From: Jan R. <slo...@gm...> - 2008-05-16 20:04:46
|
Am Thu, 15 May 2008 23:25:59 +0200 schrieb Olivier Bordes <ob...@gm...>: > Now, for the ssh sky, there is also a PreDraw and a PostDraw funtion as > the SssgCullAndDraw function must be called in between. That's why the current "Scenery" and "SkyRenderer" hooks feature exactly the same two hooks: class SkyRenderer { public: /// The destructor virtual ~SkyRenderer() {}; /// Update the camera position and cloud movement virtual void update(sgVec3 *campos, double dt) {}; /// Hook for the first drawing stage virtual void preDraw() = 0; /// Hook for the second drawing stage virtual void postDraw(float altitude) {}; }; A subclass must provide at least a preDraw() implementation (e.g. the SkyBox only draws something before the rest of the Scenery and airplane models are rendered). The postDraw() hook has a default implementation and therefore is optional. > That's the way I have written my class. Here is the .h: > > class SsgSky : public RunnableObject > { > public: > SsgSky(Scheduler *); > ~SsgSky(); > void Run(); > void PreDraw(); > void PostDraw(); > > private: > Scheduler * myScheduler; > .... > } In this case I'd still recommend that you derive your class from SkyRenderer. And SkyRenderer should be derived from RunnableObject! This absolutely makes sense: +--------------+ |RunnableObject| +--------------+ ^ | | +-------------------------------------+ | SkyRenderer | +-------------------------------------+ ^ ^ ^ ^ | | | | | | | | SkyBox CRRCSkyDome CRRCPanoDome SsgSky Each sky object will inherit RunnableObject::Run() instead of SkyRenderer::update(), so we don't lose any functionality but gain the compatibility to your scheduler for all sky classes. And you don't have to totally break the current scheme and reinvent the wheel for integrating SsgSky. > I made a first temptative to integrate in crrcsim, but does not work. It > looks like clouds do not render correctly, they are much too big and on > a bad axis. Also, in my trial , I shortcut the current sky to avoid > interference with ssgsky, but I am not sure I did not forget something. Just make sure that Scenery::theSky == NULL and the current sky will not be rendered. > Anyway I need to debug this, but I will have very little time in the > coming 2 weeks (if not at all) . Same applies to me. Kind regards, Jan R. -- Jan Reucker email: jan dot reucker at web dot de web: http://www.reucker-online.de |