From 07c0cdd64eaab4bb1bf7aaa5a549c4b3a961f9c0 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Wed, 16 Apr 2003 18:57:20 +0000 Subject: [PATCH] add near/far clip plane control to EnterPerspective --- stepmania/src/RageDisplay.cpp | 4 ++-- stepmania/src/RageDisplay.h | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/stepmania/src/RageDisplay.cpp b/stepmania/src/RageDisplay.cpp index b555452c63..9795fccc71 100644 --- a/stepmania/src/RageDisplay.cpp +++ b/stepmania/src/RageDisplay.cpp @@ -596,7 +596,7 @@ void RageDisplay::PopMatrix() * When finished, the current position will be the "viewpoint" (at 0,0). negative * Z goes into the screen, positive X and Y is right and down. */ -void RageDisplay::EnterPerspective(float fov, bool preserve_loc) +void RageDisplay::EnterPerspective(float fov, bool preserve_loc, float near_clip, float far_clip) { g_PerspectiveMode++; if(g_PerspectiveMode > 1) { @@ -612,7 +612,7 @@ void RageDisplay::EnterPerspective(float fov, bool preserve_loc) glPushMatrix(); glLoadIdentity(); float aspect = SCREEN_WIDTH/(float)SCREEN_HEIGHT; - gluPerspective(fov, aspect, 1.000f, 1000.0f); // This far clipping this might cause Z-fighting if we ever turn the z-buffer on + gluPerspective(fov, aspect, near_clip, far_clip); /* Flip the Y coordinate, so positive numbers go down. */ glScalef(1, -1, 1); diff --git a/stepmania/src/RageDisplay.h b/stepmania/src/RageDisplay.h index f7f5c7df70..7662489a1f 100644 --- a/stepmania/src/RageDisplay.h +++ b/stepmania/src/RageDisplay.h @@ -79,7 +79,8 @@ public: int GetMaxTextureSize() const; - void EnterPerspective(float fov, bool preserve_loc = true); + // This far clipping this might cause Z-fighting if we ever turn the z-buffer on + void EnterPerspective(float fov, bool preserve_loc = true, float near = 1, float far = 1000); void ExitPerspective(); void LookAt(const RageVector3 &Eye, const RageVector3 &At, const RageVector3 &Up);