-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFighter.cpp
More file actions
40 lines (33 loc) · 949 Bytes
/
Fighter.cpp
File metadata and controls
40 lines (33 loc) · 949 Bytes
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 "Fighter.h"
#include "GameEngine.h"
class ShaderProgram; // Forward declaration of ShaderProgram class.
Fighter::Fighter(GameEngine* engine) : Object(engine)
{
m_model = new MD2Model("fighter.md2", "fighter.tga");
//Set material properties.
MaterialProps props;
props.setProperty(MaterialProps::AMBIENT, 0.4f, 0.4f, 0.4f, 1.0f);
props.setProperty(MaterialProps::DIFFUSE, 0.7f, 0.7f, 0.7f, 1.0f);
props.setProperty(MaterialProps::SPECULAR, 0.9f, 0.9f, 0.9f, 1.0f);
props.setProperty(MaterialProps::EMISSIVE, 0.0f, 0.0f, 0.0f, 1.0f);
props.setShininess(90.0f);
m_model->setMaterialProperties(props);
}
const char* Fighter::getType()
{
return "Fighter";
}
void Fighter::onPrepare(GLfloat dt)
{
Object::onPrepare(dt);
m_model->onPrepare(dt);
}
void Fighter::onRender()
{
Object::onRender();
m_model->onRender(m_engine->m_modelProgram);
}
Fighter::~Fighter(void)
{
delete m_model;
}