camera yaw and pitch
This commit is contained in:
@@ -97,8 +97,15 @@ void Renderer::SetCamMovement(const Vec2f& mov) {
|
||||
}
|
||||
|
||||
void Renderer::SetCamPos(const Vec3f& newPos) {
|
||||
|
||||
Vec3f front = {
|
||||
std::cos(m_Camera.m_Yaw) * std::cos(m_Camera.m_Pitch),
|
||||
std::sin(m_Camera.m_Pitch),
|
||||
std::sin(m_Camera.m_Yaw) * std::cos(m_Camera.m_Pitch)
|
||||
};
|
||||
|
||||
m_Camera.CamPos = newPos;
|
||||
m_Camera.viewMatrix = maths::Look(m_Camera.CamPos, {0, -1, -0.000000001}, {0, 1, 0});
|
||||
m_Camera.viewMatrix = maths::Look(m_Camera.CamPos, front, {0, 1, 0});
|
||||
m_Camera.InvViewMatrix = maths::Inverse(m_Camera.viewMatrix);
|
||||
m_WorldShader->Start();
|
||||
m_WorldShader->SetViewMatrix(m_Camera.viewMatrix);
|
||||
|
||||
Reference in New Issue
Block a user