3ds Max C++ API Reference
IMeshCollector Class Referenceabstract

Utility interface for collecting the definition of a 3ds max mesh. More...

#include <IMeshCollector.h>

+ Inheritance diagram for IMeshCollector:

Classes

struct  FaceDefinition
 Defines the vertex indices that form a triangular face in a mesh. More...
 

Public Member Functions

virtual ~IMeshCollector ()
 
virtual const std::vector< Point3 > & get_vertices ()=0
 Returns the array of vertex positions used by the mesh. More...
 
virtual const std::vector< FaceDefinition > & get_vertex_faces ()=0
 Returns the array of face definitions for the vertex positions defined by get_vertices(). More...
 
virtual const std::vector< Point3 > & get_normals ()=0
 Returns the array of normal vectors used by the mesh. More...
 
virtual const std::vector< FaceDefinition > & get_normal_faces ()=0
 Returns the array of face definitions for the normals defined by get_normals(). More...
 
virtual const std::vector< MtlID > & get_face_material_ids ()=0
 Returns the array of per-face material IDs. More...
 
virtual const std::vector< int > & get_UVW_channel_ids ()=0
 Returns the array of UVW channel IDs present on the mesh. More...
 
virtual const std::vector< std::vector< Point3 > > & get_UVWs ()=0
 Returns the array of UVW coordinates used by the mesh. More...
 
virtual const std::vector< std::vector< FaceDefinition > > & get_UVW_faces ()=0
 Returns the array of face definitions for the UVW coordinates defined by get_UVWs(). More...
 
virtual const std::vector< std::vector< UVTangentVectors > > & get_UV_tangents ()=0
 Returns the array of UV tangent vectors used by the mesh. More...
 
virtual const std::vector< std::vector< FaceDefinition > > & get_UV_tangent_faces ()=0
 Returns the array of face definitions for the UV tangent vectors defined by get_UV_tangents(). More...
 

Static Public Member Functions

static RenderingAPIExport std::unique_ptr< IMeshCollectorAllocateInstance (INode &node, const View &render_view, const TimeValue t, Interval &validity)
 Allocates a new mesh collector. More...
 
