subdivision.h

Go to the documentation of this file.
00001 
00002 //**************************************************************************/
00003 // Copyright (c) 2008 Autodesk, Inc.
00004 // All rights reserved.
00005 //
00006 // Use of this software is subject to the terms of the Autodesk license
00007 // agreement provided at the time of installation or download, or which
00008 // otherwise accompanies this software in either electronic or hard copy form.
00009 //
00010 //**************************************************************************/
00011 // DESCRIPTION:
00012 // CREATED: October 2008
00013 //**************************************************************************/
00014 
00015 namespace mudbox {
00016 
00018 class MBDLL_DECL SubdivisionLevel : virtual public Mesh
00019 {
00020     DECLARE_CLASS;
00021 
00022 protected:
00024     SubdivisionLevel( FaceType eFaceType = typeQuadric );
00025 
00026 public:
00028     virtual class Geometry *Geometry( void ) const;
00030     virtual SubdivisionLevel *NextLevel( void );
00032     virtual SubdivisionLevel *PrevLevel( void ) const;
00034     virtual unsigned int Index( void ) const;
00036     virtual unsigned int TotalFaceCount( void ) const;
00038     virtual SubdivisionLevel *Subdivide( bool bProcessUV = true, bool bSmoothPositions = true, bool bSmoothUV = false,
00039         bool bPreserveHardEdges = true, bool bCreaseHardEdges = true, bool bEnableCreasing = true);
00041     virtual void ApplyChanges( bool bToLowerLevel = true );
00044     virtual void RecreateUVs( bool bForced = false );
00047     virtual bool ConvertSurfacePoint( SurfacePoint &p ) const;
00051     virtual unsigned int NextLevelQuadCount( void ) const;
00052     
00054     virtual void InitEdgeSharpness();
00056     virtual bool HasEdgeSharpness() const;
00058     virtual void SetEdgeSharpness(unsigned int iFaceIndex, unsigned int iSideIndex, float fEdgeWeight);
00060     virtual float EdgeSharpness(unsigned int iFaceIndex, unsigned int iSideIndex) const ;
00063     virtual unsigned int VertexCreaseType(unsigned int iVertexIndex);
00065     inline unsigned int QuadVertexCreaseType(unsigned int iFaceIndex, unsigned int iCornerIndex) { return VertexCreaseType(QuadIndex(iFaceIndex, iCornerIndex)); }
00067     inline unsigned int TriangleVertexCreaseType(unsigned int iFaceIndex, unsigned int iCornerIndex) { return VertexCreaseType(TriangleIndex(iFaceIndex, iCornerIndex)); }
00068     
00070     virtual void InitEdgeSoftness();
00072     virtual bool HasEdgeSoftness() const;
00074     virtual void SetEdgeSoftness(unsigned int iFaceIndex, unsigned int iSideIndex, unsigned int iSoftness);
00076     virtual unsigned int EdgeSoftness(unsigned int iFaceIndex, unsigned int iSideIndex) const;
00078     virtual unsigned int VertexHardness(unsigned int iVertexIndex) ;
00080     inline unsigned int QuadVertexHardness(unsigned int iFaceIndex, unsigned int iCornerIndex) { return VertexHardness(QuadIndex(iFaceIndex, iCornerIndex)); }
00082     inline unsigned int TriangleVertexHardness(unsigned int iFaceIndex, unsigned int iCornerIndex) { return VertexHardness(TriangleIndex(iFaceIndex, iCornerIndex)); }
00083     
00084     virtual void CheckValidity( DiagnosticLevel iLevel = dgnLevel2 ) const;
00085 
00086 
00090     static void ConvertFaceIndices(  const SubdivisionLevel* pFrom,             
00091                                      const Store<unsigned int>& aFromFaces,     
00092                                      const SubdivisionLevel* pTo,               
00093                                      Store<unsigned int>& aToFaces              
00094                                     );
00095 
00096     static void SetUVCreation( bool bCreateUV );
00097     static const Store<unsigned int> &QuadIndexTable( unsigned int iLevel );
00098     static const Store<unsigned int> &QuadVertexIndexTable( unsigned int iLevel );
00099     static const Store<unsigned int> &InvertedQuadIndexTable( unsigned int iLevel );
00100     virtual void CheckMeshGrid( unsigned int iBaseFaceIndex, unsigned int iLevel ) const;
00101     virtual void ConvertToRelative();
00102     virtual void ConvertToAbsolute();
00103 };
00104 
00105 }; // end of namespace mudbox