3ds Max C++ API Reference
Loading...
Searching...
No Matches
Mesh Class Reference

The Mesh class is provided for use by plug-ins and is used by the system. More...

#include <mesh.h>

+ Inheritance diagram for Mesh:

Classes

class  ScopedLockChannels
 A helper class for aquiring and releasing Mesh channel locks. More...
 

Public Member Functions

void AcquireChannelLocks (ChannelMask channels) const
 Using a channel mask, request the locks for those channels.
 
void ReleaseChannelLocks (ChannelMask channels) const
 Using a channel mask, release the aquired locks for those channels.
 
MaxSDK::MeshChannelContainerGetChannelDataContainer ()
 Returns the Mesh channel container which provides access to the channel objects themselves.
 
const MaxSDK::MeshChannelContainerGetChannelDataContainer () const
 Returns a const mesh channel container which provides access to the channel objects themselves.
 
void BuildGFXNormals ()
 
DllExport Mesh ()
 Constructor.
 
DllExport Mesh (const Mesh &fromMesh)
 Constructor.
 
DllExport ~Mesh ()
 Destructor.
 
DllExport void Init ()
 
DllExport void DeleteThis ()
 This method deletes this mesh.
 
DllExport Meshoperator= (const Mesh &fromMesh)
 Assignment operator.
 
DllExport void EnableEdgeList (int e)
 
DllExport void BuildVisEdgeList ()
 
DllExport void DrawVisEdgeList (GraphicsWindow *gw, DWORD vflags)
 
DllExport void Draw3DVisEdgeList (GraphicsWindow *gw, DWORD vflags)
 
DllExport void HitTestVisEdgeList (GraphicsWindow *gw, int abortOnHit)
 
DllExport void InvalidateEdgeList ()
 
DllExport IOResult Save (ISave *isave)
 
DllExport IOResult Load (ILoad *iload)
 
DllExport IOResult Save (ISave *isave, ChannelMask channels)
 
DllExport IOResult Load (ILoad *iload, ChannelMask channels)
 
DllExport Mesh operator+ (Mesh &mesh)
 Performs a boolean union operation.
 
DllExport Mesh operator- (Mesh &mesh)
 Performs a boolean difference operation.
 
DllExport Mesh operator* (Mesh &mesh)
 Performs a boolean intersection operation.
 
DllExport void MyDebugPrint ()
 
DllExport void ClearSpecifiedNormals ()
 
DllExport MeshNormalSpecGetSpecifiedNormals ()
 
DllExport void SpecifyNormals ()
 
DllExport void CopyBasics (const Mesh &from)
 
DllExport BaseInterfaceGetInterface (Interface_ID id)
 
DllExport bool isFaceCacheInvalid (int faceIndex)
 The function first checks if the whole mesh or the face have been flagged as cache invalid (MESH_CACHEINVALID).
 
DllExport void InvalidateVertexCache (int vertex)
 The function flags the specified vertex with the MESH_CACHEINVALID flag, telling the rebuild functions that this vertex, the faces surrounding it and the other vertices of those faces need to have their normals recomputed.
 
DllExport void SetStaticMesh (bool staticMesh)
 This will set the mesh or as static or not.
 
DllExport void ReduceDisplayCaches ()
 This will force all the derived data used to display the mesh to be deleted.
 
DllExport bool NeedGWCacheRebuilt (GraphicsWindow *gw, Material *ma, int numMat)
 This returns whether the Graphics Cache for this object needs to be rebuilt.
 
DllExport void BuildGWCache (GraphicsWindow *gw, Material *ma, int numMat, BOOL threaded)
 This builds the graphics window cached mesh.
 
DllExport void GenerateRenderItems (MaxSDK::Graphics::IRenderItemContainer &renderItems, const MaxSDK::Graphics::GenerateMeshRenderItemsContext &generateRenderItemsContext)
 Generate a set of render items according to the given render-item-generate context.
 
DllExport void GenerateDeferredRenderItems (MaxSDK::Graphics::IRenderItemContainer &renderItems, const MaxSDK::Graphics::GenerateMeshRenderItemsContext &generateRenderItemsContext)
 Generate a set of render items according to the given render-item-generate context.
 
DllExport void SetNormalDataGenerator (INormalDataGenerator *normalDataGenerator)
 
DllExport INormalDataGenerator * GetNormalDataGenerator ()
 
Material Assignment
DllExport MtlID GetMtlIndex () const
 Get the object material.
 
DllExport void SetMtlIndex (MtlID mtlIndex)
 Set the object material.
 
Vertex Methods
DllExport BOOL setNumVerts (int ct, BOOL keep=FALSE, BOOL synchSel=TRUE)
 Sets the number of geometric vertices in the mesh.
 
int getNumVerts (void) const
 Returns the number of vertices.
 
void setVert (int i, const Point3 &xyz)
 Sets a single vertex in the verts array.
 
void setVert (int i, float x, float y, float z)
 Sets a single vertex in the verts array.
 
Point3getVert (int i)
 Returns the 'i-th' vertex.
 
Point3getVertPtr (int i)
 Returns a pointer to the 'i-th' vertex.
 
long GetVFlags (int i)
 Returns flags specific to the corresponding vertex in the verts array.
 
Face Methods
DllExport BOOL setNumFaces (int ct, BOOL keep=FALSE, BOOL synchSel=TRUE)
 Sets the number of faces in the mesh.
 
int getNumFaces (void) const
 Returns the number of faces in the mesh.
 
FacegetFace (int i)
 Returns the 'i-th' face.
 
FacegetFacePtr (int i)
 Returns a pointer to the 'i-th' face.
 
Texture Vertex-Texture Face Methods
DllExport BOOL setNumTVerts (int ct, BOOL keep=FALSE)
 Sets the number of texture vertices (in mapping channel 1).
 
int getNumTVerts (void) const
 Returns the number of texture vertices (in mapping channel 1).
 
DllExport BOOL setNumTVFaces (int ct, BOOL keep=FALSE, int oldCt=0)
 Sets the number of TVFaces.
 
void setTVert (int i, const UVVert &xyz)
 Sets a single texture vertex in the tVerts array.
 
void setTVert (int i, float x, float y, float z)
 Sets a single texture vertex in the tVerts array.
 
UVVertgetTVert (int i)
 Returns the 'i-th' texture vertex.
 
UVVertgetTVertPtr (int i)
 Returns a pointer to the 'i-th' texture vertex.
 
Color Per Vertex Methods
DllExport BOOL setNumVertCol (int ct, BOOL keep=FALSE)
 Sets the number of color per vertex vertices.
 
int getNumVertCol () const
 Returns the number of color per vertex vertices.
 
DllExport BOOL setNumVCFaces (int ct, BOOL keep=FALSE, int oldCt=0)
 Sets the number of color per vertex faces.
 
DllExport void setVCDisplayData (int mapChan=0, VertColor *VCArray=NULL, TVFace *VCf=NULL)
 This method would typically be called right before display, as with a node display callback, or through an extension object.
 
Multiple Map Support
DllExport void setNumMaps (int ct, BOOL keep=FALSE)
 Set the number of texture maps used by this Mesh.
 
DllExport int getNumMaps () const
 Returns the number of mapping channels in use.
 
DllExport BOOL mapSupport (int mp) const
 Returns TRUE if the specified mapping channel is supported; otherwise FALSE.
 
DllExport void setMapSupport (int mp, BOOL support=TRUE)
 Sets whether the specified mapping channels is supported or not.
 
DllExport void setNumMapVerts (int mp, int ct, BOOL keep=FALSE)
 Sets the number of texture or vertex color vertices for the specified mapping channel of this mesh.
 
DllExport int getNumMapVerts (int mp) const
 Returns the number of texture or vertex color vertices for the specified channel of this mesh.
 
DllExport void setNumMapFaces (int mp, int ct, BOOL keep=FALSE, int oldCt=0)
 Sets the number of texture or vertex color faces for the specified channel of this mesh.
 
DllExport int getNumMapFaces (int mp) const
 Returns the number of texture or vertex color faces for the specified channel of this mesh.
 
DllExport UVVertmapVerts (int mp) const
 Returns a pointer to the list of UVVerts for the specified channel of this mesh.
 
DllExport TVFacemapFaces (int mp) const
 Returns a pointer to the list of TVFaces for the specified channel of this mesh.
 
void setMapVert (int mp, int i, const UVVert &xyz)
 Sets a single texture or vertex color value for the specified channel of this mesh.
 
DllExport void MakeMapPlanar (int mp)
 Applies a simple planar mapping to the specified channel.
 
DllExport BitArray GetIsoMapVerts (int mp)
 Returns a BitArray with a bit set for each isolated vertex (un-referenced by any face) for the specified channel.
 
DllExport void DeleteMapVertSet (int mp, BitArray set, BitArray *fdel=NULL)
 Deletes the map vertices indicated.
 
DllExport void DeleteIsoMapVerts ()
 This method deletes each isolated vertex (un-referenced by any face) for the all active maps.
 
DllExport void DeleteIsoMapVerts (int mp)
 This method deletes each isolated vertex (un-referenced by any face) for the specified channel.
 
DllExport void freeMapVerts (int mp)
 Deallocates the texture or vertex color vertices for the specified channel of this mesh.
 
DllExport void freeMapFaces (int mp)
 Deallocates the texture or vertex color faces for the specified channel of this mesh.
 
DllExport MeshMap const & Map (int mp) const
 This method returns the map for the specified map channel.
 
MeshMapMap (int mp)
 This method returns the map for the specified map channel.
 
Vertex Data Methods
DllExport void setNumVData (int ct, BOOL keep=FALSE)
 Sets the number of channels of vertex data used.
 
DllExport int getNumVData () const
 Returns the number of vertex data channels.
 
DllExport int getNumVDataSupported () const
 Returns the number of active vertex data channels.
 
DllExport BOOL vDataSupport (int vd) const
 Returns TRUE if the specified channel of vertex data is available for this mesh; otherwise FALSE.
 
DllExport void setVDataSupport (int vd, BOOL support=TRUE)
 Sets if the specified channel of vertex data is supported.
 
DllExport PerDataGetVD (int vdChannel) const
 Returns the vdChannel'th vertex data channels.
 
voidvertexData (int vd) const
 Returns a pointer to the vertex data for the specified channel or NULL if the channel is not supported.
 
float * vertexFloat (int vd) const
 Returns a pointer to the floating point vertex data for the specified channel of this mesh or NULL if the channel is not supported.
 
DllExport void freeVData (int vd)
 Deallocates the vertex data for the specified chanel.
 
DllExport void freeAllVData ()
 Deallocates the vertex data from all the channels and sets the number of supported channels to 0.
 
float * getVertexWeights ()
 Returns a pointer to the floating point vertex weight data.
 
void SupportVertexWeights ()
 Sets the channel support for the vertex weights channel (VDATA_WEIGHT).
 
void ClearVertexWeights ()
 Clears (deallocates) the vertex weights channel data.
 
void freeVertexWeights ()
 Deallocates the vertex weights channel data (same as ClearVertexWeights() above).
 
float * getVSelectionWeights ()
 Returns a pointer to the floating point vertex selection weights data.
 
void SupportVSelectionWeights ()
 Sets the channel support for the vertex weights channel (VDATA_SELECT).
 
void ClearVSelectionWeights ()
 Clears (deallocates) the vertex selection weights channel data.
 
void freeVSelectionWeights ()
 Deallocates the vertex selection weights channel data (same as ClearVSelectionWeights() above).
 
Normals/Smoothing/Edges/Face check Functions
DllExport void setSmoothFlags (int f)
 This method should be called when the user has clicked on the 'Smooth' check box in a procedural object.
 
DllExport int getSmoothFlags ()
 Returns the state of the smooth flags.
 
DllExport void FlipNormal (int i)
 Flips the surface normal of the 'i-th' face (this just rearranges the indices for the face structure).
 
DllExport void UnifyNormals (BOOL selOnly)
 Unifies the surfaces normals of this Mesh.
 
DllExport void AutoSmooth (float angle, BOOL useSel, BOOL preventIndirectSmoothing=FALSE)
 Performs an auto smooth on the mesh, setting the smoothing groups based on the surface normals.
 
DllExport EdgeMakeEdgeList (int *edgeCount, int flagdbls=0)
 
DllExport int DeleteFlaggedFaces ()
 This method removes faces from the face list with the FACE_WORK flag set.
 
DllExport void DeleteSelected ()
 Deletes all selected elements of the current selection level.
 
DllExport void DeleteVertSet (BitArray set)
 Deletes the vertices as specified by the BitArray.
 
DllExport void DeleteFaceSet (BitArray set, BitArray *isoVert=NULL)
 Deletes faces as specified by the BitArray.
 
DllExport BOOL DoesFaceExist (DWORD v0, DWORD v1, DWORD v2)
 This method may be called to determine if an equivalent face already exists.
 
DllExport BOOL RemoveDegenerateFaces ()
 Removes faces that have two or more equal indices.
 
DllExport BOOL RemoveIllegalFaces ()
 Removes faces that have indices that are out of range.
 
DllExport Point3 FaceNormal (DWORD fi, BOOL nrmlize=FALSE) const
 This method returns the normal of the specified face.
 
DllExport Point3 FaceCenter (DWORD fi) const
 This method returns the center of the specified face.
 
DllExport float AngleBetweenFaces (DWORD f0, DWORD f1, const Point3 *faceNormals=nullptr) const
 Returns the angle between two face surface normals in radians.
 
DllExport Point3 BaryCoords (DWORD face, Point3 p) const
 Computes and returns the barycentric coordinates of a point in the plane of a face relative to that face.
 
DllExport void FaceCenterTessellate (BOOL ignoreSel=FALSE, MeshOpProgress *mop=NULL)
 Tessellates the mesh (or only the selected faces) using the face/center method.
 
DllExport void EdgeTessellate (float tens, BOOL ignoreSel=FALSE, MeshOpProgress *mop=NULL)
 Edge tessellates the mesh using the specified tension parameter.
 
DllExport void ExtrudeFaces (BOOL doFace=TRUE)
 Extrudes the selected faces.
 
DllExport void IndentSelFaces (float amount)
 Indents the selected faces, in a manner consistent with the outlining used in Bevel.
 
DllExport void BreakVerts (BitArray set)
 Splits the vertices specified in the BitArray so that they are only used by a single face.
 
