From c69a25abfcb141e54a2a9a0397810190704ef7dc Mon Sep 17 00:00:00 2001 From: elom0n <74347790+elom0n@users.noreply.github.com> Date: Thu, 21 Jul 2022 12:09:38 +0200 Subject: [PATCH] added second event-pair for testing, added eventId for each particle --- projects/fire_works/shaders/generation.comp | 1 + projects/fire_works/shaders/particle.inc | 2 ++ projects/fire_works/src/main.cpp | 38 ++++++++++++++++++++- 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/projects/fire_works/shaders/generation.comp b/projects/fire_works/shaders/generation.comp index 0f8551df..13c21d31 100644 --- a/projects/fire_works/shaders/generation.comp +++ b/projects/fire_works/shaders/generation.comp @@ -136,6 +136,7 @@ void main() { particles[id].size = size * split; particles[id].color = color; particles[id].mass = events[event_id].mass / events[event_id].count; + particles[id].eventId = event_id; { const uint tid = atomicAdd(trailIndex, 1) % trails.length(); diff --git a/projects/fire_works/shaders/particle.inc b/projects/fire_works/shaders/particle.inc index f3da7633..488c9349 100644 --- a/projects/fire_works/shaders/particle.inc +++ b/projects/fire_works/shaders/particle.inc @@ -8,6 +8,8 @@ struct particle_t { float size; vec3 color; float mass; + vec3 pad0; + uint eventId; }; #endif // PARTICLE_INC \ No newline at end of file diff --git a/projects/fire_works/src/main.cpp b/projects/fire_works/src/main.cpp index acd94112..ea24d23a 100644 --- a/projects/fire_works/src/main.cpp +++ b/projects/fire_works/src/main.cpp @@ -16,6 +16,8 @@ struct particle_t { float size; glm::vec3 color; float pad2; + glm::vec3 pad0; + uint32_t eventId; }; struct event_t { @@ -311,7 +313,7 @@ int main(int argc, const char **argv) { 100, 0, - events.size() - 1, + events.size() - 3, 0, 10.0f, @@ -319,6 +321,40 @@ int main(int argc, const char **argv) { 0.0f, 0.0f ); + + events.emplace_back( + glm::vec3(0.5, 1, 0), + 0.1f, + glm::vec3(0.0f, 1.5f, 0.0f), + 15.0f, + + 1, + 0, + UINT_MAX, + 0, + + 0.5f, + 1.0f, + 0.5f, + 0.0f + ); + + events.emplace_back( + glm::vec3(0.0f), + 1.0f, + glm::vec3(0.0f, 1.5f, 1.0f), + 8.0f, + + 150, + 0, + events.size() - 1, + 0, + + 10.0f, + 1.0f, + 0.0f, + 0.0f + ); vkcv::Buffer<event_t> eventBuffer = core.createBuffer<event_t>( vkcv::BufferType::STORAGE, -- GitLab