Minor: Ajout du Light Map Shader au Sheder Manager
This commit is contained in:
parent
1345537486
commit
c6f97490d1
@ -99,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;
|
||||
|
||||
@ -198,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;
|
||||
|
||||
@ -1083,27 +1062,20 @@ 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, 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();
|
||||
|
@ -101,9 +101,6 @@ private :
|
||||
D3DClass* m_Direct3D;
|
||||
IDXGISwapChain* m_swapChain;
|
||||
ModelClass* m_Model;
|
||||
TextureShaderClass* m_TextureShader;
|
||||
/*TransparentShaderClass* m_TransparentShader;*/
|
||||
ShaderManagerClass* m_ShaderManager;
|
||||
ModelListClass* m_ModelList;
|
||||
|
||||
// ------------------------------------- //
|
||||
@ -140,8 +137,7 @@ private :
|
||||
// ------------- SHADERS ------------- //
|
||||
// ----------------------------------- //
|
||||
|
||||
LightShaderClass* m_LightShader;
|
||||
LightMapShaderClass* m_LightMapShader;
|
||||
ShaderManagerClass* m_ShaderManager;
|
||||
FontShaderClass* m_FontShader;
|
||||
ReflectionShaderClass* m_ReflectionShader;
|
||||
|
||||
|
@ -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">
|
||||
@ -352,15 +352,12 @@
|
||||
<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="plane.txt">
|
||||
<Filter>Assets</Filter>
|
||||
</CopyFileToFolders>
|
||||
@ -382,15 +379,37 @@
|
||||
<CopyFileToFolders Include="transparent.ps" />
|
||||
<CopyFileToFolders Include="transparent.vs" />
|
||||
<CopyFileToFolders Include="Color.ps" />
|
||||
<CopyFileToFolders Include="..\..\..\..\Downloads\grass.tga" />
|
||||
<CopyFileToFolders Include="alpha01.tga" />
|
||||
<CopyFileToFolders Include="light01.tga" />
|
||||
<CopyFileToFolders Include="moss01.tga" />
|
||||
<CopyFileToFolders Include="normal01.tga" />
|
||||
<CopyFileToFolders Include="sprite02.tga" />
|
||||
<CopyFileToFolders Include="sprite03.tga" />
|
||||
<CopyFileToFolders Include="sprite04.tga" />
|
||||
<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>
|
||||
</Project>
|
@ -10,6 +10,7 @@ ShaderManagerClass::ShaderManagerClass()
|
||||
m_SpecMapShader = 0;
|
||||
m_TransparentShader = 0;
|
||||
m_LightShader = 0;
|
||||
m_LightMapShader = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -81,7 +82,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);
|
||||
@ -90,7 +91,7 @@ bool ShaderManagerClass::Initialize(ID3D11Device* device, HWND hwnd)
|
||||
return false;
|
||||
}
|
||||
|
||||
// Create and initialize the light map shader object.
|
||||
// Create and initialize the light shader object.
|
||||
m_LightShader = new LightShaderClass;
|
||||
|
||||
result = m_LightShader->Initialize(device, hwnd);
|
||||
@ -99,6 +100,15 @@ bool ShaderManagerClass::Initialize(ID3D11Device* device, HWND hwnd)
|
||||
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;
|
||||
}
|
||||
|
||||
@ -160,7 +170,7 @@ void ShaderManagerClass::Shutdown()
|
||||
m_TransparentShader = 0;
|
||||
}
|
||||
|
||||
// Release the transparent shader object.
|
||||
// Release the light shader object.
|
||||
if (m_LightShader)
|
||||
{
|
||||
m_LightShader->Shutdown();
|
||||
@ -168,6 +178,14 @@ void ShaderManagerClass::Shutdown()
|
||||
m_LightShader = 0;
|
||||
}
|
||||
|
||||
// Release the light map shader object.
|
||||
if (m_LightMapShader)
|
||||
{
|
||||
m_LightMapShader->Shutdown();
|
||||
delete m_LightMapShader;
|
||||
m_LightMapShader = 0;
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
@ -291,5 +309,20 @@ bool ShaderManagerClass::RenderlightShader(ID3D11DeviceContext* deviceContext, i
|
||||
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;
|
||||
}
|
@ -12,6 +12,7 @@
|
||||
#include "specmapshaderclass.h"
|
||||
#include "transparentshaderclass.h"
|
||||
#include "lightshaderclass.h"
|
||||
#include "lightmapshaderclass.h"
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -35,6 +36,7 @@ public:
|
||||
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;
|
||||
@ -45,6 +47,7 @@ private:
|
||||
SpecMapShaderClass* m_SpecMapShader;
|
||||
TransparentShaderClass* m_TransparentShader;
|
||||
LightShaderClass* m_LightShader;
|
||||
LightMapShaderClass* m_LightMapShader;
|
||||
};
|
||||
|
||||
#endif
|
Loading…
x
Reference in New Issue
Block a user