Revision: 17228
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17228
Author:   broken
Date:     2008-10-30 10:26:30 +0100 (Thu, 30 Oct 2008)

Log Message:
-----------
* Added a new, slightly experimental force field type: 'Spin'.
It works similarly to Vortex, but it's a more controllable - it 
doesn't send the particles off accelerating into space, but 
keeps them spinning around the Z axis of the force field object.

This is safe in the branch, but Jahka if you have any feedback, 
I'd be curious to hear :)

Modified Paths:
--------------
    branches/sim_physics/source/blender/blenkernel/intern/effect.c
    branches/sim_physics/source/blender/makesdna/DNA_object_force.h
    branches/sim_physics/source/blender/src/buttons_object.c

Modified: branches/sim_physics/source/blender/blenkernel/intern/effect.c
===================================================================
--- branches/sim_physics/source/blender/blenkernel/intern/effect.c      
2008-10-30 08:10:19 UTC (rev 17227)
+++ branches/sim_physics/source/blender/blenkernel/intern/effect.c      
2008-10-30 09:26:30 UTC (rev 17228)
@@ -421,6 +421,19 @@
                        VecAddf(field,field,mag_vec);
 
                        break;
+               case PFIELD_SPIN:
+                       Projf(temp, velocity, eff_vel);
+                       
+                       Crossf(mag_vec,eff_vel,vec_to_part);
+
+                       Normalize(mag_vec);
+
+                       VecMulf(mag_vec,force_val*distance*falloff);
+                       VecAddf(mag_vec, mag_vec, temp);
+                       
+                       VecCopyf(velocity, mag_vec);
+                       
+                       break;
                case PFIELD_MAGNET:
                        if(planar)
                                VecCopyf(temp,eff_vel);

Modified: branches/sim_physics/source/blender/makesdna/DNA_object_force.h
===================================================================
--- branches/sim_physics/source/blender/makesdna/DNA_object_force.h     
2008-10-30 08:10:19 UTC (rev 17227)
+++ branches/sim_physics/source/blender/makesdna/DNA_object_force.h     
2008-10-30 09:26:30 UTC (rev 17228)
@@ -210,6 +210,7 @@
 #define PFIELD_HARMONIC        7
 #define PFIELD_CHARGE  8
 #define PFIELD_LENNARDJ        9
+#define PFIELD_SPIN            10
 
 
 /* pd->flag: various settings */

Modified: branches/sim_physics/source/blender/src/buttons_object.c
===================================================================
--- branches/sim_physics/source/blender/src/buttons_object.c    2008-10-30 
08:10:19 UTC (rev 17227)
+++ branches/sim_physics/source/blender/src/buttons_object.c    2008-10-30 
09:26:30 UTC (rev 17228)
@@ -3409,8 +3409,8 @@
                                sprintf(menustr, "Field 
Type%%t|None%%x0|Spherical%%x%d|Wind%%x%d|Vortex%%x%d|Curve 
Guide%%x%d|Magnetic%%x%d|Harmonic%%x%d|Texture%%x%d|Charge%%x%d|Lennard-Jones%%x%d",
 
                                                PFIELD_FORCE, PFIELD_WIND, 
PFIELD_VORTEX, PFIELD_GUIDE, PFIELD_MAGNET, PFIELD_HARMONIC, PFIELD_TEXTURE, 
PFIELD_CHARGE, PFIELD_LENNARDJ);
                        else
-                               sprintf(menustr, "Field 
Type%%t|None%%x0|Spherical%%x%d|Wind%%x%d|Vortex%%x%d|Magnetic%%x%d|Harmonic%%x%d|Texture%%x%d|Charge%%x%d|Lennard-Jones%%x%d",
 
-                                               PFIELD_FORCE, PFIELD_WIND, 
PFIELD_VORTEX, PFIELD_MAGNET, PFIELD_HARMONIC, PFIELD_TEXTURE, PFIELD_CHARGE, 
PFIELD_LENNARDJ);
+                               sprintf(menustr, "Field 
Type%%t|None%%x0|Spherical%%x%d|Wind%%x%d|Vortex%%x%d|Spin%%x%d|Magnetic%%x%d|Harmonic%%x%d|Texture%%x%d|Charge%%x%d|Lennard-Jones%%x%d",
 
+                                               PFIELD_FORCE, PFIELD_WIND, 
PFIELD_VORTEX, PFIELD_SPIN, PFIELD_MAGNET, PFIELD_HARMONIC, PFIELD_TEXTURE, 
PFIELD_CHARGE, PFIELD_LENNARDJ);
 
                        if(pd->forcefield==PFIELD_FORCE) tipstr= "Object center 
attracts or repels particles (On shared object layers)";
                        else if(pd->forcefield==PFIELD_WIND) tipstr= "Constant 
force applied in direction of Object Z axis (On shared object layers)";


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to