Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The shapes in the 3 D scene are all white and look flat. The goal is to add two different light sources at different positions

The shapes in the 3D 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 3D shapes better. Also, add some color to one of the lights to bring more color into the scene. The following picture shows an example 3D scene after the two lighting sources have been added. Specifically, you must address the following rubric criteria:Create code to address the required functionality. The work you complete in the project source code must meet the required functionality and visual representation that are outlined for this assignment. Apply logic and proper syntax to code. Apply commenting and formatting standards to facilitate understanding of the code. All code should be well commented. Your comments should explain the purpose of lines or sections of the code and may also include how you achieved a specific task in the code.
DefineObjectMaterials()
void SceneManager::DefineObjectMaterials()
{* SetupSceneLights()
void SceneManager::SetupSceneLights(){
// this line of code is NEEDED for telling the shaders to render
// the 3D scene with custom lighting, if no light sources have
// been added then the display window will be black - to use the
// default OpenGL lighting then comment out the following line
//m_pShaderManager->setBoolValue(g_UseLightingName, 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::vec3 positionXYZ;
/*** Set needed transformations
// set the XYZ scale for the mesh
scaleXYZ = glm::vec3(20.0f,1.0f,10.0f);
// set the XYZ rotation for the mesh
XrotationDegrees =0.0f;
YrotationDegrees =0.0f;
ZrotationDegrees =0.0f;
// set the XYZ position for the mesh
positionXYZ = glm::vec3(0.0f,0.0f,0.0f);
// 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(1,1,1,1);
// draw the mesh with transformation values - this plane is used for the base
m_basicMeshes->DrawPlaneMesh();
/*** Set needed transformations
// set the XYZ scale for the mesh
scaleXYZ = glm::vec3(0.9f,2.8f,0.9f);
// set the XYZ rotation for the mesh
XrotationDegrees =90.0f;
YrotationDegrees =0.0f;
ZrotationDegrees =-15.0f;
// set the XYZ position for the mesh
positionXYZ = glm::vec3(0.0f,0.9f,0.4f);
// 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(1,1,1,1);
// draw a filled cylinder shape
m_basicMeshes->DrawCylinderMesh();
/*** Set needed transformations
// set the XYZ scale for the mesh
scaleXYZ = glm::vec3(1.0f,9.0f,1.3f);
// set the XYZ rotation for the mesh
XrotationDegrees =0.0f;
YrotationDegrees =0.0f;
ZrotationDegrees =95.0f;
// set the XYZ position for the mesh
positionXYZ = glm::vec3(0.2f,2.27f,2.0f);
// 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(1,1,1,1);
// draw a filled box shape
m_basicMeshes->DrawBoxMesh();
/*** Set needed transformations
// set the XYZ scale for the mesh
scaleXYZ = glm::vec3(1.7f,1.5f,1.5f);
// set the XYZ rotation for the mesh
XrotationDegrees =0.0f;
YrotationDegrees =40.0f;
ZrotationDegrees =8.0f;
// set the XYZ position for the mesh
positionXYZ = glm::vec3(3.3f,3.83f,2.19f);
// 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(1,1,1,1);
// draw a filled box shape
m_basicMeshes->DrawBoxMesh();
/*** Set needed transformations
// set the XYZ scale for the mesh
scaleXYZ = glm::vec3(1.0f,1.0f,1.0f);
// set the XYZ rotation for the mesh
XrotationDegrees =0.0f;
YrotationDegrees =0.0f;
ZrotationDegrees =0.0f;
// set the XYZ position for the mesh
positionXYZ = glm::vec3(3.1f,5.6f,2.5f

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_2

Step: 3

blur-text-image_3

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

Modern Database Management

Authors: Heikki Topi, Jeffrey A Hoffer, Ramesh Venkataraman

13th Edition

0134773659, 978-0134773650

More Books

Students also viewed these Databases questions

Question

What is the per-capita cost?

Answered: 1 week ago

Question

Timeline for progress report

Answered: 1 week ago