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

RenderTraverser.h

Go to the documentation of this file.
00001 // Copyright NVIDIA Corporation 2002-2004
00002 // TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED
00003 // *AS IS* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS
00004 // OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
00005 // AND FITNESS FOR A PARTICULAR PURPOSE.  IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS
00006 // BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES
00007 // WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS,
00008 // BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS)
00009 // ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS
00010 // BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES 
00011 
00012 #pragma once
00013 
00015 #include "nvsgcommon.h"
00016 
00017 #include "nvtraverser/ModelViewTraverser.h"
00018 #include "nvsg/DAL.h"
00019 #include "nvutil/Incarnation.h"
00020 
00021 namespace nvsg
00022 {
00023   class StateAttribute;
00024 }
00025 
00026 namespace nvtraverser
00027 {
00028 // renderer type IDs
00029 enum 
00030 {
00031   RT_GL  = 0x00010000
00032 , RT_DX8 = 0x00020000
00033 , RT_DX9 = 0x00040000
00034 };
00035 
00037 
00047 class RenderTraverser : public ModelViewTraverser
00048                       , public nvsg::DALDataCreator
00049 {
00050   public:
00051 
00052     enum JitterTechnique
00053     {
00054       JT_ACCUM        = 0x01,   
00055       JT_READ_PIXELS  = 0x02,   
00056       JT_PBUFFER      = 0x04    
00057     };    
00058 
00059     enum RenderTechnique
00060     {
00061       RT_POINTS       = 0x01,   
00062       RT_WIREFRAME    = 0x02,   
00063       RT_SHADED       = 0x04,   
00064       RT_TEXTURED     = 0x10,   
00065       RT_EFFECTED     = 0x20    
00066     };      
00067 
00068     enum TransparencyTechnique
00069     {
00070       TT_NONE               = 0x01,   
00071       TT_STIPPLED           = 0x02,   
00072       TT_BLENDED            = 0x04,   
00073       TT_ORDER_INDEPENDENT  = 0x08    
00074     };          
00075 
00076     enum OITTechnique
00077     {
00078       OT_TEXTURE  = 0x01,   
00079       OT_PBUFFER  = 0x02    
00080     };         
00081 
00082     enum GeometryCacheTechnique
00083     {
00084       GCT_NONE    = 0x01,   
00085       GCT_DL      = 0x02,   
00086       GCT_VBO     = 0x04    
00087     };
00088 
00090 
00091     NVSG_API virtual JitterTechnique getJitterTechnique( void ) const = 0;
00092 
00094 
00097     NVSG_API virtual bool isJitterTechniqueSupported( JitterTechnique jt               
00098                                                     ) const = 0;
00099 
00101 
00102     NVSG_API virtual bool setJitterTechnique( JitterTechnique jt                       
00103                                             ) = 0;
00104     
00106     //** \return The currently used render technique. */
00107     NVSG_API virtual RenderTechnique getRenderTechnique( void ) const = 0;
00108 
00110 
00113     NVSG_API virtual bool isRenderTechniqueSupported( RenderTechnique rt               
00114                                                     ) const = 0;
00115 
00117 
00118     NVSG_API virtual bool setRenderTechnique( RenderTechnique rt                       
00119                                             ) = 0;
00120     
00122     //** \return The currently used transparency technique. */
00123     NVSG_API virtual TransparencyTechnique getTransparencyTechnique( void ) const = 0;
00124 
00126 
00129     NVSG_API virtual bool isTransparencyTechniqueSupported( TransparencyTechnique tt   
00130                                                           ) const = 0;
00131 
00133 
00134     NVSG_API virtual bool setTransparencyTechnique( TransparencyTechnique tt           
00135                                                   ) = 0;
00136     
00138     //** \return The currently used OIT technique. */
00139     NVSG_API virtual OITTechnique getOITTechnique( void ) const = 0;
00140 
00142 
00145     NVSG_API virtual bool isOITTechniqueSupported( OITTechnique ot                     
00146                                                   ) const = 0;
00147 
00149 
00150     NVSG_API virtual bool setOITTechnique( OITTechnique ot                             
00151                                           ) = 0;
00152 
00154 
00155     NVSG_API virtual size_t getOITMaxPasses( void ) const = 0;
00157 
00158     NVSG_API virtual bool setOITMaxPasses( size_t maxPasses                            
00159                                           ) = 0;
00160 
00162 
00163     NVSG_API virtual float getOITThreshold( void ) const = 0;
00164 
00166 
00172     NVSG_API virtual bool setOITThreshold( float threshold  
00173                                           ) = 0;
00174 
00176     //** \return The currently used geometry caching technique. */
00177     NVSG_API virtual GeometryCacheTechnique getGeometryCacheTechnique( void ) const = 0;
00178 
00180 
00181     NVSG_API virtual bool isGeometryCacheTechniqueSupported( GeometryCacheTechnique gct  
00182                                                             ) const = 0;
00183 
00185 
00186     NVSG_API virtual bool setGeometryCacheTechnique( GeometryCacheTechnique gct          
00187                                                     ) = 0;
00188 
00190 
00191     NVSG_API virtual void getTextureSizeLimits( size_t &width     
00192                                               , size_t &height    
00193                                               ) const = 0;
00194 
00196 
00198     NVSG_API virtual void setTextureSizeLimits( size_t width      
00199                                               , size_t height     
00200                                               ) = 0;
00201 
00203     NVSG_API void  setLineAntiAliasing( bool onOff    
00204                                       );
00205 
00207 
00208     NVSG_API bool  getLineAntiAliasing( void ) const;
00209 
00211 
00212     NVSG_API float getLineWidth( void ) const;
00213 
00215     NVSG_API void  setLineWidth( float width          
00216                                );
00217 
00219     NVSG_API void  setPointAntiAliasing( bool onOff   
00220                                        );
00221 
00223 
00224     NVSG_API bool  getPointAntiAliasing( void ) const;
00225 
00227 
00228     NVSG_API float getPointSize( void ) const;
00229 
00231     NVSG_API void  setPointSize( float size           
00232                                );
00233 
00234   protected:
00236     NVSG_API RenderTraverser(void);
00238     NVSG_API virtual ~RenderTraverser(void);
00239 
00240     // Object handler overrides
00241     NVSG_API virtual void handleParallelCamera(const nvsg::ParallelCamera * p, const nvsg::Node * root);
00242     NVSG_API virtual void handlePerspectiveCamera(const nvsg::PerspectiveCamera * p, const nvsg::Node * root);
00243  
00244     // postTraverseGroup override:
00245     // pop lights off the light stack after a group has been visited
00246     NVSG_API virtual void postTraverseGroup(const nvsg::Group *p);
00247 
00248     // traverseLight override to handle a general LightSource
00249     NVSG_API virtual void traverseLight(const nvsg::LightSource * p);
00250 
00252     NVSG_API virtual void disableLightSource(const nvsg::LightSource *p) = 0;
00253 
00255 
00258     NVSG_API size_t getCurrentLightIndex() const;
00259     
00261     std::map<const nvsg::StateAttribute*, nvutil::Incarnation> m_perStateAttributeIncarnationMap;
00262 
00263   private:
00264     void traverse(const nvsg::LightSource * p); // helper for general light source handling 
00265     void popLights( const nvsg::Group *p ); // pop lights from light stack after a group has been visited 
00266 
00267     std::stack<std::pair<const nvsg::Group *,const nvsg::LightSource *> > m_lightStack; // light stack
00268     size_t m_currentLightIndex;
00269     bool  m_lineAntiAliasing;
00270     float m_lineWidth;
00271     bool  m_pointAntiAliasing;
00272     float m_pointSize;
00273 };
00274 
00275 inline size_t RenderTraverser::getCurrentLightIndex() const 
00276 { 
00277   return m_currentLightIndex; 
00278 }
00279 
00280 inline void RenderTraverser::setLineAntiAliasing( bool onOff )
00281 {
00282   m_lineAntiAliasing = onOff;
00283 }
00284 
00285 inline bool RenderTraverser::getLineAntiAliasing() const
00286 {
00287   return( m_lineAntiAliasing );
00288 }
00289 
00290 inline float RenderTraverser::getLineWidth( void ) const
00291 {
00292   return( m_lineWidth );
00293 }
00294 
00295 inline void RenderTraverser::setLineWidth( float width )
00296 {
00297   m_lineWidth = width;
00298 }
00299 
00300 inline void RenderTraverser::setPointAntiAliasing( bool onOff )
00301 {
00302   m_pointAntiAliasing = onOff;
00303 }
00304 
00305 inline bool RenderTraverser::getPointAntiAliasing() const
00306 {
00307   return( m_pointAntiAliasing );
00308 }
00309 
00310 inline float RenderTraverser::getPointSize( void ) const
00311 {
00312   return( m_pointSize );
00313 }
00314 
00315 inline void RenderTraverser::setPointSize( float size )
00316 {
00317   m_pointSize = size;
00318 }
00319 
00320 }

Generated on Tue Mar 1 13:19:20 2005 for NVSGSDK by NVIDIA