ArcGIS Procedural Runtime  3.2.10650
List of all members | Public Member Functions
prtx::MeshBuilder Class Reference

#include <Mesh.h>

Inheritance diagram for prtx::MeshBuilder:
[legend]

Public Member Functions

uint32_t addFace (const IndexVector &vertexIndices, const IndexVector &holeFacesIndices, uint32_t materialIndex, const IndexVector &normalIndices, const std::vector< IndexVector > &uvIndices)
 
uint32_t addFace (const uint32_t *vertexIndices, size_t vertexIndicesCount, const uint32_t *holeFaceIndices, size_t holeFacesIndicesCount, uint32_t materialIndex, const uint32_t *normalIndices, size_t normalIndicesCount, const std::vector< const uint32_t *> &uvIndices, const std::vector< size_t > &uvIndicesCounts)
 
uint32_t addFace ()
 
void addFaceHoleIndex (uint32_t faceId, uint32_t index)
 
void addFaceNormalIndex (uint32_t faceId, uint32_t index)
 
void addFaceUVIndex (uint32_t faceId, uint32_t uvSet, uint32_t i)
 
void addFaceVertexIndex (uint32_t faceId, uint32_t index)
 
uint32_t addMaterial (const MaterialPtr &material)
 
void addMaterials (const MaterialPtrVector &materials)
 
uint32_t addNormalCoords (const double coords[3])
 
void addNormalCoords (const double *coords, size_t count)
 
void addNormalCoords (const DoubleVector &coords)
 
uint32_t addTextureRegionCoords (uint32_t uvSet, const double coords[4])
 
void addTextureRegionCoords (uint32_t uvSet, const double *coords, size_t count)
 
void addTextureRegionCoords (uint32_t uvSet, const DoubleVector &coords)
 
uint32_t addUVCoords (uint32_t uvSet, const double coords[2])
 
void addUVCoords (uint32_t uvSet, const double *coords, size_t count)
 
void addUVCoords (uint32_t uvSet, const DoubleVector &coords)
 
uint32_t addVertexCoords (const double coords[3])
 
void addVertexCoords (const double *coords, size_t count)
 
void addVertexCoords (const DoubleVector &coords)
 
virtual MeshPtr createShared (std::wstring *warnings=0) const
 
virtual MeshPtr createSharedAndReset (std::wstring *warnings=0)
 
bool isEmpty () const
 
 MeshBuilder ()
 
 MeshBuilder (const MeshBuilder &mb)
 
 MeshBuilder (const MeshBuilder &mb, const DoubleVector &trafoMatrix)
 
 MeshBuilder (const Mesh &mesh)
 
 MeshBuilder (const Mesh &mesh, const DoubleVector &trafoMatrix)
 
MeshBuilderoperator= (const MeshBuilder &right)
 
void reset ()
 
void resetMaterials ()
 
void setFaceMaterialIndex (uint32_t faceId, uint32_t index)
 
void setFaceNormalIndices (uint32_t faceId, const IndexVector &indices)
 
void setFaceTextureRegionIndex (uint32_t faceId, uint32_t uvSet, uint32_t index)
 
void setFaceUVIndices (uint32_t faceId, uint32_t uvSet, const IndexVector &indices)
 
void setFaceVertexIndices (uint32_t faceId, const IndexVector &indices)
 
void setName (const std::wstring &name)
 
- Public Member Functions inherited from prtx::SharedPtrBuilder< Mesh >
SharedPtrBuilderoperator= (const SharedPtrBuilder &)=delete
 
 SharedPtrBuilder (const SharedPtrBuilder &)=delete
 

Detailed Description

A builder to construct meshes. Components (vertex coordinates, normal coordinates, uv coordinates, materials and faces) can be added and get a unique index assigned. The MeshBuilder allows for random access on the faces: faces can be added first and their content defined afterwards.

See also
Mesh, MeshUtils

Constructor & Destructor Documentation

◆ MeshBuilder() [1/4]

prtx::MeshBuilder::MeshBuilder ( )

Constructor. Creates an empty builder.

◆ MeshBuilder() [2/4]

