3es
0.7
|
A base class for encapsulating a shape which is to be represented remotely. More...
#include <3esshape.h>
Public Member Functions | |
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 |
Shape & | setId (uint32_t id) |
uint16_t | category () const |
Shape & | setCategory (uint16_t category) |
Shape & | setWireframe (bool wire) |
Sets the wireframe flag value for this shape. More... | |
bool | isWireframe () const |
Returns true if the wireframe flag is set. More... | |
Shape & | setTransparent (bool transparent) |
Sets the transparent flag value for this shape. More... | |
bool | isTransparent () const |
Returns true if the transparent flag is set. More... | |
Shape & | setTwoSided (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... | |
Shape & | setFlags (uint16_t flags) |
Set the full set of ObjectFlag values. More... | |
uint16_t | flags () const |
Retrieve the full set of ObjectFlag values. More... | |
Shape & | setPosition (const V3Arg &pos) |
Vector3f | position () const |
Shape & | setPosX (float p) |
Shape & | setPosY (float p) |
Shape & | setPosZ (float p) |
Shape & | setRotation (const QuaternionArg &rot) |
Quaternionf | rotation () const |
Shape & | setScale (const V3Arg &scale) |
Vector3f | scale () const |
Shape & | setColour (const Colour &colour) |
Colour | colour () const |
virtual void | updateFrom (const Shape &other) |
Update the attributes of this shape to match other . More... | |
virtual bool | writeCreate (PacketWriter &stream) const |
Writes the create message to stream . 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... | |
virtual int | enumerateResources (const Resource **resources, int capacity, int fetchOffset=0) const |
Enumerate the resources used by this shape. More... | |
virtual Shape * | clone () const |
Deep copy clone. More... | |
Protected Member Functions | |
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) |
Protected Attributes | |
uint16_t | _routingId |
CreateMessage | _data |
A base class for encapsulating a shape which is to be represented remotely.
Simple shapes only need a writeCreate()
call to be fully represented, after which writeUpdate()
may move the object. Complex shapes required additional data to be fully represented and the writeCreate()
packet stream may not be large enough to hold all the data. Such complex shapes will have writeData()
called, with a changing progress marker. Complex shapes return true
from isComplex()
.
Note that a shape which is not complex may override the writeCreate()
method and add additional data. Complex shapes are only required when this is not sufficient and the additional data may overflow the packet buffer.
|
inline |
Construct a box object.
id | The shape ID, unique among Arrow objects, or zero for a transient shape. |
category | The category grouping for the shape used for filtering. |
References tes::CreateMessage::attributes, tes::CreateMessage::category, tes::ObjectAttributes::colour, flags(), tes::CreateMessage::flags, tes::CreateMessage::id, tes::ObjectAttributes::position, tes::CreateMessage::reserved, tes::ObjectAttributes::rotation, and tes::ObjectAttributes::scale.
|
virtual |
Deep copy clone.
Reimplemented in tes::MeshShape, tes::PointCloudShape, tes::MeshSet, tes::Text3D, and tes::Text2D.
|
virtual |
Enumerate the resources used by this shape.
Resources are most commonly used by mesh shapes to expose the mesh data, where the shape simply positions the mesh.
The function is called to fetch the shape's resources into resources
, up to the given capacity
. Repeated calls may be used to fetch all resources into a smaller array by using the fetchOffset
parameter as a marker indicating how many items have already been fetched. Regardless, data are always written to resources
starting at index zero.
This function may also be called with a nullptr
for resources
and/or a zero capacity
. In this case the return value indicates the number of resources used by the shape.
resources | The array to populate with this shape's resources. |
capacity | The element count capacity of resources . |
fetchOffset | An offset used to fetch resources into an array too small to hold all available resources. It is essentially the running sum of resources fetched so far. |
resources
when resources
and capacity
are non zero. When resources
is null or capacity
zero, the return value indicates the total number of resources used by the shape. Reimplemented in tes::PointCloudShape, and tes::MeshSet.
|
inline |
Retrieve the full set of ObjectFlag
values.
References tes::CreateMessage::attributes, tes::Colour::c, tes::ObjectAttributes::colour, tes::CreateMessage::flags, tes::ObjectAttributes::position, tes::ObjectAttributes::rotation, and tes::ObjectAttributes::scale.
Referenced by setFlags(), and Shape().
|
inlinevirtual |
Is this a complex shape? Complex shapes have writeData()
called.
Reimplemented in tes::MeshShape, and tes::PointCloudShape.
|
inline |
Returns true if the transparent flag is set.
References tes::CreateMessage::flags, and tes::OFTransparent.
|
inline |
Returns true if the two sided shader flag is set.
References tes::CreateMessage::flags, and tes::OFTwoSided.
|
inline |
Returns true if the wireframe flag is set.
References tes::CreateMessage::flags, and tes::OFWire.
|
protected |
Called when copy
is created from this object to copy appropriate attributes to copy
.
The general use case is for a subclass to override clone()
, creating the correct concrete type, then call onClone()
to copy data. The advantage is that onClone()
can recursively call up the class hierarchy.
copy | The newly cloned object to copy data to. Must not be null. |
|
inline |
Set the full set of ObjectFlag
values.
This affects attributes such as isTwoSided()
and isWireframe()
.
flags | New flag values to write. |
*this
. References flags(), and tes::CreateMessage::flags.
|
inline |
Sets the transparent flag value for this shape.
Only before sending create. Not all shapes will respect the flag.
*this
. References tes::CreateMessage::flags, and tes::OFTransparent.
|
inline |
Sets the two sided shader flag value for this shape.
Only before sending create. Not all shapes will respect the flag.
*this
. References tes::CreateMessage::flags, and tes::OFTwoSided.
|
inline |
Sets the wireframe flag value for this shape.
Only before sending create. Not all shapes will respect the flag.
*this
. References tes::CreateMessage::flags, and tes::OFWire.
|
virtual |
Update the attributes of this shape to match other
.
Used in maintaining cached copies of shapes. The shapes should already represent the same object.
Not all attributes need to be updated. Only attributes which may be updated via an UpdateMessage
for this shape need be copied.
The default implementation copies only the ObjectAttributes
.
other | The shape to update data from. |
|
virtual |
Writes the create message to stream
.
Simple shapes will write all data in the create message. More complex shapes may have additional data which is required to create object (e.g., point clouds). In the latter case, only enough data to initialise the object need be written.
Reimplemented in tes::MeshShape, tes::PointCloudShape, tes::Text3D, tes::MeshSet, and tes::Text2D.
|
inlinevirtual |
Called only for complex shapes to write additional creation data.
stream | The data stream to write to. | |
[in,out] | progressMarker | Indicates data transfer progress. Initially zero, the Shape manages its own semantics. |
Reimplemented in tes::MeshShape, and tes::PointCloudShape.