feat: scale down sphere
This commit is contained in:
parent
fdabe9aadd
commit
c161f3e54a
|
@ -150,7 +150,7 @@ int main()
|
|||
return -1;
|
||||
|
||||
GLuint shaderProgram = compileShaderProgram();
|
||||
//Icosphere sphere(0.5, 2);
|
||||
Icosphere sphere(0.5, 2);
|
||||
Orbit orbit(30, glm::vec3(.5, .5, 0));
|
||||
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
|
@ -168,7 +168,7 @@ int main()
|
|||
updateModelViewProjectionMatrix(shaderProgram, glfwGetTime());
|
||||
|
||||
// Render objects
|
||||
//sphere.render();
|
||||
sphere.render();
|
||||
orbit.render();
|
||||
|
||||
glfwSwapBuffers(window);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#include <iostream>
|
||||
#include <array>
|
||||
|
||||
Icosphere::Icosphere(int subdivisions)
|
||||
Icosphere::Icosphere(float radius, int subdivisions)
|
||||
{
|
||||
VertexList vertices = _isocahedronVertices;
|
||||
TriangleList triangles = _isocahedronTriangles;
|
||||
|
@ -16,6 +16,13 @@ Icosphere::Icosphere(int subdivisions)
|
|||
" vertices: " << vertices.size() <<
|
||||
" triangles: " << triangles.size() << std::endl;
|
||||
|
||||
// Scale vertices by radius after subdivision as subdivision happens on a
|
||||
// unit sphere
|
||||
for (int i = 0; i < vertices.size(); i++)
|
||||
{
|
||||
vertices[i] *= radius;
|
||||
}
|
||||
|
||||
glGenVertexArrays(1, &_vao);
|
||||
glGenBuffers(1, &_vbo);
|
||||
glGenBuffers(1, &_ebo);
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
class Icosphere
|
||||
{
|
||||
public:
|
||||
Icosphere(int subdividision);
|
||||
Icosphere(float radius, int subdividision);
|
||||
void render();
|
||||
|
||||
~Icosphere();
|
||||
|
|
Loading…
Reference in New Issue