Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

OSGDrawActionBase.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002  *                                OpenSG                                     *
00003  *                                                                           *
00004  *                                                                           *
00005  *             Copyright (C) 2000-2002 by the OpenSG Forum                   *
00006  *                                                                           *
00007  *                            www.opensg.org                                 *
00008  *                                                                           *
00009  *   contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de          *
00010  *                                                                           *
00011 \*---------------------------------------------------------------------------*/
00012 /*---------------------------------------------------------------------------*\
00013  *                                License                                    *
00014  *                                                                           *
00015  * This library is free software; you can redistribute it and/or modify it   *
00016  * under the terms of the GNU Library General Public License as published    *
00017  * by the Free Software Foundation, version 2.                               *
00018  *                                                                           *
00019  * This library is distributed in the hope that it will be useful, but       *
00020  * WITHOUT ANY WARRANTY; without even the implied warranty of                *
00021  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         *
00022  * Library General Public License for more details.                          *
00023  *                                                                           *
00024  * You should have received a copy of the GNU Library General Public         *
00025  * License along with this library; if not, write to the Free Software       *
00026  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                 *
00027  *                                                                           *
00028 \*---------------------------------------------------------------------------*/
00029 /*---------------------------------------------------------------------------*\
00030  *                                Changes                                    *
00031  *                                                                           *
00032  *                                                                           *
00033  *                                                                           *
00034  *                                                                           *
00035  *                                                                           *
00036  *                                                                           *
00037 \*---------------------------------------------------------------------------*/
00038 
00039 
00040 #ifndef _OSGDRAWACTIONBASE_H_
00041 #define _OSGDRAWACTIONBASE_H_
00042 #ifdef __sgi
00043 #pragma once
00044 #endif
00045 
00046 //---------------------------------------------------------------------------
00047 //  Includes
00048 //---------------------------------------------------------------------------
00049 
00050 #include <OSGBaseTypes.h>
00051 #include <OSGFrustumVolume.h>
00052 #include <OSGStatCollector.h>
00053 #include <OSGStatElemTypes.h>
00054 #include <OSGAction.h>
00055 
00056 OSG_BEGIN_NAMESPACE
00057 
00058 //---------------------------------------------------------------------------
00059 //  Forward References
00060 //---------------------------------------------------------------------------
00061 
00062 class Camera;
00063 class Background;
00064 class Window;
00065 class Node;
00066 class Viewport;
00067 class Material;
00068 
00069 //---------------------------------------------------------------------------
00070 //   Types
00071 //---------------------------------------------------------------------------
00072 
00073 //---------------------------------------------------------------------------
00074 //  Class
00075 //---------------------------------------------------------------------------
00076 
00077 class OSG_SYSTEMLIB_DLLMAPPING DrawActionBase : public Action
00078 {
00079   public:
00080 
00081     //-----------------------------------------------------------------------
00082     //   constants                                                           
00083     //-----------------------------------------------------------------------
00084 
00085     static StatElemDesc<StatTimeElem> statTravTime;
00086     static StatElemDesc<StatIntElem>  statCullTestedNodes;
00087     static StatElemDesc<StatIntElem>  statCulledNodes;
00088     
00089     //-----------------------------------------------------------------------
00090     //   enums                                                               
00091     //-----------------------------------------------------------------------
00092 
00093     //-----------------------------------------------------------------------
00094     //   types                                                               
00095     //-----------------------------------------------------------------------
00096 
00097     //-----------------------------------------------------------------------
00098     //   class functions                                                     
00099     //-----------------------------------------------------------------------
00100  
00101     //-----------------------------------------------------------------------
00102     //   instance functions                                                  
00103     //-----------------------------------------------------------------------
00104 
00105     virtual ~DrawActionBase(void); 
00106 
00107     /*------------------------- your_category -------------------------------*/
00108 
00109     // rendering state handling
00110        
00111           Viewport      *getViewport     (void                  ) const;    
00112           void           setViewport     (Viewport   *viewport  );
00113     
00114           Camera        *getCamera       (void                  ) const;    
00115           void           setCamera       (Camera     *cam       );
00116     const Matrix        &getCameraToWorld(void);
00117 
00118           Background    *getBackground   (void                  ) const;
00119           void           setBackground   (Background *background);
00120     
00121           Window        *getWindow       (void                  ) const;
00122           void           setWindow       (Window * window       );
00123     
00124           StatCollector *getStatistics   (void                  );
00125           void           setStatistics   (StatCollector * stat  );
00126 
00127     // frustum culling functions
00128     // these are just temporary, sooner or later they'll move into a 
00129     // cacaded action
00130     
00131     // control activation of frustum culling
00132     bool            getFrustumCulling( void ) const;
00133     void            setFrustumCulling( bool val = true );
00134     
00135     // control drawing of checked volumes
00136     bool            getVolumeDrawing( void ) const;
00137     void            setVolumeDrawing( bool val = false );
00138     
00139     // control automatic frustum calculation
00140     bool            getAutoFrustum( void ) const;
00141     void            setAutoFrustum( bool val = true );
00142 
00143     // control frustum
00144     const FrustumVolume & getFrustum( void ) const;
00145     void            setFrustum( FrustumVolume & frust );    
00146     
00147     virtual bool    isVisible(Node* node) = 0;
00148 
00149     // select all visible nodes
00150     UInt32  selectVisibles( void );
00151 
00152 
00153     Material   *getMaterial    (void                             ) const;
00154     NodePtr     getMaterialNode(void                             ) const;
00155     void        setMaterial    (Material *pMaterial, NodePtr node);
00156     
00157     /*------------------------- your_operators ------------------------------*/
00158 
00159     // initialisation
00160     virtual Action::ResultE start(void);
00161     virtual Action::ResultE stop( Action::ResultE res );
00162 
00163     /*------------------------- assignment ----------------------------------*/
00164 
00165     /*------------------------- comparison ----------------------------------*/
00166 
00167 
00168   protected:
00169 
00170     //-----------------------------------------------------------------------
00171     //   enums                                                               
00172     //-----------------------------------------------------------------------
00173 
00174     //-----------------------------------------------------------------------
00175     //   types                                                               
00176     //-----------------------------------------------------------------------
00177 
00178     //-----------------------------------------------------------------------
00179     //   class variables                                                     
00180     //-----------------------------------------------------------------------
00181 
00182     //-----------------------------------------------------------------------
00183     //   class functions                                                     
00184     //-----------------------------------------------------------------------
00185 
00186     //-----------------------------------------------------------------------
00187     //   instance variables                                                  
00188     //-----------------------------------------------------------------------
00189 
00190     Camera        *_camera;
00191     Background    *_background;
00192     Window        *_window;
00193     Viewport      *_viewport;
00194     StatCollector *_statistics;
00195     bool           _ownStat;
00196 
00197 
00198     Material      *_pMaterial;
00199     NodePtr        _pMaterialNode;
00200 
00201     // frustum culling attributes
00202     
00203     bool          _frustumCulling;
00204     bool          _volumeDrawing;
00205     bool          _autoFrustum;
00206     FrustumVolume _frustum;
00207     Matrix        _mCameraToWorld;
00208     
00209     //-----------------------------------------------------------------------
00210     //   instance functions                                                  
00211     //-----------------------------------------------------------------------
00212 
00213     DrawActionBase(void);
00214 
00215     DrawActionBase(const DrawActionBase &source);
00216     void operator =(const DrawActionBase &source);
00217 
00218     virtual std::vector<Functor> *getDefaultEnterFunctors(void) = 0;
00219     virtual std::vector<Functor> *getDefaultLeaveFunctors(void) = 0;
00220 
00221   private:
00222 
00223     //-----------------------------------------------------------------------
00224     //   enums                                                               
00225     //-----------------------------------------------------------------------
00226 
00227     //-----------------------------------------------------------------------
00228     //   types                                                               
00229     //-----------------------------------------------------------------------
00230 
00231     typedef Action Inherited;
00232 
00233     //-----------------------------------------------------------------------
00234     //   friend classes                                                      
00235     //-----------------------------------------------------------------------
00236 
00237     //-----------------------------------------------------------------------
00238     //   friend functions                                                    
00239     //-----------------------------------------------------------------------
00240 
00241     //-----------------------------------------------------------------------
00242     //   class variables                                                     
00243     //-----------------------------------------------------------------------
00244 
00245     static char cvsid[];
00246 
00247     //-----------------------------------------------------------------------
00248     //   class functions                                                     
00249     //-----------------------------------------------------------------------
00250 
00251     //-----------------------------------------------------------------------
00252     //   instance variables                                                  
00253     //-----------------------------------------------------------------------
00254 
00255     //-----------------------------------------------------------------------
00256     //   instance functions                                                  
00257     //-----------------------------------------------------------------------
00258 
00259     // prohibit default functions (move to 'public' if you need one)
00260 };
00261 
00262 //---------------------------------------------------------------------------
00263 //   Exported Types
00264 //---------------------------------------------------------------------------
00265 
00266 // class pointer
00267 
00268 typedef DrawActionBase *DrawActionBaseP;
00269 
00270 OSG_END_NAMESPACE
00271 
00272 #include <OSGDrawActionBase.inl>
00273 
00274 #endif /* _OSGDRAWACTIONBASE_H_ */

Generated on Thu Aug 25 04:03:08 2005 for OpenSG by  doxygen 1.4.3