Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   Related Pages  

sglScene.hpp

00001 /*****************************************************************************
00002  * SGL: A Scene Graph Library
00003  *
00004  * Copyright (C) 1997-2001  Scott McMillan   All Rights Reserved.
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Library General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2 of the License, or (at your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Library General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Library General Public
00017  * License along with this library; if not, write to the Free
00018  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00019  *****************************************************************************
00020  *     File: sglScene.hpp
00021  *  Created: 2 January 1999
00022  *  Summary: Root node in a scene graph initializes and begins the traversal
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    // ----------------- single precision cull functions --------------------
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    // ----------------- double precision cull functions --------------------
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    // See sglNode::clone() for details.
00346    virtual sglNode *clone(unsigned int mode) const;
00347 
00348    // See sglObject::printInfo() for details.
00349    virtual void printInfo(ostream &ostrm, const char *indent_string) const;
00350 
00351 protected:
00352    // uses sglGroup's versions of these - these are here to avoid MIPSPro
00353    // compiler warnings:
00354 
00355    // see sglNode::cull(f) for details
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    // see sglNode::cull(d) for details
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 &);            // not implemented
00373    sglScene &operator=(const sglScene&);  // not implemented
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

Generated at Mon Jul 1 18:00:05 2002 for SGL by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001