예제 #1
0
CameraState* OrbitCamera::getState() {
    CameraState* s = new CameraState();
    s->fovy = getFOVY();
    s->farClip = getFarClip();
    s->nearClip = getNearClip();
    s->pos = getPos();
    s->look = getLook3();
    s->up = getUp3();
    return s;
}
// ---------------------------------------------------------------------------------------------------------------------------------------------------
//
void ofxOculusRift::beginRender( float _interOcularShift, ofFbo* _fbo  )
{
	ofPushView();

		_fbo->begin();
		ofClear(0,0,0); // Todo: get the proper clear color
	
		setupScreenPerspective( _interOcularShift, ofGetWidth(), ofGetHeight(), ofGetOrientation(), false, getFov(), getNearClip(), getFarClip()  );
	
		ofSetMatrixMode(OF_MATRIX_MODELVIEW);
		ofLoadIdentityMatrix();
	
		ofPushMatrix();
	
			// flip for FBO
			ofScale(1,-1,1);
	
			ofMultMatrix( getHeadsetViewOrientationMat() );
			ofTranslate( getPosition() );
}
예제 #3
0
glm::mat4 Camera::calculateProjectionMatrix(){
    // Use all of the intrinsic values to create the projection matrix
    return glm::perspective(getFieldOfView(), getViewport().getAspectRatio(), getNearClip(), getFarClip());
}