Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Z I need help adjusting my code, the shape i need to create is an hourglass out of two pyramids, but as you can see
I need help adjusting my code, the shape i need to create is an hourglass out of two pyramids, but as you can see they arent pyramids
#include "SceneManager.h
#ifndef STBIMAGEIMPLEMENTATION
#define STBIMAGEIMPLEMENTATION
#include stbimage.h
#endif
#include
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
glm::mat modelView;
glm::mat scale;
glm::mat rotationX;
glm::mat rotationY;
glm::mat rotationZ;
glm::mat translation;
scale glm::scalescaleXYZ;
rotationX glm::rotateglm::radiansXrotationDegrees glm::vecfff;
rotationY glm::rotateglm::radiansYrotationDegrees glm::vecfff;
rotationZ glm::rotateglm::radiansZrotationDegrees glm::vecfff;
translation glm::translatepositionXYZ;
modelView translation rotationX rotationY rotationZ scale;
if NULL mpShaderManager
mpShaderManagersetMatValuegModelName, modelView;
void SceneManager::SetShaderColor
float redColorValue,
float greenColorValue,
float blueColorValue,
float alphaValue
glm::vec currentColor;
currentColor.r redColorValue;
currentColor.g greenColorValue;
currentColor.b blueColorValue;
currentColor.a alphaValue;
if NULL mpShaderManager
mpShaderManagersetIntValuegUseTextureName, false;
mpShaderManagersetVecValuegColorValueName, currentColor;
void SceneManager::PrepareScene
mbasicMeshesLoadPyramidMesh;
void SceneManager::RenderScene
Transformation for the top pyramid top of the hourglass
glm::vec scaleXYZtop glm::vecfff;
float XrotationDegreestop f; Invert the pyramid
float YrotationDegreestop f;
float ZrotationDegreestop f;
glm::vec positionXYZtop glm::vecfff; Move it upwards
SetTransformations
scaleXYZtop,
XrotationDegreestop,
YrotationDegreestop,
ZrotationDegreestop,
positionXYZtop;
SetShaderColor;
mbasicMeshesDrawPyramidMesh; Draw the top pyramid
Transformation for the bottom pyramid bottom of the hourglass
glm::vec scaleXYZbottom glm::vecfff;
float XrotationDegreesbottom f; No rotation needed
float YrotationDegreesbottom f;
float ZrotationDegreesbottom f;
glm::vec positionXYZbottom glm::vecfff; Move it downwards
SetTransformations
scaleXYZbottom,
XrotationDegreesbottom,
YrotationDegreesbottom,
ZrotationDegreesbottom,
positionXYZbottom;
SetShaderColor;
mbasicMeshesDrawPyramidMesh; Draw the bottom pyramid
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