Shader manager
Erreur de transformation
This commit is contained in:
parent
563fea3d75
commit
cf14772018
@ -22,8 +22,7 @@ ApplicationClass::ApplicationClass()
|
|||||||
m_TextString3 = 0;
|
m_TextString3 = 0;
|
||||||
m_Fps = 0;
|
m_Fps = 0;
|
||||||
m_FpsString = 0;
|
m_FpsString = 0;
|
||||||
m_NormalMapShader = 0;
|
m_ShaderManager = 0;
|
||||||
m_SpecMapShader = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -74,25 +73,7 @@ bool ApplicationClass::Initialize(int screenWidth, int screenHeight, HWND hwnd)
|
|||||||
m_Camera->SetPosition(0.0f, 0.0f, -12.0f);
|
m_Camera->SetPosition(0.0f, 0.0f, -12.0f);
|
||||||
m_Camera->SetRotation(0.0f, 0.0f, 0.0f);
|
m_Camera->SetRotation(0.0f, 0.0f, 0.0f);
|
||||||
|
|
||||||
// Create and initialize the specular map shader object.
|
return true;
|
||||||
m_SpecMapShader = new SpecMapShaderClass;
|
|
||||||
|
|
||||||
result = m_SpecMapShader->Initialize(m_Direct3D->GetDevice(), hwnd);
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
MessageBox(hwnd, L"Could not initialize the specular map shader object.", L"Error", MB_OK);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create and initialize the normal map shader object.
|
|
||||||
m_NormalMapShader = new NormalMapShaderClass;
|
|
||||||
|
|
||||||
result = m_NormalMapShader->Initialize(m_Direct3D->GetDevice(), hwnd);
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
MessageBox(hwnd, L"Could not initialize the normal map shader object.", L"Error", MB_OK);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create and initialize the font shader object.
|
// Create and initialize the font shader object.
|
||||||
m_FontShader = new FontShaderClass;
|
m_FontShader = new FontShaderClass;
|
||||||
@ -262,25 +243,15 @@ bool ApplicationClass::Initialize(int screenWidth, int screenHeight, HWND hwnd)
|
|||||||
m_Light->SetSpecularColor(1.0f, 1.0f, 1.0f, 1.0f);
|
m_Light->SetSpecularColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
m_Light->SetSpecularPower(16.0f);
|
m_Light->SetSpecularPower(16.0f);
|
||||||
|
|
||||||
// Set the number of lights we will use.
|
|
||||||
m_numLights = 4;
|
|
||||||
|
|
||||||
// Create and initialize the light objects array.
|
// Create and initialize the normal map shader object.
|
||||||
m_Lights = new LightClass[m_numLights];
|
m_ShaderManager = new ShaderManagerClass;
|
||||||
|
|
||||||
// Manually set the color and position of each light.
|
|
||||||
m_Lights[0].SetDiffuseColor(1.0f, 0.0f, 0.0f, 1.0f); // Red
|
|
||||||
m_Lights[0].SetPosition(-3.0f, 1.0f, 3.0f);
|
|
||||||
|
|
||||||
m_Lights[1].SetDiffuseColor(0.0f, 1.0f, 0.0f, 1.0f); // Green
|
|
||||||
m_Lights[1].SetPosition(3.0f, 1.0f, 3.0f);
|
|
||||||
|
|
||||||
m_Lights[2].SetDiffuseColor(0.0f, 0.0f, 1.0f, 1.0f); // Blue
|
|
||||||
m_Lights[2].SetPosition(-3.0f, 1.0f, -3.0f);
|
|
||||||
|
|
||||||
m_Lights[3].SetDiffuseColor(1.0f, 1.0f, 1.0f, 1.0f); // White
|
|
||||||
m_Lights[3].SetPosition(3.0f, 1.0f, -3.0f);
|
|
||||||
|
|
||||||
|
result = m_ShaderManager->Initialize(m_Direct3D->GetDevice(), hwnd);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
// Create and initialize the light map shader object.
|
// Create and initialize the light map shader object.
|
||||||
m_LightMapShader = new LightMapShaderClass;
|
m_LightMapShader = new LightMapShaderClass;
|
||||||
|
|
||||||
@ -326,6 +297,14 @@ bool ApplicationClass::Initialize(int screenWidth, int screenHeight, HWND hwnd)
|
|||||||
|
|
||||||
void ApplicationClass::Shutdown()
|
void ApplicationClass::Shutdown()
|
||||||
{
|
{
|
||||||
|
// Release the shader manager object.
|
||||||
|
if (m_ShaderManager)
|
||||||
|
{
|
||||||
|
m_ShaderManager->Shutdown();
|
||||||
|
delete m_ShaderManager;
|
||||||
|
m_ShaderManager = 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Release the text objects for the mouse strings.
|
// Release the text objects for the mouse strings.
|
||||||
if (m_MouseStrings)
|
if (m_MouseStrings)
|
||||||
{
|
{
|
||||||
@ -404,12 +383,12 @@ void ApplicationClass::Shutdown()
|
|||||||
m_Sprite = 0;
|
m_Sprite = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Release the light objects.
|
// Release the light object.
|
||||||
if(m_Lights)
|
if (m_Light)
|
||||||
{
|
{
|
||||||
delete [] m_Lights;
|
delete m_Light;
|
||||||
m_Lights = 0;
|
m_Light = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Release the light shader object.
|
// Release the light shader object.
|
||||||
if (m_LightShader)
|
if (m_LightShader)
|
||||||
@ -427,22 +406,6 @@ void ApplicationClass::Shutdown()
|
|||||||
m_Model = 0;
|
m_Model = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Release the specular map shader object.
|
|
||||||
if (m_SpecMapShader)
|
|
||||||
{
|
|
||||||
m_SpecMapShader->Shutdown();
|
|
||||||
delete m_SpecMapShader;
|
|
||||||
m_SpecMapShader = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Release the normal map shader object.
|
|
||||||
if (m_NormalMapShader)
|
|
||||||
{
|
|
||||||
m_NormalMapShader->Shutdown();
|
|
||||||
delete m_NormalMapShader;
|
|
||||||
m_NormalMapShader = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Release the multitexture shader object.
|
// Release the multitexture shader object.
|
||||||
if (m_MultiTextureShader)
|
if (m_MultiTextureShader)
|
||||||
{
|
{
|
||||||
@ -500,9 +463,9 @@ bool ApplicationClass::Frame(InputClass* Input)
|
|||||||
|
|
||||||
float frameTime;
|
float frameTime;
|
||||||
static float rotation = 360.0f;
|
static float rotation = 360.0f;
|
||||||
static float x = 6.f;
|
static float x = 0.f;
|
||||||
static float y = 3.f;
|
static float y = 0.f;
|
||||||
static float z = 0.f;
|
static float z = -8.f;
|
||||||
|
|
||||||
// Check if the user pressed escape and wants to exit the application.
|
// Check if the user pressed escape and wants to exit the application.
|
||||||
if (Input->IsEscapePressed())
|
if (Input->IsEscapePressed())
|
||||||
@ -524,13 +487,13 @@ bool ApplicationClass::Frame(InputClass* Input)
|
|||||||
rotation += 360.0f;
|
rotation += 360.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the x position variable each frame.
|
//// Update the x position variable each frame.
|
||||||
x -= 0.0174532925f * 0.6f;
|
//x -= 0.0174532925f * 0.6f;
|
||||||
|
|
||||||
y -= 0.0174532925f * 0.2f;
|
//y -= 0.0174532925f * 0.2f;
|
||||||
|
|
||||||
// Update the z position variable each frame.
|
//// Update the z position variable each frame.
|
||||||
z -= 0.0174532925f * 0.2f;
|
//z -= 0.0174532925f * 0.2f;
|
||||||
|
|
||||||
|
|
||||||
// Render the graphics scene.
|
// Render the graphics scene.
|
||||||
@ -540,6 +503,64 @@ bool ApplicationClass::Frame(InputClass* Input)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
XMMATRIX worldMatrix, viewMatrix, projectionMatrix, rotateMatrix, translateMatrix;
|
||||||
|
|
||||||
|
// Clear the buffers to begin the scene.
|
||||||
|
m_Direct3D->BeginScene(0.0f, 0.0f, 0.0f, 1.0f);
|
||||||
|
|
||||||
|
// Get the world, view, and projection matrices from the camera and d3d objects.
|
||||||
|
m_Direct3D->GetWorldMatrix(worldMatrix);
|
||||||
|
m_Camera->GetViewMatrix(viewMatrix);
|
||||||
|
m_Direct3D->GetProjectionMatrix(projectionMatrix);
|
||||||
|
|
||||||
|
// Setup matrices.
|
||||||
|
rotateMatrix = XMMatrixRotationY(rotation);
|
||||||
|
translateMatrix = XMMatrixTranslation(0.0f, 1.0f, 0.0f);
|
||||||
|
worldMatrix = XMMatrixMultiply(rotateMatrix, translateMatrix);
|
||||||
|
|
||||||
|
// Render the model using the texture shader.
|
||||||
|
m_Model->Render(m_Direct3D->GetDeviceContext());
|
||||||
|
|
||||||
|
result = m_ShaderManager->RenderTextureShader(m_Direct3D->GetDeviceContext(), m_Model->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix,
|
||||||
|
m_Model->GetTexture(0));
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Setup matrices.
|
||||||
|
rotateMatrix = XMMatrixRotationY(rotation);
|
||||||
|
translateMatrix = XMMatrixTranslation(-1.5f, -1.0f, 0.0f);
|
||||||
|
worldMatrix = XMMatrixMultiply(rotateMatrix, translateMatrix);
|
||||||
|
|
||||||
|
// Render the model using the light shader.
|
||||||
|
m_Model->Render(m_Direct3D->GetDeviceContext());
|
||||||
|
|
||||||
|
result = m_ShaderManager->RenderLightShader(m_Direct3D->GetDeviceContext(), m_Model->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix,
|
||||||
|
m_Model->GetTexture(0), m_Light->GetDirection(), m_Light->GetDiffuseColor());
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Setup matrices.
|
||||||
|
rotateMatrix = XMMatrixRotationY(rotation);
|
||||||
|
translateMatrix = XMMatrixTranslation(1.5f, -1.0f, 0.0f);
|
||||||
|
worldMatrix = XMMatrixMultiply(rotateMatrix, translateMatrix);
|
||||||
|
|
||||||
|
// Render the model using the normal map shader.
|
||||||
|
m_Model->Render(m_Direct3D->GetDeviceContext());
|
||||||
|
|
||||||
|
result = m_ShaderManager->RenderNormalMapShader(m_Direct3D->GetDeviceContext(), m_Model->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix,
|
||||||
|
m_Model->GetTexture(0), m_Model->GetTexture(1), m_Light->GetDirection(), m_Light->GetDiffuseColor());
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Present the rendered scene to the screen.
|
||||||
|
m_Direct3D->EndScene();
|
||||||
|
|
||||||
// Get the location of the mouse from the input object,
|
// Get the location of the mouse from the input object,
|
||||||
Input->GetMouseLocation(mouseX, mouseY);
|
Input->GetMouseLocation(mouseX, mouseY);
|
||||||
|
|
||||||
@ -672,15 +693,15 @@ bool ApplicationClass::Render(float rotation, float x, float y, float z)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the light properties.
|
//// Get the light properties.
|
||||||
for (i = 0; i < m_numLights; i++)
|
//for (i = 0; i < m_numLights; i++)
|
||||||
{
|
//{
|
||||||
// Create the diffuse color array from the four light colors.
|
// // Create the diffuse color array from the four light colors.
|
||||||
diffuseColor[i] = m_Lights[i].GetDiffuseColor();
|
// diffuseColor[i] = m_Lights[i].GetDiffuseColor();
|
||||||
|
|
||||||
// Create the light position array from the four light positions.
|
// // Create the light position array from the four light positions.
|
||||||
lightPosition[i] = m_Lights[i].GetPosition();
|
// lightPosition[i] = m_Lights[i].GetPosition();
|
||||||
}
|
//}
|
||||||
|
|
||||||
scaleMatrix = XMMatrixScaling(0.75f, 0.75f, 0.75f); // Build the scaling matrix.
|
scaleMatrix = XMMatrixScaling(0.75f, 0.75f, 0.75f); // Build the scaling matrix.
|
||||||
rotateMatrix = XMMatrixRotationY(rotation); // Build the rotation matrix.
|
rotateMatrix = XMMatrixRotationY(rotation); // Build the rotation matrix.
|
||||||
@ -734,13 +755,13 @@ bool ApplicationClass::Render(float rotation, float x, float y, float z)
|
|||||||
//}
|
//}
|
||||||
|
|
||||||
//Specular Mapping
|
//Specular Mapping
|
||||||
result = m_SpecMapShader->Render(m_Direct3D->GetDeviceContext(), m_Model->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix,
|
/*result = m_SpecMapShader->Render(m_Direct3D->GetDeviceContext(), m_Model->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix,
|
||||||
m_Model->GetTexture(0), m_Model->GetTexture(1), m_Model->GetTexture(2), m_Light->GetDirection(), m_Light->GetDiffuseColor(),
|
m_Model->GetTexture(0), m_Model->GetTexture(1), m_Model->GetTexture(2), m_Light->GetDirection(), m_Light->GetDiffuseColor(),
|
||||||
m_Camera->GetPosition(), m_Light->GetSpecularColor(), m_Light->GetSpecularPower());
|
m_Camera->GetPosition(), m_Light->GetSpecularColor(), m_Light->GetSpecularPower());
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
// Enable the Z buffer and disable alpha blending now that 2D rendering is complete.
|
// Enable the Z buffer and disable alpha blending now that 2D rendering is complete.
|
||||||
m_Direct3D->TurnZBufferOn();
|
m_Direct3D->TurnZBufferOn();
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
#include "multitextureshaderclass.h"
|
#include "multitextureshaderclass.h"
|
||||||
#include "alphamapshaderclass.h"
|
#include "alphamapshaderclass.h"
|
||||||
#include "bitmapclass.h"
|
#include "bitmapclass.h"
|
||||||
#include "textureshaderclass.h"
|
|
||||||
#include "spriteclass.h"
|
#include "spriteclass.h"
|
||||||
#include "timerclass.h"
|
#include "timerclass.h"
|
||||||
#include "fontshaderclass.h"
|
#include "fontshaderclass.h"
|
||||||
@ -22,8 +21,7 @@
|
|||||||
#include "textclass.h"
|
#include "textclass.h"
|
||||||
#include "fpsclass.h"
|
#include "fpsclass.h"
|
||||||
#include "inputclass.h"
|
#include "inputclass.h"
|
||||||
#include "normalmapshaderclass.h"
|
#include "shadermanagerclass.h"
|
||||||
#include "specmapshaderclass.h"
|
|
||||||
|
|
||||||
|
|
||||||
/////////////
|
/////////////
|
||||||
@ -68,7 +66,6 @@ private:
|
|||||||
SpriteClass* m_Sprite;
|
SpriteClass* m_Sprite;
|
||||||
TimerClass* m_Timer;
|
TimerClass* m_Timer;
|
||||||
TextClass* m_MouseStrings;
|
TextClass* m_MouseStrings;
|
||||||
LightClass* m_Lights;
|
|
||||||
int m_numLights;
|
int m_numLights;
|
||||||
FontShaderClass* m_FontShader;
|
FontShaderClass* m_FontShader;
|
||||||
FontClass* m_Font;
|
FontClass* m_Font;
|
||||||
@ -76,8 +73,7 @@ private:
|
|||||||
FpsClass* m_Fps;
|
FpsClass* m_Fps;
|
||||||
TextClass* m_FpsString;
|
TextClass* m_FpsString;
|
||||||
int m_previousFps;
|
int m_previousFps;
|
||||||
NormalMapShaderClass* m_NormalMapShader;
|
ShaderManagerClass* m_ShaderManager;
|
||||||
SpecMapShaderClass* m_SpecMapShader;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
<ClCompile Include="modelclass.cpp" />
|
<ClCompile Include="modelclass.cpp" />
|
||||||
<ClCompile Include="Multitextureshaderclass.cpp" />
|
<ClCompile Include="Multitextureshaderclass.cpp" />
|
||||||
<ClCompile Include="normalmapshaderclass.cpp" />
|
<ClCompile Include="normalmapshaderclass.cpp" />
|
||||||
|
<ClCompile Include="shadermanagerclass.cpp" />
|
||||||
<ClCompile Include="specmapshaderclass.cpp" />
|
<ClCompile Include="specmapshaderclass.cpp" />
|
||||||
<ClCompile Include="Spriteclass.cpp" />
|
<ClCompile Include="Spriteclass.cpp" />
|
||||||
<ClCompile Include="Systemclass.cpp" />
|
<ClCompile Include="Systemclass.cpp" />
|
||||||
@ -62,6 +63,7 @@
|
|||||||
<ClInclude Include="modelclass.h" />
|
<ClInclude Include="modelclass.h" />
|
||||||
<ClInclude Include="Multitextureshaderclass.h" />
|
<ClInclude Include="Multitextureshaderclass.h" />
|
||||||
<ClInclude Include="normalmapshaderclass.h" />
|
<ClInclude Include="normalmapshaderclass.h" />
|
||||||
|
<ClInclude Include="shadermanagerclass.h" />
|
||||||
<ClInclude Include="specmapshaderclass.h" />
|
<ClInclude Include="specmapshaderclass.h" />
|
||||||
<ClInclude Include="Spriteclass.h" />
|
<ClInclude Include="Spriteclass.h" />
|
||||||
<ClInclude Include="systemclass.h" />
|
<ClInclude Include="systemclass.h" />
|
||||||
|
@ -99,6 +99,9 @@
|
|||||||
<ClCompile Include="specmapshaderclass.cpp">
|
<ClCompile Include="specmapshaderclass.cpp">
|
||||||
<Filter>Fichiers sources</Filter>
|
<Filter>Fichiers sources</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="shadermanagerclass.cpp">
|
||||||
|
<Filter>Fichiers sources</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="applicationclass.h">
|
<ClInclude Include="applicationclass.h">
|
||||||
@ -170,6 +173,9 @@
|
|||||||
<ClInclude Include="specmapshaderclass.h">
|
<ClInclude Include="specmapshaderclass.h">
|
||||||
<Filter>Fichiers d%27en-tête</Filter>
|
<Filter>Fichiers d%27en-tête</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="shadermanagerclass.h">
|
||||||
|
<Filter>Fichiers d%27en-tête</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Image Include="font01.tga">
|
<Image Include="font01.tga">
|
||||||
|
129
enginecustom/shadermanagerclass.cpp
Normal file
129
enginecustom/shadermanagerclass.cpp
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
#include "shadermanagerclass.h"
|
||||||
|
|
||||||
|
ShaderManagerClass::ShaderManagerClass()
|
||||||
|
{
|
||||||
|
m_TextureShader = 0;
|
||||||
|
m_LightShader = 0;
|
||||||
|
m_NormalMapShader = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ShaderManagerClass::ShaderManagerClass(const ShaderManagerClass& other)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ShaderManagerClass::~ShaderManagerClass()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool ShaderManagerClass::Initialize(ID3D11Device* device, HWND hwnd)
|
||||||
|
{
|
||||||
|
bool result;
|
||||||
|
|
||||||
|
// Create and initialize the texture shader object.
|
||||||
|
m_TextureShader = new TextureShaderClass;
|
||||||
|
|
||||||
|
result = m_TextureShader->Initialize(device, hwnd);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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 normal map shader object.
|
||||||
|
m_NormalMapShader = new NormalMapShaderClass;
|
||||||
|
|
||||||
|
result = m_NormalMapShader->Initialize(device, hwnd);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShaderManagerClass::Shutdown()
|
||||||
|
{
|
||||||
|
// Release the normal map shader object.
|
||||||
|
if (m_NormalMapShader)
|
||||||
|
{
|
||||||
|
m_NormalMapShader->Shutdown();
|
||||||
|
delete m_NormalMapShader;
|
||||||
|
m_NormalMapShader = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Release the light shader object.
|
||||||
|
if (m_LightShader)
|
||||||
|
{
|
||||||
|
m_LightShader->Shutdown();
|
||||||
|
delete m_LightShader;
|
||||||
|
m_LightShader = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Release the texture shader object.
|
||||||
|
if (m_TextureShader)
|
||||||
|
{
|
||||||
|
m_TextureShader->Shutdown();
|
||||||
|
delete m_TextureShader;
|
||||||
|
m_TextureShader = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ShaderManagerClass::RenderTextureShader(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix,
|
||||||
|
ID3D11ShaderResourceView* texture)
|
||||||
|
{
|
||||||
|
bool result;
|
||||||
|
|
||||||
|
|
||||||
|
result = m_TextureShader->Render(deviceContext, indexCount, worldMatrix, viewMatrix, projectionMatrix, texture);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool ShaderManagerClass::RenderLightShader(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix,
|
||||||
|
ID3D11ShaderResourceView* texture, XMFLOAT4 lightDirection, XMFLOAT4 diffuseColor)
|
||||||
|
{
|
||||||
|
bool result;
|
||||||
|
|
||||||
|
|
||||||
|
result = m_LightShader->Render(deviceContext, indexCount, worldMatrix, viewMatrix, projectionMatrix, texture, lightDirection, diffuseColor);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool ShaderManagerClass::RenderNormalMapShader(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix,
|
||||||
|
ID3D11ShaderResourceView* colorTexture, ID3D11ShaderResourceView* normalTexture, XMFLOAT3 lightDirection, XMFLOAT4 diffuseColor)
|
||||||
|
{
|
||||||
|
bool result;
|
||||||
|
|
||||||
|
|
||||||
|
result = m_NormalMapShader->Render(deviceContext, indexCount, worldMatrix, viewMatrix, projectionMatrix, colorTexture, normalTexture, lightDirection, diffuseColor);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
34
enginecustom/shadermanagerclass.h
Normal file
34
enginecustom/shadermanagerclass.h
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
#ifndef _SHADERMANAGERCLASS_H_
|
||||||
|
#define _SHADERMANAGERCLASS_H_
|
||||||
|
|
||||||
|
///////////////////////
|
||||||
|
// MY CLASS INCLUDES //
|
||||||
|
///////////////////////
|
||||||
|
#include "textureshaderclass.h"
|
||||||
|
#include "lightshaderclass.h"
|
||||||
|
#include "normalmapshaderclass.h"
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Class name: ShaderManagerClass
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
class ShaderManagerClass
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ShaderManagerClass();
|
||||||
|
ShaderManagerClass(const ShaderManagerClass&);
|
||||||
|
~ShaderManagerClass();
|
||||||
|
|
||||||
|
bool Initialize(ID3D11Device*, HWND);
|
||||||
|
void Shutdown();
|
||||||
|
bool RenderTextureShader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*);
|
||||||
|
bool RenderLightShader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT3, XMFLOAT4);
|
||||||
|
bool RenderNormalMapShader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, XMFLOAT3, XMFLOAT4);
|
||||||
|
|
||||||
|
private:
|
||||||
|
TextureShaderClass* m_TextureShader;
|
||||||
|
LightShaderClass* m_LightShader;
|
||||||
|
NormalMapShaderClass* m_NormalMapShader;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
Loading…
x
Reference in New Issue
Block a user