patch.h File Reference

#include "maxheap.h"
#include "coreexp.h"
#include "meshlib.h"
#include "hitdata.h"
#include "maxtess.h"
#include "PatchTypeConstants.h"
#include "containers/Array.h"

Classes

class  HookPoint
 
class  ExtrudeData
 
class  PRVertex
 
class  PatchVec
 
class  PatchVert
 
class  PatchTVert
 
class  PatchEdge
 
class  Patch
 
class  TVPatch
 
class  PatchSubHitRec
 
struct  PatchSubHitRec::Iterator
 
class  SubPatchHitList
 
class  PatchHitData
 
class  PatchMesh
 

Macros

#define PATCH_UNDEFINED   -1
 
#define NEWPATCH
 
#define PVEC_INTERIOR   (1<<0)
 
#define PVEC_INTERIOR_MASK   0xfffffffe
 
#define NUM_PATCH_VEC_FLAGS   1
 
#define PVERT_COPLANAR   (1<<0)
 
#define PVERT_CORNER   (0)
 
#define PVERT_TYPE_MASK   0xfffffffe
 
#define PVERT_HIDDEN   (1<<1)
 
#define PVERT_HIDDEN_MASK   0xfffffffd
 
#define PVERT_RESET   (1<<2)
 
#define NUM_PATCH_VERT_FLAGS   2
 
#define PATCH_AUTO   (1<<0)
 
#define PATCH_MANUAL   (0)
 
#define PATCH_INTERIOR_MASK   0xfffffffe
 
#define PATCH_HIDDEN   (1<<1)
 
#define PATCH_LINEARMAPPING   (1<<2)
 
#define PATCH_USE_CURVED_MAPPING_ON_VERTEX_COLOR   (1<<3)
 
#define PATCH_MATID_SHIFT   16
 
#define PATCH_MATID_MASK   0xFFFF
 
#define NUM_PATCH_PATCH_FLAGS   5
 
#define PATCH_HIT_PATCH   0
 
#define PATCH_HIT_EDGE   1
 
#define PATCH_HIT_VERTEX   2
 
#define PATCH_HIT_VECTOR   3
 
#define PATCH_HIT_INTERIOR   4
 
#define SUBHIT_PATCH_SELONLY   (1<<0)
 
#define SUBHIT_PATCH_UNSELONLY   (1<<2)
 
#define SUBHIT_PATCH_ABORTONHIT   (1<<3)
 
#define SUBHIT_PATCH_SELSOLID   (1<<4)
 
#define SUBHIT_PATCH_VERTS   (1<<24)
 
#define SUBHIT_PATCH_VECS   (1<<25)
 
#define SUBHIT_PATCH_PATCHES   (1<<26)
 
#define SUBHIT_PATCH_EDGES   (1<<27)
 
#define SUBHIT_PATCH_TYPEMASK   (SUBHIT_PATCH_VERTS|SUBHIT_PATCH_VECS|SUBHIT_PATCH_EDGES|SUBHIT_PATCH_PATCHES)
 
#define SUBHIT_PATCH_IGNORE_BACKFACING   (1<<28)
 
#define PATCH_OBJECT   (1<<0)
 
#define PATCH_VERTEX   (1<<1)
 
#define PATCH_PATCH   (1<<2)
 
#define PATCH_EDGE   (1<<3)
 
#define PATCH_HANDLE   (1<<4)
 
#define SUBDIV_EDGES   0
 
#define SUBDIV_PATCHES   1
 
#define DEF_PM_RELAX   FALSE
 
#define DEF_PM_RELAX_VIEWPORTS   TRUE
 
#define DEF_PM_RELAX_VALUE   0.0f
 
#define DEF_PM_ITER   1
 
#define DEF_PM_BOUNDARY   TRUE
 
#define DEF_PM_SADDLE   FALSE
 
#define PM_HITTEST_REQUIRE_ALL   (1<<0)
 
Conversion flags

These are used in conversion methods in core\converters.cpp and in poly\converters.cpp.

#define CONVERT_KEEPSEL   0x0001
 Translate subobject selections, so selected vertices, edges, or surface areas (faces or patches) in the input model is still selected in the output. More...
 
#define CONVERT_USESOFTSEL   0x0002
 Translate soft selections. More...
 
#define CONVERT_SEL_LEVEL   0x0004
 
#define CONVERT_PATCH_USEQUADS   0x0010
 When converting to a Patch model, create quad patches for any quads in the input mesh or poly mesh. More...
 
#define CONVERT_NO_RELAX   0x0020
 Indicates in patch-to-mesh conversions that the Relax parameters in the patch must be ignored. More...
 

Functions

CoreExport void setPatchIntrFunc (INTRFUNC fn)
 
CoreExport void ConvertMeshToPatch (Mesh &m, PatchMesh &pm, DWORD flags=0)
 Converts a mesh to a patch mesh. More...
 
CoreExport void ConvertPatchToMesh (PatchMesh &pm, Mesh &m, DWORD flags=0)
 Converts a patch mesh to a mesh. More...
 
CoreExport void ConvertPatchToMeshWithMapping (PatchMesh &pm, Mesh &m, Tab< int > *mapping, DWORD flags=0)
 This method converts a Patch to Trimesh, similarly to the method ConvertPatchToMesh(). More...
 
CoreExport void RelaxMesh (Mesh &mesh, float value, int iter, BOOL boundary, BOOL saddle)
 

Variables

const DWORD PatchVecFlagMasks [] = {1}
 
