#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"
#include "autoptr.h"
#include "Graphics/IRenderItemContainer.h"
#include "Graphics/GenerateMeshRenderItemsContext.h"
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 |
struct | MeshSubHitRec |
This class allows access to the sub-object hit records used in Mesh hit testing. More... | |
struct | MeshSubHitRec::Iterator |
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... | |
Macros | |
#define | MESH_USE_EXT_CVARRAY (-32767) |
An argument for the mapChan parameter in Mesh::setVCDisplayData(). More... | |
#define | MESH_MULTI_PROCESSING TRUE |
TRUE turns on mp vertex transformation. More... | |
#define | MESH_CAGE_BACKFACE_CULLING |
for "cage" orange gizmo meshes in EMesh, EPoly, Mesh Select, etc. More... | |
#define | NEWMESH |
#define | MAX_MESHMAPS 100 |
The higher limit of the mapping channels (map channel can be from 0 to MAX_MESHMAPS - 1) More... | |
#define | MESHMAP_USED 0x0001 |
Indicates this mapping channel is actually used (carries mapping information). More... | |
#define | MESHMAP_TEXTURE 0x0002 |
Indicates this is a texture mapping channel. More... | |
#define | MESHMAP_VERTCOLOR 0x0004 |
Indicates this is a vertex color channel. More... | |
#define | MESHMAP_USER 0x0100 |
Indicates the channel is used for a developer purpose. More... | |
#define | NUM_HIDDENMAPS 2 |
The number of "Hidden" or negative-indexed maps in objects which support hidden maps. More... | |
#define | MAP_SHADING -1 |
The shading (or illumination) map. More... | |
#define | MAP_ALPHA -2 |
The Alpha channel map. More... | |
#define | MAX_VERTDATA 100 |
The maximum channel index for developers' defined data. More... | |
#define | VDATA_USER 10 |
Third parties should use this channel or higher. More... | |
#define | VDATA_SELECT 0 |
The vertex soft selection data. More... | |
#define | VDATA_WEIGHT 1 |
The vertex weight data. More... | |
#define | VDATA_ALPHA 2 |
Vertex Alpha values. More... | |
#define | VDATA_CORNER 3 |
Cornering values for subdivision use. More... | |
#define | VDATA_CREASE 4 |
Crease values for subdivision use. More... | |
#define | VDATA_COLOR 5 |
Special-use display colors (Color24) More... | |
#define | MAX_WEIGHT ((float)1e5) |
#define | MIN_WEIGHT ((float)1e-5) |
#define | PERDATA_TYPE_FLOAT 0 |
The floating point data type. More... | |
#define | PERDATA_TYPE_COLOR24 1 |
The color data type. More... | |
#define | MESH_EDGE_LIST (1<<1) |
Edge list. More... | |
#define | MESH_LOCK_RENDDATA (1<<2) |
Setting this flag prevents render data from being deleted (except when the mesh is deleted). More... | |
#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. More... | |
#define | MESH_BEEN_DSP (1<<9) |
This flag is reserved for internal use. More... | |
#define | MESH_SMOOTH_SUBSEL (1<<10) |
Having this bit set to 1 indicates that the smooth faces with selection-color outlines should be displayed. More... | |
#define | MESH_FACENORMALSINVALID (1<<11) |
Mesh flag that Signals that face normals should be rebuilt. More... | |
#define | MESH_CACHEINVALID (1<<12) |
Mesh, vertices and Face flag Signals that the they have changed and RVertices normals should be rebuilt. More... | |
#define | MESH_BACKFACESCOMPUTED (1<<16) |
Mesh flag to determine whether the back facing attribute on the face list has been computed or not. More... | |
#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. More... | |
#define | MESH_TEMP_1 (1<<13) |
#define | MESH_TEMP_2 (1<<14) |
#define | MESH_DONTTRISTRIP (1<<15) |
#define | MESH_SUBSELECTION_INVALID (1<<18) |
#define | MESH_SOFTSELECTION_WEIGHT_INVALID (1<<19) |
#define | MESH_UVW_INVALID (1<<20) |
#define | MESH_CLEARMAPCHANNEL (1<<21) |
Mesh Flag if set new tv face data will be cleared otherwise it will use a default planar. More... | |
#define | MESH_VERTEXCOLOR_INVALID (1<<22) |
#define | SUBHIT_SELONLY (1<<0) |
Selected only. More... | |
#define | SUBHIT_UNSELONLY (1<<2) |
Unselected only. More... | |
#define | SUBHIT_ABORTONHIT (1<<3) |
Abort hit testing on the first hit found. More... | |
#define | SUBHIT_SELSOLID (1<<4) |
This treats selected items as solid and unselected items as not solid. More... | |
#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. More... | |
#define | SUBHIT_VERTS (1<<24) |
Hit test vertices. More... | |
#define | SUBHIT_FACES (1<<25) |
Hit test faces. More... | |
#define | SUBHIT_EDGES (1<<26) |
Hit test edges. More... | |
#define | SUBHIT_TYPEMASK (SUBHIT_VERTS|SUBHIT_FACES|SUBHIT_EDGES) |
#define | SUBHIT_CHECK_ONLY (1<<28) |
Use this flag for Mesh::SubObjectHitTest or MNMesh::SubObjectHitTest to check if any or all sub-objects are hit. More... | |
#define | MESH_OBJECT (1<<0) |
Object level. More... | |
#define | MESH_VERTEX (1<<1) |
Vertex level. More... | |
#define | MESH_FACE (1<<2) |
Face level. More... | |
#define | MESH_EDGE (1<<3) |
Edge level. More... | |
#define | MESH_DISP_NO_NORMALS 0 |
Turn off normal display. More... | |
#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. More... | |
#define | OPTIMIZE_SAVESMOOTHBOUNDRIES (1<<1) |
Specifies that faces won't be collapsed across a dissimilar smoothing group boundary. More... | |
#define | OPTIMIZE_AUTOEDGE (1<<2) |
Specifies that the edge visibility should be set automatically based on the angle between adjacent surface normals. More... | |
#define | SMALL_VERTEX_DOTS 0 |
#define | LARGE_VERTEX_DOTS 1 |
#define | VERTEX_DOT2 0 |
equivalent to SMALL_VERTEX_DOTS More... | |
#define | VERTEX_DOT3 1 |
equivalent to LARGE_VERTEX_DOTS More... | |
#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 ChannelMask | MapChannelID (int mp) |
Returns the Channel ID of the map channel. More... | |
DllExport int | MapChannelNum (int mp) |
Similar to MapChannelID, but this returns the CHAN_NUM version:TEXMAP_CHAN_NUM, VERTCOLOR_CHAN_NUM, etc. More... | |
DllExport int | VertexDataType (int vdID) |
Return the data type of the specified vertex data channel. More... | |
DllExport void * | VertexDataDefault (int vdID) |
Returns a pointer to a default value for the specified channel. More... | |
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 obsolete. More... | |
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. More... | |
DllExport void | SliceMesh (Mesh &mesh, Point3 N, float off, bool split=FALSE, bool remove=FALSE) |
Slices a single mesh. More... | |
DllExport Mesh * | CreateNewMesh () |
#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.
#define MESH_MULTI_PROCESSING TRUE |
TRUE turns on mp vertex transformation.
#define MESH_CAGE_BACKFACE_CULLING |
#define NEWMESH |
#define MAX_MESHMAPS 100 |
The higher limit of the mapping channels (map channel can be from 0 to MAX_MESHMAPS - 1)
#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 MAX_WEIGHT ((float)1e5) |
#define MIN_WEIGHT ((float)1e-5) |
#define MESH_TEMP_1 (1<<13) |
#define MESH_TEMP_2 (1<<14) |
#define MESH_DONTTRISTRIP (1<<15) |
Mesh flag to determine whether to use tri-striping or not
#define MESH_SUBSELECTION_INVALID (1<<18) |
Mesh flag to determine if selection state of vertices, edges or faces has changed or not.
#define MESH_SOFTSELECTION_WEIGHT_INVALID (1<<19) |
Mesh flag to determine if soft selection weight of vertices has changed or not.
#define MESH_UVW_INVALID (1<<20) |
Mesh flag that means any MapChannel data is changed.
#define MESH_CLEARMAPCHANNEL (1<<21) |
Mesh Flag if set new tv face data will be cleared otherwise it will use a default planar.
#define MESH_VERTEXCOLOR_INVALID (1<<22) |
Mesh flag that means any of the vertex color channel data is changed.
#define SMALL_VERTEX_DOTS 0 |
#define LARGE_VERTEX_DOTS 1 |
#define VERTEX_DOT_MARKER | ( | vtype | ) | (MarkerType)(vtype - VERTEX_DOT2 + DOT2_MRKR) |
#define HANDLE_BOX_MARKER | ( | htype | ) | (MarkerType)(htype - HANDLE_BOX2 + BOX2_MRKR) |
typedef int(* INTRFUNC) () |
DllExport ChannelMask 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.
mp | The map channel. |
Similar to MapChannelID, but this returns the CHAN_NUM version:TEXMAP_CHAN_NUM, VERTCOLOR_CHAN_NUM, etc.
mp | The map channel. |
Return the data type of the specified vertex data channel.
vdID | - One of the values from Vertex Data Index Options |
Returns a pointer to a default value for the specified channel.
vdID | One of the values from Vertex Data Index Options |
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 obsolete.
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).
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. |
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.
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.