SubdivisionLevel Class Reference

This reference page is linked to from the following overview topics: Mudbox 2013, Scene Graph, Mesh and Topology, Subdivision.



Detailed Description

Represents one level of subdivision details in a geometry.

Examples:

MeshBuilder/MeshBuilder.cpp, and PtexExtractor/PtexLayout.h.

Definition at line 18 of file subdivision.h.

#include <subdivision.h>

Inheritance diagram for SubdivisionLevel:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual class Geometry Geometry (void) const
  Returns the geometry that this mesh belongs to.
virtual SubdivisionLevel NextLevel (void)
  Returns the next (one detail higher) level.
virtual SubdivisionLevel PrevLevel (void) const
  Returns the previous (one detail lower) level.
virtual unsigned int  Index (void) const
  Returns the index in the level list of the geometry.
virtual unsigned int  TotalFaceCount (void) const
  Returns the maximum reachable face count on the level. Equals to the total face count of the previous level * 4.
virtual SubdivisionLevel Subdivide (bool bProcessUV=true, bool bSmoothPositions=true, bool bSmoothUV=false, bool bPreserveHardEdges=true, bool bCreaseHardEdges=true, bool bEnableCreasing=true)
  Subdivides the level to a higher detail.
virtual void  ApplyChanges (bool bToLowerLevel=true)
  Updates the higher/lower level with all the changes on the current level.
virtual void  RecreateUVs (bool bForced=false)
  Creates the UV layout if not exists or recreates if forced.
virtual bool  ConvertSurfacePoint (SurfacePoint &p) const
  Returns ture if succeed in converting a surface point from another subdivision level to this level.
virtual unsigned int  NextLevelQuadCount (void) const
  This function returns the number of quads on the next subdivision level.
virtual void  InitEdgeSharpness ()
  Cleans all the edges crease weight.
virtual bool  HasEdgeSharpness () const
  Returns ture if this level has edge sharpness (creasing) information.
virtual void  SetEdgeSharpness (unsigned int iFaceIndex, unsigned int iSideIndex, float fEdgeWeight)
  Sets the crease weight of a specific edge.
virtual float  EdgeSharpness (unsigned int iFaceIndex, unsigned int iSideIndex) const
  Returns the crease weight of a specific edge.
virtual unsigned int  VertexCreaseType (unsigned int iVertexIndex)
  Returns the vertex crease type, it is also the number of crease edges shared this vertex.
unsigned int  QuadVertexCreaseType (unsigned int iFaceIndex, unsigned int iCornerIndex)
  Returns the vertex crease type of the specified face corner of a quad.
unsigned int  TriangleVertexCreaseType (unsigned int iFaceIndex, unsigned int iCornerIndex)
  Returns the vertex crease type of the specified face corner of a triangle.
virtual void  InitEdgeSoftness ()
  Initailize all edges to be soft edges.
virtual bool  HasEdgeSoftness () const
  Returns ture if this level has information about soft/hard edge, smoothing group.
virtual void  SetEdgeSoftness (unsigned int iFaceIndex, unsigned int iSideIndex, unsigned int iSoftness)
  Soften or Harden the specific edge. iSoftness = 0: hard edge; iSoftness = 1: soft edge.
virtual unsigned int  EdgeSoftness (unsigned int iFaceIndex, unsigned int iSideIndex) const
  Returns the softness of the specific edge.
virtual unsigned int  VertexHardness (unsigned int iVertexIndex)
  Returns the number of harded edges shared this vertex.
unsigned int  QuadVertexHardness (unsigned int iFaceIndex, unsigned int iCornerIndex)
  Returns the hardness of the specified face corner of a quad.
unsigned int  TriangleVertexHardness (unsigned int iFaceIndex, unsigned int iCornerIndex)
  Returns the hardness of the specified face corner of a triangle.
virtual void  CheckValidity (DiagnosticLevel iLevel=dgnLevel2) const
  See the documentation for Node::CheckValidity.
