From fd0ae3aa25e64f9451cd56ddfdb7ae48ea8873a7 Mon Sep 17 00:00:00 2001 From: StratiX0 Date: Tue, 2 Apr 2024 12:58:28 +0200 Subject: [PATCH] 2eme cube test + lock vertical camera --- enginecustom/applicationclass.cpp | 19 +++++++++++++++++++ enginecustom/inputclass.cpp | 4 ++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/enginecustom/applicationclass.cpp b/enginecustom/applicationclass.cpp index cd32c19..539bb69 100644 --- a/enginecustom/applicationclass.cpp +++ b/enginecustom/applicationclass.cpp @@ -780,6 +780,25 @@ bool ApplicationClass::Render(float rotation, float x, float y, float z) return false; } + scaleMatrix = XMMatrixScaling(1.0f, 1.0f, 1.0f); // Build the scaling matrix. + rotateMatrix = XMMatrixRotationY(40); // Build the rotation matrix. + translateMatrix = XMMatrixTranslation(0, 5.0f, -10.0f); // Build the translation matrix. + + // Multiply the scale, rotation, and translation matrices together to create the final world transformation matrix. + srMatrix = XMMatrixMultiply(scaleMatrix, rotateMatrix); + worldMatrix = XMMatrixMultiply(srMatrix, translateMatrix); + + // Render the model using the multitexture shader. + m_Model->Render(m_Direct3D->GetDeviceContext()); + + //Normal Mapping + result = m_NormalMapShader->Render(m_Direct3D->GetDeviceContext(), m_Model->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix, + m_Model->GetTexture(0), m_Model->GetTexture(1), m_Light->GetDirection(), m_Light->GetDiffuseColor()); + if (!result) + { + return false; + } + // Enable the Z buffer and disable alpha blending now that 2D rendering is complete. m_Direct3D->TurnZBufferOn(); m_Direct3D->DisableAlphaBlending(); diff --git a/enginecustom/inputclass.cpp b/enginecustom/inputclass.cpp index c69a6d5..5dd3f40 100644 --- a/enginecustom/inputclass.cpp +++ b/enginecustom/inputclass.cpp @@ -236,10 +236,10 @@ void InputClass::ProcessInput() //// Ensure the mouse location doesn't exceed the screen width or height. //if (m_mouseX < 0) { m_mouseX = 0; } - //if (m_mouseY < 0) { m_mouseY = 0; } + if (m_mouseY < -m_screenHeight) { m_mouseY = -m_screenHeight; } //if (m_mouseX > m_screenWidth) { m_mouseX = m_screenWidth; } - //if (m_mouseY > m_screenHeight) { m_mouseY = m_screenHeight; } + if (m_mouseY > m_screenHeight) { m_mouseY = m_screenHeight; } return; }