00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef __SGL_SCENE_HPP
00026 #define __SGL_SCENE_HPP
00027
00028 #include <sgl.h>
00029 #include <sglGroup.hpp>
00030 #include <sglPolytope.hpp>
00031 #include <sglCull.hpp>
00032
00033 class sglViewPlatform;
00034
00035
00036
00148 class SGL_DLL_API sglScene : public sglGroup
00149 {
00150 public:
00152 sglScene();
00154 virtual ~sglScene();
00155
00165 static float computeLODScale(float fov_x, float fov_y,
00166 unsigned int viewport_x,
00167 unsigned int viewport_y);
00168
00177 static void createDefaultStatelets(vector<const sglStatelet*> &def);
00178
00186 void preDraw();
00187
00199 void preDraw(const sglTimespec &frame_time, unsigned int frame_count);
00200
00202 virtual void preDraw(const PreDrawStruct &trav) { sglGroup::preDraw(trav); }
00203
00207 unsigned int getFrameCount() const { return m_frame_count; }
00208
00212 const sglTimespec &getFrameTime() const { return m_frame_time; }
00213
00214
00215
00240 void cull(sglCullf &trav_state,
00241 float fov_x, float fov_y,
00242 unsigned int viewport_x, unsigned int viewport_y,
00243 const sglFrustumf &orig_frustum,
00244 const sglMat4f &view_matrix,
00245 const deque<const sglStatelet*> &override_statelets,
00246 unsigned int discriminator_mask = 0,
00247 unsigned int state_mask = 0) const;
00248
00267 void cull(sglCullf &trav_state,
00268 unsigned int viewport_x, unsigned int viewport_y,
00269 const sglViewPlatform &view_platform,
00270 const deque<const sglStatelet*> &override_statelets,
00271 unsigned int discriminator_mask = 0,
00272 unsigned int state_mask = 0) const;
00273
00299 void drawCulled(float fov_x, float fov_y,
00300 unsigned int viewport_x, unsigned int viewport_y,
00301 const sglFrustumf &orig_frustum,
00302 const sglMat4f &view_matrix,
00303 const deque<const sglStatelet*> &override_statelets,
00304 unsigned int discriminator_mask = 0,
00305 unsigned int state_mask = 0) const;
00306
00307
00308
00313 void cull(sglCulld &trav_state,
00314 float fov_x, float fov_y,
00315 unsigned int viewport_x, unsigned int viewport_y,
00316 const sglFrustumd &orig_frustum,
00317 const sglMat4d &view_matrix,
00318 const deque<const sglStatelet*> &override_statelets,
00319 unsigned int discriminator_mask = 0,
00320 unsigned int state_mask = 0) const;
00321
00326 void cull(sglCulld &trav_state,
00327 unsigned int viewport_x, unsigned int viewport_y,
00328 const sglViewPlatform &view_platform,
00329 const deque<const sglStatelet*> &override_statelets,
00330 unsigned int discriminator_mask = 0,
00331 unsigned int state_mask = 0) const;
00332
00337 void drawCulled(float fov_x, float fov_y,
00338 unsigned int viewport_x, unsigned int viewport_y,
00339 const sglFrustumd &orig_frustum,
00340 const sglMat4d &view_matrix,
00341 const deque<const sglStatelet*> &override_statelets,
00342 unsigned int discriminator_mask = 0,
00343 unsigned int state_mask = 0) const;
00344
00345
00346 virtual sglNode *clone(unsigned int mode) const;
00347
00348
00349 virtual void printInfo(ostream &ostrm, const char *indent_string) const;
00350
00351 protected:
00352
00353
00354
00355
00356 virtual void cull(sglCull<float> &trav_state,
00357 unsigned int cull_flags) const
00358 {
00359 sglGroup::cull(trav_state, cull_flags);
00360 }
00361
00362
00363 virtual void cull(sglCull<double> &trav_state,
00364 unsigned int cull_flags) const
00365 {
00366 sglGroup::cull(trav_state, cull_flags);
00367 }
00368
00369 void copyTo(sglScene *dst, unsigned int mode) const;
00370
00371 private:
00372 sglScene(const sglScene &);
00373 sglScene &operator=(const sglScene&);
00374
00375 private:
00376 vector<const sglStatelet*> m_default_statelets;
00377
00378 unsigned int m_frame_count;
00379 sglTimespec m_frame_time;
00380 };
00381
00382 #endif