MaterialX 1.39.1
Loading...
Searching...
No Matches
Mesh Class Reference

Container for mesh data. More...

#include <Mesh.h>

Public Member Functions

 Mesh (const string &name)
 
const string & getName () const
 Return the name of this mesh.
 
void setSourceUri (const string &sourceUri)
 Set the mesh's source URI.
 
bool hasSourceUri () const
 Return true if this mesh has a source URI.
 
const string & getSourceUri () const
 Return the mesh's source URI.
 
MeshStreamPtr getStream (const string &name) const
 Get a mesh stream by name. More...
 
MeshStreamPtr getStream (const string &type, unsigned int index) const
 Get a mesh stream by type and index. More...
 
void addStream (MeshStreamPtr stream)
 Add a mesh stream.
 
void removeStream (MeshStreamPtr stream)
 Remove a mesh stream.
 
void setVertexCount (size_t val)
 Set vertex count.
 
size_t getVertexCount () const
 Get vertex count.
 
void setMinimumBounds (const Vector3 &val)
 Set the minimum bounds for the geometry.
 
const Vector3getMinimumBounds () const
 Return the minimum bounds for the geometry.
 
void setMaximumBounds (const Vector3 &v)
 Set the minimum bounds for the geometry.
 
const Vector3getMaximumBounds () const
 Return the minimum bounds for the geometry.
 
void setSphereCenter (const Vector3 &val)
 Set center of the bounding sphere.
 
const Vector3getSphereCenter () const
 Return center of the bounding sphere.
 
void setSphereRadius (float val)
 Set radius of the bounding sphere.
 
float getSphereRadius () const
 Return radius of the bounding sphere.
 
size_t getPartitionCount () const
 Return the number of mesh partitions.
 
void addPartition (MeshPartitionPtr partition)
 Add a partition.
 
MeshPartitionPtr getPartition (size_t partIndex) const
 Return a reference to a mesh partition.
 
MeshStreamPtr generateTextureCoordinates (MeshStreamPtr positionStream)
 Create texture coordinates from the given positions. More...
 
MeshStreamPtr generateNormals (MeshStreamPtr positionStream)
 Generate face normals from the given positions. More...
 
MeshStreamPtr generateTangents (MeshStreamPtr positionStream, MeshStreamPtr normalStream, MeshStreamPtr texcoordStream)
 Generate tangents from the given positions, normals, and texture coordinates. More...
 
MeshStreamPtr generateBitangents (MeshStreamPtr normalStream, MeshStreamPtr tangentStream)
 Generate bitangents from the given normals and tangents. More...
 
void mergePartitions ()
 Merge all mesh partitions into one.
 
void splitByUdims ()
 Split the mesh into a single partition per UDIM.
 

Static Public Member Functions

static MeshPtr create (const string &name)
 Create a new mesh.
 

Detailed Description

Container for mesh data.

Member Function Documentation

◆ generateBitangents()

MeshStreamPtr generateBitangents ( MeshStreamPtr  normalStream,
MeshStreamPtr  tangentStream 
)

Generate bitangents from the given normals and tangents.

Parameters
normalStreamInput normal stream
tangentStreamInput tangent stream
Returns
The generated bitangent stream, on success; otherwise, a null pointer.

◆ generateNormals()

MeshStreamPtr generateNormals ( MeshStreamPtr  positionStream)

Generate face normals from the given positions.

Parameters
positionStreamInput position stream
Returns
The generated normal stream

◆ generateTangents()

MeshStreamPtr generateTangents ( MeshStreamPtr  positionStream,
MeshStreamPtr  normalStream,
MeshStreamPtr  texcoordStream 
)

Generate tangents from the given positions, normals, and texture coordinates.

Parameters
positionStreamInput position stream
normalStreamInput normal stream
texcoordStreamInput texcoord stream
Returns
The generated tangent stream, on success; otherwise, a null pointer.

◆ generateTextureCoordinates()

MeshStreamPtr generateTextureCoordinates ( MeshStreamPtr  positionStream)

Create texture coordinates from the given positions.

The texture coordinates are all initialize to a zero value.

Parameters
positionStreamInput position stream
Returns
The generated texture coordinate stream

◆ getStream() [1/2]

MeshStreamPtr getStream ( const string &  name) const
inline

Get a mesh stream by name.

Parameters
nameName of stream
Returns
Reference to a mesh stream if found

◆ getStream() [2/2]

MeshStreamPtr getStream ( const string &  type,
unsigned int  index 
) const
inline

Get a mesh stream by type and index.

Parameters
typeType of stream
indexIndex of stream
Returns
Reference to a mesh stream if found

The documentation for this class was generated from the following file: