Set of decals in 3D space.
More...
#include <GREM/graphics_3d/Decals3D.hpp>
|
| | Decals3D (Device &device, const Decals3DOptions &options={}) |
| | Construct a set of decals.
|
| void | clearDecalMaterials () noexcept |
| | Remove all decal materials and images from the set, and consequently all decals as well.
|
| DecalMaterialID | createDecalMaterial (const DecalMaterialOptions &options) |
| | Create a decal material.
|
| void | clearDecals () noexcept |
| | Remove all decals from the set.
|
| DecalID | createDecal (DecalMaterialID materialID, const DecalOptions3D &options) |
| | Create a decal.
|
| bool | containsDecal (DecalID id) const noexcept |
| | Check if a specific decal handle is still valid, meaning that the decal has not yet been destroyed.
|
| bool | destroyDecal (DecalID id) |
| | Destroy a decal and remove it from the set.
|
| void | setDecalPosition (DecalID id, vec3 newPosition) |
| | Update the position of a decal.
|
| void | setDecalRange (DecalID id, float newRange) |
| | Update the range of a decal.
|
| void | setDecalOrientation (DecalID id, quat newOrientation) |
| | Update the rotation of a decal.
|
| void | setDecalSize (DecalID id, vec2 newSize) |
| | Update the size of a decal.
|
| void | setDecalOrigin (DecalID id, vec2 newOrigin) |
| | Update the origin of a decal.
|
| void | setDecalColor (DecalID id, Color newColor) |
| | Update the tint color of a decal.
|
| void | setDecalEmissiveFactor (DecalID id, vec3 newEmissiveFactor) |
| | Update the emissive factor of a decal.
|
| void | setDecalModelInstanceIdentifier (DecalID id, uint32_t newModelInstanceIdentifier) |
| | Update the model instance identifier of a decal.
|
| void | setOptions (const Decals3DOptions &newOptions) |
| | Set the configuration options of the decal set.
|
| Decals3DOptions | getOptions () const noexcept |
| | Get the configuration options of the decal set.
|
| auto | forEachDecal (auto callback) |
| | Execute a callback function for each decal in the decal set.
|
Set of decals in 3D space.
◆ ParameterBuffer
Shader buffer for decal parameters.
◆ Decals3D()
Construct a set of decals.
- Parameters
-
| device | device to create the decals for. Must outlive the decals. |
| options | decal set options, see Decals3DOptions. |
- Exceptions
-
| graphics::Error | if resource creation failed. |
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
◆ clearDecalMaterials()
| void grem::graphics::Decals3D::clearDecalMaterials |
( |
| ) |
|
|
noexcept |
Remove all decal materials and images from the set, and consequently all decals as well.
◆ createDecalMaterial()
Create a decal material.
- Parameters
-
- Returns
- an identifier for the inserted decal material.
- Exceptions
-
| graphics::Error | on failure to copy an image or expand a texture atlas. |
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
◆ clearDecals()
| void grem::graphics::Decals3D::clearDecals |
( |
| ) |
|
|
noexcept |
Remove all decals from the set.
◆ createDecal()
Create a decal.
- Parameters
-
- Returns
- a handle to the new decal that can be used to refer back to it later in order to make changes to it.
- Exceptions
-
| graphics::Error | if resource creation failed. |
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
◆ containsDecal()
| bool grem::graphics::Decals3D::containsDecal |
( |
DecalID | id | ) |
const |
|
nodiscardnoexcept |
Check if a specific decal handle is still valid, meaning that the decal has not yet been destroyed.
- Parameters
-
- Returns
- true if the associated decal still exists, false if the decal has been destroyed.
◆ destroyDecal()
| bool grem::graphics::Decals3D::destroyDecal |
( |
DecalID | id | ) |
|
Destroy a decal and remove it from the set.
- Parameters
-
- Returns
- true if the specified decal was found and destroyed, false otherwise.
- Note
- If the specified decal has already been destroyed, this function has no effect.
◆ setDecalPosition()
| void grem::graphics::Decals3D::setDecalPosition |
( |
DecalID | id, |
|
|
vec3 | newPosition ) |
Update the position of a decal.
- Parameters
-
| id | handle to the decal. |
| newPosition | new position of the decal, in world coordinates. |
- Note
- If the given decal handle is invalid, this function has no effect.
◆ setDecalRange()
| void grem::graphics::Decals3D::setDecalRange |
( |
DecalID | id, |
|
|
float | newRange ) |
Update the range of a decal.
- Parameters
-
| id | handle to the decal. |
| newRange | new maximum range from the decal position, in world coordinates, where the decal will apply to meshes. |
- Note
- If the given decal handle is invalid, this function has no effect.
◆ setDecalOrientation()
| void grem::graphics::Decals3D::setDecalOrientation |
( |
DecalID | id, |
|
|
quat | newOrientation ) |
Update the rotation of a decal.
- Parameters
-
| id | handle to the decal. |
| newOrientation | new rotation of the decal around its origin. |
- Note
- If the given decal handle is invalid, this function has no effect.
◆ setDecalSize()
| void grem::graphics::Decals3D::setDecalSize |
( |
DecalID | id, |
|
|
vec2 | newSize ) |
Update the size of a decal.
- Parameters
-
| id | handle to the decal. |
| newSize | new size of the decal, in world coordinates. |
- Note
- If the given decal handle is invalid, this function has no effect.
◆ setDecalOrigin()
| void grem::graphics::Decals3D::setDecalOrigin |
( |
DecalID | id, |
|
|
vec2 | newOrigin ) |
Update the origin of a decal.
- Parameters
-
| id | handle to the decal. |
| newOrigin | new offset, in texture coordinates, specifying the origin relative to the bottom left of the decal. For example, a value of (0.5, 0.5) corresponds to the middle of the decal. |
- Note
- If the given decal handle is invalid, this function has no effect.
◆ setDecalColor()
| void grem::graphics::Decals3D::setDecalColor |
( |
DecalID | id, |
|
|
Color | newColor ) |
Update the tint color of a decal.
- Parameters
-
| id | handle to the decal. |
| newColor | new tint color to use in the shader. |
- Note
- If the given decal handle is invalid, this function has no effect.
◆ setDecalEmissiveFactor()
| void grem::graphics::Decals3D::setDecalEmissiveFactor |
( |
DecalID | id, |
|
|
vec3 | newEmissiveFactor ) |
Update the emissive factor of a decal.
- Parameters
-
| id | handle to the decal. |
| newEmissiveFactor | new emissive factor to use in the shader. |
- Note
- If the given decal handle is invalid, this function has no effect.
◆ setDecalModelInstanceIdentifier()
| void grem::graphics::Decals3D::setDecalModelInstanceIdentifier |
( |
DecalID | id, |
|
|
uint32_t | newModelInstanceIdentifier ) |
Update the model instance identifier of a decal.
- Parameters
-
| id | handle to the decal. |
| newModelInstanceIdentifier | new model instance identifier that the decal applies to, or the maximum value to apply to all instances. |
- Note
- If the given decal handle is invalid, this function has no effect.
◆ setOptions()
| void grem::graphics::Decals3D::setOptions |
( |
const Decals3DOptions & | newOptions | ) |
|
|
inline |
Set the configuration options of the decal set.
- Parameters
-
◆ getOptions()
Get the configuration options of the decal set.
- Returns
- the current configuration options.
◆ forEachDecal()
| auto grem::graphics::Decals3D::forEachDecal |
( |
auto | callback | ) |
|
|
inline |
Execute a callback function for each decal in the decal set.
- Parameters
-
| callback | function to execute, which should accept the decal ID as a parameter. The callback function should return either void or a bool that specifies whether to stop the traversal or not. A value of true means to stop and return early, while a value of false means to continue traversing. |
- Returns
- void if the callback function returns void, true if the callback returns bool and exited early, false if the callback function returns bool but didn't exit early.
- Exceptions
-
| any | exception thrown by the callback function. |
- Note
- The order of traversal is unspecified.
- Warning
- Decals must not be added or removed from the set during traversal, unless the traversal is stopped immediately afterwards.
The documentation for this class was generated from the following file: