[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [10953] branches/particles/source/blender: Particle system files added.

Janne Karhu janne.karhu at palvelut.net
Sun Jun 17 20:54:57 CEST 2007


Revision: 10953
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=10953
Author:   jhk
Date:     2007-06-17 20:54:57 +0200 (Sun, 17 Jun 2007)

Log Message:
-----------
Particle system files added.

Added Paths:
-----------
    branches/particles/source/blender/blenkernel/BKE_particle.h
    branches/particles/source/blender/blenkernel/intern/particle.c
    branches/particles/source/blender/blenkernel/intern/particle_edit.c
    branches/particles/source/blender/blenkernel/intern/particle_system.c
    branches/particles/source/blender/makesdna/DNA_particle_types.h

Added: branches/particles/source/blender/blenkernel/BKE_particle.h
===================================================================
--- branches/particles/source/blender/blenkernel/BKE_particle.h	                        (rev 0)
+++ branches/particles/source/blender/blenkernel/BKE_particle.h	2007-06-17 18:54:57 UTC (rev 10953)
@@ -0,0 +1,244 @@
+#ifndef BKE_PARTICLE_H
+#define BKE_PARTICLE_H
+
+#include "DNA_object_types.h"
+#include "DNA_particle_types.h"
+
+struct ParticleSystemModifierData;
+struct ParticleSystem;
+struct DerivedMesh;
+struct Object;
+struct Group;
+struct ListBase;
+
+typedef struct pNewEffectorCache {
+	struct pNewEffectorCache *next, *prev;
+	Object *ob;
+	
+	/* precalculated variables (only for guides)*/
+	float firstloc[4], firstdir[3];
+	float *distances;
+	float *locations;
+
+	short type, psys_nbr;
+	
+	Object obcopy;	/* for restoring transformation data */
+} pNewEffectorCache;
+
+typedef struct ParticleReactEvent {
+	struct ParticleReactEvent *next, *prev;
+	int event, pa_num;
+	Object *ob;
+	struct ParticleSystem *psys;
+	struct ParticleKey state;
+
+	float time, size;
+}ParticleReactEvent;
+
+typedef struct ParticleTexture{
+	float ivel;						/* used in reset */
+	float time, life, exist, size;	/* used in init */
+	float pvel[3];					/* used in physics */
+	float length, clump, kink;		/* used in path caching */
+} ParticleTexture;
+
+typedef struct ParticleTreeNode{
+	struct ParticleTreeNode *left, *right;
+	float co[3];
+	int nbr;
+	short d;
+} ParticleTreeNode;
+
+typedef struct ParticleTreeNearest {
+	int num;
+	float dist;
+}ParticleTreeNearest;
+
+typedef struct ParticleUndo {
+	struct ParticleUndo *next, *prev;
+	struct ParticleKey **keys;
+	struct ParticleData *particles;
+	ParticleTreeNode *emitter_field;
+	float **lengths;
+	float **wcos;
+	float *emitter_cosnos;
+	int totpart, totpoint;
+	char name[64];
+} ParticleUndo;
+
+typedef struct ParticleEditPath{
+	ListBase undo;
+	ParticleUndo *curundo;
+	ParticleTreeNode *emitter_field;
+	float **lengths;
+	float *emitter_cosnos;
+	float **world_cos;
+	float sta, end, life, size; /* average values for selected particles */
+	float o_sta, o_end, o_life, o_size;
+	float keytime, o_keytime;
+	float emitter_dist;
+	int totpoint, rt;
+	short flag, brush, totrekey, totaddkey;
+	short brushsize[7], brushpow[7];
+	short average, brushstep;
+} ParticleEditPath;
+
+typedef struct BoidVecFunc{
+	void (*Addf)(float *v, float *v1, float *v2);
+	void (*Subf)(float *v, float *v1, float *v2);
+	void (*Mulf)(float *v, float f);
+	float (*Length)(float *v);
+	float (*Normalize)(float *v);
+	float (*Inpf)(float *v1, float *v2);
+	void (*Copyf)(float *v1, float *v2);
+} BoidVecFunc;
+
+/* ----------- functions needed outside particlesystem ---------------- */
+/* particle.c */
+int count_particles(struct ParticleSystem *psys);
+int count_particles_mod(struct ParticleSystem *psys, int totgr, int cur);
+int count_psyskeys(struct ParticleSystem *psys);
+
+struct ParticleSystem *get_current_psys(struct Object *ob);
+struct ParticleSystem *get_psys(struct Object *ob, int index);
+struct ParticleData *get_selected_particle(struct ParticleSystem *psys, int *index);
+struct ParticleKey *get_particle_selected_key(struct ParticleSystem *psys, int pa_index, int *key_index);
+void particles_change_act(void *ob_v, void *old_act);
+struct Object *get_particle_lattice(struct ParticleSystemModifierData *psmd);
+
+void free_particleSettings(struct ParticleSettings *part);
+void particle_system_free_bake(struct ParticleSystem *psys);
+void free_particle_path_cache(struct ParticleSystem *psys);
+void free_particles(struct Object * ob, struct ParticleSystem * psys, int sys);
+void remove_from_particle_list(struct Object *ob, short nbr, struct ParticleSystem *psys);
+
+void interpolate_face_uvs(struct MTFace *tface, int quad, float *uv, float *uvco);
+
+void copy_particle_key(struct ParticleKey *to, struct ParticleKey *from, int time);
+
+void particle_on_emitter(struct ParticleSystemModifierData *psmd, int distr, int index, float *fuv, float *vec, float *nor, float *utan, float *vtan);
+struct ParticleSystemModifierData *get_particle_modifier(struct Object *ob, struct ParticleSystem *psys);
+
+struct ParticleSettings *new_particle_settings(char *name);
+struct ParticleSettings *copy_particle_settings(struct ParticleSettings *part);
+void flush_particlesettings(struct ParticleSettings *part, int event);
+
+void find_particle_parents(struct ParticleSystemModifierData *psmd, struct ParticleSystem *psys);
+
+void cache_particle_paths(struct Object *ob, struct ParticleSystemModifierData *psmd, struct ParticleSystem *psys, float cfra);
+void particle_guide(struct ParticleKey *state, int pa_num, float time, struct ListBase *lb);
+float get_particle_size(struct ParticleSettings *part, struct ParticleData *pa);
+float get_particle_timestep(struct ParticleSettings *part);
+float get_child_particle_time(struct ParticleSystem *psys, int child_nbr, float cfra);
+float get_child_particle_size(struct ParticleSystem *psys, int child_nbr, float cfra, float *pa_time);
+void get_particle_on_path(struct Object *ob, struct ParticleSystem *psys, int pa_num, struct ParticleKey *state, int vel);
+int get_particle_state(struct Object *ob, struct ParticleSystem *psys, int p, struct ParticleKey *state, int allways);
+
+/* particle_system.c */
+int count_keyed_particle_targets(struct Object *ob, struct ParticleSystem *psys);
+void get_reactor_particle_target(struct Object *ob, struct ParticleSystem *psys, Object **target_ob, struct ParticleSystem **target_psys);
+
+void pdInitEffectorsNew(struct Object *obsrc, struct Group *group, struct ParticleSystem *psys);
+void pdEndEffectorsNew(struct ParticleSystem *psys);
+
+void particle_system_update(struct Object *ob, struct ParticleSystem *psys);
+
+/* particle_edit.c */
+void foreach_particle(struct ParticleSystem *psys, void (*func)(ParticleSystem *psys, int index, void *userData), void *userData);
+void particle_select_root(struct ParticleSystem *psys, int index, void *userData);
+void particle_select_tip(struct ParticleSystem *psys, int index, void *userData);
+void particle_edit_apply_averages(void);
+void particle_edit_keytime_change(void);
+void set_particleedit(void);
+void mouse_particles(void);
+void select_linked_particles(void);
+void particle_borderselect(void);
+void brush_particles(void);
+void deselectall_particle(void);
+void particle_selectionCB(short selecting, struct Object *editobj, short *mval, float rad);
+void do_lasso_select_particles(short mcords[][2], short moves, short select);
+void select_less_particle(void);
+void select_more_particle(void);
+void hide_particles(void);
+void rekey_particles(void);
+void subdivide_particles(void);
+void delete_particle(void);
+void particle_edit_averages_change(void);
+
+void undo_push_particle(char *str);
+void particle_undo(void);
+void particle_redo(void);
+void particle_undo_menu(void);
+
+/* ----------- functions needed only inside particlesystem ------------ */
+/* particle.c */
+void particle_key_to_object(struct Object *ob, struct ParticleKey *key, float imat[][4]);
+void particle_key_to_geometry(struct DerivedMesh *dm, struct ParticleData *pa, struct ParticleKey *key);
+void particle_key_from_geometry(struct DerivedMesh *dm, struct ParticleData *pa, struct ParticleKey *key);
+void particle_geometry_mat(struct DerivedMesh *dm, struct ParticleData *pa, float mat[][4]);
+void particle_vec_from_geometry(struct DerivedMesh *dm, struct ParticleData *pa, float *vec);
+
+struct ParticleTreeNode *particle_tree_alloc(int nodes);
+struct ParticleTreeNode *copy_particle_tree(struct ParticleTreeNode *from);
+void free_particle_tree(struct ParticleTreeNode *root);
+int particle_tree_find_nearest(struct ParticleTreeNode *root, float *co);
+void particle_tree_insert(struct ParticleTreeNode *root, struct ParticleTreeNode *node);
+int particle_tree_find_n_nearest(struct ParticleTreeNode *root, float *co, int n, struct ParticleTreeNearest *ptn);
+
+float *cache_particle_vgroup(struct DerivedMesh *dm, struct ParticleSystem *psys, int vgroup);
+void get_particle_texture(struct Material *ma, struct ParticleSystemModifierData *psmd, struct ParticleSystem *psys, struct ParticleData *pa, struct ParticleTexture *ptex, int event);
+void interpolate_face_coordinates(struct MVert *mvert, struct MFace *mface, struct MTFace *tface, float *uv, float *vec, float *nor, float *utan, float *vtan);
+float interpolate_particle_value_from_verts(struct DerivedMesh *dm, short from, int index, float *fuv, float *values);
+void get_from_particle_key(struct ParticleKey *key, float *loc, float *vel, float *rot, float *time);
+
+int particle_intersect_dm(int final, struct Object *ob, struct DerivedMesh *dm, float *co1, float* co2, float *min_d, int *min_face, float *min_uv);
+void particle_on_dm(struct DerivedMesh *dm, int from, int index, float *fuv, float *vec, float *nor, float *utan, float *vtan);
+
+/* particle_system.c */
+void initialize_particle(struct ParticleData *pa, int p, Object *ob, struct ParticleSystem *psys, struct ParticleSystemModifierData *psmd, float *vg_size);
+void reset_particle(struct ParticleData *pa, struct ParticleSystem *psys, struct ParticleSystemModifierData *psmd, struct Object *ob, float dtime, float cfra, float *vg_vel);
+
+/* particle_edit.c */
+void free_particle_edit_path(struct ParticleSystem *psys);
+void particle_edit_iterate_lengths(struct ParticleSystem *psys);
+void particle_edit_apply_lengths(struct ParticleSystem *psys);
+void particle_edit_deflect_emitter(struct ParticleSystem *psys);
+void recalc_particle_edit_wcos(struct Object *ob, struct ParticleSystem *psys);
+void particle_edit_path(struct Object *ob, struct ParticleSystem *psys, int init);
+void undo_particle_clear(struct ParticleSystem *psys);
+
+#define PSYS_EC_EFFECTOR	1
+#define PSYS_EC_DEFLECT		2
+#define PSYS_EC_PARTICLE	4
+#define PSYS_EC_REACTOR		8
+
+/* ParticleEditPath->flag */
+#define PSYS_EP_ROTVEL		1
+#define PSYS_EP_ROTROT		2
+#define PSYS_EP_SCALE_ROOT	4
+#define PSYS_EP_LOCK_ROOT	8
+#define PSYS_EP_KEEP_LENGTHS	16
+#define PSYS_EP_DEFLECT_EMITTER	32
+#define PSYS_EP_ADD_INTERP	64
+#define PSYS_EP_SHOW_CHILD	128
+
+/* ParticleEditPath->average */
+#define PSYS_EP_AV_STA		1
+#define PSYS_EP_AV_END		2
+#define PSYS_EP_AV_LIFE		4
+#define PSYS_EP_AV_SIZE		8
+
+/* ParticleEditPath->brush */
+/* Remember to update arrays in struct too! */
+#define PSYS_TOT_BRUSH		7
+

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list