prtx::MeshBuilder::MeshBuilder ( const MeshBuilder mb,
const DoubleVector trafoMatrix 
)

Constructor which initializes the builder to a copy of the passed builder where existing vertices and normals are transformed.

Parameters
mbThe builder to copy and transform.
trafoMatrixMatrix to transform the builder with. 4x4 harmonic transformation matrix, column major (OpenGL).

◆ MeshBuilder() [3/4]

prtx::MeshBuilder::MeshBuilder ( const Mesh mesh)

Constructor which initializes the builder to a copy of the passed mesh.

Parameters
meshThe mesh to initialize the builder with.

◆ MeshBuilder() [4/4]

prtx::MeshBuilder::MeshBuilder ( const Mesh mesh,
const DoubleVector trafoMatrix 
)

Constructor which initializes the builder to a transformed copy of the passed mesh.

Parameters
meshThe mesh to transform and initialize the builder with.
trafoMatrixMatrix to transform mesh with. 4x4 harmonic transformation matrix, column major (OpenGL).

Member Function Documentation

◆ addFace() [1/3]

uint32_t prtx::MeshBuilder::addFace ( const IndexVector vertexIndices,
const IndexVector holeFacesIndices,
uint32_t  materialIndex,
const IndexVector normalIndices,
const std::vector< IndexVector > &  uvIndices 
)

Adds a face with the passed indices.

Parameters
vertexIndicesVector with vertex indices of face.
holeFacesIndicesVector with face indices of holes inside this face.
materialIndexMaterial index for this face.
normalIndicesVector with vertex normal indices of face. Might be empty.
uvIndicesVector with a vector of uv indices for face. Vectors might be empty.
Returns
index of new face.

◆ addFace() [2/3]

uint32_t prtx::MeshBuilder::addFace ( const uint32_t *  vertexIndices,
size_t  vertexIndicesCount,
const uint32_t *  holeFaceIndices,
size_t  holeFacesIndicesCount,
uint32_t  materialIndex,
const uint32_t *  normalIndices,
size_t  normalIndicesCount,
const std::vector< const uint32_t *> &  uvIndices,
const std::vector< size_t > &  uvIndicesCounts 
)

Adds a face with the passed indices.

Parameters
vertexIndicesPointer to array of vertex indices.
vertexIndicesCountNumber of vertex indices in array.
holeFacesIndicesPointer to array with face indices of holes inside this face.
holeFacesIndicesCountNumber of indices in array. Might be empty (count 0).
materialIndexMaterial index for this face.
normalIndicesPointer to normal indices of face. Might be empty (count 0).
normalIndicesCountNumber of normal indices in array.
uvIndicesVector with pointers to uv indices for face. Vector might be empty, and individual arrays might be empty.
uvIndicesCountsVector with sizes for the uv index arrays. Same size as uvIndices. Arrays might be empty (count 0).
Returns
index of new face.

◆ addFace() [3/3]

uint32_t prtx::MeshBuilder::addFace ( )

Adds an empty face. Use trhe returned index to setup face details.

Returns
index of new face.

◆ addFaceHoleIndex()

void prtx::MeshBuilder::addFaceHoleIndex ( uint32_t  faceId,
uint32_t  index 
)

Adds a hole face index to the selected face.

Parameters
faceIdIndex of face.
indexFace index of hole to add.

◆ addFaceNormalIndex()

void prtx::MeshBuilder::addFaceNormalIndex ( uint32_t  faceId,
uint32_t  index 
)

Adds a normal index to the selected face.

Parameters
faceIdIndex of face.
indexNormal index to add.

◆ addFaceUVIndex()

void prtx::MeshBuilder::addFaceUVIndex ( uint32_t  faceId,
uint32_t  uvSet,
uint32_t  i 
)

Adds a uv index to the selected face and the selected uv set.

Parameters
faceIdIndex of face.
uvSetIndex of uv set.
indexUV index to add.

◆ addFaceVertexIndex()

void prtx::MeshBuilder::addFaceVertexIndex ( uint32_t  faceId,
uint32_t  index 
)

Adds a vertex index to the selected face.

