Manages oriented-capsule tracers for fast-bullet projectile entities.
More...
#include <TracerEffect.hpp>
|
| void | update (float dt, Registry ®istry) |
| | Update all live tracers.
|
| void | attach (entt::entity e, Registry ®istry) |
| | Attach a new tracer to a projectile entity.
|
| void | detach (entt::entity e) |
| | Detach the tracer from an entity (entity dying); tracer fades out.
|
| void | spawnRifleTracer (glm::vec3 origin, glm::vec3 dir, float range) |
| | Spawn a visual-only rifle bullet that travels along a hitscan path.
|
| const TracerParticle * | data () const |
| uint32_t | count () const |
Manages oriented-capsule tracers for fast-bullet projectile entities.
Each frame, update() polls registry entities with TracerEmitter components and updates the tip/tail of their associated TracerParticle.
◆ RuntimeKind
| Enumerator |
|---|
| None | |
| Entity | |
| RifleProjectile | |
◆ attach()
| void TracerEffect::attach |
( |
entt::entity | e, |
|
|
Registry & | registry ) |
Attach a new tracer to a projectile entity.
- Parameters
-
◆ count()
| uint32_t TracerEffect::count |
( |
| ) |
const |
|
inlinenodiscard |
◆ data()
◆ detach()
| void TracerEffect::detach |
( |
entt::entity | e | ) |
|
Detach the tracer from an entity (entity dying); tracer fades out.
- Parameters
-
| e | Entity handle being destroyed. |
◆ killTracer()
| void TracerEffect::killTracer |
( |
uint32_t | idx | ) |
|
|
private |
◆ spawnRifleTracer()
| void TracerEffect::spawnRifleTracer |
( |
glm::vec3 | origin, |
|
|
glm::vec3 | dir, |
|
|
float | range ) |
Spawn a visual-only rifle bullet that travels along a hitscan path.
- Parameters
-
| origin | Muzzle world position. |
| dir | Normalized or normalizable fire direction. |
| range | Visual travel distance in world units. |
◆ update()
| void TracerEffect::update |
( |
float | dt, |
|
|
Registry & | registry ) |
Update all live tracers.
Registry is used to read projectile positions.
- Parameters
-
| dt | Frame delta time in seconds. |
| registry | ECS registry containing TracerEmitter entities. |
◆ updateRifleTracer()
| void TracerEffect::updateRifleTracer |
( |
uint32_t | idx, |
|
|
float | dt ) |
|
private |
◆ entityToIdx_
| std::unordered_map<uint32_t, uint32_t> TracerEffect::entityToIdx_ |
|
private |
◆ k_fadeTime
| float TracerEffect::k_fadeTime = 0.15f |
|
staticconstexprprivate |
Seconds to fade after entity death.
◆ k_maxTracers
| uint32_t TracerEffect::k_maxTracers = 512 |
|
staticconstexprprivate |
◆ k_rifleRadius
| float TracerEffect::k_rifleRadius = 2.35f |
|
staticconstexprprivate |
◆ k_rifleSpawnLead
| float TracerEffect::k_rifleSpawnLead = 75.f |
|
staticconstexprprivate |
◆ k_rifleTrailLength
| float TracerEffect::k_rifleTrailLength = 140.f |
|
staticconstexprprivate |
◆ k_rifleVisualSpeed
| float TracerEffect::k_rifleVisualSpeed = 8000.f |
|
staticconstexprprivate |
◆ k_streakLength
| float TracerEffect::k_streakLength = 200.f |
|
staticconstexprprivate |
Visual streak length in world units.
◆ pool_
◆ runtime_
The documentation for this class was generated from the following files: