Re #589: cGrPerspCamera: added callbacks for before/after drawing (Boris)

o added callbacks
o put them to use in cGrScreen::camDraw()

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@4961 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: b13bb983c12c945c618bae1b60f7c104c21bbb7b
Former-commit-id: 97ec443745f99c673d9c47aae850a11e81ec39e3
This commit is contained in:
kmetykog 2012-09-25 09:33:01 +00:00
parent 56f90eb25c
commit 96f1fb2f69
2 changed files with 15 additions and 0 deletions

View file

@ -176,6 +176,13 @@ class cGrPerspCamera : public cGrCamera
float getFogStart(void) { return fogstart; }
float getFogEnd(void) { return fogend; }
/** called in cGrScreen::camDraw() before anything else. Can be used to setup any state
* before any rendering takes place. */
virtual void beforeDraw() {}
/** called in cGrScreen::camDraw() after everything else. The counterpart to
* cGrPerspCamera::beforeDraw(). */
virtual void afterDraw() {}
cGrPerspCamera *next(void) {
return (cGrPerspCamera *)cGrCamera::next();
}

View file

@ -233,6 +233,10 @@ compareCars(const void *car1, const void *car2)
void cGrScreen::camDraw(tSituation *s)
{
GfProfStartProfile("dispCam->beforeDraw*");
dispCam->beforeDraw();
GfProfStopProfile("dispCam->beforeDraw*");
glDisable(GL_COLOR_MATERIAL);
GfProfStartProfile("dispCam->update*");
@ -300,6 +304,10 @@ void cGrScreen::camDraw(tSituation *s)
curCar->_roll * SG_RADIANS_TO_DEGREES, 0.0, curCar->_speed_x);
} else
grRain.drawPrecipitation(grTrack->local.rain, 1.0, 0.0, 0.0, 0.0, 0.0);
GfProfStartProfile("dispCam->afterDraw*");
dispCam->afterDraw();
GfProfStopProfile("dispCam->afterDraw*");
}