-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBullet.cpp
More file actions
40 lines (33 loc) · 1.12 KB
/
Copy pathBullet.cpp
File metadata and controls
40 lines (33 loc) · 1.12 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
#include "Bullet.h"
#include <GL/glut.h>
//// MÉTODOS CLASE BULLET ////
//* Constructores *//
Bullet::Bullet() : Sphere() {
}
Bullet::Bullet(const Vector3D& position, const Color& color, const Vector3D& speed,
const Vector3D& orientation, float radius, int slices, int stacks)
: Sphere(position, color, speed, orientation, radius, slices, stacks) {}
//* Getters *//
char Bullet::getId() const {
return this->id;
}
//* Setters *//
void Bullet::setId(const char i) {
this->id = i;
}
//* Otros *//
//Renderizado
void Bullet::render() const {
glPushMatrix();
glTranslatef(getPosition().getX(), getPosition().getY(), getPosition().getZ());
glColor3f(getColor().getRed(), getColor().getGreen(), getColor().getBlue());
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);
glutSolidSphere(this->getRadius(), this->getSlices(), this->getStacks());
glPopMatrix();
}
//Actualización
void Bullet::update(const float& deltaTime, const Vector3D& gravity) {
this->setPosition(Vector3D(this->getPosition() + this->getSpeed() * deltaTime));
}