Represents a mesh part or object.
More...
#include <3esmeshresource.h>
|
virtual | ~MeshResource () |
| Virtual destructor.
|
|
uint16_t | typeId () const override |
| Returns MtMesh .
|
|
virtual Matrix4f | transform () const =0 |
|
virtual uint32_t | tint () const =0 |
|
virtual uint8_t | drawType (int stream=0) const =0 |
| Returns the DrawType of the mesh. More...
|
|
virtual unsigned | vertexCount (int stream=0) const =0 |
| Returns the number of vertices in the mesh. More...
|
|
virtual unsigned | indexCount (int stream=0) const =0 |
| Returns the number of indices in the mesh. More...
|
|
virtual const float * | vertices (unsigned &stride, int stream=0) const =0 |
| Returns a pointer to the vertex stream. More...
|
|
virtual const uint8_t * | indices (unsigned &stride, unsigned &width, int stream=0) const =0 |
| Returns a pointer to the index stream. More...
|
|
virtual const float * | normals (unsigned &stride, int stream=0) const =0 |
| Returns a pointer to the normal stream. More...
|
|
virtual const float * | uvs (unsigned &stride, int stream=0) const =0 |
| Returns a pointer to the UV stream. More...
|
|
virtual const uint32_t * | colours (unsigned &stride, int stream=0) const =0 |
| Returns a pointer to the colour stream. More...
|
|
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()) * |
|
virtual | ~Resource () |
| Virtual destructor (empty).
|
|
virtual uint32_t | id () const =0 |
| The resource ID. More...
|
|
uint64_t | uniqueKey () const |
| Returns a unique key for this resource, based on the typeId() and id() .
|
|
virtual Resource * | clone () const =0 |
| Clone the resource. More...
|
|
|
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...
|
|
|
*const tes::MeshResource * | mesh = |
|
*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...
|
|
Represents a mesh part or object.
These are visualised via MeshSet
, which may contain several MeshResource
parts.
◆ colours()
virtual const uint32_t* tes::MeshResource::colours |
( |
unsigned & |
stride, |
|
|
int |
stream = 0 |
|
) |
| const |
|
pure virtual |
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] | stride | The stride between colour elements (bytes). This would be 4 for a contiguous array of uint32_t colours. |
| stream | Reserved for future use. |
- Returns
- A pointer to the first colour value or null.
Implemented in tes::SimpleMesh, tes::PointCloud, and tes::MeshPlaceholder.
◆ create()
int tes::MeshResource::create |
( |
PacketWriter & |
packet | ) |
const |
|
overridevirtual |
Populate a mesh creation packet.
- Parameters
-
packet | A packet to populate and send. |
- Returns
- Zero on success, an error code otherwise.
Implements tes::Resource.
◆ destroy()
int tes::MeshResource::destroy |
( |
PacketWriter & |
packet | ) |
const |
|
overridevirtual |
Populate a mesh destroy packet.
- Parameters
-
packet | A packet to populate and send. |
- Returns
- Zero on success, an error code otherwise.
Implements tes::Resource.
◆ drawType()
virtual uint8_t tes::MeshResource::drawType |
( |
int |
stream = 0 | ) |
const |
|
pure virtual |
◆ estimateTransferCount()
static int tes::MeshResource::estimateTransferCount |
( |
size_t |
elementSize, |
|
|
unsigned |
byteLimit, |
|
|
int |
overhead = 0 |
|
) |
| |
|
static |
Estimate the number of elements which can be transferred at the given byteLimit
.
- Parameters
-
elementSize | The byte size of each element. |
byteLimit | The maximum number of bytes to transfer. Note: a hard limit of 0xffff, packet header size and CRC is enforced. Zero indices use of the hard limit. |
Additional | byte overhead to account for. |
◆ indexCount()
virtual unsigned tes::MeshResource::indexCount |
( |
int |
stream = 0 | ) |
const |
|
pure virtual |
◆ indices()
virtual const uint8_t* tes::MeshResource::indices |
( |
unsigned & |
stride, |
|
|
unsigned & |
width, |
|
|
int |
stream = 0 |
|
) |
| const |
|
pure virtual |
Returns a pointer to the index stream.
Supports different index widths. Expects indexCount(stream)
elements or null if no indices.
- Parameters
-
[out] | stride | Specifies the stride between index elements (bytes). This would be 4 for a contiguous array of uint32_t indices. |
[out] | Specifies | the index byte width. Supports [1, 2, 4]. |
| stream | Reserved for future use. |
- Returns
- A pointer to the first index.
Implemented in tes::SimpleMesh, tes::PointCloud, and tes::MeshPlaceholder.
◆ normals()
virtual const float* tes::MeshResource::normals |
( |
unsigned & |
stride, |
|
|
int |
stream = 0 |
|
) |
| const |
|
pure virtual |
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] | stride | The stride between normal elements (bytes). This would be 12 for a contiguous array of float triples. |
| stream | Reserved for future use. |
- Returns
- A pointer to the first normal or null
Implemented in tes::SimpleMesh, tes::PointCloud, and tes::MeshPlaceholder.
◆ packet()
Compose a mesh index component message in packet
.
This method composes a MeshComponentMessage
for writing index data to packet
. The packet
must be reset before calling this method and finalised after calling.
The number of indices written is limited by three factors:
- The available
packet
buffer space.
- The
byteLimit
- The remaining indices to write from
offset
. All present hard limits to the number of indices written to packet
. The number of indices written is reported in the return value.
The index source address starts at dataSource
plus dataStride
times offset
. The dataStride
identifies the space between indices while indexByteWidth
identifies the number of bytes in each integer index.
A complete index set can be written by repeated calls, using the following code: tes::Server server = / server pointer
◆ transfer()
Populate the next mesh data packet.
The progress.phase
is used to track which data array currently being transfered, from the various MeshMessageType
values matching components (e.g., vertices, indices). The progress.progress
value is used to track how many have been transfered.
- Parameters
-
| packet | A packet to populate and send. |
| byteLimit | A nominal byte limit on how much data a single transfer() call may add. |
[in,out] | progress | A progress marker tracking how much has already been transfered, and updated to indicate what has been added to packet . |
- Returns
- Zero on success, an error code otherwise.
Implements tes::Resource.
◆ uvs()
virtual const float* tes::MeshResource::uvs |
( |
unsigned & |
stride, |
|
|
int |
stream = 0 |
|
) |
| const |
|
pure virtual |
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] | stride | The stride between UV elements (bytes). This would be 8 for a contiguous array of float pairs. |
| stream | Reserved for future use. |
- Returns
- A pointer to the first UV coordinate or null.
Implemented in tes::SimpleMesh, tes::PointCloud, and tes::MeshPlaceholder.
◆ vertexCount()
virtual unsigned tes::MeshResource::vertexCount |
( |
int |
stream = 0 | ) |
const |
|
pure virtual |
◆ vertices()
virtual const float* tes::MeshResource::vertices |
( |
unsigned & |
stride, |
|
|
int |
stream = 0 |
|
) |
| const |
|
pure virtual |
Returns a pointer to the vertex stream.
Each element is taken as a triple of single precision floats: (x, y, z).
- Parameters
-
[out] | stride | The stride between vertex elements (bytes). This would be 12 for a contiguous array of float triples. |
| stream | Reserved for future use. |
- Returns
- A pointer to the first vertex.
Implemented in tes::SimpleMesh, tes::PointCloud, and tes::MeshPlaceholder.
◆ writeColours()
static unsigned tes::MeshResource::writeColours |
( |
PacketWriter & |
packet, |
|
|
uint32_t |
meshId, |
|
|
uint32_t |
offset, |
|
|
unsigned |
byteLimit, |
|
|
const uint8_t * |
dataSource, |
|
|
unsigned |
dataStride, |
|
|
uint32_t |
componentCount |
|
) |
| |
|
static |
Compose a mesh component message for writing colour data in packet
.
This method is very similar to writeIndices()
and writeVectors3()
, except that it is intended for 4-byte colour values. Example call below: packet.reset(mesh->typeId(), MmtVertexColour); offset += tes::MeshResource::writeColours( packet, mesh->id(), offset, 0xffffffffu, coloursPtr, dataStride, mesh->vertexCount());
- Parameters
-
packet | Packet to write to. |
meshId | The mesh to which the data belong. |
offset | An vertex count offset to start writing from. See remarks. |
byteLimit | A hard limit on the number of bytes to write. |
dataSource | Base pointer for the vertex data. |
dataStride | Number of bytes between indices. |
componentCount | The total number of indices. |
- Returns
- The number of indices written.
◆ writeVectors2()
static unsigned tes::MeshResource::writeVectors2 |
( |
PacketWriter & |
packet, |
|
|
uint32_t |
meshId, |
|
|
uint32_t |
offset, |
|
|
unsigned |
byteLimit, |
|
|
const uint8_t * |
dataSource, |
|
|
unsigned |
dataStride, |
|
|
uint32_t |
componentCount |
|
) |
| |
|
static |
Compose a mesh float vector 2 component message in packet
.
This method is identical to writeVectors3()
, except that it deals with vector 2 components such as UV coordinates (MmtUv
).
- Parameters
-
packet | Packet to write to. |
meshId | The mesh to which the data belong. |
offset | An vertex count offset to start writing from. See remarks. |
byteLimit | A hard limit on the number of bytes to write. |
dataSource | Base pointer for the vertex data. |
dataStride | Number of bytes between indices. |
componentCount | The total number of indices. |
- Returns
- The number of indices written.
◆ offset
* tes::MeshResource::offset |
Initial value:= tes::MeshResource::writeVectors3(
* 0xffffffffu, vectorPtr,
Compose a mesh float vector 3 component message in packet
.
This method composes a MeshComponentMessage
for writing vector based data to packet
. The packet
must be reset before calling this method and finalised after calling.
The behaviour and calling pattern matches writeIndices()
, except that the size of each vector component is assumed to be three floats (12). The code below shows the call required to replace writeIndices()
in that example code: packet.reset(mesh->typeId(), /* MmtVertex or MmtNormal
The documentation for this class was generated from the following file: