diff options
Diffstat (limited to 'rayhit')
| -rw-r--r-- | rayhit/rayhit.layout | 2 | ||||
| -rw-r--r-- | rayhit/src/testApp.cpp | 23 |
2 files changed, 18 insertions, 7 deletions
diff --git a/rayhit/rayhit.layout b/rayhit/rayhit.layout index 52f6b25..63b7198 100644 --- a/rayhit/rayhit.layout +++ b/rayhit/rayhit.layout @@ -11,7 +11,7 @@ <Cursor position="0" topLine="0" /> </File> <File name="src/testApp.cpp" open="1" top="1" tabpos="4"> - <Cursor position="392" topLine="0" /> + <Cursor position="1148" topLine="0" /> </File> <File name="src/testApp.h" open="0" top="0" tabpos="0"> <Cursor position="641" topLine="0" /> diff --git a/rayhit/src/testApp.cpp b/rayhit/src/testApp.cpp index 78a3890..392e84d 100644 --- a/rayhit/src/testApp.cpp +++ b/rayhit/src/testApp.cpp @@ -2,15 +2,26 @@ //-------------------------------------------------------------- void testApp::setup(){ - ofVec3f centre=ofVec3f(ofGetWidth()/2,0,0); + ofVec3f centre=ofVec3f(ofGetWidth()/2,0,0); //ofGetHeight(),0); ofVec3f normal=ofVec3f(0,0,-1); ray=ofRay(); plane=ofPlane(centre,normal); plane.color=ofColor(255,255,255); - //Projector::Projector(float throwRatio, const ofVec2f& lensOffset, int width, int height) + //setup that works for a new camera. but can we match the existing camera, must be possible! + /* + projector=ofProjector(1.535f, ofVec2f(0.0f, 0.5f),ofGetWidth(),ofGetHeight()); projector.setPosition(ofGetWidth()/2,ofGetHeight()/2,ofGetHeight()); + */ + + //Projector::Projector(float throwRatio, const ofVec2f& lensOffset, int width, int height) + + projector=ofProjector(2.0f, ofVec2f(0.0f, 0.0f),ofGetWidth(),ofGetHeight()); //1.535f + projector.setPosition(ofGetWidth()/2,ofGetHeight()/2,-ofGetWidth()); + projector.lookAt(ofVec3f(ofGetWidth()/2,ofGetHeight()/2,0),ofVec3f(0, -1, 0)); + + pos=ofVec3f(ofGetWidth()/2,ofGetHeight()/2,0); @@ -38,7 +49,7 @@ void testApp::update(){ void testApp::draw(){ ofBackground(0,0,0); - cam.begin(); + //cam.begin(); plane.draw(); @@ -61,7 +72,7 @@ void testApp::draw(){ ofPopMatrix(); - ofSphere(pos.x,pos.y,pos.z,2); + ofSphere(pos.x,pos.y,pos.z,20); /* for (int j=0;j<ofGetWidth();j+=64){ @@ -71,7 +82,7 @@ void testApp::draw(){ } */ - cam.end(); + //cam.end(); } @@ -123,7 +134,7 @@ why won't the plane draw! */ void testApp::mouseReleased(int x, int y, int button){ - ray=projector.castPixel(x,y+(ofGetHeight()/2)); //(ofGetHeight()-y)); + ray=projector.castPixel(x,y); //+(ofGetHeight()/2)); //(ofGetHeight()-y)); bool hit = plane.intersect(ray,pos); //pos=ofVec3f(pos.x*2,pos.y*2,pos.z*2); if (hit) printf("ray:%i,%i hit plane:%f,%f,%f\n",x,y,pos.x,pos.y,pos.z); |
