3es  0.7
tes::MeshPlaceholder Class Reference

A placeholder for a mesh resource, carrying only a mesh ID. More...

#include <3esmeshplaceholder.h>

Inheritance diagram for tes::MeshPlaceholder:
tes::MeshResource tes::Resource

Public Member Functions

 MeshPlaceholder (uint32_t id)
 Create a placeholder mesh resource for the given id. More...
 
void setId (uint32_t newId)
 Changes the ID the placeholder publishes. More...
 
uint32_t id () const override
 Returns the ID the placeholder was constructed with.
 
Matrix4f transform () const override
 
uint32_t tint () const override
 
uint8_t drawType (int stream=0) const override
 Returns the DrawType of the mesh. More...
 
unsigned vertexCount (int stream=0) const override
 Returns the number of vertices in the mesh. More...
 
unsigned indexCount (int stream=0) const override
 Returns the number of indices in the mesh. More...
 
const float * vertices (unsigned &stride, int stream=0) const override
 Returns a pointer to the vertex stream. More...
 
const uint8_t * indices (unsigned &stride, unsigned &width, int stream=0) const override
 Returns a pointer to the index stream. More...
 
const float * normals (unsigned &stride, int stream=0) const override
 Returns a pointer to the normal stream. More...
 
const float * uvs (unsigned &stride, int stream=0) const override
 Returns a pointer to the UV stream. More...
 
const uint32_t * colours (unsigned &stride, int stream=0) const override
 Returns a pointer to the colour stream. More...
 
- Public Member Functions inherited from tes::MeshResource
virtual ~MeshResource ()
 Virtual destructor.
 
uint16_t typeId () const override
 Returns MtMesh.
 
int create (PacketWriter &packet) const override
 Populate a mesh creation packet. More...
 
int destroy (PacketWriter &packet) const override
 Populate a mesh destroy packet. More...
 
int transfer (PacketWriter &packet, int byteLimit, TransferProgress &progress) const override
 Populate the next mesh data packet. More...
 
*tes::PacketWriter packet ()
 Compose a mesh index component message in packet. More...
 
while (offset< mesh->indexCount()) *
 
- Public Member Functions inherited from tes::Resource
virtual ~Resource ()
 Virtual destructor (empty).
 
uint64_t uniqueKey () const
 Returns a unique key for this resource, based on the typeId() and id().
 
virtual Resourceclone () const =0
 Clone the resource. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from tes::MeshResource
static int estimateTransferCount (size_t elementSize, unsigned byteLimit, int overhead=0)
 Estimate the number of elements which can be transferred at the given byteLimit. More...
 
*</code > **param packet Packet to write to *param meshId The mesh to which the data belong *param offset An index count offset to start writing from See remarks *param byteLimit A hard limit on the number of bytes to write *param dataSource Base pointer for the index data *param dataStride Number of bytes between indices *param indexByteWidth The byte size of a single index Generally equal to p dataStride *param componentCount The total number of indices *return The number of indices written *static unsigned writeIndices (PacketWriter &packet, uint32_t meshId, uint32_t offset, unsigned byteLimit, const uint8_t *dataSource, unsigned dataStride, unsigned indexByteWidth, uint32_t componentCount)
 
*</code > **param packet Packet to write to *param meshId The mesh to which the data belong *param offset An vertex count offset to start writing from See remarks *param byteLimit A hard limit on the number of bytes to write *param dataSource Base pointer for the vertex data *param dataStride Number of bytes between indices *param componentCount The total number of indices *return The number of indices written *static unsigned writeVectors3 (PacketWriter &packet, uint32_t meshId, uint32_t offset, unsigned byteLimit, const uint8_t *dataSource, unsigned dataStride, uint32_t componentCount)
 
static unsigned writeVectors2 (PacketWriter &packet, uint32_t meshId, uint32_t offset, unsigned byteLimit, const uint8_t *dataSource, unsigned dataStride, uint32_t componentCount)
 Compose a mesh float vector 2 component message in packet. More...
 
static unsigned writeColours (PacketWriter &packet, uint32_t meshId, uint32_t offset, unsigned byteLimit, const uint8_t *dataSource, unsigned dataStride, uint32_t componentCount)
 Compose a mesh component message for writing colour data in packet. More...
 
- Public Attributes inherited from tes::MeshResource
*const tes::MeshResourcemesh =
 
*uint32_t offset = 0
 
*unsigned dataStride
 
*unsigned indexByteWidth
 
*const uint8_t * indicesPtr = reinterpret_cast<const uint8_t *>(indices(dataStride, indexByteWidth))
 
