-
Notifications
You must be signed in to change notification settings - Fork 0
/
PointSphere.cpp
36 lines (32 loc) · 1.04 KB
/
PointSphere.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include "PointSphere.h"
#include "Window.h"
PointSphere::PointSphere(glm::vec3 color) : Geometry("sphere.obj", NULL), defaultColor(color) {
PointSphere::color = defaultColor;
isSelected = false;
}
//overrides the parent method
void PointSphere::draw(glm::mat4 C) {
//renders a point sphere with flat shading
glUseProgram(Window::bezierShaderProgram);
glm::mat4 i = glm::mat4(1);
glUniformMatrix4fv(Window::bezierModelLoc, 1, GL_FALSE, glm::value_ptr(i));
glUniformMatrix4fv(Window::bezierViewLoc, 1, GL_FALSE, glm::value_ptr(C));
glUniformMatrix4fv(Window::bezierProjectionLoc, 1, GL_FALSE, glm::value_ptr(Window::projection));
glUniform3f(Window::bezierColorLoc, color.x, color.y, color.z);
//render object
// Bind to the VAO.
glBindVertexArray(vao);
// Draw the model
glDrawElements(GL_TRIANGLES, indices.size(), GL_UNSIGNED_INT, 0);
// Unbind from the VAO.
glBindVertexArray(0);
}
void PointSphere::selectionStatus(bool state) {
isSelected = state;
if (isSelected) {
color = glm::vec3(1, 1, 0);
}
else {
color = defaultColor;
}
}