Skip to main content
← PSoXide SDK guides and examples · SDK f2fec1c301f1 · All Cargo features enabled; check feature gates before use.

lerp_q16_i32_exact

Function lerp_q16_i32_exact 

Source
pub fn lerp_q16_i32_exact(first: i32, second: i32, fraction_q16: u32) -> i32
Expand description

Exact first + (second - first) * fraction / 65536, truncating toward negative infinity like a shift, in 32-bit operations.

The product is split so nothing exceeds i32 for |second - first| below 2^23: enough for i16 positions and screen coordinates, byte attributes and Q12 depths, which is everything a clipped world vertex carries.