|
ToyMaker Game Engine 0.0.2
ToyMaker is a game engine developed and maintained by Zoheb Shujauddin.
|
A component defining the true bounds of a spatially queryable object situated somewhere in the world. More...
#include <types.hpp>
Classes | |
| union | TrueVolume |
| A union of supported volume structs. More... | |
Public Types | |
| enum class | TrueVolumeType : uint8_t { BOX =0 , SPHERE , CAPSULE } |
| The types of volumes supported by the engine. | |
Public Member Functions | |
| void | applyModelMatrix (const glm::mat4 &modelMatrix) |
| Computes new mPosition and mOrientation offsets based on (presumably) the model transform of the underlying scene object. | |
| glm::mat3 | getRotationTransformLocal () const |
| Gets the rotation matrix associated with this object's orientation offset. | |
| glm::mat4 | getRotationTransformOrigin () const |
| Gets the rotation matrix associated with the underlying scene object's orientation. | |
| glm::mat4 | getTranslationTransformOrigin () const |
| Gets the translation matrix associated with the underlying scene object's translation. | |
| glm::vec3 | getPositionWorld () const |
| The final position of the origin of the object bounds in the world. | |
| void | setPositionWorld (const glm::vec3 &newPosition) |
| Sets the new world position for the object while keeping its offset relative to its entity fixed. | |
| void | setPositionOffset (const glm::vec3 &newPosition) |
| Sets the offset of the bounds origin to the scene node origin. | |
| void | setPositionOrigin (const glm::vec3 &newPosition) |
| Sets the position of the scene node origin. | |
| void | recomputeWorldPositionOrientation () |
| Recomputes bounds world position based on origin and offsets. | |
| glm::quat | getOrientationWorld () const |
| The final orientation of the object bounds in the world. | |
| void | setOrientationWorld (const glm::quat &newOrientation) |
| Sets the new world orientation for the object while keeping its offset relative to its entity fixed. | |
| void | setOrientationOffset (const glm::quat &newOrientation) |
| Sets orientation offset relative to the scene node's orientation. | |
| void | setOrientationOrigin (const glm::quat &newOrientation) |
| Sets orientation of the scene node. | |
| std::array< glm::vec3, 8 > | getVolumeRelativeBoxCorners () const |
| Gets the corners of the box just encapsulating this object's true volume, relative to the origin of the spatial query volume alone. | |
| std::array< glm::vec3, 8 > | getLocalOrientedBoxCorners () const |
| Gets the corners of the box just encapsulating this object's true volume and sharing its position and orientation, relative to the origin of the underlying scene node at 0,0,0 (in short, in model space). | |
| std::array< glm::vec3, 8 > | getWorldOrientedBoxCorners () const |
| Gets the corners of the box just encapsulating this object's true volume relative to the origin of the underlying scene node in world space. | |
| std::array< AreaTriangle, 12 > | getWorldOrientedBoxFaceTriangles () const |
| Gets an array of triangles that make up the faces of the bounds-aligned box corners in world space. | |
| std::pair< TrueVolumeType, TrueVolume > | getVolume () const |
| Returns the volume and its type associated with these bounds. | |
| void | setVolume (TrueVolumeType type, const TrueVolume &volume) |
| Sets the volume for these bounds. | |
| void | setVolumeBox (const glm::vec3 &boxDimensions) |
| Sets a box volume for this object. | |
| void | setVolumeCapsule (float radius, float height) |
| Sets a capsule volume for this object. | |
| void | setVolumeSphere (float radius) |
| Sets a sphere volume for this object. | |
| glm::vec3 | getSupportAlong (const glm::vec3 &axis) const |
| Returns the point on this object's surface furthest along a given axis from the origin of this object. | |
| std::pair< float, float > | getProjectionAlong (const glm::vec3 &axis) const |
| Returns this shape's projection along some unit vector. | |
| bool | isSensible () const |
| Returns whether the underlying volume has sensible parameters (i.e., finite, non-degenerate, non-negative parameters). | |
| bool | isPositiveStrict () const |
| Checks whether underlying bounds is non-trivial, as in each important parameter that represents the volume is greater than 0. | |
| InteractionLayerMask | getInteractionLayers () const |
| Returns an integer representing which spatial queries and collisions this object will participate in. | |
| void | setInteractionLayers (InteractionLayerMask newLayers) |
| Moves this object into a new group of interaction layers. | |
| InteractionLayerMask | getInteractionMask () const |
| Returns an integer representing which layers this object will generate spatial queries and collisions for. | |
| void | setInteractionMask (InteractionLayerMask newMask) |
| Changes which set of interaction layers this object can trigger events with. | |
Static Public Member Functions | |
| static std::string | getComponentTypeName () |
| Fetches the component type string associated with this class. | |
| static ObjectBounds | create (const VolumeBox &box, const glm::vec3 &positionOffset, const glm::quat &orientationOffset, InteractionLayerMask interactionLayers=0x1, InteractionLayerMask interactionMask=std::numeric_limits< InteractionLayerMask >::max()) |
| Creates bounds for an object in the shape of a box. | |
| static ObjectBounds | create (const VolumeCapsule &capsule, const glm::vec3 &positionOffset, const glm::quat &orientationOffset, InteractionLayerMask interactionLayers=0x1, InteractionLayerMask interactionMask=std::numeric_limits< InteractionLayerMask >::max()) |
| Creates bounds for an object in the shape of a capsule. | |
| static ObjectBounds | create (const VolumeSphere &sphere, const glm::vec3 &positionOffset, const glm::quat &orientationOffset, InteractionLayerMask interactionLayers=0x1, InteractionLayerMask interactionMask=std::numeric_limits< InteractionLayerMask >::max()) |
| Creates bounds for an object in the shape of a sphere. | |
Public Attributes | |
| TrueVolumeType | mType { TrueVolumeType::BOX } |
| Value indicating the type of the volume represented by this object. | |
| TrueVolume | mTrueVolume {} |
| The data defining the volume itself, independent of its position. | |
| glm::vec3 | mPositionWorld { 0.f } |
| The world position of the bounds of this object in the current frame. | |
| glm::vec3 | mPositionOrigin { 0.f } |
| The position, in the real world, of origin of the scene node this data is attached to. | |
| glm::vec3 | mPositionOffset { 0.f } |
| The position of the origin of the spatial query volume relative to the origin of the node it is attached to. | |
| glm::quat | mOrientationWorld { glm::vec3 { 0.f } } |
| The world orientation of the bounds of this object in the current frame. | |
| glm::quat | mOrientationOrigin { glm::vec3{ 0.f } } |
| The orientation in the real world of the origin of the scene node this bounds component is attached to. | |
| glm::quat | mOrientationOffset { glm::vec3{ 0.f } } |
| The transformation mapping forward as known by the underlying scene node, to forward as known by the spatial query volume. | |
| InteractionLayerMask | mInteractionLayers { 0x1 } |
| Determines which spatial queries and collisions this object participates in. | |
| InteractionLayerMask | mInteractionMask { std::numeric_limits<InteractionLayerMask>::max() } |
| Determines which spatial queries and collisions this object will generate. | |
| bool | mUpdatedFromTransform { true } |
| Whether an update on the object's transform is allowed to modify object bounds properties. | |
| bool | mTransformUpdateRequired { false } |
| Flag set when object position or orientation has been set through this component, indicating that the user facing Transform should be updated accordingly. | |
| bool | mVolumeSystemComputed { true } |
| Flag set when these object bounds were set by the engine, through light bounds compute or model bounds compute. | |
| bool | mVolumeUpdateRequired { true } |
| Flag set when this object's bounds must be recomputed by a related system. | |
| bool | mPhysicsRecomputeRequired { true } |
| Flag set when this object's physics properties must be recomputed according to its new volume. | |
A component defining the true bounds of a spatially queryable object situated somewhere in the world.
Also provides methods for retrieving related axis aligned and volume aligned box properties.
| void ObjectBounds::applyModelMatrix | ( | const glm::mat4 & | modelMatrix | ) |
Computes new mPosition and mOrientation offsets based on (presumably) the model transform of the underlying scene object.
| modelMatrix | The transform specifying the new origin of the underlying scene object. |
|
static |
Creates bounds for an object in the shape of a box.
| box | The data defining the volume itself, independent of its placement. |
| positionOffset | The offset of the center of the box, relative to the owning entity's position per its Transform. |
| orientationOffset | The quaternion specifying the angle offset for these bounds |
| interactionLayers | Which set of interaction layers this object belongs to |
| interactionMask | Which set of interaction layers this object triggers interactions with |
|
static |
Creates bounds for an object in the shape of a capsule.
| capsule | The data defining the volume itself. |
| positionOffset | The offset of the center of the capsule, relative to the owning entity's position per its Transform. |
| orientationOffset | The quaternion specifying the angle offset for these bounds |
| interactionLayers | Which set of interaction layers this object belongs to |
| interactionMask | Which set of interaction layers this object triggers interactions with |
|
static |
Creates bounds for an object in the shape of a sphere.
| sphere | The data defining the volume itself. |
| positionOffset | The offset of the center of the sphere, relative to the owning entity's position per its Transform. |
| orientationOffset | The quaternion specifying the angle offset for these bounds |
| interactionLayers | Which set of interaction layers this object belongs to |
| interactionMask | Which set of interaction layers this object triggers interactions with |
|
inlinestatic |
Fetches the component type string associated with this class.
| std::array< glm::vec3, 8 > ObjectBounds::getLocalOrientedBoxCorners | ( | ) | const |
Gets the corners of the box just encapsulating this object's true volume and sharing its position and orientation, relative to the origin of the underlying scene node at 0,0,0 (in short, in model space).
| glm::quat ObjectBounds::getOrientationWorld | ( | ) | const |
The final orientation of the object bounds in the world.
Orientation here refers to global orientation, where w=1,xyz=0 corresponds to the object facing down the -Z axis
| glm::vec3 ObjectBounds::getPositionWorld | ( | ) | const |
The final position of the origin of the object bounds in the world.
| std::pair< float, float > ObjectBounds::getProjectionAlong | ( | const glm::vec3 & | axis | ) | const |
Returns this shape's projection along some unit vector.
|
inline |
Gets the rotation matrix associated with this object's orientation offset.
|
inline |
Gets the rotation matrix associated with the underlying scene object's orientation.
| glm::vec3 ObjectBounds::getSupportAlong | ( | const glm::vec3 & | axis | ) | const |
Returns the point on this object's surface furthest along a given axis from the origin of this object.
Strongly related to the Gilbert-Johnson-Keerthi (GJK) algorithm for detecting intersections of convex shapes.
|
inline |
Gets the translation matrix associated with the underlying scene object's translation.
| std::array< glm::vec3, 8 > ObjectBounds::getVolumeRelativeBoxCorners | ( | ) | const |
Gets the corners of the box just encapsulating this object's true volume, relative to the origin of the spatial query volume alone.
| std::array< glm::vec3, 8 > ObjectBounds::getWorldOrientedBoxCorners | ( | ) | const |
Gets the corners of the box just encapsulating this object's true volume relative to the origin of the underlying scene node in world space.
|
inline |
Gets an array of triangles that make up the faces of the bounds-aligned box corners in world space.
| void ObjectBounds::setOrientationOffset | ( | const glm::quat & | newOrientation | ) |
Sets orientation offset relative to the scene node's orientation.
Does not keep bounds orientation stable.
| void ObjectBounds::setOrientationOrigin | ( | const glm::quat & | newOrientation | ) |
Sets orientation of the scene node.
Does not keep bounds orientation stable.
| void ObjectBounds::setOrientationWorld | ( | const glm::quat & | newOrientation | ) |
Sets the new world orientation for the object while keeping its offset relative to its entity fixed.
Orientation here refers to global orientation, where w=1,xyz=0 corresponds to the object facing down the -Z axis
Keeps bounds orientation stable, while updating origin orientation.
| void ObjectBounds::setPositionOffset | ( | const glm::vec3 & | newPosition | ) |
Sets the offset of the bounds origin to the scene node origin.
Does not keep bounds position stable while updating position offset.
| void ObjectBounds::setPositionOrigin | ( | const glm::vec3 & | newPosition | ) |
Sets the position of the scene node origin.
Does not keep bounds position stable while updating position offset.
| void ObjectBounds::setPositionWorld | ( | const glm::vec3 & | newPosition | ) |
Sets the new world position for the object while keeping its offset relative to its entity fixed.
| newPosition | The new position this object should appear in |
Keeps bounds position stable while updating origin orientation.
| bool ToyMaker::ObjectBounds::mVolumeSystemComputed { true } |
Flag set when these object bounds were set by the engine, through light bounds compute or model bounds compute.
This is set to false when bounds are set by the scene description or by a user-side aspect.
| bool ToyMaker::ObjectBounds::mVolumeUpdateRequired { true } |
Flag set when this object's bounds must be recomputed by a related system.