Classes | Namespaces | Defines | Typedefs | Functions

mesh.h File Reference

This reference page is linked to from the following overview topics: Mapping Channels, Getting and Setting User Preferences.


#include "maxheap.h"
#include "channels.h"
#include "snap.h"
#include "ioapi.h"
#include "export.h"
#include "vedge.h"
#include "utillib.h"
#include "tab.h"
#include "baseinterface.h"
#include "MeshFaceFlagConstants.h"
#include "GraphicsConstants.h"
#include "assert.h"
#include "bitarray.h"
#include "TabTypes.h"
#include "Strip.h"
#include "box3.h"
#include "point3.h"
#include "UVWMapper.h"
#include "UVWMapTypes.h"

Go to the source code of this file.

Classes

class   RNormal
class   RVertex
class   Face
  This class represents a single triangular face. More...
class   TVFace
  This class is used for texture faces as well as vertex colors. More...
class   MeshMap
  In 3ds Max 3.0 and later the user may work with more than 2 mapping channels. More...
class   MapBitArray
  This class can be used to store a bit per map channel, including both negative and positive map channels, and it works with any size index. More...
class   PerData
  This class is used for per -'something' floating-point information. More...
class   StripData
class   MeshSubHitRec
  This class allows access to the sub-object hit records used in Mesh hit testing. More...
class   SubObjHitList
  This class describes a list of sub-object hit records. More...
class   MeshRenderData
  A developer may derive a class from this class, put any required data in it, and then hang this data off a Mesh. More...
class   Mesh
  The Mesh class is provided for use by plug-ins and is used by the system. More...
class   VertexNormalsCallback
class   VertexNormalsControl
class   MeshOpProgress
  A callback used while doing a lengthy operation to a mesh. More...

Namespaces

namespace   MaxGraphics

Defines

#define  MESH_USE_EXT_CVARRAY   (-32767)
  An argument for the mapChan parameter in Mesh::setVCDisplayData().
#define  MESH_MULTI_PROCESSING   TRUE
  TRUE turns on mp vertex transformation.
#define  MESH_CAGE_BACKFACE_CULLING
  for "cage" orange gizmo meshes in EMesh, EPoly, Mesh Select, etc.
#define  NEWMESH
#define  MAX_MESHMAPS   100
  The higher limit of the mapping channels (map channel can be from 0 to MAX_MESHMAPS - 1)
#define  MESHMAP_USED   0x0001
  Indicates this mapping channel is actually used (carries mapping information).
#define  MESHMAP_TEXTURE   0x0002
  Indicates this is a texture mapping channel.
#define  MESHMAP_VERTCOLOR   0x0004
  Indicates this is a vertex color channel.
#define  MESHMAP_USER   0x0100
  Indicates the channel is used for a developer purpose.
#define  NUM_HIDDENMAPS   2
  The number of "Hidden" or negative-indexed maps in objects which support hidden maps.
#define  MAP_SHADING   -1
  The shading (or illumination) map.
#define  MAP_ALPHA   -2
  The Alpha channel map.
#define  MAX_VERTDATA   100
  The maximum channel index for developers' defined data.
#define  VDATA_USER   10
  Third parties should use this channel or higher.
#define  VDATA_SELECT   0
  The vertex soft selection data.
#define  VDATA_WEIGHT   1
  The vertex weight data.
#define  VDATA_ALPHA   2
  Vertex Alpha values.
#define  VDATA_CORNER   3
  Cornering values for subdivision use.
#define  MAX_WEIGHT   ((float)1e5)
#define  MIN_WEIGHT   ((float)1e-5)
#define  PERDATA_TYPE_FLOAT   0
  The floating point data type.
#define  MESH_EDGE_LIST   (1<<1)
#define  MESH_LOCK_RENDDATA   (1<<2)
  Setting this flag prevents render data from being deleted (except when the mesh is deleted).
#define  MESH_SMOOTH_BIT1   (1<<3)
#define  MESH_SMOOTH_BIT2   (1<<4)
#define  MESH_SMOOTH_BIT3   (1<<5)
#define  MESH_SMOOTH_BIT4   (1<<6)
#define  MESH_SMOOTH_MASK   0x78
  Flag mask for SMOOTH_BIT's 1 thru 4.
#define  MESH_BEEN_DSP   (1<<9)
#define  MESH_SMOOTH_SUBSEL   (1<<10)
  Having this bit set to 1 indicates that the smooth faces with selection-color outlines should be displayed.
