Entity¶
An Entity represents a spatially positioned object in the game.
Detailed Description¶
Amplitude uses entities to link sound to an object in the game. Each sound played from an entity gets the location and orientation data from that entity.
The Entity class is a lightweight reference to an EntityInternalState object which is managed internally by the Engine.
Public Functions¶
| Type | Name |
|---|---|
| void | Clear () Uninitializes this entity. |
| Entity () Creates an uninitialized entity. | |
| Entity (EntityInternalState * state) Creates a wrapper instance over the provided state. | |
| AmUInt64 | GetActiveChannelCount () const Gets the number of active channels for this entity. |
| AmVector3 | GetDirection () const Gets the direction vector of the entity. |
| AmReal32 | GetDirectivity () const Gets the directivity of sounds played by this entity. |
| AmReal32 | GetDirectivitySharpness () const Gets the directivity sharpness of sounds played by this entity. |
| AmReal32 | GetEnvironmentFactor (AmEnvironmentID environment) const Gets the environment factor of this entity for the given environment. |
| const std::unordered_map< AmEnvironmentID, AmReal32 > & | GetEnvironments () const Gets the list of environments where this entity belongs or has visited. |
| AmEntityID | GetId () const Gets the ID of this entity. |
| const AmVector3 & | GetLocation () const Gets the current location of this entity. |
| AmReal32 | GetObstruction () const Gets the obstruction level of sounds played by this entity. |
| AmReal32 | GetOcclusion () const Gets the occlusion level of sounds played by this entity. |
| const Orientation & | GetOrientation () const Gets the orientation of the entity. |
| EntityInternalState * | GetState () const Returns the internal state of this entity. |
| AmVector3 | GetUp () const Gets the up vector of the entity. |
| const AmVector3 & | GetVelocity () const Gets the velocity of the entity. |
| void | SetDirectivity (AmReal32 directivity, AmReal32 sharpness) const Sets the directivity and sharpness of sounds played by this entity. |
| void | SetEnvironmentFactor (AmEnvironmentID environment, AmReal32 factor) const Sets the environment factor for this entity in the given environment. |
| void | SetLocation (const AmVector3 & location) const Sets the location of this entity. |
| void | SetObstruction (AmReal32 obstruction) const Sets the obstruction level of sounds played by this entity. |
| void | SetOcclusion (AmReal32 occlusion) const Sets the occlusion level of sounds played by this entity. |
| void | SetOrientation (const Orientation & orientation) const Sets the orientation of this entity. |
| void | Update () const Updates the state of this entity. |
| bool | Valid () const Checks whether this entity has been initialized. |
Public Functions Documentation¶
Clear
Uninitializes this entity.
Note:
This does not destroy the internal state it references, it just removes this reference to it.
To completely destroy the entity, use the RemoveEntity() method of the Engine instance.
Entity[1/2]
Creates an uninitialized entity.
An uninitialized entity cannot provide location and orientation information, and therefore cannot play sounds.
To create an initialized entity, use the AddEntity() method of the Engine instance.
Entity[2/2]
Creates a wrapper instance over the provided state.
Parameters:
-
stateThe internal state to wrap.
Warning:
This constructor is for internal usage only.
GetActiveChannelCount
Gets the number of active channels for this entity.
Returns:
The number of active channels.
GetDirection
Gets the direction vector of the entity.
Returns:
The direction vector.
GetDirectivity
Gets the directivity of sounds played by this entity.
Returns:
The directivity of sound sources.
GetDirectivitySharpness
Gets the directivity sharpness of sounds played by this entity.
Returns:
The directivity sharpness of sounds played by this entity.
GetEnvironmentFactor
Gets the environment factor of this entity for the given environment.
Parameters:
-
environmentThe environment ID.
Returns:
The environment factor.
GetEnvironments
Gets the list of environments where this entity belongs or has visited.
Returns:
The list of environments where this entity belongs or has visited.
GetId
Gets the ID of this entity.
Returns:
The entity ID.
GetLocation
Gets the current location of this entity.
Returns:
The current location of this entity.
GetObstruction
Gets the obstruction level of sounds played by this entity.
Returns:
The obstruction amount.
GetOcclusion
Gets the occlusion level of sounds played by this entity.
Returns:
The occlusion amount.
GetOrientation
Gets the orientation of the entity.
Returns:
The entity's orientation.
GetState
Returns the internal state of this entity.
Returns:
The entity internal state.
Warning:
This method is for internal usage only.
GetUp
Gets the up vector of the entity.
Returns:
The up vector.
GetVelocity
Gets the velocity of the entity.
Returns:
The entity's velocity.
SetDirectivity
Sets the directivity and sharpness of sounds played by this entity.
Parameters:
-
directivityThe directivity of the sound source, in the range [0, 1]. -
sharpnessThe directivity sharpness of the sound source, in the range [1, +INF]. Increasing this value increases the directivity towards the front of the source.
SetEnvironmentFactor
Sets the environment factor for this entity in the given environment.
Parameters:
-
environmentThe environment ID. -
factorThe environment factor.
SetLocation
Sets the location of this entity.
Parameters:
-
locationThe new location.
SetObstruction
Sets the obstruction level of sounds played by this entity.
Parameters:
-
obstructionThe obstruction amount.
SetOcclusion
Sets the occlusion level of sounds played by this entity.
Parameters:
-
occlusionThe occlusion amount.
SetOrientation
Sets the orientation of this entity.
Parameters:
-
orientationThe new orientation.
Update
Updates the state of this entity.
The Engine calls this method automatically on each frame to update the internal state of the entity.
Warning:
This method is for internal usage only.
Valid
Checks whether this entity has been initialized.
Returns:
true if this entity is initialized, false otherwise.
The documentation for this class was generated from the following file: include/SparkyStudios/Audio/Amplitude/Core/Entity.h