00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #pragma once
00013
00014 #include "nvsgcommon.h"
00015
00016 #include "nvsg/Face.h"
00017 #include "nvtraverser/Traverser.h"
00018
00019 namespace nvtraverser
00020 {
00022
00023 class DrawableUnifyTraverser : public Traverser
00024 {
00025 public:
00027 NVSG_API DrawableUnifyTraverser( void );
00028
00029 public:
00031
00033 NVSG_API bool getIgnoreNames( void ) const;
00034
00036
00037 NVSG_API void setIgnoreNames( bool ignore
00038 );
00039
00040 protected:
00042 NVSG_API virtual ~DrawableUnifyTraverser( void );
00043
00045
00046 NVSG_API virtual void handleGeoNode( const nvsg::GeoNode * p
00047 );
00048
00050
00051 NVSG_API virtual void handleStateSet( const nvsg::StateSet * p
00052 );
00053
00055
00056 NVSG_API virtual void handleQuads( const nvsg::Quads * p
00057 );
00058
00060
00061 NVSG_API virtual void handleAnimatedQuads( const nvsg::AnimatedQuads * p
00062 );
00063
00065
00066 NVSG_API virtual void handleQuadStrips( const nvsg::QuadStrips * p
00067 );
00068
00070
00071 NVSG_API virtual void handleTriangles( const nvsg::Triangles * p
00072 );
00073
00075
00076 NVSG_API virtual void handleAnimatedTriangles( const nvsg::AnimatedTriangles * p
00077 );
00078
00080
00081 NVSG_API virtual void handleSkinnedTriangles( const nvsg::SkinnedTriangles * p
00082 );
00083
00085
00086 NVSG_API virtual void handleTriStrips( const nvsg::TriStrips * p
00087 );
00088
00089 protected:
00090 void combine( nvsg::GeoSet *p0, const nvsg::GeoSet *p1 );
00091 void combine( nvsg::Quads *p0, const nvsg::Quads *p1 );
00092 void combine( nvsg::QuadStrips *p0, const nvsg::QuadStrips *p1 );
00093 void combine( nvsg::Triangles *p0, const nvsg::Triangles *p1 );
00094 void combine( nvsg::TriStrips *p0, const nvsg::TriStrips *p1 );
00095
00096 private:
00097 bool m_ignoreNames;
00098 const nvsg::StateSet * m_currentStateSet;
00099 std::vector<std::pair<const nvsg::Drawable*,const nvsg::StateSet*> > m_drawableToDelete;
00100 std::vector<std::pair<const nvsg::Quads*,const nvsg::StateSet*> > m_quadsToKeep;
00101 std::vector<std::pair<const nvsg::QuadStrips*,const nvsg::StateSet*> > m_quadStripsToKeep;
00102 std::vector<std::pair<const nvsg::Triangles*,const nvsg::StateSet*> > m_trianglesToKeep;
00103 std::vector<std::pair<const nvsg::TriStrips*,const nvsg::StateSet*> > m_triStripsToKeep;
00104 std::vector<nvsg::Face3> m_shiftedFaces3;
00105 std::vector<nvsg::Face4> m_shiftedFaces4;
00106 std::vector<nvsg::IndexSet> m_shiftedIndexSets;
00107 };
00108
00109 inline bool DrawableUnifyTraverser::getIgnoreNames( void ) const
00110 {
00111 return( m_ignoreNames );
00112 }
00113
00114 inline void DrawableUnifyTraverser::setIgnoreNames( bool ignore )
00115 {
00116 m_ignoreNames = ignore;
00117 }
00118
00119 }