From f0b8e46ed5c6ee07409071e60a4bff9847c08482 Mon Sep 17 00:00:00 2001 From: josh Date: Fri, 14 Nov 2008 00:32:11 +0000 Subject: [PATCH] drawing orb in the correct order now git-svn-id: svn://anubis/dwscr/trunk@107 5bef9df8-b654-44bb-925b-0ff18baa8f8c --- ss/LightBounce.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ss/LightBounce.cc b/ss/LightBounce.cc index 3dd1550..29f4ecc 100644 --- a/ss/LightBounce.cc +++ b/ss/LightBounce.cc @@ -190,15 +190,24 @@ void LightBounce::update() for (int i = 0; i < numMonitors; i++) { + bool drewOrb = false; + float orbDx = viewer_x - m_orb_pos[0]; + float orbDy = viewer_y - m_orb_pos[1]; + float orbDz = viewer_z - m_orb_pos[2]; + float orbDist = (orbDx * orbDx) + (orbDy * orbDy) + (orbDz * orbDz); glViewport(i*width/numMonitors, 0, width/numMonitors, height); glLoadIdentity(); gluLookAt(viewer_x, viewer_y, viewer_z, 0, 0, 0, 0, 1, 0); for (int i = 0, sz = m_boxes.size(); i < sz; i++) { + if (m_boxes[i]->getDist() < orbDist && !drewOrb) + { + glCallList(m_orb_dl); + drewOrb = true; + } m_boxes[i]->draw(); } glTranslatef(m_orb_pos[0], m_orb_pos[1], m_orb_pos[2]); - glCallList(m_orb_dl); } SDL_GL_SwapBuffers(); }