summaryrefslogtreecommitdiff
path: root/src/viewpoint.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/viewpoint.cpp')
-rw-r--r--src/viewpoint.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/viewpoint.cpp b/src/viewpoint.cpp
index fe8bb28..cf05663 100644
--- a/src/viewpoint.cpp
+++ b/src/viewpoint.cpp
@@ -53,7 +53,15 @@ double viewpoint::getSetting(const string& setting){
}
//--------------------------------------------------------------
void viewpoint::setLight(){
- target.setPosition(vars[1].getVal(),vars[2].getVal(),vars[3].getVal());
+
+ ofNode c=ofNode();
+ ofNode t=ofNode();
+ t.setParent(c);
+ t.setPosition(vars[1].getVal(),vars[2].getVal(),vars[3].getVal());
+ //make target controls relative to rotation
+ c.rotate(vars[5].getVal(), ofVec3f(0, 1, 0));
+
+ target.setPosition(t.getGlobalPosition());
//camera.orbit(vars[5].getVal(), vars[4].getVal(), vars[7].getVal(), target);
camera.setFov(vars[0].getVal());
if (vertigo) {
@@ -62,6 +70,8 @@ void viewpoint::setLight(){
vars[7].setVal((tan((vars[0].readVal()-vars[0].inc)*PI*0.0027777)*vars[7].readVal())/tan(vars[0].readVal()*PI*0.0027777));
}
+
+
ofVec3f p(0, 0, vars[7].getVal());
//p.rotate(ofClamp(vars[2].getVal(), -89, 89), ofVec3f(1, 0, 0));
p.rotate(vars[4].getVal(), ofVec3f(1, 0, 0));