Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Hello, im just trying to add these shape to this code and cannot do so without getting errors please help c + + #include SceneManager.h
Hello, im just trying to add these shape to this code and cannot do so without getting errors please help c
#include "SceneManager.h
#ifndef STBIMAGEIMPLEMENTATION
#define STBIMAGEIMPLEMENTATION
#include stbimage.h
#endif
#include
declaration of global variables
namespace
const char gModelName "model";
const char gColorValueName "objectColor";
const char gTextureValueName "objectTexture";
const char gUseTextureName "bUseTexture";
const char gUseLightingName "bUseLighting";
SceneManager::SceneManagerShaderManager pShaderManager
mpShaderManager pShaderManager;
mbasicMeshes new ShapeMeshes;
SceneManager::~SceneManager
mpShaderManager NULL;
delete mbasicMeshes;
mbasicMeshes NULL;
void SceneManager::SetTransformations
glm::vec scaleXYZ,
float XrotationDegrees,
float YrotationDegrees,
float ZrotationDegrees,
glm::vec positionXYZ
variables for this method
glm::mat modelView;
glm::mat scale;
glm::mat rotationX;
glm::mat rotationY;
glm::mat rotationZ;
glm::mat translation;
set the scale value in the transform buffer
scale glm::scalescaleXYZ;
set the rotation values in the transform buffer
rotationX glm::rotateglm::radiansXrotationDegrees glm::vecfff;
rotationY glm::rotateglm::radiansYrotationDegrees glm::vecfff;
rotationZ glm::rotateglm::radiansZrotationDegrees glm::vecfff;
set the translation value in the transform buffer
translation glm::translatepositionXYZ;
matrix math for calculating the final model matrix
modelView translation rotationX rotationY rotationZ scale;
if NULL mpShaderManager
pass the model matrix into the shader
mpShaderManagersetMatValuegModelName, modelView;
void SceneManager::SetShaderColor
float redColorValue,
float greenColorValue,
float blueColorValue,
float alphaValue
variables for this method
glm::vec currentColor;
currentColor.r redColorValue;
currentColor.g greenColorValue;
currentColor.b blueColorValue;
currentColor.a alphaValue;
if NULL mpShaderManager
pass the color values into the shader
mpShaderManagersetIntValuegUseTextureName, false;
mpShaderManagersetVecValuegColorValueName, currentColor;
void SceneManager::PrepareScene
mbasicMeshesLoadPlaneMesh;
mbasicMeshesLoadBoxMesh;
mbasicMeshesLoadSphereMesh;
mbasicMeshesLoadCylinderMesh;
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 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 color values into the shader
SetShaderColor;
draw the mesh with transformation values
mbasicMeshesDrawPlaneMesh;
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 color values into the shader
SetShaderColor;
draw the mesh with transformation values
mbasicMeshesDrawPlaneMesh;
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