Bugfix: the circles for the karts on the minimap were not shown

when the game was started using the menu (instead of -N command
line option).


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@3878 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2009-08-18 09:41:53 +00:00
parent d5b56f92ee
commit 184ba6269e
2 changed files with 20 additions and 1 deletions

View File

@ -388,7 +388,7 @@ void IrrDriver::renderToTexture(ptr_vector<scene::IMesh, REF>& mesh,
//m_device->getVideoDriver()->endScene();
removeNode(main_node);
removeNode(camera);
removeCamera(camera);
removeNode(light);
m_device->getVideoDriver()->setRenderTarget(0, false, false);

View File

@ -88,6 +88,23 @@ void RaceGUI::createMarkerTexture()
m_marker_rendered_size),
"RaceGUI::markers");
#endif
scene::ICameraSceneNode *camera = irr_driver->addCamera();
core::matrix4 projection;
projection.buildProjectionMatrixOrthoLH((float)(m_marker_rendered_size*npower2),
(float)(m_marker_rendered_size), -1.0f, 1.0f);
camera->setProjectionMatrix(projection, true);
core::vector3df center( (float)(m_marker_rendered_size*npower2>>1),
(float)(m_marker_rendered_size>>1), 0.0f);
camera->setPosition(center);
camera->setUpVector(core::vector3df(0,1,0));
camera->setTarget(center + core::vector3df(0,0,4));
// The call to render sets the projection matrix etc. So we have to call
// this now before doing the direct OpenGL calls.
// FIXME: perhaps we should use three calls to irr_driver: begin(),
// render(), end() - so we could do the rendering by calling to
// draw2DPolygon() between render() and end(), avoiding the
// call to camera->render()
camera->render();
for(unsigned int i=0; i<race_manager->getNumKarts(); i++)
{
const std::string& kart_ident = race_manager->getKartIdent(i);
@ -105,7 +122,9 @@ void RaceGUI::createMarkerTexture()
irr_driver->getVideoDriver()->draw2DPolygon(vertices, &colors);
#endif
}
m_marker = irr_driver->endRenderToTexture();
irr_driver->removeCamera(camera);
} // createMarkerTexture
//-----------------------------------------------------------------------------