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/blenkernel/BKE_simulation.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/blenkernel/BKE_simulation.h')
-rw-r--r--source/blender/blenkernel/BKE_simulation.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/source/blender/blenkernel/BKE_simulation.h b/source/blender/blenkernel/BKE_simulation.h
index 36f4122f4dc..5aa71b6381d 100644
--- a/source/blender/blenkernel/BKE_simulation.h
+++ b/source/blender/blenkernel/BKE_simulation.h
@@ -34,13 +34,26 @@ void BKE_simulation_data_update(struct Depsgraph *depsgraph,
struct Simulation *simulation);
SimulationState *BKE_simulation_state_add(Simulation *simulation,
- eSimulationStateType type,
+ const char *type,
const char *name);
void BKE_simulation_state_remove(Simulation *simulation, SimulationState *state);
void BKE_simulation_state_remove_all(Simulation *simulation);
+void BKE_simulation_state_reset(Simulation *simulation, SimulationState *state);
+void BKE_simulation_state_reset_all(Simulation *simulation);
+SimulationState *BKE_simulation_state_try_find_by_name(Simulation *simulation, const char *name);
+SimulationState *BKE_simulation_state_try_find_by_name_and_type(Simulation *simulation,
+ const char *name,
+ const char *type);
+void BKE_simulation_state_copy_data(const SimulationState *src_state, SimulationState *dst_state);
#ifdef __cplusplus
}
#endif
+#ifdef __cplusplus
+
+template<typename StateType> const char *BKE_simulation_get_state_type_name();
+
+#endif
+
#endif /* __BKE_SIMULATION_H__ */