#define  MESH_FACENORMALSINVALID   (1<<11)
  Mesh flag that Signals that face normals should be rebuilt.
#define  MESH_CACHEINVALID   (1<<12)
  Mesh, vertices and Face flag Signals that the they have changed and RVertices normals should be rebuilt.
#define  MESH_BACKFACESCOMPUTED   (1<<16)
  Mesh flag to determine whether the back facing attribute on the face list has been computed or not.
#define  MESH_PARTIALCACHEINVALID   (1<<17)
  Mesh flag that means that the mesh has only set some of the vertices as invalid and not to reprocess the entire mesh just the vertices that changed.
#define  MESH_TEMP_1   (1<<13)
#define  MESH_TEMP_2   (1<<14)
#define  MESH_DONTTRISTRIP   (1<<15)
#define  SUBHIT_SELONLY   (1<<0)
  Selected only.
#define  SUBHIT_UNSELONLY   (1<<2)
  Unselected only.
#define  SUBHIT_ABORTONHIT   (1<<3)
  Abort hit testing on the first hit found.
#define  SUBHIT_SELSOLID   (1<<4)
  This treats selected items as solid and unselected items as not solid.
#define  SUBHIT_USEFACESEL   (1<<23)
  When this bit is set, the sel only and unsel only tests will use the faces selection when doing a vertex level hit test.
#define  SUBHIT_VERTS   (1<<24)
  Hit test vertices.
#define  SUBHIT_FACES   (1<<25)
  Hit test faces.
#define  SUBHIT_EDGES   (1<<26)
  Hit test edges.
#define  SUBHIT_TYPEMASK   (SUBHIT_VERTS|SUBHIT_FACES|SUBHIT_EDGES)
#define  MESH_OBJECT   (1<<0)
  Object level.
#define  MESH_VERTEX   (1<<1)
  Vertex level.
#define  MESH_FACE   (1<<2)
  Face level.
#define  MESH_EDGE   (1<<3)
  Edge level.
#define  MESH_DISP_NO_NORMALS   0
  Turn off normal display.
#define  MESH_DISP_FACE_NORMALS   (1<<0)
#define  MESH_DISP_VERTEX_NORMALS   (1<<1)
#define  OPTIMIZE_SAVEMATBOUNDRIES   (1<<0)
  Specifies that faces won't be collapsed across a material boundary.
#define  OPTIMIZE_SAVESMOOTHBOUNDRIES   (1<<1)
  Specifies that faces won't be collapsed across a dissimilar smoothing group boundary.
#define  OPTIMIZE_AUTOEDGE   (1<<2)
  Specifies that the edge visibility should be set automatically based on the angle between adjacent surface normals.
#define  SMALL_VERTEX_DOTS   0
#define  LARGE_VERTEX_DOTS   1
#define  VERTEX_DOT2   0
  equivalent to SMALL_VERTEX_DOTS
#define  VERTEX_DOT3   1
  equivalent to LARGE_VERTEX_DOTS
#define  VERTEX_DOT4   2
#define  VERTEX_DOT5   3
#define  VERTEX_DOT6   4
#define  VERTEX_DOT7   5
#define  HANDLE_BOX2   0
#define  HANDLE_BOX3   1
#define  HANDLE_BOX4   2
#define  HANDLE_BOX5   3
#define  HANDLE_BOX6   4
#define  HANDLE_BOX7   5
#define  VERTEX_DOT_MARKER(vtype)   (MarkerType)(vtype - VERTEX_DOT2 + DOT2_MRKR)
#define  HANDLE_BOX_MARKER(htype)   (MarkerType)(htype - HANDLE_BOX2 + BOX2_MRKR)
#define  MESHBOOL_UNION   1
#define  MESHBOOL_INTERSECTION   2
#define  MESHBOOL_DIFFERENCE   3

Typedefs

typedef int(*  INTRFUNC )()

Functions

DllExport DWORD  MapChannelID (int mp)
  Returns the Channel ID of the map channel.
DllExport int  MapChannelNum (int mp)
  Similar to MapChannelID, but this returns the CHAN_NUM version:TEXMAP_CHAN_NUM, VERTCOLOR_CHAN_NUM, etc.
DllExport int  VertexDataType (int vdID)
  Returns the type of data supported, i.e.
DllExport void *  VertexDataDefault (int vdID)
  Returns a pointer to a default floating point value for the specified channel.
