Skip to content

Commit 9a73b71

Browse files
committed
[MIN] lerp correction
1 parent 29bff60 commit 9a73b71

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

vm.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -819,6 +819,8 @@ VM_API VM_INLINE float vm_v3_length(v3 a)
819819

820820
VM_API VM_INLINE v3 vm_v3_lerp(v3 a, v3 b, float t)
821821
{
822+
v3 result;
823+
822824
if (t <= 0.0f)
823825
{
824826
return a;
@@ -835,18 +837,14 @@ VM_API VM_INLINE v3 vm_v3_lerp(v3 a, v3 b, float t)
835837
__m128 sub_vec = _mm_sub_ps(b_vec, a_vec);
836838
__m128 mul_vec = _mm_mul_ps(sub_vec, t_vec);
837839
__m128 result_vec = _mm_add_ps(mul_vec, a_vec);
838-
v3 result;
839840
_mm_storeu_ps((float *)&result, result_vec);
840-
return result;
841841
#else
842-
v3 result;
843-
844842
result.x = ((b.x - a.x) * t) + a.x;
845843
result.y = ((b.y - a.y) * t) + a.y;
846844
result.z = ((b.z - a.z) * t) + a.z;
845+
#endif
847846

848847
return (result);
849-
#endif
850848
}
851849

852850
VM_API VM_INLINE float vm_v3_length_manhatten(v3 start, v3 end, float unit)

0 commit comments

Comments
 (0)