-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCuboid.cpp
More file actions
49 lines (41 loc) · 1.06 KB
/
Copy pathCuboid.cpp
File metadata and controls
49 lines (41 loc) · 1.06 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
#include "Cuboid.h"
#include <GL/glut.h>
//// MÉTODOS CLASE CUBOID ////
//* Constructor *//
Cuboid::Cuboid() : GameObject() {
this->height = 1.0;
this->length = 2.0;
this->width = 0.5;
this->canCollide = true;
}
//* Getters *//
inline float Cuboid::getHeight() const {
return this->height;
}
inline float Cuboid::getLength() const {
return this->length;
}
inline float Cuboid::getWidth() const {
return this->width;
}
bool Cuboid::getCanCollide() const {
return this->canCollide;
}
//* Setters *//
void Cuboid::setCanCollide(const bool c) {
this->canCollide = c;
}
//* Otros *//
//Renderizado
void Cuboid::render() const
{
glPushMatrix();
glTranslatef(this->getPosition().getX(), this->getPosition().getY(), this->getPosition().getZ());
glRotatef(getOrientation().getX(), 1.0, 0.0, 0.0);
glRotatef(getOrientation().getY(), 0.0, 1.0, 0.0);
glRotatef(getOrientation().getZ(), 0.0, 0.0, 1.0);
glColor3f(getColor().getRed(), getColor().getGreen(), getColor().getBlue());
glScalef(getLength(), getHeight(), getWidth());
glutSolidCube(1);
glPopMatrix();
}