DllExport void  setMeshIntrFunc (INTRFUNC fn)
DllExport void  setUseVisEdge (int b)
DllExport int  getUseVisEdge ()
DllExport void  setUseVertexDots (int b)
DllExport int  getUseVertexDots ()
DllExport void  setVertexDotType (int t)
DllExport int  getVertexDotType ()
DllExport void  setHandleBoxType (int t)
DllExport int  getHandleBoxType ()
DllExport void  setDisplayBackFaceVertices (int b)
DllExport int  getDisplayBackFaceVertices ()
DllExport VertexNormalsControl GetVertexNormalsControl ()
DllExport int  CalcBoolOp (Mesh &mesh, Mesh &mesh1, Mesh &mesh2, int op, MeshOpProgress *prog=NULL, Matrix3 *tm1=NULL, Matrix3 *tm2=NULL, int whichInv=0, int weld=TRUE)
  Matrix3 *tm2 = NULL, int whichInv = 0, int weld = TRUE); Note: This method is still in the SDK, but it is now obselete.
DllExport void  CombineMeshes (Mesh &mesh, Mesh &mesh1, Mesh &mesh2, Matrix3 *tm1=NULL, Matrix3 *tm2=NULL, int whichInv=0)
  This function is available in release 2.0 and later only.
DllExport void  SliceMesh (Mesh &mesh, Point3 N, float off, bool split=FALSE, bool remove=FALSE)
  Slices a single mesh.
DllExport Mesh CreateNewMesh ()

Define Documentation

#define MESH_USE_EXT_CVARRAY   (-32767)

An argument for the mapChan parameter in Mesh::setVCDisplayData().

If mapChan parameter is set to MESH_USE_EXT_CVARRAY then the data in VCArray and TVFace is stored for internal use and consequent drawing.

Definition at line 42 of file mesh.h.

#define MESH_MULTI_PROCESSING   TRUE

TRUE turns on mp vertex transformation.

Definition at line 44 of file mesh.h.

#define MESH_CAGE_BACKFACE_CULLING

for "cage" orange gizmo meshes in EMesh, EPoly, Mesh Select, etc.

Definition at line 46 of file mesh.h.

#define NEWMESH

Definition at line 54 of file mesh.h.

#define MAX_MESHMAPS   100

The higher limit of the mapping channels (map channel can be from 0 to MAX_MESHMAPS - 1)

Definition at line 419 of file mesh.h.

#define MAX_VERTDATA   100

The maximum channel index for developers' defined data.

Definition at line 649 of file mesh.h.

#define VDATA_USER   10

Third parties should use this channel or higher.

Definition at line 650 of file mesh.h.

#define MAX_WEIGHT   ((float)1e5)

Definition at line 665 of file mesh.h.

#define MIN_WEIGHT   ((float)1e-5)

Definition at line 666 of file mesh.h.

#define MESH_TEMP_1   (1<<13)

Definition at line 889 of file mesh.h.

#define MESH_TEMP_2   (1<<14)

Definition at line 890 of file mesh.h.

#define MESH_DONTTRISTRIP   (1<<15)

Mesh flag to determine whether to use tristripping or not

Definition at line 891 of file mesh.h.

#define SMALL_VERTEX_DOTS   0

Definition at line 2674 of file mesh.h.

#define LARGE_VERTEX_DOTS   1

Definition at line 2675 of file mesh.h.

#define VERTEX_DOT_MARKER (   vtype )    (MarkerType)(vtype - VERTEX_DOT2 + DOT2_MRKR)

Definition at line 2700 of file mesh.h.

#define HANDLE_BOX_MARKER (   htype )    (MarkerType)(htype - HANDLE_BOX2 + BOX2_MRKR)

Definition at line 2703 of file mesh.h.


Typedef Documentation

typedef int(* INTRFUNC)()

Definition at line 901 of file mesh.h.


Function Documentation

DllExport DWORD MapChannelID ( int  mp )

Returns the Channel ID of the map channel.

if mp>=1, this always returns TEXMAP_CHANNEL. For mp<1, including the hidden map channels, this is currently always VERTCOLOR_CHANNEL. In the future it may include map channels that are actually part of GEOM_CHANNEL or something.

Parameters:
mp The map channel.
DllExport int MapChannelNum ( int  mp )

Similar to MapChannelID, but this returns the CHAN_NUM version:TEXMAP_CHAN_NUM, VERTCOLOR_CHAN_NUM, etc.

