summaryrefslogtreecommitdiff
path: root/gaunt01/src/bird.cpp
blob: 388d7af4559ed87c0c03611cc2c30d60aaa10718 (plain)
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
#include "bird.h"

bird::bird()
{
   model.loadMesh("Bird-test.xml");
   texture.loadImage("TextureBird.jpg");

   //starting pos
   position=ofVec3f(ofGetWidth()/2,ofGetHeight()/3,ofGetHeight()/2);
   heading=ofVec3f(-1,0,0);
   direction=ofVec3f(-1,0,0);
   velocity=ofGetWidth()/100;

   turnAngle=0;
   diveAngle=0;

   lastTime=ofGetElapsedTimef();
}

bird::~bird()
{
    //dtor
}

void bird::update(const vector<ofVec3f>& players){
    float time=ofGetElapsedTimef();
    float timeSeg=time-lastTime;
    lastTime=time;
    position+=direction*velocity*timeSeg;
}
void bird::draw(){
    glEnable(GL_DEPTH_TEST);
    ofPushMatrix();
        ofTranslate(position);
        //ofRotate(direction);
        ofRotate(90,0,0,1);
        ofRotate(90,-1,0,0);
        //ofRotate(180,1,0,0);
        bindTexture(texture);
        model.draw();
        unbindTexture(texture);
    ofPopMatrix();
    glDisable(GL_DEPTH_TEST);
}