virtual void  CheckMeshGrid (unsigned int iBaseFaceIndex, unsigned int iLevel) const
virtual void  ConvertToRelative ()
virtual void  ConvertToAbsolute ()

Static Public Member Functions

static void  ConvertFaceIndices (const SubdivisionLevel *pFrom, const Store< unsigned int > &aFromFaces, const SubdivisionLevel *pTo, Store< unsigned int > &aToFaces)
  Converts a set of faces from one subdivision level to another subdivision level.
static void  SetUVCreation (bool bCreateUV)
static const Store< unsigned
int > & 
QuadIndexTable (unsigned int iLevel)
static const Store< unsigned
int > & 
QuadVertexIndexTable (unsigned int iLevel)
static const Store< unsigned
int > & 
InvertedQuadIndexTable (unsigned int iLevel)

Protected Member Functions

  SubdivisionLevel (FaceType eFaceType=typeQuadric)
  Do not use constructors directly. Use CreateInstances() instead.

Constructor & Destructor Documentation

SubdivisionLevel ( FaceType  eFaceType = typeQuadric ) [protected]

Do not use constructors directly. Use CreateInstances() instead.


Member Function Documentation

virtual class Geometry* Geometry ( void  ) const [virtual]

Returns the geometry that this mesh belongs to.

Reimplemented from Mesh.

virtual SubdivisionLevel* NextLevel ( void  ) [virtual]

Returns the next (one detail higher) level.

virtual SubdivisionLevel* PrevLevel ( void  ) const [virtual]

Returns the previous (one detail lower) level.

virtual unsigned int Index ( void  ) const [virtual]

Returns the index in the level list of the geometry.

virtual unsigned int TotalFaceCount ( void  ) const [virtual]

Returns the maximum reachable face count on the level. Equals to the total face count of the previous level * 4.

virtual SubdivisionLevel* Subdivide ( bool  bProcessUV = true,
bool  bSmoothPositions = true,
bool  bSmoothUV = false,
bool  bPreserveHardEdges = true,
bool  bCreaseHardEdges = true,
bool  bEnableCreasing = true 
) [virtual]

Subdivides the level to a higher detail.

Examples:
MeshBuilder/MeshBuilder.cpp.
virtual void ApplyChanges ( bool  bToLowerLevel = true ) [virtual]

Updates the higher/lower level with all the changes on the current level.

virtual void RecreateUVs ( bool  bForced = false ) [virtual]

Creates the UV layout if not exists or recreates if forced.

The calculation is based on the uv layout of the previous level; if it does not exist it will be created recursively down to level0. If level 0 has no UV the funcion does nothing.

virtual bool ConvertSurfacePoint ( SurfacePoint p ) const [virtual]

Returns ture if succeed in converting a surface point from another subdivision level to this level.

If true is returned, the surface point p is at the same level as this subdivision level.

virtual unsigned int NextLevelQuadCount ( void  ) const [virtual]

This function returns the number of quads on the next subdivision level.

This function can be called even if there is no next level created yet. For full quad meshes, this number is 4 times the number of quads on the current level. This function is thread safe.

virtual void InitEdgeSharpness ( ) [virtual]

Cleans all the edges crease weight.

virtual bool HasEdgeSharpness ( ) const [virtual]

Returns ture if this level has edge sharpness (creasing) information.

virtual void SetEdgeSharpness ( unsigned int  iFaceIndex,
unsigned int  iSideIndex,
float  fEdgeWeight 
) [virtual]

Sets the crease weight of a specific edge.

virtual float EdgeSharpness ( unsigned int  iFaceIndex,
unsigned int  iSideIndex 
) const [virtual]

Returns the crease weight of a specific edge.

virtual unsigned int VertexCreaseType ( unsigned int  iVertexIndex ) [virtual]

Returns the vertex crease type, it is also the number of crease edges shared this vertex.

0: smooth vertex; 1: dart vertex; 2: crease vertex; >= 3: corner vertex.

