more camera movement
This commit is contained in:
@@ -9,6 +9,21 @@ namespace
|
||||
Game::GameInstance* GameInst = nullptr;
|
||||
} // namespace
|
||||
|
||||
void Vec2::Normalize()
|
||||
{
|
||||
float len = bx::sqrt(X * X + Y * Y);
|
||||
X /= len;
|
||||
Y /= len;
|
||||
}
|
||||
|
||||
void Vec3::Normalize()
|
||||
{
|
||||
float len = bx::sqrt(X * X + Y * Y + Z * Z);
|
||||
X /= len;
|
||||
Y /= len;
|
||||
Z /= len;
|
||||
}
|
||||
|
||||
Quat Quat::FromEuler(float x, float y, float z)
|
||||
{
|
||||
x *= bx::kPi / 180.0f;
|
||||
@@ -47,13 +62,23 @@ void Mat4::CreateTransform(float* out, Vec3 pos, Quat rot, Vec3 scale)
|
||||
bx::mtxMul(out, buf, tMat);
|
||||
}
|
||||
|
||||
void Mat4::Translate(Vec3 offset)
|
||||
void Mat4::TranslateLocal(Vec3 offset)
|
||||
{
|
||||
M[12] += offset.X;
|
||||
M[13] += offset.Y;
|
||||
M[14] += offset.Z;
|
||||
}
|
||||
|
||||
void Mat4::Rotate(Vec3 rotation)
|
||||
{
|
||||
float rot[16]{0};
|
||||
bx::mtxRotateXYZ(rot, rotation.X, rotation.Y, rotation.Z);
|
||||
float temp[16]{0};
|
||||
bx::mtxMul(temp, M, rot);
|
||||
for (int32_t i = 0; i < 16; ++i)
|
||||
M[i] = temp[i];
|
||||
}
|
||||
|
||||
Vec3 Mat4::Right()
|
||||
{
|
||||
return {M[0], M[1], M[2]};
|
||||
|
||||
Reference in New Issue
Block a user