send bilerp upstream to spawn
parent
b0d7e38b2f
commit
dd9af334a9
|
@ -14,3 +14,5 @@ USING: math.vectors tools.test ;
|
|||
[ { 1.75 1.75 } ] [ { 1.0 2.5 } { 2.5 1.0 } 0.5 vnlerp ] unit-test
|
||||
|
||||
[ { 1.75 2.125 } ] [ { 1.0 2.5 } { 2.5 1.0 } { 0.5 0.25 } vlerp ] unit-test
|
||||
|
||||
[ 1.125 ] [ 0.0 1.0 2.0 4.0 { 0.5 0.25 } bilerp ] unit-test
|
||||
|
|
|
@ -41,6 +41,10 @@ IN: math.vectors
|
|||
: set-axis ( u v axis -- w )
|
||||
[ [ zero? 2over ? ] dip swap nth ] map-index 2nip ;
|
||||
|
||||
: bilerp ( aa ba ab bb {t,u} -- a_tu )
|
||||
[ first lerp ] [ second lerp ] bi-curry
|
||||
[ 2bi@ ] [ call ] bi* ;
|
||||
|
||||
: vlerp ( a b t -- a_t )
|
||||
[ lerp ] 3map ;
|
||||
|
||||
|
|
|
@ -155,7 +155,7 @@ TUPLE: terrain-world < world
|
|||
pixel dim pixel-indices :> indices
|
||||
|
||||
indices [ pixels nth COMPONENT-SCALE v. 255.0 / ] map
|
||||
first4 [ pixel-mantissa first lerp ] 2bi@ pixel-mantissa second lerp ;
|
||||
first4 pixel-mantissa bilerp ;
|
||||
|
||||
: collide ( segment location -- location' )
|
||||
[ [ first ] [ third ] bi 2array terrain-height-at PLAYER-HEIGHT + ]
|
||||
|
|
Loading…
Reference in New Issue