Mudbox/subdivision.h Source File

subdivision.h
Go to the documentation of this file.
1 
2 //**************************************************************************/
3 // Copyright (c) 2008 Autodesk, Inc.
4 // All rights reserved.
5 //
6 // Use of this software is subject to the terms of the Autodesk license
7 // agreement provided at the time of installation or download, or which
8 // otherwise accompanies this software in either electronic or hard copy form.
9 //
10 //**************************************************************************/
11 // DESCRIPTION:
12 // CREATED: October 2008
13 //**************************************************************************/
14 
15 namespace mudbox {
16 
18 {
19  SubdivisionInfo( bool bRemoveLevel, bool bRemoveOctree, bool bCreateUV,
20  bool bSmoothPositions,
21  int iBoundaryRule, bool bPreserveBorders, bool bPreserveHardNormals, bool bCreaseHardEdges, bool bEnableCreasing )
22  { m_bRemoveLevel = bRemoveLevel;
23  m_bRemoveOctree = bRemoveOctree;
24  m_bCreateUV = bCreateUV;
25  m_bSmoothPositions = bSmoothPositions;
26  m_iBoundaryRule = iBoundaryRule;
27  m_bPreserveBorders = bPreserveBorders;
28  m_bPreserveHardEdges = bPreserveHardNormals;
29  m_bCreaseHardEdges = bCreaseHardEdges;
30  m_bEnableCreasing = bEnableCreasing;
31  };
32 
37 };
38 
40 class MBDLL_DECL SubdivisionLevel : virtual public Mesh
41 {
43 
44 protected:
46  SubdivisionLevel( FaceType eFaceType = typeQuadric );
47 
48 public:
50  virtual class Geometry *Geometry( void ) const;
52  virtual SubdivisionLevel *NextLevel( void );
54  virtual SubdivisionLevel *PrevLevel( void ) const;
56  virtual unsigned int Index( void ) const;
58  virtual unsigned int TotalFaceCount( void ) const;
60  virtual SubdivisionLevel *Subdivide( bool bProcessUV = true, bool bSmoothPositions = true, bool bSmoothUV = false,
61  bool bPreserveHardEdges = true, bool bCreaseHardEdges = true, bool bEnableCreasing = true, bool bPreserveBorders = false);
63  virtual SubdivisionInfo GetSubdivisionInfo( void ) const;
65  virtual void ApplyChanges( bool bToLowerLevel = true );
68  virtual void RecreateUVs( bool bForced = false );
71  virtual bool ConvertSurfacePoint( SurfacePoint &p, bool bUniform = false ) const;
75  virtual unsigned int NextLevelQuadCount( void ) const;
77  virtual Vector LocalPolygonPointPosition( const SurfacePoint &p ) const;
78 
80  virtual void InitEdgeSharpness();
82  virtual bool HasEdgeSharpness() const;
84  virtual void SetEdgeSharpness(unsigned int iFaceIndex, unsigned int iSideIndex, float fEdgeWeight);
86  virtual float EdgeSharpness(unsigned int iFaceIndex, unsigned int iSideIndex) const ;
89  virtual unsigned int VertexCreaseType(unsigned int iVertexIndex);
91  inline unsigned int QuadVertexCreaseType(unsigned int iFaceIndex, unsigned int iCornerIndex) { return VertexCreaseType(QuadIndex(iFaceIndex, iCornerIndex)); }
93  inline unsigned int TriangleVertexCreaseType(unsigned int iFaceIndex, unsigned int iCornerIndex) { return VertexCreaseType(TriangleIndex(iFaceIndex, iCornerIndex)); }
94 
96  virtual void InitEdgeSoftness();
98  virtual bool HasEdgeSoftness() const;
100  virtual void SetEdgeSoftness(unsigned int iFaceIndex, unsigned int iSideIndex, unsigned int iSoftness);
102  virtual unsigned int EdgeSoftness(unsigned int iFaceIndex, unsigned int iSideIndex) const;
104  virtual unsigned int VertexHardness(unsigned int iVertexIndex) ;
106  inline unsigned int QuadVertexHardness(unsigned int iFaceIndex, unsigned int iCornerIndex) { return VertexHardness(QuadIndex(iFaceIndex, iCornerIndex)); }
108  inline unsigned int TriangleVertexHardness(unsigned int iFaceIndex, unsigned int iCornerIndex) { return VertexHardness(TriangleIndex(iFaceIndex, iCornerIndex)); }
109 
110  virtual void CheckValidity( DiagnosticLevel iLevel = dgnLevel2 ) const;
111 
112  virtual void SetUseCustomIndices( bool b );
113 
117  static void ConvertFaceIndices( const SubdivisionLevel* pFrom,
118  const Store<unsigned int>& aFromFaces,
119  const SubdivisionLevel* pTo,
120  Store<unsigned int>& aToFaces
121  );
122 
123  static void SetUVCreation( bool bCreateUV );
124  static const Store<unsigned int> &QuadIndexTable( unsigned int iLevel );
125  static const Store<unsigned int> &QuadVertexIndexTable( unsigned int iLevel );
126  static const Store<unsigned int> &InvertedQuadIndexTable( unsigned int iLevel );
127  virtual void CheckMeshGrid( unsigned int iBaseFaceIndex, unsigned int iLevel ) const;
128  virtual void ConvertToRelative();
129  virtual void ConvertToAbsolute();
130 };
131 
132 }; // end of namespace mudbox
Represents a 3D vector or point with S23E8 floating point elements.
Definition: math.h:35
A Mesh is a collection of vertices organized into faces, and optional Texture Coordinate information...
Definition: mesh.h:452
Describes a location somewhere on the surface of a Mesh.
Definition: mesh.h:340
GLubyte GLubyte b
Definition: GLee.h:5404
unsigned int QuadVertexCreaseType(unsigned int iFaceIndex, unsigned int iCornerIndex)
Returns the vertex crease type of the specified face corner of a quad.
Definition: subdivision.h:91
GLfloat GLfloat p
Definition: GLee.h:5416
Class: ConvolutionKernel.
Definition: array.h:15
unsigned int TriangleVertexCreaseType(unsigned int iFaceIndex, unsigned int iCornerIndex)
Returns the vertex crease type of the specified face corner of a triangle.
Definition: subdivision.h:93
unsigned int TriangleVertexHardness(unsigned int iFaceIndex, unsigned int iCornerIndex)
Returns the hardness of the specified face corner of a triangle.
Definition: subdivision.h:108
unsigned int QuadVertexHardness(unsigned int iFaceIndex, unsigned int iCornerIndex)
Returns the hardness of the specified face corner of a quad.
Definition: subdivision.h:106
Represents a 3d object in the scene.
Definition: geometry.h:18
Represents one level of subdivision details in a geometry.
Definition: subdivision.h:40
#define DECLARE_CLASS
This macro should be used in declaration of classes which are inherited from the Node class (or any d...
Definition: node.h:91
#define MBDLL_DECL
Definition: dllinterface.h:35
SubdivisionInfo(bool bRemoveLevel, bool bRemoveOctree, bool bCreateUV, bool bSmoothPositions, int iBoundaryRule, bool bPreserveBorders, bool bPreserveHardNormals, bool bCreaseHardEdges, bool bEnableCreasing)
Definition: subdivision.h:19