offset
 Compose a mesh float vector 3 component message in packet. More...
 
- Protected Member Functions inherited from tes::MeshResource
virtual void nextPhase (TransferProgress &progress) const
 

Detailed Description

A placeholder for a mesh resource, carrying only a mesh ID.

All other fields and data manipulations are null and void.

This can be use to reference an existing mesh resource, primarily when using the macro interface to release a mesh set such as with the tesmacros.

Constructor & Destructor Documentation

◆ MeshPlaceholder()

tes::MeshPlaceholder::MeshPlaceholder ( uint32_t  id)

Create a placeholder mesh resource for the given id.

Parameters
idThe ID this placeholder publishes.

Member Function Documentation

◆ colours()

const uint32_t* tes::MeshPlaceholder::colours ( unsigned &  stride,
int  stream = 0 
) const
overridevirtual

Returns a pointer to the colour stream.

Each element is taken 32-bit integer. Expects vertexCount(stream) elements or null if no vertex colours.

Parameters
[out]strideThe stride between colour elements (bytes). This would be 4 for a contiguous array of uint32_t colours.
streamReserved for future use.
Returns
A pointer to the first colour value or null.

Implements tes::MeshResource.

◆ drawType()

uint8_t tes::MeshPlaceholder::drawType ( int  stream = 0) const
overridevirtual

Returns the DrawType of the mesh.

Parameters
streamReserved for future use.

Implements tes::MeshResource.

◆ indexCount()

unsigned tes::MeshPlaceholder::indexCount ( int  stream = 0) const
overridevirtual

Returns the number of indices in the mesh.

Parameters
streamReserved for future use.
Returns
The number of indices.

Implements tes::MeshResource.

◆ indices()

const uint8_t* tes::MeshPlaceholder::indices ( unsigned &  stride,
unsigned &  width,
int  stream = 0 
) const
overridevirtual

Returns a pointer to the index stream.

Supports different index widths. Expects indexCount(stream) elements or null if no indices.

Parameters
[out]strideSpecifies the stride between index elements (bytes). This would be 4 for a contiguous array of uint32_t indices.
[out]Specifiesthe index byte width. Supports [1, 2, 4].
streamReserved for future use.
Returns
A pointer to the first index.

Implements tes::MeshResource.

◆ normals()

const float* tes::MeshPlaceholder::normals ( unsigned &  stride,
int  stream = 0 
) const
overridevirtual

Returns a pointer to the normal stream.

Each element is taken as a triple of single precision floats: (x, y, z). Expects vertexColour(stream) elements or null if no normals.

Parameters
[out]strideThe stride between normal elements (bytes). This would be 12 for a contiguous array of float triples.
streamReserved for future use.
Returns
A pointer to the first normal or null

Implements tes::MeshResource.

◆ setId()

void tes::MeshPlaceholder::setId ( uint32_t  newId)

Changes the ID the placeholder publishes.

Use with care.

Parameters
newIdThe new value for id().

◆ tint()

uint32_t tes::MeshPlaceholder::tint ( ) const
overridevirtual

Implements tes::MeshResource.

◆ transform()

Matrix4f tes::MeshPlaceholder::transform ( ) const
overridevirtual

Implements tes::MeshResource.

◆ uvs()

const float* tes::MeshPlaceholder::uvs ( unsigned &  stride,
int  stream = 0 
) const
overridevirtual

Returns a pointer to the UV stream.

Each element is taken as a pair of single precision floats: (u, v). Expects vertexCount(stream) elements or null if no UVs.

Parameters
[out]strideThe stride between UV elements (bytes). This would be 8 for a contiguous array of float pairs.
streamReserved for future use.
Returns
A pointer to the first UV coordinate or null.

Implements tes::MeshResource.

◆ vertexCount()

unsigned tes::MeshPlaceholder::vertexCount ( int  stream = 0) const
overridevirtual

Returns the number of vertices in the mesh.

Parameters
streamReserved for future use.
Returns
The number of vertices.

Implements tes::MeshResource.

◆ vertices()

const float* tes::MeshPlaceholder::vertices ( unsigned &  stride,
int  stream = 0 
) const
overridevirtual

Returns a pointer to the vertex stream.

Each element is taken as a triple of single precision floats: (x, y, z).

Parameters
[out]strideThe stride between vertex elements (bytes). This would be 12 for a contiguous array of float triples.
streamReserved for future use.
Returns
A pointer to the first vertex.

Implements tes::MeshResource.


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