Parameters
faceIdIndex of face.
indexVertex index to add.

◆ addMaterial()

uint32_t prtx::MeshBuilder::addMaterial ( const MaterialPtr material)

Adds a material to the material array.

Parameters
materialMaterial to add.
Returns
index of the Material.

◆ addMaterials()

void prtx::MeshBuilder::addMaterials ( const MaterialPtrVector materials)

Adds a vector of materials to the material array.

Parameters
materialsMaterials to add.

◆ addNormalCoords() [1/3]

uint32_t prtx::MeshBuilder::addNormalCoords ( const double  coords[3])

Adds a normal (i.e. a coordinate triplet) to the normal coordinates array.

Parameters
coords(x, y, z) coordinate triplet to add.
Returns
index of the added normal (i.e. normal i has coordinates [i*3, i*3+1, i*3+2].

◆ addNormalCoords() [2/3]

void prtx::MeshBuilder::addNormalCoords ( const double *  coords,
size_t  count 
)

Adds a number of normals (i.e. a number of coordinate triplets) to the normal coordinates array.

Parameters
coordsPointer to an array of (x, y, z) coordinate triplets to add.
countNumber of coordinates (i.e. normalCount * 3) to add.

◆ addNormalCoords() [3/3]

void prtx::MeshBuilder::addNormalCoords ( const DoubleVector coords)

Adds a number of normals (i.e. a number of coordinate triplets) to the normal coordinates array.

Parameters
coordsPointer to a vector of (x, y, z) coordinate triplets to add.

◆ addTextureRegionCoords() [1/3]

uint32_t prtx::MeshBuilder::addTextureRegionCoords ( uint32_t  uvSet,
const double  coords[4] 
)

Adds a texture region quadruple to the selected texture region array.

Parameters
uvSetIndex of uv set.
coords(u, v) coordinate tuple to add.
Returns
index of the added texture region quadruple.

Note: texture regions are only supported by the EncodePreparator, not yet by decoders and CGA itself.

◆ addTextureRegionCoords() [2/3]

void prtx::MeshBuilder::addTextureRegionCoords ( uint32_t  uvSet,
const double *  coords,
size_t  count 
)

Adds a number of texture region quadruples to the selected texture region array.

Parameters
uvSetIndex of uv set.
coordsPointer to an array of (u_min, v_min, u_max, v_max) coordinate tuples to add.
countNumber of coordinates (i.e. textureRegionCount * 4) to add.

Note: texture regions are only supported by the EncodePreparator, not yet by decoders and CGA itself.

◆ addTextureRegionCoords() [3/3]

void prtx::MeshBuilder::addTextureRegionCoords ( uint32_t  uvSet,
const DoubleVector coords 
)

Adds a number of texture region quadruples to the texture region array.

Parameters
uvSetIndex of uv set.
coordsPointer to a vector of (u_min, v_min, u_max, v_max) coordinate quadruples to add.

Note: texture regions are only supported by the EncodePreparator, not yet by decoders and CGA itself.

◆ addUVCoords() [1/3]

uint32_t prtx::MeshBuilder::addUVCoords ( uint32_t  uvSet,
const double  coords[2] 
)

Adds a uv tuple (i.e. a coordinate tuple) to the selected uv coordinates array.

Parameters
uvSetIndex of uv set.
coords(u, v) coordinate tuple to add.
Returns
index of the added uv tuple (i.e. uv tuple i has coordinates [i*2, i*2+1]).

◆ addUVCoords() [2/3]

void prtx::MeshBuilder::addUVCoords ( uint32_t  uvSet,
const double *  coords,
size_t  count 
)

Adds a number of uv tuples (i.e. a number of coordinate tuples) to the selected uv coordinates array.

Parameters
uvSetIndex of uv set.
coordsPointer to an array of (u, v) coordinate tuples to add.
countNumber of coordinates (i.e. uvTupleCount * 2) to add.

◆ addUVCoords() [3/3]

void prtx::MeshBuilder::addUVCoords ( uint32_t  uvSet,
const DoubleVector coords 
)

Adds a number of uv tuples (i.e. a number of coordinate tuples) to the selected uv coordinates array.

Parameters
uvSetIndex of uv set.
coordsPointer to a vector of (u, v) coordinate tuples to add.

◆ addVertexCoords() [1/3]

uint32_t prtx::MeshBuilder::addVertexCoords ( const double  coords[3])

Adds a vertex (i.e. a coordinate triplet) to the vertex coordinates array.

Parameters
coords(x, y, z) coordinate triplet to add.
Returns
index of the added vertex (i.e. vertex i has coordinates [i*3, i*3+1, i*3+2].

◆ addVertexCoords() [2/3]

void prtx::MeshBuilder::addVertexCoords ( const double *  coords,
size_t  count 
)

Adds a number of vertices (i.e. a number of coordinate triplets) to the vertex coordinates array.

Parameters
coordsPointer to an array of (x, y, z) coordinate triplets to add.
countNumber of coordinates (i.e. vertexCount * 3) to add.

◆ addVertexCoords() [3/3]

void prtx::MeshBuilder::addVertexCoords ( const DoubleVector coords)

Adds a number of vertices (i.e. a number of coordinate triplets) to the vertex coordinates array.

Parameters
coordsPointer to a vector of (x, y, z) coordinate triplets to add.

◆ createShared()

virtual MeshPtr prtx::MeshBuilder::createShared ( std::wstring *  warnings = 0) const
virtual

Creates an instance of type C based on the current builder state. Does not modify the builder state.

Parameters
[out]warningsIf warnings != 0, a builder implementation may emit warnings about the creation process.
Returns
Shared pointer to a new instance of type C.

Implements prtx::SharedPtrBuilder< Mesh >.

◆ createSharedAndReset()

virtual MeshPtr prtx::MeshBuilder::createSharedAndReset ( std::wstring *  warnings = 0)
virtual

Creates and instance of type C based on the current builder state. Resets the builder state at the end.

Parameters
[out]warningsIf warnings != 0, a builder implementation may emit warnings about the creation process.
Returns
Shared pointer to a new instance of type C.

Implements prtx::SharedPtrBuilder< Mesh >.

◆ isEmpty()

bool prtx::MeshBuilder::isEmpty ( ) const
Returns
true if the builder is empty, i.e. nothing got set or added.

◆ reset()

void prtx::MeshBuilder::reset ( )

Resets the builder.

◆ resetMaterials()

void prtx::MeshBuilder::resetMaterials ( )

Removes all previously added materials.

◆ setFaceMaterialIndex()

void prtx::MeshBuilder::setFaceMaterialIndex ( uint32_t  faceId,
uint32_t  index 
)

Sets the material index of the selected face.

Parameters
faceIdIndex of face.
indexMaterial index to set.

◆ setFaceNormalIndices()

void prtx::MeshBuilder::setFaceNormalIndices ( uint32_t  faceId,
const IndexVector indices 
)

Sets the normal indices of the selected face.

Parameters
faceIdIndex of face.
indicesNormal indices to set.

◆ setFaceTextureRegionIndex()

void prtx::MeshBuilder::setFaceTextureRegionIndex ( uint32_t  faceId,
uint32_t  uvSet,
uint32_t  index 
)

Sets the texture region index in the selected uv set of the selected face.

Parameters
faceIdIndex of face.
uvSetIndex of uv set.
indextexture region index to set.

◆ setFaceUVIndices()

void prtx::MeshBuilder::setFaceUVIndices ( uint32_t  faceId,
uint32_t  uvSet,
const IndexVector indices 
)

Sets the uv indices of the selected face and the selected uv set.

Parameters
faceIdIndex of face.
uvSetIndex of uv set.
indicesUV indices to set.

◆ setFaceVertexIndices()

void prtx::MeshBuilder::setFaceVertexIndices ( uint32_t  faceId,
const IndexVector indices 
)

Sets the vertex indices of the selected face.

Parameters
faceIdIndex of face.
indicesVertex indices to set.

◆ setName()

void prtx::MeshBuilder::setName ( const std::wstring &  name)

Set the name of the Mesh.

Parameters
namename to set.

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