Skip to content

Commit 9f053b0

Browse files
committed
Mesh: Minor fixes on the Constant buffer
1 parent 76592da commit 9f053b0

File tree

1 file changed

+2
-3
lines changed
  • src/private/Core/GameObject/Component

1 file changed

+2
-3
lines changed

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,11 @@ void Mesh::InitConstantBuffer() {
112112

113113
void Mesh::UpdateConstantBuffer() {
114114
UINT nWVPSize = (sizeof(this->m_wvp) + 255) & ~255;
115-
this->m_wvp.World = XMMatrixTranspose(XMMatrixIdentity() * XMMatrixTranslation(this->m_transform.location.x, this->m_transform.location.y, this->m_transform.location.z));
115+
this->m_wvp.World = XMMatrixTranspose(XMMatrixIdentity());
116116
this->m_wvp.World *= XMMatrixTranspose(XMMatrixRotationX(XMConvertToRadians(this->m_transform.rotation.x)));
117117
this->m_wvp.World *= XMMatrixTranspose(XMMatrixRotationY(XMConvertToRadians(this->m_transform.rotation.y)));
118118
this->m_wvp.World *= XMMatrixTranspose(XMMatrixRotationZ(XMConvertToRadians(this->m_transform.rotation.z)));
119+
this->m_wvp.World *= XMMatrixTranspose(XMMatrixTranslation(this->m_transform.location.x, this->m_transform.location.y, this->m_transform.location.z));
119120

120121
Transform cameraTransform = this->m_sceneMgr->GetCurrentScene()->GetCurrentCamera()->transform;
121122
this->m_wvp.View = XMMatrixTranspose(XMMatrixIdentity());
@@ -125,8 +126,6 @@ void Mesh::UpdateConstantBuffer() {
125126
this->m_wvp.View *= XMMatrixTranspose(XMMatrixTranslation(cameraTransform.location.x, cameraTransform.location.y, cameraTransform.location.z));
126127

127128

128-
//this->m_wvp.Projection = XMMatrixTranspose(XMMatrixPerspectiveLH(XMConvertToRadians(90.f), static_cast<float>(nWidth) / static_cast<float>(nHeight), 0.01f, 3000.f));
129-
130129
PVOID pData;
131130
ThrowIfFailed(this->m_wvpRes->Map(0, nullptr, &pData));
132131
memcpy(pData, &this->m_wvp, nWVPSize);

0 commit comments

Comments
 (0)