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
path: root/source
diff options
context:
space:
mode:
authorJanne Karhu <jhkarh@gmail.com>2009-11-25 20:46:10 +0300
committerJanne Karhu <jhkarh@gmail.com>2009-11-25 20:46:10 +0300
commit323aa656715f9f40e151acd0b61305384ae0970d (patch)
treed5faa5573f198c380dc9e9a4f6ac2514e698a828 /source
parent553374bd4c9833b13072bcf697b5776f95366407 (diff)
Verlet integration method for particles (patch provided by farsthary).
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/particle_system.c10
-rw-r--r--source/blender/makesdna/DNA_particle_types.h1
-rw-r--r--source/blender/makesrna/intern/rna_particle.c1
3 files changed, 12 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index 075c6f6207f..809b5f2090c 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -2287,6 +2287,9 @@ static void apply_particle_forces(ParticleSimulationData *sim, int p, float dfra
case PART_INT_RK4:
steps=4;
break;
+ case PART_INT_VERLET:
+ steps=1;
+ break;
}
copy_particle_key(states,&pa->state,1);
@@ -2392,6 +2395,13 @@ static void apply_particle_forces(ParticleSimulationData *sim, int p, float dfra
VECADDFAC(pa->state.vel,pa->state.vel,dv[3],1.0f/6.0f);
}
break;
+ case PART_INT_VERLET: /* Verlet integration */
+ VECADDFAC(pa->state.vel,pa->state.vel,force,dtime);
+ VECADDFAC(pa->state.co,pa->state.co,pa->state.vel,dtime);
+
+ VECSUB(pa->state.vel,pa->state.co,pa->prev_state.co);
+ mul_v3_fl(pa->state.vel,1.0f/dtime);
+ break;
}
}
diff --git a/source/blender/makesdna/DNA_particle_types.h b/source/blender/makesdna/DNA_particle_types.h
index 0de48c54fe2..81510ef96a3 100644
--- a/source/blender/makesdna/DNA_particle_types.h
+++ b/source/blender/makesdna/DNA_particle_types.h
@@ -391,6 +391,7 @@ typedef struct ParticleSystem{ /* note, make sure all (runtime) are NULL's in
#define PART_INT_EULER 0
#define PART_INT_MIDPOINT 1
#define PART_INT_RK4 2
+#define PART_INT_VERLET 3
/* part->rotmode */
#define PART_ROT_NOR 1
diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c
index f458ee86091..6ddec53c28d 100644
--- a/source/blender/makesrna/intern/rna_particle.c
+++ b/source/blender/makesrna/intern/rna_particle.c
@@ -917,6 +917,7 @@ static void rna_def_particle_settings(BlenderRNA *brna)
static EnumPropertyItem integrator_type_items[] = {
{PART_INT_EULER, "EULER", 0, "Euler", ""},
+ {PART_INT_VERLET, "VERLET", 0, "Verlet", ""},
{PART_INT_MIDPOINT, "MIDPOINT", 0, "Midpoint", ""},
{PART_INT_RK4, "RK4", 0, "RK4", ""},
{0, NULL, 0, NULL, NULL}