DllExport BitArray GetIsoVerts ()
 This method returns a BitArray (of size numVerts), where isolated verts are selected.
 
DllExport void DeleteIsoVerts ()
 Deletes the vertices that aren't used by any faces.
 
DllExport void CloneFaces (BitArray fset)
 Creates a copy of the faces and verts used by those faces as specified by the BitArray passed.
 
DllExport void PolyFromFace (DWORD f, BitArray &set, float thresh, BOOL ignoreVisEdges, AdjFaceList *af=NULL)
 Sets bits for all faces in the same polygon with face f.
 
DllExport void ElementFromFace (DWORD f, BitArray &set, AdjFaceList *af=NULL) const
 This method sets bits for all faces in the same "element", or connected component, with face f.
 
DllExport void FindVertsUsedOnlyByFaces (BitArray &fset, BitArray &vset)
 When faces are deleted in Edit or Editable Mesh, we often want to be able to delete the verts that are isolated by this action.
 
DllExport void FindOpenEdges (BitArray &edges)
 This method fills in a BitArray with the edges in the mesh that are "open" or "one-sided".
 
DllExport void FindVertexAngles (float *vang, BitArray *set=NULL)
 This method calculates, for each vertex, the sum of the angles of this vertex's corner in each face it's on.
 
void SetRenderData (MeshRenderData *p)
 Sets the mesh render data hung off this Mesh.
 
MeshRenderDataGetRenderData ()
 Returns the mesh render data hung off this Mesh.
 
Normals Methods
DllExport void setNormal (int i, const Point3 &xyz)
 Sets a single 'rendered' normal in the rVerts array of RVertex instances.
 
DllExport Point3getNormal (int i)
 Returns the 'i-th' 'rendered' normal from the rVerts array.
 
DllExport void setFaceNormal (int i, const Point3 &xyz)
 Sets the 'i-th' face normal.
 
DllExport Point3getFaceNormal (int i)
 Returns the 'i-th' face normal.
 
DllExport Point3getFaceNormalPtr (int i)
 Returns a pointer to the 'i-th' face normal.
 
DllExport void buildNormals ()
 This method resolves the normals on the RVertex array.
 
DllExport void buildRenderNormals ()
 This method is similar to buildNormals() above, but ignores the material index (mtlIndex).
 
DllExport void checkNormals (BOOL illum)
 This method can be used to build the normals and allocate RVert space only if necessary.
 
Render Vertex Methods
DllExport RVertexgetRVert (int i)
 This method returns the 'i-th' RVertex.
 
DllExport RVertexgetRVertPtr (int i)
 This method returns a pointer to the 'i-th' RVertex.
 
Material Methods
DllExport MtlID getFaceMtlIndex (int i)
 Retrieves the zero based material index of the 'i-th' face.
 
DllExport void setFaceMtlIndex (int i, MtlID id)
 Sets the material index of the 'i-th' face.
 
Render/Hit Test/Snap Methods
DllExport void render (GraphicsWindow *gw, Material *ma, RECT *rp, int compFlags, int numMat=1, InterfaceServer *is=NULL)
 Renders this Mesh using the specified graphics window and array of materials.
 
DllExport void snap (GraphicsWindow *gw, SnapInfo *snap, IPoint2 *p, Matrix3 &tm)
 Checks to see if there is a snap point near the given mouse point.
 
void displayNormals (int b, float sc)
 Note that there may be more than one normal per vertex if faces that share the vertex are in non-overlapping smoothing groups.
 
Bounding Box Methods
DllExport void buildBoundingBox (void)
 Computes the bounding box of the Mesh.
 
DllExport void BuildTransformedBoundingBox (const Matrix3 &transformMat)
 If the transformed bounding box presently stored by this mesh is invalid, or corresponds to a transformation differing from that defined the specified matrix transformMat, then the stored transformed bounding box is updated to reflect the transformation of the mesh into the space defined by transformMat.
 
DllExport Box3 getBoundingBox (Matrix3 *tm=NULL)
 Retrieves the bounding box of the mesh object.
 
Strip Methods
DllExport BOOL BuildStrips ()
 It builds the strips database inside the mesh.
 
DllExport void Stripify (Strip *s, StripData *sd, int vtx)
 
DllExport void Stripify (Strip *s, StripData *sd, int vtx, DWTab &v, DWTab &n, DWTab &tv)
 It builds the strips database inside the mesh.
 
DllExport void getStripVertColor (GraphicsWindow *gw, int cv, int flipped, MtlID mID, DWORD smGroup, Point3 &rgb)
 
DllExport void getStripNormal (int cv, MtlID mID, DWORD smGroup, Point3 &nor)
 
DllExport int getStripNormalIndex (int cv, MtlID mID, DWORD smGroup)
 It builds the strips database inside the mesh.
 
DllExport BOOL getStripTVert (GraphicsWindow *gw, int cv, int ctv, Point3 &uvw, int texNum=0)
 
DllExport void DrawStrips (GraphicsWindow *gw, Material *ma, int numMat)
 
DllExport void Draw3DStrips (GraphicsWindow *gw, Material *ma, int numMat)
 
DllExport void Draw3DWireStrips (GraphicsWindow *gw, Material *ma, int numMat)
 It builds the strips database inside the mesh.
 
DllExport void InvalidateStrips ()
 This method invalidates the strips database.
 
DllExport void BuildStripsAndEdges ()
 This method builds the strips and edges database inside the mesh.
 
Data Flow Evaluation Methods
DllExport void ShallowCopy (Mesh *amesh, ChannelMask channels)
 Shallow copy the specified channel objects of the specified Mesh.
 
DllExport void DeepCopy (Mesh *amesh, ChannelMask channels)
 Makes a complete copy of the specified channel objects from the specified Mesh and store them into this Mesh.
 
DllExport void NewAndCopyChannels (ChannelMask channels)
 This method clones the specified channel objects and stores those in the channel container.
 
DllExport void FreeChannels (ChannelMask channels, int zeroOthers=1)
 Drop the channel objects specified by the channels argument.
 
Mesh/Display Flags
void SetFlag (DWORD f)
 Sets the state of the mesh flags.
 
DWORD GetFlag (DWORD f)
 Returns the state of the specified mesh flags.
 
void ClearFlag (DWORD f)
 Sets the state of the specified mesh flags to 0.
 
void SetDispFlag (DWORD f)
 Sets the state of the display flags.
 
DWORD GetDispFlag (DWORD f)
 Returns the state of the specified display flags.
 
void ClearDispFlag (DWORD f)
 Sets the state of the specified display flags to 0.
 
Selection Access
DllExport BitArrayVertSel ()
 Retrieves the bits representing the vertex selection status.
 
DllExport const BitArrayVertSel () const
 
DllExport BitArrayFaceSel ()
 Retrieves the bits representing the face selection status.
 
DllExport const BitArrayFaceSel () const
 
DllExport BitArrayEdgeSel ()
 Retrieves the bits representing the the selected edges status.
 
DllExport const BitArrayEdgeSel () const
 
DllExport BitArrayVertHide ()
 Retrieves the bits representing the hidden flags for vertices.
 
DllExport const BitArrayVertHide () const
 
DllExport BitArray VertexTempSel ()
 Constructs a vertex selection list based on the current selection level.
 
Intersect Ray/Weld/Optimize/Apply Mapping
DllExport void WeldCollinear (BitArray &set)
 
DllExport void Optimize (float normThresh, float edgeThresh, float bias, float maxEdge, DWORD vflags, MeshOpProgress *prog=NULL)
 Allows this Mesh to be reduced in complexity by reducing the number of faces based on a surface normal threshold.
 
DllExport void ApplyUVWMap (int type, float utile, float vtile, float wtile, int uflip, int vflip, int wflip, int cap, const Matrix3 &tm, int channel=1)
 This method may be called to map this Mesh with UVW mapping coordinates.
 
DllExport void ApplyMapper (UVWMapper &map, int channel=1)
 
- Public Member Functions inherited from BaseInterfaceServer
UtilExport BaseInterfaceGetInterface (Interface_ID id) override
 
virtual UtilExport int NumInterfaces () const
 
virtual UtilExport BaseInterfaceGetInterfaceAt (int i) const
 
virtual UtilExport ~BaseInterfaceServer ()
 
- Public Member Functions inherited from InterfaceServer
virtual UtilExport ~InterfaceServer ()
 Destructor.
 
virtual UtilExport BaseInterfaceGetInterface (Interface_ID id)
 
template<class InterfaceType >
InterfaceType * GetTypedInterface ()
 

Public Attributes

MaxSDK::BlockWrite_Value< int, MaxSDK::MeshTopoChannelDatanumFaces
 The number of faces in this Mesh. Faces are owned by the MaxSDK::MeshTopoChannelData channel.
 
MaxSDK::BlockWrite_Ptr< Face, MaxSDK::MeshTopoChannelDatafaces
 The mesh faces. Faces are owned by the MaxSDK::MeshTopoChannelData channel.
 
MaxSDK::BlockWrite_Value< int, MaxSDK::MeshGeomChannelDatanumVerts
 The number of verts in this Mesh. Mesh verts are owned by the MaxSDK::MeshGeomChannelData channel.
 
MaxSDK::BlockWrite_Ptr< Point3, MaxSDK::MeshGeomChannelDataverts
 The mesh verts. Mesh verts are owned by the MaxSDK::MeshGeomChannelData channel.
 
MaxSDK::BlockWrite_Ptr< long, MaxSDK::MeshGeomChannelDatavFlags
 Holds flags specific to the corresponding vertex in the verts array. Owned by the MaxSDK::MeshGeomChannelData channel.
 
int curVCChan
 Storage for the current mapping channel to use for vertex colors (default = 0).
 
VertColorcurVCArray
 Points to storage for a possible external color array (default = NULL).
 
TVFacecurVCFace
 possible external face array (default = NULL)
 
VertColorvertColArray
 When 3ds Max is rendering the color values come from this variable.
 
TVFacevcFaceData
 When 3ds Max is rendering the vertex color lookup comes from this structure.
 
DWORD dispFlags
 Display attribute flags.
 
DWORD selLevel
 Selection level flags.
 
int normalsBuilt
 Nonzero if normals have been built for the current mesh; 0 otherwise.
 
MeshRenderDatarenderData
 Points to the render data used by the renderer.
 
StripTabstab
 depends on topo
 
DWTab norInd
 indirection array for fast normal lookup
 
int normalCount
 total number of normals
 
Point3gfxNormals
 flattened list of normals pointers back in the rverts data.
 
int numTexCoords [GFX_MAX_TEXTURES]
 Derived arrays to contain generated texture coordinates.
 
Point3texCoords [GFX_MAX_TEXTURES]
 Derived arrays to contain generated texture coordinates.
 
Tab< TriStrip * > * tstab
 Derived table of TriStrips, depends on topology.
 
Color per vertex
MaxSDK::BlockWrite_Value< int, MaxSDK::MeshVertexColorChannelDatanumCVerts
 Number of color vertices.
 
MaxSDK::BlockWrite_Ptr< VertColor, MaxSDK::MeshVertexColorChannelDatavertCol
 Array of color vertices.
 
MaxSDK::BlockWrite_Ptr< TVFace, MaxSDK::MeshVertexColorChannelDatavcFace
 Array of color per vertex faces.
 
Texture Coord assignment
MaxSDK::BlockWrite_Value< int, MaxSDK::MeshTextureMapChannelDatanumTVerts
 Number of texture vertices.
 
MaxSDK::BlockWrite_Ptr< UVVert, MaxSDK::MeshTextureMapChannelDatatVerts
 The array of texture vertices.
 
MaxSDK::BlockWrite_Ptr< TVFace, MaxSDK::MeshTextureMapChannelDatatvFace
 The array of texture faces.
 

Friends

class Face
 
class MeshAccess
 
class HardwareMesh
 
class MaxGraphics::IMeshInternal
 
class MaxGraphics::BackfaceWireframe::IMeshBackfaceWireframeUtility
 
void gfxCleanup (void *data)
 

Space Accelerating Data Structure

These functions and member variable handle the space accelerating data structure used internally by Max system.

3ds Max 2017 release introduced the space accelerating data structure and algorithm to speed up the methods related to space looking-up. The space accelerating data can significantly improve the space looking-up algorithm, however the system may take some time to build the space accelerating data.It is recommended to use the following functions in the scenario of updating once then looking up multiple times.

bool checkFaceSel (int face_i, Mesh_SelParams &params)
 Invoke these methods to check the Sub-Objects associated with the face indexed by face_i is in the hit region.
 
bool checkFaceEdgesSel (int face_i, Mesh_SelParams &params)
 Invoke these methods to check the Sub-Objects associated with the face indexed by face_i is in the hit region.
 
bool checkVertSel (int vert_i, Mesh_SelParams &params)
 Invoke these methods to check the Sub-Objects associated with the face indexed by face_i is in the hit region.
 
DllExport bool IsAccelDataDirty ()
 Checks if the space accelerating data is up-to-date.
 
DllExport void DirtyAccelData ()
 Update the space accelerating data.
 
DllExport BOOL select (GraphicsWindow *gw, Material *ma, HitRegion *hr, int abortOnHit=FALSE, int numMat=1)
 Checks the given HitRecord hr to see if it intersects this Mesh object.
 
DllExport BOOL SubObjectHitTest (GraphicsWindow *gw, Material *ma, HitRegion *hr, DWORD vflags, SubObjHitList &hitList, int numMat=1)
 This method may be called to perform sub-object hit testing on this mesh.
 
DllExport Point3 ComputeRenderNormal (int face_i, int corner)
 This function computes the render normal for the specified face and corner.
 
DllExport Point3 ComputeInterpolatedRenderNormal (int face_i, const Point3 &bary)
 This function computes the interpolated normals regarding the barycentric coordinates.
 
DllExport int IntersectRay (Ray &ray, float &at, Point3 &norm)
 Calculates the intersection of the specified ray with this mesh object.
 
DllExport int IntersectRay (Ray &ray, float &at, Point3 &norm, DWORD &fi, Point3 &bary)
 Calculates the intersection of the specified ray with this mesh object.
 
DllExport voidGetSpaceAccelHandle ()
 Invoke these methods to check the Sub-Objects associated with the face indexed by face_i is in the hit region.
 