const int PatchVecFlagShifts [] = {0}
 
const DWORD PatchVertFlagMasks [] = {1, 1}
 
const int PatchVertFlagShifts [] = {0, 1}
 
const DWORD PatchPatchFlagMasks [] = {1, 1, 1, 1, 0xffff}
 
const int PatchPatchFlagShifts [] = {0, 1, 2, 3, 16}
 

Macro Definition Documentation

#define PATCH_UNDEFINED   -1
#define NEWPATCH
#define PVEC_INTERIOR   (1<<0)
#define PVEC_INTERIOR_MASK   0xfffffffe
#define NUM_PATCH_VEC_FLAGS   1
#define PVERT_COPLANAR   (1<<0)
#define PVERT_CORNER   (0)
#define PVERT_TYPE_MASK   0xfffffffe
#define PVERT_HIDDEN   (1<<1)
#define PVERT_HIDDEN_MASK   0xfffffffd
#define PVERT_RESET   (1<<2)
#define NUM_PATCH_VERT_FLAGS   2
#define PATCH_AUTO   (1<<0)
#define PATCH_MANUAL   (0)
#define PATCH_INTERIOR_MASK   0xfffffffe
#define PATCH_HIDDEN   (1<<1)
#define PATCH_LINEARMAPPING   (1<<2)
#define PATCH_USE_CURVED_MAPPING_ON_VERTEX_COLOR   (1<<3)
#define PATCH_MATID_SHIFT   16
#define PATCH_MATID_MASK   0xFFFF
#define NUM_PATCH_PATCH_FLAGS   5
#define PATCH_HIT_PATCH   0
#define PATCH_HIT_EDGE   1
#define PATCH_HIT_VERTEX   2
#define PATCH_HIT_VECTOR   3
#define PATCH_HIT_INTERIOR   4
#define SUBHIT_PATCH_SELONLY   (1<<0)
#define SUBHIT_PATCH_UNSELONLY   (1<<2)
#define SUBHIT_PATCH_ABORTONHIT   (1<<3)
#define SUBHIT_PATCH_SELSOLID   (1<<4)
#define SUBHIT_PATCH_VERTS   (1<<24)
#define SUBHIT_PATCH_VECS   (1<<25)
#define SUBHIT_PATCH_PATCHES   (1<<26)
#define SUBHIT_PATCH_EDGES   (1<<27)
#define SUBHIT_PATCH_IGNORE_BACKFACING   (1<<28)
#define PATCH_OBJECT   (1<<0)
#define PATCH_VERTEX   (1<<1)
#define PATCH_PATCH   (1<<2)
#define PATCH_EDGE   (1<<3)
#define PATCH_HANDLE   (1<<4)
#define SUBDIV_EDGES   0
#define SUBDIV_PATCHES   1
#define DEF_PM_RELAX   FALSE
#define DEF_PM_RELAX_VIEWPORTS   TRUE
#define DEF_PM_RELAX_VALUE   0.0f
#define DEF_PM_ITER   1
#define DEF_PM_BOUNDARY   TRUE
#define DEF_PM_SADDLE   FALSE
#define PM_HITTEST_REQUIRE_ALL   (1<<0)
#define CONVERT_KEEPSEL   0x0001

Translate subobject selections, so selected vertices, edges, or surface areas (faces or patches) in the input model is still selected in the output.

#define CONVERT_USESOFTSEL   0x0002

Translate soft selections.

Also, in the case of patches turning into meshes with more vertices, soft selections are used to interpolate between selected patch corners and non-selected ones.

#define CONVERT_SEL_LEVEL   0x0004
#define CONVERT_PATCH_USEQUADS   0x0010

When converting to a Patch model, create quad patches for any quads in the input mesh or poly mesh.

Otherwise, turns everything into triangle patches.

#define CONVERT_NO_RELAX   0x0020

Indicates in patch-to-mesh conversions that the Relax parameters in the patch must be ignored.

Function Documentation

CoreExport void setPatchIntrFunc ( INTRFUNC  fn)
CoreExport void ConvertMeshToPatch ( Mesh m,
PatchMesh pm,
DWORD  flags = 0 
)

Converts a mesh to a patch mesh.

CoreExport void ConvertPatchToMesh ( PatchMesh pm,
Mesh m,
DWORD  flags = 0 
)

Converts a patch mesh to a mesh.

CoreExport void ConvertPatchToMeshWithMapping ( PatchMesh pm,
Mesh m,
Tab< int > *  mapping,
DWORD  flags = 0 
)

This method converts a Patch to Trimesh, similarly to the method ConvertPatchToMesh().

However, the new method also stores the mapping from the Mesh's faces to the PatchMesh's patches in the 'mapping' parameter.

Parameters
[in]pm- The patch to convert
[in]m- The mesh object we set our converted TriMesh onto.
[out]mapping- After conversion, this array will be filled a mapping from the Mesh's faces to the PatchMeshs faces.
[in]flags- One of the ConversionFlags
CoreExport void RelaxMesh ( Mesh mesh,
float  value,
int  iter,
BOOL  boundary,
BOOL  saddle 
)

Variable Documentation

const DWORD PatchVecFlagMasks[] = {1}
const int PatchVecFlagShifts[] = {0}
const DWORD PatchVertFlagMasks[] = {1, 1}
const int PatchVertFlagShifts[] = {0, 1}
const DWORD PatchPatchFlagMasks[] = {1, 1, 1, 1, 0xffff}
const int PatchPatchFlagShifts[] = {0, 1, 2, 3, 16}