Skip to content

Commit b7e5b2a

Browse files
committed
Mesh: Corrected View Rotations.
1 parent 0a18098 commit b7e5b2a

File tree

1 file changed

+4
-4
lines changed
  • src/private/Core/GameObject/Component

1 file changed

+4
-4
lines changed

src/private/Core/GameObject/Component/Mesh.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ void Mesh::Init() {
3939
Component::Init();
4040
Transform cameraTransform = this->m_sceneMgr->GetCurrentScene()->GetCurrentCamera()->transform;
4141
this->m_wvp.View = XMMatrixTranspose(XMMatrixIdentity());
42-
this->m_wvp.View *= XMMatrixTranspose(XMMatrixTranslation(cameraTransform.location.x, cameraTransform.location.y, cameraTransform.location.z));
43-
4442
this->m_wvp.View *= XMMatrixTranspose(XMMatrixRotationX(XMConvertToRadians(cameraTransform.rotation.x)));
4543
this->m_wvp.View *= XMMatrixTranspose(XMMatrixRotationY(XMConvertToRadians(cameraTransform.rotation.y)));
4644
this->m_wvp.View *= XMMatrixTranspose(XMMatrixRotationZ(XMConvertToRadians(cameraTransform.rotation.z)));
45+
this->m_wvp.View *= XMMatrixTranspose(XMMatrixTranslation(cameraTransform.location.x, cameraTransform.location.y, cameraTransform.location.z));
46+
4747

4848
if (D3D12* d3d12 = dynamic_cast<D3D12*>(this->m_renderer)) {
4949
this->D3D12Init(d3d12);
@@ -119,11 +119,11 @@ void Mesh::UpdateConstantBuffer() {
119119

120120
Transform cameraTransform = this->m_sceneMgr->GetCurrentScene()->GetCurrentCamera()->transform;
121121
this->m_wvp.View = XMMatrixTranspose(XMMatrixIdentity());
122-
this->m_wvp.View *= XMMatrixTranspose(XMMatrixTranslation(cameraTransform.location.x, cameraTransform.location.y, cameraTransform.location.z));
123-
124122
this->m_wvp.View *= XMMatrixTranspose(XMMatrixRotationX(XMConvertToRadians(cameraTransform.rotation.x)));
125123
this->m_wvp.View *= XMMatrixTranspose(XMMatrixRotationY(XMConvertToRadians(cameraTransform.rotation.y)));
126124
this->m_wvp.View *= XMMatrixTranspose(XMMatrixRotationZ(XMConvertToRadians(cameraTransform.rotation.z)));
125+
this->m_wvp.View *= XMMatrixTranspose(XMMatrixTranslation(cameraTransform.location.x, cameraTransform.location.y, cameraTransform.location.z));
126+
127127

128128
//this->m_wvp.Projection = XMMatrixTranspose(XMMatrixPerspectiveLH(XMConvertToRadians(90.f), static_cast<float>(nWidth) / static_cast<float>(nHeight), 0.01f, 3000.f));
129129

0 commit comments

Comments
 (0)