Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2020-07-22 15:16:08 +0300
committerJacques Lucke <jacques@blender.org>2020-07-22 15:16:08 +0300
commit980dd43bd4be7d5f2d893148984e5fd96c5747f4 (patch)
treebcfd4a1f02358f97ea1804f81f469689be00f31a /source/blender/makesdna/DNA_simulation_types.h
parent47b6c332587ca45eddc98e75b3f563e2f17a0d47 (diff)
Particles: give emitter its own state
High quality emitters need to maintain state themselves. For example, this it needs to remember when it spawned the last particle. This is especially important when the birth rate is changing over time. Otherwise, there will be very visible artifacts. It is quite likely that other components of the simulation need their own state as well. Therefore, I refactored the `SimulationState` type a bit, to make it more extensible. Instead of using hardcoded type numbers, a string is used to identify the state type. Also, instead of having switch statements in many places, there is a new `SimulationStateType` that encapsulates information about how a specific state is created/freed/copied/... I removed the integration with the point cache for now, because it was not used anyway in it's current state.
Diffstat (limited to 'source/blender/makesdna/DNA_simulation_types.h')
-rw-r--r--source/blender/makesdna/DNA_simulation_types.h23
1 files changed, 10 insertions, 13 deletions
diff --git a/source/blender/makesdna/DNA_simulation_types.h b/source/blender/makesdna/DNA_simulation_types.h
index f7a7f94da53..5bb0e50e089 100644
--- a/source/blender/makesdna/DNA_simulation_types.h
+++ b/source/blender/makesdna/DNA_simulation_types.h
@@ -46,10 +46,7 @@ typedef struct SimulationState {
struct SimulationState *next;
struct SimulationState *prev;
- /** eSimulationStateType */
- int type;
- int _pad;
-
+ char *type;
char *name;
} SimulationState;
@@ -60,13 +57,15 @@ typedef struct ParticleSimulationState {
int tot_particles;
int next_particle_id;
struct CustomData attributes;
-
- /** Caches the state of the particles over time. The cache only exists on the original data
- * block, not on cow copies. */
- struct PointCache *point_cache;
- struct ListBase ptcaches;
} ParticleSimulationState;
+typedef struct ParticleMeshEmitterSimulationState {
+ SimulationState head;
+
+ float last_birth_time;
+ char _pad[4];
+} ParticleMeshEmitterSimulationState;
+
/** Stores a mapping between an integer handle and a corresponding ID data block. */
typedef struct PersistentDataHandleItem {
struct PersistentDataHandleItem *next;
@@ -81,9 +80,7 @@ enum {
SIM_DS_EXPAND = (1 << 0),
};
-/* SimulationCache.type */
-typedef enum eSimulationStateType {
- SIM_STATE_TYPE_PARTICLES = 0,
-} eSimulationStateType;
+#define SIM_TYPE_NAME_PARTICLE_SIMULATION "Particle Simulation"
+#define SIM_TYPE_NAME_PARTICLE_MESH_EMITTER "Particle Mesh Emitter"
#endif /* __DNA_SIMULATION_TYPES_H__ */