Skip to main content

Bounds.ixx File

Utility functions for computing world-space bounding volumes. More...

Included Headers

Namespaces Index

namespacehelios
namespaceengine

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

namespacemodules

Domain-specific components and systems. More...

namespacephysics

Physics simulation and collision detection subsystem for the game engine. More...

namespacecollision
namespaceBounds

Description

Utility functions for computing world-space bounding volumes.

File Listing

The file content with the documentation metadata removed is:

1/**
2 * @file Bounds.ixx
3 * @brief Utility functions for computing world-space bounding volumes.
4 */
5module;
6
7export module helios.engine.modules.physics.collision.Bounds;
8
9import helios.engine.ecs.System;
10import helios.math;
11
12import helios.core.units.Unit;
13
14import helios.engine.ecs.GameObject;
15import helios.engine.runtime.world.GameWorld;
16import helios.engine.runtime.world.UpdateContext;
17
18import helios.engine.modules.scene.components.SceneNodeComponent;
19import helios.engine.modules.spatial.transform.components.ScaleStateComponent;
20import helios.engine.modules.spatial.transform.components.TranslationStateComponent;
21import helios.engine.modules.spatial.transform.components.RotationStateComponent;
22
23import helios.engine.modules.rendering.model.components.ModelAabbComponent;
24
26
27 /**
28 * @brief Computes the world-space AABB from local model bounds and transforms.
29 *
30 * Combines the parent's world transform with the entity's local translation,
31 * rotation, and scale to transform the model-space AABB into world space.
32 *
33 * The transformation order is: Translation * Rotation * Scale (TRS).
34 *
35 * @param mab Model AABB component containing the local bounding box.
36 * @param sc Scene node component for accessing parent world transform.
37 * @param tsc Translation state component with local position.
38 * @param sca Scale state component with local scaling factors.
39 * @param rsc Rotation state component with local rotation matrix.
40 *
41 * @return World-space axis-aligned bounding box.
42 */
49 ) noexcept {
50
51 const helios::math::mat4f& parentTransform = sc.sceneNode()->parent()->worldTransform();
52
53 const helios::math::vec3f localTranslation = tsc.translation();
54 const helios::math::mat4f localRotation = rsc.rotation();
55 const helios::math::vec3f localScaling = sca.scaling();
56
57 const helios::math::mat4f mScaling = helios::math::mat4f::identity().withScaling(localScaling);
58 const helios::math::mat4f mTranslation = helios::math::mat4f::identity().withTranslation(localTranslation);
59
60 const helios::math::mat4f localTransform = mTranslation * (localRotation * mScaling);
61
62 return mab.aabb().applyTransform(parentTransform * localTransform);
63 }
64
65}

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.