AxisSpawnPlacer.ixx File
Spawn placer that arranges entities along an axis. More...
Included Headers
#include <cassert>
#include <algorithm>
#include <helios.engine.runtime.world.UpdateContext>
#include <helios.math>
#include <helios.util.Random>
#include <helios.engine.runtime.spawn.behavior.SpawnPlacer>
#include <helios.engine.runtime.spawn.types.SpawnContext>
#include <helios.engine.ecs.EntityHandle>
#include <helios.engine.runtime.spawn.types.SpawnPlanCursor>
Namespaces Index
| namespace | helios |
| namespace | engine |
|
Main engine module aggregating core infrastructure and game systems. More... | |
| namespace | runtime |
|
Runtime infrastructure for game execution and lifecycle orchestration. More... | |
| namespace | spawn |
|
Entity spawning infrastructure for the helios engine. More... | |
| namespace | behavior |
|
Spawn behavior strategies for positioning and initializing entities. More... | |
| namespace | placements |
|
Concrete SpawnPlacer implementations. More... | |
Classes Index
| class | AxisSpawnPlacer |
|
Spawn placer that distributes entities evenly along an axis. More... | |
Description
Spawn placer that arranges entities along an axis.
File Listing
The file content with the documentation metadata removed is:
22using namespace helios::engine::runtime::spawn::types;
23export namespace helios::engine::runtime::spawn::behavior::placements {
62 class AxisSpawnPlacer final : public SpawnPlacer {
67 helios::math::vec3f axis_;
72 helios::math::vec3f origin_{};
84 explicit AxisSpawnPlacer(const helios::math::vec3f axis, const helios::math::vec3f origin)
86 assert(axis.isNormalized() && "Axis must be normalized.");
107 const helios::engine::ecs::EntityHandle& entityHandle,
108 const helios::math::aabbf& gameObjectBounds,
109 const helios::math::aabbf& environmentBounds,
110 const SpawnPlanCursor& cursor,
111 const SpawnContext& spawnContext
114 assert(environmentBounds.contains(origin_) && "origin is not within bounding box");
116 const float top = environmentBounds.max()[1];
117 const float bottom = environmentBounds.min()[1];
118 const float left = environmentBounds.min()[0];
119 const float right = environmentBounds.max()[0];
120 const float near = environmentBounds.min()[2];
121 const float far = environmentBounds.max()[2];
153 const auto objectHalfSize = gameObjectBounds.size() * 0.5f;
154 const auto projection = objectHalfSize.dot(helios::math::vec3f{
162 (static_cast<float>(cursor.position)/static_cast<float>(
163 cursor.spawnCount > 0 ? cursor.spawnCount - 1 :1)
167 const auto center = gameObjectBounds.translate(
168 helios::math::vec3f{origin_[0] + pos[0], origin_[1] + pos[1], origin_[2] + pos[2]}
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.