Added Matrix4::Identity(), Added Lerp (scalar.h)

This commit is contained in:
2018-03-19 17:28:31 -07:00
parent 62670af728
commit 1e2c597fb6
4 changed files with 14 additions and 0 deletions

View File

@@ -107,6 +107,7 @@ public:
static Matrix4 Translation(const Vector3 &v); static Matrix4 Translation(const Vector3 &v);
static Matrix4 Rotation(const Vector3 &v); static Matrix4 Rotation(const Vector3 &v);
static Matrix4 Scaling(const Vector3 &v); static Matrix4 Scaling(const Vector3 &v);
static Matrix4 Identity();
}; };
static_assert(std::is_pod<Matrix4>::value, "kraken::Matrix4 must be a POD type."); static_assert(std::is_pod<Matrix4>::value, "kraken::Matrix4 must be a POD type.");

View File

@@ -35,6 +35,7 @@
namespace kraken { namespace kraken {
float SmoothStep(float a, float b, float t); float SmoothStep(float a, float b, float t);
float Lerp(float a, float b, float t);
}; // namespace kraken }; // namespace kraken

View File

@@ -441,5 +441,12 @@ Matrix4 Matrix4::Scaling(const Vector3 &v)
return m; return m;
} }
Matrix4 Matrix4::Identity()
{
Matrix4 m;
m.init();
return m;
}
} // namespace kraken } // namespace kraken

View File

@@ -39,4 +39,9 @@ float SmoothStep(float a, float b, float t)
return a * (1.0f - d) + b * d; return a * (1.0f - d) + b * d;
} }
float Lerp(float a, float b, float t)
{
return (a + (b - a) * t);
}
} // namespace kraken } // namespace kraken