3ds Max C++ API Reference
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
 

Namespaces

 MaxGraphics
 

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
 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_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

◆ PATCH_UNDEFINED

#define PATCH_UNDEFINED   -1

◆ NEWPATCH

#define NEWPATCH

◆ PVEC_INTERIOR

#define PVEC_INTERIOR   (1<<0)

◆ PVEC_INTERIOR_MASK

#define PVEC_INTERIOR_MASK   0xfffffffe

◆ NUM_PATCH_VEC_FLAGS

#define NUM_PATCH_VEC_FLAGS   1

◆ PVERT_COPLANAR

#define PVERT_COPLANAR   (1<<0)

◆ PVERT_CORNER

#define PVERT_CORNER   (0)

◆ PVERT_TYPE_MASK

#define PVERT_TYPE_MASK   0xfffffffe

◆ PVERT_HIDDEN

#define PVERT_HIDDEN   (1<<1)

◆ PVERT_HIDDEN_MASK

#define PVERT_HIDDEN_MASK   0xfffffffd

◆ PVERT_RESET

#define PVERT_RESET   (1<<2)

◆ NUM_PATCH_VERT_FLAGS

#define NUM_PATCH_VERT_FLAGS   2

◆ PATCH_AUTO

#define PATCH_AUTO   (1<<0)

◆ PATCH_MANUAL

#define PATCH_MANUAL   (0)

◆ PATCH_INTERIOR_MASK

#define PATCH_INTERIOR_MASK   0xfffffffe

◆ PATCH_HIDDEN

#define PATCH_HIDDEN   (1<<1)

◆ PATCH_LINEARMAPPING

#define PATCH_LINEARMAPPING   (1<<2)

◆ PATCH_USE_CURVED_MAPPING_ON_VERTEX_COLOR

#define PATCH_USE_CURVED_MAPPING_ON_VERTEX_COLOR   (1<<3)

◆ PATCH_MATID_SHIFT

#define PATCH_MATID_SHIFT   16

◆ PATCH_MATID_MASK

#define PATCH_MATID_MASK   0xFFFF

◆ NUM_PATCH_PATCH_FLAGS

#define NUM_PATCH_PATCH_FLAGS   5

◆ PATCH_HIT_PATCH

#define PATCH_HIT_PATCH   0

◆ PATCH_HIT_EDGE

#define PATCH_HIT_EDGE   1

◆ PATCH_HIT_VERTEX

#define PATCH_HIT_VERTEX   2

◆ PATCH_HIT_VECTOR

#define PATCH_HIT_VECTOR   3

◆ PATCH_HIT_INTERIOR

#define PATCH_HIT_INTERIOR   4

◆ SUBHIT_PATCH_SELONLY

#define SUBHIT_PATCH_SELONLY   (1<<0)

◆ SUBHIT_PATCH_UNSELONLY

#define SUBHIT_PATCH_UNSELONLY   (1<<2)

◆ SUBHIT_PATCH_ABORTONHIT

#define SUBHIT_PATCH_ABORTONHIT   (1<<3)

◆ SUBHIT_PATCH_SELSOLID

#define SUBHIT_PATCH_SELSOLID   (1<<4)

◆ SUBHIT_PATCH_VERTS

#define SUBHIT_PATCH_VERTS   (1<<24)

◆ SUBHIT_PATCH_VECS

#define SUBHIT_PATCH_VECS   (1<<25)

◆ SUBHIT_PATCH_PATCHES

#define SUBHIT_PATCH_PATCHES   (1<<26)

◆ SUBHIT_PATCH_EDGES

#define SUBHIT_PATCH_EDGES   (1<<27)

◆ SUBHIT_PATCH_TYPEMASK

◆ SUBHIT_PATCH_IGNORE_BACKFACING

#define SUBHIT_PATCH_IGNORE_BACKFACING   (1<<28)

◆ PATCH_OBJECT

#define PATCH_OBJECT   (1<<0)

◆ PATCH_VERTEX

#define PATCH_VERTEX   (1<<1)

◆ PATCH_PATCH

#define PATCH_PATCH   (1<<2)

◆ PATCH_EDGE

#define PATCH_EDGE   (1<<3)

◆ PATCH_HANDLE

#define PATCH_HANDLE   (1<<4)

◆ SUBDIV_EDGES

#define SUBDIV_EDGES   0

◆ SUBDIV_PATCHES

#define SUBDIV_PATCHES   1

◆ DEF_PM_RELAX

#define DEF_PM_RELAX   FALSE

◆ DEF_PM_RELAX_VIEWPORTS

#define DEF_PM_RELAX_VIEWPORTS   TRUE

◆ DEF_PM_RELAX_VALUE

#define DEF_PM_RELAX_VALUE   0.0f

◆ DEF_PM_ITER

#define DEF_PM_ITER   1

◆ DEF_PM_BOUNDARY

#define DEF_PM_BOUNDARY   TRUE

◆ DEF_PM_SADDLE

#define DEF_PM_SADDLE   FALSE

◆ PM_HITTEST_REQUIRE_ALL

#define PM_HITTEST_REQUIRE_ALL   (1<<0)

◆ CONVERT_KEEPSEL

#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.

◆ CONVERT_USESOFTSEL

#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.

◆ CONVERT_SEL_LEVEL

#define CONVERT_SEL_LEVEL   0x0004

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

◆ CONVERT_PATCH_USEQUADS

#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.

◆ CONVERT_NO_RELAX

#define CONVERT_NO_RELAX   0x0020

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

Function Documentation

◆ setPatchIntrFunc()

CoreExport void setPatchIntrFunc ( INTRFUNC  fn)

◆ ConvertMeshToPatch()

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

Converts a mesh to a patch mesh.

◆ ConvertPatchToMesh()

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

Converts a patch mesh to a mesh.

◆ ConvertPatchToMeshWithMapping()

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

◆ RelaxMesh()

CoreExport void RelaxMesh ( Mesh mesh,
float  value,
int  iter,
BOOL  boundary,
BOOL  saddle 
)

Variable Documentation

◆ PatchVecFlagMasks

const DWORD PatchVecFlagMasks[] = {1}

◆ PatchVecFlagShifts

const int PatchVecFlagShifts[] = {0}

◆ PatchVertFlagMasks

const DWORD PatchVertFlagMasks[] = {1, 1}

◆ PatchVertFlagShifts

const int PatchVertFlagShifts[] = {0, 1}

◆ PatchPatchFlagMasks

const DWORD PatchPatchFlagMasks[] = {1, 1, 1, 1, 0xffff}

◆ PatchPatchFlagShifts

const int PatchPatchFlagShifts[] = {0, 1, 2, 3, 16}