Shape¶
class Shape
A geometrical closed 3D shape.
A Shape
defines a zone in the world where game objects (listener, sound sources, entities, etc.) can be localized. Shapes are used in many places of the engine, like to define a sound attenuation shape, or to build a room.
Functions¶
Name | Description |
---|---|
Create | Creates a new Shape from a definition. |
Shape | Constructs a new Shape . |
~Shape | Default destructor. |
GetShortestDistanceToEdge | Gets the shortest distance to the edge of this shape. |
GetShortestDistanceToEdge | Gets the shortest distance to the edge of this shape. |
GetShortestDistanceToEdge | Gets the shortest distance to the edge of this shape. |
Contains | Checks if the given entity is contained in this shape. |
Contains | Checks if the given listener is contained in this shape. |
Contains | Checks if the given position is contained in this shape. |
SetLocation | Sets the location of this shape in the 3D environment. |
SetOrientation | Sets the orientation of this shape. |
GetOrientation | Gets the orientation of this shape. |
GetLookAt | Gets the LookAt transformation matrix for this shape. |
GetLocation | Gets the position of this shape in the 3D environment. |
GetDirection | Gets the position of this shape in the 3D environment. |
GetUp | Gets the up vector of the zone. |
Function Details¶
Contains¶
[[nodiscard]] virtual bool Contains(const Entity& entity)
Checks if the given entity is contained in this shape.
- Parameter
entity
- The entity to check.
- Return
true
if the shape contains the entity,false
otherwise.
[[nodiscard]] virtual bool Contains(const Listener& listener)
Checks if the given listener is contained in this shape.
- Parameter
listener
- The listener to check.
- Return
true
if the shape contains the listener,false
otherwise.
[[nodiscard]] virtual bool Contains(const AmVec3& location) = 0
Checks if the given position is contained in this shape.
- Parameter
location
- The 3D position to check.
- Return
true
if the shape contains the given position,false
otherwise.
Create¶
static Shape* Create(const ShapeDefinition* definition)
Creates a new Shape
from a definition.
- Parameter
definition
- The definition of the shape generated from a flatbuffer binary.
Warning
This method is intended for internal usage only.
GetDirection¶
[[nodiscard]] AmVec3 GetDirection() const
Gets the position of this shape in the 3D environment.
- Return
- The shape's position.
GetLocation¶
[[nodiscard]] const AmVec3& GetLocation() const
Gets the position of this shape in the 3D environment.
- Return
- The shape's position.
GetLookAt¶
[[nodiscard]] const AmMat4& GetLookAt() const
Gets the LookAt transformation matrix for this shape.
- Return
- The look-at transformation matrix.
GetOrientation¶
[[nodiscard]] const Orientation& GetOrientation() const
Gets the orientation of this shape.
- Return
- The orientation of this shape.
GetShortestDistanceToEdge¶
[[nodiscard]] virtual AmReal32 GetShortestDistanceToEdge(const Entity& entity)
Gets the shortest distance to the edge of this shape.
- Parameter
entity
- The entity from which calculate the distance.
- Return
- The shortest distance from the entity location to the edge of this shape. If negative, the given entity in outside the shape.
[[nodiscard]] virtual AmReal32 GetShortestDistanceToEdge(const Listener& listener)
Gets the shortest distance to the edge of this shape.
- Parameter
listener
- The listener from which calculate the distance.
- Return
- The shortest distance from the listener location to the edge of this shape. If negative, the given listener in outside the shape.
[[nodiscard]] virtual AmReal32 GetShortestDistanceToEdge(const AmVec3& location) = 0
Gets the shortest distance to the edge of this shape.
- Parameter
location
- The location from which calculate the distance.
- Return
- The shortest distance from the location to the edge of this shape. If negative, the given location in outside the shape.
GetUp¶
[[nodiscard]] AmVec3 GetUp() const
Gets the up vector of the zone.
- Return
- The up vector.
SetLocation¶
void SetLocation(const AmVec3& location)
Sets the location of this shape in the 3D environment.
- Parameter
location
- The shape location.
SetOrientation¶
void SetOrientation(const Orientation& orientation)
Sets the orientation of this shape.
- Parameter
orientation
- The new orientation.
Shape¶
Shape()
Constructs a new Shape
.
~Shape¶
virtual ~Shape() = default
Default destructor.