Edge Methods

void displayAllEdges (int b)
 Controls the display of hidden edges of this mesh object.
 
DllExport void InvalidateGeomCache ()
 Call this method after the geometry of this Mesh has changed.
 
DllExport void InvalidateTopologyCache ()
 Call this method after you alter vertex or face lists or revise edge visibility flags.
 
DllExport void FreeAll ()
 Cleans up the allocated arrays.
 
DllExport void DivideEdge (DWORD edge, float prop=.5f, bool visDiag1=TRUE, bool fixNeighbors=TRUE, bool visDiag2=TRUE)
 Divides the edge, creating a new point.
 
DllExport void DivideFace (DWORD face, DWORD e1, DWORD e2, float prop1=.5f, float prop2=.5f, bool fixNeighbors=TRUE, bool split=FALSE)
 Cuts a face into three faces, arranged as a quad and a triangle, by slicing from a point on one edge to a point on another.
 
DllExport void TurnEdge (DWORD edge, DWORD *otherEdge=NULL)
 Turns an edge.
 

Additional Inherited Members

- Static Public Member Functions inherited from MaxHeapOperators
static UtilExport voidoperator new (size_t size)
 Standard new operator used to allocate objects If there is insufficient memory, an exception will be thrown.
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e)
 Standard new operator used to allocate objects if there is insufficient memory, NULL will be returned.
 