unsigned int QuadVertexCreaseType ( unsigned int  iFaceIndex,
unsigned int  iCornerIndex 
) [inline]

Returns the vertex crease type of the specified face corner of a quad.

Definition at line 65 of file subdivision.h.

{ return VertexCreaseType(QuadIndex(iFaceIndex, iCornerIndex)); }
unsigned int TriangleVertexCreaseType ( unsigned int  iFaceIndex,
unsigned int  iCornerIndex 
) [inline]

Returns the vertex crease type of the specified face corner of a triangle.

Definition at line 67 of file subdivision.h.

{ return VertexCreaseType(TriangleIndex(iFaceIndex, iCornerIndex)); }
virtual void InitEdgeSoftness ( ) [virtual]

Initailize all edges to be soft edges.

virtual bool HasEdgeSoftness ( ) const [virtual]

Returns ture if this level has information about soft/hard edge, smoothing group.

virtual void SetEdgeSoftness ( unsigned int  iFaceIndex,
unsigned int  iSideIndex,
unsigned int  iSoftness 
) [virtual]

Soften or Harden the specific edge. iSoftness = 0: hard edge; iSoftness = 1: soft edge.

virtual unsigned int EdgeSoftness ( unsigned int  iFaceIndex,
unsigned int  iSideIndex 
) const [virtual]

Returns the softness of the specific edge.

virtual unsigned int VertexHardness ( unsigned int  iVertexIndex ) [virtual]

Returns the number of harded edges shared this vertex.

unsigned int QuadVertexHardness ( unsigned int  iFaceIndex,
unsigned int  iCornerIndex 
) [inline]

Returns the hardness of the specified face corner of a quad.

Definition at line 80 of file subdivision.h.

{ return VertexHardness(QuadIndex(iFaceIndex, iCornerIndex)); }
unsigned int TriangleVertexHardness ( unsigned int  iFaceIndex,
unsigned int  iCornerIndex 
) [inline]

Returns the hardness of the specified face corner of a triangle.

Definition at line 82 of file subdivision.h.

{ return VertexHardness(TriangleIndex(iFaceIndex, iCornerIndex)); }
virtual void CheckValidity ( DiagnosticLevel  iLevel = dgnLevel2 ) const [virtual]

See the documentation for Node::CheckValidity.

Reimplemented from Mesh.

static void ConvertFaceIndices ( const SubdivisionLevel pFrom,
const Store< unsigned int > &  aFromFaces,
const SubdivisionLevel pTo,
Store< unsigned int > &  aToFaces 
) [static]

Converts a set of faces from one subdivision level to another subdivision level.

This is useful when you have a set of faces on level n and need to find the corresponding faces on level m for any values of n and m.

Parameters:
[in] pFrom The source subdivision level to convert the face set from
[in] aFromFaces The set of faces to convert
[in] pTo The target subdivision level to convert the face set to
[in] aToFaces The converted faces will be stored in this array
static void SetUVCreation ( bool  bCreateUV ) [static]
static const Store<unsigned int>& QuadIndexTable ( unsigned int  iLevel ) [static]
static const Store<unsigned int>& QuadVertexIndexTable ( unsigned int  iLevel ) [static]
static const Store<unsigned int>& InvertedQuadIndexTable ( unsigned int  iLevel ) [static]
virtual void CheckMeshGrid ( unsigned int  iBaseFaceIndex,
unsigned int  iLevel 
) const [virtual]
virtual void ConvertToRelative ( ) [virtual]
virtual void ConvertToAbsolute ( ) [virtual]

The documentation for this class was generated from the following file:

SubdivisionLevel SubdivisionLevel SubdivisionLevel SubdivisionLevel SubdivisionLevel SubdivisionLevel SubdivisionLevel SubdivisionLevel SubdivisionLevel SubdivisionLevel
SubdivisionLevel SubdivisionLevel SubdivisionLevel SubdivisionLevel SubdivisionLevel SubdivisionLevel SubdivisionLevel SubdivisionLevel SubdivisionLevel SubdivisionLevel