Merge pull request #60 from ZappoMan/view_frustum_work

Small tweaks to initial values for offset camera, so people can make sen...
This commit is contained in:
birarda 2013-04-16 20:28:46 -07:00
commit 36559becb2
2 changed files with 13 additions and 17 deletions

View file

@ -13,7 +13,7 @@ Camera::Camera() {
_mode = CAMERA_MODE_THIRD_PERSON;
_tightness = DEFAULT_CAMERA_TIGHTNESS;
_fieldOfView = 60.0; // default
_nearClip = 0.01; // default
_nearClip = 0.08; // default
_farClip = 50.0; // default
_yaw = 0.0;
_pitch = 0.0;

View file

@ -520,12 +520,12 @@ int frustumDrawingMode = FRUSTUM_DRAW_MODE_ALL; // the mode we're drawing the
bool frustumOn = false; // Whether or not to display the debug view frustum
bool cameraFrustum = true; // which frustum to look at
bool viewFrustumFromOffset=false; // Wether or not to offset the view of the frustum
float viewFrustumOffsetYaw = -90.0; // the following variables control yaw, pitch, roll and distance form regular
float viewFrustumOffsetPitch = 7.5; // camera to the offset camera
float viewFrustumOffsetRoll = 0.0;
float viewFrustumOffsetDistance = 0.0;
float viewFrustumOffsetUp = 0.0;
bool viewFrustumFromOffset =false; // Wether or not to offset the view of the frustum
float viewFrustumOffsetYaw = -135.0; // the following variables control yaw, pitch, roll and distance form regular
float viewFrustumOffsetPitch = 0.0; // camera to the offset camera
float viewFrustumOffsetRoll = 0.0;
float viewFrustumOffsetDistance = 25.0;
float viewFrustumOffsetUp = 0.0;
void render_view_frustum() {
@ -747,24 +747,20 @@ void display(void)
Camera viewFrustumOffsetCamera = myCamera;
if (::viewFrustumFromOffset && ::frustumOn) {
//----------------------------------------------------
// set the camera to third-person view but offset so we can see the frustum
//----------------------------------------------------
viewFrustumOffsetCamera.setYaw ( 180.0 - myAvatar.getBodyYaw() + ::viewFrustumOffsetYaw );
viewFrustumOffsetCamera.setPitch ( 0.0 + ::viewFrustumOffsetPitch );
viewFrustumOffsetCamera.setRoll ( 0.0 + ::viewFrustumOffsetRoll );
viewFrustumOffsetCamera.setUp ( 0.2 + ::viewFrustumOffsetUp );
viewFrustumOffsetCamera.setDistance ( 0.5 + ::viewFrustumOffsetDistance );
viewFrustumOffsetCamera.setYaw ( 180.0 - myAvatar.getBodyYaw() + ::viewFrustumOffsetYaw );
viewFrustumOffsetCamera.setPitch ( ::viewFrustumOffsetPitch );
viewFrustumOffsetCamera.setRoll ( ::viewFrustumOffsetRoll );
viewFrustumOffsetCamera.setUp ( ::viewFrustumOffsetUp );
viewFrustumOffsetCamera.setDistance ( ::viewFrustumOffsetDistance );
viewFrustumOffsetCamera.update(1.f/FPS);
whichCamera = viewFrustumOffsetCamera;
}
//---------------------------------------------
// transform view according to whichCamera
// could be myCamera (if in normal mode)
// or could be viewFrustumOffsetCamera if in offset mode
//---------------------------------------------
// I changed the ordering here - roll is FIRST (JJV)
glRotatef ( whichCamera.getRoll(), 0, 0, 1 );
glRotatef ( whichCamera.getPitch(), 1, 0, 0 );