Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Build me a UBuildSphere function for OpenGL in c + + thats takes a mesh in as arguments? Here's my cylinder and cone functions: /
Build me a UBuildSphere function for OpenGL in c thats takes a mesh in as arguments? Here's my cylinder and cone functions:
Function to build cylinders so far used to make the cameras on the phone
void Shapes::UBuildCylinderGLMesh& mesh
vector c mesh.p mesh.p mesh.p mesh.p;
float r mesh.radius;
float l mesh.width;
float s mesh.numOfSides;
float h mesh.height;
constexpr float PI f;
const float sectorStep f PI s;
vector v;
for auto i ; i s ; i
vinsertvendfff c c c cff ;
vinsertvendf r cosi sectorStep
f r sini sectorStep
f
c c c c
f r cosisectorStep
f r sinisectorStep;
vinsertvendf r cosi sectorStep
f r sini sectorStep
f
c c c c
f r cosi sectorStep
f r sini sectorStep;
for auto i ; i s ; i
vinsertvendff l c c c cff ;
vinsertvendf r cosi sectorStep
f r sini sectorStep
l
c c c c
f r cosisectorStep
f r sinisectorStep;
vinsertvendf r cosi sectorStep
f r sini sectorStep
l
c c c c
f r cosi sectorStep
f r sini sectorStep;
constexpr float x f;
float j f s x;
float k f;
for auto i ; i s ; i
vinsertvendf r cosi sectorStep
f r sini sectorStep
f
c c c c
k
;
vinsertvendf r cosi sectorStep
f r sini sectorStep
l
c c c c
k
f ;
vinsertvendf r cosi sectorStep
f r sini sectorStep
l
c c c c
k j
f ;
vinsertvendf r cosi sectorStep
f r sini sectorStep
l
c c c c
k j
f ;
vinsertvendf r cosi sectorStep
f r sini sectorStep
f
c c c c
k j
f ;
vinsertvendf r cosi sectorStep
f r sini sectorStep
f
c c c c
k
f ;
k j;
mesh.v v;
vclear;
UTranslatormesh;
void Shapes::UBuildConeGLMesh& mesh
vector c mesh.p mesh.p mesh.p mesh.p;
float r mesh.radius;
float l mesh.height;
float s mesh.numOfSides;
constexpr float PI f;
const float sectorStep f PI s;
const float textStep f s;
float textureXLoc f;
vector v;
for auto i ; i s ; i
float one f r cosi sectorStep;
float two f r sini sectorStep;
one f;
one f;
two f;
two
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started