summaryrefslogtreecommitdiff
path: root/gaunt01/src/testApp.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gaunt01/src/testApp.cpp')
-rw-r--r--gaunt01/src/testApp.cpp37
1 files changed, 22 insertions, 15 deletions
diff --git a/gaunt01/src/testApp.cpp b/gaunt01/src/testApp.cpp
index 853a23f..6ac3d26 100644
--- a/gaunt01/src/testApp.cpp
+++ b/gaunt01/src/testApp.cpp
@@ -113,7 +113,7 @@ void testApp::setup(){
}
scaleFactor=ofVec2f(windowWidth/1280.0f,windowHeight/768.0f);
- gameState=TITLES;
+ gameState=PLAYING; //TITLES;
segTimes[TITLES]=4.0;
segTimes[CREDIT]=2.5;
@@ -137,6 +137,7 @@ void testApp::setup(){
cam.end();
updatePlane();
+ Bird.setBounds(bounds);
}
@@ -265,27 +266,32 @@ void testApp::updatePlane(){
ofVec2f l=ofVec2f(windowWidth/20,windowHeight/2);
ofRay r=projector.castPixel(l.x,l.y);
ofVec3f p;
- plane.intersect(r,p);
- ofVec3f pn=(p-projector.getGlobalPosition()).getPerpendicular(ofVec3f(0,1,0));
- bounds[0]=ofPlane(p,pn,pn,ofVec2f(1000,1000));
+ if (plane.intersect(r,p)) printf("found ground plane intersection 1 at %f,%f,%f\n",p.x,p.y,p.z);
+ else printf("bound plane 1 not found\n");
+ ofVec3f pn=(p-projector.getGlobalPosition()).getPerpendicular(ofVec3f(0,-1,0));
+ bounds[0]=ofPlane(p,pn); //,pn,ofVec2f(1000,1000));
l=ofVec2f(windowWidth/2,windowHeight/20);
r=projector.castPixel(l.x,l.y);
- plane.intersect(r,p);
+ if (plane.intersect(r,p)) printf("found ground plane intersection 2 at %f,%f,%f\n",p.x,p.y,p.z);
+ else printf("bound plane 2 not found\n");
pn=(p-projector.getGlobalPosition()).getPerpendicular(ofVec3f(1,0,0));
- bounds[1]=ofPlane(p,pn,-pn,ofVec2f(1000,1000));
+ bounds[1]=ofPlane(p,pn); //,-pn,ofVec2f(1000,1000));
l=ofVec2f(19*windowWidth/20,windowHeight/2);
r=projector.castPixel(l.x,l.y);
- plane.intersect(r,p);
+ if (plane.intersect(r,p)) printf("found ground plane intersection 3 at %f,%f,%f\n",p.x,p.y,p.z);
+ else printf("bound plane 3 not found\n");
pn=(p-projector.getGlobalPosition()).getPerpendicular(ofVec3f(0,1,0));
- bounds[2]=ofPlane(p,pn,-pn,ofVec2f(1000,1000));
+ bounds[2]=ofPlane(p,pn); //,-pn,ofVec2f(1000,1000));
- l=ofVec2f(windowWidth/2,19*windowHeight/20);
+ l=ofVec2f(windowWidth/2,19*(windowHeight/20));
r=projector.castPixel(l.x,l.y);
- plane.intersect(r,p);
- pn=(p-projector.getGlobalPosition()).getPerpendicular(ofVec3f(1,0,0));
- bounds[1]=ofPlane(p,pn,-pn,ofVec2f(1000,1000));
+ if (plane.intersect(r,p)) printf("found ground plane intersection 4 at %f,%f,%f\n",p.x,p.y,p.z);
+ else printf("bound plane 4 not found\n");
+ pn=(p-projector.getGlobalPosition()).getPerpendicular(ofVec3f(-1,0,0));
+ bounds[3]=ofPlane(p,pn); //,-pn,ofVec2f(1000,1000));
+
// vector<trapdoor> trapdoors;
// float trapdoorSize;
@@ -504,7 +510,7 @@ void testApp::update(){
}
}
- Bird.update(players,cam_angle,border);
+ Bird.update(players,cam_angle);
}
@@ -693,13 +699,14 @@ void testApp::draw(){
ofVec3f bp;
for (int i=0;i<4;i++) {
bounds[i].draw();
- if (
- bounds[i].intersect(Bird.pointer,bp)) {
+ if (bounds[i].intersect(Bird.pointer,bp)) {
char numStr[16];
sprintf(numStr, "%4.1f", (bp-Bird.position.rotated(cam_angle,ofVec3f(1,0,0))).length());
ofVec3f sc=cam.worldToScreen(bp);
ofDrawBitmapString(numStr, sc.x, sc.y);
}
+ //ofLine(bounds[i].getCenter(),bounds[i].getCenter()+(bounds[i].getNormal()*100));
+ //normals sorted
}
ofSetHexColor(0xffff77);
char numStr[16];