- 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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
static UtilExport voidoperator new[] (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate arrays of objects. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
static UtilExport voidoperator new (size_t size, void *placement_ptr)
 Placement new operator. More...
 
static UtilExport void operator delete (void *ptr, void *placement_ptr)
 Placement delete operator. More...
 
static UtilExport voidaligned_malloc (size_t size, size_t alignment)
 Allocates memory on a specified alignment boundary. More...
 
static UtilExport voidaligned_realloc (void *ptr, size_t size, size_t alignment)
 Reallocates memory on a specified alignment boundary. More...
 
static UtilExport void aligned_free (void *ptr)
 Frees a block of memory that was allocated with aligned_malloc/aligned_realloc. More...
 

Detailed Description

Utility interface for collecting the definition of a 3ds max mesh.

This class abstracts the logic necessary for reading and interpreting class Mesh. Given an INode, it automatically evaluates its render mesh and generates well formatted, standardized definitions for vertex positions, normals, UVWs, tangents, etc.

This class may not be the optimal way to read a render mesh: it stores its data in intermediate buffers which entail an extra copy into the renderer's database. But the fact that it's standardized and maintained internally should make it much easier for renderer plugin developers to translate 3ds max scenes.

Constructor & Destructor Documentation

◆ ~IMeshCollector()

virtual ~IMeshCollector ( )
inlinevirtual
64 {}

Member Function Documentation

◆ AllocateInstance()

static RenderingAPIExport std::unique_ptr<IMeshCollector> AllocateInstance ( INode node,
const View render_view,
const TimeValue  t,
Interval validity 
)
static

Allocates a new mesh collector.

The mesh collector, return by this method, should be treated as a temporary object. The mesh attributes should be extracted immediately, followed by immediate discarding of the collector. This is because the mesh collector maintains references to the node and mesh, which could become dangling if the collector were kept around while other components were to evaluate the node.

Parameters
nodeThe (geometric) node from which to evaluate the mesh.
render_viewThe view to be passed to GeomObject::GetRenderMesh(). This view should implement View::CheckForRenderAbort() to always return false, because the mesh collector has no provisions for correctly supporting an abort while evaluating a mesh.
tThe time at which to evaluate the mesh.
validity[in, out] The validity of the mesh is intersected into this interval.
Returns
A new instance of a mesh collector

◆ get_vertices()

virtual const std::vector<Point3>& get_vertices ( )
pure virtual

Returns the array of vertex positions used by the mesh.

Remarks
The values returned are guaranteed to be valid (all NaN values get converted to 0.0).
See also
get_vertex_faces()

◆ get_vertex_faces()

virtual const std::vector<FaceDefinition>& get_vertex_faces ( )
pure virtual

Returns the array of face definitions for the vertex positions defined by get_vertices().

Remarks
The values returned are guaranteed to be valid (all indices point to valid vertex indices).
See also
get_vertices()

◆ get_normals()

virtual const std::vector<Point3>& get_normals ( )
pure virtual

Returns the array of normal vectors used by the mesh.

Remarks
The values returned are guaranteed to be valid (all NaN values get converted to 0.0) and normalized; degenerate normals are converted to use the geometric normal.
See also
get_normal_faces()

◆ get_normal_faces()

virtual const std::vector<FaceDefinition>& get_normal_faces ( )
pure virtual

Returns the array of face definitions for the normals defined by get_normals().

Remarks
The values returned are guaranteed to be valid (all indices point to valid vertex indices).
The size of the array is guaranteed to be equal to that returng by get_vertex_faces().
See also
get_normals()

◆ get_face_material_ids()

virtual const std::vector<MtlID>& get_face_material_ids ( )
pure virtual

Returns the array of per-face material IDs.

These material IDs are meant to be used in conjunction with multi/sub-object materials.

Remarks
The size of the array is guaranteed to be equal to that returng by get_vertex_faces().

◆ get_UVW_channel_ids()

virtual const std::vector<int>& get_UVW_channel_ids ( )
pure virtual

Returns the array of UVW channel IDs present on the mesh.

These UVW channel IDs are meant to be matched with the channel IDs specified in a Texmap's UVW mapping parameters.

◆ get_UVWs()

virtual const std::vector<std::vector<Point3> >& get_UVWs ( )
pure virtual

Returns the array of UVW coordinates used by the mesh.

Remarks
The values returned are guaranteed to be valid (all NaN values get converted to 0.0).
This array is guaranteed to be the same size as that returned by get_UVW_channel_ids(); each sub-array therefore corresponds to a specific UVW channel.
See also
get_UVW_faces()

◆ get_UVW_faces()

virtual const std::vector<std::vector<FaceDefinition> >& get_UVW_faces ( )
pure virtual

Returns the array of face definitions for the UVW coordinates defined by get_UVWs().

Remarks
The values returned are guaranteed to be valid (all indices point to valid vertex indices).
This array is guaranteed to be the same size as that returned by get_UVW_channel_ids(); each sub-array therefore corresponds to a specific UVW channel. The size of each sub-array is guaranteed to be equal to that returng by get_vertex_faces().
See also
get_UVWs()

◆ get_UV_tangents()

virtual const std::vector<std::vector<UVTangentVectors> >& get_UV_tangents ( )
pure virtual

Returns the array of UV tangent vectors used by the mesh.

Remarks
The values returned are guaranteed to be valid (all NaN values get converted to 0.0).
This array is guaranteed to be the same size as that returned by get_UVW_channel_ids(); each sub-array therefore corresponds to a specific UVW channel.
See also
get_UV_tangent_faces()

◆ get_UV_tangent_faces()

virtual const std::vector<std::vector<FaceDefinition> >& get_UV_tangent_faces ( )
pure virtual

Returns the array of face definitions for the UV tangent vectors defined by get_UV_tangents().

Remarks
The values returned are guaranteed to be valid (all indices point to valid vertex indices).
This array is guaranteed to be the same size as that returned by get_UVW_channel_ids(); each sub-array therefore corresponds to a specific UVW channel. The size of each sub-array is guaranteed to be equal to that returng by get_vertex_faces().
See also
get_UV_tangents()