Minor: Ajout shader de translation au shadermanager
This commit is contained in:
parent
d61a5b7f5f
commit
48e7b18d7c
@ -29,7 +29,6 @@ ApplicationClass::ApplicationClass()
|
|||||||
m_Position = 0;
|
m_Position = 0;
|
||||||
m_Frustum = 0;
|
m_Frustum = 0;
|
||||||
m_DisplayPlane = 0;
|
m_DisplayPlane = 0;
|
||||||
m_TranslateShader = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -258,17 +257,6 @@ bool ApplicationClass::Initialize(int screenWidth, int screenHeight, HWND hwnd)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create and initialize the translate shader object.
|
|
||||||
m_TranslateShader = new TranslateShaderClass;
|
|
||||||
|
|
||||||
result = m_TranslateShader->Initialize(m_Direct3D->GetDevice(), hwnd);
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
MessageBox(hwnd, L"Could not initialize the translate shader object.", L"Error", MB_OK);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Create and initialize the light shader object.
|
// Create and initialize the light shader object.
|
||||||
m_LightShader = new LightShaderClass;
|
m_LightShader = new LightShaderClass;
|
||||||
|
|
||||||
@ -417,14 +405,6 @@ void ApplicationClass::Shutdown()
|
|||||||
m_ShaderManager = 0;
|
m_ShaderManager = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Release the translate shader object.
|
|
||||||
if (m_TranslateShader)
|
|
||||||
{
|
|
||||||
m_TranslateShader->Shutdown();
|
|
||||||
delete m_TranslateShader;
|
|
||||||
m_TranslateShader = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Release the frustum class object.
|
// Release the frustum class object.
|
||||||
if (m_Frustum)
|
if (m_Frustum)
|
||||||
{
|
{
|
||||||
@ -798,12 +778,6 @@ 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.
|
// Render the display plane using the texture shader and the render texture resource.
|
||||||
m_DisplayPlane->Render(m_Direct3D->GetDeviceContext());
|
m_DisplayPlane->Render(m_Direct3D->GetDeviceContext());
|
||||||
|
|
||||||
result = m_TranslateShader->Render(m_Direct3D->GetDeviceContext(), m_Model->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix,
|
|
||||||
m_Model->GetTexture(0), textureTranslation);
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Setup matrices - Bottom left display plane.
|
// Setup matrices - Bottom left display plane.
|
||||||
worldMatrix = XMMatrixTranslation(-1.5f, -1.5f, 0.0f);
|
worldMatrix = XMMatrixTranslation(-1.5f, -1.5f, 0.0f);
|
||||||
@ -1069,6 +1043,21 @@ bool ApplicationClass::Render(float rotation, float x, float y, float z, float t
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Setup matrices.
|
||||||
|
rotateMatrix = XMMatrixRotationY(rotation);
|
||||||
|
translateMatrix = XMMatrixTranslation(0.0f, -8.0f, 0.0f);
|
||||||
|
worldMatrix = XMMatrixMultiply(rotateMatrix, translateMatrix);
|
||||||
|
|
||||||
|
// Render the model using the Translation shader.
|
||||||
|
m_Model->Render(m_Direct3D->GetDeviceContext());
|
||||||
|
|
||||||
|
result = m_ShaderManager->RenderTranslateShader(m_Direct3D->GetDeviceContext(), m_Model->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix,
|
||||||
|
m_Model->GetTexture(0), textureTranslation);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Lighting, utilise plusieurs lights donc Multiple Points Lighting
|
// 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),
|
//result = m_LightShader->Render(m_Direct3D->GetDeviceContext(), m_Model->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix, m_Model->GetTexture(0),
|
||||||
// diffuseColor, lightPosition);
|
// diffuseColor, lightPosition);
|
||||||
|
@ -29,7 +29,6 @@
|
|||||||
#include "frustumclass.h"
|
#include "frustumclass.h"
|
||||||
#include "rendertextureclass.h"
|
#include "rendertextureclass.h"
|
||||||
#include "displayplaneclass.h"
|
#include "displayplaneclass.h"
|
||||||
#include "translateshaderclass.h"
|
|
||||||
|
|
||||||
|
|
||||||
/////////////
|
/////////////
|
||||||
@ -94,7 +93,6 @@ private:
|
|||||||
RenderTextureClass* m_RenderTexture;
|
RenderTextureClass* m_RenderTexture;
|
||||||
DisplayPlaneClass* m_DisplayPlane;
|
DisplayPlaneClass* m_DisplayPlane;
|
||||||
float m_screenWidth, m_screenHeight;
|
float m_screenWidth, m_screenHeight;
|
||||||
TranslateShaderClass* m_TranslateShader;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -5,6 +5,8 @@ ShaderManagerClass::ShaderManagerClass()
|
|||||||
m_TextureShader = 0;
|
m_TextureShader = 0;
|
||||||
m_LightShader = 0;
|
m_LightShader = 0;
|
||||||
m_NormalMapShader = 0;
|
m_NormalMapShader = 0;
|
||||||
|
m_MultitextureShader = 0;
|
||||||
|
m_TranslateShader = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -58,6 +60,15 @@ bool ShaderManagerClass::Initialize(ID3D11Device* device, HWND hwnd)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create and initialize the translate shader object.
|
||||||
|
m_TranslateShader = new TranslateShaderClass;
|
||||||
|
|
||||||
|
result = m_TranslateShader->Initialize(device, hwnd);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,6 +98,14 @@ void ShaderManagerClass::Shutdown()
|
|||||||
m_TextureShader = 0;
|
m_TextureShader = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Release the multitexture shader object.
|
||||||
|
if (m_TranslateShader)
|
||||||
|
{
|
||||||
|
m_TranslateShader->Shutdown();
|
||||||
|
delete m_TranslateShader;
|
||||||
|
m_TranslateShader = 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Release the multitexture shader object.
|
// Release the multitexture shader object.
|
||||||
if (m_MultitextureShader)
|
if (m_MultitextureShader)
|
||||||
{
|
{
|
||||||
@ -96,6 +115,7 @@ void ShaderManagerClass::Shutdown()
|
|||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ShaderManagerClass::RenderTextureShader(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix,
|
bool ShaderManagerClass::RenderTextureShader(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix,
|
||||||
@ -164,5 +184,20 @@ bool ShaderManagerClass::RenderMultitextureShader(ID3D11DeviceContext* deviceCon
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ShaderManagerClass::RenderTranslateShader(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix,
|
||||||
|
ID3D11ShaderResourceView* texture1, float valeur)
|
||||||
|
{
|
||||||
|
bool result;
|
||||||
|
|
||||||
|
|
||||||
|
result = m_TranslateShader->Render(deviceContext, indexCount, worldMatrix, viewMatrix, projectionMatrix, texture1, valeur);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
@ -8,6 +8,7 @@
|
|||||||
#include "lightshaderclass.h"
|
#include "lightshaderclass.h"
|
||||||
#include "normalmapshaderclass.h"
|
#include "normalmapshaderclass.h"
|
||||||
#include "Multitextureshaderclass.h"
|
#include "Multitextureshaderclass.h"
|
||||||
|
#include "translateshaderclass.h"
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
@ -26,12 +27,14 @@ public:
|
|||||||
bool RenderLightShader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT3, XMFLOAT4);
|
bool RenderLightShader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT3, XMFLOAT4);
|
||||||
bool RenderNormalMapShader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, XMFLOAT3, XMFLOAT4);
|
bool RenderNormalMapShader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, XMFLOAT3, XMFLOAT4);
|
||||||
bool RenderMultitextureShader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*);
|
bool RenderMultitextureShader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*);
|
||||||
|
bool RenderTranslateShader(ID3D11DeviceContext*,int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, float);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TextureShaderClass* m_TextureShader;
|
TextureShaderClass* m_TextureShader;
|
||||||
LightShaderClass* m_LightShader;
|
LightShaderClass* m_LightShader;
|
||||||
NormalMapShaderClass* m_NormalMapShader;
|
NormalMapShaderClass* m_NormalMapShader;
|
||||||
MultiTextureShaderClass* m_MultitextureShader;
|
MultiTextureShaderClass* m_MultitextureShader;
|
||||||
|
TranslateShaderClass* m_TranslateShader;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -8,7 +8,6 @@ TranslateShaderClass::TranslateShaderClass()
|
|||||||
m_layout = 0;
|
m_layout = 0;
|
||||||
m_matrixBuffer = 0;
|
m_matrixBuffer = 0;
|
||||||
m_sampleState = 0;
|
m_sampleState = 0;
|
||||||
|
|
||||||
m_translateBuffer = 0;
|
m_translateBuffer = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,7 +55,6 @@ private:
|
|||||||
ID3D11InputLayout* m_layout;
|
ID3D11InputLayout* m_layout;
|
||||||
ID3D11Buffer* m_matrixBuffer;
|
ID3D11Buffer* m_matrixBuffer;
|
||||||
ID3D11SamplerState* m_sampleState;
|
ID3D11SamplerState* m_sampleState;
|
||||||
|
|
||||||
ID3D11Buffer* m_translateBuffer;
|
ID3D11Buffer* m_translateBuffer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user