diff --git a/README.md b/README.md index 50e50f8..9741747 100644 --- a/README.md +++ b/README.md @@ -48,8 +48,6 @@ This **DirectX11** based engine uses **ImGui** with an abstraction layer to enab - **Water** - **Refraction** - *Reflection (cassé / broken)* - - *Glace (cassé / broken)* - - *Verre (cassé / broken)* *Plus de shaders seront disponibles dans le futur* diff --git a/enginecustom/Colorshaderclass.cpp b/enginecustom/Colorshaderclass.cpp index 5447f69..e62c100 100644 --- a/enginecustom/Colorshaderclass.cpp +++ b/enginecustom/Colorshaderclass.cpp @@ -23,7 +23,7 @@ ColorShaderClass::~ColorShaderClass() bool ColorShaderClass::Initialize(ID3D11Device* device, HWND hwnd) { - Logger::Get().Log("Initializing ColorShaderClass", __FILE__, __LINE__); + Logger::Get().Log("Initializing ColorShaderClass", __FILE__, __LINE__, Logger::LogLevel::Initialize); bool result; wchar_t vsFilename[128]; @@ -55,7 +55,7 @@ bool ColorShaderClass::Initialize(ID3D11Device* device, HWND hwnd) return false; } - Logger::Get().Log("ColorShaderClass initialized", __FILE__, __LINE__); + Logger::Get().Log("ColorShaderClass initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize); return true; } @@ -90,7 +90,7 @@ bool ColorShaderClass::Render(ID3D11DeviceContext* deviceContext, int indexCount bool ColorShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR* vsFilename, WCHAR* psFilename) { - Logger::Get().Log("Initializing shader", __FILE__, __LINE__); + Logger::Get().Log("Initializing shader", __FILE__, __LINE__, Logger::LogLevel::Initialize); HRESULT result; ID3D10Blob* errorMessage; @@ -213,41 +213,49 @@ bool ColorShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR* return false; } - Logger::Get().Log("Shader initialized", __FILE__, __LINE__); + Logger::Get().Log("Shader initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize); return true; } void ColorShaderClass::ShutdownShader() { - Logger::Get().Log("Shutting down shader", __FILE__, __LINE__); + Logger::Get().Log("Shutting down shader", __FILE__, __LINE__, Logger::LogLevel::Shutdown); // Release the matrix constant buffer. if (m_matrixBuffer) { + Logger::Get().Log("Releasing matrix buffer", __FILE__, __LINE__, Logger::LogLevel::Shutdown); m_matrixBuffer->Release(); m_matrixBuffer = 0; + Logger::Get().Log("Matrix buffer released", __FILE__, __LINE__, Logger::LogLevel::Shutdown); } // Release the layout. if (m_layout) { + Logger::Get().Log("Releasing layout", __FILE__, __LINE__, Logger::LogLevel::Shutdown); m_layout->Release(); m_layout = 0; + Logger::Get().Log("Layout released", __FILE__, __LINE__, Logger::LogLevel::Shutdown); } // Release the pixel shader. if (m_pixelShader) { + Logger::Get().Log("Releasing pixel shader", __FILE__, __LINE__, Logger::LogLevel::Shutdown); m_pixelShader->Release(); m_pixelShader = 0; + Logger::Get().Log("Pixel shader released", __FILE__, __LINE__, Logger::LogLevel::Shutdown); } // Release the vertex shader. if (m_vertexShader) { + Logger::Get().Log("Releasing vertex shader", __FILE__, __LINE__, Logger::LogLevel::Shutdown); m_vertexShader->Release(); m_vertexShader = 0; + Logger::Get().Log("Vertex shader released", __FILE__, __LINE__, Logger::LogLevel::Shutdown); } Logger::Get().Log("Shader shut down", __FILE__, __LINE__); diff --git a/enginecustom/Lightshaderclass.cpp b/enginecustom/Lightshaderclass.cpp index 9fc289d..6f76143 100644 --- a/enginecustom/Lightshaderclass.cpp +++ b/enginecustom/Lightshaderclass.cpp @@ -30,7 +30,7 @@ LightShaderClass::~LightShaderClass() bool LightShaderClass::Initialize(ID3D11Device* device, HWND hwnd) { - Logger::Get().Log("Initializing LightShaderClass", __FILE__, __LINE__); + Logger::Get().Log("Initializing LightShaderClass", __FILE__, __LINE__, Logger::LogLevel::Initialize); wchar_t vsFilename[128]; wchar_t psFilename[128]; @@ -60,7 +60,7 @@ bool LightShaderClass::Initialize(ID3D11Device* device, HWND hwnd) return false; } - Logger::Get().Log("LightShaderClass initialized", __FILE__, __LINE__); + Logger::Get().Log("LightShaderClass initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize); return true; } @@ -97,6 +97,8 @@ bool LightShaderClass::Render(ID3D11DeviceContext* deviceContext, int indexCount bool LightShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR* vsFilename, WCHAR* psFilename) { + Logger::Get().Log("Initializing shader", __FILE__, __LINE__, Logger::LogLevel::Initialize); + HRESULT result; ID3D10Blob* errorMessage; ID3D10Blob* vertexShaderBuffer; @@ -301,7 +303,7 @@ bool LightShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR* return false; } - Logger::Get().Log("Shader initialized", __FILE__, __LINE__); + Logger::Get().Log("Shader initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize); return true; } @@ -309,7 +311,7 @@ bool LightShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR* void LightShaderClass::ShutdownShader() { - Logger::Get().Log("Shutting down LightShaderClass", __FILE__, __LINE__); + Logger::Get().Log("Shutting down LightShaderClass", __FILE__, __LINE__, Logger::LogLevel::Shutdown); // Release the light constant buffers. if (m_lightColorBuffer) @@ -373,7 +375,7 @@ void LightShaderClass::ShutdownShader() m_vertexShader = 0; } - Logger::Get().Log("LightShaderClass shut down", __FILE__, __LINE__); + Logger::Get().Log("LightShaderClass shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown); return; } @@ -475,10 +477,10 @@ bool LightShaderClass::SetShaderParameters(ID3D11DeviceContext* deviceContext, X dataPtr2 = (LightPositionBufferType*)mappedResource.pData; // Copy the light position variables into the constant buffer. - dataPtr2->lightPosition[0] = lightPosition[0]; - dataPtr2->lightPosition[1] = lightPosition[1]; - dataPtr2->lightPosition[2] = lightPosition[2]; - dataPtr2->lightPosition[3] = lightPosition[3]; + for (int i = 0; i < NUM_LIGHTS; i++) + { + dataPtr2->lightPosition[i] = lightPosition[i]; + } // Unlock the constant buffer. deviceContext->Unmap(m_lightPositionBuffer, 0); @@ -504,10 +506,10 @@ bool LightShaderClass::SetShaderParameters(ID3D11DeviceContext* deviceContext, X dataPtr3 = (LightColorBufferType*)mappedResource.pData; // Copy the light color variables into the constant buffer. - dataPtr3->diffuseColor[0] = diffuseColor[0]; - dataPtr3->diffuseColor[1] = diffuseColor[1]; - dataPtr3->diffuseColor[2] = diffuseColor[2]; - dataPtr3->diffuseColor[3] = diffuseColor[3]; + for (int i = 0; i < NUM_LIGHTS; i++) + { + dataPtr3->diffuseColor[i] = diffuseColor[i]; + } // Unlock the constant buffer. deviceContext->Unmap(m_lightColorBuffer, 0); diff --git a/enginecustom/Lightshaderclass.h b/enginecustom/Lightshaderclass.h index 03e62f3..dd45b3d 100644 --- a/enginecustom/Lightshaderclass.h +++ b/enginecustom/Lightshaderclass.h @@ -9,7 +9,6 @@ // GLOBALS // ///////////// const int NUM_LIGHTS = 4; - ////////////// // INCLUDES // ////////////// @@ -88,7 +87,6 @@ private: ID3D11Buffer* m_lightBuffer; ID3D11Buffer* m_lightColorBuffer; ID3D11Buffer* m_lightPositionBuffer; - }; #endif \ No newline at end of file diff --git a/enginecustom/Logger.h b/enginecustom/Logger.h index bd1e35f..2486fc7 100644 --- a/enginecustom/Logger.h +++ b/enginecustom/Logger.h @@ -24,7 +24,20 @@ public: { Info, Warning, - Error + Error, + Shutdown, + Initialize, + Update, + Render, + Input, + Physics, + Audio, + Network, + Scripting, + AI, + Resource, + Memory, + Debug }; Logger() @@ -72,6 +85,46 @@ public: case LogLevel::Info: levelStr = "INFO"; break; + case LogLevel::Shutdown: + levelStr = "SHUTDOWN"; + break; + case LogLevel::Initialize: + levelStr = "INITIALIZE"; + break; + case LogLevel::Update: + levelStr = "UPDATE"; + break; + case LogLevel::Render: + levelStr = "RENDER"; + break; + case LogLevel::Input: + levelStr = "INPUT"; + break; + case LogLevel::Physics: + levelStr = "PHYSICS"; + break; + case LogLevel::Audio: + levelStr = "AUDIO"; + break; + case LogLevel::Network: + levelStr = "NETWORK"; + break; + case LogLevel::Scripting: + levelStr = "SCRIPTING"; + break; + case LogLevel::AI: + levelStr = "AI"; + break; + case LogLevel::Resource: + levelStr = "RESOURCE"; + break; + case LogLevel::Memory: + levelStr = "MEMORY"; + break; + case LogLevel::Debug: + levelStr = "DEBUG"; + break; + } std::stringstream ss; diff --git a/enginecustom/Main.cpp b/enginecustom/Main.cpp index 3c3d8d6..f470c5a 100644 --- a/enginecustom/Main.cpp +++ b/enginecustom/Main.cpp @@ -13,7 +13,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR pScmdline, result = System->Initialize(); if (result) { - Logger::Get().Log("System initialized", __FILE__, __LINE__); + Logger::Get().Log("System initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize); System->Run(); } diff --git a/enginecustom/Modellistclass.cpp b/enginecustom/Modellistclass.cpp index ae3b3f2..ea52799 100644 --- a/enginecustom/Modellistclass.cpp +++ b/enginecustom/Modellistclass.cpp @@ -19,6 +19,7 @@ ModelListClass::~ModelListClass() void ModelListClass::Initialize(int numModels) { + int i; // Store the number of models. diff --git a/enginecustom/Multitextureshaderclass.cpp b/enginecustom/Multitextureshaderclass.cpp index c6ff3d6..d37c616 100644 --- a/enginecustom/Multitextureshaderclass.cpp +++ b/enginecustom/Multitextureshaderclass.cpp @@ -26,7 +26,7 @@ MultiTextureShaderClass::~MultiTextureShaderClass() bool MultiTextureShaderClass::Initialize(ID3D11Device* device, HWND hwnd) { - Logger::Get().Log("Initializing MultiTextureShaderClass", __FILE__, __LINE__); + Logger::Get().Log("Initializing MultiTextureShaderClass", __FILE__, __LINE__, Logger::LogLevel::Initialize); bool result; wchar_t vsFilename[128]; @@ -57,6 +57,8 @@ bool MultiTextureShaderClass::Initialize(ID3D11Device* device, HWND hwnd) return false; } + Logger::Get().Log("MultiTextureShaderClass initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize); + return true; } @@ -90,7 +92,7 @@ bool MultiTextureShaderClass::Render(ID3D11DeviceContext* deviceContext, int ind bool MultiTextureShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR* vsFilename, WCHAR* psFilename) { - Logger::Get().Log("Initializing the shader", __FILE__, __LINE__); + Logger::Get().Log("Initializing the shader", __FILE__, __LINE__, Logger::LogLevel::Initialize); HRESULT result; ID3D10Blob* errorMessage; @@ -244,14 +246,14 @@ bool MultiTextureShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, return false; } - Logger::Get().Log("Shader initialized", __FILE__, __LINE__); + Logger::Get().Log("Shader initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize); return true; } void MultiTextureShaderClass::ShutdownShader() { - Logger::Get().Log("Shutting down the shader", __FILE__, __LINE__); + Logger::Get().Log("Shutting down the shader", __FILE__, __LINE__, Logger::LogLevel::Shutdown); // Release the sampler state. if (m_sampleState) @@ -288,7 +290,7 @@ void MultiTextureShaderClass::ShutdownShader() m_vertexShader = 0; } - Logger::Get().Log("Shader shut down", __FILE__, __LINE__); + Logger::Get().Log("Shader shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown); return; } diff --git a/enginecustom/Systemclass.cpp b/enginecustom/Systemclass.cpp index f6b0b9c..95a6451 100644 --- a/enginecustom/Systemclass.cpp +++ b/enginecustom/Systemclass.cpp @@ -25,7 +25,7 @@ bool SystemClass::Initialize() int screenWidth, screenHeight; bool result; - Logger::Get().Log("Initializing system class", __FILE__, __LINE__); + Logger::Get().Log("Initializing system class", __FILE__, __LINE__, Logger::LogLevel::Initialize); try { @@ -81,50 +81,50 @@ bool SystemClass::Initialize() return false; } - Logger::Get().Log("System class initialized", __FILE__, __LINE__); + Logger::Get().Log("System class initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize); return true; } void SystemClass::Shutdown() { - Logger::Get().Log("Shutting down system class", __FILE__, __LINE__); + Logger::Get().Log("Shutting down system class", __FILE__, __LINE__, Logger::LogLevel::Shutdown); std::lock_guard guard(renderMutex); // Shutdown imgui if (m_imguiManager) { - Logger::Get().Log("Shutting down imgui manager", __FILE__, __LINE__); + Logger::Get().Log("Shutting down imgui manager", __FILE__, __LINE__, Logger::LogLevel::Shutdown); m_imguiManager->Shutdown(); delete m_imguiManager; m_imguiManager = 0; - Logger::Get().Log("Imgui manager shut down", __FILE__, __LINE__); + Logger::Get().Log("Imgui manager shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown); } // Release the application class object. if (m_Application) { - Logger::Get().Log("Shutting down application", __FILE__, __LINE__); + Logger::Get().Log("Shutting down application", __FILE__, __LINE__, Logger::LogLevel::Shutdown); m_Application->Shutdown(); delete m_Application; m_Application = 0; - Logger::Get().Log("Application shut down", __FILE__, __LINE__); + Logger::Get().Log("Application shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown); } // Release the input object. if (m_Input) { - Logger::Get().Log("Shutting down input", __FILE__, __LINE__); + Logger::Get().Log("Shutting down input", __FILE__, __LINE__, Logger::LogLevel::Shutdown); delete m_Input; m_Input = 0; - Logger::Get().Log("Input shut down", __FILE__, __LINE__); + Logger::Get().Log("Input shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown); } @@ -132,7 +132,7 @@ void SystemClass::Shutdown() // Shutdown the window. ShutdownWindows(); - Logger::Get().Log("System class shut down", __FILE__, __LINE__); + Logger::Get().Log("System class shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown); return; } @@ -189,6 +189,8 @@ void SystemClass::Run() bool SystemClass::Frame() { + // Clear the buffers to begin the scene. + m_Application->GetDirect3D()->BeginScene(0.0f, 0.0f, 0.0f, 1.0f); std::lock_guard guard(renderMutex); bool result; @@ -201,6 +203,14 @@ bool SystemClass::Frame() return false; } + // Do the frame processing for the application class object. + result = m_Application->Frame(m_Input); + if (!result) + { + Logger::Get().Log("Failed to process application frame", __FILE__, __LINE__, Logger::LogLevel::Error); + return false; + } + // Render ImGui result = m_imguiManager->ImGuiWidgetRenderer(m_Application); if (!result) @@ -209,13 +219,7 @@ bool SystemClass::Frame() return false; } - // Do the frame processing for the application class object. - result = m_Application->Frame(m_Input); - if (!result) - { - Logger::Get().Log("Failed to process application frame", __FILE__, __LINE__, Logger::LogLevel::Error); - return false; - } + m_Application->GetDirect3D()->EndScene(); return true; } @@ -324,7 +328,7 @@ void SystemClass::InitializeWindows(int& screenWidth, int& screenHeight) DEVMODE dmScreenSettings; int posX, posY; - Logger::Get().Log("Initializing windows", __FILE__, __LINE__); + Logger::Get().Log("Initializing windows", __FILE__, __LINE__, Logger::LogLevel::Initialize); // Get an external pointer to this object. ApplicationHandle = this; @@ -404,10 +408,7 @@ void SystemClass::InitializeWindows(int& screenWidth, int& screenHeight) void SystemClass::ShutdownWindows() { - - Logger::Get().Log("Shutting down windows", __FILE__, __LINE__); - - Logger::Get().Log("Shutting down the windows", __FILE__, __LINE__); + Logger::Get().Log("Shutting down the windows", __FILE__, __LINE__, Logger::LogLevel::Shutdown); // Show the mouse cursor. ShowCursor(true); diff --git a/enginecustom/Timerclass.cpp b/enginecustom/Timerclass.cpp index 3237e7d..2e5a08b 100644 --- a/enginecustom/Timerclass.cpp +++ b/enginecustom/Timerclass.cpp @@ -17,7 +17,7 @@ TimerClass::~TimerClass() bool TimerClass::Initialize() { - Logger::Get().Log("Initilazing timer class", __FILE__, __LINE__); + Logger::Get().Log("Initilazing timer class", __FILE__, __LINE__, Logger::LogLevel::Initialize); INT64 frequency; @@ -36,6 +36,8 @@ bool TimerClass::Initialize() // Get the initial start time. QueryPerformanceCounter((LARGE_INTEGER*)&m_startTime); + Logger::Get().Log("Timer class initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize); + return true; } diff --git a/enginecustom/alphamapshaderclass.cpp b/enginecustom/alphamapshaderclass.cpp index 297b1f6..cbf697a 100644 --- a/enginecustom/alphamapshaderclass.cpp +++ b/enginecustom/alphamapshaderclass.cpp @@ -23,7 +23,7 @@ AlphaMapShaderClass::~AlphaMapShaderClass() bool AlphaMapShaderClass::Initialize(ID3D11Device* device, HWND hwnd) { - Logger::Get().Log("Initializing AlphaMapShaderClass", __FILE__, __LINE__); + Logger::Get().Log("Initializing AlphaMapShaderClass", __FILE__, __LINE__, Logger::LogLevel::Initialize); bool result; wchar_t vsFilename[128]; @@ -77,6 +77,7 @@ bool AlphaMapShaderClass::Render(ID3D11DeviceContext* deviceContext, int indexCo result = SetShaderParameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix, texture1, texture2, texture3); if (!result) { + Logger::Get().Log("Error setting shader parameters", __FILE__, __LINE__, Logger::LogLevel::Error); return false; } @@ -89,7 +90,7 @@ bool AlphaMapShaderClass::Render(ID3D11DeviceContext* deviceContext, int indexCo bool AlphaMapShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR* vsFilename, WCHAR* psFilename) { - Logger::Get().Log("Initializing shader", __FILE__, __LINE__); + Logger::Get().Log("Initializing shader", __FILE__, __LINE__, Logger::LogLevel::Initialize); HRESULT result; ID3D10Blob* errorMessage; @@ -243,7 +244,7 @@ bool AlphaMapShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHA return false; } - Logger::Get().Log("Shader initialized", __FILE__, __LINE__); + Logger::Get().Log("Shader initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize); return true; } @@ -252,44 +253,54 @@ bool AlphaMapShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHA void AlphaMapShaderClass::ShutdownShader() { - Logger::Get().Log("Shutting down shader", __FILE__, __LINE__); + Logger::Get().Log("Shutting down shader", __FILE__, __LINE__, Logger::LogLevel::Shutdown); // Release the sampler state. if (m_sampleState) { + Logger::Get().Log("Releasing sampler state", __FILE__, __LINE__, Logger::LogLevel::Shutdown); m_sampleState->Release(); m_sampleState = 0; + Logger::Get().Log("Sampler state released", __FILE__, __LINE__, Logger::LogLevel::Shutdown); } // Release the matrix constant buffer. if (m_matrixBuffer) { + Logger::Get().Log("Releasing constant buffer", __FILE__, __LINE__, Logger::LogLevel::Shutdown); m_matrixBuffer->Release(); m_matrixBuffer = 0; + Logger::Get().Log("Constant buffer released", __FILE__, __LINE__, Logger::LogLevel::Shutdown); } // Release the layout. if (m_layout) { + Logger::Get().Log("Releasing layout", __FILE__, __LINE__, Logger::LogLevel::Shutdown); m_layout->Release(); m_layout = 0; + Logger::Get().Log("Layout released", __FILE__, __LINE__, Logger::LogLevel::Shutdown); } // Release the pixel shader. if (m_pixelShader) { + Logger::Get().Log("Releasing pixel shader", __FILE__, __LINE__, Logger::LogLevel::Shutdown); m_pixelShader->Release(); m_pixelShader = 0; + Logger::Get().Log("Pixel shader released", __FILE__, __LINE__, Logger::LogLevel::Shutdown); } // Release the vertex shader. if (m_vertexShader) { + Logger::Get().Log("Releasing vertex shader", __FILE__, __LINE__, Logger::LogLevel::Shutdown); m_vertexShader->Release(); m_vertexShader = 0; + Logger::Get().Log("Vertex shader released", __FILE__, __LINE__, Logger::LogLevel::Shutdown); } - Logger::Get().Log("Shader shutdown complete", __FILE__, __LINE__); + Logger::Get().Log("Shader shutdown complete", __FILE__, __LINE__, Logger::LogLevel::Shutdown); return; } diff --git a/enginecustom/applicationclass.cpp b/enginecustom/applicationclass.cpp index 16b3207..4741d20 100644 --- a/enginecustom/applicationclass.cpp +++ b/enginecustom/applicationclass.cpp @@ -40,7 +40,7 @@ ApplicationClass::~ApplicationClass() bool ApplicationClass::Initialize(int screenWidth, int screenHeight, HWND hwnd) { - Logger::Get().Log("Initializing application class", __FILE__, __LINE__); + Logger::Get().Log("Initializing application class", __FILE__, __LINE__, Logger::LogLevel::Initialize); try { @@ -202,7 +202,6 @@ bool ApplicationClass::Initialize(int screenWidth, int screenHeight, HWND hwnd) // Set the number of lights we will use. m_numLights = 4; - // Create and initialize the light objects array. m_Lights.resize(m_numLights); @@ -214,31 +213,29 @@ bool ApplicationClass::Initialize(int screenWidth, int screenHeight, HWND hwnd) m_Lights[0]->SetSpecularPower(16.0f); m_Lights[0]->SetPosition(10.0f, 7.0f, -5.0f); - // Manually set the color and position of each light. m_Lights[1] = new LightClass; m_Lights[1]->SetDiffuseColor(1.0f, 0.0f, 0.0f, 1.0f); // Red - m_Lights[1]->SetDirection(0.0f, 0.0f, 1.0f); + m_Lights[1]->SetDirection(0.0f, 0.0f, -1.0f); m_Lights[1]->SetAmbientColor(0.15f, 0.15f, 0.15f, 1.0f); m_Lights[1]->SetSpecularColor(1.0f, 0.0f, 0.0f, 1.0f); m_Lights[1]->SetSpecularPower(16.0f); - m_Lights[1]->SetPosition(10.0f, 7.0f, -5.0f); + m_Lights[1]->SetPosition(-10.0f, 7.0f, -5.0f); m_Lights[2] = new LightClass; m_Lights[2]->SetDiffuseColor(0.0f, 1.0f, 0.0f, 1.0f); // Green - m_Lights[2]->SetDirection(0.0f, 0.0f, 1.0f); + m_Lights[2]->SetDirection(0.0f, 0.0f, -1.0f); m_Lights[2]->SetAmbientColor(0.15f, 0.15f, 0.15f, 1.0f); m_Lights[2]->SetSpecularColor(0.0f, 1.0f, 0.0f, 1.0f); m_Lights[2]->SetSpecularPower(16.0f); - m_Lights[2]->SetPosition(10.0f, 7.0f, -5.0f); + m_Lights[2]->SetPosition(10.0f, 7.0f, 5.0f); m_Lights[3] = new LightClass; m_Lights[3]->SetDiffuseColor(0.0f, 0.0f, 1.0f, 1.0f); // Blue - m_Lights[3]->SetDirection(0.0f, 0.0f, 1.0f); + m_Lights[3]->SetDirection(0.0f, 0.0f, -1.0f); m_Lights[3]->SetAmbientColor(0.15f, 0.15f, 0.15f, 1.0f); m_Lights[3]->SetSpecularColor(0.0f, 0.0f, 1.0f, 1.0f); m_Lights[3]->SetSpecularPower(16.0f); - m_Lights[3]->SetPosition(10.0f, 7.0f, -5.0f); - + m_Lights[3]->SetPosition(-10.0f, 7.0f, 5.0f); // Create and initialize the normal map shader object. m_ShaderManager = new ShaderManagerClass; @@ -361,7 +358,7 @@ bool ApplicationClass::Initialize(int screenWidth, int screenHeight, HWND hwnd) Logger::Get().Log(std::string("Exception caught during initialization: ") + e.what(), __FILE__, __LINE__, Logger::LogLevel::Error); return false; } - Logger::Get().Log("Application class initialized", __FILE__, __LINE__); + Logger::Get().Log("Application class initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize); return true; } @@ -369,18 +366,18 @@ bool ApplicationClass::Initialize(int screenWidth, int screenHeight, HWND hwnd) void ApplicationClass::Shutdown() { - Logger::Get().Log("Shutting down application class", __FILE__, __LINE__); + Logger::Get().Log("Shutting down application class", __FILE__, __LINE__, Logger::LogLevel::Shutdown); // Release the shader manager object. if (m_ShaderManager) { - Logger::Get().Log("Releasing the shader manager object", __FILE__, __LINE__); + Logger::Get().Log("Releasing the shader manager object", __FILE__, __LINE__, Logger::LogLevel::Shutdown); m_ShaderManager->Shutdown(); delete m_ShaderManager; m_ShaderManager = 0; - Logger::Get().Log("Shader manager object released", __FILE__, __LINE__); + Logger::Get().Log("Shader manager object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown); } // Release the reflection render texture object. @@ -418,65 +415,65 @@ void ApplicationClass::Shutdown() // Release the frustum class object. if (m_Frustum) { - Logger::Get().Log("Releasing the frustum class object", __FILE__, __LINE__); + Logger::Get().Log("Releasing the frustum class object", __FILE__, __LINE__, Logger::LogLevel::Shutdown); delete m_Frustum; m_Frustum = 0; - Logger::Get().Log("Frustum class object released", __FILE__, __LINE__); + Logger::Get().Log("Frustum class object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown); } // Release the display plane object. if (m_DisplayPlane) { - Logger::Get().Log("Releasing the display plane object", __FILE__, __LINE__); + Logger::Get().Log("Releasing the display plane object", __FILE__, __LINE__, Logger::LogLevel::Shutdown); m_DisplayPlane->Shutdown(); delete m_DisplayPlane; m_DisplayPlane = 0; - Logger::Get().Log("Display plane object released", __FILE__, __LINE__); + Logger::Get().Log("Display plane object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown); } // Release the position object. if (m_Position) { - Logger::Get().Log("Releasing the position object", __FILE__, __LINE__); + Logger::Get().Log("Releasing the position object", __FILE__, __LINE__, Logger::LogLevel::Shutdown); delete m_Position; m_Position = 0; - Logger::Get().Log("Position object released", __FILE__, __LINE__); + Logger::Get().Log("Position object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown); } // Release the model list object. if (m_ModelList) { - Logger::Get().Log("Releasing the model list object", __FILE__, __LINE__); + Logger::Get().Log("Releasing the model list object", __FILE__, __LINE__, Logger::LogLevel::Shutdown); m_ModelList->Shutdown(); delete m_ModelList; m_ModelList = 0; - Logger::Get().Log("Model list object released", __FILE__, __LINE__); + Logger::Get().Log("Model list object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown); } // Release the text objects for the render count string. if (m_RenderCountString) { - Logger::Get().Log("Releasing the render count string object", __FILE__, __LINE__); + Logger::Get().Log("Releasing the render count string object", __FILE__, __LINE__, Logger::LogLevel::Shutdown); m_RenderCountString->Shutdown(); delete m_RenderCountString; m_RenderCountString = 0; - Logger::Get().Log("Render count string object released", __FILE__, __LINE__); + Logger::Get().Log("Render count string object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown); } // Release the text objects for the mouse strings. if (m_MouseStrings) { - Logger::Get().Log("Releasing the mouse strings", __FILE__, __LINE__); + Logger::Get().Log("Releasing the mouse strings", __FILE__, __LINE__, Logger::LogLevel::Shutdown); m_MouseStrings[0].Shutdown(); m_MouseStrings[1].Shutdown(); @@ -485,108 +482,110 @@ void ApplicationClass::Shutdown() delete[] m_MouseStrings; m_MouseStrings = 0; - Logger::Get().Log("Mouse strings released", __FILE__, __LINE__); + Logger::Get().Log("Mouse strings released", __FILE__, __LINE__, Logger::LogLevel::Shutdown); } // Release the text object for the fps string. if (m_FpsString) { - Logger::Get().Log("Releasing the fps string object", __FILE__, __LINE__); + Logger::Get().Log("Releasing the fps string object", __FILE__, __LINE__, Logger::LogLevel::Shutdown); m_FpsString->Shutdown(); delete m_FpsString; m_FpsString = 0; - Logger::Get().Log("Fps string object released", __FILE__, __LINE__); + Logger::Get().Log("Fps string object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown); } // Release the fps object. if (m_Fps) { - Logger::Get().Log("Releasing the fps object", __FILE__, __LINE__); + Logger::Get().Log("Releasing the fps object", __FILE__, __LINE__, Logger::LogLevel::Shutdown); delete m_Fps; m_Fps = 0; - Logger::Get().Log("Fps object released", __FILE__, __LINE__); + Logger::Get().Log("Fps object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown); } // Release the font object. if (m_Font) { - Logger::Get().Log("Releasing the font object", __FILE__, __LINE__); + Logger::Get().Log("Releasing the font object", __FILE__, __LINE__, Logger::LogLevel::Shutdown); m_Font->Shutdown(); delete m_Font; m_Font = 0; - Logger::Get().Log("Font object released", __FILE__, __LINE__); + Logger::Get().Log("Font object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown); } // Release the font shader object. if (m_FontShader) { - Logger::Get().Log("Releasing the font shader object", __FILE__, __LINE__); + Logger::Get().Log("Releasing the font shader object", __FILE__, __LINE__, Logger::LogLevel::Shutdown); m_FontShader->Shutdown(); delete m_FontShader; m_FontShader = 0; - Logger::Get().Log("Font shader object released", __FILE__, __LINE__); + Logger::Get().Log("Font shader object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown); } // Release the timer object. if (m_Timer) { - Logger::Get().Log("Releasing the timer object", __FILE__, __LINE__); + Logger::Get().Log("Releasing the timer object", __FILE__, __LINE__, Logger::LogLevel::Shutdown); delete m_Timer; m_Timer = 0; - Logger::Get().Log("Timer object released", __FILE__, __LINE__); + Logger::Get().Log("Timer object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown); } // Release the sprite object. if (m_Sprite) { - Logger::Get().Log("Releasing the sprite object", __FILE__, __LINE__); + Logger::Get().Log("Releasing the sprite object", __FILE__, __LINE__, Logger::LogLevel::Shutdown); m_Sprite->Shutdown(); delete m_Sprite; m_Sprite = 0; - Logger::Get().Log("Sprite object released", __FILE__, __LINE__); + Logger::Get().Log("Sprite object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown); } for (auto light : m_Lights) { - Logger::Get().Log("Releasing the light object", __FILE__, __LINE__); + Logger::Get().Log("Releasing the light object", __FILE__, __LINE__, Logger::LogLevel::Shutdown); if (light) { delete light; light = 0; } - Logger::Get().Log("Light object released", __FILE__, __LINE__); + Logger::Get().Log("Light object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown); } // Release the light object. if (m_Light) { - Logger::Get().Log("Releasing the light object", __FILE__, __LINE__); + Logger::Get().Log("Releasing the light object", __FILE__, __LINE__, Logger::LogLevel::Shutdown); delete m_Light; m_Light = 0; - Logger::Get().Log("Light object released", __FILE__, __LINE__); + Logger::Get().Log("Light object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown); } // Release the model object. if (m_Model) { - Logger::Get().Log("Releasing the model object", __FILE__, __LINE__); + Logger::Get().Log("Releasing the model object", __FILE__, __LINE__, Logger::LogLevel::Shutdown); m_Model->Shutdown(); delete m_Model; m_Model = 0; - Logger::Get().Log("Model object released", __FILE__, __LINE__); + Logger::Get().Log("Model object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown); } + + Logger::Get().Log("Application class shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown); } @@ -615,7 +614,7 @@ bool ApplicationClass::Frame(InputClass* Input) // Check if the user pressed escape and wants to exit the application. if (Input->IsEscapePressed()) { - Logger::Get().Log("User pressed escape, exiting application", __FILE__, __LINE__); + Logger::Get().Log("User pressed escape, exiting application", __FILE__, __LINE__, Logger::LogLevel::Input); m_ShouldQuit = true; } @@ -848,7 +847,7 @@ bool ApplicationClass::RenderSceneToTexture(float rotation) m_Model->Render(m_Direct3D->GetDeviceContext()); result = m_ShaderManager->RenderTextureShader(m_Direct3D->GetDeviceContext(), m_Model->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix, - m_Model->GetTexture(1)); + m_Model->GetTexture(0)); if (!result) { return false; @@ -873,9 +872,6 @@ bool ApplicationClass::Render(float rotation, float x, float y, float z, float t // Set the blending amount to 10%. blendAmount = 0.1f; - // Clear the buffers to begin the scene. - m_Direct3D->BeginScene(0.0f, 0.0f, 0.0f, 1.0f); - // Generate the view matrix based on the camera's position. m_Camera->Render(); @@ -933,8 +929,16 @@ bool ApplicationClass::Render(float rotation, float x, float y, float z, float t cube->Render(m_Direct3D->GetDeviceContext()); - result = m_ShaderManager->RenderlightShader(m_Direct3D->GetDeviceContext(), m_Model->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix, m_Model->GetTexture(0), - diffuseColor, lightPosition, ambientColor); + // render the texture using the texture shader. + result = m_ShaderManager->RenderTextureShader(m_Direct3D->GetDeviceContext(), cube->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix, cube->GetTexture(0)); + if (!result) + { + Logger::Get().Log("Could not render the cube model using the texture shader", __FILE__, __LINE__, Logger::LogLevel::Error); + return false; + } + + result = m_ShaderManager->RenderlightShader(m_Direct3D->GetDeviceContext(), m_Model->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix, cube->GetTexture(0), + diffuseColor, lightPosition,ambientColor); if (!result) { Logger::Get().Log("Could not render the cube model using the light shader", __FILE__, __LINE__, Logger::LogLevel::Error); @@ -957,6 +961,14 @@ bool ApplicationClass::Render(float rotation, float x, float y, float z, float t object->Render(m_Direct3D->GetDeviceContext()); + // render the texture using the texture shader. + result = m_ShaderManager->RenderTextureShader(m_Direct3D->GetDeviceContext(), object->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix, object->GetTexture(0)); + if (!result) + { + Logger::Get().Log("Could not render the cube model using the texture shader", __FILE__, __LINE__, Logger::LogLevel::Error); + return false; + } + result = m_ShaderManager->RenderlightShader(m_Direct3D->GetDeviceContext(), m_Model->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix, m_Model->GetTexture(0), diffuseColor, lightPosition, ambientColor); @@ -990,6 +1002,41 @@ bool ApplicationClass::Render(float rotation, float x, float y, float z, float t } } + // Translate to where the bath model will be rendered. + worldMatrix = XMMatrixTranslation(0.0f, -10.0f, 0.0f); + + // Put the bath model vertex and index buffers on the graphics pipeline to prepare them for drawing. + m_BathModel->Render(m_Direct3D->GetDeviceContext()); + + // Render the bath model using the light shader. + result = m_ShaderManager->RenderTextureShader(m_Direct3D->GetDeviceContext(), m_BathModel->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix, + m_BathModel->GetTexture(0)); + if (!result) + { + return false; + } + + // Reset the world matrix. + m_Direct3D->GetWorldMatrix(worldMatrix); + + // Get the camera reflection view matrix. + m_Camera->GetReflectionViewMatrix(reflectionMatrix); + + // Translate to where the water model will be rendered. + worldMatrix = XMMatrixTranslation(0.0f, m_waterHeight, 0.0f); + + // Put the water model vertex and index buffers on the graphics pipeline to prepare them for drawing. + m_WaterModel->Render(m_Direct3D->GetDeviceContext()); + + // Render the water model using the water shader. + result = m_ShaderManager->RenderWaterShader(m_Direct3D->GetDeviceContext(), m_WaterModel->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix, reflectionMatrix, + m_ReflectionTexture->GetShaderResourceView(), m_RefractionTexture->GetShaderResourceView(), m_WaterModel->GetTexture(0), + m_waterTranslation, 0.01f); + if (!result) + { + return false; + } + // Setup matrices - Top display plane. worldMatrix = XMMatrixTranslation(0.0f, 1.5f, 0.0f); @@ -1163,42 +1210,6 @@ bool ApplicationClass::Render(float rotation, float x, float y, float z, float t lightPosition[i] = m_Lights[i]->GetPosition(); } - // Translate to where the bath model will be rendered. - worldMatrix = XMMatrixTranslation(0.0f, -10.0f, 0.0f); - - // Put the bath model vertex and index buffers on the graphics pipeline to prepare them for drawing. - m_BathModel->Render(m_Direct3D->GetDeviceContext()); - - // Render the bath model using the light shader. - result = m_ShaderManager->RenderTextureShader(m_Direct3D->GetDeviceContext(), m_BathModel->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix, - m_BathModel->GetTexture(0)); - if (!result) - { - return false; - } - - // Reset the world matrix. - m_Direct3D->GetWorldMatrix(worldMatrix); - - // Get the camera reflection view matrix. - m_Camera->GetReflectionViewMatrix(reflectionMatrix); - - // Translate to where the water model will be rendered. - worldMatrix = XMMatrixTranslation(0.0f, m_waterHeight, 0.0f); - - // Put the water model vertex and index buffers on the graphics pipeline to prepare them for drawing. - m_WaterModel->Render(m_Direct3D->GetDeviceContext()); - - // Render the water model using the water shader. - result = m_ShaderManager->RenderWaterShader(m_Direct3D->GetDeviceContext(), m_WaterModel->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix, reflectionMatrix, - m_ReflectionTexture->GetShaderResourceView(), m_RefractionTexture->GetShaderResourceView(), m_WaterModel->GetTexture(0), - m_waterTranslation, 0.01f); - - if (!result) - { - return false; - } - // Setup matrices. rotateMatrix = XMMatrixRotationY(rotation); translateMatrix = XMMatrixTranslation(-5.0f, 1.0f, -20.0f); @@ -1345,9 +1356,6 @@ bool ApplicationClass::Render(float rotation, float x, float y, float z, float t m_Direct3D->TurnZBufferOn(); m_Direct3D->DisableAlphaBlending(); - // Present the rendered scene to the screen. - m_Direct3D->EndScene(); - return true; } @@ -1684,21 +1692,4 @@ void ApplicationClass::SetLightPosition(int index, XMVECTOR position) //set the position m_Lights[index]->SetPosition(lightPosition.x, lightPosition.y, lightPosition.z); -} - -void ApplicationClass::DeleteLight(int index) -{ - Logger::Get().Log("Deleting light", __FILE__, __LINE__); - - if (index < 0 || index >= m_Lights.size()) - { - // Index out of bounds - return; - } - - // Delete the light object - delete m_Lights[index]; - - // Remove the light from the vector - m_Lights.erase(m_Lights.begin() + index); -} +} \ No newline at end of file diff --git a/enginecustom/applicationclass.h b/enginecustom/applicationclass.h index a066f0d..7628949 100644 --- a/enginecustom/applicationclass.h +++ b/enginecustom/applicationclass.h @@ -75,8 +75,8 @@ public: void SetLightPosition(int index, XMVECTOR color); void SetLightColor(int index, XMVECTOR color); void DeleteLight(int index); + void AddLight(); std::vector GetLights() const { return m_Lights; }; - bool GetShouldQuit() const { return m_ShouldQuit; }; void SetShouldQuit(bool shouldQuit) { m_ShouldQuit = shouldQuit; }; diff --git a/enginecustom/bitmapclass.cpp b/enginecustom/bitmapclass.cpp index 8f6b01f..17ff2ba 100644 --- a/enginecustom/bitmapclass.cpp +++ b/enginecustom/bitmapclass.cpp @@ -20,7 +20,7 @@ BitmapClass::~BitmapClass() bool BitmapClass::Initialize(ID3D11Device* device, ID3D11DeviceContext* deviceContext, int screenWidth, int screenHeight, char* textureFilename, int renderX, int renderY) { - Logger::Get().Log("Initializing bitmap class", __FILE__, __LINE__); + Logger::Get().Log("Initializing bitmap class", __FILE__, __LINE__, Logger::LogLevel::Initialize); bool result; @@ -48,7 +48,7 @@ bool BitmapClass::Initialize(ID3D11Device* device, ID3D11DeviceContext* deviceCo return false; } - Logger::Get().Log("Bitmap class initialized", __FILE__, __LINE__); + Logger::Get().Log("Bitmap class initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize); return true; } @@ -95,7 +95,7 @@ ID3D11ShaderResourceView* BitmapClass::GetTexture() bool BitmapClass::InitializeBuffers(ID3D11Device* device) { - Logger::Get().Log("Initializing buffers", __FILE__, __LINE__); + Logger::Get().Log("Initializing buffers", __FILE__, __LINE__, Logger::LogLevel::Initialize); VertexType* vertices; unsigned long* indices; @@ -178,27 +178,35 @@ bool BitmapClass::InitializeBuffers(ID3D11Device* device) delete[] indices; indices = 0; - Logger::Get().Log("Buffers initialized", __FILE__, __LINE__); + Logger::Get().Log("Buffers initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize); return true; } void BitmapClass::ShutdownBuffers() { + Logger::Get().Log("Shutting down buffers", __FILE__, __LINE__, Logger::LogLevel::Shutdown); + // Release the index buffer. if (m_indexBuffer) { + Logger::Get().Log("Releasing index buffer", __FILE__, __LINE__, Logger::LogLevel::Shutdown); m_indexBuffer->Release(); m_indexBuffer = 0; + Logger::Get().Log("Index buffer released", __FILE__, __LINE__, Logger::LogLevel::Shutdown); } // Release the vertex buffer. if (m_vertexBuffer) { + Logger::Get().Log("Releasing vertex buffer", __FILE__, __LINE__, Logger::LogLevel::Shutdown); m_vertexBuffer->Release(); m_vertexBuffer = 0; + Logger::Get().Log("Vertex buffer released", __FILE__, __LINE__, Logger::LogLevel::Shutdown); } + Logger::Get().Log("Buffers shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown); + return; } @@ -329,14 +337,19 @@ bool BitmapClass::LoadTexture(ID3D11Device* device, ID3D11DeviceContext* deviceC void BitmapClass::ReleaseTexture() { + Logger::Get().Log("Releasing texture", __FILE__, __LINE__, Logger::LogLevel::Shutdown); // Release the texture object. if (m_Texture) { + Logger::Get().Log("Releasing texture object", __FILE__, __LINE__, Logger::LogLevel::Shutdown); m_Texture->Shutdown(); delete m_Texture; m_Texture = 0; + Logger::Get().Log("Texture object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown); } + Logger::Get().Log("Texture released", __FILE__, __LINE__, Logger::LogLevel::Shutdown); + return; } diff --git a/enginecustom/d3dclass.cpp b/enginecustom/d3dclass.cpp index af89d43..1765f76 100644 --- a/enginecustom/d3dclass.cpp +++ b/enginecustom/d3dclass.cpp @@ -32,7 +32,7 @@ D3DClass::~D3DClass() bool D3DClass::Initialize(int screenWidth, int screenHeight, bool vsync, HWND hwnd, bool fullscreen, float screenDepth, float screenNear) { - Logger::Get().Log("Initializing D3Dclass", __FILE__, __LINE__); + Logger::Get().Log("Initializing D3Dclass", __FILE__, __LINE__, Logger::LogLevel::Initialize); HRESULT result; IDXGIFactory* factory; @@ -433,7 +433,7 @@ bool D3DClass::Initialize(int screenWidth, int screenHeight, bool vsync, HWND hw void D3DClass::Shutdown() { - Logger::Get().Log("Shutting down D3Dclass", __FILE__, __LINE__); + Logger::Get().Log("Shutting down D3Dclass", __FILE__, __LINE__, Logger::LogLevel::Shutdown); // Before shutting down set to windowed mode or when you release the swap chain it will throw an exception. if (m_swapChain) @@ -507,7 +507,7 @@ void D3DClass::Shutdown() m_swapChain = 0; } - Logger::Get().Log("D3Dclass shutdown", __FILE__, __LINE__); + Logger::Get().Log("D3Dclass shutdown", __FILE__, __LINE__, Logger::LogLevel::Shutdown); return; } diff --git a/enginecustom/displayplaneclass.cpp b/enginecustom/displayplaneclass.cpp index 527e962..ab6c4d8 100644 --- a/enginecustom/displayplaneclass.cpp +++ b/enginecustom/displayplaneclass.cpp @@ -19,7 +19,7 @@ DisplayPlaneClass::~DisplayPlaneClass() bool DisplayPlaneClass::Initialize(ID3D11Device* device, float width, float height) { - Logger::Get().Log("Initializing DisplayPlaneClass, width: " + std::to_string(width) + ", height: " + std::to_string(height), __FILE__, __LINE__); + Logger::Get().Log("Initializing DisplayPlaneClass, width: " + std::to_string(width) + ", height: " + std::to_string(height), __FILE__, __LINE__, Logger::LogLevel::Initialize); bool result; @@ -27,7 +27,7 @@ bool DisplayPlaneClass::Initialize(ID3D11Device* device, float width, float heig result = InitializeBuffers(device, width, height); if (!result) { - Logger::Get().Log("Could not initialize buffers", __FILE__, __LINE__); + Logger::Get().Log("Could not initialize buffers", __FILE__, __LINE__, Logger::LogLevel::Error); return false; } @@ -60,7 +60,7 @@ int DisplayPlaneClass::GetIndexCount() bool DisplayPlaneClass::InitializeBuffers(ID3D11Device* device, float width, float height) { - Logger::Get().Log("Initializing buffers", __FILE__, __LINE__); + Logger::Get().Log("Initializing buffers", __FILE__, __LINE__, Logger::LogLevel::Initialize); VertexType* vertices; unsigned long* indices; @@ -158,7 +158,7 @@ bool DisplayPlaneClass::InitializeBuffers(ID3D11Device* device, float width, flo delete[] indices; indices = 0; - Logger::Get().Log("Buffers initialized", __FILE__, __LINE__); + Logger::Get().Log("Buffers initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize); return true; } @@ -166,6 +166,8 @@ bool DisplayPlaneClass::InitializeBuffers(ID3D11Device* device, float width, flo void DisplayPlaneClass::ShutdownBuffers() { + Logger::Get().Log("Shutting down Plane buffers", __FILE__, __LINE__, Logger::LogLevel::Shutdown); + // Release the index buffer. if (m_indexBuffer) { @@ -180,6 +182,8 @@ void DisplayPlaneClass::ShutdownBuffers() m_vertexBuffer = 0; } + Logger::Get().Log("Plane buffers shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown); + return; } diff --git a/enginecustom/fontclass.cpp b/enginecustom/fontclass.cpp index 5b165bc..2fe58b7 100644 --- a/enginecustom/fontclass.cpp +++ b/enginecustom/fontclass.cpp @@ -18,7 +18,7 @@ FontClass::~FontClass() bool FontClass::Initialize(ID3D11Device* device, ID3D11DeviceContext* deviceContext, int fontChoice) { - Logger::Get().Log("Initializing font class", __FILE__, __LINE__); + Logger::Get().Log("Initializing font class", __FILE__, __LINE__, Logger::LogLevel::Initialize); char fontFilename[128]; char fontTextureFilename[128]; @@ -49,7 +49,7 @@ bool FontClass::Initialize(ID3D11Device* device, ID3D11DeviceContext* deviceCont result = LoadFontData(fontFilename); if (!result) { - Logger::Get().Log("Failed to load font data", __FILE__, __LINE__); + Logger::Get().Log("Failed to load font data", __FILE__, __LINE__, Logger::LogLevel::Error); return false; } @@ -57,11 +57,11 @@ bool FontClass::Initialize(ID3D11Device* device, ID3D11DeviceContext* deviceCont result = LoadTexture(device, deviceContext, fontTextureFilename); if (!result) { - Logger::Get().Log("Failed to load font texture", __FILE__, __LINE__); + Logger::Get().Log("Failed to load font texture", __FILE__, __LINE__, Logger::LogLevel::Error); return false; } - Logger::Get().Log("Font class initialized", __FILE__, __LINE__); + Logger::Get().Log("Font class initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize); return true; } @@ -148,7 +148,7 @@ bool FontClass::LoadTexture(ID3D11Device* device, ID3D11DeviceContext* deviceCon result = m_Texture->Initialize(device, deviceContext, filename); if (!result) { - Logger::Get().Log("Failed to initialize font texture", __FILE__, __LINE__); + Logger::Get().Log("Failed to initialize font texture", __FILE__, __LINE__, Logger::LogLevel::Error); return false; } diff --git a/enginecustom/fontshaderclass.cpp b/enginecustom/fontshaderclass.cpp index f372676..ab90dd1 100644 --- a/enginecustom/fontshaderclass.cpp +++ b/enginecustom/fontshaderclass.cpp @@ -24,7 +24,7 @@ FontShaderClass::~FontShaderClass() bool FontShaderClass::Initialize(ID3D11Device* device, HWND hwnd) { - Logger::Get().Log("Initializing FontShaderClass", __FILE__, __LINE__); + Logger::Get().Log("Initializing FontShaderClass", __FILE__, __LINE__, Logger::LogLevel::Initialize); bool result; wchar_t vsFilename[128]; @@ -55,7 +55,7 @@ bool FontShaderClass::Initialize(ID3D11Device* device, HWND hwnd) return false; } - Logger::Get().Log("FontShaderClass initialized", __FILE__, __LINE__); + Logger::Get().Log("FontShaderClass initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize); return true; } @@ -90,7 +90,7 @@ bool FontShaderClass::Render(ID3D11DeviceContext* deviceContext, int indexCount, bool FontShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR* vsFilename, WCHAR* psFilename) { - Logger::Get().Log("Initializing shader", __FILE__, __LINE__); + Logger::Get().Log("Initializing shader", __FILE__, __LINE__, Logger::LogLevel::Initialize); HRESULT result; ID3D10Blob* errorMessage; @@ -253,14 +253,14 @@ bool FontShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR* v return false; } - Logger::Get().Log("Shader initialized", __FILE__, __LINE__); + Logger::Get().Log("Shader initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize); return true; } void FontShaderClass::ShutdownShader() { - Logger::Get().Log("Shutting down shader", __FILE__, __LINE__); + Logger::Get().Log("Shutting down shader", __FILE__, __LINE__, Logger::LogLevel::Shutdown); // Release the pixel constant buffer. if (m_pixelBuffer) @@ -304,7 +304,7 @@ void FontShaderClass::ShutdownShader() m_vertexShader = 0; } - Logger::Get().Log("Shader shut down", __FILE__, __LINE__); + Logger::Get().Log("Shader shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown); return; } diff --git a/enginecustom/imgui.ini b/enginecustom/imgui.ini index e8c95e7..0385078 100644 --- a/enginecustom/imgui.ini +++ b/enginecustom/imgui.ini @@ -3,18 +3,18 @@ Pos=60,60 Size=400,400 [Window][Khaotic Engine] -Pos=429,57 -Size=392,218 +Pos=1139,42 +Size=392,214 [Window][Objects] -Pos=39,222 -Size=379,299 +Pos=53,55 +Size=637,299 [Window][Terrain] -Pos=60,60 +Pos=741,42 Size=342,82 [Window][Light] -Pos=62,180 +Pos=1107,9 Size=345,230 diff --git a/enginecustom/imguiManager.cpp b/enginecustom/imguiManager.cpp index aa3bd4d..5cc5ea0 100644 --- a/enginecustom/imguiManager.cpp +++ b/enginecustom/imguiManager.cpp @@ -13,26 +13,31 @@ imguiManager::~imguiManager() bool imguiManager::Initialize(HWND hwnd, ID3D11Device* device, ID3D11DeviceContext* deviceContext) { - Logger::Get().Log("Initializing imgui", __FILE__, __LINE__); + Logger::Get().Log("Initializing imgui", __FILE__, __LINE__, Logger::LogLevel::Initialize); + + m_device = device; + m_deviceContext = deviceContext; IMGUI_CHECKVERSION(); ImGui::CreateContext(); io = &ImGui::GetIO(); ImGui_ImplWin32_Init(hwnd); - ImGui_ImplDX11_Init(device, deviceContext); + ImGui_ImplDX11_Init(m_device, m_deviceContext); ImGui::StyleColorsDark(); - Logger::Get().Log("imgui initialized", __FILE__, __LINE__); + Logger::Get().Log("imgui initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize); return true; } void imguiManager::Shutdown() { + Logger::Get().Log("Shutting down imgui", __FILE__, __LINE__, Logger::LogLevel::Shutdown); ImGui_ImplDX11_Shutdown(); ImGui_ImplWin32_Shutdown(); ImGui::DestroyContext(); + Logger::Get().Log("imgui shutdown", __FILE__, __LINE__, Logger::LogLevel::Shutdown); } void imguiManager::Render() @@ -88,7 +93,7 @@ void imguiManager::WidgetAddObject(ApplicationClass* app) ofn.lpstrFile = szFile; ofn.lpstrFile[0] = '\0'; ofn.nMaxFile = sizeof(szFile); - ofn.lpstrFilter = L"OBJ\0*.obj\0TXT\0*.txt\0KOBJ\0*.kobj"; + ofn.lpstrFilter = L"TXT\0*.txt\0KOBJ\0*.kobj\0*OBJ\0*.obj"; ofn.nFilterIndex = 1; ofn.lpstrFileTitle = NULL; ofn.nMaxFileTitle = 0; @@ -110,7 +115,6 @@ void imguiManager::WidgetObjectWindow(ApplicationClass* app) { ImGui::Begin("Objects", &showObjectWindow); int index = 0; - int count = 0; for (auto& object : app->GetKobjects()) { std::string headerName = object->GetName() + " " + std::to_string(index); @@ -145,17 +149,80 @@ void imguiManager::WidgetObjectWindow(ApplicationClass* app) ImGui::Separator(); // Texture - std::string textureLabel = "Texture##" + std::to_string(index); - ID3D11ShaderResourceView* texture = object->GetTexture(0); - if (texture != nullptr) + // add all texture category names to a vector + std::vector textureCategories = { "Diffuse", "Normal", "Specular", "Alpha", "Light", "Change Me" }; + + + for (int count = 0; count < 6; count++) { - if (ImGui::ImageButton((ImTextureID)texture, ImVec2(64, 64))) + std::string textureLabel = "Texture##" + std::to_string(index); + ID3D11ShaderResourceView* texture = object->GetTexture(count); + if (texture != nullptr) { - count++; - + // Set the cursor position + ImGui::SetCursorPosX(count * (64 + 20) + 10); // 64 is the width of the image, 10 is the spacing + + // Display the texture name + std::string textureName = textureCategories[count]; + ImGui::Text(textureName.c_str()); + + if(count < 5) + { + ImGui::SameLine(); + } } } - ImGui::Text("Texture count: %d", count); + + // Display all images + for (int count = 0; count < 6; count++) + { + std::string textureLabel = "Texture##" + std::to_string(index); + ID3D11ShaderResourceView* texture = object->GetTexture(count); + if (texture != nullptr) + { + // Set the cursor position + ImGui::SetCursorPosX(count * (64 + 20) + 10); // 64 is the width of the image, 10 is the spacing + + if (ImGui::ImageButton((ImTextureID)texture, ImVec2(64, 64))) + { + // Open file dialog + OPENFILENAME ofn; + WCHAR szFile[260]; + ZeroMemory(&ofn, sizeof(ofn)); + ofn.lStructSize = sizeof(ofn); + ofn.hwndOwner = NULL; + ofn.lpstrFile = szFile; + ofn.lpstrFile[0] = '\0'; + ofn.nMaxFile = sizeof(szFile); + ofn.lpstrFilter = L"Texture\0*.tga\0"; + ofn.nFilterIndex = 1; + ofn.lpstrFileTitle = NULL; + ofn.nMaxFileTitle = 0; + ofn.lpstrInitialDir = NULL; + ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST; + + if (GetOpenFileName(&ofn)) + { + // Load the selected texture + object->ChangeTexture(m_device, m_deviceContext, ofn.lpstrFile, index); + } + } + + if (ImGui::IsItemHovered()) + { + ImGui::BeginTooltip(); + ImGui::Image((ImTextureID)texture, ImVec2(256, 256)); + ImGui::EndTooltip(); + } + + // If this is not the last texture, put the next button on the same line + if (count < 5) + { + ImGui::SameLine(); + } + } + } + ImGui::Separator(); @@ -254,8 +321,6 @@ bool imguiManager::ImGuiWidgetRenderer(ApplicationClass* app) //render imgui Render(); - app->GetDirect3D()->m_swapChain->Present(0, NULL); - return true; } @@ -263,6 +328,7 @@ void imguiManager::WidgetLightWindow(ApplicationClass* app) { ImGui::Begin("Light", &showLightWindow); int index = 0; + for(auto& light : app->GetLights()) { std::string headerName = "Light " + std::to_string(index); @@ -287,15 +353,6 @@ void imguiManager::WidgetLightWindow(ApplicationClass* app) } ImGui::Separator(); - - // Delete button - std::string deleteLabel = "Delete##" + std::to_string(index); - if (ImGui::Button(deleteLabel.c_str())) - { - app->DeleteLight(index); - } - - ImGui::Separator(); } index++; }; diff --git a/enginecustom/imguiManager.h b/enginecustom/imguiManager.h index 0d8ef86..c814210 100644 --- a/enginecustom/imguiManager.h +++ b/enginecustom/imguiManager.h @@ -42,6 +42,9 @@ private : private: ImGuiIO* io; + ID3D11Device* m_device; + ID3D11DeviceContext* m_deviceContext; + }; #endif \ No newline at end of file diff --git a/enginecustom/inputclass.cpp b/enginecustom/inputclass.cpp index f627251..530b478 100644 --- a/enginecustom/inputclass.cpp +++ b/enginecustom/inputclass.cpp @@ -20,7 +20,7 @@ InputClass::~InputClass() bool InputClass::Initialize(HINSTANCE hinstance, HWND hwnd, int screenWidth, int screenHeight) { - Logger::Get().Log("Initializing input class", __FILE__, __LINE__); + Logger::Get().Log("Initializing input class", __FILE__, __LINE__, Logger::LogLevel::Initialize); HRESULT result; int i; @@ -112,7 +112,7 @@ bool InputClass::Initialize(HINSTANCE hinstance, HWND hwnd, int screenWidth, int return false; } - Logger::Get().Log("Input class initialized", __FILE__, __LINE__); + Logger::Get().Log("Input class initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize); return true; } @@ -123,6 +123,7 @@ bool InputClass::Initialize(HINSTANCE hinstance, HWND hwnd, int screenWidth, int void InputClass::KeyDown(unsigned int input) { // If a key is pressed then save that state in the key array. + Logger::Get().Log("Key down", __FILE__, __LINE__, Logger::LogLevel::Input); m_keys[input] = true; return; } @@ -131,6 +132,7 @@ void InputClass::KeyDown(unsigned int input) void InputClass::KeyUp(unsigned int input) { // If a key is released then clear that state in the key array. + Logger::Get().Log("Key up", __FILE__, __LINE__, Logger::LogLevel::Input); m_keys[input] = false; return; } @@ -144,7 +146,7 @@ bool InputClass::IsKeyDown(unsigned int key) void InputClass::Shutdown() { - Logger::Get().Log("Shutting down input class", __FILE__, __LINE__); + Logger::Get().Log("Shutting down input class", __FILE__, __LINE__, Logger::LogLevel::Shutdown); // Release the mouse. if (m_mouse) @@ -169,7 +171,7 @@ void InputClass::Shutdown() m_directInput = 0; } - Logger::Get().Log("Input class shut down", __FILE__, __LINE__); + Logger::Get().Log("Input class shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown); return; } @@ -280,6 +282,7 @@ bool InputClass::IsLeftArrowPressed() { if (m_keyboardState[DIK_LEFT] & 0x80) { + Logger::Get().Log("Left arrow pressed", __FILE__, __LINE__, Logger::LogLevel::Input); return true; } @@ -291,6 +294,7 @@ bool InputClass::IsRightArrowPressed() { if (m_keyboardState[DIK_RIGHT] & 0x80) { + Logger::Get().Log("Right arrow pressed", __FILE__, __LINE__, Logger::LogLevel::Input); return true; } @@ -306,6 +310,7 @@ bool InputClass::IsAPressed() // Touche A sur QWERTY, Q sur AZERTY if (m_keyboardState[DIK_A] & 0x80) { + Logger::Get().Log("A pressed", __FILE__, __LINE__, Logger::LogLevel::Input); return true; } @@ -316,6 +321,7 @@ bool InputClass::IsDPressed() { if (m_keyboardState[DIK_D] & 0x80) { + Logger::Get().Log("D pressed", __FILE__, __LINE__, Logger::LogLevel::Input); return true; } @@ -327,6 +333,7 @@ bool InputClass::IsWPressed() // Touche W sur QWERTY, Z sur AZERTY if (m_keyboardState[DIK_W] & 0x80) { + Logger::Get().Log("W pressed", __FILE__, __LINE__, Logger::LogLevel::Input); return true; } @@ -337,6 +344,7 @@ bool InputClass::IsSPressed() { if (m_keyboardState[DIK_S] & 0x80) { + Logger::Get().Log("S pressed", __FILE__, __LINE__, Logger::LogLevel::Input); return true; } @@ -348,6 +356,7 @@ bool InputClass::IsQPressed() // Touche Q sur QWERTY, A sur AZERTY if (m_keyboardState[DIK_Q] & 0x80) { + Logger::Get().Log("Q pressed", __FILE__, __LINE__, Logger::LogLevel::Input); return true; } @@ -358,6 +367,7 @@ bool InputClass::IsEPressed() { if (m_keyboardState[DIK_E] & 0x80) { + Logger::Get().Log("E pressed", __FILE__, __LINE__, Logger::LogLevel::Input); return true; } @@ -376,6 +386,7 @@ bool InputClass::IsLeftMousePressed() // Check the left mouse button state. if (m_mouseState.rgbButtons[0] & 0x80) { + Logger::Get().Log("Left mouse button pressed", __FILE__, __LINE__, Logger::LogLevel::Input); return true; } @@ -387,6 +398,7 @@ bool InputClass::IsRightMousePressed() // Check the left mouse button state. if (m_mouseState.rgbButtons[1] & 0x80) { + Logger::Get().Log("Right mouse button pressed", __FILE__, __LINE__, Logger::LogLevel::Input); return true; } diff --git a/enginecustom/lightmapshaderclass.cpp b/enginecustom/lightmapshaderclass.cpp index d1a2c9d..ffa16ba 100644 --- a/enginecustom/lightmapshaderclass.cpp +++ b/enginecustom/lightmapshaderclass.cpp @@ -23,7 +23,7 @@ LightMapShaderClass::~LightMapShaderClass() bool LightMapShaderClass::Initialize(ID3D11Device* device, HWND hwnd) { - Logger::Get().Log("Initializing LightMapShaderClass", __FILE__, __LINE__); + Logger::Get().Log("Initializing LightMapShaderClass", __FILE__, __LINE__, Logger::LogLevel::Initialize); bool result; wchar_t vsFilename[128]; @@ -54,7 +54,7 @@ bool LightMapShaderClass::Initialize(ID3D11Device* device, HWND hwnd) return false; } - Logger::Get().Log("LightMapShaderClass initialized", __FILE__, __LINE__); + Logger::Get().Log("LightMapShaderClass initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize); return true; } @@ -92,6 +92,7 @@ bool LightMapShaderClass::Render(ID3D11DeviceContext* deviceContext, int indexCo bool LightMapShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR* vsFilename, WCHAR* psFilename) { + Logger::Get().Log("Initializing shader", __FILE__, __LINE__, Logger::LogLevel::Initialize); HRESULT result; ID3D10Blob* errorMessage; ID3D10Blob* vertexShaderBuffer; @@ -244,7 +245,7 @@ bool LightMapShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHA return false; } - Logger::Get().Log("Shader initialized", __FILE__, __LINE__); + Logger::Get().Log("Shader initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize); return true; } @@ -252,7 +253,7 @@ bool LightMapShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHA void LightMapShaderClass::ShutdownShader() { - Logger::Get().Log("Shutting down LightMapShaderClass", __FILE__, __LINE__); + Logger::Get().Log("Shutting down LightMapShaderClass", __FILE__, __LINE__, Logger::LogLevel::Shutdown); // Release the sampler state. if (m_sampleState) @@ -289,7 +290,7 @@ void LightMapShaderClass::ShutdownShader() m_vertexShader = 0; } - Logger::Get().Log("LightMapShaderClass shut down", __FILE__, __LINE__); + Logger::Get().Log("LightMapShaderClass shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown); return; } diff --git a/enginecustom/lightshaderclass.cpp b/enginecustom/lightshaderclass.cpp index 9fc289d..6f76143 100644 --- a/enginecustom/lightshaderclass.cpp +++ b/enginecustom/lightshaderclass.cpp @@ -30,7 +30,7 @@ LightShaderClass::~LightShaderClass() bool LightShaderClass::Initialize(ID3D11Device* device, HWND hwnd) { - Logger::Get().Log("Initializing LightShaderClass", __FILE__, __LINE__); + Logger::Get().Log("Initializing LightShaderClass", __FILE__, __LINE__, Logger::LogLevel::Initialize); wchar_t vsFilename[128]; wchar_t psFilename[128]; @@ -60,7 +60,7 @@ bool LightShaderClass::Initialize(ID3D11Device* device, HWND hwnd) return false; } - Logger::Get().Log("LightShaderClass initialized", __FILE__, __LINE__); + Logger::Get().Log("LightShaderClass initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize); return true; } @@ -97,6 +97,8 @@ bool LightShaderClass::Render(ID3D11DeviceContext* deviceContext, int indexCount bool LightShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR* vsFilename, WCHAR* psFilename) { + Logger::Get().Log("Initializing shader", __FILE__, __LINE__, Logger::LogLevel::Initialize); + HRESULT result; ID3D10Blob* errorMessage; ID3D10Blob* vertexShaderBuffer; @@ -301,7 +303,7 @@ bool LightShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR* return false; } - Logger::Get().Log("Shader initialized", __FILE__, __LINE__); + Logger::Get().Log("Shader initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize); return true; } @@ -309,7 +311,7 @@ bool LightShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR* void LightShaderClass::ShutdownShader() { - Logger::Get().Log("Shutting down LightShaderClass", __FILE__, __LINE__); + Logger::Get().Log("Shutting down LightShaderClass", __FILE__, __LINE__, Logger::LogLevel::Shutdown); // Release the light constant buffers. if (m_lightColorBuffer) @@ -373,7 +375,7 @@ void LightShaderClass::ShutdownShader() m_vertexShader = 0; } - Logger::Get().Log("LightShaderClass shut down", __FILE__, __LINE__); + Logger::Get().Log("LightShaderClass shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown); return; } @@ -475,10 +477,10 @@ bool LightShaderClass::SetShaderParameters(ID3D11DeviceContext* deviceContext, X dataPtr2 = (LightPositionBufferType*)mappedResource.pData; // Copy the light position variables into the constant buffer. - dataPtr2->lightPosition[0] = lightPosition[0]; - dataPtr2->lightPosition[1] = lightPosition[1]; - dataPtr2->lightPosition[2] = lightPosition[2]; - dataPtr2->lightPosition[3] = lightPosition[3]; + for (int i = 0; i < NUM_LIGHTS; i++) + { + dataPtr2->lightPosition[i] = lightPosition[i]; + } // Unlock the constant buffer. deviceContext->Unmap(m_lightPositionBuffer, 0); @@ -504,10 +506,10 @@ bool LightShaderClass::SetShaderParameters(ID3D11DeviceContext* deviceContext, X dataPtr3 = (LightColorBufferType*)mappedResource.pData; // Copy the light color variables into the constant buffer. - dataPtr3->diffuseColor[0] = diffuseColor[0]; - dataPtr3->diffuseColor[1] = diffuseColor[1]; - dataPtr3->diffuseColor[2] = diffuseColor[2]; - dataPtr3->diffuseColor[3] = diffuseColor[3]; + for (int i = 0; i < NUM_LIGHTS; i++) + { + dataPtr3->diffuseColor[i] = diffuseColor[i]; + } // Unlock the constant buffer. deviceContext->Unmap(m_lightColorBuffer, 0); diff --git a/enginecustom/lightshaderclass.h b/enginecustom/lightshaderclass.h index 03e62f3..dd45b3d 100644 --- a/enginecustom/lightshaderclass.h +++ b/enginecustom/lightshaderclass.h @@ -9,7 +9,6 @@ // GLOBALS // ///////////// const int NUM_LIGHTS = 4; - ////////////// // INCLUDES // ////////////// @@ -88,7 +87,6 @@ private: ID3D11Buffer* m_lightBuffer; ID3D11Buffer* m_lightColorBuffer; ID3D11Buffer* m_lightPositionBuffer; - }; #endif \ No newline at end of file diff --git a/enginecustom/modelclass.cpp b/enginecustom/modelclass.cpp index 5ff2364..7581ead 100644 --- a/enginecustom/modelclass.cpp +++ b/enginecustom/modelclass.cpp @@ -21,7 +21,7 @@ ModelClass::~ModelClass() bool ModelClass::Initialize(ID3D11Device* device, ID3D11DeviceContext* deviceContext, char* modelFilename, vector filename) { - Logger::Get().Log("Initializing model class", __FILE__, __LINE__); + Logger::Get().Log("Initializing model class", __FILE__, __LINE__, Logger::LogLevel::Initialize); bool result; @@ -51,7 +51,7 @@ bool ModelClass::Initialize(ID3D11Device* device, ID3D11DeviceContext* deviceCon return false; } - Logger::Get().Log("Model class initialized", __FILE__, __LINE__); + Logger::Get().Log("Model class initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize); return true; } @@ -94,7 +94,7 @@ ID3D11ShaderResourceView* ModelClass::GetTexture(int index) bool ModelClass::InitializeBuffers(ID3D11Device* device) { - Logger::Get().Log("Initializing buffers", __FILE__, __LINE__); + Logger::Get().Log("Initializing buffers", __FILE__, __LINE__, Logger::LogLevel::Initialize); VertexType* vertices; unsigned long* indices; @@ -170,7 +170,7 @@ bool ModelClass::InitializeBuffers(ID3D11Device* device) delete[] indices; indices = 0; - Logger::Get().Log("Buffers initialized", __FILE__, __LINE__); + Logger::Get().Log("Buffers initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize); return true; } @@ -178,6 +178,7 @@ bool ModelClass::InitializeBuffers(ID3D11Device* device) void ModelClass::ShutdownBuffers() { + Logger::Get().Log("Shutting down buffers", __FILE__, __LINE__, Logger::LogLevel::Shutdown); // Release the index buffer. if (m_indexBuffer) { @@ -192,6 +193,8 @@ void ModelClass::ShutdownBuffers() m_vertexBuffer = 0; } + Logger::Get().Log("Buffers shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown); + return; } @@ -399,7 +402,6 @@ void ModelClass::CalculateModelVectors() void ModelClass::CalculateTangentBinormal(TempVertexType vertex1, TempVertexType vertex2, TempVertexType vertex3, VectorType& tangent, VectorType& binormal) { - Logger::Get().Log("Calculating tangent and binormal", __FILE__, __LINE__); float vector1[3], vector2[3]; float tuVector[2], tvVector[2]; @@ -451,8 +453,6 @@ void ModelClass::CalculateTangentBinormal(TempVertexType vertex1, TempVertexType binormal.y = binormal.y / length; binormal.z = binormal.z / length; - Logger::Get().Log("Tangent and binormal calculated", __FILE__, __LINE__); - return; } @@ -469,4 +469,27 @@ void ModelClass::ReleaseModel() Logger::Get().Log("Model released", __FILE__, __LINE__); return; +} + +bool ModelClass::ChangeTexture(ID3D11Device* device, ID3D11DeviceContext* deviceContext, std::wstring filename, int index) +{ + bool result; + + // convert wstring to string + std::string str(filename.begin(), filename.end()); + + // Release the old texture object. + m_Textures[index].Shutdown(); + + // Initialize the new texture object. + result = m_Textures[index].Initialize(device, deviceContext, str); + if (!result) + { + Logger::Get().Log("Failed to initialize texture", __FILE__, __LINE__, Logger::LogLevel::Error); + return false; + } + + Logger::Get().Log("Texture changed", __FILE__, __LINE__); + + return true; } \ No newline at end of file diff --git a/enginecustom/modelclass.h b/enginecustom/modelclass.h index ba6cca1..d32de0b 100644 --- a/enginecustom/modelclass.h +++ b/enginecustom/modelclass.h @@ -88,6 +88,7 @@ public: int GetIndexCount(); ID3D11ShaderResourceView* GetTexture(int); + bool ChangeTexture(ID3D11Device*, ID3D11DeviceContext*, std::wstring filename, int index); private: bool InitializeBuffers(ID3D11Device*); diff --git a/enginecustom/normalmapshaderclass.cpp b/enginecustom/normalmapshaderclass.cpp index 75533c4..6333e1c 100644 --- a/enginecustom/normalmapshaderclass.cpp +++ b/enginecustom/normalmapshaderclass.cpp @@ -24,7 +24,7 @@ NormalMapShaderClass::~NormalMapShaderClass() bool NormalMapShaderClass::Initialize(ID3D11Device* device, HWND hwnd) { - Logger::Get().Log("Initializing normal map shader", __FILE__, __LINE__); + Logger::Get().Log("Initializing normal map shader", __FILE__, __LINE__, Logger::LogLevel::Initialize); bool result; wchar_t vsFilename[128]; @@ -55,6 +55,8 @@ bool NormalMapShaderClass::Initialize(ID3D11Device* device, HWND hwnd) return false; } + Logger::Get().Log("Successfully initialized normal map shader", __FILE__, __LINE__, Logger::LogLevel::Initialize); + return true; } @@ -77,7 +79,7 @@ bool NormalMapShaderClass::Render(ID3D11DeviceContext* deviceContext, int indexC result = SetShaderParameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix, texture1, texture2, lightDirection, diffuseColor); if (!result) { - Logger::Get().Log("Failed to set the shader parameters that will be used for rendering", __FILE__, __LINE__); + Logger::Get().Log("Failed to set the shader parameters that will be used for rendering", __FILE__, __LINE__, Logger::LogLevel::Error); return false; } @@ -90,7 +92,7 @@ bool NormalMapShaderClass::Render(ID3D11DeviceContext* deviceContext, int indexC bool NormalMapShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR* vsFilename, WCHAR* psFilename) { - Logger::Get().Log("Initializing normal map shader", __FILE__, __LINE__); + Logger::Get().Log("Initializing normal map shader", __FILE__, __LINE__, Logger::LogLevel::Initialize); HRESULT result; ID3D10Blob* errorMessage; @@ -277,7 +279,7 @@ bool NormalMapShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCH return false; } - Logger::Get().Log("Successfully initialized normal map shader", __FILE__, __LINE__); + Logger::Get().Log("Successfully initialized normal map shader", __FILE__, __LINE__, Logger::LogLevel::Initialize); return true; } @@ -285,7 +287,7 @@ bool NormalMapShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCH void NormalMapShaderClass::ShutdownShader() { - Logger::Get().Log("Shutting down normal map shader", __FILE__, __LINE__); + Logger::Get().Log("Shutting down normal map shader", __FILE__, __LINE__, Logger::LogLevel::Shutdown); // Release the light constant buffer. if (m_lightBuffer) @@ -329,7 +331,7 @@ void NormalMapShaderClass::ShutdownShader() m_vertexShader = 0; } - Logger::Get().Log("Successfully shut down normal map shader", __FILE__, __LINE__); + Logger::Get().Log("Successfully shut down normal map shader", __FILE__, __LINE__, Logger::LogLevel::Shutdown); return; } diff --git a/enginecustom/reflectionshaderclass.cpp b/enginecustom/reflectionshaderclass.cpp index 3ace524..02a505d 100644 --- a/enginecustom/reflectionshaderclass.cpp +++ b/enginecustom/reflectionshaderclass.cpp @@ -21,7 +21,7 @@ ReflectionShaderClass::~ReflectionShaderClass() bool ReflectionShaderClass::Initialize(ID3D11Device* device, HWND hwnd) { - Logger::Get().Log("Initializing reflection shader", __FILE__, __LINE__); + Logger::Get().Log("Initializing reflection shader", __FILE__, __LINE__, Logger::LogLevel::Initialize); bool result; wchar_t vsFilename[128]; @@ -52,6 +52,8 @@ bool ReflectionShaderClass::Initialize(ID3D11Device* device, HWND hwnd) return false; } + Logger::Get().Log("Reflection shader initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize); + return true; } @@ -85,7 +87,7 @@ bool ReflectionShaderClass::Render(ID3D11DeviceContext* deviceContext, int index bool ReflectionShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR* vsFilename, WCHAR* psFilename) { - Logger::Get().Log("Initializing reflection shader", __FILE__, __LINE__); + Logger::Get().Log("Initializing reflection shader", __FILE__, __LINE__, Logger::LogLevel::Initialize); HRESULT result; ID3D10Blob* errorMessage; @@ -245,14 +247,14 @@ bool ReflectionShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WC return false; } - Logger::Get().Log("Reflection shader initialized", __FILE__, __LINE__); + Logger::Get().Log("Reflection shader initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize); return true; } void ReflectionShaderClass::ShutdownShader() { - Logger::Get().Log("Shutting down reflection shader", __FILE__, __LINE__); + Logger::Get().Log("Shutting down reflection shader", __FILE__, __LINE__, Logger::LogLevel::Shutdown); // Release the reflection constant buffer. if (m_reflectionBuffer) @@ -296,7 +298,7 @@ void ReflectionShaderClass::ShutdownShader() m_vertexShader = 0; } - Logger::Get().Log("Reflection shader shut down", __FILE__, __LINE__); + Logger::Get().Log("Reflection shader shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown); return; } diff --git a/enginecustom/rendertextureclass.cpp b/enginecustom/rendertextureclass.cpp index 75b0a49..79fcfbe 100644 --- a/enginecustom/rendertextureclass.cpp +++ b/enginecustom/rendertextureclass.cpp @@ -21,7 +21,7 @@ RenderTextureClass::~RenderTextureClass() bool RenderTextureClass::Initialize(ID3D11Device * device, int textureWidth, int textureHeight, float screenDepth, float screenNear, int format) { - Logger::Get().Log("Initializing RenderTextureClass", __FILE__, __LINE__); + Logger::Get().Log("Initializing RenderTextureClass", __FILE__, __LINE__, Logger::LogLevel::Initialize); D3D11_TEXTURE2D_DESC textureDesc; HRESULT result; @@ -155,14 +155,14 @@ bool RenderTextureClass::Initialize(ID3D11Device * device, int textureWidth, int // Create an orthographic projection matrix for 2D rendering. m_orthoMatrix = XMMatrixOrthographicLH((float)textureWidth, (float)textureHeight, screenNear, screenDepth); - Logger::Get().Log("RenderTextureClass initialized", __FILE__, __LINE__); + Logger::Get().Log("RenderTextureClass initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize); return true; } void RenderTextureClass::Shutdown() { - Logger::Get().Log("Shutting down RenderTextureClass", __FILE__, __LINE__); + Logger::Get().Log("Shutting down RenderTextureClass", __FILE__, __LINE__, Logger::LogLevel::Shutdown); if (m_depthStencilView) { @@ -194,7 +194,7 @@ void RenderTextureClass::Shutdown() m_renderTargetTexture = 0; } - Logger::Get().Log("RenderTextureClass shut down", __FILE__, __LINE__); + Logger::Get().Log("RenderTextureClass shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown); return; } diff --git a/enginecustom/shadermanagerclass.cpp b/enginecustom/shadermanagerclass.cpp index d6406bd..a6d5be3 100644 --- a/enginecustom/shadermanagerclass.cpp +++ b/enginecustom/shadermanagerclass.cpp @@ -28,7 +28,7 @@ ShaderManagerClass::~ShaderManagerClass() bool ShaderManagerClass::Initialize(ID3D11Device* device, HWND hwnd) { - Logger::Get().Log("Initializing ShaderManagerClass", __FILE__, __LINE__); + Logger::Get().Log("Initializing ShaderManagerClass", __FILE__, __LINE__, Logger::LogLevel::Initialize); bool result; @@ -102,13 +102,13 @@ bool ShaderManagerClass::Initialize(ID3D11Device* device, HWND hwnd) return false; } - Logger::Get().Log("ShaderManagerClass initialized", __FILE__, __LINE__); // Create and initialize the light shader object. m_LightShader = new LightShaderClass; result = m_LightShader->Initialize(device, hwnd); if (!result) { + Logger::Get().Log("Error initializing LightShaderClass", __FILE__, __LINE__, Logger::LogLevel::Error); return false; } @@ -118,6 +118,7 @@ bool ShaderManagerClass::Initialize(ID3D11Device* device, HWND hwnd) result = m_LightMapShader->Initialize(device, hwnd); if (!result) { + Logger::Get().Log("Error initializing LightMapShaderClass", __FILE__, __LINE__, Logger::LogLevel::Error); return false; } @@ -139,12 +140,14 @@ bool ShaderManagerClass::Initialize(ID3D11Device* device, HWND hwnd) return false; } + Logger::Get().Log("ShaderManagerClass initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize); + return true; } void ShaderManagerClass::Shutdown() { - Logger::Get().Log("Shutting down ShaderManagerClass", __FILE__, __LINE__); + Logger::Get().Log("Shutting down ShaderManagerClass", __FILE__, __LINE__, Logger::LogLevel::Shutdown); // Release the normal map shader object. if (m_NormalMapShader) @@ -202,7 +205,6 @@ void ShaderManagerClass::Shutdown() m_TransparentShader = 0; } - Logger::Get().Log("ShaderManagerClass shut down", __FILE__, __LINE__); // Release the light shader object. if (m_LightShader) { @@ -235,6 +237,8 @@ void ShaderManagerClass::Shutdown() m_WaterShader = 0; } + Logger::Get().Log("ShaderManagerClass shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown); + return; } diff --git a/enginecustom/textureclass.cpp b/enginecustom/textureclass.cpp index ecdd88d..1a9f50d 100644 --- a/enginecustom/textureclass.cpp +++ b/enginecustom/textureclass.cpp @@ -19,7 +19,7 @@ TextureClass::~TextureClass() bool TextureClass::Initialize(ID3D11Device * device, ID3D11DeviceContext * deviceContext, std::string filename) { - Logger::Get().Log(("Iinitializing texture: %s", filename), __FILE__, __LINE__); + Logger::Get().Log(("Iinitializing texture: %s", filename), __FILE__, __LINE__, Logger::LogLevel::Initialize); bool result; D3D11_TEXTURE2D_DESC textureDesc; @@ -79,11 +79,15 @@ bool TextureClass::Initialize(ID3D11Device * device, ID3D11DeviceContext * devic delete[] m_targaData; m_targaData = 0; + Logger::Get().Log("Texture initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize); + return true; } void TextureClass::Shutdown() { + + Logger::Get().Log("Shutting down texture", __FILE__, __LINE__, Logger::LogLevel::Shutdown); // Release the texture view resource. if (m_textureView) { @@ -105,6 +109,8 @@ void TextureClass::Shutdown() m_targaData = 0; } + Logger::Get().Log("Texture shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown); + return; } @@ -115,6 +121,8 @@ ID3D11ShaderResourceView* TextureClass::GetTexture() bool TextureClass::LoadTarga(std::string filename) { + + Logger::Get().Log(("Loading targa file: %s", filename), __FILE__, __LINE__); int error, bpp, imageSize, index, i, j, k; FILE* filePtr; unsigned int count; @@ -216,7 +224,7 @@ bool TextureClass::LoadTarga(std::string filename) delete[] targaImage; targaImage = 0; - Logger::Get().Log("Targa file loaded", __FILE__, __LINE__); + Logger::Get().Log(("targa file %s loaded", filename), __FILE__, __LINE__); return true; } diff --git a/enginecustom/textureshaderclass.cpp b/enginecustom/textureshaderclass.cpp index 62b7e6f..a011ef9 100644 --- a/enginecustom/textureshaderclass.cpp +++ b/enginecustom/textureshaderclass.cpp @@ -23,7 +23,7 @@ TextureShaderClass::~TextureShaderClass() bool TextureShaderClass::Initialize(ID3D11Device* device, HWND hwnd) { - Logger::Get().Log("Initializing texture shader", __FILE__, __LINE__); + Logger::Get().Log("Initializing texture shader", __FILE__, __LINE__, Logger::LogLevel::Initialize); bool result; wchar_t vsFilename[128]; @@ -53,7 +53,7 @@ bool TextureShaderClass::Initialize(ID3D11Device* device, HWND hwnd) return false; } - Logger::Get().Log("Texture shader initialized", __FILE__, __LINE__); + Logger::Get().Log("Texture shader initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize); return true; } @@ -88,7 +88,7 @@ bool TextureShaderClass::Render(ID3D11DeviceContext* deviceContext, int indexCou bool TextureShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR* vsFilename, WCHAR* psFilename) { - Logger::Get().Log("Initializing shader", __FILE__, __LINE__); + Logger::Get().Log("Initializing shader", __FILE__, __LINE__, Logger::LogLevel::Initialize); HRESULT result; ID3D10Blob* errorMessage; @@ -232,14 +232,14 @@ bool TextureShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR return false; } - Logger::Get().Log("Shader initialized", __FILE__, __LINE__); + Logger::Get().Log("Shader initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize); return true; } void TextureShaderClass::ShutdownShader() { - Logger::Get().Log("Shutting down shader", __FILE__, __LINE__); + Logger::Get().Log("Shutting down shader", __FILE__, __LINE__, Logger::LogLevel::Shutdown); // Release the sampler state. if (m_sampleState) @@ -276,7 +276,7 @@ void TextureShaderClass::ShutdownShader() m_vertexShader = 0; } - Logger::Get().Log("Shader shut down", __FILE__, __LINE__); + Logger::Get().Log("Shader shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown); return; } diff --git a/enginecustom/translateshaderclass.cpp b/enginecustom/translateshaderclass.cpp index 45a407a..e427d55 100644 --- a/enginecustom/translateshaderclass.cpp +++ b/enginecustom/translateshaderclass.cpp @@ -24,7 +24,7 @@ TranslateShaderClass::~TranslateShaderClass() bool TranslateShaderClass::Initialize(ID3D11Device* device, HWND hwnd) { - Logger::Get().Log("Initilaizing TranslateShaderClass", __FILE__, __LINE__); + Logger::Get().Log("Initilaizing TranslateShaderClass", __FILE__, __LINE__, Logger::LogLevel::Initialize); bool result; wchar_t vsFilename[128]; @@ -55,7 +55,7 @@ bool TranslateShaderClass::Initialize(ID3D11Device* device, HWND hwnd) return false; } - Logger::Get().Log("TranslateShaderClass initialized", __FILE__, __LINE__); + Logger::Get().Log("TranslateShaderClass initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize); return true; } @@ -92,7 +92,7 @@ bool TranslateShaderClass::Render(ID3D11DeviceContext * deviceContext, int index bool TranslateShaderClass::InitializeShader(ID3D11Device * device, HWND hwnd, WCHAR * vsFilename, WCHAR * psFilename) { - Logger::Get().Log("Initializing translate shader", __FILE__, __LINE__); + Logger::Get().Log("Initializing translate shader", __FILE__, __LINE__, Logger::LogLevel::Initialize); HRESULT result; ID3D10Blob* errorMessage; @@ -255,7 +255,7 @@ bool TranslateShaderClass::InitializeShader(ID3D11Device * device, HWND hwnd, WC return false; } - Logger::Get().Log("Translate shader initialized", __FILE__, __LINE__); + Logger::Get().Log("Translate shader initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize); return true; } @@ -263,7 +263,7 @@ bool TranslateShaderClass::InitializeShader(ID3D11Device * device, HWND hwnd, WC void TranslateShaderClass::ShutdownShader() { - Logger::Get().Log("Shutting down translate shader", __FILE__, __LINE__); + Logger::Get().Log("Shutting down translate shader", __FILE__, __LINE__, Logger::LogLevel::Shutdown); // Release the texture translation constant buffer. if (m_translateBuffer) @@ -307,7 +307,7 @@ void TranslateShaderClass::ShutdownShader() m_vertexShader = 0; } - Logger::Get().Log("Translate shader shut down", __FILE__, __LINE__); + Logger::Get().Log("Translate shader shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown); return; } diff --git a/enginecustom/transparentshaderclass.cpp b/enginecustom/transparentshaderclass.cpp index 985a657..08e7f63 100644 --- a/enginecustom/transparentshaderclass.cpp +++ b/enginecustom/transparentshaderclass.cpp @@ -24,7 +24,7 @@ TransparentShaderClass::~TransparentShaderClass() bool TransparentShaderClass::Initialize(ID3D11Device* device, HWND hwnd) { - Logger::Get().Log("Initializing TransparentShaderClass", __FILE__, __LINE__); + Logger::Get().Log("Initializing TransparentShaderClass", __FILE__, __LINE__, Logger::LogLevel::Initialize); bool result; wchar_t vsFilename[128]; @@ -55,7 +55,7 @@ bool TransparentShaderClass::Initialize(ID3D11Device* device, HWND hwnd) return false; } - Logger::Get().Log("TransparentShaderClass initialized", __FILE__, __LINE__); + Logger::Get().Log("TransparentShaderClass initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize); return true; } @@ -92,7 +92,7 @@ bool TransparentShaderClass::Render(ID3D11DeviceContext* deviceContext, int inde bool TransparentShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR* vsFilename, WCHAR* psFilename) { - Logger::Get().Log("Initializing transparent shader", __FILE__, __LINE__); + Logger::Get().Log("Initializing transparent shader", __FILE__, __LINE__, Logger::LogLevel::Initialize); HRESULT result; ID3D10Blob* errorMessage; @@ -255,7 +255,7 @@ bool TransparentShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, W return false; } - Logger::Get().Log("Transparent shader initialized", __FILE__, __LINE__); + Logger::Get().Log("Transparent shader initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize); return true; } @@ -263,7 +263,7 @@ bool TransparentShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, W void TransparentShaderClass::ShutdownShader() { - Logger::Get().Log("Shutting down transparent shader", __FILE__, __LINE__); + Logger::Get().Log("Shutting down transparent shader", __FILE__, __LINE__, Logger::LogLevel::Shutdown); // Release the transparent constant buffer. if (m_transparentBuffer) @@ -307,7 +307,7 @@ void TransparentShaderClass::ShutdownShader() m_vertexShader = 0; } - Logger::Get().Log("Transparent shader shut down", __FILE__, __LINE__); + Logger::Get().Log("Transparent shader shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown); return; }