Answered step by step
Verified Expert Solution
Question
1 Approved Answer
i only see a black screen The shapes in the 3 D scene are all white and look flat. The goal is to add two
i only see a black screen The shapes in the D scene are all white and look flat. The goal is to add two different light sources at different positions to improve the look of the scene and define the D shapes better. Also, add some color to one of the lights to bring more color into the scene. The following picture shows an example D scene after the two lighting sources have been added.Create code to address the required functionality. Apply logic and proper syntax to code. All code should be well commented.
DefineObjectMaterials
void SceneManager::DefineObjectMaterials
SetupSceneLights
void SceneManager::SetupSceneLights
Define light properties
glm::vec lightPosition glm::vecfff;
glm::vec lightColor glm::vecfff; White light
glm::vec lightPosition glm::vecfff;
glm::vec lightColor glm::vecfff; Red light
Set the light positions and colors in the shader
mpShaderManagersetVecValuelightposition", lightPosition;
mpShaderManagersetVecValuelightcolor", lightColor;
mpShaderManagersetVecValuelightposition", lightPosition;
mpShaderManagersetVecValuelightcolor", lightColor;
Enable lighting in the shader
mpShaderManagersetBoolValuegUseLightingName, true;
PrepareScene
void SceneManager::PrepareScene
define the materials for objects in the scene
DefineObjectMaterials;
add and define the light sources for the scene
SetupSceneLights;
mbasicMeshesLoadBoxMesh;
mbasicMeshesLoadPlaneMesh;
mbasicMeshesLoadCylinderMesh;
mbasicMeshesLoadConeMesh;
mbasicMeshesLoadSphereMesh;
RenderScene
void SceneManager::RenderScene
declare the variables for the transformations
glm::vec scaleXYZ;
float XrotationDegrees f;
float YrotationDegrees f;
float ZrotationDegrees f;
glm::vec positionXYZ;
Set needed transformations
set the XYZ scale for the mesh
scaleXYZ glm::vecfff;
set the XYZ rotation for the mesh
XrotationDegrees f;
YrotationDegrees f;
ZrotationDegrees f;
set the XYZ position for the mesh
positionXYZ glm::vecfff;
set the transformations into memory to be used on the drawn meshes
SetTransformations
scaleXYZ,
XrotationDegrees,
YrotationDegrees,
ZrotationDegrees,
positionXYZ;
set the active color values in the shader RGBA
SetShaderColor;
draw the mesh with transformation values this plane is used for the base
mbasicMeshesDrawPlaneMesh;
Set needed transformations
set the XYZ scale for the mesh
scaleXYZ glm::vecfff;
set the XYZ rotation for the mesh
XrotationDegrees f;
YrotationDegrees f;
ZrotationDegrees f;
set the XYZ position for the mesh
positionXYZ glm::vecfff;
set the transformations into memory to be used on the drawn meshes
SetTransformations
scaleXYZ,
XrotationDegrees,
YrotationDegrees,
ZrotationDegrees,
positionXYZ;
set the active color values in the shader RGBA
SetShaderColor;
draw a filled cylinder shape
mbasicMeshesDrawCylinderMesh;
Set needed transformations
set the XYZ scale for the mesh
scaleXYZ glm::vecfff;
set the XYZ rotation for the mesh
XrotationDegrees f;
YrotationDegrees f;
ZrotationDegrees f;
set the XYZ position for the mesh
positionXYZ glm::vecfff;
set the transformations into memory to be used on the drawn meshes
SetTransformations
scaleXYZ,
XrotationDegrees,
YrotationDegrees,
ZrotationDegrees,
positionXYZ;
set the active color values in the shader RGBA
SetShaderColor;
draw a filled box shape
mbasicMeshesDrawBoxMesh;
Set needed transformations
set the XYZ scale for the mesh
scaleXYZ glm::vecfff;
set the XYZ rotation for the mesh
XrotationDegrees f;
YrotationDegrees f;
ZrotationDegrees f;
set the XYZ position for the mesh
positionXYZ glm::vecfff;
set the transformations into memory to be used on the drawn meshes
SetTransformations
scaleXYZ,
XrotationDegrees,
YrotationDegrees,
ZrotationDegrees,
positionXYZ;
set the active color values in the shader RGBA
SetShaderColor;
draw a filled box shape
mbasicMeshesDrawBoxMesh;
Set needed transformations
set the XYZ scale for the mesh
scaleXYZ glm::vecfff;
set the XYZ rotation for the mesh
XrotationDegrees f;
YrotationDegrees f;
ZrotationDegrees f;
set the XYZ position for the mesh
positionXYZ glm::vecfff;
set the transformations into memo
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started