A component defining the true bounds of a spatially queryable object situated somewhere in the world.
More...
#include <spatial_query_math.hpp>
|
enum class | TrueVolumeType : uint8_t { BOX
, SPHERE
, CAPSULE
} |
| The types of volumes supported by the engine.
|
|
|
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 | getLocalRotationTransform () const |
| Gets the rotation matrix associated with this object's orientation offset.
|
|
glm::mat3 | getWorldRotationTransform () const |
| Gets the rotation matrix associated with the underlying scene object's orientation, derived from its cached transform.
|
|
glm::vec3 | getComputedWorldPosition () const |
| The final position of the origin of the object bounds in the world.
|
|
glm::quat | getComputedWorldOrientation () const |
| The final orientation of the object bounds in the world.
|
|
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.
|
|
|
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::vec3 &orientationOffset) |
| Creates bounds for an object in the shape of a box.
|
|
static ObjectBounds | create (const VolumeCapsule &capsule, const glm::vec3 &positionOffset, const glm::vec3 &orientationOffset) |
| Creates bounds for an object in the shape of a capsule.
|
|
static ObjectBounds | create (const VolumeSphere &sphere, const glm::vec3 &positionOffset, const glm::vec3 &orientationOffset) |
| Creates bounds for an object in the shape of a sphere.
|
|
|
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 | mPosition { 0.f } |
| The position, in the real world, 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 | mOrientation { glm::vec3{ 0.f } } |
| The orientation in the real world 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.
|
|
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.
- See also
- ECSWorld::registerComponentTypes()
◆ applyModelMatrix()
void ObjectBounds::applyModelMatrix |
( |
const glm::mat4 & | modelMatrix | ) |
|
Computes new mPosition and mOrientation offsets based on (presumably) the model transform of the underlying scene object.
- Parameters
-
modelMatrix | The transform specifying the new origin of the underlying scene object. |
◆ create() [1/3]
ObjectBounds ObjectBounds::create |
( |
const VolumeBox & | box, |
|
|
const glm::vec3 & | positionOffset, |
|
|
const glm::vec3 & | orientationOffset ) |
|
static |
Creates bounds for an object in the shape of a box.
- Parameters
-
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 direction that is considered "forward" when the object is in model space. |
- Returns
- ObjectBounds The constructed object bounds.
- Todo
- Oriention offset should just be a quaternion. Multiple quaternions may produce the same forward vector while still altering the up and right vectors.
◆ create() [2/3]
ObjectBounds ObjectBounds::create |
( |
const VolumeCapsule & | capsule, |
|
|
const glm::vec3 & | positionOffset, |
|
|
const glm::vec3 & | orientationOffset ) |
|
static |
Creates bounds for an object in the shape of a capsule.
- Parameters
-
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 direction that is considered "forward" when the object is in model space. |
- Returns
- ObjectBounds The constructed object bounds.
- Todo
- Oriention offset should just be a quaternion. Multiple quaternions may produce the same forward vector while still altering the up and right vectors.
◆ create() [3/3]
ObjectBounds ObjectBounds::create |
( |
const VolumeSphere & | sphere, |
|
|
const glm::vec3 & | positionOffset, |
|
|
const glm::vec3 & | orientationOffset ) |
|
static |
Creates bounds for an object in the shape of a sphere.
- Parameters
-
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 direction that is considered "forward" when the object is in model space. |
- Returns
- ObjectBounds The constructed object bounds.
- Todo
- Oriention offset should just be a quaternion. Multiple quaternions may produce the same forward vector while still altering the up and right vectors.
◆ getComponentTypeName()
static std::string ToyMaker::ObjectBounds::getComponentTypeName |
( |
| ) |
|
|
inlinestatic |
Fetches the component type string associated with this class.
- Returns
- std::string The component type string of this class.
◆ getComputedWorldOrientation()
glm::quat ObjectBounds::getComputedWorldOrientation |
( |
| ) |
const |
The final orientation of the object bounds in the world.
- Returns
- glm::quat The orientation of this node's object bounds.
◆ getComputedWorldPosition()
glm::vec3 ObjectBounds::getComputedWorldPosition |
( |
| ) |
const |
The final position of the origin of the object bounds in the world.
- Returns
- glm::vec3 The origin of this node's object bounds.
◆ getLocalOrientedBoxCorners()
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).
- Returns
- std::array<glm::vec3, 8> An array of coordinates of bounds-aligned box corners in model space.
◆ getLocalRotationTransform()
glm::mat3 ToyMaker::ObjectBounds::getLocalRotationTransform |
( |
| ) |
const |
|
inline |
Gets the rotation matrix associated with this object's orientation offset.
- Returns
- glm::mat3 This object's orientation offset's rotation matrix representation.
◆ getVolumeRelativeBoxCorners()
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.
- Returns
- std::array<glm::vec3, 8> An array of coordinates representing the corners of the box just containing the spatial query volume.
◆ getWorldOrientedBoxCorners()
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.
- Returns
- std::array<glm::vec3, 8> An array of coordinates of bounds-aligned box corners in world space.
◆ getWorldOrientedBoxFaceTriangles()
std::array< AreaTriangle, 12 > ToyMaker::ObjectBounds::getWorldOrientedBoxFaceTriangles |
( |
| ) |
const |
|
inline |
Gets an array of triangles that make up the faces of the bounds-aligned box corners in world space.
- Returns
- std::array<AreaTriangle, 12> An array of triangles for the faces of the bounds-aligned box.
- See also
- getWorldOrientedBoxCorners()
◆ getWorldRotationTransform()
glm::mat3 ToyMaker::ObjectBounds::getWorldRotationTransform |
( |
| ) |
const |
|
inline |
Gets the rotation matrix associated with the underlying scene object's orientation, derived from its cached transform.
- Returns
- glm::mat3 The orientation of the underlying scene object.
The documentation for this struct was generated from the following files: