Nebula
Loading...
Searching...
No Matches
particle.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
16#include "math/vec4.h"
17#include "math/mat4.h"
18#include "math/bbox.h"
21#include "threading/event.h"
22
23//------------------------------------------------------------------------------
24namespace Particles
25{
28 static const SizeT MaxNumRenderedParticles = 65535;
29
30 struct Particle
31 {
38 float rotation;
40 float size;
43 float relAge; // between 0 and 1, particle is dead if age > 1.0
44 float age; // absolute age
45 float particleId; // id for differing particles in vertex shader
46 };
47
48 typedef unsigned int JOB_ID;
49
50 // uniform data for particle system instances, used for job-uniform data as well,
51 // so we dont have to copy that much
53 {
55 : gravity(0.0f, 0.0f, 0.0f)
56 , windVector(0.0f, 0.0f, 0.0f)
57 , stretchToStart(false)
58 , stretchTime(0)
59 , sampleBuffer(nullptr)
60 {};
65
66 // static sample buffer
67 const float* sampleBuffer;
68 };
69
70 // each job-slice generates this output
76
86
88
91
92} // namespace Particles
93//------------------------------------------------------------------------------
Nebula's bounding box class.
Definition bbox.h:24
static const int JobMaxSliceSize
Nebula configuration.
Definition config.h:39
Particle context controls playing and enabling/disabling of particle emitters inside a model.
Definition modelnode.h:37
static const SizeT ParticleSystemNumEnvelopeSamples
number of samples in envelope curves
Definition particle.h:27
static const SizeT ParticleJobInputMaxElementsPerSlice
Definition particle.h:89
unsigned int JOB_ID
Definition particle.h:48
static const SizeT ParticleJobInputElementSize
Definition particle.h:87
static const SizeT MaxNumRenderedParticles
Definition particle.h:28
static const SizeT ParticleJobInputSliceSize
Definition particle.h:90
A 4D vector.
Definition vec4.h:24
A vector is a 3D direction in space.
Definition vector.h:22
The particle structure holds the current state of a single particle and common data for particle-job ...
Definition particle.h:31
Math::vec4 color
Definition particle.h:37
float particleId
Definition particle.h:45
float oneDivLifeTime
Definition particle.h:42
Math::vec4 startPosition
Definition particle.h:33
Math::vec4 stretchPosition
Definition particle.h:34
float rotation
Definition particle.h:38
Math::vec4 velocity
Definition particle.h:35
float sizeVariation
Definition particle.h:41
Math::vec4 position
Definition particle.h:32
float relAge
Definition particle.h:43
float size
Definition particle.h:40
Math::vec4 uvMinMax
Definition particle.h:36
float age
Definition particle.h:44
float rotationVariation
Definition particle.h:39
Definition particle.h:78
float stepTime
Definition particle.h:82
Particle * outputParticles
Definition particle.h:80
const Particle * inputParticles
Definition particle.h:79
uint numParticles
Definition particle.h:83
const ParticleJobUniformData * uniformData
Definition particle.h:81
ParticleJobSliceOutputData * output
Definition particle.h:84
Math::bbox bbox
Definition particle.h:73
unsigned int numLivingParticles
Definition particle.h:74
Definition particle.h:53
bool stretchToStart
Definition particle.h:63
ParticleJobUniformData()
Definition particle.h:54
const float * sampleBuffer
Definition particle.h:67
Math::vector gravity
Definition particle.h:61
Math::vector windVector
Definition particle.h:62
float stretchTime
Definition particle.h:64
int SizeT
Definition types.h:49
unsigned int uint
Definition types.h:31