summaryrefslogtreecommitdiff
path: root/rayhit/src
diff options
context:
space:
mode:
Diffstat (limited to 'rayhit/src')
-rw-r--r--rayhit/src/testApp.cpp23
1 files changed, 17 insertions, 6 deletions
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);