Skip to main content

EmitterSpawnPlacer.ixx File

Placer that spawns entities at the emitter's position. More...

Included Headers

Namespaces Index

namespacehelios
namespaceengine

Main engine module aggregating core infrastructure and game systems. More...

namespaceruntime

Runtime infrastructure for game execution and lifecycle orchestration. More...

namespacespawn

Entity spawning infrastructure for the helios engine. More...

namespacebehavior

Spawn behavior strategies for positioning and initializing entities. More...

namespaceplacements

Concrete SpawnPlacer implementations. More...

Classes Index

classEmitterSpawnPlacer

Placer that spawns entities at the emitter's position. More...

Description

Placer that spawns entities at the emitter's position.

File Listing

The file content with the documentation metadata removed is:

1/**
2 * @file EmitterSpawnPlacer.ixx
3 * @brief Placer that spawns entities at the emitter's position.
4 */
5module;
6
7#include <cassert>
8
9export module helios.engine.runtime.spawn.behavior.placements.EmitterSpawnPlacer;
10
11import helios.engine.runtime.spawn.types.SpawnPlanCursor;
12import helios.engine.runtime.spawn.types.SpawnContext;
13import helios.engine.runtime.spawn.behavior.SpawnPlacer;
14import helios.math;
15import helios.engine.ecs.EntityHandle;
16
19
20 /**
21 * @brief Placer that spawns entities at the emitter's position.
22 *
23 * @details EmitterSpawnPlacer uses the position stored in the EmitterContext
24 * to place spawned entities. This is commonly used for projectiles that should
25 * originate from the firing entity.
26 *
27 * @pre The SpawnContext must contain a valid EmitterContext.
28 *
29 * @see SpawnPlacer
30 * @see EmitterContext
31 */
32 class EmitterSpawnPlacer final : public SpawnPlacer {
33
34 public:
35
36 /**
37 * @brief Returns the emitter's position.
38 *
39 * @param entityHandle The handle of the entity being spawned (unused).
40 * @param gameObjectBounds The bounding box of the entity to spawn (unused).
41 * @param environmentBounds The level bounds (unused).
42 * @param cursor The current position within the spawn batch (unused).
43 * @param spawnContext Context containing the emitter information.
44 *
45 * @return The emitter's world position.
46 *
47 * @pre spawnContext.emitterContext must have a value.
48 */
50 const helios::engine::ecs::EntityHandle& entityHandle,
51 const helios::math::aabbf& gameObjectBounds,
52 const helios::math::aabbf& environmentBounds,
53 const SpawnPlanCursor& cursor,
54 const SpawnContext& spawnContext
55 ) override {
56
57 const auto emitterCtx = spawnContext.emitterContext;
58 assert(emitterCtx.has_value() && "Unexpected nullopt for emitter");
59
60 return emitterCtx.value().position;
61 }
62
63
64 };
65
66}

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.