Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

My lite shade isn t showing in the scene. There needs to be a light red shade to the light. * DefineObjectMaterials ( ) void

My lite shade isnt showing in the scene. There needs to be a light red shade to the light.
* DefineObjectMaterials()
void SceneManager::DefineObjectMaterials()// This function will set material properties such as diffuse, specular, ambient, etc.{
OBJECT_MATERIAL goldMaterial;
goldMaterial.ambientColor = glm::vec3(0.2f,0.2f,0.1f);
goldMaterial.ambientStrength =0.4f;
goldMaterial.diffuseColor = glm::vec3(0.3f,0.3f,0.2f);
goldMaterial.specularColor = glm::vec3(0.6f,0.5f,0.4f);
goldMaterial.shininess =22.0;
goldMaterial.tag = "gold";
m_objectMaterials.push_back(goldMaterial);
OBJECT_MATERIAL cementMaterial;
cementMaterial.ambientColor = glm::vec3(0.2f,0.2f,0.2f);
cementMaterial.ambientStrength =0.2f;
cementMaterial.diffuseColor = glm::vec3(0.5f,0.5f,0.5f);
cementMaterial.specularColor = glm::vec3(0.4f,0.4f,0.4f);
cementMaterial.shininess =0.5;
cementMaterial.tag = "cement";
m_objectMaterials.push_back(cementMaterial);
OBJECT_MATERIAL woodMaterial;
woodMaterial.ambientColor = glm::vec3(0.4f,0.3f,0.1f);
woodMaterial.ambientStrength =0.2f;
woodMaterial.diffuseColor = glm::vec3(0.3f,0.2f,0.1f);
woodMaterial.specularColor = glm::vec3(0.1f,0.1f,0.1f);
woodMaterial.shininess =0.3;
woodMaterial.tag = "wood";
m_objectMaterials.push_back(woodMaterial);
OBJECT_MATERIAL TileMaterial;
TileMaterial.ambientColor = glm::vec3(0.2f,0.3f,0.4f);
TileMaterial.ambientStrength =0.3f;
TileMaterial.diffuseColor = glm::vec3(0.3f,0.2f,0.1f);
TileMaterial.specularColor = glm::vec3(0.4f,0.5f,0.6f);
TileMaterial.shininess =25.0;
TileMaterial.tag = "Tile";
m_objectMaterials.push_back(TileMaterial);
OBJECT_MATERIAL glassMaterial;
glassMaterial.ambientColor = glm::vec3(0.4f,0.4f,0.4f);
glassMaterial.ambientStrength =0.3f;
glassMaterial.diffuseColor = glm::vec3(0.3f,0.3f,0.3f);
glassMaterial.specularColor = glm::vec3(0.6f,0.6f,0.6f);
glassMaterial.shininess =85.0;
glassMaterial.tag = "glass";
m_objectMaterials.push_back(glassMaterial);
OBJECT_MATERIAL clayMaterial;
clayMaterial.ambientColor = glm::vec3(0.2f,0.2f,0.3f);
clayMaterial.ambientStrength =0.3f;
clayMaterial.diffuseColor = glm::vec3(0.4f,0.4f,0.5f);
clayMaterial.specularColor = glm::vec3(0.2f,0.2f,0.4f);
clayMaterial.shininess =0.5;
clayMaterial.tag = "clay";
m_objectMaterials.push_back(clayMaterial);}
* SetupSceneLights()
void SceneManager::SetupSceneLights(){
// Define properties of the first light
m_pShaderManager->setVec3Value("lightSources[0].position", 3.0f,14.0f,0.0f);
m_pShaderManager->setVec3Value("lightSources[0].ambientColor", 1.0f,0.1f,0.1f); // Red ambient color
m_pShaderManager->setVec3Value("lightSources[0].diffuseColor", 1.0f,0.0f,0.0f); // Red diffuse color
m_pShaderManager->setVec3Value("lightSources[0].specularColor", 1.0f,0.0f,0.0f); // Red specular color
m_pShaderManager->setFloatValue("lightSources[0].focalStrength", 32.0f);
m_pShaderManager->setFloatValue("lightSources[0].specularIntensity", 0.05f);
// Define properties of the second light
m_pShaderManager->setVec3Value("lightSources[1].position", -3.0f,14.0f,0.0f);
m_pShaderManager->setVec3Value("lightSources[1].ambientColor", 0.1f,1.0f,0.1f); // Green ambient color
m_pShaderManager->setVec3Value("lightSources[1].diffuseColor", 0.0f,1.0f,0.0f); // Green diffuse color
m_pShaderManager->setVec3Value("lightSources[1].specularColor", 0.0f,1.0f,0.0f); // Green specular color
m_pShaderManager->setFloatValue("lightSources[1].focalStrength", 32.0f);
m_pShaderManager->setFloatValue("lightSources[1].specularIntensity", 0.05f);
// Define properties of the third light
m_pShaderManager->setVec3Value("lightSources[2].position", 0.6f,5.0f,6.0f);
m_pShaderManager->setVec3Value("lightSources[2].ambientColor", 0.1f,0.1f,1.0f); // Blue ambient color
m_pShaderManager->setVec3Value("lightSources[2].diffuseColor", 0.0f,0.0f,1.0f); // Blue diffuse color
m_pShaderManager->setVec3Value("lightSources[2].specularColor", 0.0f,0.0f,1.0f); // Blue specular color
m_pShaderManager->setFloatValue("lightSources[2].focalStrength", 12.0f);
m_pShaderManager->setFloatValue("lightSources[2].specularIntensity", 0.5f);
// Enable lighting in the shader
m_pShaderManager->setBoolValue("bUseLighting", true);}
* PrepareScene()
void SceneManager::PrepareScene(){
// define the materials for objects in the scene
DefineObjectMaterials();
// add and define the light sources for the scene
SetupSceneLights();
m_basicMeshes->LoadBoxMesh();
m_basicMeshes->LoadPlaneMesh();
m_basicMeshes->LoadCylinderMesh();
m_basicMeshes->LoadConeMesh();
m_basicMeshes->LoadSphereMesh();}
* RenderScene()
void SceneManager::RenderScene(){
// declare the variables for the transformations
glm::vec3 scaleXYZ;
float XrotationDegrees =0.0f;
float YrotationDegrees =0.0f;
float ZrotationDegrees =0.0f;
glm::

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning Microsoft SQL Server 2012 Programming

Authors: Paul Atkinson, Robert Vieira

1st Edition

1118102282, 9781118102282

Students also viewed these Databases questions

Question

What are the advantages and disadvantages of flextime?

Answered: 1 week ago

Question

What could Kathy have done to keep the situation from occurring?

Answered: 1 week ago

Question

How can Seaview improve their benefits communication? Discuss.

Answered: 1 week ago