Unravel Engine C++ Reference
Loading...
Searching...
No Matches
particle_gpu_schema.h
Go to the documentation of this file.
1#pragma once
2
3#include "particle_types.h"
4
5#include <cstdint>
6
7namespace unravel
8{
9namespace ps_soa
10{
11
13enum class particle_sim_backend : uint8_t
14{
15 cpu = 0,
16 gpu = 1,
17};
18
20constexpr uint16_t k_gpu_instance_stride = 96;
21constexpr uint32_t k_gpu_instance_floats = k_gpu_instance_stride / sizeof(float);
22constexpr uint32_t k_gpu_sim_floats_per_particle = 20;
23constexpr uint32_t k_gpu_sim_vec4s_per_particle = 5;
24constexpr uint32_t k_gpu_lut_size = 256;
25constexpr uint32_t k_gpu_cs_threads = 64;
26
45
46static_assert(sizeof(gpu_sim_particle) == k_gpu_sim_floats_per_particle * sizeof(float),
47 "gpu_sim_particle size mismatch");
48
51{
52 float opacity = 1.0f;
53 float color_intensity = 1.0f;
54 float avg_system_scale = 1.0f;
55 float render_mode = 0.0f;
56
57 float pivot_x = 0.5f;
58 float pivot_y = 0.5f;
59 float particle_count = 0.0f;
60 float features = 0.0f;
61
62 float scale3d_x = 1.0f;
63 float scale3d_y = 1.0f;
64 float scale3d_z = 1.0f;
65 float tex_sheet_cycles = 0.0f;
66
67 float tex_tiles_x = 1.0f;
68 float tex_tiles_y = 1.0f;
69 float tex_sheet_randomize = 0.0f;
70 float pad0 = 0.0f;
71
72 float size_by_speed_min = 1.0f;
73 float size_by_speed_max = 1.0f;
74 float inv_size_speed_span = 0.0f;
75 float size_speed_min = 0.0f;
76
78 float color_speed_min = 0.0f;
79 float pad1 = 0.0f;
80 float pad2 = 0.0f;
81
82 float local_to_world[16]{};
83};
84
85inline auto gpu_feature_mask(emitter_feature features) -> uint32_t
86{
87 return static_cast<uint32_t>(features);
88}
89
90} // namespace ps_soa
91} // namespace unravel
constexpr uint32_t k_gpu_sim_vec4s_per_particle
constexpr uint32_t k_gpu_cs_threads
constexpr uint32_t k_gpu_instance_floats
particle_sim_backend
Selects CPU vs resident-GPU simulation backend.
constexpr uint32_t k_gpu_lut_size
constexpr uint16_t k_gpu_instance_stride
GPU instance row matches vs_particle_instanced i_data0..i_data5 (96 bytes).
auto gpu_feature_mask(emitter_feature features) -> uint32_t
emitter_feature
Feature bits baked from authoring desc for specialized update/render paths.
render_mode
Billboard / facing mode. Ordinals match legacy RenderMode.
constexpr uint32_t k_gpu_sim_floats_per_particle
Uniform vec4 packing for compute (set as float[4] arrays).
Packed sim particle for compute (80 bytes / 5 x vec4).