"L. Spiro Engine"

F:/My Projects/LSEngine/Modules/LSGraphicsLib/Src/TriangleStrips/LSGTriangleStripper.h

00001 
00016 #ifndef __LSG_TRIANGLESTRIPPER_H__
00017 #define __LSG_TRIANGLESTRIPPER_H__
00018 
00019 #include "../LSGGraphicsLib.h"
00020 #include "LSGStripAdjacency.h"
00021 #include "Vector/LSTLVectorPoD.h"
00022 
00023 namespace lsg {
00024 
00031         class CTriangleStripper {
00032         public :
00033                 // == Various constructors.
00034                 LSE_CALLCTOR                                    CTriangleStripper();
00035                 LSE_CALLCTOR                                    ~CTriangleStripper();
00036 
00037 
00038                 // == Functions.
00047                 LSBOOL LSE_CALL                                 InitTriangleStripper( LSUINT32 _ui32Faces = 0UL, const LSUINT32 * _pui32Faces = NULL, const LSUINT16 * _pui16Faces = NULL );
00048 
00055                 LSBOOL LSE_CALL                                 Compute();
00056 
00062                 LSE_INLINE LSUINT32 LSE_CALL    TotalIndices() const;
00063 
00069                 LSE_INLINE const LSUINT16 * LSE_CALL
00070                                                                                 IndicesAsWords() const;
00071 
00077                 LSE_INLINE const LSUINT32 * LSE_CALL
00078                                                                                 IndicesAsDoubleWords() const;
00079 
00080         protected :
00081                 // == Members.
00085                 CStripAdjacency                                 m_saAdj;
00086 
00090                 CVectorPoD<LSUINT8, LSUINT32>   m_vVerts;
00091 
00095                 LSBOOL                                                  m_bWords;
00096 
00097 
00098                 // == Functions.
00110                 LSUINT32 LSE_CALL                               GetStripLength( LSUINT32 _ui32Face, LSUINT32 _ui32Oldest, LSUINT32 _ui32Middle, LSUINT32 * _pui32Strip, LSUINT32 * _pui32Faces, LSUINT8 * _pui8Tags );
00111 
00125                 LSUINT32 LSE_CALL                               GetBestStrip( LSUINT32 _ui32Face,
00126                         LSUINT32 * _pui32TempFaceBuffer, LSUINT32 * _pui32BestFaceBuffer,
00127                         LSUINT32 * _pui32TempStripBuffer, LSUINT32 * _pui32BestStripBuffer,
00128                         LSUINT8 * _pui8TempTagsBuffer, LSUINT8 * _pui8Tags,
00129                         LSUINT32 &_ui32StripLen );
00130 
00139                 LSBOOL LSE_CALL                                 ConnectStrip( CVectorPoD<LSUINT32, LSUINT32, 1024UL> &_vLeft, LSUINT32 * _pui32Right, LSUINT32 _ui32RightLen );
00140         };
00141 
00142 
00143         // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
00144         // DEFINITIONS
00145         // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
00146         // == Functions.
00152         LSE_INLINE LSUINT32 LSE_CALL CTriangleStripper::TotalIndices() const {
00153                 if ( m_bWords ) { return m_vVerts.Length() / sizeof( LSUINT16 ); }
00154                 return m_vVerts.Length() / sizeof( LSUINT32 );
00155         }
00156 
00162         LSE_INLINE const LSUINT16 * LSE_CALL CTriangleStripper::IndicesAsWords() const {
00163                 return reinterpret_cast<const LSUINT16 *>(&m_vVerts[0]);
00164         }
00165 
00171         LSE_INLINE const LSUINT32 * LSE_CALL CTriangleStripper::IndicesAsDoubleWords() const {
00172                 return reinterpret_cast<const LSUINT32 *>(&m_vVerts[0]);
00173         }
00174 
00175 }       // namespace lsg
00176 
00177 #endif  // __LSG_TRIANGLESTRIPPER_H__
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator