Skybox WIP

This commit is contained in:
2025-01-21 15:28:37 +01:00
parent 296e04692a
commit 172db0b96d
16 changed files with 177 additions and 88 deletions

View File

@@ -13,20 +13,17 @@ ShaderManagerClass::ShaderManagerClass()
m_LightMapShader = 0;
m_RefractionShader = 0;
m_WaterShader = 0;
m_CelShadingShader = 0;
m_CelShadingShader = 0;
}
ShaderManagerClass::ShaderManagerClass(const ShaderManagerClass& other)
{
}
ShaderManagerClass::~ShaderManagerClass()
{
}
bool ShaderManagerClass::Initialize(ID3D11Device* device, HWND hwnd)
{
Logger::Get().Log("Initializing ShaderManagerClass", __FILE__, __LINE__, Logger::LogLevel::Initialize);
@@ -35,7 +32,6 @@ bool ShaderManagerClass::Initialize(ID3D11Device* device, HWND hwnd)
// Create and initialize the texture shader object.
m_TextureShader = new TextureShaderClass;
result = m_TextureShader->Initialize(device, hwnd);
if (!result)
{
@@ -45,7 +41,6 @@ bool ShaderManagerClass::Initialize(ID3D11Device* device, HWND hwnd)
// Create and initialize the normal map shader object.
m_NormalMapShader = new NormalMapShaderClass;
result = m_NormalMapShader->Initialize(device, hwnd);
if (!result)
{
@@ -55,7 +50,6 @@ bool ShaderManagerClass::Initialize(ID3D11Device* device, HWND hwnd)
// Create and initialize the multitexture shader object.
m_MultitextureShader = new MultiTextureShaderClass;
result = m_MultitextureShader->Initialize(device, hwnd);
if (!result)
{
@@ -65,7 +59,6 @@ bool ShaderManagerClass::Initialize(ID3D11Device* device, HWND hwnd)
// Create and initialize the translate shader object.
m_TranslateShader = new TranslateShaderClass;
result = m_TranslateShader->Initialize(device, hwnd);
if (!result)
{
@@ -75,7 +68,6 @@ bool ShaderManagerClass::Initialize(ID3D11Device* device, HWND hwnd)
// Create and initialize the alpha map shader object.
m_AlphaMapShader = new AlphaMapShaderClass;
result = m_AlphaMapShader->Initialize(device, hwnd);
if (!result)
{
@@ -85,7 +77,6 @@ bool ShaderManagerClass::Initialize(ID3D11Device* device, HWND hwnd)
// Create and initialize the specular map shader object.
m_SpecMapShader = new SpecMapShaderClass;
result = m_SpecMapShader->Initialize(device, hwnd);
if (!result)
{
@@ -95,7 +86,6 @@ bool ShaderManagerClass::Initialize(ID3D11Device* device, HWND hwnd)
// Create and initialize the transparent shader object.
m_TransparentShader = new TransparentShaderClass;
result = m_TransparentShader->Initialize(device, hwnd);
if (!result)
{
@@ -105,7 +95,6 @@ bool ShaderManagerClass::Initialize(ID3D11Device* device, HWND hwnd)
// Create and initialize the light shader object.
m_LightShader = new LightShaderClass;
result = m_LightShader->Initialize(device, hwnd);
if (!result)
{
@@ -115,7 +104,6 @@ bool ShaderManagerClass::Initialize(ID3D11Device* device, HWND hwnd)
// Create and initialize the light map shader object.
m_LightMapShader = new LightMapShaderClass;
result = m_LightMapShader->Initialize(device, hwnd);
if (!result)
{
@@ -125,7 +113,6 @@ bool ShaderManagerClass::Initialize(ID3D11Device* device, HWND hwnd)
// Create and initialize the refraction shader object.
m_RefractionShader = new RefractionShaderClass;
result = m_RefractionShader->Initialize(device, hwnd);
if (!result)
{
@@ -134,20 +121,18 @@ bool ShaderManagerClass::Initialize(ID3D11Device* device, HWND hwnd)
// Create and initialize the water shader object.
m_WaterShader = new WaterShaderClass;
result = m_WaterShader->Initialize(device, hwnd);
if (!result)
{
return false;
}
m_CelShadingShader = new CelShadingShader;
result = m_CelShadingShader->Initialize(device, hwnd);
if (!result)
{
return false;
}
m_CelShadingShader = new CelShadingShader;
result = m_CelShadingShader->Initialize(device, hwnd);
if (!result)
{
return false;
}
Logger::Get().Log("ShaderManagerClass initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
@@ -182,7 +167,7 @@ void ShaderManagerClass::Shutdown()
m_MultitextureShader = 0;
}
// Release the multitexture shader object.
// Release the translate shader object.
if (m_TranslateShader)
{
m_TranslateShader->Shutdown();
@@ -246,10 +231,15 @@ void ShaderManagerClass::Shutdown()
m_WaterShader = 0;
}
Logger::Get().Log("ShaderManagerClass shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
// Release the cel shading shader object.
if (m_CelShadingShader)
{
m_CelShadingShader->Shutdown();
delete m_CelShadingShader;
m_CelShadingShader = 0;
}
return;
Logger::Get().Log("ShaderManagerClass shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
}
bool ShaderManagerClass::RenderTextureShader(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix,
@@ -257,7 +247,6 @@ bool ShaderManagerClass::RenderTextureShader(ID3D11DeviceContext* deviceContext,
{
bool result;
result = m_TextureShader->Render(deviceContext, indexCount, worldMatrix, viewMatrix, projectionMatrix, texture);
if (!result)
{
@@ -273,7 +262,6 @@ bool ShaderManagerClass::RenderNormalMapShader(ID3D11DeviceContext* deviceContex
{
bool result;
result = m_NormalMapShader->Render(deviceContext, indexCount, worldMatrix, viewMatrix, projectionMatrix, colorTexture, normalTexture, lightDirection, diffuseColor);
if (!result)
{
@@ -289,7 +277,6 @@ bool ShaderManagerClass::RenderMultitextureShader(ID3D11DeviceContext* deviceCon
{
bool result;
result = m_MultitextureShader->Render(deviceContext, indexCount, worldMatrix, viewMatrix, projectionMatrix, texture1, texture2);
if (!result)
{
@@ -305,7 +292,6 @@ bool ShaderManagerClass::RenderTranslateShader(ID3D11DeviceContext* deviceContex
{
bool result;
result = m_TranslateShader->Render(deviceContext, indexCount, worldMatrix, viewMatrix, projectionMatrix, texture1, valeur);
if (!result)
{
@@ -321,7 +307,6 @@ bool ShaderManagerClass::RenderAlphaMapShader(ID3D11DeviceContext* deviceContext
{
bool result;
result = m_AlphaMapShader->Render(deviceContext, indexCount, worldMatrix, viewMatrix, projectionMatrix, texture1, texture2, texture3);
if (!result)
{
@@ -338,8 +323,7 @@ bool ShaderManagerClass::RenderSpecMapShader(ID3D11DeviceContext* deviceContext,
{
bool result;
result = m_SpecMapShader->Render(deviceContext, indexCount, worldMatrix, viewMatrix, projectionMatrix, texture1, texture2, texture3, lightDirection,
result = m_SpecMapShader->Render(deviceContext, indexCount, worldMatrix, viewMatrix, projectionMatrix, texture1, texture2, texture3, lightDirection,
diffuseColor, cameraPosition, specularColor, specularPower);
if (!result)
{
@@ -355,7 +339,6 @@ bool ShaderManagerClass::RenderTransparentShader(ID3D11DeviceContext* deviceCont
{
bool result;
result = m_TransparentShader->Render(deviceContext, indexCount, worldMatrix, viewMatrix, projectionMatrix, texture1, blendAmount);
if (!result)
{
@@ -371,7 +354,6 @@ bool ShaderManagerClass::RenderlightShader(ID3D11DeviceContext* deviceContext, i
{
bool result;
result = m_LightShader->Render(deviceContext, indexCount, worldMatrix, viewMatrix, projectionMatrix, texture, diffuseColor, lightPosition, ambientColor);
if (!result)
{
@@ -386,7 +368,6 @@ bool ShaderManagerClass::RenderlightMapShader(ID3D11DeviceContext* deviceContext
{
bool result;
result = m_LightMapShader->Render(deviceContext, indexCount, worldMatrix, viewMatrix, projectionMatrix, texture1, texture2);
if (!result)
{
@@ -401,7 +382,6 @@ bool ShaderManagerClass::RenderRefractionShader(ID3D11DeviceContext* deviceConte
{
bool result;
result = m_RefractionShader->Render(deviceContext, indexCount, worldMatrix, viewMatrix, projectionMatrix, texture, lightDirection, ambientColor, diffuseColor, lightPosition, clipPlane);
if (!result)
{
@@ -417,7 +397,6 @@ bool ShaderManagerClass::RenderWaterShader(ID3D11DeviceContext* deviceContext, i
{
bool result;
result = m_WaterShader->Render(deviceContext, indexCount, worldMatrix, viewMatrix, projectionMatrix, reflectionMatrix, reflectionTexture,
refractionTexture, normalTexture, waterTranslation, reflectRefractScale);
if (!result)
@@ -434,10 +413,10 @@ bool ShaderManagerClass::RenderCelShadingShader(ID3D11DeviceContext* deviceConte
bool result;
result = m_CelShadingShader->Render(deviceContext, indexCount, worldMatrix, viewMatrix, projectionMatrix, texture, lightDirection, diffuseColor, lightPosition);
if (!result)
{
return false;
}
if (!result)
{
return false;
}
return true;
return true;
}