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(); }