minor update - préparation sunlight
This commit is contained in:
@@ -29,6 +29,9 @@ ApplicationClass::ApplicationClass() : m_ShouldQuit(false)
|
||||
m_terrainChunk.clear();
|
||||
m_object.clear();
|
||||
m_RenderQueues.clear();
|
||||
m_Skybox.clear();
|
||||
m_Lights.clear();
|
||||
m_SunLight = 0;
|
||||
}
|
||||
|
||||
ApplicationClass::~ApplicationClass()
|
||||
@@ -274,6 +277,15 @@ bool ApplicationClass::Initialize(int screenWidth, int screenHeight, HWND hwnd)
|
||||
m_Lights[3]->SetSpecularPower(16.0f);
|
||||
m_Lights[3]->SetPosition(-10.0f, 7.0f, 5.0f);
|
||||
|
||||
// Create || THE SUN ||
|
||||
m_SunLight = new LightClass;
|
||||
m_SunLight->SetDiffuseColor(1.0f, 1.0f, 1.0f, 1.0f); // White
|
||||
m_SunLight->SetDirection(0.0f, -1.0f, 0.0f);
|
||||
m_SunLight->SetAmbientColor(0.15f, 0.15f, 0.15f, 1.0f);
|
||||
m_SunLight->SetSpecularColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
m_SunLight->SetSpecularPower(16.0f);
|
||||
m_SunLight->SetPosition(0.0f, 100.0f, 0.0f);
|
||||
|
||||
// Create and initialize the normal map shader object.
|
||||
m_ShaderManager = new ShaderManagerClass;
|
||||
|
||||
@@ -1442,15 +1454,11 @@ void ApplicationClass::GenerateTerrain()
|
||||
{
|
||||
Object* newTerrain = new Object();
|
||||
newTerrain->Initialize(m_Direct3D->GetDevice(), m_Direct3D->GetDeviceContext(), modelFilename, textures);
|
||||
|
||||
newTerrain->SetScaleMatrix(scaleMatrix);
|
||||
|
||||
newTerrain->SetTranslateMatrix(XMMatrixTranslation(i / 2 * scaleX , -12.0f, j * scaleZ));
|
||||
|
||||
newTerrain->SetName(filenameWithoutExtension);
|
||||
|
||||
newTerrain->SetType(ObjectType::Cube);
|
||||
|
||||
newTerrain->SetActiveShader(Object::SUNLIGHT);
|
||||
m_terrainChunk.push_back(newTerrain);
|
||||
|
||||
}
|
||||
@@ -1922,6 +1930,8 @@ bool ApplicationClass::RenderPass(const std::vector<std::reference_wrapper<std::
|
||||
Logger::Get().Log("Could not render the model using the texture shader", __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
case Object::LIGHTING:
|
||||
result = m_ShaderManager->RenderlightShader(m_Direct3D->GetDeviceContext(), object->GetIndexCount(), worldMatrix, view, projection,
|
||||
object->GetTexture(0), diffuse, position, ambient);
|
||||
@@ -1931,6 +1941,16 @@ bool ApplicationClass::RenderPass(const std::vector<std::reference_wrapper<std::
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
case Object::SUNLIGHT:
|
||||
result = m_ShaderManager->RenderSunlightShader(m_Direct3D->GetDeviceContext(), object->GetIndexCount(), worldMatrix, view, projection,
|
||||
object->GetTexture(0), m_SunLight->GetDiffuseColor(), m_SunLight->GetPosition(), m_SunLight->GetAmbientColor());
|
||||
if (!result)
|
||||
{
|
||||
Logger::Get().Log("Could not render the object model using the sunlight shader", __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
result = m_ShaderManager->RenderlightShader(m_Direct3D->GetDeviceContext(), object->GetIndexCount(), worldMatrix, view, projection,
|
||||
object->GetTexture(0), diffuse, position, ambient);
|
||||
|
||||
Reference in New Issue
Block a user