Merge branch 'main' of https://github.com/GamingCampus-AdrienBourgois/khaotic-engine
This commit is contained in:
commit
d52ea4b753
@ -37,6 +37,8 @@ This **DirectX11** based engine uses **ImGui** with an abstraction layer to enab
|
||||
- **Diffuse Lighting**
|
||||
- **Ambiant Lighting**
|
||||
- **Specular Lighting**
|
||||
- **Light Shader**
|
||||
- **Light Map Shader**
|
||||
- **Alpha Mapping**
|
||||
- **Normal Mapping**
|
||||
- **Specular Mapping**
|
||||
|
@ -5,9 +5,6 @@ ApplicationClass::ApplicationClass()
|
||||
m_Direct3D = 0;
|
||||
m_Camera = 0;
|
||||
m_Model = 0;
|
||||
m_LightShader = 0;
|
||||
m_Light = 0;
|
||||
m_TextureShader = 0;
|
||||
m_Bitmap = 0;
|
||||
m_Sprite = 0;
|
||||
m_Timer = 0;
|
||||
@ -102,17 +99,6 @@ bool ApplicationClass::Initialize(int screenWidth, int screenHeight, HWND hwnd)
|
||||
return false;
|
||||
}
|
||||
|
||||
// Create and initialize the texture shader object.
|
||||
m_TextureShader = new TextureShaderClass;
|
||||
|
||||
result = m_TextureShader->Initialize(m_Direct3D->GetDevice(), hwnd);
|
||||
if (!result)
|
||||
{
|
||||
logger.Log("Could not initialize the texture shader object", __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Create and initialize the render to texture object.
|
||||
m_RenderTexture = new RenderTextureClass;
|
||||
|
||||
@ -201,16 +187,6 @@ bool ApplicationClass::Initialize(int screenWidth, int screenHeight, HWND hwnd)
|
||||
return false;
|
||||
}
|
||||
|
||||
// Create and initialize the light shader object.
|
||||
m_LightShader = new LightShaderClass;
|
||||
|
||||
result = m_LightShader->Initialize(m_Direct3D->GetDevice(), hwnd);
|
||||
if (!result)
|
||||
{
|
||||
logger.Log("Could not initialize the light shader object", __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Create and initialize the light object.
|
||||
m_Light = new LightClass;
|
||||
|
||||
@ -322,7 +298,6 @@ bool ApplicationClass::Initialize(int screenWidth, int screenHeight, HWND hwnd)
|
||||
logger.Log(std::string("Exception caught during initialization: ") + e.what(), __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
logger.Log("Application class initialized", __FILE__, __LINE__);
|
||||
|
||||
return true;
|
||||
@ -450,14 +425,6 @@ void ApplicationClass::Shutdown()
|
||||
m_Light = 0;
|
||||
}
|
||||
|
||||
// Release the light shader object.
|
||||
if (m_LightShader)
|
||||
{
|
||||
m_LightShader->Shutdown();
|
||||
delete m_LightShader;
|
||||
m_LightShader = 0;
|
||||
}
|
||||
|
||||
// Release the model object.
|
||||
if (m_Model)
|
||||
{
|
||||
@ -637,7 +604,8 @@ bool ApplicationClass::RenderSceneToTexture(float rotation)
|
||||
// Render the model using the texture shader.
|
||||
m_Model->Render(m_Direct3D->GetDeviceContext());
|
||||
|
||||
result = m_TextureShader->Render(m_Direct3D->GetDeviceContext(), m_Model->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix, m_Model->GetTexture(1));
|
||||
result = m_ShaderManager->RenderTextureShader(m_Direct3D->GetDeviceContext(), m_Model->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix,
|
||||
m_Model->GetTexture(1));
|
||||
if (!result)
|
||||
{
|
||||
return false;
|
||||
@ -697,7 +665,7 @@ bool ApplicationClass::Render(float rotation, float x, float y, float z, float t
|
||||
m_Model->Render(m_Direct3D->GetDeviceContext());
|
||||
|
||||
// Render the model using the light shader.
|
||||
result = m_LightShader->Render(m_Direct3D->GetDeviceContext(), m_Model->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix, m_Model->GetTexture(0),
|
||||
result = m_ShaderManager->RenderlightShader(m_Direct3D->GetDeviceContext(), m_Model->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix, m_Model->GetTexture(0),
|
||||
diffuseColor, lightPosition);
|
||||
|
||||
for (auto cube : m_cubes)
|
||||
@ -719,7 +687,7 @@ bool ApplicationClass::Render(float rotation, float x, float y, float z, float t
|
||||
|
||||
cube->Render(m_Direct3D->GetDeviceContext());
|
||||
|
||||
result = m_LightShader->Render(m_Direct3D->GetDeviceContext(), m_Model->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix, m_Model->GetTexture(0),
|
||||
result = m_ShaderManager->RenderlightShader(m_Direct3D->GetDeviceContext(), m_Model->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix, m_Model->GetTexture(0),
|
||||
diffuseColor, lightPosition);
|
||||
if (!result)
|
||||
{
|
||||
@ -743,7 +711,7 @@ bool ApplicationClass::Render(float rotation, float x, float y, float z, float t
|
||||
|
||||
object->Render(m_Direct3D->GetDeviceContext());
|
||||
|
||||
result = m_LightShader->Render(m_Direct3D->GetDeviceContext(), m_Model->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix, m_Model->GetTexture(0),
|
||||
result = m_ShaderManager->RenderlightShader(m_Direct3D->GetDeviceContext(), m_Model->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix, m_Model->GetTexture(0),
|
||||
diffuseColor, lightPosition);
|
||||
|
||||
if (!result)
|
||||
@ -766,8 +734,9 @@ bool ApplicationClass::Render(float rotation, float x, float y, float z, float t
|
||||
|
||||
chunk->Render(m_Direct3D->GetDeviceContext());
|
||||
|
||||
result = m_LightShader->Render(m_Direct3D->GetDeviceContext(), chunk->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix, chunk->GetTexture(5),
|
||||
result = m_ShaderManager->RenderlightShader(m_Direct3D->GetDeviceContext(), chunk->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix, chunk->GetTexture(5),
|
||||
diffuseColor, lightPosition);
|
||||
|
||||
if (!result)
|
||||
{
|
||||
logger.Log("Could not render the terrain model using the light shader", __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||
@ -781,7 +750,8 @@ bool ApplicationClass::Render(float rotation, float x, float y, float z, float t
|
||||
// Render the display plane using the texture shader and the render texture resource.
|
||||
m_DisplayPlane->Render(m_Direct3D->GetDeviceContext());
|
||||
|
||||
result = m_TextureShader->Render(m_Direct3D->GetDeviceContext(), m_DisplayPlane->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix, m_RenderTexture->GetShaderResourceView());
|
||||
result = m_ShaderManager->RenderTextureShader(m_Direct3D->GetDeviceContext(), m_DisplayPlane->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix,
|
||||
m_RenderTexture->GetShaderResourceView());
|
||||
if (!result)
|
||||
{
|
||||
logger.Log("Could not render the display plane using the texture shader", __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||
@ -794,7 +764,8 @@ bool ApplicationClass::Render(float rotation, float x, float y, float z, float t
|
||||
// Render the display plane using the texture shader and the render texture resource.
|
||||
m_DisplayPlane->Render(m_Direct3D->GetDeviceContext());
|
||||
|
||||
result = m_TextureShader->Render(m_Direct3D->GetDeviceContext(), m_DisplayPlane->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix, m_RenderTexture->GetShaderResourceView());
|
||||
result = m_ShaderManager->RenderTextureShader(m_Direct3D->GetDeviceContext(), m_DisplayPlane->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix,
|
||||
m_RenderTexture->GetShaderResourceView());
|
||||
if (!result)
|
||||
{
|
||||
logger.Log("Could not render the display plane using the texture shader", __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||
@ -807,7 +778,8 @@ bool ApplicationClass::Render(float rotation, float x, float y, float z, float t
|
||||
// Render the display plane using the texture shader and the render texture resource.
|
||||
m_DisplayPlane->Render(m_Direct3D->GetDeviceContext());
|
||||
|
||||
result = m_TextureShader->Render(m_Direct3D->GetDeviceContext(), m_DisplayPlane->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix, m_RenderTexture->GetShaderResourceView());
|
||||
result = m_ShaderManager->RenderTextureShader(m_Direct3D->GetDeviceContext(), m_DisplayPlane->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix,
|
||||
m_RenderTexture->GetShaderResourceView());
|
||||
if (!result)
|
||||
{
|
||||
logger.Log("Could not render the display plane using the texture shader", __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||
@ -844,8 +816,8 @@ bool ApplicationClass::Render(float rotation, float x, float y, float z, float t
|
||||
// Render the model using the light shader.
|
||||
m_Model->Render(m_Direct3D->GetDeviceContext());
|
||||
|
||||
result = m_LightShader->Render(m_Direct3D->GetDeviceContext(), m_Model->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix,
|
||||
m_Model->GetTexture(0), diffuseColor, lightPosition);
|
||||
result = m_ShaderManager->RenderlightShader(m_Direct3D->GetDeviceContext(), m_Model->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix, m_Model->GetTexture(0),
|
||||
diffuseColor, lightPosition);
|
||||
if (!result)
|
||||
{
|
||||
logger.Log("Could not render the model using the light shader", __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||
@ -916,7 +888,8 @@ bool ApplicationClass::Render(float rotation, float x, float y, float z, float t
|
||||
}
|
||||
|
||||
// Render the sprite with the texture shader.
|
||||
result = m_TextureShader->Render(m_Direct3D->GetDeviceContext(), m_Sprite->GetIndexCount(), worldMatrix, viewMatrix, orthoMatrix, m_Sprite->GetTexture());
|
||||
result = m_ShaderManager->RenderTextureShader(m_Direct3D->GetDeviceContext(), m_Model->GetIndexCount(), worldMatrix, viewMatrix, orthoMatrix,
|
||||
m_Sprite->GetTexture());
|
||||
if (!result)
|
||||
{
|
||||
logger.Log("Could not render the sprite using the texture shader", __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||
@ -1075,27 +1048,34 @@ bool ApplicationClass::Render(float rotation, float x, float y, float z, float t
|
||||
return false;
|
||||
}
|
||||
|
||||
// Turn off alpha blending.
|
||||
m_Direct3D->DisableAlphaBlending();
|
||||
// Setup matrices.
|
||||
rotateMatrix = XMMatrixRotationY(rotation);
|
||||
translateMatrix = XMMatrixTranslation(-10.0f, -2.0f, -20.0f);
|
||||
worldMatrix = XMMatrixMultiply(rotateMatrix, translateMatrix);
|
||||
|
||||
// Render the model using the transparent shader.
|
||||
m_Model->Render(m_Direct3D->GetDeviceContext());
|
||||
|
||||
result = m_ShaderManager->RenderlightShader(m_Direct3D->GetDeviceContext(), m_Model->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix, m_Model->GetTexture(0), diffuseColor, lightPosition);
|
||||
if (!result)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Setup matrices.
|
||||
rotateMatrix = XMMatrixRotationY(rotation);
|
||||
translateMatrix = XMMatrixTranslation(-10.0f, 1.0f, -20.0f);
|
||||
worldMatrix = XMMatrixMultiply(rotateMatrix, translateMatrix);
|
||||
|
||||
// Render the model using the transparent shader.
|
||||
m_Model->Render(m_Direct3D->GetDeviceContext());
|
||||
|
||||
result = m_ShaderManager->RenderlightMapShader(m_Direct3D->GetDeviceContext(), m_Model->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix, m_Model->GetTexture(0), m_Model->GetTexture(4));
|
||||
if (!result)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Lighting, utilise plusieurs lights donc Multiple Points Lighting
|
||||
//result = m_LightShader->Render(m_Direct3D->GetDeviceContext(), m_Model->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix, m_Model->GetTexture(0),
|
||||
// diffuseColor, lightPosition);
|
||||
//if (!result)
|
||||
//{
|
||||
// return false;
|
||||
//}
|
||||
|
||||
// Lightmapping, utiliser light01.tga en deuxieme texture
|
||||
//result = m_LightMapShader->Render(m_Direct3D->GetDeviceContext(), m_Model->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix,
|
||||
// m_Model->GetTexture(0), m_Model->GetTexture(1));
|
||||
//if (!result)
|
||||
//{
|
||||
// return false;
|
||||
//}
|
||||
|
||||
|
||||
// Enable the Z buffer and disable alpha blending now that 2D rendering is complete.
|
||||
m_Direct3D->TurnZBufferOn();
|
||||
m_Direct3D->DisableAlphaBlending();
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include "lightmapshaderclass.h"
|
||||
#include "bitmapclass.h"
|
||||
#include "spriteclass.h"
|
||||
#include "textureshaderclass.h"
|
||||
#include "timerclass.h"
|
||||
#include "fontshaderclass.h"
|
||||
#include "fontclass.h"
|
||||
@ -30,8 +29,6 @@
|
||||
#include "rendertextureclass.h"
|
||||
#include "displayplaneclass.h"
|
||||
#include "reflectionshaderclass.h"
|
||||
#include "transparentshaderclass.h"
|
||||
|
||||
|
||||
|
||||
/////////////
|
||||
@ -102,9 +99,6 @@ private :
|
||||
D3DClass* m_Direct3D;
|
||||
IDXGISwapChain* m_swapChain;
|
||||
ModelClass* m_Model;
|
||||
TextureShaderClass* m_TextureShader;
|
||||
/*TransparentShaderClass* m_TransparentShader;*/
|
||||
ShaderManagerClass* m_ShaderManager;
|
||||
ModelListClass* m_ModelList;
|
||||
|
||||
// ------------------------------------- //
|
||||
@ -141,8 +135,7 @@ private :
|
||||
// ------------- SHADERS ------------- //
|
||||
// ----------------------------------- //
|
||||
|
||||
LightShaderClass* m_LightShader;
|
||||
LightMapShaderClass* m_LightMapShader;
|
||||
ShaderManagerClass* m_ShaderManager;
|
||||
FontShaderClass* m_FontShader;
|
||||
ReflectionShaderClass* m_ReflectionShader;
|
||||
|
||||
|
@ -188,7 +188,6 @@
|
||||
</CopyFileToFolders>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CopyFileToFolders Include="..\..\..\..\Downloads\grass.tga" />
|
||||
<CopyFileToFolders Include="alpha01.tga" />
|
||||
<Image Include="dirt01.tga" />
|
||||
<CopyFileToFolders Include="font01.tga" />
|
||||
@ -206,10 +205,10 @@
|
||||
<Image Include="wall.tga" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CopyFileToFolders Include="..\..\..\..\Downloads\chunk.txt" />
|
||||
<CopyFileToFolders Include="cube.txt" />
|
||||
<CopyFileToFolders Include="font01.txt" />
|
||||
<CopyFileToFolders Include="plane.txt" />
|
||||
<Text Include="chunk.txt" />
|
||||
<Text Include="sphere.txt" />
|
||||
<CopyFileToFolders Include="sprite_data_01.txt" />
|
||||
<Text Include="square.txt" />
|
||||
|
@ -123,9 +123,6 @@
|
||||
<ClCompile Include="fpsclass.cpp">
|
||||
<Filter>Fichiers sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="lightmapshaderclass.cpp">
|
||||
<Filter>Fichiers sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="alphamapshaderclass.cpp">
|
||||
<Filter>Fichiers sources</Filter>
|
||||
</ClCompile>
|
||||
@ -162,6 +159,9 @@
|
||||
<ClCompile Include="transparentshaderclass.cpp">
|
||||
<Filter>Fichiers sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="lightmapshaderclass.cpp">
|
||||
<Filter>Fichiers sources</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="systemclass.h">
|
||||
@ -307,81 +307,15 @@
|
||||
<Image Include="papier.tga">
|
||||
<Filter>assets</Filter>
|
||||
</Image>
|
||||
<Image Include="moss01.tga">
|
||||
<Filter>assets</Filter>
|
||||
</Image>
|
||||
<Image Include="light01.tga">
|
||||
<Filter>assets</Filter>
|
||||
</Image>
|
||||
<Image Include="dirt01.tga">
|
||||
<Filter>assets</Filter>
|
||||
</Image>
|
||||
<Image Include="alpha01.tga">
|
||||
<Filter>assets</Filter>
|
||||
</Image>
|
||||
<Image Include="normal01.tga">
|
||||
<Filter>assets</Filter>
|
||||
</Image>
|
||||
<Image Include="..\..\..\..\Downloads\grass.tga">
|
||||
<Filter>Assets</Filter>
|
||||
</Image>
|
||||
<Image Include="KhaoticIcon.ico">
|
||||
<Filter>Assets</Filter>
|
||||
</Image>
|
||||
<Image Include="sprite02.tga" />
|
||||
<Image Include="sprite03.tga" />
|
||||
<Image Include="sprite04.tga" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
<None Include="Color.ps">
|
||||
<Filter>shader</Filter>
|
||||
</None>
|
||||
<None Include="light.vs">
|
||||
<Filter>shader</Filter>
|
||||
</None>
|
||||
<None Include="lightmap.vs">
|
||||
<Filter>shader</Filter>
|
||||
</None>
|
||||
<None Include="lightmap.ps">
|
||||
<Filter>shader</Filter>
|
||||
</None>
|
||||
<None Include="alphamap.vs">
|
||||
<Filter>texture</Filter>
|
||||
</None>
|
||||
<None Include="alphamap.ps">
|
||||
<Filter>texture</Filter>
|
||||
</None>
|
||||
<None Include="normalmap.vs">
|
||||
<Filter>shader</Filter>
|
||||
</None>
|
||||
<None Include="normalmap.ps">
|
||||
<Filter>shader</Filter>
|
||||
</None>
|
||||
<None Include="texture.ps">
|
||||
<Filter>Texture</Filter>
|
||||
</None>
|
||||
<None Include="texture.vs">
|
||||
<Filter>Texture</Filter>
|
||||
</None>
|
||||
<None Include="Multitexture.ps">
|
||||
<Filter>Texture</Filter>
|
||||
</None>
|
||||
<None Include="Multitexture.vs">
|
||||
<Filter>Texture</Filter>
|
||||
</None>
|
||||
<None Include="translate.vs">
|
||||
<Filter>shader</Filter>
|
||||
</None>
|
||||
<None Include="translate.ps">
|
||||
<Filter>shader</Filter>
|
||||
</None>
|
||||
<None Include="reflection.vs" />
|
||||
<None Include="reflection.ps" />
|
||||
<None Include="specmap.ps" />
|
||||
<None Include="specmap.vs" />
|
||||
<None Include="transparent.ps" />
|
||||
<None Include="transparent.vs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="sphere.txt">
|
||||
@ -390,6 +324,9 @@
|
||||
<Text Include="square.txt">
|
||||
<Filter>assets</Filter>
|
||||
</Text>
|
||||
<Text Include="chunk.txt">
|
||||
<Filter>Assets</Filter>
|
||||
</Text>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="resources.rc">
|
||||
@ -415,19 +352,63 @@
|
||||
<CopyFileToFolders Include="font01.tga">
|
||||
<Filter>fonts</Filter>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="sprite_data_01.txt" />
|
||||
<CopyFileToFolders Include="sprite01.tga" />
|
||||
<CopyFileToFolders Include="stone01.tga">
|
||||
<Filter>assets</Filter>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="cube.txt">
|
||||
<Filter>Assets</Filter>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="spec02.tga" />
|
||||
<CopyFileToFolders Include="..\..\..\..\Downloads\chunk.txt">
|
||||
<CopyFileToFolders Include="plane.txt">
|
||||
<Filter>Assets</Filter>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="plane.txt">
|
||||
<CopyFileToFolders Include="alphamap.ps" />
|
||||
<CopyFileToFolders Include="alphamap.vs" />
|
||||
<CopyFileToFolders Include="light.vs" />
|
||||
<CopyFileToFolders Include="lightmap.ps" />
|
||||
<CopyFileToFolders Include="lightmap.vs" />
|
||||
<CopyFileToFolders Include="Multitexture.ps" />
|
||||
<CopyFileToFolders Include="Multitexture.vs" />
|
||||
<CopyFileToFolders Include="normalmap.ps" />
|
||||
<CopyFileToFolders Include="normalmap.vs" />
|
||||
<CopyFileToFolders Include="reflection.ps" />
|
||||
<CopyFileToFolders Include="reflection.vs" />
|
||||
<CopyFileToFolders Include="specmap.ps" />
|
||||
<CopyFileToFolders Include="specmap.vs" />
|
||||
<CopyFileToFolders Include="texture.ps" />
|
||||
<CopyFileToFolders Include="texture.vs" />
|
||||
<CopyFileToFolders Include="transparent.ps" />
|
||||
<CopyFileToFolders Include="transparent.vs" />
|
||||
<CopyFileToFolders Include="Color.ps" />
|
||||
<CopyFileToFolders Include="translate.ps" />
|
||||
<CopyFileToFolders Include="translate.vs" />
|
||||
<CopyFileToFolders Include="alpha01.tga">
|
||||
<Filter>Assets</Filter>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="light01.tga">
|
||||
<Filter>Assets</Filter>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="moss01.tga">
|
||||
<Filter>Assets</Filter>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="normal01.tga">
|
||||
<Filter>Assets</Filter>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="spec02.tga">
|
||||
<Filter>Assets</Filter>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="sprite01.tga">
|
||||
<Filter>Assets</Filter>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="sprite02.tga">
|
||||
<Filter>Assets</Filter>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="sprite_data_01.txt">
|
||||
<Filter>Assets</Filter>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="sprite03.tga">
|
||||
<Filter>Assets</Filter>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="sprite04.tga">
|
||||
<Filter>Assets</Filter>
|
||||
</CopyFileToFolders>
|
||||
</ItemGroup>
|
||||
|
@ -9,6 +9,8 @@ ShaderManagerClass::ShaderManagerClass()
|
||||
m_AlphaMapShader = 0;
|
||||
m_SpecMapShader = 0;
|
||||
m_TransparentShader = 0;
|
||||
m_LightShader = 0;
|
||||
m_LightMapShader = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -88,7 +90,7 @@ bool ShaderManagerClass::Initialize(ID3D11Device* device, HWND hwnd)
|
||||
return false;
|
||||
}
|
||||
|
||||
// Create and initialize the specular map shader object.
|
||||
// Create and initialize the transparent shader object.
|
||||
m_TransparentShader = new TransparentShaderClass;
|
||||
|
||||
result = m_TransparentShader->Initialize(device, hwnd);
|
||||
@ -99,6 +101,23 @@ bool ShaderManagerClass::Initialize(ID3D11Device* device, HWND hwnd)
|
||||
}
|
||||
|
||||
logger.Log("ShaderManagerClass initialized", __FILE__, __LINE__);
|
||||
// Create and initialize the light shader object.
|
||||
m_LightShader = new LightShaderClass;
|
||||
|
||||
result = m_LightShader->Initialize(device, hwnd);
|
||||
if (!result)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Create and initialize the light map shader object.
|
||||
m_LightMapShader = new LightMapShaderClass;
|
||||
|
||||
result = m_LightMapShader->Initialize(device, hwnd);
|
||||
if (!result)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -164,6 +183,21 @@ void ShaderManagerClass::Shutdown()
|
||||
}
|
||||
|
||||
logger.Log("ShaderManagerClass shut down", __FILE__, __LINE__);
|
||||
// Release the light shader object.
|
||||
if (m_LightShader)
|
||||
{
|
||||
m_LightShader->Shutdown();
|
||||
delete m_LightShader;
|
||||
m_LightShader = 0;
|
||||
}
|
||||
|
||||
// Release the light map shader object.
|
||||
if (m_LightMapShader)
|
||||
{
|
||||
m_LightMapShader->Shutdown();
|
||||
delete m_LightMapShader;
|
||||
m_LightMapShader = 0;
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
@ -280,5 +314,35 @@ bool ShaderManagerClass::RenderTransparentShader(ID3D11DeviceContext* deviceCont
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ShaderManagerClass::RenderlightShader(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix,
|
||||
ID3D11ShaderResourceView* texture, XMFLOAT4 diffuseColor[], XMFLOAT4 lightPosition[])
|
||||
{
|
||||
bool result;
|
||||
|
||||
|
||||
result = m_LightShader->Render(deviceContext, indexCount, worldMatrix, viewMatrix, projectionMatrix, texture, diffuseColor, lightPosition);
|
||||
if (!result)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ShaderManagerClass::RenderlightMapShader(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix,
|
||||
XMMATRIX projectionMatrix, ID3D11ShaderResourceView* texture1, ID3D11ShaderResourceView* texture2)
|
||||
{
|
||||
bool result;
|
||||
|
||||
|
||||
result = m_LightMapShader->Render(deviceContext, indexCount, worldMatrix, viewMatrix, projectionMatrix, texture1, texture2);
|
||||
if (!result)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
@ -11,6 +11,8 @@
|
||||
#include "alphamapshaderclass.h"
|
||||
#include "specmapshaderclass.h"
|
||||
#include "transparentshaderclass.h"
|
||||
#include "lightshaderclass.h"
|
||||
#include "lightmapshaderclass.h"
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -33,6 +35,8 @@ public:
|
||||
bool RenderSpecMapShader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*,
|
||||
XMFLOAT3, XMFLOAT4, XMFLOAT3, XMFLOAT4, float);
|
||||
bool RenderTransparentShader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, float);
|
||||
bool RenderlightShader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT4[], XMFLOAT4[]);
|
||||
bool RenderlightMapShader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*);
|
||||
|
||||
private:
|
||||
TextureShaderClass* m_TextureShader;
|
||||
@ -44,6 +48,8 @@ private:
|
||||
TransparentShaderClass* m_TransparentShader;
|
||||
|
||||
Logger logger;
|
||||
LightShaderClass* m_LightShader;
|
||||
LightMapShaderClass* m_LightMapShader;
|
||||
};
|
||||
|
||||
#endif
|
Loading…
x
Reference in New Issue
Block a user