Shape¶
A geometrical closed 3D shape.
Inherited by the following classes: SparkyStudios::Audio::Amplitude::BoxShape, SparkyStudios::Audio::Amplitude::CapsuleShape, SparkyStudios::Audio::Amplitude::ConeShape, SparkyStudios::Audio::Amplitude::SphereShape
Detailed Description¶
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.
Public Functions¶
| Type | Name |
|---|---|
| virtual bool | Contains (const Entity & entity) const Checks if the given entity is contained in this shape. |
| virtual bool | Contains (const Listener & listener) const Checks if the given listener is contained in this shape. |
| virtual bool | Contains (const AmVector3 & location) const = 0 Checks if the given position is contained in this shape. |
| AmVector3 | GetDirection () const Gets the position of this shape in the 3D environment. |
| const AmVector3 & | GetLocation () const Gets the position of this shape in the 3D environment. |
| const AmMatrix4 & | GetLookAt () const Gets the LookAt transformation matrix for this shape. |
| const Orientation & | GetOrientation () const Gets the orientation of this shape. |
| virtual AmReal32 | GetShortestDistanceToEdge (const Entity & entity) const Gets the shortest distance to the edge of this shape. |
| virtual AmReal32 | GetShortestDistanceToEdge (const Listener & listener) const Gets the shortest distance to the edge of this shape. |
| virtual AmReal32 | GetShortestDistanceToEdge (const AmVector3 & location) const = 0 Gets the shortest distance to the edge of this shape. |
| AmVector3 | GetUp () const Gets the up vector of the zone. |
| void | SetLocation (const AmVector3 & location) Sets the location of this shape in the 3D environment. |
| void | SetOrientation (const Orientation & orientation) Sets the orientation of this shape. |
| Shape () Constructs a new Shape . | |
| virtual | ~Shape () = default Default destructor. |
Public Static Functions¶
| Type | Name |
|---|---|
| std::shared_ptr< Shape > | Create (const ShapeDefinition * definition) Creates a new Shape from a definition. |
Protected Attributes¶
| Type | Name |
|---|---|
| AmVector3 | m_location Represents the 3D position of an object in space. |
| AmMatrix4 | m_lookAtMatrix The look-at matrix representing a transformation in 3D space. |
| bool | m_needUpdate Indicates whether an update is required. |
| Orientation | m_orientation Represents the orientation of an object in 3D space. |
Protected Functions¶
| Type | Name |
|---|---|
| virtual void | Update () = 0 Updates the internal state of the shape. |
| void | UpdateIfNeeded () const Performs an update of the internal state if needed. |
Public Functions Documentation¶
Contains[1/3]
Checks if the given entity is contained in this shape.
Parameters:
-
entityThe entity to check.
Returns:
true if the shape contains the entity, false otherwise.
Contains[2/3]
Checks if the given listener is contained in this shape.
Parameters:
-
listenerThe listener to check.
Returns:
true if the shape contains the listener, false otherwise.
Contains[3/3]
Checks if the given position is contained in this shape.
Parameters:
-
locationThe 3D position to check.
Returns:
true if the shape contains the given position, false otherwise.
GetDirection
Gets the position of this shape in the 3D environment.
Returns:
The shape's position.
GetLocation
Gets the position of this shape in the 3D environment.
Returns:
The shape's position.
GetLookAt
Gets the LookAt transformation matrix for this shape.
Returns:
The look-at transformation matrix.
GetOrientation
Gets the orientation of this shape.
Returns:
The orientation of this shape.
GetShortestDistanceToEdge[1/3]
Gets the shortest distance to the edge of this shape.
Parameters:
-
entityThe entity used to calculate the distance.
Returns:
The shortest distance from the entity location to the edge of this shape. If negative, the given entity in outside the shape.
GetShortestDistanceToEdge[2/3]
Gets the shortest distance to the edge of this shape.
Parameters:
-
listenerThe listener used to calculate the distance.
Returns:
The shortest distance from the listener location to the edge of this shape. If negative, the given listener in outside the shape.
GetShortestDistanceToEdge[3/3]
Gets the shortest distance to the edge of this shape.
virtual AmReal32 Amplitude::Shape::GetShortestDistanceToEdge (
const AmVector3 & location
) const = 0
Parameters:
-
locationThe location from which calculate the distance.
Returns:
The shortest distance from the location to the edge of this shape. If negative, the given location in outside the shape.
GetUp
Gets the up vector of the zone.
Returns:
The up vector.
SetLocation
Sets the location of this shape in the 3D environment.
Parameters:
-
locationThe shape location.
SetOrientation
Sets the orientation of this shape.
Parameters:
-
orientationThe new orientation.
Public Static Functions Documentation¶
Create
Creates a new Shape from a definition.
Parameters:
-
definitionThe definition of the shape generated from a flatbuffer binary.
Warning:
This method is intended for internal usage only.
Protected Attributes Documentation¶
m_location
Represents the 3D position of an object in space.
m_lookAtMatrix
The look-at matrix representing a transformation in 3D space.
m_needUpdate
Indicates whether an update is required.
m_orientation
Represents the orientation of an object in 3D space.
Protected Functions Documentation¶
Update
Updates the internal state of the shape.
This pure virtual function must be implemented by derived classes to perform custom updates whenever modifications occur, such as changes to the shape's position, orientation, or other parameters. It is intended to synchronize the internal data or perform computations necessary for the shape's functionality.
Note:
The engine calls this method internally when parameters like location or orientation are modified.
UpdateIfNeeded
Performs an update of the internal state if needed.
The documentation for this class was generated from the following file: include/SparkyStudios/Audio/Amplitude/Math/Shape.h