static UtilExport voidoperator new (size_t size, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, an exception will be thrown.
 
static UtilExport voidoperator new (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate objects that takes the type of memory, filename and line number where the new was called If there is insufficient memory, an exception will be thrown.
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, NULL will be returned.
 
static UtilExport voidoperator new (size_t size, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, an exception will be thrown.
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, NULL will be returned.
 
static UtilExport voidoperator new[] (size_t size)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown.
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned.
 
static UtilExport voidoperator new[] (size_t size, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown.
 
static UtilExport voidoperator new[] (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate arrays of objects.
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned.
 
static UtilExport voidoperator new[] (size_t size, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown.
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned.
 
static UtilExport void operator delete (void *ptr)
 Standard delete operator used to deallocate an object If the pointer is invalid, an exception will be thrown.
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an object If the pointer is invalid, nothing will happen.
 
static UtilExport void operator delete (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown.
 
static UtilExport void operator delete (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an object that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown.
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen.
 
static UtilExport void operator delete (void *ptr, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown.
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, nothing will happen.
 
static UtilExport void operator delete[] (void *ptr)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, an exception will be thrown.
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, nothing will happen.
 
static UtilExport void operator delete[] (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown.
 
static UtilExport void operator delete[] (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown.
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen.
 
static UtilExport void operator delete[] (void *ptr, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown.
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown.
 
static UtilExport voidoperator new (size_t size, void *placement_ptr)
 Placement new operator.
 
static UtilExport void operator delete (void *ptr, void *placement_ptr)
 Placement delete operator.
 
static UtilExport voidaligned_malloc (size_t size, size_t alignment)
 Allocates memory on a specified alignment boundary.
 
static UtilExport voidaligned_realloc (void *ptr, size_t size, size_t alignment)
 Reallocates memory on a specified alignment boundary.
 
static UtilExport void aligned_free (void *ptr)
 Frees a block of memory that was allocated with aligned_malloc/aligned_realloc.
 
- Protected Attributes inherited from BaseInterfaceServer
Tab< BaseInterface * > interfaces
 

Detailed Description

The Mesh class is provided for use by plug-ins and is used by the system.

It is the data structure for meshes in the system and maintains pointers to the vertices, faces, texture vertices, etc. It provides methods to handle most of the functionality that procedural objects must implement. All methods of this class are implemented by the system. See the Meshes section for more information. Note 1 : There is a set of classes for working with parts of a mesh such as its face structure, element structure, and cluster structure. For details see: Class AdjEdgeList, Class AdjFaceList, Class FaceElementList, Class FaceClusterList.

See also
BitArray, Face, TVFace, Point3, TriObject
RNormal, RVertex, TriObject, MeshMap, Note 2 : if you are going to share this mesh between different classes, you should use the class SharedMesh which uses reference counting and gets deleted once its ref count reaches 0.
MaxSDK::SharedMesh.
List of deprecations from 3dsMax 2024:
DeprecatedPlease use instead
BitArray vdSupport, moved to MaxSDK::MeshGeomChannelData. getNumVData() const, getNumVDataSupported() const, vDataSupport(int vd) const, setVDataSupport(int vd, BOOL support)
PerData* vData, moved to MaxSDK::MeshGeomChannelData. GetVD(int vdChannel) const;
BitArray vertSel, moved to MaxSDK::MeshGeomChannelData. VertSel()
BitArray faceSel, moved to MaxSDK::MeshTopoChannelData. FaceSel()
BitArray edgeSel, moved to MaxSDK::MeshTopoChannelData. EdgeSel()
BitArray vertHide, moved to MaxSDK::MeshGeomChannelData. VertHide()
MtlID mtlIndex, moved to MaxSDK::MeshMaterialChannelData. GetMtlIndex() const, SetMtlIndex(MtlID mtlIndex).
int numMapsgetNumMaps() const;
MeshMap* maps, moved to MaxSDK::MeshTextureMapChannelData and MaxSDK::MeshVertexColorChannelData.Map(int mp) const;
void ZeroTopologyCache()Removed completely.

Constructor & Destructor Documentation

◆ Mesh() [1/2]

Constructor.

Initializes the mesh object. The mesh counts are set to 0 and its pointers are set to NULL.

◆ Mesh() [2/2]

DllExport Mesh ( const Mesh fromMesh)

Constructor.

The mesh is initialized equal to fromMesh.

◆ ~Mesh()

Destructor.

Frees any allocated arrays (faces, verts, tverts, tvfaces).

Member Function Documentation

◆ AcquireChannelLocks()

void AcquireChannelLocks ( ChannelMask  channels) const
inline

Using a channel mask, request the locks for those channels.

This can be used avoid race conditions when modifying many Min parallel when some of them share channels.

Parameters
[in]channels- Which channels to aquire a lock for.
See also
Mesh::ReleaseChannelLocks(ChannelMask channels) const
Mesh::ShallowCopy(Mesh *amesh, ChannelMask channels)
1141{ return m_ChannelDataContainer.AcquireChannelLocks(channels); }
DllExport void AcquireChannelLocks(ChannelMask channels) const
Based on a channel mask, request the locks for those channels.

◆ ReleaseChannelLocks()

void ReleaseChannelLocks ( ChannelMask  channels) const
inline

Using a channel mask, release the aquired locks for those channels.

Parameters
[in]channels- Which channels to release the locks for.
See also
Mesh::AcquireChannelLocks(ChannelMask channels) const
Mesh::ShallowCopy(Mesh *amesh, ChannelMask channels)
1147{ return m_ChannelDataContainer.ReleaseChannelLocks(channels); }
DllExport void ReleaseChannelLocks(ChannelMask channels) const
Based on a channel mask, release the locks for those channels.

◆ GetChannelDataContainer() [1/2]

MaxSDK::MeshChannelContainer & GetChannelDataContainer ( )
inline

Returns the Mesh channel container which provides access to the channel objects themselves.

To modify a Mesh channel directly, instead of using the Mesh interface, you can fetch the MeshChannelContainer, then grab the appropriate channel object and make the changes directly. This is not recommended, mistakes here could cause crashes and data loss. Example to manually reallocate the Mesh faces:

MeshTopoChannelData* tc = mesh.GetChannelDataContainer().GetOrCreateMeshTopoChannelData();
tc->numFaces = newFaceCount;
tc->faces = newFaces;
tc->edgeSel.SetSize(newFaceCount * 3);
tc->faceSel.SetSize(newFaceCount);
tc->SyncParentInterface(&mesh); //Don't forget to sync. This updates the meshes public "BlockWrite" members with the new data.
See also
MaxSDK::MeshChannelData
MaxSDK::BlockWrite_Ptr
MaxSDK::BlockWrite_Value
1312{ return m_ChannelDataContainer; }

◆ GetChannelDataContainer() [2/2]

const MaxSDK::MeshChannelContainer & GetChannelDataContainer ( ) const
inline

Returns a const mesh channel container which provides access to the channel objects themselves.

See also
Mesh::GetChannelDataContainer()
1315{ return m_ChannelDataContainer; }

◆ GetMtlIndex()

DllExport MtlID GetMtlIndex ( ) const

Get the object material.

◆ SetMtlIndex()

DllExport void SetMtlIndex ( MtlID  mtlIndex)

Set the object material.

◆ BuildGFXNormals()

void BuildGFXNormals ( )

◆ Init()

DllExport void Init ( )

Initializes the mesh object. The mesh counts are set to 0 and its pointers are set to NULL. Note: This method is not intended to be called by developers. It is used internally.

◆ DeleteThis()

DllExport void DeleteThis ( )

This method deletes this mesh.

◆ operator=()

DllExport Mesh & operator= ( const Mesh fromMesh)

Assignment operator.

Note: This operator does not copy the rVerts array. This means that developers who have specified normals will have to explicitly copy them after a mesh assignment is done using this operator. This is because rVerts are instance-specific. In general, normals are computed from smoothing groups, and hence are "generated data". In the case where normals are specified, 3ds Max stores the data in the rVerts array so as to not waste space. The way 3ds Max uses the mesh = operator assumes that the rVerts are not copied, and thus developers must do the copying themselves.

Parameters
fromMeshSpecifies the mesh to copy.

◆ setNumVerts()

DllExport BOOL setNumVerts ( int  ct,
BOOL  keep = FALSE,
BOOL  synchSel = TRUE 
)

Sets the number of geometric vertices in the mesh.

Parameters
ctSpecifies the number of vertices.
keepSpecifies if the previous vertices should be kept. If TRUE the previous vertices are kept; otherwise they are discarded. Defaults to FALSE.
synchSelThis parameter is available in release 2.0 and later only. If TRUE the selection set BitArrays are resized to fit the number of vertices; otherwise they are left unaltered. Defaults to TRUE.
Returns
TRUE if storage was allocated and the number of vertices was set; otherwise FALSE.

◆ getNumVerts()

int getNumVerts ( void  ) const
inline

Returns the number of vertices.

1623{ return numVerts; }
MaxSDK::BlockWrite_Value< int, MaxSDK::MeshGeomChannelData > numVerts
The number of verts in this Mesh. Mesh verts are owned by the MaxSDK::MeshGeomChannelData channel.
Definition: mesh.h:1347

◆ setNumFaces()

DllExport BOOL setNumFaces ( int  ct,
BOOL  keep = FALSE,
BOOL  synchSel = TRUE 
)

Sets the number of faces in the mesh.

Parameters
ctSpecifies the number of faces.
keepSpecifies if the previous faces should be kept. If TRUE the previous faces are kept; otherwise they are discarded. Defaults to FALSE.
synchSelIf TRUE the selection set BitArrays are resized to fit the number of faces; otherwise they are left unaltered. Defaults to TRUE.
Returns
TRUE if storage was allocated and the number of faces was set; otherwise FALSE.

◆ getNumFaces()

int getNumFaces ( void  ) const
inline

Returns the number of faces in the mesh.

1639{ return numFaces; }
MaxSDK::BlockWrite_Value< int, MaxSDK::MeshTopoChannelData > numFaces
The number of faces in this Mesh. Faces are owned by the MaxSDK::MeshTopoChannelData channel.
Definition: mesh.h:1326

◆ getFace()

Face & getFace ( int  i)
inline

Returns the 'i-th' face.

Parameters
iSpecifies the index of the face to retrieve.
1643{ return faces[i]; }
MaxSDK::BlockWrite_Ptr< Face, MaxSDK::MeshTopoChannelData > faces
The mesh faces. Faces are owned by the MaxSDK::MeshTopoChannelData channel.
Definition: mesh.h:1335

◆ getFacePtr()

Face * getFacePtr ( int  i)
inline

Returns a pointer to the 'i-th' face.

Parameters
iSpecifies the index of the face address to retrieve.
1647{ return faces + i; }

◆ setNumTVerts()

DllExport BOOL setNumTVerts ( int  ct,
BOOL  keep = FALSE 
)

Sets the number of texture vertices (in mapping channel 1).

Parameters
ctSpecifies the number of texture vertices.
keepSpecifies if the previous texture vertices should be kept. If TRUE the previous texture vertices are kept; otherwise they are discarded. Defaults to FALSE.
Returns
TRUE if storage was allocated and the number of texture vertices was set; otherwise FALSE.

◆ getNumTVerts()

int getNumTVerts ( void  ) const
inline

Returns the number of texture vertices (in mapping channel 1).

1664{ return numTVerts; }
MaxSDK::BlockWrite_Value< int, MaxSDK::MeshTextureMapChannelData > numTVerts
Number of texture vertices.
Definition: mesh.h:1451

◆ setNumTVFaces()

DllExport BOOL setNumTVFaces ( int  ct,
BOOL  keep = FALSE,
int  oldCt = 0 
)

Sets the number of TVFaces.

This method is automatically called if you set the number of faces to keep these two in sync (because the number of TVFaces should be the same as the number of faces). The following rules apply: If you have no TVFaces and keep is TRUE then the TVFaces array stays empty. If you have no TVFaces and keep is FALSE they are allocated. If you have TVFaces and ct = 0 then the TVFaces are freed.

Parameters
ctThe number of TVFaces.
keepSpecifies if the old faces should be kept.
oldCtThe length of the existing TVFaces array.
Returns
TRUE if storage has been allocated and the number is set; otherwise FALSE.

◆ setNumVertCol()

DllExport BOOL setNumVertCol ( int  ct,
BOOL  keep = FALSE 
)

Sets the number of color per vertex vertices.

Parameters
ctThe number of color vertices to set.
keepIf TRUE previous values are kept; otherwise they are discarded.
Returns
TRUE if the value was set; otherwise FALSE.

◆ getNumVertCol()

int getNumVertCol ( ) const
inline

Returns the number of color per vertex vertices.

1693{return numCVerts;}
MaxSDK::BlockWrite_Value< int, MaxSDK::MeshVertexColorChannelData > numCVerts
Number of color vertices.
Definition: mesh.h:1417

◆ setNumVCFaces()

DllExport BOOL setNumVCFaces ( int  ct,
BOOL  keep = FALSE,
int  oldCt = 0 
)

Sets the number of color per vertex faces.

Parameters
ctThe number of color per vertex faces to set.
keepSpecifies if the old faces should be kept if the array is being resized. If FALSE they are freed.
oldCtThe length of the existing VCFaces array.
Returns
TRUE if storage has been allocated and the number is set; otherwise FALSE.

◆ setVCDisplayData()

DllExport void setVCDisplayData ( int  mapChan = 0,
VertColor VCArray = NULL,
TVFace VCf = NULL 
)

This method would typically be called right before display, as with a node display callback, or through an extension object.

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. If the arrays are NULL then the internal source is used.

Parameters
mapChanthe mapping channel to use.
VCArrayAn external array hosting the vertex colors
VCfAn external array of TVFace indexing into the color array

◆ setNumMaps()

DllExport void setNumMaps ( int  ct,
BOOL  keep = FALSE 
)

Set the number of texture maps used by this Mesh.

Note that this call is made automatically if Mesh::setMapSupport() is called.

Parameters
ct- The number of texture maps to use. This is a value between 2 and MAX_MESHMAPS-1.
keep- TRUE to keep the old mapping information after the resize; FALSE to discard it.

◆ getNumMaps()

DllExport int getNumMaps ( ) const

Returns the number of mapping channels in use.

◆ mapSupport()

DllExport BOOL mapSupport ( int  mp) const

Returns TRUE if the specified mapping channel is supported; otherwise FALSE.

Parameters
mp- Specifies the channel. See the page "List of Mapping Channel Index Values".

◆ setMapSupport()

DllExport void setMapSupport ( int  mp,
BOOL  support = TRUE 
)

Sets whether the specified mapping channels is supported or not.

Parameters
mp- Specifies the channel. See the page "List of Mapping Channel Index Values".
support- TRUE to indicate the channel is supported; otherwise FALSE.

◆ setNumMapVerts()

DllExport void setNumMapVerts ( int  mp,
int  ct,
BOOL  keep = FALSE 
)

Sets the number of texture or vertex color vertices for the specified mapping channel of this mesh.

Parameters
mp- Specifies the channel. See the page "List of Mapping Channel Index Values".
ct- The number of vertices to allocate.
keep- If TRUE previous values are kept; otherwise they are discarded.

◆ getNumMapVerts()

DllExport int getNumMapVerts ( int  mp) const

Returns the number of texture or vertex color vertices for the specified channel of this mesh.

Parameters
mp- Specifies the channel. See "List of Mapping Channel Index Values".

◆ setNumMapFaces()

DllExport void setNumMapFaces ( int  mp,
int  ct,
BOOL  keep = FALSE,
int  oldCt = 0 
)

Sets the number of texture or vertex color faces for the specified channel of this mesh.

Parameters
mp- Specifies the channel. See the page "List of Mapping Channel Index Values".
ct- The number of faces to allocate.
keep- If TRUE previous values are kept; otherwise they are discarded.
oldCt- The length of the existing VCFaces array.

◆ getNumMapFaces()

DllExport int getNumMapFaces ( int  mp) const

Returns the number of texture or vertex color faces for the specified channel of this mesh.

Parameters
mp- Specifies the channel. See "List of Mapping Channel Index Values".

◆ mapVerts()

DllExport UVVert * mapVerts ( int  mp) const

Returns a pointer to the list of UVVerts for the specified channel of this mesh.

Parameters
mp- Specifies the channel. See the page "List of Mapping Channel Index Values".

◆ mapFaces()

DllExport TVFace * mapFaces ( int  mp) const

Returns a pointer to the list of TVFaces for the specified channel of this mesh.

Parameters
mp- Specifies the channel. See the page "List of Mapping Channel Index Values".

◆ setMapVert()

void setMapVert ( int  mp,
int  i,
const UVVert xyz 
)
inline

Sets a single texture or vertex color value for the specified channel of this mesh.

Parameters
mp- Specifies the channel. See the page "List of Mapping Channel Index Values".
i- The zero based index of the vertex to set.
xyz- The value to set.
1787{ if (mapVerts(mp)) mapVerts(mp)[i] = xyz; }
DllExport UVVert * mapVerts(int mp) const
Returns a pointer to the list of UVVerts for the specified channel of this mesh.

◆ MakeMapPlanar()

DllExport void MakeMapPlanar ( int  mp)

Applies a simple planar mapping to the specified channel.

This is done by copying the mesh topology and vertex locations into the map.

Parameters
mp- Specifies the channel. See the page "List of Mapping Channel Index Values".

◆ GetIsoMapVerts()

DllExport BitArray GetIsoMapVerts ( int  mp)

Returns a BitArray with a bit set for each isolated vertex (un-referenced by any face) for the specified channel.

Parameters
mp- Specifies the channel. See the page "List of Mapping Channel Index Values".

◆ DeleteMapVertSet()

DllExport void DeleteMapVertSet ( int  mp,
BitArray  set,
BitArray fdel = NULL 
)

Deletes the map vertices indicated.

Parameters
mpSpecifies the channel. See the page "List of Mapping Channel Index Values".
setIndicates which map verts should be deleted. set.GetSize() should equal this mesh's getNumMapVerts(mp).
fdelIf non-NULL, this points to a BitArray that will be filled in with the faces that will need to be deleted or have new map verts assigned because they used a map vert that was deleted. (The size will be set to this mesh's numFaces.)

◆ DeleteIsoMapVerts() [1/2]

DllExport void DeleteIsoMapVerts ( )

This method deletes each isolated vertex (un-referenced by any face) for the all active maps.

◆ DeleteIsoMapVerts() [2/2]

DllExport void DeleteIsoMapVerts ( int  mp)

This method deletes each isolated vertex (un-referenced by any face) for the specified channel.

Parameters
mpSpecifies the channel. See the page "List of Mapping Channel Index Values". The default value of -1 indicates to do all active maps.

◆ freeMapVerts()

DllExport void freeMapVerts ( int  mp)

Deallocates the texture or vertex color vertices for the specified channel of this mesh.

Parameters
mpSpecifies the channel. See the page "List of Mapping Channel Index Values".

◆ freeMapFaces()

DllExport void freeMapFaces ( int  mp)

Deallocates the texture or vertex color faces for the specified channel of this mesh.

Parameters
mpSpecifies the channel. See the page "List of Mapping Channel Index Values".

◆ Map() [1/2]

DllExport MeshMap const & Map ( int  mp) const

This method returns the map for the specified map channel.

Parameters
mp- The map channel.
Returns
Const reference to a MeshMap.

◆ Map() [2/2]

MeshMap & Map ( int  mp)
inline

This method returns the map for the specified map channel.

Parameters
mp- The map channel.
Returns
Reference to a MeshMap.
1840 {
1841 const Mesh* m = this;
1842 return const_cast<MeshMap&>(m->Map(mp));
1843 }
The Mesh class is provided for use by plug-ins and is used by the system.
Definition: mesh.h:1126
DllExport MeshMap const & Map(int mp) const
This method returns the map for the specified map channel.
In 3ds Max 3.0 and later the user may work with more than 2 mapping channels.
Definition: mesh.h:462

◆ setNumVData()

DllExport void setNumVData ( int  ct,
BOOL  keep = FALSE 
)

Sets the number of channels of vertex data used.

Parameters
ctThe number of elements of vertex data to set.
keepIf TRUE any old vertex data is kept; otherwise it is discarded.

◆ getNumVData()

DllExport int getNumVData ( ) const

Returns the number of vertex data channels.

◆ getNumVDataSupported()

DllExport int getNumVDataSupported ( ) const

Returns the number of active vertex data channels.

◆ vDataSupport()

DllExport BOOL vDataSupport ( int  vd) const

Returns TRUE if the specified channel of vertex data is available for this mesh; otherwise FALSE.

Parameters
vdThe vertex data channel. See the page "List of Vertex Data Index Options".

◆ setVDataSupport()

DllExport void setVDataSupport ( int  vd,
BOOL  support = TRUE 
)

Sets if the specified channel of vertex data is supported.

Parameters
vdThe vertex data channel. See the page "List of Vertex Data Index Options".
supportTRUE to indicate the channel is supported; FALSE to indicate it's not. If TRUE is specified then numVerts elements are allocated (if needed). If FALSE is specified the data for the channel is freed.

◆ GetVD()

DllExport PerData * GetVD ( int  vdChannel) const

Returns the vdChannel'th vertex data channels.

◆ vertexData()

void * vertexData ( int  vd) const
inline

Returns a pointer to the vertex data for the specified channel or NULL if the channel is not supported.

If supported then the size of this array is numVerts.

Parameters
vdThe vertex data channel. See the page "List of Vertex Data Index Options".
1879{ return vDataSupport(vd) ? GetVD(vd)->data : NULL; }
#define NULL
Definition: autoptr.h:18
DllExport BOOL vDataSupport(int vd) const
Returns TRUE if the specified channel of vertex data is available for this mesh; otherwise FALSE.
DllExport PerData * GetVD(int vdChannel) const
Returns the vdChannel'th vertex data channels.
void * data
Points to the actual data.
Definition: mesh.h:721

◆ vertexFloat()

float * vertexFloat ( int  vd) const
inline

Returns a pointer to the floating point vertex data for the specified channel of this mesh or NULL if the channel is not supported.

If supported then the size of this array is numVerts.

Parameters
vdThe vertex data channel. See the page "List of Vertex Data Index Options".
1885{ return (float *) vertexData (vd); }
void * vertexData(int vd) const
Returns a pointer to the vertex data for the specified channel or NULL if the channel is not supporte...
Definition: mesh.h:1879

◆ freeVData()

DllExport void freeVData ( int  vd)

Deallocates the vertex data for the specified chanel.

Parameters
vdThe vertex data channel. See the page "List of Vertex Data Index Options".

◆ freeAllVData()

DllExport void freeAllVData ( )

Deallocates the vertex data from all the channels and sets the number of supported channels to 0.

◆ getVertexWeights()

float * getVertexWeights ( )
inline

Returns a pointer to the floating point vertex weight data.

1897{ return vertexFloat(VDATA_WEIGHT); }
float * vertexFloat(int vd) const
Returns a pointer to the floating point vertex data for the specified channel of this mesh or NULL if...
Definition: mesh.h:1885
#define VDATA_WEIGHT
The vertex weight data.
Definition: mesh.h:668

◆ SupportVertexWeights()

void SupportVertexWeights ( )
inline

Sets the channel support for the vertex weights channel (VDATA_WEIGHT).

DllExport void setVDataSupport(int vd, BOOL support=TRUE)
Sets if the specified channel of vertex data is supported.

◆ ClearVertexWeights()

void ClearVertexWeights ( )
inline

Clears (deallocates) the vertex weights channel data.

1904{ setVDataSupport (VDATA_WEIGHT, FALSE); }

◆ freeVertexWeights()

void freeVertexWeights ( )
inline

Deallocates the vertex weights channel data (same as ClearVertexWeights() above).

DllExport void freeVData(int vd)
Deallocates the vertex data for the specified chanel.

◆ getVSelectionWeights()

float * getVSelectionWeights ( )
inline

Returns a pointer to the floating point vertex selection weights data.

1912{ return vertexFloat(VDATA_SELECT); }
#define VDATA_SELECT
The vertex soft selection data.
Definition: mesh.h:667

◆ SupportVSelectionWeights()

void SupportVSelectionWeights ( )
inline

Sets the channel support for the vertex weights channel (VDATA_SELECT).

◆ ClearVSelectionWeights()

void ClearVSelectionWeights ( )
inline

Clears (deallocates) the vertex selection weights channel data.

1919{ setVDataSupport (VDATA_SELECT, FALSE); }

◆ freeVSelectionWeights()

void freeVSelectionWeights ( )
inline

Deallocates the vertex selection weights channel data (same as ClearVSelectionWeights() above).

◆ setSmoothFlags()

DllExport void setSmoothFlags ( int  f)

This method should be called when the user has clicked on the 'Smooth' check box in a procedural object.

It invalidates the appropriate caches of the mesh so the display is updated properly. If this method is not called, the internal topology cache might prevent the mesh from appearing changed.

Parameters
fNonzero indicates smoothed; zero unsmoothed.

◆ getSmoothFlags()

DllExport int getSmoothFlags ( )

Returns the state of the smooth flags.

See setSmoothFlags() above.

◆ setVert() [1/2]

void setVert ( int  i,
const Point3 xyz 
)
inline

Sets a single vertex in the verts array.

Parameters
iA zero based index into the verts array of the vertex to store.
xyzSpecifies the coordinate of the vertex.
1949{ verts[i] = xyz; }
MaxSDK::BlockWrite_Ptr< Point3, MaxSDK::MeshGeomChannelData > verts
The mesh verts. Mesh verts are owned by the MaxSDK::MeshGeomChannelData channel.
Definition: mesh.h:1356

◆ setVert() [2/2]

void setVert ( int  i,
float  x,
float  y,
float  z 
)
inline

Sets a single vertex in the verts array.

Parameters
iA zero based index into the verts array of the vertex to store.
xSpecifies the X coordinate of the vertex.
ySpecifies the Y coordinate of the vertex.
zSpecifies the Z coordinate of the vertex.
1960{ verts[i].x=x; verts[i].y=y; verts[i].z=z; }
controller mat max min numsubs x z controller keys x z controller keys x z
Definition: generics.inl:214
controller mat max min numsubs x z controller keys x z controller keys x
Definition: generics.inl:212

◆ getVert()

Point3 & getVert ( int  i)
inline

Returns the 'i-th' vertex.

Parameters
iSpecifies the index of the vertex to retrieve.
1964{ return verts[i]; }

◆ getVertPtr()

Point3 * getVertPtr ( int  i)
inline

Returns a pointer to the 'i-th' vertex.

Parameters
iSpecifies the index of the vertex address to retrieve.
1968{ return verts+i; }

◆ GetVFlags()

long GetVFlags ( int  i)
inline

Returns flags specific to the corresponding vertex in the verts array.

Owned by the MaxSDK::MeshGeomChannelData channel.

Parameters
iSpecifies the index of the vertex address to retrieve the flags for.
1972{ return vFlags[i]; }
MaxSDK::BlockWrite_Ptr< long, MaxSDK::MeshGeomChannelData > vFlags
Holds flags specific to the corresponding vertex in the verts array. Owned by the MaxSDK::MeshGeomCha...
Definition: mesh.h:1365

◆ setTVert() [1/2]

void setTVert ( int  i,
const UVVert xyz 
)
inline

Sets a single texture vertex in the tVerts array.

Parameters
iA zero based index into the tVerts array of the texture vertex to store.
xyzSpecifies the coordinate of the vertex.
1983{ tVerts[i] = xyz; }
MaxSDK::BlockWrite_Ptr< UVVert, MaxSDK::MeshTextureMapChannelData > tVerts
The array of texture vertices.
Definition: mesh.h:1465

◆ setTVert() [2/2]

void setTVert ( int  i,
float  x,
float  y,
float  z 
)
inline

Sets a single texture vertex in the tVerts array.

Parameters
iA zero based index into the tVerts array of the texture vertex to store.
xSpecifies the X coordinate of the texture vertex.
ySpecifies the Y coordinate of the texture vertex.
zSpecifies the Z coordinate of the texture vertex.
1994{ tVerts[i].x=x; tVerts[i].y=y; tVerts[i].z=z; }

◆ getTVert()

UVVert & getTVert ( int  i)
inline

Returns the 'i-th' texture vertex.

Parameters
iSpecifies the index of the texture vertex to retrieve.
1998{ return tVerts[i]; }

◆ getTVertPtr()

UVVert * getTVertPtr ( int  i)
inline

Returns a pointer to the 'i-th' texture vertex.

Parameters
iSpecifies the index of the texture vertex address to retrieve.
2002{ return tVerts+i; }

◆ setNormal()

DllExport void setNormal ( int  i,
const Point3 xyz 
)

Sets a single 'rendered' normal in the rVerts array of RVertex instances.

Parameters
iA zero based index into the rVerts array of the normal to store.
xyzThe normal to store in device coordinates. This should be a unit vector.

◆ getNormal()

DllExport Point3 & getNormal ( int  i)

Returns the 'i-th' 'rendered' normal from the rVerts array.

Parameters
iA zero based index into the rVerts array of the normal to get.

◆ setFaceNormal()

DllExport void setFaceNormal ( int  i,
const Point3 xyz 
)

Sets the 'i-th' face normal.

Parameters
iA zero based index into the face normal array of the normal to store.
xyzThe face normal to store. This should be a unit vector.

◆ getFaceNormal()

DllExport Point3 & getFaceNormal ( int  i)

Returns the 'i-th' face normal.

Parameters
iSpecifies the index of the face normal to retrieve.

◆ getFaceNormalPtr()

DllExport Point3 * getFaceNormalPtr ( int  i)

Returns a pointer to the 'i-th' face normal.

Parameters
iSpecifies the index of the face normal to retrieve.

◆ buildNormals()

DllExport void buildNormals ( )

This method resolves the normals on the RVertex array.

If the Mesh already has normals at each vertex, the normal is just moved to the RVertex array. See Class RVertex and Class RNormal. If you are creating a Mesh by hand, after you are done specifying all the vertices and faces, this method should be called. This allocates the RVertex and RNormal database for the Mesh. This will allow you to query the Mesh and ask about normals on the vertices. Also, if you deform a Mesh (i.e. take one of the vertices and move it), you should call this method again. Actually, if you are only moving one normal you only need to smooth the polygons that share the vertex. However, there is no method to smooth a subset of a Mesh, you either have to do it by hand or call this method to smooth the entire Mesh. This method also builds the face normals for the mesh.

◆ buildRenderNormals()

DllExport void buildRenderNormals ( )

This method is similar to buildNormals() above, but ignores the material index (mtlIndex).

In other words, the difference between this and buildNormals() is that it doesn't look at the mtlIndex of the faces: normals of faces with the same smoothing group are averaged regardless.

◆ checkNormals()

DllExport void checkNormals ( BOOL  illum)

This method can be used to build the normals and allocate RVert space only if necessary.

This is a very inexpensive call if the normals are already calculated. When illum is FALSE, only the RVerts allocation is checked (since normals aren't needed for non-illum rendering). When illum is TRUE, normals will also be built, if they aren't already. So, to make sure normals are built, call this with illum=TRUE.

Parameters
illumIf TRUE then normals are built. If FALSE then only the RVert array is allocated.

◆ getRVert()

DllExport RVertex & getRVert ( int  i)

This method returns the 'i-th' RVertex.

Parameters
iSpecifies the index of the RVertex to retrieve.

◆ getRVertPtr()

DllExport RVertex * getRVertPtr ( int  i)

This method returns a pointer to the 'i-th' RVertex.

Parameters
iSpecifies the index of the RVertex to retrieve.

◆ getFaceMtlIndex()

DllExport MtlID getFaceMtlIndex ( int  i)

Retrieves the zero based material index of the 'i-th' face.

Parameters
iSpecifies the face index. This is the zero based index into the faces array.

◆ setFaceMtlIndex()

DllExport void setFaceMtlIndex ( int  i,
MtlID  id 
)

Sets the material index of the 'i-th' face.

Parameters
iSpecifies the face index. This is the zero based index into the faces array.
idThe material index for the 'i-th' face.

◆ render()

DllExport void render ( GraphicsWindow gw,
Material ma,
RECT *  rp,
int  compFlags,
int  numMat = 1,
InterfaceServer is = NULL 
)

Renders this Mesh using the specified graphics window and array of materials.

Note: If a display routine makes multiple calls to this method you need to have called: gw->setMaterial(inode->Mtls()[0]); before calling Mesh::render(). If you don't then you may get the wrong material for material ID 0.

Parameters
gwPoints to the graphics window to render to.
maThe list of materials to use to render the mesh. See Class Material and the topic "Class INode - Material methods".
rpSpecifies the rectangular region to render. If the mesh should be rendered to the entire viewport pass NULL.
compFlagsOne or more of the following flags:
  • COMP_TRANSFORM Forces recalculation of the model to screen transformation; otherwise attempt to use the cache.
  • COMP_IGN_RECT Forces all polygons to be rendered; otherwise only those intersecting the box will be rendered.
  • COMP_LIGHTING Forces re-lighting of all vertices (as when a light moves); otherwise only re-light moved vertices
  • COMP_ALL All of the above flags.
  • COMP_OBJSELECTED If this bit is set then the node being displayed by this mesh is selected. Certain display flags only activate when this bit is set.
numMatThe number of materials for the mesh.
isThis pointer to an InterfaceServer can be used to get hold of the IXTCAccess pointer. And IXTCAccess interface can also be obtained from the object by calling Object::GetInterface (IXTCACCESS_INTERFACE_ID).
Sample Code:
The following code shows this method being used to render the mesh as part of the SimpleObject implementation of the BaseObject::Display() method:
int SimpleObject::Display(TimeValue t, INode* inode, ViewExp *vpt, int flags)
{
if (!OKtoDisplay(t))
return 0;
GraphicsWindow *gw = vpt->getGW();
Matrix3 mat = inode->GetObjectTM(t);
UpdateMesh(t); // UpdateMesh() just calls BuildMesh()
gw->setTransform(mat);
mesh.render(gw, inode->Mtls(), (flags&USE_DAMAGE_RECT) ? &vpt->GetDammageRect() : NULL, COMP_ALL, inode->NumMtls());
return(0);
}
virtual int Display(TimeValue t, INode *inode, ViewExp *vpt, int flags)
This is called by the system to have the item display itself (perform a quick render in viewport,...
Definition: object.h:599
Definition: GraphicsWindow.h:73
virtual void setTransform(const Matrix3 &m)=0
Definition: inode.h:55
virtual Material * Mtls()=0
virtual int NumMtls()=0
virtual Matrix3 GetObjectTM(TimeValue time, Interval *valid=NULL)=0
Definition: matrix3.h:99
Definition: maxapi.h:795
virtual Rect GetDammageRect()=0
virtual GraphicsWindow * getGW()=0
#define USE_DAMAGE_RECT
If this flag is set, only the damaged area needs to be displayed.
Definition: object.h:500
#define COMP_ALL
Combination of COMP_TRANSFORM, COMP_IGN_RECT and COMP_LIGHTING.
Definition: MeshFaceFlagConstants.h:65
int TimeValue
Definition: maxtypes.h:31

◆ snap()

DllExport void snap ( GraphicsWindow gw,
SnapInfo snap,
IPoint2 p,
Matrix3 tm 
)

Checks to see if there is a snap point near the given mouse point.

Parameters
gwThe graphics window in which to check.
snapThis structure describes the snap settings used, and the results of the snap test. See the title "Structure SnapInfo".
pThe mouse point to check.
tmThe object transformation matrix. This is the transformation to place the object into the world coordinate system.
Sample Code:
Checks to see if there is a snap point near the given mouse point.
void TestObject::Snap(TimeValue t, INode* inode, SnapInfo *snap, IPoint2 *p, ViewExp *vpt)
{
// Grab the object TM
Matrix3 tm = inode->GetObjectTM(t);
// Grab the graphics window
GraphicsWindow *gw = vpt->getGW();
// Make sure our mesh is up to date
UpdateMesh(t); // UpdateMesh() just calls BuildMesh()
// Set the transform in the GW
gw->setTransform(tm);
// Let the mesh do the work...
mesh.snap( gw, snap, p, tm );
}
Definition: ipoint2.h:30
DllExport void snap(GraphicsWindow *gw, SnapInfo *snap, IPoint2 *p, Matrix3 &tm)
Checks to see if there is a snap point near the given mouse point.
Describes the snap settings used for snap operations.
Definition: snap.h:91

◆ displayNormals()

void displayNormals ( int  b,
float  sc 
)
inline

Note that there may be more than one normal per vertex if faces that share the vertex are in non-overlapping smoothing groups.

In this case, all normals associated with the given vertex are drawn.

Parameters
bNonzero to display the normals; zero to turn off normals display. This can be a combination of MESH_DISP_FACE_NORMALS and MESH_DISP_VERTEX_NORMALS. (The arguments may be or'ed together to display both.) For backwards compatibility, MESH_DISP_FACE_NORMALS is defined to be 1, so sending in TRUE will turn on display of face normals, as before.
scThis specifies the length that should be used (in world units) to display the normals. Since all normals start out with length equal to 1 they probably would be too small to see unless they were scaled
2213 {
2214 DbgAssert(b <= 0xff);
2215 DbgAssert(b >= 0);
2216 dspNormals = (BYTE)b;
2217 if(sc != 0.0f)
2218 norScale = sc;
2219 }
#define DbgAssert(expr)
Definition: assert1.h:83
float float b
Definition: texutil.h:51

◆ displayAllEdges()

void displayAllEdges ( int  b)
inline

Controls the display of hidden edges of this mesh object.

This just sets the Boolean in the mesh that controls whether "hidden" edges (for instance the diagonals on the sides of a cube) are displayed.

Parameters
bNonzero to display all the hidden edges; otherwise zero.
2231 {
2232 DbgAssert(b <= 0xff);
2233 DbgAssert(b >= 0);
2234 dspAllEdges = (BYTE)b;
2235 }

◆ InvalidateGeomCache()

DllExport void InvalidateGeomCache ( )

Call this method after the geometry of this Mesh has changed.

It invalidates the bounding box, and tosses out the cached normals and edge list.

◆ InvalidateTopologyCache()

DllExport void InvalidateTopologyCache ( )

Call this method after you alter vertex or face lists or revise edge visibility flags.

It will invalidate the edge and strip database maintained by the mesh.

◆ FreeAll()

DllExport void FreeAll ( )

Cleans up the allocated arrays.

This frees the Faces, Verts, TVerts, TVFaces, FaceMtlIndexList and invalidates the geometry cache.

◆ EnableEdgeList()

DllExport void EnableEdgeList ( int  e)

This method is used internally.

◆ BuildVisEdgeList()

DllExport void BuildVisEdgeList ( )

This method is used internally.

◆ DrawVisEdgeList()

DllExport void DrawVisEdgeList ( GraphicsWindow gw,
DWORD  vflags 
)

This is used internally.

◆ Draw3DVisEdgeList()

DllExport void Draw3DVisEdgeList ( GraphicsWindow gw,
DWORD  vflags 
)

◆ HitTestVisEdgeList()

DllExport void HitTestVisEdgeList ( GraphicsWindow gw,
int  abortOnHit 
)

This is used internally.

◆ InvalidateEdgeList()

DllExport void InvalidateEdgeList ( )

This is used internally.

◆ buildBoundingBox()

DllExport void buildBoundingBox ( void  )

Computes the bounding box of the Mesh.

If surface normals are displayed, they are taken into account in the computation of the box. The bounding box is stored with the Mesh object, use getBoundingBox() to retrieve it.

◆ BuildTransformedBoundingBox()

DllExport void BuildTransformedBoundingBox ( const Matrix3 transformMat)

If the transformed bounding box presently stored by this mesh is invalid, or corresponds to a transformation differing from that defined the specified matrix transformMat, then the stored transformed bounding box is updated to reflect the transformation of the mesh into the space defined by transformMat.

The computed bounding box will then be accessible via a call to getBoundingBox with *tm = transformMat.

Parameters
[in]transformMattransformation matrix, including translation vector, defining the transformation from this mesh's object space, to the space in which the bounding box is to be computed

◆ getBoundingBox()

DllExport Box3 getBoundingBox ( Matrix3 tm = NULL)

Retrieves the bounding box of the mesh object.

If an up-to-date bounding box corresponding to the specified transformation tm is not available, it will be generated via a call to buildBoundingBox, if tm = nullptr, or BuildTransformedBoundingBox, otherwise.

Parameters
tmThe optional TM allows the box to be calculated in any space. NOTE: This computation will be slower because all the points must be transformed.
Returns
The bounding box of the Mesh.

◆ BuildStrips()

DllExport BOOL BuildStrips ( )

It builds the strips database inside the mesh.

See the method BuildStripsAndEdges() below.

◆ Stripify() [1/2]

DllExport void Stripify ( Strip s,
StripData sd,
int  vtx 
)

This method is used internally.

◆ Stripify() [2/2]

DllExport void Stripify ( Strip s,
StripData sd,
int  vtx,
DWTab v,
DWTab n,
DWTab tv 
)

It builds the strips database inside the mesh.

See the method BuildStripsAndEdges() below.

◆ getStripVertColor()

DllExport void getStripVertColor ( GraphicsWindow gw,
int  cv,
int  flipped,
MtlID  mID,
DWORD  smGroup,
Point3 rgb 
)

This method is used internally.

◆ getStripNormal()

DllExport void getStripNormal ( int  cv,
MtlID  mID,
DWORD  smGroup,
Point3 nor 
)

This method is used internally.

◆ getStripNormalIndex()

DllExport int getStripNormalIndex ( int  cv,
MtlID  mID,
DWORD  smGroup 
)

It builds the strips database inside the mesh.

See the method BuildStripsAndEdges() below.

◆ getStripTVert()

DllExport BOOL getStripTVert ( GraphicsWindow gw,
int  cv,
int  ctv,
Point3 uvw,
int  texNum = 0 
)

This method is used internally.

◆ DrawStrips()

DllExport void DrawStrips ( GraphicsWindow gw,
Material ma,
int  numMat 
)

This method is used internally.

◆ Draw3DStrips()

DllExport void Draw3DStrips ( GraphicsWindow gw,
Material ma,
int  numMat 
)

This method is used internally.

◆ Draw3DWireStrips()

DllExport void Draw3DWireStrips ( GraphicsWindow gw,
Material ma,
int  numMat 
)

It builds the strips database inside the mesh.

See the method BuildStripsAndEdges() below.

◆ InvalidateStrips()

DllExport void InvalidateStrips ( )

This method invalidates the strips database.

◆ BuildStripsAndEdges()

DllExport void BuildStripsAndEdges ( )

This method builds the strips and edges database inside the mesh.

When developers create a new mesh for display then this method should be called. See the Mesh Stripping topic in the Meshes section for more information about this method.

◆ ShallowCopy()

DllExport void ShallowCopy ( Mesh amesh,
ChannelMask  channels 
)

Shallow copy the specified channel objects of the specified Mesh.

This means that the data channel objects are shared between the two meshes.

Parameters
amesh- Specifies the source Mesh to copy.
channels- Specifies the channels to copy. See Object Channels.
See also
MaxSDK::MeshChannelContainer

◆ DeepCopy()

DllExport void DeepCopy ( Mesh amesh,
ChannelMask  channels 
)

Makes a complete copy of the specified channel objects from the specified Mesh and store them into this Mesh.

Parameters
amesh- Specifies the source Mesh to copy.
channels- Specifies the channels to copy. See Object Channels.
See also
MaxSDK::MeshChannelContainer

◆ NewAndCopyChannels()

DllExport void NewAndCopyChannels ( ChannelMask  channels)

This method clones the specified channel objects and stores those in the channel container.

There is no risk of leaking channel objects.

Parameters
channels- Specifies the channels to copy. See Object Channels.
See also
MaxSDK::MeshChannelContainer

◆ FreeChannels()

DllExport void FreeChannels ( ChannelMask  channels,
int  zeroOthers = 1 
)

Drop the channel objects specified by the channels argument.

No risk of leaking channel objects. For example if the TOPO_CHANNEL is specified, MeshTopoChannelData is freed, if the GEOM_CHANNEL is specified then MeshGeomChannelData is freed, etc. Number of maps are always preserved. As of 3ds Max 2024, if any MeshMap channels are specified, they flags are also reset.

Parameters
channels- Specifies the channels to free. Channels not specified are left intact. See Object Channels.
zeroOthers- If nonzero then the topo, geom, vert color, tex map and hidden maps are cleared out.
See also
Mesh::ShallowCopy(Mesh *amesh, ChannelMask channels)
MaxSDK::MeshChannelContainer

◆ SetFlag()

void SetFlag ( DWORD  f)
inline

Sets the state of the mesh flags.

Parameters
fSpecifies the flags to set. See Mesh, Vertex and Face Flags
2377{ flags |= f; }

◆ GetFlag()

DWORD GetFlag ( DWORD  f)
inline

Returns the state of the specified mesh flags.

See Data Members: above for a list of the mesh flags.

Parameters
fSpecifies the flags to retrieve. See Mesh, Vertex and Face Flags
2382{ return flags & f; }

◆ ClearFlag()

void ClearFlag ( DWORD  f)
inline

Sets the state of the specified mesh flags to 0.

Parameters
fSpecifies the flags to clear. See Mesh, Vertex and Face Flags
2386{ flags &= ~f; }

◆ SetDispFlag()

void SetDispFlag ( DWORD  f)
inline

Sets the state of the display flags.

See Data Members: above for a list of the display flags.

Parameters
fSpecifies the flags to set.
2393{ dispFlags |= f; }
DWORD dispFlags
Display attribute flags.
Definition: mesh.h:1543

◆ GetDispFlag()

DWORD GetDispFlag ( DWORD  f)
inline

Returns the state of the specified display flags.

See Data Members: above for a list of the display flags.

Parameters
fSpecifies the flags to retrieve.
2398{ return dispFlags & f; }

◆ ClearDispFlag()

void ClearDispFlag ( DWORD  f)
inline

Sets the state of the specified display flags to 0.

Parameters
fSpecifies the flags to clear.
2402{ dispFlags &= ~f; }

◆ VertSel() [1/2]

DllExport BitArray & VertSel ( )

Retrieves the bits representing the vertex selection status.

Returns
The vertex selection status.

◆ VertSel() [2/2]

DllExport const BitArray * VertSel ( ) const
See also
Mesh::VertSel()

◆ FaceSel() [1/2]

DllExport BitArray & FaceSel ( )

Retrieves the bits representing the face selection status.

Returns
The face selection status.

◆ FaceSel() [2/2]

DllExport const BitArray * FaceSel ( ) const
See also
Mesh::FaceSel()

◆ EdgeSel() [1/2]

DllExport BitArray & EdgeSel ( )

Retrieves the bits representing the the selected edges status.

Returns
The selected edges status.

◆ EdgeSel() [2/2]

DllExport const BitArray * EdgeSel ( ) const
See also
Mesh::EdgeSel()

◆ VertHide() [1/2]

DllExport BitArray & VertHide ( )

Retrieves the bits representing the hidden flags for vertices.

Returns
The hidden vertex status.

◆ VertHide() [2/2]

DllExport const BitArray * VertHide ( ) const

◆ VertexTempSel()

DllExport BitArray VertexTempSel ( )

Constructs a vertex selection list based on the current selection level.

For example if the selection level is at object level all the bits are set (vertices, faces and edges). If the selection level is at vertex level only the selected vertex bits are set.

Returns
A BitArray reflecting the current selection level.
Sample Code:
BitArray sel = mesh->VertexTempSel();
for ( int i = 0; i < mesh->getNumVerts(); i++ )
{
if ( sel[i] ) {
...
}
}
Definition: bitarray.h:59

◆ Save() [1/2]

DllExport IOResult Save ( ISave isave)

◆ Load() [1/2]

DllExport IOResult Load ( ILoad iload)

◆ Save() [2/2]

DllExport IOResult Save ( ISave isave,
ChannelMask  channels 
)

◆ Load() [2/2]

DllExport IOResult Load ( ILoad iload,
ChannelMask  channels 
)

◆ operator+()

DllExport Mesh operator+ ( Mesh mesh)

Performs a boolean union operation.

Parameters
meshSpecifies the mesh to use as the other operand of the boolean operation.
Returns
A new Mesh resulting from the boolean operation. If the operation fails an empty Mesh is returned.

◆ operator-()

DllExport Mesh operator- ( Mesh mesh)

Performs a boolean difference operation.

Parameters
meshSpecifies the mesh to use as the other operand of the boolean operation.
Returns
A new Mesh resulting from the boolean operation. If the operation fails an empty Mesh is returned.

◆ operator*()

DllExport Mesh operator* ( Mesh mesh)

Performs a boolean intersection operation.

Parameters
meshSpecifies the mesh to use as the other operand of the boolean operation.
Returns
A new Mesh resulting from the boolean operation. If the operation fails an empty Mesh is returned.

◆ MyDebugPrint()

DllExport void MyDebugPrint ( )

◆ WeldCollinear()

DllExport void WeldCollinear ( BitArray set)

This method is used internally.

◆ Optimize()

DllExport void Optimize ( float  normThresh,
float  edgeThresh,
float  bias,
float  maxEdge,
DWORD  vflags,
MeshOpProgress prog = NULL 
)

Allows this Mesh to be reduced in complexity by reducing the number of faces based on a surface normal threshold.

Adjacent faces whose difference in surface normal angle falls below the specified threshold will be collapsed into a single triangle. The Mesh may also have its edge visibility set based on a surface normal threshold.

Parameters
normThreshWhen the angle between adjacent surface normals is less than this value the optimization is performed. This angle is specified in radians.
edgeThreshWhen the angle between adjacent surface normals is less than this value the auto edge is performed (if the OPTIMIZE_AUTOEDGE flag is set). This angle is specified in radians.
biasWhen optimizing mesh objects, as the optimization increases, you can get lots of long skinny 'degenerate' triangles (that cause rendering artifacts). Increasing the bias parameter keeps triangles from becoming degenerate. The range of values is from 0 to 1 (where 0 turns bias off). Values close to 1 reduce the amount of optimization in favor of maintaining equilateral triangles.
maxEdgeThis parameter is available in release 2.0 and later only. This will prevent the optimize function from creating edges longer than this value. If this parameter is <=0 no limit is placed on the length of the edges.
vflagsThese flags control the optimization. Specify zero or more of the Optimization Flags
progA callback used for lengthy optimize operations. See Class MeshOpProgress.

◆ ApplyUVWMap()

DllExport void ApplyUVWMap ( int  type,
float  utile,
float  vtile,
float  wtile,
int  uflip,
int  vflip,
int  wflip,
int  cap,
const Matrix3 tm,
int  channel = 1 
)

This method may be called to map this Mesh with UVW mapping coordinates.

Parameters
typeThe mapping type. One of the following values:
  • MAP_PLANAR
  • MAP_CYLINDRICAL
  • MAP_SPHERICAL
  • MAP_BALL
  • MAP_BOX
utileNumber of tiles in the U direction.
vtileNumber of tiles in the V direction.
wtileNumber of tiles in the W direction.
uflipIf nonzero the U values are mirrored.
vflipIf nonzero the V values are mirrored.
wflipIf nonzero the W values are mirrored.
capThis is used with MAP_CYLINDRICAL. If nonzero, then any face normal that is pointing more vertically than horizontally will be mapped using planar coordinates.
tmThis defines the mapping space. As each point is mapped, it is multiplied by this matrix, and then it is mapped.
channelThis parameter is available in release 2.0 and later only. This indicates which channel the mapping is applied to – channel==1 corresponds to the original texture mapping channel.

◆ ApplyMapper()

DllExport void ApplyMapper ( UVWMapper map,
int  channel = 1 
)

This method is used internally.

◆ FlipNormal()

DllExport void FlipNormal ( int  i)

Flips the surface normal of the 'i-th' face (this just rearranges the indices for the face structure).

This also makes sure the edge flags are rearranged as well. If there are UV coordinates they are rearranged appropriately.

Parameters
iThe index of the face to flip.

◆ UnifyNormals()

DllExport void UnifyNormals ( BOOL  selOnly)

Unifies the surfaces normals of this Mesh.

This may be for selected faces, or the entire mesh.

Parameters
selOnlyIf TRUE only the selected faces are unified.

◆ AutoSmooth()

DllExport void AutoSmooth ( float  angle,
BOOL  useSel,
BOOL  preventIndirectSmoothing = FALSE 
)

Performs an auto smooth on the mesh, setting the smoothing groups based on the surface normals.

Parameters
angleThe minimum angle between surface normals for smoothing to be applied, in radians.
useSelIf TRUE only the selected faces are smoothed.
preventIndirectSmoothingThis parameter is available in release 2.0 and later only. TRUE to turn on; FALSE to leave off. This matches the option in the Smooth Modifier UI – use this to prevent smoothing 'leaks" when using this method. If you use this method, and portions of the mesh that should not be smoothed become smoothed, then try this option to see if it will correct the problem. Note that the problem it corrects is rare, and that checking this slows the Auto Smooth process.

◆ MakeEdgeList()

DllExport Edge * MakeEdgeList ( int edgeCount,
int  flagdbls = 0 
)

This method is used internally.

◆ DeleteFlaggedFaces()

DllExport int DeleteFlaggedFaces ( )

This method removes faces from the face list with the FACE_WORK flag set.

Returns
The number of faces deleted.

◆ DeleteSelected()

DllExport void DeleteSelected ( )

Deletes all selected elements of the current selection level.

◆ DeleteVertSet()

DllExport void DeleteVertSet ( BitArray  set)

Deletes the vertices as specified by the BitArray.

Parameters
setSet of bits to indicate the vertices to delete.

◆ DeleteFaceSet()

DllExport void DeleteFaceSet ( BitArray  set,
BitArray isoVert = NULL 
)

Deletes faces as specified by the BitArray.

Parameters
setSet of bits to indicate the faces to delete.
isoVertIf non NULL then this method will be setup to flag vertices that were isolated by the face deletion. This set can then be passed to DeleteVertSet() to delete isolated vertices.

◆ DoesFaceExist()

DllExport BOOL DoesFaceExist ( DWORD  v0,
DWORD  v1,
DWORD  v2 
)

This method may be called to determine if an equivalent face already exists.

Parameters
v0Index of the first vertex.
v1Index of the second vertex.
v2Index of the third vertex.
Returns
TRUE if an equivalent face already exists; otherwise FALSE.

◆ RemoveDegenerateFaces()

DllExport BOOL RemoveDegenerateFaces ( )

Removes faces that have two or more equal indices.

Returns
TRUE if any degenerate faces were found; otherwise FALSE.

◆ RemoveIllegalFaces()

DllExport BOOL RemoveIllegalFaces ( )

Removes faces that have indices that are out of range.

Returns
TRUE if any illegal faces were found; otherwise FALSE.

◆ FaceNormal()

DllExport Point3 FaceNormal ( DWORD  fi,
BOOL  nrmlize = FALSE 
) const

This method returns the normal of the specified face.

If nrmlize is TRUE, it makes this normal unit length. Otherwise, it's the edge cross-product length, which is actually 2 times the area of the face.

Parameters
fiSpecifies the face whose normal is returned.
nrmlizeUse TRUE to make the normal unit length.

◆ FaceCenter()

DllExport Point3 FaceCenter ( DWORD  fi) const

This method returns the center of the specified face.

Parameters
fiSpecifies the face whose center is returned.

◆ AngleBetweenFaces()

DllExport float AngleBetweenFaces ( DWORD  f0,
DWORD  f1,
const Point3 faceNormals = nullptr 
) const

Returns the angle between two face surface normals in radians.

Parameters
f0Index of the first face.
f1
faceNormalsan optional parameter to pass in a precomputed face normal list so you can improve performance Index of the second face.

◆ BaryCoords()

DllExport Point3 BaryCoords ( DWORD  face,
Point3  p 
) const

Computes and returns the barycentric coordinates of a point in the plane of a face relative to that face.

Parameters
faceThe index of the face to check.
pThe input point.
Returns
The point p barycentric coordinates. If the point p is inside the face the returned values will sum to one. Note: If the face (or set of 3 points) is degenerate, ie if it has a zero length normal vector ((p1-p0)^(p2-p0)), the methods return Point3(-1,1,1).

◆ DivideEdge()

DllExport void DivideEdge ( DWORD  edge,
float  prop = .5f,
bool  visDiag1 = TRUE,
bool  fixNeighbors = TRUE,
bool  visDiag2 = TRUE 
)

Divides the edge, creating a new point.

The face directly using this edge (face edge/3) is also divided in two, and other faces using the edge may optionally be split to use the split edges.

Parameters
edgeThe edge to divide.
propThe proportion along the edge to make the division. An edge can be expressed as ff*3+ee, where ff is a face using this edge and ee represents which pair of vertices the edge is between, faces[ff]->v[ee] and faces[ff]->v[(ee+1)%3]. The new point is created at (1-prop) times the first vertex plus prop times the second. prop may vary from 0 to 1. prop=.5 gives the same result that DivideEdge (DWORD edge) would generate.
visDiag1
Indicates whether the "diagonal" used to split the primary face this edge is on (edge/3) is visible or not.
fixNeighbors
Indicates whether other faces using this edge should also be split to use the two new edges, or if they should be left as they were. In a typical mesh, there is one other face using this edge, the face on the "other side" of the edge. If fixNeighbors is FALSE, the "other side" in this case would still use the original edge, while the face on this side would be split to use the two new edges. This would create a "hole" in the mesh.
visDiag2Indicates whether the "diagonals" used to split other faces using this edge are visible or not. This argument is not used if fixneighbors is FALSE.

◆ DivideFace()

DllExport void DivideFace ( DWORD  face,
DWORD  e1,
DWORD  e2,
float  prop1 = .5f,
float  prop2 = .5f,
bool  fixNeighbors = TRUE,
bool  split = FALSE 
)

Cuts a face into three faces, arranged as a quad and a triangle, by slicing from a point on one edge to a point on another.

Parameters
faceThe face to be divided.
e1,e2The index of edges to be cut. For instance, if you wanted to cut from the edge between v[0] and v[1], to the edge between v[2] and v[0], you would use e1=0 and e2=2.
prop1The proportion along edge e1 to start cutting.
prop2The proportion along edge e2 to stop cutting.
fixNeighborsIndicates whether faces also using the cut edges should be split to use the new, subdivided edges.
splitIndicates that the triangle and quad created by this action should use different vertices. If TRUE, the vertices created by the cut are duplicated, with one set being used for faces on one side and the other set being used by faces on the other side.

◆ TurnEdge()

DllExport void TurnEdge ( DWORD  edge,
DWORD *  otherEdge = NULL 
)

Turns an edge.

The quadrilateral formed by the triangles on either side of this edge essentially has its diagonal switched.

Parameters
edgeThe edge to be turned.
otherEdgeIf non-NULL, this should point to a variable in which the index of the "other side" of this edge should be stored. In essence, the two sides of an edge used by two faces, f1 and f2, are stored in two different locations, f1*3+e1 and f2*3+e2, where e1, e2 are 0, 1, or 2. This argument is provided so you have easy access to the other side of the edge, if desired, to make easy selection or visibility changes to the edge or other changes to the faces on both sides.

◆ FaceCenterTessellate()

DllExport void FaceCenterTessellate ( BOOL  ignoreSel = FALSE,
MeshOpProgress mop = NULL 
)

Tessellates the mesh (or only the selected faces) using the face/center method.

This means each face is subdivided by lines from a new vertex at the center to the original vertices.

Parameters
ignoreSel
If TRUE the entire mesh is tessellated; otherwise only the selected faces.
mopA callback that can be used for lengthy operations. If you want to get updated on the progress of the operation being performed, pass a pointer to your callback, and the function will call the MeshOpProgress methods as it progresses. The MeshOpProgress object can return FALSE to its MeshOpProgress::Progress method to cancel the operation.

◆ EdgeTessellate()

DllExport void EdgeTessellate ( float  tens,
BOOL  ignoreSel = FALSE,
MeshOpProgress mop = NULL 
)

Edge tessellates the mesh using the specified tension parameter.

This method can operate on the entire mesh or only the selection set. Edge tessellation means that faces are internally subdivided, with additional faces generated from a new vertex in the middle of each face edge.

Parameters
tensThe tension setting. This value can range from -100.0 to 100.0. This value matches the parameter in the Editable Mesh user interface when tessellating faces.
ignoreSelIf TRUE the entire mesh is tessellated; otherwise only the selected faces.
mopA callback that can be used for lengthy operations. If you want to get updated on the progress of the operation being performed, pass a pointer to your callback, and the function will call the MeshOpProgress methods as it progresses. The MeshOpProgress object can return FALSE to its MeshOpProgress::Progress method to cancel the operation.

◆ ExtrudeFaces()

DllExport void ExtrudeFaces ( BOOL  doFace = TRUE)

Extrudes the selected faces.

Note that this is just a topological change. The new extruded faces do not change position but are left on top of the original faces.

Parameters
doFaceIf TRUE the faces are extruded. If FALSE then the selected edges are extruded.

◆ IndentSelFaces()

DllExport void IndentSelFaces ( float  amount)

Indents the selected faces, in a manner consistent with the outlining used in Bevel.

Parameters
amountThe amount to indent.

◆ BreakVerts()

DllExport void BreakVerts ( BitArray  set)

Splits the vertices specified in the BitArray so that they are only used by a single face.

Parameters
setThis array of bits, one per vertex in the mesh. If the bit is set, the corresponding vertex in the mesh is copied as required so it is only used by a single face. If the bit is not set the vertex is ignored.

◆ GetIsoVerts()

DllExport BitArray GetIsoVerts ( )

This method returns a BitArray (of size numVerts), where isolated verts are selected.

◆ DeleteIsoVerts()

DllExport void DeleteIsoVerts ( )

Deletes the vertices that aren't used by any faces.

◆ CloneFaces()

DllExport void CloneFaces ( BitArray  fset)

Creates a copy of the faces and verts used by those faces as specified by the BitArray passed.

If texture faces and vertex color faces are present they are cloned as well.

Parameters
fsetThere is one bit in this array for each face in the mesh. If the bit is set, the corresponding face in the mesh is cloned. If the bit is zero the face is not cloned.

◆ PolyFromFace()

DllExport void PolyFromFace ( DWORD  f,
BitArray set,
float  thresh,
BOOL  ignoreVisEdges,
AdjFaceList af = NULL 
)

Sets bits for all faces in the same polygon with face f.

Faces already selected in set will not be processed – so if f is "set", nothing happens. The definition of a polygon is all faces sharing invisible edges with edge angles below "thresh".

Parameters
fSpecifies which face to evaluate – the zero based index into the faces array.
setSpecifies which faces are not processed. One bit for each face with set bits not considered.
threshThe angle in radians which is the threshold for defining a polygon. A polygon is all faces sharing invisible edges with edge angles below this angle.
ignoreVisEdgesIf TRUE, the edge visibility is ignored but the threshold is still relevant.
afThis adjacent face list can be passed if there's one handy; otherwise a new one will be computed by the method.

◆ ElementFromFace()

DllExport void ElementFromFace ( DWORD  f,
BitArray set,
AdjFaceList af = NULL 
) const

This method sets bits for all faces in the same "element", or connected component, with face f.

Faces already selected in set will be considered "walls" for this processing and will not be evaluated.

Parameters
fSpecifies which face to evaluate – the zero based index into the faces array.
setSpecifies which faces are considered as barriers to the element and are not processed. One bit for each face with set bits not considered.
af
This adjacent face list can be passed if there's one handy; otherwise a new one will be computed by the method.

◆ FindVertsUsedOnlyByFaces()

DllExport void FindVertsUsedOnlyByFaces ( BitArray fset,
BitArray vset 
)

When faces are deleted in Edit or Editable Mesh, we often want to be able to delete the verts that are isolated by this action.

This method generates the list of verts that are used only by the specified set of faces.

Parameters
fsetThis method finds those vertices used only by the faces indicated in this BitArray.
vsetThis BitArray is completely overwritten with the result, and will be set to the right size (numVerts) if needed.

◆ FindOpenEdges()

DllExport void FindOpenEdges ( BitArray edges)

This method fills in a BitArray with the edges in the mesh that are "open" or "one-sided".

(This is the same as the Edit Mesh "Select Open Edges" function.)

Parameters
edgesThis BitArray will be set to size numFaces*3, and only the open edge bits will be set.

◆ FindVertexAngles()

DllExport void FindVertexAngles ( float *  vang,
BitArray set = NULL 
)

This method calculates, for each vertex, the sum of the angles of this vertex's corner in each face it's on.

So for instance, a point lying in the middle of a grid would always have vertex angle 2*PI, whereas a corner of a box would only have 3*PI/2.

Parameters
vangThis should be a pointer to an array of size numVerts. The vertex angle for each vertex is put in this array (in radians).
set
If non-NULL, this points to a BitArray describing which vertices to find angles of. If only some bits are set, some computation time is saved. If NULL, all vertices' angles are found.

◆ SetRenderData()

void SetRenderData ( MeshRenderData p)
inline

Sets the mesh render data hung off this Mesh.

This method and GetRenderData() allow the renderer to 'hang' data on a mesh. This data can be anything the renderer wants. The data will automatically be deleted when the mesh is deleted via the DeleteThis() method.

Parameters
p
See also
Class MeshRenderData.
2910{renderData = p; }
MeshRenderData * renderData
Points to the render data used by the renderer.
Definition: mesh.h:1561

◆ GetRenderData()

MeshRenderData * GetRenderData ( )
inline

Returns the mesh render data hung off this Mesh.

See Class MeshRenderData. This method and SetRenderData() allow the renderer to 'hang' data on a mesh. This data can be anything the renderer wants. The data will automatically be deleted when the mesh is deleted via DeleteThis() .

2917{ return renderData; }

◆ ClearSpecifiedNormals()

DllExport void ClearSpecifiedNormals ( )

◆ GetSpecifiedNormals()

DllExport MeshNormalSpec * GetSpecifiedNormals ( )

◆ SpecifyNormals()

DllExport void SpecifyNormals ( )

◆ CopyBasics()

DllExport void CopyBasics ( const Mesh from)

◆ GetInterface()

DllExport BaseInterface * GetInterface ( Interface_ID  id)
virtual
Remarks
This method returns a pointer to the BaseInterface of the specified interface.
Parameters:
Interface_ID id

The interface ID for which to return the BaseInterface.

Reimplemented from BaseInterfaceServer.

◆ isFaceCacheInvalid()

DllExport bool isFaceCacheInvalid ( int  faceIndex)

The function first checks if the whole mesh or the face have been flagged as cache invalid (MESH_CACHEINVALID).

If none of these is true, it then cycles through the face's vertices and returns true as soon as it finds a vertex flagged with MESH_CACHEINVALID.

Precondition
faceIndex must be a valid index in the faces (f) array.
Parameters
faceIndexThe index of the face for which you want to determine cache validity
Returns
true if the face is invalid, else false.

◆ InvalidateVertexCache()

DllExport void InvalidateVertexCache ( int  vertex)

The function flags the specified vertex with the MESH_CACHEINVALID flag, telling the rebuild functions that this vertex, the faces surrounding it and the other vertices of those faces need to have their normals recomputed.

It also sets normalsBuilt to 0 to trigger normals' rebuild. This function should be called when one to several vertices have been modified. If all or almost all vertices of the mesh have been invalidated, it's more efficient to call InvalidateGeomCache() instead.

Precondition
vertex must be a valid index in the vertex (v) array.
Parameters
vertexThe index of the vertex that needs to be invalidated.

◆ SetStaticMesh()

DllExport void SetStaticMesh ( bool  staticMesh)

This will set the mesh or as static or not.

As static mesh has no animated channels. This allows use to certain display optimization since we know the mesh is not changing.

Parameters
staticMeshWhether the mesh is to tagged static or not.

◆ ReduceDisplayCaches()

DllExport void ReduceDisplayCaches ( )

This will force all the derived data used to display the mesh to be deleted.

This data can be things like the gfx normals, the direct x mesh cache, tri stripping data etc.

◆ NeedGWCacheRebuilt()

DllExport bool NeedGWCacheRebuilt ( GraphicsWindow gw,
Material ma,
int  numMat 
)

This returns whether the Graphics Cache for this object needs to be rebuilt.

Parameters
gwthe active graphics window
mathe material array assigned to the mesh
numMatthe number of materials in the material array

◆ BuildGWCache()

DllExport void BuildGWCache ( GraphicsWindow gw,
Material ma,
int  numMat,
BOOL  threaded 
)

This builds the graphics window cached mesh.

Parameters
gwthe active graphics window
mathe material array assigned to the mesh
numMatthe number of materials in the material array
threadedwhether when building the cache it can use additional threads. This is needed since the system may be creating many meshes at the same time

◆ GenerateRenderItems()

DllExport void GenerateRenderItems ( MaxSDK::Graphics::IRenderItemContainer renderItems,
const MaxSDK::Graphics::GenerateMeshRenderItemsContext generateRenderItemsContext 
)

Generate a set of render items according to the given render-item-generate context.

Remarks
Usually plugins use this function in their UpdateDisplay(). If plugins maintain copies of Mesh, then they should use this function to convert those mesh instances to render items (RenderItemHandle). This function generates mesh data immediately. Note for instance rendering: instance rendering is a way to draw many objects that use the same geometry. These objects share the same materials and modifiers. The only difference between objects is world transformation. You can specify a matrix array for the mesh, then the mesh will be drawn for many times. Each corresponds to a mesh in the array.
Parameters
renderItemsthe container that accept newly generated render items.
generateRenderItemsContextcontains all the information that is used to generate all the required render items.

◆ GenerateDeferredRenderItems()

DllExport void GenerateDeferredRenderItems ( MaxSDK::Graphics::IRenderItemContainer renderItems,
const MaxSDK::Graphics::GenerateMeshRenderItemsContext generateRenderItemsContext 
)

Generate a set of render items according to the given render-item-generate context.

The mesh will be built in realize render item callback. So only use this function if the mesh is stable in current frame. It has better performance, because it only generates necessary data. For example, in wireframe mode, no normal data will be generated.

Remarks
Usually plugins use this function in their UpdateDisplay(). If plugins maintain copies of Mesh, then they should use this function to convert those mesh instances to render items (RenderItemHandle). Note for instance rendering: instance rendering is a way to draw many objects that use the same geometry. These objects shares same materials and modifiers. The only difference between objects is world transformation. You can specify a matrix array for the mesh, then the mesh will be drawn for many times. Each corresponds to a mesh in the array.
Parameters
renderItemsthe container that accept newly generated render items.
generateRenderItemsContextcontains all the information that is used to generate all the required render items.

◆ SetNormalDataGenerator()

DllExport void SetNormalDataGenerator ( INormalDataGenerator *  normalDataGenerator)

◆ GetNormalDataGenerator()

DllExport INormalDataGenerator * GetNormalDataGenerator ( )

◆ checkFaceSel()

bool checkFaceSel ( int  face_i,
Mesh_SelParams &  params 
)

Invoke these methods to check the Sub-Objects associated with the face indexed by face_i is in the hit region.

The detailed parameters are in SelectionCheckParams structure. Currently these methods are not exposed in SDK.

◆ checkFaceEdgesSel()

bool checkFaceEdgesSel ( int  face_i,
Mesh_SelParams &  params 
)

Invoke these methods to check the Sub-Objects associated with the face indexed by face_i is in the hit region.

The detailed parameters are in SelectionCheckParams structure. Currently these methods are not exposed in SDK.

◆ checkVertSel()

bool checkVertSel ( int  vert_i,
Mesh_SelParams &  params 
)

Invoke these methods to check the Sub-Objects associated with the face indexed by face_i is in the hit region.

The detailed parameters are in SelectionCheckParams structure. Currently these methods are not exposed in SDK.

◆ IsAccelDataDirty()

DllExport bool IsAccelDataDirty ( )

Checks if the space accelerating data is up-to-date.

Remarks
Invoking InvalidateGeomCache() or InvalidateTopologyCache() will dirty the space accelerating data.

◆ DirtyAccelData()

DllExport void DirtyAccelData ( )

Update the space accelerating data.

Remarks
This function should only be invoked when the plug-in needs to invoke following methods before InvalidateGeomCache() or InvalidateTopologyCache() gets invoked.

◆ select()

DllExport BOOL select ( GraphicsWindow gw,
Material ma,
HitRegion hr,
int  abortOnHit = FALSE,
int  numMat = 1 
)

Checks the given HitRecord hr to see if it intersects this Mesh object.

Parameters
gwPoints to the graphics window to check.
maThe list of materials for the mesh.
hrThis describes the properties of a region used for the hit testing. See Class HitRegion.
abortOnHitIf nonzero, the hit testing is complete after any hit; otherwise all hits are checked.
numMatThe number of materials for the mesh.
Returns
TRUE if the item was hit; otherwise FALSE.

◆ SubObjectHitTest()

DllExport BOOL SubObjectHitTest ( GraphicsWindow gw,
Material ma,
HitRegion hr,
DWORD  vflags,
SubObjHitList hitList,
int  numMat = 1 
)

This method may be called to perform sub-object hit testing on this mesh.

Parameters
gwThe graphics window associated with the viewport the mesh is being hit tested in.
maThe list of materials for the mesh. See Class Material and the topic "Class INode - Material methods".
hrThis describes the properties of a region used for the hit testing. See Class HitRegion.
vflagsFlags for sub object hit testing. One or more of the flags in Flags for Sub Object Hit Test
hitListThe results are stored here. See Class SubObjHitList.
numMatThe number of materials for the mesh.
Returns
TRUE if the item was hit; otherwise FALSE.

◆ ComputeRenderNormal()

DllExport Point3 ComputeRenderNormal ( int  face_i,
int  corner 
)

This function computes the render normal for the specified face and corner.

Unlike the method of buildNormals() and buildRenderNormals(), this function does not rely on whole RVertex array to achieve normal computation, which means it is lightweight and it quite efficent to do the normal computation for a given face and corner index. The only limitation is that this function will update the space accelerating structure if it is needed.

Parameters
face_iThe index to the face.
cornerThe corner index within the face(must between 0 and 2 inclusively)

◆ ComputeInterpolatedRenderNormal()

DllExport Point3 ComputeInterpolatedRenderNormal ( int  face_i,
const Point3 bary 
)

This function computes the interpolated normals regarding the barycentric coordinates.

Parameters
face_iThe index to the face.
baryThe input barycentric coordinates to compute the interpolated normal.

◆ IntersectRay() [1/2]

DllExport int IntersectRay ( Ray ray,
float &  at,
Point3 norm 
)

Calculates the intersection of the specified ray with this mesh object.

This allows Mesh objects to easily implement the Object::IntersectRay() method.

Parameters
raySpecifies the origin and direction of the ray to intersect with the mesh. See Class Ray.
atThe computed point of intersection on the surface of the mesh.
normThe face normal at the point of intersection (at).
Returns
Nonzero if the ray intersected the mesh object; otherwise 0. Note that this method ignores backfaces when computing the result.

◆ IntersectRay() [2/2]

DllExport int IntersectRay ( Ray ray,
float &  at,
Point3 norm,
DWORD &  fi,
Point3 bary 
)

Calculates the intersection of the specified ray with this mesh object.

This new version also returns the face index that was intersected and the barycentric coordinates of that face. Barycentric coordinates are the coordinates relative to the triangular face. The barycentric coordinates of a point p relative to a triangle describe that point as a weighted sum of the vertices of the triangle. If the barycentric coordinates are b0, b1, and b2, then: p = b0*p0 + b1*p1 + b2*p2; where p0, p1, and p2 are the vertices of the triangle. The Point3 returned by this method has the barycentric coordinates stored in its three coordinates. These coordinates are relative to the triangular face that was intersected. These barycentric coordinates can be used to interpolate any quantity whose value is known at the vertices of the triangle.

Parameters
raySpecifies the origin and direction of the ray to intersect with the mesh. See Class Ray.
atThe computed point of intersection on the surface of the mesh.
normThe face normal at the point of intersection (at).
fiThe face index of the face that was intersected is returned here.
baryThe barycentric coordinates of the face that was hit.
Returns
Nonzero if the ray intersected the mesh object; otherwise 0.

◆ GetSpaceAccelHandle()

DllExport void * GetSpaceAccelHandle ( )

Invoke these methods to check the Sub-Objects associated with the face indexed by face_i is in the hit region.

The detailed parameters are in SelectionCheckParams structure. Currently these methods are not exposed in SDK.

Friends And Related Function Documentation

◆ Face

friend class Face
friend

◆ MeshAccess

friend class MeshAccess
friend

◆ HardwareMesh

friend class HardwareMesh
friend

◆ MaxGraphics::IMeshInternal

friend class MaxGraphics::IMeshInternal
friend

◆ MaxGraphics::BackfaceWireframe::IMeshBackfaceWireframeUtility

friend class MaxGraphics::BackfaceWireframe::IMeshBackfaceWireframeUtility
friend

◆ gfxCleanup

void gfxCleanup ( void data)
friend

Member Data Documentation

◆ numFaces

The number of faces in this Mesh. Faces are owned by the MaxSDK::MeshTopoChannelData channel.

To modify use the Mesh interface methods such as "setNumFaces". May need to cast in some cases:

MAXMEM_EXTERN_C UtilExport int(__cdecl *MAX_heapchk)(void)
See also
MaxSDK::BlockWrite_Value
MaxSDK::MeshTopoChannelData

◆ faces

The mesh faces. Faces are owned by the MaxSDK::MeshTopoChannelData channel.

May need to cast in some cases:

This class represents a single triangular face.
Definition: mesh.h:194
See also
MaxSDK::BlockWrite_Ptr
MaxSDK::MeshTopoChannelData

◆ numVerts

The number of verts in this Mesh. Mesh verts are owned by the MaxSDK::MeshGeomChannelData channel.

To modify use the Mesh interface methods such as "setNumVerts". May need to cast in some cases:

See also
MaxSDK::BlockWrite_Value
MaxSDK::MeshGeomChannelData

◆ verts

The mesh verts. Mesh verts are owned by the MaxSDK::MeshGeomChannelData channel.

◆ vFlags

Holds flags specific to the corresponding vertex in the verts array. Owned by the MaxSDK::MeshGeomChannelData channel.

May need to cast in some cases:

(long*)vFlags;
See also
MaxSDK::BlockWrite_Ptr

◆ numCVerts

Number of color vertices.

Mesh numCVerts is owned by the MaxSDK::MeshVertexColorChannelData channel. May need to cast in some cases:

See also
MaxSDK::BlockWrite_Value
MaxSDK::MeshVertexColorChannelData

◆ vertCol

Array of color vertices.

Mesh numCVerts is owned by the MaxSDK::MeshVertexColorChannelData channel. May need to cast in some cases:

MaxSDK::BlockWrite_Ptr< VertColor, MaxSDK::MeshVertexColorChannelData > vertCol
Array of color vertices.
Definition: mesh.h:1427
Definition: point3.h:54
See also
MaxSDK::BlockWrite_Ptr
MaxSDK::MeshVertexColorChannelData

◆ vcFace

Array of color per vertex faces.

Mesh numCVerts is owned by the MaxSDK::MeshVertexColorChannelData channel. May need to cast in some cases:

MaxSDK::BlockWrite_Ptr< TVFace, MaxSDK::MeshVertexColorChannelData > vcFace
Array of color per vertex faces.
Definition: mesh.h:1437
This class is used for texture faces as well as vertex colors.
Definition: mesh.h:362
See also
MaxSDK::BlockWrite_Ptr
MaxSDK::MeshVertexColorChannelData

◆ numTVerts

Number of texture vertices.

Mesh numCVerts is owned by the MaxSDK::MeshTextureMapChannelData channel. May need to cast in some cases:

See also
MaxSDK::BlockWrite_Value
MaxSDK::MeshTextureMapChannelData

◆ tVerts

The array of texture vertices.

This stores the UVW coordinates. For a 2D mapping only two of them are used, i.e. UV, VW, or WU. This just provides greater flexibility so the user can choose to use UV, VW, or WU. MaxSDK::MeshTextureMapChannelData channel owns this members data.

Note
typedef Point3 UVVert; May need to cast in some cases:
See also
MaxSDK::BlockWrite_Ptr
MaxSDK::MeshTextureMapChannelData

◆ tvFace

The array of texture faces.

There needs to be one TVFace for every face, but there can be three indices into the UVVert array that are any UVs. Each face of the object can have its own mapping. MaxSDK::MeshTextureMapChannelData channel owns this members data. May need to cast in some cases:

MaxSDK::BlockWrite_Ptr< TVFace, MaxSDK::MeshTextureMapChannelData > tvFace
The array of texture faces.
Definition: mesh.h:1479
See also
MaxSDK::BlockWrite_Ptr
MaxSDK::MeshTextureMapChannelData

◆ curVCChan

int curVCChan

Storage for the current mapping channel to use for vertex colors (default = 0).

◆ curVCArray

VertColor* curVCArray

Points to storage for a possible external color array (default = NULL).

This can be either an external array or one of the mapping channels. See the method Mesh::setVCDisplayData();

◆ curVCFace

TVFace* curVCFace

possible external face array (default = NULL)

◆ vertColArray

VertColor* vertColArray

When 3ds Max is rendering the color values come from this variable.

This array defaults to the internal vertCol but can be set to an external array, or a map channel. See the method Mesh::setVCDisplayData();

◆ vcFaceData

TVFace* vcFaceData

When 3ds Max is rendering the vertex color lookup comes from this structure.

This defaults to the vcFace data but if a mapping channel is used for color lookup, its TVFace structure is used.

◆ dispFlags

DWORD dispFlags

Display attribute flags.

They control various aspect of the Mesh objects display and may be one or more of the following values:

  • DISP_VERTTICKS - Display vertices as small tick marks.
  • DISP_SELVERTS - Display selected vertices.
  • DISP_SELFACES - Display selected faces.
  • DISP_SELEDGES - Display selected edges.
  • DISP_SELPOLYS - Display selected polygons. Polygons are defined as adjacent triangles with hidden edges. A selected face would show all edges regardless of if they were hidden edges. A polygon would only show the edges of the polygon that were not hidden.

◆ selLevel

DWORD selLevel

Selection level flags.

This is the current level of selection. When all the bits are 0, the object is at object level selection. The selection level bits are:

  • MESH_OBJECT- Object level.
  • MESH_VERTEX - Vertex level.
  • MESH_FACE - Face level.
  • MESH_EDGE - Edge level.

◆ normalsBuilt

int normalsBuilt

Nonzero if normals have been built for the current mesh; 0 otherwise.

◆ renderData

MeshRenderData* renderData

Points to the render data used by the renderer.

◆ stab

StripTab* stab

depends on topo

◆ norInd

DWTab norInd

indirection array for fast normal lookup

◆ normalCount

int normalCount

total number of normals

◆ gfxNormals

Point3* gfxNormals

flattened list of normals pointers back in the rverts data.

We need to get rid of this or something this is big memory eater

◆ numTexCoords

int numTexCoords[GFX_MAX_TEXTURES]

Derived arrays to contain generated texture coordinates.

◆ texCoords

Point3* texCoords[GFX_MAX_TEXTURES]

Derived arrays to contain generated texture coordinates.

◆ tstab

Tab<TriStrip *>* tstab

Derived table of TriStrips, depends on topology.