#include "bird.h" /* keep track of the high-level properties of the bird here activate and control sequences of targets in the morphmesh finally drawAnimated() */ bird::bird() { if (model.loadMesh("Bird-poses.xml")) printf("mesh loaded with %i vertices, %i face indices, %i targets\n",model.getNumVertices(),model.getNumIndices(),model.getNumTargets()); else printf("mesh XML file not parsed\n"); if (model.loadSeqs("Bird-anim.xml")) printf("animation loaded with %i sequences\n",model.getNumSequences()); else printf("animation XML file not parsed\n"); model.sequences["flap"].start(); currentseq="hover"; texture.loadImage("TextureBird.jpg"); //starting pos position=ofVec3f(ofGetWidth()/2,ofGetHeight(),-100); //ofGetHeight()/4); heading=ofVec3f(-1,0,0); direction=ofVec3f(-1,0,0); velocity=ofGetWidth()/50; turnAngle=-1; diveAngle=0; lastTime=ofGetElapsedTimef(); } bird::~bird() { //dtor } void bird::update(const vector& 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); ofScale(.15,.15,.15); bindTexture(texture); model.drawAnimated(); unbindTexture(texture); ofPopMatrix(); glDisable(GL_DEPTH_TEST); }