3es  0.7
tes::MeshSet Class Reference

Represents a mesh shape. More...

#include <3esmeshset.h>

Inheritance diagram for tes::MeshSet:
tes::Shape

Public Member Functions

 MeshSet (uint32_t id=0u, uint16_t category=0u, int partCount=0)
 Create a shape with a partCount parts. More...
 
 MeshSet (const MeshResource *part, uint32_t id=0u, uint16_t category=0u)
 Create a shape with a single part with transform matching the shape transform. More...
 
 ~MeshSet ()
 Destructor.
 
int partCount () const
 Get the number of parts to this shape. More...
 
void setPart (int index, const MeshResource *part, const Matrix4f &transform)
 Set the part at the given index. More...
 
const MeshResourcepartAt (int index) const
 Fetch the part at the given index. More...
 
const Matrix4fpartTransform (int index) const
 Fetch the transform for the part at the given index. More...
 
bool writeCreate (PacketWriter &stream) const override
 Overridden to include the number of mesh parts, their IDs and transforms.
 
int enumerateResources (const Resource **resources, int capacity, int fetchOffset=0) const override
 Enumerate the mesh resources for this shape. More...
 
Shapeclone () const override
 Clone the mesh shape. More...
 
- Public Member Functions inherited from tes::Shape
 Shape (uint16_t routingId, uint32_t id=0)
 
 Shape (uint16_t routingId, uint32_t id, uint16_t category)
 Construct a box object. More...
 
uint16_t routingId () const
 
uint32_t id () const
 
ShapesetId (uint32_t id)
 
uint16_t category () const
 
ShapesetCategory (uint16_t category)
 
ShapesetWireframe (bool wire)
 Sets the wireframe flag value for this shape. More...
 
bool isWireframe () const
 Returns true if the wireframe flag is set. More...
 
ShapesetTransparent (bool transparent)
 Sets the transparent flag value for this shape. More...
 
bool isTransparent () const
 Returns true if the transparent flag is set. More...
 
ShapesetTwoSided (bool twoSided)
 Sets the two sided shader flag value for this shape. More...
 
bool isTwoSided () const
 Returns true if the two sided shader flag is set. More...
 
ShapesetFlags (uint16_t flags)
 Set the full set of ObjectFlag values. More...
 
uint16_t flags () const
 Retrieve the full set of ObjectFlag values. More...
 
ShapesetPosition (const V3Arg &pos)
 
Vector3f position () const
 
ShapesetPosX (float p)
 
ShapesetPosY (float p)
 
ShapesetPosZ (float p)
 
ShapesetRotation (const QuaternionArg &rot)
 
Quaternionf rotation () const
 
ShapesetScale (const V3Arg &scale)
 
Vector3f scale () const
 
ShapesetColour (const Colour &colour)
 
Colour colour () const
 
virtual void updateFrom (const Shape &other)
 Update the attributes of this shape to match other. More...
 
virtual int writeData (PacketWriter &stream, unsigned &progressMarker) const
 Called only for complex shapes to write additional creation data. More...
 
bool writeUpdate (PacketWriter &stream) const
 
bool writeDestroy (PacketWriter &stream) const
 
virtual bool isComplex () const
 Is this a complex shape? Complex shapes have writeData() called. More...
 

Protected Member Functions

void onClone (MeshSet *copy) const
 
- Protected Member Functions inherited from tes::Shape
void onClone (Shape *copy) const
 Called when copy is created from this object to copy appropriate attributes to copy. More...
 
void init (uint32_t id, uint16_t cat=0, uint16_t flags=0)
 

Additional Inherited Members

- Protected Attributes inherited from tes::Shape
uint16_t _routingId
 
CreateMessage _data
 

Detailed Description

Represents a mesh shape.

Requires a MeshResource parts to get represent mesh topology. The shape never owns the MeshResource parts and they must outlive the shape.

Constructor & Destructor Documentation

◆ MeshSet() [1/2]

tes::MeshSet::MeshSet ( uint32_t  id = 0u,
uint16_t  category = 0u,
int  partCount = 0 
)

Create a shape with a partCount parts.

Use setPart() to populate.

Parameters
partCountThe number of parts to the mesh.
idThe unique mesh shape ID, zero for transient (not recommended for mesh shapes).
categoryThe mesh shape category.

◆ MeshSet() [2/2]

tes::MeshSet::MeshSet ( const MeshResource part,
uint32_t  id = 0u,
uint16_t  category = 0u 
)

Create a shape with a single part with transform matching the shape transform.

Parameters
partThe mesh part.
idThe unique mesh shape ID, zero for transient (not recommended for mesh shapes).
categoryThe mesh shape category.

Member Function Documentation

◆ clone()

Shape* tes::MeshSet::clone ( ) const
overridevirtual

Clone the mesh shape.

MeshResource objects are shared.

Returns
The cloned shape.

Reimplemented from tes::Shape.

◆ enumerateResources()

int tes::MeshSet::enumerateResources ( const Resource **  resources,
int  capacity,
int  fetchOffset = 0 
) const
overridevirtual

Enumerate the mesh resources for this shape.

Todo:
Add material resources.

Reimplemented from tes::Shape.

◆ partAt()

const MeshResource * tes::MeshSet::partAt ( int  index) const
inline

Fetch the part at the given index.

Parameters
indexThe part index to fetch. Must be in the range [0, partCount()).
Returns
The mesh at the given index.

◆ partCount()

int tes::MeshSet::partCount ( ) const
inline

Get the number of parts to this shape.

Returns
The number of parts this shape has.

◆ partTransform()

const Matrix4f & tes::MeshSet::partTransform ( int  index) const
inline

Fetch the transform for the part at the given index.

Parameters
indexThe part transform to fetch. Must be in the range [0, partCount()).
Returns
The transform for the mesh at the given index.

◆ setPart()

void tes::MeshSet::setPart ( int  index,
const MeshResource part,
const Matrix4f transform 
)
inline

Set the part at the given index.

Parameters
indexThe part index to set. Must be in the range [0, partCount()).
partThe mesh data to set at index.
transformThe transform for this part, relative to this shape's transform. This transform may not be updated after the shape is sent to a client.

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