소스 검색

lerp for vector2 and float

pull/633/head
Oğuzhan Çankaya 6 년 전
committed by GitHub
부모
커밋
2bef76735d
No known key found for this signature in database GPG 키 ID: 4AEE18F83AFDEB23
1개의 변경된 파일17개의 추가작업 그리고 0개의 파일을 삭제
  1. +17
    -0
      src/raymath.h

+ 17
- 0
src/raymath.h 파일 보기

@ -155,6 +155,12 @@ RMDEF float Clamp(float value, float min, float max)
return res > max ? max : res;
}
// Calculate linear interpolation between two vectors
RMDEF float Lerp(float start, float end, float amount)
{
return start + amount*(end - start);
}
//----------------------------------------------------------------------------------
// Module Functions Definition - Vector2 math
//----------------------------------------------------------------------------------
@ -244,6 +250,17 @@ RMDEF Vector2 Vector2Normalize(Vector2 v)
return result;
}
// Calculate linear interpolation between two vectors
RMDEF Vector2 Vector2Lerp(Vector2 v1, Vector2 v2, float amount)
{
Vector2 result = { 0 };
result.x = v1.x + amount*(v2.x - v1.x);
result.y = v1.y + amount*(v2.y - v1.y);
return result;
}
//----------------------------------------------------------------------------------
// Module Functions Definition - Vector3 math
//----------------------------------------------------------------------------------

불러오는 중...
취소
저장