Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
Loading...
Searching...
No Matches
ParticleForceField.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
13#pragma once
14
15#include "../../core/Types.hpp"
17#include "../../math/Math.hpp"
18
19namespace esengine::ecs {
20
21// Directional: a constant push along `direction` (wind). Point: pull toward
22// (strength > 0) or push from (strength < 0) the field. Vortex: swirl tangentially
23// around the field. Drag: damp velocity inside the zone (still air / water pocket).
24// NOTE: keep these descriptions here, not as inline `//` comments on the values —
25// the EHT enum parser treats trailing words as extra enum members.
26ES_ENUM()
27enum class ForceFieldType : i32 {
29 Point = 1,
30 Vortex = 2,
31 Drag = 3,
32};
33
36 ES_PROPERTY(enum=ForceFieldType, category=Field)
38
39 // Directional/Point/Vortex: acceleration magnitude (px/s²). Drag: damping rate
40 // per second. Negative flips a Point field from attractor to repeller.
41 ES_PROPERTY(category=Field)
42 f32 strength{200.0f};
43
44 // 0 = unbounded (affects the whole scene). > 0 = only particles within this world
45 // radius of the field's position are affected.
46 ES_PROPERTY(min=0, category=Field)
47 f32 radius{0.0f};
48
49 // Push direction for a Directional field (normalized at use). Point/Vortex/Drag
50 // derive their direction from the field→particle vector and ignore this.
51 ES_PROPERTY(category=Field)
52 glm::vec3 direction{1.0f, 0.0f, 0.0f};
53
54 // Fade the force linearly to 0 at the radius edge (only meaningful when radius > 0).
55 ES_PROPERTY(category=Field)
56 bool falloff{true};
57
59 bool enabled{true};
60
61 ParticleForceField() = default;
62};
63
64} // namespace esengine::ecs
Math utilities and GLM configuration for ESEngine.
Reflection and metadata system for automatic binding generation.
#define ES_COMPONENT(...)
Mark a struct/class as a component that should be exposed to scripts.
#define ES_ENUM(...)
Mark an enum that should be exposed to scripts.
#define ES_PROPERTY(...)
Mark a field as a property that should be exposed to scripts.
Core type definitions and utilities for ESEngine.
std::int32_t i32
Signed 32-bit integer.
Definition Types.hpp:54
float f32
32-bit floating point
Definition Types.hpp:59