Adjust near clipping plane in glViewer automatically when SSAO is turned off

- when SSAO is turned off, we can bring the near clipping plane much closer to help close-up inspection...
This commit is contained in:
manuelk 2014-10-21 18:50:54 -07:00
parent f145f70fd2
commit 7d07e341e0
2 changed files with 8 additions and 3 deletions

View File

@ -108,6 +108,10 @@ public:
virtual void BuildUI(GLhud * hud, int x, int y);
void SetActive(bool value);
bool IsActive() const {
return _active;
}
void SetRadius(float value);

View File

@ -1115,7 +1115,8 @@ bindProgram(Effect effect, OpenSubdiv::Osd::DrawContext::PatchArray const & patc
static void
display() {
g_hud.GetFrameBuffer()->Bind();
SSAOGLFrameBuffer * fb = (SSAOGLFrameBuffer *)g_hud.GetFrameBuffer();
fb->Bind();
Stopwatch s;
s.Start();
@ -1134,7 +1135,7 @@ display() {
translate(g_transformData.ModelViewMatrix,
-g_center[0], -g_center[1], -g_center[2]);
perspective(g_transformData.ProjectionMatrix,
45.0f, (float)aspect, 1.0f, 500.0f);
45.0f, (float)aspect, fb->IsActive() ? 1.0f : 0.0001f, 500.0f);
multMatrix(g_transformData.ModelViewProjectionMatrix,
g_transformData.ModelViewMatrix,
g_transformData.ProjectionMatrix);
@ -1255,7 +1256,7 @@ display() {
if (g_drawCageVertices)
drawCageVertices();
g_hud.GetFrameBuffer()->ApplyImageShader();
fb->ApplyImageShader();
GLuint numPrimsGenerated = 0;
GLuint timeElapsed = 0;