diff options
| author | Tim Redfern <tim@eclectronics.org> | 2012-05-14 19:00:08 +0100 |
|---|---|---|
| committer | Tim Redfern <tim@eclectronics.org> | 2012-05-14 19:00:08 +0100 |
| commit | dbf9692b03ac2485f771993184222f7170e71cf2 (patch) | |
| tree | 9a17e44304856b5daa9d91172eb40f6e1783b1da /gaunt01/src/trapdoor.cpp | |
| parent | e333ec0659a74899fbd75c5ed490089d0fd7d244 (diff) | |
working on background segmentation
Diffstat (limited to 'gaunt01/src/trapdoor.cpp')
| -rw-r--r-- | gaunt01/src/trapdoor.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/gaunt01/src/trapdoor.cpp b/gaunt01/src/trapdoor.cpp index 309cda6..f609c91 100644 --- a/gaunt01/src/trapdoor.cpp +++ b/gaunt01/src/trapdoor.cpp @@ -3,16 +3,17 @@ trapdoor::trapdoor(ofVec2f pos,float _doorSize) { surround=morphmesh("trapdoor-top.xml"); + beneath=morphmesh("trapdoor-bottom.xml"); lid=morphmesh("trapdoor-lid.xml"); if (!surround.isLoaded()||!lid.isLoaded()) printf("problem loading trap door mesh.\n"); texture.loadImage("TextureTrapdoor.jpg"); - + splashFrames=new ofImage[3]; splashFrames[0].loadImage("Drops_1.tga"); splashFrames[1].loadImage("Drops_2.tga"); splashFrames[2].loadImage("Drops_3.tga"); - + for (int i=0;i<3;i++) { splashFrames[i].setAnchorPercent(0.5,0.5); } @@ -30,7 +31,7 @@ trapdoor::trapdoor(ofVec2f pos,float _doorSize) } trapdoor::~trapdoor() { - for (int i=0;i<3;i++) splashFrames[i].clear(); + //for (int i=0;i<3;i++) splashFrames[i].clear(); //delete splashFrames; } @@ -61,7 +62,7 @@ void trapdoor::trigger() { /* ofVec2f trapdoor::bounds2UV(ofVec2f point){ //returns the 0-1 UV coords of a point on the ground plane relative to its bounds. - //this should not be in the trapdoor class???? + //this should not be in the trapdoor class???? float v=(point.y-boundTR.y)/(boundBR.y-boundTR.y); float mx=ofGetWidth()/2; float u=((point.x-mx)/(((boundTR.x-mx)*(1-v))+((boundBR.x-mx)*v)))+0.5; @@ -94,13 +95,13 @@ bool trapdoor::checkUpdate(map<int,player>& players) { float sc=pow(0.2,ofGetElapsedTimef()-caughtTime[i]); caught[i]->setCatchTransform(ofVec3f(0,0,0),ofVec3f(sc,sc,sc)); } - - + + float segTime=(ofGetElapsedTimef()-triggeredTime); if (triggeredTime>0) { doorSpeed=(doorSpeed+((cos(doorAngle*0.0174532925)/ofGetFrameRate())*50))*0.95; doorAngle-=doorSpeed; - } + } return gotcha; } @@ -128,6 +129,7 @@ void trapdoor::draw() { ofPushMatrix(); ofRotate(90,-1,0,0); ofScale(size*.005,size*.005,size*.005); + beneath.draw(); surround.draw(); ofPushMatrix(); ofTranslate(90,0,-5); @@ -146,7 +148,7 @@ void trapdoor::draw() { glDisable(GL_DEPTH_TEST); } void trapdoor::drawSplash(float angle) { - for (int i=0;i<caught.size();i++) { + for (int i=0;i<caught.size();i++) { float splashTime = (ofGetElapsedTimef()-caughtTime[i]); if (splashTime>0.3) { ofPushMatrix(); @@ -159,5 +161,5 @@ void trapdoor::drawSplash(float angle) { ofPopMatrix(); } } - -}
\ No newline at end of file + +} |