Parameters:
mp The map channel.
DllExport int VertexDataType ( int  vdID )

Returns the type of data supported, i.e.

PERDATA_TYPE_FLOAT.

Deprecated:
Parameters:
vdID This parameter is ignored.
DllExport void* VertexDataDefault ( int  vdID )

Returns a pointer to a default floating point value for the specified channel.

Parameters:
vdID One of the values from Vertex Data Index Options
DllExport void setMeshIntrFunc ( INTRFUNC  fn )
DllExport void setUseVisEdge ( int  b )

This is used internally.

DllExport int getUseVisEdge ( )

This is used internally.

DllExport void setUseVertexDots ( int  b )
DllExport int getUseVertexDots ( )
DllExport void setVertexDotType ( int  t )
DllExport int getVertexDotType ( )
DllExport void setHandleBoxType ( int  t )
DllExport int getHandleBoxType ( )
DllExport void setDisplayBackFaceVertices ( int  b )
DllExport int getDisplayBackFaceVertices ( )
DllExport VertexNormalsControl* GetVertexNormalsControl ( )
DllExport int CalcBoolOp ( Mesh mesh,
Mesh mesh1,
Mesh mesh2,
int  op,
MeshOpProgress prog = NULL,
Matrix3 tm1 = NULL,
Matrix3 tm2 = NULL,
int  whichInv = 0,
int  weld = TRUE 
)

Matrix3 *tm2 = NULL, int whichInv = 0, int weld = TRUE); Note: This method is still in the SDK, but it is now obselete.

Calls to CalcBoolOp() should be replaced with calls to the new MNMesh form of Boolean. Please see the method MNMesh::MakeBoolean in Class MNMesh for details. This function stores the result of a boolean operation between mesh1 and mesh2 into mesh. This operation may be a union, intersection or difference. If tm1 or tm2 are non-NULL, the points of the corresponding mesh will be transformed by these matrices before the boolean operation. The mesh will be transformed back by either Inverse(tm1) or Inverse(tm2) depending on whichInv (a value of 0 will use tm1, a value of 1 will use tm2, unless whichInv is -1 in which case it will not be transformed back).

Parameters:
mesh The result of the boolean operation is stored here. mesh = mesh1 op mesh2.
mesh1 The first operand.
mesh2 The second operand.
op The boolean operation. One of the values from Boolean Operations for Meshes
prog = NULL A callback to display a progress. See Class MeshOpProgress.
tm1 = NULL If non-NULL then the points of mesh1 will transformed by this matrix before the boolean operation.
tm2 = NULL If non-NULL then the points of mesh2 will transformed by this matrix before the boolean operation.
whichInv = 0 If 0, the resulting mesh will be transformed by Inverse(tm1). If 1, the resulting mesh will be transformed by Inverse(tm2). If -1, the mesh will not be transformed back.
weld = TRUE If TRUE, the vertices of the resulting mesh are welded.
Returns:
Nonzero if the operation completed successfully; otherwise zero.
DllExport void CombineMeshes ( Mesh mesh,
Mesh mesh1,
Mesh mesh2,
Matrix3 tm1 = NULL,
Matrix3 tm2 = NULL,
int  whichInv = 0 
)

This function is available in release 2.0 and later only.

This function may be used to simply combine two meshes into one.

Parameters:
mesh The result of the combine operation is stored here. mesh = mesh1+mesh2.
mesh1 The first operand.
mesh2 The second operand.
tm1 If non-NULL then the points of mesh1 will transformed by this matrix before the boolean operation.
tm2 If non-NULL then the points of mesh2 will transformed by this matrix before the boolean operation.
whichInv If 0, the resulting mesh will be transformed by Inverse(tm1). If 1, the resulting mesh will be transformed by Inverse(tm2). If -1, the mesh will not be transformed back.
DllExport void SliceMesh ( Mesh mesh,
Point3  N,
float  off,
bool  split = FALSE,
bool  remove = FALSE 
)

Slices a single mesh.

The Point3 N and the float offset define a slicing plane (by DotProd (N,X) = offset). Default behavior is to split faces that cross the plane, producing 1-2 new faces on each side and a new vert in the middle of each edge crossing the plane. split means to add 2 different but coincident points to the top and bottom sets of faces, splitting the mesh into two meshes. remove means to delete all faces & verts below the plane.

DllExport Mesh* CreateNewMesh ( )