Skip to content

Commit

Permalink
Merge pull request #1 from jasonrwalters/master
Browse files Browse the repository at this point in the history
view lock
  • Loading branch information
obviousjim committed Oct 17, 2013
2 parents aa3a94f + ff2b52f commit 75e4536
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
6 changes: 5 additions & 1 deletion example-OculusRiftRendering/src/testApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ void testApp::keyPressed(int key)
if(key == 's'){
oculusRift.reloadShader();
}

if(key == 'l'){
oculusRift.lockView = !oculusRift.lockView;
}
}

//--------------------------------------------------------------
Expand Down Expand Up @@ -156,4 +160,4 @@ void testApp::gotMessage(ofMessage msg)
void testApp::dragEvent(ofDragInfo dragInfo)
{

}
}
9 changes: 7 additions & 2 deletions src/ofxOculusRift.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,15 @@ ofRectangle toOf(const OVR::Util::Render::Viewport vp){
ofxOculusRift::ofxOculusRift(){
baseCamera = NULL;
bSetup = false;
viewLock = false;
bUsePredictedOrientation = true;
}

ofxOculusRift::~ofxOculusRift(){
if(bSetup){
pSensor.Clear();
pManager.Clear();
System::Destroy();
//System::Destroy(); // causes the system to crash.
bSetup = false;
}
}
Expand Down Expand Up @@ -200,7 +201,11 @@ void ofxOculusRift::setupEyeParams(OVR::Util::Render::StereoEye eye){
if(baseCamera != NULL){
headRotation = headRotation * baseCamera->getGlobalTransformMatrix();
}
ofLoadMatrix( ofMatrix4x4::getInverseOf( headRotation ));

// lock the camera when enabled...
if (!lockView) {
ofLoadMatrix( ofMatrix4x4::getInverseOf( headRotation ));
}

ofViewport(toOf(VP));
ofMatrix4x4 viewAdjust = toOf(eyeRenderParams.ViewAdjust);
Expand Down
1 change: 1 addition & 0 deletions src/ofxOculusRift.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class ofxOculusRift

bool setup();
bool isSetup();
bool lockView;

void beginLeftEye();
void endLeftEye();
Expand Down

0 comments on commit 75e4536

Please sign in to comment.