Removed particle DNA.
This commit is contained in:
@@ -67,7 +67,6 @@ set(SRC_DNA_INC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_object_types.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_outliner_types.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_packedFile_types.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_particle_types.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_property_types.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_rigidbody_types.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_scene_types.h
|
||||
|
||||
@@ -43,7 +43,7 @@ struct ListBase;
|
||||
struct Group;
|
||||
struct ParticleSimulationData;
|
||||
struct ParticleData;
|
||||
struct ParticleKey;
|
||||
struct PointCacheKey;
|
||||
|
||||
struct EffectorWeights *BKE_add_effector_weights(struct Group *group);
|
||||
struct PartDeflect *object_add_collision_fields(int type);
|
||||
@@ -95,7 +95,6 @@ typedef struct EffectorCache {
|
||||
|
||||
struct Scene *scene;
|
||||
struct Object *ob;
|
||||
struct ParticleSystem *psys;
|
||||
struct SurfaceModifierData *surmd;
|
||||
|
||||
struct PartDeflect *pd;
|
||||
@@ -110,7 +109,7 @@ typedef struct EffectorCache {
|
||||
} EffectorCache;
|
||||
|
||||
void free_partdeflect(struct PartDeflect *pd);
|
||||
struct ListBase *pdInitEffectors(struct Scene *scene, struct Object *ob_src, struct ParticleSystem *psys_src, struct EffectorWeights *weights, bool precalc);
|
||||
struct ListBase *pdInitEffectors(struct Scene *scene, struct Object *ob_src, struct EffectorWeights *weights, bool precalc);
|
||||
void pdEndEffectors(struct ListBase **effectors);
|
||||
void pdPrecalculateEffectors(struct ListBase *effectors);
|
||||
void pdDoEffectors(struct ListBase *effectors, struct ListBase *colliders, struct EffectorWeights *weights, struct EffectedPoint *point, float *force, float *impulse);
|
||||
|
||||
@@ -85,7 +85,7 @@ struct ClothModifierData;
|
||||
struct ListBase;
|
||||
struct Main;
|
||||
struct Object;
|
||||
struct ParticleKey;
|
||||
struct PointCacheKey;
|
||||
struct ParticleSystem;
|
||||
struct PointCache;
|
||||
struct Scene;
|
||||
@@ -264,12 +264,18 @@ typedef struct PTCacheEdit {
|
||||
unsigned char nosel_col[3];
|
||||
} PTCacheEdit;
|
||||
|
||||
/* Particle functions */
|
||||
void BKE_ptcache_make_particle_key(struct ParticleKey *key, int index, void **data, float time);
|
||||
typedef struct PointCacheKey {
|
||||
float co[3]; /* location */
|
||||
float vel[3]; /* velocity */
|
||||
float rot[4]; /* rotation quaternion */
|
||||
float ave[3]; /* angular velocity */
|
||||
float time; /* when this key happens */
|
||||
} PointCacheKey;
|
||||
|
||||
void BKE_ptcache_make_key(struct PointCacheKey *key, int index, void **data, float time);
|
||||
|
||||
/**************** Creating ID's ****************************/
|
||||
void BKE_ptcache_id_from_softbody(PTCacheID *pid, struct Object *ob, struct SoftBody *sb);
|
||||
void BKE_ptcache_id_from_particles(PTCacheID *pid, struct Object *ob, struct ParticleSystem *psys);
|
||||
void BKE_ptcache_id_from_cloth(PTCacheID *pid, struct Object *ob, struct ClothModifierData *clmd);
|
||||
void BKE_ptcache_id_from_smoke(PTCacheID *pid, struct Object *ob, struct SmokeModifierData *smd);
|
||||
void BKE_ptcache_id_from_dynamicpaint(PTCacheID *pid, struct Object *ob, struct DynamicPaintSurface *surface);
|
||||
|
||||
@@ -87,7 +87,6 @@ struct Tex *give_current_lamp_texture(struct Lamp *la);
|
||||
struct Tex *give_current_linestyle_texture(struct FreestyleLineStyle *linestyle);
|
||||
struct Tex *give_current_world_texture(struct World *world);
|
||||
struct Tex *give_current_brush_texture(struct Brush *br);
|
||||
struct Tex *give_current_particle_texture(struct ParticleSettings *part);
|
||||
|
||||
struct bNode *give_current_material_texture_node(struct Material *ma);
|
||||
|
||||
@@ -99,7 +98,6 @@ void set_current_world_texture(struct World *wo, struct Tex *tex);
|
||||
void set_current_material_texture(struct Material *ma, struct Tex *tex);
|
||||
void set_current_lamp_texture(struct Lamp *la, struct Tex *tex);
|
||||
void set_current_linestyle_texture(struct FreestyleLineStyle *linestyle, struct Tex *tex);
|
||||
void set_current_particle_texture(struct ParticleSettings *part, struct Tex *tex);
|
||||
|
||||
bool has_current_material_texture(struct Material *ma);
|
||||
|
||||
|
||||
@@ -55,7 +55,6 @@
|
||||
#include "DNA_object_fluidsim.h"
|
||||
#include "DNA_object_force.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_particle_types.h"
|
||||
#include "DNA_sequence_types.h"
|
||||
#include "DNA_sound_types.h"
|
||||
#include "DNA_text_types.h"
|
||||
@@ -462,7 +461,6 @@ void BKE_bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int
|
||||
{
|
||||
Object *ob = (Object *)id;
|
||||
ModifierData *md;
|
||||
ParticleSystem *psys;
|
||||
|
||||
#define BPATH_TRAVERSE_POINTCACHE(ptcaches) \
|
||||
{ \
|
||||
@@ -515,10 +513,6 @@ void BKE_bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int
|
||||
BPATH_TRAVERSE_POINTCACHE(ob->soft->ptcaches);
|
||||
}
|
||||
|
||||
for (psys = ob->particlesystem.first; psys; psys = psys->next) {
|
||||
BPATH_TRAVERSE_POINTCACHE(psys->ptcaches);
|
||||
}
|
||||
|
||||
#undef BPATH_TRAVERSE_POINTCACHE
|
||||
|
||||
break;
|
||||
|
||||
@@ -365,7 +365,7 @@ static int do_step_cloth(Object *ob, ClothModifierData *clmd, DerivedMesh *resul
|
||||
mul_m4_v3(ob->obmat, verts->xconst);
|
||||
}
|
||||
|
||||
effectors = pdInitEffectors(clmd->scene, ob, NULL, clmd->sim_parms->effector_weights, true);
|
||||
effectors = pdInitEffectors(clmd->scene, ob, clmd->sim_parms->effector_weights, true);
|
||||
|
||||
/* Support for dynamic vertex groups, changing from frame to frame */
|
||||
cloth_apply_vgroup ( clmd, result );
|
||||
|
||||
@@ -3843,7 +3843,7 @@ static int dynamicPaint_prepareEffectStep(DynamicPaintSurface *surface, Scene *s
|
||||
/* Init force data if required */
|
||||
if (surface->effect & MOD_DPAINT_EFFECT_DO_DRIP) {
|
||||
float vel[3] = {0};
|
||||
ListBase *effectors = pdInitEffectors(scene, ob, NULL, surface->effector_weights, true);
|
||||
ListBase *effectors = pdInitEffectors(scene, ob, surface->effector_weights, true);
|
||||
|
||||
/* allocate memory for force data (dir vector + strength) */
|
||||
*force = MEM_mallocN(sData->total_points * 4 * sizeof(float), "PaintEffectForces");
|
||||
|
||||
@@ -43,7 +43,6 @@
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_object_force.h"
|
||||
#include "DNA_particle_types.h"
|
||||
#include "DNA_texture_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
|
||||
@@ -147,12 +146,11 @@ void free_partdeflect(PartDeflect *pd)
|
||||
MEM_freeN(pd);
|
||||
}
|
||||
|
||||
static EffectorCache *new_effector_cache(Scene *scene, Object *ob, ParticleSystem *psys, PartDeflect *pd)
|
||||
static EffectorCache *new_effector_cache(Scene *scene, Object *ob, PartDeflect *pd)
|
||||
{
|
||||
EffectorCache *eff = MEM_callocN(sizeof(EffectorCache), "EffectorCache");
|
||||
eff->scene = scene;
|
||||
eff->ob = ob;
|
||||
eff->psys = psys;
|
||||
eff->pd = pd;
|
||||
eff->frame = -1;
|
||||
return eff;
|
||||
@@ -170,7 +168,7 @@ static void add_object_to_effectors(ListBase **effectors, Scene *scene, Effector
|
||||
if (*effectors == NULL)
|
||||
*effectors = MEM_callocN(sizeof(ListBase), "effectors list");
|
||||
|
||||
eff = new_effector_cache(scene, ob, NULL, ob->pd);
|
||||
eff = new_effector_cache(scene, ob, ob->pd);
|
||||
|
||||
/* make sure imat is up to date */
|
||||
invert_m4_m4(ob->imat, ob->obmat);
|
||||
@@ -179,7 +177,7 @@ static void add_object_to_effectors(ListBase **effectors, Scene *scene, Effector
|
||||
}
|
||||
|
||||
/* returns ListBase handle with objects taking part in the effecting */
|
||||
ListBase *pdInitEffectors(Scene *scene, Object *ob_src, ParticleSystem *UNUSED(psys_src),
|
||||
ListBase *pdInitEffectors(Scene *scene, Object *ob_src,
|
||||
EffectorWeights *weights, bool precalc)
|
||||
{
|
||||
Base *base;
|
||||
@@ -577,7 +575,7 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin
|
||||
|
||||
return ret;
|
||||
}
|
||||
static void get_effector_tot(EffectorCache *eff, EffectorData *efd, EffectedPoint *point, int *tot, int *p, int *step)
|
||||
static void get_effector_tot(EffectorCache *eff, EffectorData *efd, EffectedPoint *point, int *tot, int *p)
|
||||
{
|
||||
*p = 0;
|
||||
efd->index = p;
|
||||
@@ -590,31 +588,6 @@ static void get_effector_tot(EffectorCache *eff, EffectorData *efd, EffectedPoin
|
||||
*tot = *p+1;
|
||||
}
|
||||
}
|
||||
else if (eff->psys) {
|
||||
*tot = eff->psys->totpart;
|
||||
|
||||
if (eff->pd->forcefield == PFIELD_CHARGE) {
|
||||
/* Only the charge of the effected particle is used for
|
||||
* interaction, not fall-offs. If the fall-offs aren't the
|
||||
* same this will be unphysical, but for animation this
|
||||
* could be the wanted behavior. If you want physical
|
||||
* correctness the fall-off should be spherical 2.0 anyways.
|
||||
*/
|
||||
efd->charge = eff->pd->f_strength;
|
||||
}
|
||||
else if (eff->pd->forcefield == PFIELD_HARMONIC && (eff->pd->flag & PFIELD_MULTIPLE_SPRINGS)==0) {
|
||||
/* every particle is mapped to only one harmonic effector particle */
|
||||
*p= point->index % eff->psys->totpart;
|
||||
*tot= *p + 1;
|
||||
}
|
||||
|
||||
if (eff->psys->part->effector_amount) {
|
||||
int totpart = eff->psys->totpart;
|
||||
int amount = eff->psys->part->effector_amount;
|
||||
|
||||
*step = (totpart > amount) ? totpart/amount : 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
*tot = 1;
|
||||
}
|
||||
@@ -875,7 +848,7 @@ void pdDoEffectors(ListBase *effectors, ListBase *colliders, EffectorWeights *we
|
||||
*/
|
||||
EffectorCache *eff;
|
||||
EffectorData efd;
|
||||
int p=0, tot = 1, step = 1;
|
||||
int p=0, tot = 1;
|
||||
|
||||
/* Cycle through collected objects, get total of (1/(gravity_strength * dist^gravity_power)) */
|
||||
/* Check for min distance here? (yes would be cool to add that, ton) */
|
||||
@@ -883,9 +856,9 @@ void pdDoEffectors(ListBase *effectors, ListBase *colliders, EffectorWeights *we
|
||||
if (effectors) for (eff = effectors->first; eff; eff=eff->next) {
|
||||
/* object effectors were fully checked to be OK to evaluate! */
|
||||
|
||||
get_effector_tot(eff, &efd, point, &tot, &p, &step);
|
||||
get_effector_tot(eff, &efd, point, &tot, &p);
|
||||
|
||||
for (; p<tot; p+=step) {
|
||||
for (; p<tot; p++) {
|
||||
if (get_effector_data(eff, &efd, point, 0)) {
|
||||
efd.falloff= effector_falloff(eff, &efd, point, weights);
|
||||
|
||||
|
||||
@@ -43,7 +43,6 @@
|
||||
#include "DNA_object_fluidsim.h"
|
||||
#include "DNA_object_force.h" // for pointcache
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_particle_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
|
||||
#include "BLI_math.h"
|
||||
|
||||
@@ -40,7 +40,6 @@
|
||||
#include "DNA_material_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_particle_types.h"
|
||||
|
||||
#include "BLI_blenlib.h"
|
||||
#include "BLI_utildefines.h"
|
||||
@@ -79,7 +78,6 @@ void BKE_group_unlink(Main *bmain, Group *group)
|
||||
Object *ob;
|
||||
Scene *sce;
|
||||
SceneRenderLayer *srl;
|
||||
ParticleSystem *psys;
|
||||
|
||||
for (ma = bmain->mat.first; ma; ma = ma->id.next) {
|
||||
if (ma->group == group)
|
||||
@@ -119,15 +117,6 @@ void BKE_group_unlink(Main *bmain, Group *group)
|
||||
if (ob->dup_group == group) {
|
||||
ob->dup_group = NULL;
|
||||
}
|
||||
|
||||
for (psys = ob->particlesystem.first; psys; psys = psys->next) {
|
||||
if (psys->part->dup_group == group)
|
||||
psys->part->dup_group = NULL;
|
||||
#if 0 /* not used anymore, only keps for readfile.c, no need to account for this */
|
||||
if (psys->part->eff_group == group)
|
||||
psys->part->eff_group = NULL;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/* group stays in library, but no members */
|
||||
|
||||
@@ -42,7 +42,6 @@
|
||||
#include "DNA_modifier_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_object_force.h"
|
||||
#include "DNA_particle_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
|
||||
#include "BKE_action.h"
|
||||
@@ -72,8 +71,6 @@ static Lattice *object_defgroup_lattice_get(ID *id)
|
||||
void BKE_object_defgroup_remap_update_users(Object *ob, int *map)
|
||||
{
|
||||
ModifierData *md;
|
||||
ParticleSystem *psys;
|
||||
int a;
|
||||
|
||||
/* these cases don't use names to refer to vertex groups, so when
|
||||
* they get removed the numbers get out of sync, this corrects that */
|
||||
@@ -98,12 +95,6 @@ void BKE_object_defgroup_remap_update_users(Object *ob, int *map)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (psys = ob->particlesystem.first; psys; psys = psys->next) {
|
||||
for (a = 0; a < PSYS_TOT_VG; a++) {
|
||||
psys->vgroup[a] = map[psys->vgroup[a]];
|
||||
}
|
||||
}
|
||||
}
|
||||
/** \} */
|
||||
|
||||
|
||||
@@ -41,7 +41,6 @@
|
||||
#include "DNA_modifier_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_object_force.h"
|
||||
#include "DNA_particle_types.h"
|
||||
#include "DNA_rigidbody_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_smoke_types.h"
|
||||
@@ -136,7 +135,7 @@ static int ptcache_data_size[] = {
|
||||
|
||||
static int ptcache_extra_datasize[] = {
|
||||
0,
|
||||
sizeof(ParticleSpring)
|
||||
0
|
||||
};
|
||||
|
||||
/* forward declerations */
|
||||
@@ -196,7 +195,7 @@ static void ptcache_softbody_read(int index, void *soft_v, void **data, float UN
|
||||
}
|
||||
}
|
||||
|
||||
static void interpolate_particle_keys(short type, ParticleKey keys[4], float dt, ParticleKey *result, bool velocity)
|
||||
static void interpolate_particle_keys(short type, PointCacheKey keys[4], float dt, PointCacheKey *result, bool velocity)
|
||||
{
|
||||
float t[4];
|
||||
|
||||
@@ -229,7 +228,7 @@ static void ptcache_softbody_interpolate(int index, void *soft_v, void **data, f
|
||||
{
|
||||
SoftBody *soft= soft_v;
|
||||
BodyPoint *bp = soft->bpoint + index;
|
||||
ParticleKey keys[4];
|
||||
PointCacheKey keys[4];
|
||||
float dfra;
|
||||
|
||||
if (cfra1 == cfra2)
|
||||
@@ -243,7 +242,7 @@ static void ptcache_softbody_interpolate(int index, void *soft_v, void **data, f
|
||||
memcpy(keys[2].vel, old_data + 3, 3 * sizeof(float));
|
||||
}
|
||||
else
|
||||
BKE_ptcache_make_particle_key(keys+2, 0, data, cfra2);
|
||||
BKE_ptcache_make_key(keys+2, 0, data, cfra2);
|
||||
|
||||
dfra = cfra2 - cfra1;
|
||||
|
||||
@@ -267,8 +266,7 @@ static void ptcache_softbody_error(void *UNUSED(soft_v), const char *UNUSED(mess
|
||||
/* ignored for now */
|
||||
}
|
||||
|
||||
/* Particle functions */
|
||||
void BKE_ptcache_make_particle_key(ParticleKey *key, int index, void **data, float time)
|
||||
void BKE_ptcache_make_key(PointCacheKey *key, int index, void **data, float time)
|
||||
{
|
||||
PTCACHE_DATA_TO(data, BPHYS_DATA_LOCATION, index, key->co);
|
||||
PTCACHE_DATA_TO(data, BPHYS_DATA_VELOCITY, index, key->vel);
|
||||
@@ -284,229 +282,6 @@ void BKE_ptcache_make_particle_key(ParticleKey *key, int index, void **data, flo
|
||||
PTCACHE_DATA_TO(data, BPHYS_DATA_AVELOCITY, index, key->ave);
|
||||
key->time = time;
|
||||
}
|
||||
static int ptcache_particle_write(int index, void *psys_v, void **data, int cfra)
|
||||
{
|
||||
ParticleSystem *psys= psys_v;
|
||||
ParticleData *pa = psys->particles + index;
|
||||
BoidParticle *boid = (psys->part->phystype == PART_PHYS_BOIDS) ? pa->boid : NULL;
|
||||
float times[3];
|
||||
int step = psys->pointcache->step;
|
||||
|
||||
/* No need to store unborn or died particles outside cache step bounds */
|
||||
if (data[BPHYS_DATA_INDEX] && (cfra < pa->time - step || cfra > pa->dietime + step))
|
||||
return 0;
|
||||
|
||||
times[0] = pa->time;
|
||||
times[1] = pa->dietime;
|
||||
times[2] = pa->lifetime;
|
||||
|
||||
PTCACHE_DATA_FROM(data, BPHYS_DATA_INDEX, &index);
|
||||
PTCACHE_DATA_FROM(data, BPHYS_DATA_LOCATION, pa->state.co);
|
||||
PTCACHE_DATA_FROM(data, BPHYS_DATA_VELOCITY, pa->state.vel);
|
||||
PTCACHE_DATA_FROM(data, BPHYS_DATA_ROTATION, pa->state.rot);
|
||||
PTCACHE_DATA_FROM(data, BPHYS_DATA_AVELOCITY, pa->state.ave);
|
||||
PTCACHE_DATA_FROM(data, BPHYS_DATA_SIZE, &pa->size);
|
||||
PTCACHE_DATA_FROM(data, BPHYS_DATA_TIMES, times);
|
||||
|
||||
if (boid) {
|
||||
PTCACHE_DATA_FROM(data, BPHYS_DATA_BOIDS, &boid->data);
|
||||
}
|
||||
|
||||
/* return flag 1+1=2 for newly born particles to copy exact birth location to previously cached frame */
|
||||
return 1 + (pa->state.time >= pa->time && pa->prev_state.time <= pa->time);
|
||||
}
|
||||
static void ptcache_particle_read(int index, void *psys_v, void **data, float cfra, float *old_data)
|
||||
{
|
||||
ParticleSystem *psys= psys_v;
|
||||
ParticleData *pa;
|
||||
BoidParticle *boid;
|
||||
float timestep = 0.04f * psys->part->timetweak;
|
||||
|
||||
if (index >= psys->totpart)
|
||||
return;
|
||||
|
||||
pa = psys->particles + index;
|
||||
boid = (psys->part->phystype == PART_PHYS_BOIDS) ? pa->boid : NULL;
|
||||
|
||||
if (cfra > pa->state.time)
|
||||
memcpy(&pa->prev_state, &pa->state, sizeof(ParticleKey));
|
||||
|
||||
if (old_data) {
|
||||
/* old format cache */
|
||||
memcpy(&pa->state, old_data, sizeof(ParticleKey));
|
||||
return;
|
||||
}
|
||||
|
||||
BKE_ptcache_make_particle_key(&pa->state, 0, data, cfra);
|
||||
|
||||
/* set frames cached before birth to birth time */
|
||||
if (cfra < pa->time)
|
||||
pa->state.time = pa->time;
|
||||
else if (cfra > pa->dietime)
|
||||
pa->state.time = pa->dietime;
|
||||
|
||||
if (data[BPHYS_DATA_SIZE]) {
|
||||
PTCACHE_DATA_TO(data, BPHYS_DATA_SIZE, 0, &pa->size);
|
||||
}
|
||||
|
||||
if (data[BPHYS_DATA_TIMES]) {
|
||||
float times[3];
|
||||
PTCACHE_DATA_TO(data, BPHYS_DATA_TIMES, 0, ×);
|
||||
pa->time = times[0];
|
||||
pa->dietime = times[1];
|
||||
pa->lifetime = times[2];
|
||||
}
|
||||
|
||||
if (boid) {
|
||||
PTCACHE_DATA_TO(data, BPHYS_DATA_BOIDS, 0, &boid->data);
|
||||
}
|
||||
|
||||
/* determine velocity from previous location */
|
||||
if (data[BPHYS_DATA_LOCATION] && !data[BPHYS_DATA_VELOCITY]) {
|
||||
if (cfra > pa->prev_state.time) {
|
||||
sub_v3_v3v3(pa->state.vel, pa->state.co, pa->prev_state.co);
|
||||
mul_v3_fl(pa->state.vel, (cfra - pa->prev_state.time) * timestep);
|
||||
}
|
||||
else {
|
||||
sub_v3_v3v3(pa->state.vel, pa->prev_state.co, pa->state.co);
|
||||
mul_v3_fl(pa->state.vel, (pa->prev_state.time - cfra) * timestep);
|
||||
}
|
||||
}
|
||||
|
||||
/* default to no rotation */
|
||||
if (data[BPHYS_DATA_LOCATION] && !data[BPHYS_DATA_ROTATION]) {
|
||||
unit_qt(pa->state.rot);
|
||||
}
|
||||
}
|
||||
static void ptcache_particle_interpolate(int index, void *psys_v, void **data, float cfra, float cfra1, float cfra2, float *old_data)
|
||||
{
|
||||
ParticleSystem *psys= psys_v;
|
||||
ParticleData *pa;
|
||||
ParticleKey keys[4];
|
||||
float dfra, timestep = 0.04f * psys->part->timetweak;
|
||||
|
||||
if (index >= psys->totpart)
|
||||
return;
|
||||
|
||||
pa = psys->particles + index;
|
||||
|
||||
/* particle wasn't read from first cache so can't interpolate */
|
||||
if ((int)cfra1 < pa->time - psys->pointcache->step || (int)cfra1 > pa->dietime + psys->pointcache->step)
|
||||
return;
|
||||
|
||||
cfra = MIN2(cfra, pa->dietime);
|
||||
cfra1 = MIN2(cfra1, pa->dietime);
|
||||
cfra2 = MIN2(cfra2, pa->dietime);
|
||||
|
||||
if (cfra1 == cfra2)
|
||||
return;
|
||||
|
||||
memcpy(keys+1, &pa->state, sizeof(ParticleKey));
|
||||
if (old_data)
|
||||
memcpy(keys+2, old_data, sizeof(ParticleKey));
|
||||
else
|
||||
BKE_ptcache_make_particle_key(keys+2, 0, data, cfra2);
|
||||
|
||||
/* determine velocity from previous location */
|
||||
if (data[BPHYS_DATA_LOCATION] && !data[BPHYS_DATA_VELOCITY]) {
|
||||
if (keys[1].time > keys[2].time) {
|
||||
sub_v3_v3v3(keys[2].vel, keys[1].co, keys[2].co);
|
||||
mul_v3_fl(keys[2].vel, (keys[1].time - keys[2].time) * timestep);
|
||||
}
|
||||
else {
|
||||
sub_v3_v3v3(keys[2].vel, keys[2].co, keys[1].co);
|
||||
mul_v3_fl(keys[2].vel, (keys[2].time - keys[1].time) * timestep);
|
||||
}
|
||||
}
|
||||
|
||||
/* determine rotation from velocity */
|
||||
if (data[BPHYS_DATA_LOCATION] && !data[BPHYS_DATA_ROTATION]) {
|
||||
vec_to_quat(keys[2].rot, keys[2].vel, OB_NEGX, OB_POSZ);
|
||||
}
|
||||
|
||||
if (cfra > pa->time)
|
||||
cfra1 = MAX2(cfra1, pa->time);
|
||||
|
||||
dfra = cfra2 - cfra1;
|
||||
|
||||
mul_v3_fl(keys[1].vel, dfra * timestep);
|
||||
mul_v3_fl(keys[2].vel, dfra * timestep);
|
||||
|
||||
interpolate_particle_keys(-1, keys, (cfra - cfra1) / dfra, &pa->state, 1);
|
||||
interp_qt_qtqt(pa->state.rot, keys[1].rot, keys[2].rot, (cfra - cfra1) / dfra);
|
||||
|
||||
mul_v3_fl(pa->state.vel, 1.f / (dfra * timestep));
|
||||
|
||||
pa->state.time = cfra;
|
||||
}
|
||||
|
||||
static int ptcache_particle_totpoint(void *psys_v, int UNUSED(cfra))
|
||||
{
|
||||
ParticleSystem *psys = psys_v;
|
||||
return psys->totpart;
|
||||
}
|
||||
|
||||
static void ptcache_particle_error(void *UNUSED(psys_v), const char *UNUSED(message))
|
||||
{
|
||||
/* ignored for now */
|
||||
}
|
||||
|
||||
static int ptcache_particle_totwrite(void *psys_v, int cfra)
|
||||
{
|
||||
ParticleSystem *psys = psys_v;
|
||||
ParticleData *pa= psys->particles;
|
||||
int p, step = psys->pointcache->step;
|
||||
int totwrite = 0;
|
||||
|
||||
if (cfra == 0)
|
||||
return psys->totpart;
|
||||
|
||||
for (p=0; p<psys->totpart; p++, pa++)
|
||||
totwrite += (cfra >= pa->time - step && cfra <= pa->dietime + step);
|
||||
|
||||
return totwrite;
|
||||
}
|
||||
|
||||
static void ptcache_particle_extra_write(void *psys_v, PTCacheMem *pm, int UNUSED(cfra))
|
||||
{
|
||||
ParticleSystem *psys = psys_v;
|
||||
PTCacheExtra *extra = NULL;
|
||||
|
||||
if (psys->part->phystype == PART_PHYS_FLUID &&
|
||||
psys->part->fluid && psys->part->fluid->flag & SPH_VISCOELASTIC_SPRINGS &&
|
||||
psys->tot_fluidsprings && psys->fluid_springs) {
|
||||
|
||||
extra = MEM_callocN(sizeof(PTCacheExtra), "Point cache: fluid extra data");
|
||||
|
||||
extra->type = BPHYS_EXTRA_FLUID_SPRINGS;
|
||||
extra->totdata = psys->tot_fluidsprings;
|
||||
|
||||
extra->data = MEM_callocN(extra->totdata * ptcache_extra_datasize[extra->type], "Point cache: extra data");
|
||||
memcpy(extra->data, psys->fluid_springs, extra->totdata * ptcache_extra_datasize[extra->type]);
|
||||
|
||||
BLI_addtail(&pm->extradata, extra);
|
||||
}
|
||||
}
|
||||
|
||||
static void ptcache_particle_extra_read(void *psys_v, PTCacheMem *pm, float UNUSED(cfra))
|
||||
{
|
||||
ParticleSystem *psys = psys_v;
|
||||
PTCacheExtra *extra = pm->extradata.first;
|
||||
|
||||
for (; extra; extra=extra->next) {
|
||||
switch (extra->type) {
|
||||
case BPHYS_EXTRA_FLUID_SPRINGS:
|
||||
{
|
||||
if (psys->fluid_springs)
|
||||
MEM_freeN(psys->fluid_springs);
|
||||
|
||||
psys->fluid_springs = MEM_dupallocN(extra->data);
|
||||
psys->tot_fluidsprings = psys->alloc_fluidsprings = extra->totdata;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Cloth functions */
|
||||
static int ptcache_cloth_write(int index, void *cloth_v, void **data, int UNUSED(cfra))
|
||||
@@ -543,7 +318,7 @@ static void ptcache_cloth_interpolate(int index, void *cloth_v, void **data, flo
|
||||
ClothModifierData *clmd= cloth_v;
|
||||
Cloth *cloth= clmd->clothObject;
|
||||
ClothVertex *vert = cloth->verts + index;
|
||||
ParticleKey keys[4];
|
||||
PointCacheKey keys[4];
|
||||
float dfra;
|
||||
|
||||
if (cfra1 == cfra2)
|
||||
@@ -557,7 +332,7 @@ static void ptcache_cloth_interpolate(int index, void *cloth_v, void **data, flo
|
||||
memcpy(keys[2].vel, old_data + 6, 3 * sizeof(float));
|
||||
}
|
||||
else
|
||||
BKE_ptcache_make_particle_key(keys+2, 0, data, cfra2);
|
||||
BKE_ptcache_make_key(keys+2, 0, data, cfra2);
|
||||
|
||||
dfra = cfra2 - cfra1;
|
||||
|
||||
@@ -1368,8 +1143,8 @@ static void ptcache_rigidbody_interpolate(int index, void *rb_v, void **data, fl
|
||||
RigidBodyOb *rbo = ob->rigidbody_object;
|
||||
|
||||
if (rbo->type == RBO_TYPE_ACTIVE) {
|
||||
ParticleKey keys[4];
|
||||
ParticleKey result;
|
||||
PointCacheKey keys[4];
|
||||
PointCacheKey result;
|
||||
float dfra;
|
||||
|
||||
memset(keys, 0, sizeof(keys));
|
||||
@@ -1382,7 +1157,7 @@ static void ptcache_rigidbody_interpolate(int index, void *rb_v, void **data, fl
|
||||
memcpy(keys[2].rot, data + 3, 4 * sizeof(float));
|
||||
}
|
||||
else {
|
||||
BKE_ptcache_make_particle_key(&keys[2], 0, data, cfra2);
|
||||
BKE_ptcache_make_key(&keys[2], 0, data, cfra2);
|
||||
}
|
||||
|
||||
dfra = cfra2 - cfra1;
|
||||
@@ -1448,68 +1223,6 @@ void BKE_ptcache_id_from_softbody(PTCacheID *pid, Object *ob, SoftBody *sb)
|
||||
pid->max_step = 20;
|
||||
pid->file_type = PTCACHE_FILE_PTCACHE;
|
||||
}
|
||||
void BKE_ptcache_id_from_particles(PTCacheID *pid, Object *ob, ParticleSystem *psys)
|
||||
{
|
||||
memset(pid, 0, sizeof(PTCacheID));
|
||||
|
||||
pid->ob= ob;
|
||||
pid->calldata= psys;
|
||||
pid->type= 0xdeadbeef;
|
||||
pid->stack_index= psys->pointcache->index;
|
||||
pid->cache= psys->pointcache;
|
||||
pid->cache_ptr= &psys->pointcache;
|
||||
pid->ptcaches= &psys->ptcaches;
|
||||
|
||||
if (psys->part->type != PART_HAIR)
|
||||
pid->flag |= PTCACHE_VEL_PER_SEC;
|
||||
|
||||
pid->totpoint = ptcache_particle_totpoint;
|
||||
pid->totwrite = ptcache_particle_totwrite;
|
||||
pid->error = ptcache_particle_error;
|
||||
|
||||
pid->write_point = ptcache_particle_write;
|
||||
pid->read_point = ptcache_particle_read;
|
||||
pid->interpolate_point = ptcache_particle_interpolate;
|
||||
|
||||
pid->write_stream = NULL;
|
||||
pid->read_stream = NULL;
|
||||
|
||||
pid->write_openvdb_stream = NULL;
|
||||
pid->read_openvdb_stream = NULL;
|
||||
|
||||
pid->write_extra_data = NULL;
|
||||
pid->read_extra_data = NULL;
|
||||
pid->interpolate_extra_data = NULL;
|
||||
|
||||
pid->write_header = ptcache_basic_header_write;
|
||||
pid->read_header = ptcache_basic_header_read;
|
||||
|
||||
pid->data_types = (1<<BPHYS_DATA_LOCATION) | (1<<BPHYS_DATA_VELOCITY) | (1<<BPHYS_DATA_INDEX);
|
||||
|
||||
if (psys->part->phystype == PART_PHYS_BOIDS)
|
||||
pid->data_types|= (1<<BPHYS_DATA_AVELOCITY) | (1<<BPHYS_DATA_ROTATION) | (1<<BPHYS_DATA_BOIDS);
|
||||
else if (psys->part->phystype == PART_PHYS_FLUID && psys->part->fluid && psys->part->fluid->flag & SPH_VISCOELASTIC_SPRINGS) {
|
||||
pid->write_extra_data = ptcache_particle_extra_write;
|
||||
pid->read_extra_data = ptcache_particle_extra_read;
|
||||
}
|
||||
|
||||
if (psys->part->flag & PART_ROTATIONS) {
|
||||
pid->data_types|= (1<<BPHYS_DATA_ROTATION);
|
||||
|
||||
if (psys->part->rotmode != PART_ROT_VEL ||
|
||||
psys->part->avemode == PART_AVE_RAND ||
|
||||
psys->part->avefac != 0.0f)
|
||||
{
|
||||
pid->data_types |= (1 << BPHYS_DATA_AVELOCITY);
|
||||
}
|
||||
}
|
||||
|
||||
pid->info_types= (1<<BPHYS_DATA_TIMES);
|
||||
|
||||
pid->default_step = 10;
|
||||
pid->max_step = 20;
|
||||
pid->file_type = PTCACHE_FILE_PTCACHE;
|
||||
}
|
||||
void BKE_ptcache_id_from_cloth(PTCacheID *pid, Object *ob, ClothModifierData *clmd)
|
||||
{
|
||||
memset(pid, 0, sizeof(PTCacheID));
|
||||
@@ -1682,7 +1395,6 @@ void BKE_ptcache_id_from_rigidbody(PTCacheID *pid, Object *ob, RigidBodyWorld *r
|
||||
void BKE_ptcache_ids_from_object(ListBase *lb, Object *ob, Scene *scene, int duplis)
|
||||
{
|
||||
PTCacheID *pid;
|
||||
ParticleSystem *psys;
|
||||
ModifierData *md;
|
||||
|
||||
lb->first= lb->last= NULL;
|
||||
@@ -1693,26 +1405,6 @@ void BKE_ptcache_ids_from_object(ListBase *lb, Object *ob, Scene *scene, int dup
|
||||
BLI_addtail(lb, pid);
|
||||
}
|
||||
|
||||
for (psys=ob->particlesystem.first; psys; psys=psys->next) {
|
||||
if (psys->part==NULL)
|
||||
continue;
|
||||
|
||||
/* check to make sure point cache is actually used by the particles */
|
||||
if (ELEM(psys->part->phystype, PART_PHYS_NO, PART_PHYS_KEYED))
|
||||
continue;
|
||||
|
||||
/* hair needs to be included in id-list for cache edit mode to work */
|
||||
/* if (psys->part->type == PART_HAIR && (psys->flag & PSYS_HAIR_DYNAMICS)==0) */
|
||||
/* continue; */
|
||||
|
||||
if (psys->part->type == PART_FLUID)
|
||||
continue;
|
||||
|
||||
pid= MEM_callocN(sizeof(PTCacheID), "PTCacheID");
|
||||
BKE_ptcache_id_from_particles(pid, ob, psys);
|
||||
BLI_addtail(lb, pid);
|
||||
}
|
||||
|
||||
for (md=ob->modifiers.first; md; md=md->next) {
|
||||
if (md->type == eModifierType_Cloth) {
|
||||
pid= MEM_callocN(sizeof(PTCacheID), "PTCacheID");
|
||||
|
||||
@@ -1255,7 +1255,7 @@ static void rigidbody_update_sim_ob(Scene *scene, RigidBodyWorld *rbw, Object *o
|
||||
ListBase *effectors;
|
||||
|
||||
/* get effectors present in the group specified by effector_weights */
|
||||
effectors = pdInitEffectors(scene, ob, NULL, effector_weights, true);
|
||||
effectors = pdInitEffectors(scene, ob, effector_weights, true);
|
||||
if (effectors) {
|
||||
float eff_force[3] = {0.0f, 0.0f, 0.0f};
|
||||
float eff_loc[3], eff_vel[3];
|
||||
|
||||
@@ -57,7 +57,6 @@
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_modifier_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_particle_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_smoke_types.h"
|
||||
|
||||
@@ -2198,7 +2197,7 @@ static void update_effectors(Scene *scene, Object *ob, SmokeDomainSettings *sds,
|
||||
ListBase *effectors;
|
||||
/* make sure smoke flow influence is 0.0f */
|
||||
sds->effector_weights->weight[PFIELD_SMOKEFLOW] = 0.0f;
|
||||
effectors = pdInitEffectors(scene, ob, NULL, sds->effector_weights, true);
|
||||
effectors = pdInitEffectors(scene, ob, sds->effector_weights, true);
|
||||
|
||||
if (effectors) {
|
||||
// precalculate wind forces
|
||||
|
||||
@@ -1499,7 +1499,7 @@ static void scan_for_ext_spring_forces(Scene *scene, Object *ob, float timenow)
|
||||
SoftBody *sb = ob->soft;
|
||||
ListBase *do_effector = NULL;
|
||||
|
||||
do_effector = pdInitEffectors(scene, ob, NULL, sb->effector_weights, true);
|
||||
do_effector = pdInitEffectors(scene, ob, sb->effector_weights, true);
|
||||
_scan_for_ext_spring_forces(scene, ob, timenow, 0, sb->totspring, do_effector);
|
||||
pdEndEffectors(&do_effector);
|
||||
}
|
||||
@@ -1519,7 +1519,7 @@ static void sb_sfesf_threads_run(Scene *scene, struct Object *ob, float timenow,
|
||||
int i, totthread, left, dec;
|
||||
int lowsprings =100; /* wild guess .. may increase with better thread management 'above' or even be UI option sb->spawn_cf_threads_nopts */
|
||||
|
||||
do_effector= pdInitEffectors(scene, ob, NULL, ob->soft->effector_weights, true);
|
||||
do_effector= pdInitEffectors(scene, ob, ob->soft->effector_weights, true);
|
||||
|
||||
/* figure the number of threads while preventing pretty pointless threading overhead */
|
||||
totthread= BKE_scene_num_threads(scene);
|
||||
@@ -2209,7 +2209,7 @@ static void softbody_calc_forcesEx(Scene *scene, Object *ob, float forcetime, fl
|
||||
sb_sfesf_threads_run(scene, ob, timenow, sb->totspring, NULL);
|
||||
|
||||
/* after spring scan because it uses Effoctors too */
|
||||
do_effector= pdInitEffectors(scene, ob, NULL, sb->effector_weights, true);
|
||||
do_effector= pdInitEffectors(scene, ob, sb->effector_weights, true);
|
||||
|
||||
if (do_deflector) {
|
||||
float defforce[3];
|
||||
@@ -2271,7 +2271,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
|
||||
|
||||
if (do_springcollision || do_aero) scan_for_ext_spring_forces(scene, ob, timenow);
|
||||
/* after spring scan because it uses Effoctors too */
|
||||
do_effector= pdInitEffectors(scene, ob, NULL, ob->soft->effector_weights, true);
|
||||
do_effector= pdInitEffectors(scene, ob, ob->soft->effector_weights, true);
|
||||
|
||||
if (do_deflector) {
|
||||
float defforce[3];
|
||||
|
||||
@@ -50,7 +50,6 @@
|
||||
#include "DNA_brush_types.h"
|
||||
#include "DNA_node_types.h"
|
||||
#include "DNA_color_types.h"
|
||||
#include "DNA_particle_types.h"
|
||||
#include "DNA_linestyle_types.h"
|
||||
|
||||
#include "IMB_imbuf.h"
|
||||
@@ -910,7 +909,6 @@ void BKE_texture_make_local(Tex *tex)
|
||||
World *wrld;
|
||||
Lamp *la;
|
||||
Brush *br;
|
||||
ParticleSettings *pa;
|
||||
FreestyleLineStyle *ls;
|
||||
int a;
|
||||
bool is_local = false, is_lib = false;
|
||||
@@ -970,16 +968,6 @@ void BKE_texture_make_local(Tex *tex)
|
||||
}
|
||||
br = br->id.next;
|
||||
}
|
||||
pa = bmain->particle.first;
|
||||
while (pa) {
|
||||
for (a = 0; a < MAX_MTEX; a++) {
|
||||
if (pa->mtex[a] && pa->mtex[a]->tex == tex) {
|
||||
if (pa->id.lib) is_lib = true;
|
||||
else is_local = true;
|
||||
}
|
||||
}
|
||||
pa = pa->id.next;
|
||||
}
|
||||
ls = bmain->linestyle.first;
|
||||
while (ls) {
|
||||
for (a = 0; a < MAX_MTEX; a++) {
|
||||
@@ -1060,19 +1048,6 @@ void BKE_texture_make_local(Tex *tex)
|
||||
}
|
||||
br = br->id.next;
|
||||
}
|
||||
pa = bmain->particle.first;
|
||||
while (pa) {
|
||||
for (a = 0; a < MAX_MTEX; a++) {
|
||||
if (pa->mtex[a] && pa->mtex[a]->tex == tex) {
|
||||
if (pa->id.lib == NULL) {
|
||||
pa->mtex[a]->tex = tex_new;
|
||||
id_us_plus(&tex_new->id);
|
||||
id_us_min(&tex->id);
|
||||
}
|
||||
}
|
||||
}
|
||||
pa = pa->id.next;
|
||||
}
|
||||
ls = bmain->linestyle.first;
|
||||
while (ls) {
|
||||
for (a = 0; a < MAX_MTEX; a++) {
|
||||
@@ -1235,10 +1210,6 @@ bool give_active_mtex(ID *id, MTex ***mtex_ar, short *act)
|
||||
*mtex_ar = ((FreestyleLineStyle *)id)->mtex;
|
||||
if (act) *act = (((FreestyleLineStyle *)id)->texact);
|
||||
break;
|
||||
case ID_PA:
|
||||
*mtex_ar = ((ParticleSettings *)id)->mtex;
|
||||
if (act) *act = (((ParticleSettings *)id)->texact);
|
||||
break;
|
||||
default:
|
||||
*mtex_ar = NULL;
|
||||
if (act) *act = 0;
|
||||
@@ -1266,9 +1237,6 @@ void set_active_mtex(ID *id, short act)
|
||||
case ID_LS:
|
||||
((FreestyleLineStyle *)id)->texact = act;
|
||||
break;
|
||||
case ID_PA:
|
||||
((ParticleSettings *)id)->texact = act;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1378,42 +1346,6 @@ void set_current_brush_texture(Brush *br, Tex *newtex)
|
||||
}
|
||||
}
|
||||
|
||||
Tex *give_current_particle_texture(ParticleSettings *part)
|
||||
{
|
||||
MTex *mtex = NULL;
|
||||
Tex *tex = NULL;
|
||||
|
||||
if (!part) return NULL;
|
||||
|
||||
mtex = part->mtex[(int)(part->texact)];
|
||||
if (mtex) tex = mtex->tex;
|
||||
|
||||
return tex;
|
||||
}
|
||||
|
||||
void set_current_particle_texture(ParticleSettings *part, Tex *newtex)
|
||||
{
|
||||
int act = part->texact;
|
||||
|
||||
if (part->mtex[act] && part->mtex[act]->tex)
|
||||
id_us_min(&part->mtex[act]->tex->id);
|
||||
|
||||
if (newtex) {
|
||||
if (!part->mtex[act]) {
|
||||
part->mtex[act] = BKE_texture_mtex_add();
|
||||
part->mtex[act]->texco = TEXCO_ORCO;
|
||||
part->mtex[act]->blendtype = MTEX_MUL;
|
||||
}
|
||||
|
||||
part->mtex[act]->tex = newtex;
|
||||
id_us_plus(&newtex->id);
|
||||
}
|
||||
else if (part->mtex[act]) {
|
||||
MEM_freeN(part->mtex[act]);
|
||||
part->mtex[act] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
EnvMap *BKE_texture_envmap_add(void)
|
||||
|
||||
@@ -82,7 +82,6 @@
|
||||
#include "DNA_object_fluidsim.h" // NT
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_packedFile_types.h"
|
||||
#include "DNA_particle_types.h"
|
||||
#include "DNA_property_types.h"
|
||||
#include "DNA_rigidbody_types.h"
|
||||
#include "DNA_text_types.h"
|
||||
@@ -4013,101 +4012,6 @@ static void lib_link_partdeflect(FileData *fd, ID *id, PartDeflect *pd)
|
||||
pd->f_source = newlibadr(fd, id->lib, pd->f_source);
|
||||
}
|
||||
|
||||
static void lib_link_particlesettings(FileData *fd, Main *main)
|
||||
{
|
||||
ParticleSettings *part;
|
||||
ParticleDupliWeight *dw;
|
||||
MTex *mtex;
|
||||
int a;
|
||||
|
||||
for (part = main->particle.first; part; part = part->id.next) {
|
||||
if (part->id.tag & LIB_TAG_NEED_LINK) {
|
||||
lib_link_animdata(fd, &part->id, part->adt);
|
||||
part->ipo = newlibadr_us(fd, part->id.lib, part->ipo); // XXX deprecated - old animation system
|
||||
|
||||
part->dup_ob = newlibadr(fd, part->id.lib, part->dup_ob);
|
||||
part->dup_group = newlibadr(fd, part->id.lib, part->dup_group);
|
||||
part->eff_group = newlibadr(fd, part->id.lib, part->eff_group);
|
||||
part->bb_ob = newlibadr(fd, part->id.lib, part->bb_ob);
|
||||
|
||||
lib_link_partdeflect(fd, &part->id, part->pd);
|
||||
lib_link_partdeflect(fd, &part->id, part->pd2);
|
||||
|
||||
if (part->effector_weights)
|
||||
part->effector_weights->group = newlibadr(fd, part->id.lib, part->effector_weights->group);
|
||||
|
||||
if (part->dupliweights.first && part->dup_group) {
|
||||
int index_ok = 0;
|
||||
/* check for old files without indices (all indexes 0) */
|
||||
if (BLI_listbase_is_single(&part->dupliweights)) {
|
||||
/* special case for only one object in the group */
|
||||
index_ok = 1;
|
||||
}
|
||||
else {
|
||||
for (dw = part->dupliweights.first; dw; dw = dw->next) {
|
||||
if (dw->index > 0) {
|
||||
index_ok = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (index_ok) {
|
||||
/* if we have indexes, let's use them */
|
||||
for (dw = part->dupliweights.first; dw; dw = dw->next) {
|
||||
GroupObject *go = (GroupObject *)BLI_findlink(&part->dup_group->gobject, dw->index);
|
||||
dw->ob = go ? go->ob : NULL;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* otherwise try to get objects from own library (won't work on library linked groups) */
|
||||
for (dw = part->dupliweights.first; dw; dw = dw->next) {
|
||||
dw->ob = newlibadr(fd, part->id.lib, dw->ob);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
BLI_listbase_clear(&part->dupliweights);
|
||||
}
|
||||
|
||||
if (part->boids) {
|
||||
BoidState *state = part->boids->states.first;
|
||||
BoidRule *rule;
|
||||
for (; state; state=state->next) {
|
||||
rule = state->rules.first;
|
||||
for (; rule; rule=rule->next) {
|
||||
switch (rule->type) {
|
||||
case eBoidRuleType_Goal:
|
||||
case eBoidRuleType_Avoid:
|
||||
{
|
||||
BoidRuleGoalAvoid *brga = (BoidRuleGoalAvoid*)rule;
|
||||
brga->ob = newlibadr(fd, part->id.lib, brga->ob);
|
||||
break;
|
||||
}
|
||||
case eBoidRuleType_FollowLeader:
|
||||
{
|
||||
BoidRuleFollowLeader *brfl = (BoidRuleFollowLeader*)rule;
|
||||
brfl->ob = newlibadr(fd, part->id.lib, brfl->ob);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (a = 0; a < MAX_MTEX; a++) {
|
||||
mtex= part->mtex[a];
|
||||
if (mtex) {
|
||||
mtex->tex = newlibadr_us(fd, part->id.lib, mtex->tex);
|
||||
mtex->object = newlibadr(fd, part->id.lib, mtex->object);
|
||||
}
|
||||
}
|
||||
|
||||
part->id.tag &= ~LIB_TAG_NEED_LINK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void direct_link_partdeflect(PartDeflect *pd)
|
||||
{
|
||||
if (pd) pd->rng = NULL;
|
||||
@@ -8076,7 +7980,6 @@ static void lib_link_all(FileData *fd, Main *main)
|
||||
lib_link_brush(fd, main);
|
||||
lib_link_palette(fd, main);
|
||||
lib_link_paint_curve(fd, main);
|
||||
lib_link_particlesettings(fd, main);
|
||||
lib_link_movieclip(fd, main);
|
||||
lib_link_mask(fd, main);
|
||||
lib_link_linestyle(fd, main);
|
||||
@@ -8584,26 +8487,6 @@ static void expand_animdata(FileData *fd, Main *mainvar, AnimData *adt)
|
||||
expand_animdata_nlastrips(fd, mainvar, &nlt->strips);
|
||||
}
|
||||
|
||||
static void expand_particlesettings(FileData *fd, Main *mainvar, ParticleSettings *part)
|
||||
{
|
||||
int a;
|
||||
|
||||
expand_doit(fd, mainvar, part->dup_ob);
|
||||
expand_doit(fd, mainvar, part->dup_group);
|
||||
expand_doit(fd, mainvar, part->eff_group);
|
||||
expand_doit(fd, mainvar, part->bb_ob);
|
||||
|
||||
if (part->adt)
|
||||
expand_animdata(fd, mainvar, part->adt);
|
||||
|
||||
for (a = 0; a < MAX_MTEX; a++) {
|
||||
if (part->mtex[a]) {
|
||||
expand_doit(fd, mainvar, part->mtex[a]->tex);
|
||||
expand_doit(fd, mainvar, part->mtex[a]->object);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void expand_group(FileData *fd, Main *mainvar, Group *group)
|
||||
{
|
||||
GroupObject *go;
|
||||
@@ -8906,7 +8789,6 @@ static void expand_object_expandModifiers(
|
||||
|
||||
static void expand_object(FileData *fd, Main *mainvar, Object *ob)
|
||||
{
|
||||
ParticleSystem *psys;
|
||||
bSensor *sens;
|
||||
bController *cont;
|
||||
bActuator *act;
|
||||
@@ -8963,9 +8845,6 @@ static void expand_object(FileData *fd, Main *mainvar, Object *ob)
|
||||
if (ob->proxy_group)
|
||||
expand_doit(fd, mainvar, ob->proxy_group);
|
||||
|
||||
for (psys = ob->particlesystem.first; psys; psys = psys->next)
|
||||
expand_doit(fd, mainvar, psys->part);
|
||||
|
||||
for (sens = ob->sensors.first; sens; sens = sens->next) {
|
||||
if (sens->type == SENS_MESSAGE) {
|
||||
bMessageSensor *ms = sens->data;
|
||||
@@ -9325,9 +9204,6 @@ void BLO_expand_main(void *fdhandle, Main *mainvar)
|
||||
case ID_IP:
|
||||
expand_ipo(fd, mainvar, (Ipo *)id); // XXX deprecated - old animation system
|
||||
break;
|
||||
case ID_PA:
|
||||
expand_particlesettings(fd, mainvar, (ParticleSettings *)id);
|
||||
break;
|
||||
case ID_MC:
|
||||
expand_movieclip(fd, mainvar, (MovieClip *)id);
|
||||
break;
|
||||
|
||||
@@ -47,7 +47,6 @@
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_modifier_types.h"
|
||||
#include "DNA_particle_types.h"
|
||||
#include "DNA_linestyle_types.h"
|
||||
#include "DNA_actuator_types.h"
|
||||
#include "DNA_view3d_types.h"
|
||||
@@ -469,16 +468,6 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
||||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(main, 273, 3)) {
|
||||
ParticleSettings *part;
|
||||
for (part = main->particle.first; part; part = part->id.next) {
|
||||
if (part->clumpcurve)
|
||||
part->child_flag |= PART_CHILD_USE_CLUMP_CURVE;
|
||||
if (part->roughcurve)
|
||||
part->child_flag |= PART_CHILD_USE_ROUGH_CURVE;
|
||||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(main, 273, 6)) {
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "ClothSimSettings", "float", "bending_damping")) {
|
||||
Object *ob;
|
||||
@@ -493,33 +482,6 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "ParticleSettings", "float", "clump_noise_size")) {
|
||||
ParticleSettings *part;
|
||||
for (part = main->particle.first; part; part = part->id.next) {
|
||||
part->clump_noise_size = 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "ParticleSettings", "int", "kink_extra_steps")) {
|
||||
ParticleSettings *part;
|
||||
for (part = main->particle.first; part; part = part->id.next) {
|
||||
part->kink_extra_steps = 4;
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "MTex", "float", "kinkampfac")) {
|
||||
ParticleSettings *part;
|
||||
for (part = main->particle.first; part; part = part->id.next) {
|
||||
int a;
|
||||
for (a = 0; a < MAX_MTEX; a++) {
|
||||
MTex *mtex = part->mtex[a];
|
||||
if (mtex) {
|
||||
mtex->kinkampfac = 1.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "HookModifierData", "char", "flag")) {
|
||||
Object *ob;
|
||||
|
||||
@@ -602,19 +564,6 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(main, 274, 1)) {
|
||||
/* particle systems need to be forced to redistribute for jitter mode fix */
|
||||
{
|
||||
Object *ob;
|
||||
ParticleSystem *psys;
|
||||
for (ob = main->object.first; ob; ob = ob->id.next) {
|
||||
for (psys = ob->particlesystem.first; psys; psys = psys->next) {
|
||||
if ((psys->pointcache->flag & PTCACHE_BAKED) == 0) {
|
||||
psys->recalc |= PSYS_RECALC_RESET;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* hysteresis setted to 10% but not actived */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "LodLevel", "int", "obhysteresis")) {
|
||||
Object *ob;
|
||||
|
||||
@@ -118,7 +118,6 @@
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_object_force.h"
|
||||
#include "DNA_packedFile_types.h"
|
||||
#include "DNA_particle_types.h"
|
||||
#include "DNA_property_types.h"
|
||||
#include "DNA_rigidbody_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
@@ -1059,40 +1058,6 @@ static void write_userdef(WriteData *wd)
|
||||
}
|
||||
}
|
||||
|
||||
static void write_boid_state(WriteData *wd, BoidState *state)
|
||||
{
|
||||
BoidRule *rule = state->rules.first;
|
||||
//BoidCondition *cond = state->conditions.first;
|
||||
|
||||
writestruct(wd, DATA, "BoidState", 1, state);
|
||||
|
||||
for (; rule; rule=rule->next) {
|
||||
switch (rule->type) {
|
||||
case eBoidRuleType_Goal:
|
||||
case eBoidRuleType_Avoid:
|
||||
writestruct(wd, DATA, "BoidRuleGoalAvoid", 1, rule);
|
||||
break;
|
||||
case eBoidRuleType_AvoidCollision:
|
||||
writestruct(wd, DATA, "BoidRuleAvoidCollision", 1, rule);
|
||||
break;
|
||||
case eBoidRuleType_FollowLeader:
|
||||
writestruct(wd, DATA, "BoidRuleFollowLeader", 1, rule);
|
||||
break;
|
||||
case eBoidRuleType_AverageSpeed:
|
||||
writestruct(wd, DATA, "BoidRuleAverageSpeed", 1, rule);
|
||||
break;
|
||||
case eBoidRuleType_Fight:
|
||||
writestruct(wd, DATA, "BoidRuleFight", 1, rule);
|
||||
break;
|
||||
default:
|
||||
writestruct(wd, DATA, "BoidRule", 1, rule);
|
||||
break;
|
||||
}
|
||||
}
|
||||
//for (; cond; cond=cond->next)
|
||||
// writestruct(wd, DATA, "BoidCondition", 1, cond);
|
||||
}
|
||||
|
||||
/* update this also to readfile.c */
|
||||
static const char *ptcache_data_struct[] = {
|
||||
"", // BPHYS_DATA_INDEX
|
||||
@@ -1143,102 +1108,6 @@ static void write_pointcaches(WriteData *wd, ListBase *ptcaches)
|
||||
}
|
||||
}
|
||||
}
|
||||
static void write_particlesettings(WriteData *wd, ListBase *idbase)
|
||||
{
|
||||
ParticleSettings *part;
|
||||
ParticleDupliWeight *dw;
|
||||
GroupObject *go;
|
||||
int a;
|
||||
|
||||
part= idbase->first;
|
||||
while (part) {
|
||||
if (part->id.us>0 || wd->current) {
|
||||
/* write LibData */
|
||||
writestruct(wd, ID_PA, "ParticleSettings", 1, part);
|
||||
if (part->id.properties) IDP_WriteProperty(part->id.properties, wd);
|
||||
if (part->adt) write_animdata(wd, part->adt);
|
||||
writestruct(wd, DATA, "PartDeflect", 1, part->pd);
|
||||
writestruct(wd, DATA, "PartDeflect", 1, part->pd2);
|
||||
writestruct(wd, DATA, "EffectorWeights", 1, part->effector_weights);
|
||||
|
||||
if (part->clumpcurve)
|
||||
write_curvemapping(wd, part->clumpcurve);
|
||||
if (part->roughcurve)
|
||||
write_curvemapping(wd, part->roughcurve);
|
||||
|
||||
dw = part->dupliweights.first;
|
||||
for (; dw; dw=dw->next) {
|
||||
/* update indices */
|
||||
dw->index = 0;
|
||||
if (part->dup_group) { /* can be NULL if lining fails or set to None */
|
||||
go = part->dup_group->gobject.first;
|
||||
while (go && go->ob != dw->ob) {
|
||||
go=go->next;
|
||||
dw->index++;
|
||||
}
|
||||
}
|
||||
writestruct(wd, DATA, "ParticleDupliWeight", 1, dw);
|
||||
}
|
||||
|
||||
if (part->boids && part->phystype == PART_PHYS_BOIDS) {
|
||||
BoidState *state = part->boids->states.first;
|
||||
|
||||
writestruct(wd, DATA, "BoidSettings", 1, part->boids);
|
||||
|
||||
for (; state; state=state->next)
|
||||
write_boid_state(wd, state);
|
||||
}
|
||||
if (part->fluid && part->phystype == PART_PHYS_FLUID) {
|
||||
writestruct(wd, DATA, "SPHFluidSettings", 1, part->fluid);
|
||||
}
|
||||
|
||||
for (a=0; a<MAX_MTEX; a++) {
|
||||
if (part->mtex[a]) writestruct(wd, DATA, "MTex", 1, part->mtex[a]);
|
||||
}
|
||||
}
|
||||
part= part->id.next;
|
||||
}
|
||||
}
|
||||
static void write_particlesystems(WriteData *wd, ListBase *particles)
|
||||
{
|
||||
ParticleSystem *psys= particles->first;
|
||||
ParticleTarget *pt;
|
||||
int a;
|
||||
|
||||
for (; psys; psys=psys->next) {
|
||||
writestruct(wd, DATA, "ParticleSystem", 1, psys);
|
||||
|
||||
if (psys->particles) {
|
||||
writestruct(wd, DATA, "ParticleData", psys->totpart, psys->particles);
|
||||
|
||||
if (psys->particles->hair) {
|
||||
ParticleData *pa = psys->particles;
|
||||
|
||||
for (a=0; a<psys->totpart; a++, pa++)
|
||||
writestruct(wd, DATA, "HairKey", pa->totkey, pa->hair);
|
||||
}
|
||||
|
||||
if (psys->particles->boid && psys->part->phystype == PART_PHYS_BOIDS)
|
||||
writestruct(wd, DATA, "BoidParticle", psys->totpart, psys->particles->boid);
|
||||
|
||||
if (psys->part->fluid && psys->part->phystype == PART_PHYS_FLUID && (psys->part->fluid->flag & SPH_VISCOELASTIC_SPRINGS))
|
||||
writestruct(wd, DATA, "ParticleSpring", psys->tot_fluidsprings, psys->fluid_springs);
|
||||
}
|
||||
pt = psys->targets.first;
|
||||
for (; pt; pt=pt->next)
|
||||
writestruct(wd, DATA, "ParticleTarget", 1, pt);
|
||||
|
||||
if (psys->child) writestruct(wd, DATA, "ChildParticle", psys->totchild, psys->child);
|
||||
|
||||
if (psys->clmd) {
|
||||
writestruct(wd, DATA, "ClothModifierData", 1, psys->clmd);
|
||||
writestruct(wd, DATA, "ClothSimSettings", 1, psys->clmd->sim_parms);
|
||||
writestruct(wd, DATA, "ClothCollSettings", 1, psys->clmd->coll_parms);
|
||||
}
|
||||
|
||||
write_pointcaches(wd, &psys->ptcaches);
|
||||
}
|
||||
}
|
||||
|
||||
static void write_properties(WriteData *wd, ListBase *lb)
|
||||
{
|
||||
@@ -1716,7 +1585,6 @@ static void write_objects(WriteData *wd, ListBase *idbase)
|
||||
writestruct(wd, DATA, "ImageUser", 1, ob->iuser);
|
||||
}
|
||||
|
||||
write_particlesystems(wd, &ob->particlesystem);
|
||||
write_modifiers(wd, &ob->modifiers);
|
||||
|
||||
writelist(wd, DATA, "LinkData", &ob->pc_ids);
|
||||
@@ -3749,7 +3617,6 @@ static int write_file_handle(
|
||||
write_materials(wd, &mainvar->mat);
|
||||
write_textures (wd, &mainvar->tex);
|
||||
write_meshes (wd, &mainvar->mesh);
|
||||
write_particlesettings(wd, &mainvar->particle);
|
||||
write_nodetrees(wd, &mainvar->nodetree);
|
||||
write_brushes (wd, &mainvar->brush);
|
||||
write_palettes (wd, &mainvar->palettes);
|
||||
|
||||
@@ -53,7 +53,6 @@ extern "C" {
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_meta_types.h"
|
||||
#include "DNA_node_types.h"
|
||||
#include "DNA_particle_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_rigidbody_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
|
||||
@@ -56,7 +56,6 @@ extern "C" {
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_meta_types.h"
|
||||
#include "DNA_node_types.h"
|
||||
#include "DNA_particle_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_rigidbody_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
|
||||
@@ -56,7 +56,6 @@ extern "C" {
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_meta_types.h"
|
||||
#include "DNA_node_types.h"
|
||||
#include "DNA_particle_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_rigidbody_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
|
||||
@@ -38,7 +38,6 @@ extern "C" {
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_particle_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
#include "DNA_windowmanager_types.h"
|
||||
|
||||
@@ -110,7 +109,7 @@ void lib_id_recalc_tag_flag(Main *bmain, ID *id, int flag)
|
||||
|
||||
if (flag & OB_RECALC_OB)
|
||||
lib_id_recalc_tag(bmain, id);
|
||||
if (flag & (OB_RECALC_DATA | PSYS_RECALC))
|
||||
if (flag & OB_RECALC_DATA)
|
||||
lib_id_recalc_data_tag(bmain, id);
|
||||
}
|
||||
else {
|
||||
@@ -118,33 +117,6 @@ void lib_id_recalc_tag_flag(Main *bmain, ID *id, int flag)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEPSGRAPH_USE_LEGACY_TAGGING
|
||||
void depsgraph_legacy_handle_update_tag(Main *bmain, ID *id, short flag)
|
||||
{
|
||||
if (flag) {
|
||||
Object *object;
|
||||
short idtype = GS(id->name);
|
||||
if (idtype == ID_PA) {
|
||||
ParticleSystem *psys;
|
||||
for (object = (Object *)bmain->object.first;
|
||||
object != NULL;
|
||||
object = (Object *)object->id.next)
|
||||
{
|
||||
for (psys = (ParticleSystem *)object->particlesystem.first;
|
||||
psys != NULL;
|
||||
psys = (ParticleSystem *)psys->next)
|
||||
{
|
||||
if (&psys->part->id == id) {
|
||||
DEG_id_tag_update_ex(bmain, &object->id, flag & OB_RECALC_ALL);
|
||||
psys->recalc |= (flag & PSYS_RECALC);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
} /* namespace */
|
||||
|
||||
/* Tag all nodes in ID-block for update.
|
||||
@@ -228,14 +200,6 @@ void DEG_id_tag_update_ex(Main *bmain, ID *id, short flag)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEPSGRAPH_USE_LEGACY_TAGGING
|
||||
/* Special handling from the legacy depsgraph.
|
||||
* TODO(sergey): Need to get rid of those once all the areas
|
||||
* are re-formulated in terms of franular nodes.
|
||||
*/
|
||||
depsgraph_legacy_handle_update_tag(bmain, id, flag);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Tag given ID type for update. */
|
||||
|
||||
@@ -62,7 +62,6 @@ typedef struct GPUNode GPUNode;
|
||||
typedef struct GPUNodeLink GPUNodeLink;
|
||||
typedef struct GPUMaterial GPUMaterial;
|
||||
typedef struct GPULamp GPULamp;
|
||||
typedef struct GPUParticleInfo GPUParticleInfo;
|
||||
|
||||
/* Functions to create GPU Materials nodes */
|
||||
|
||||
@@ -92,11 +91,7 @@ typedef enum GPUBuiltin {
|
||||
GPU_OBCOLOR = (1 << 6),
|
||||
GPU_AUTO_BUMPSCALE = (1 << 7),
|
||||
GPU_CAMERA_TEXCO_FACTORS = (1 << 8),
|
||||
GPU_PARTICLE_SCALAR_PROPS = (1 << 9),
|
||||
GPU_PARTICLE_LOCATION = (1 << 10),
|
||||
GPU_PARTICLE_VELOCITY = (1 << 11),
|
||||
GPU_PARTICLE_ANG_VELOCITY = (1 << 12),
|
||||
GPU_LOC_TO_VIEW_MATRIX = (1 << 13),
|
||||
GPU_LOC_TO_VIEW_MATRIX = (1 << 9),
|
||||
GPU_INVERSE_LOC_TO_VIEW_MATRIX = (1 << 14),
|
||||
} GPUBuiltin;
|
||||
|
||||
@@ -230,7 +225,7 @@ void GPU_material_bind(
|
||||
float viewmat[4][4], float viewinv[4][4], float cameraborder[4], bool scenelock);
|
||||
void GPU_material_bind_uniforms(
|
||||
GPUMaterial *material, float obmat[4][4], float viewmat[4][4], float obcol[4],
|
||||
float autobumpscale, GPUParticleInfo *pi);
|
||||
float autobumpscale);
|
||||
void GPU_material_unbind(GPUMaterial *material);
|
||||
bool GPU_material_bound(GPUMaterial *material);
|
||||
struct Scene *GPU_material_scene(GPUMaterial *material);
|
||||
@@ -336,14 +331,6 @@ void GPU_mist_update_values(int type, float start, float dist, float inten, floa
|
||||
void GPU_horizon_update_color(float color[3]);
|
||||
void GPU_ambient_update_color(float color[3]);
|
||||
|
||||
struct GPUParticleInfo
|
||||
{
|
||||
float scalprops[4];
|
||||
float location[3];
|
||||
float velocity[3];
|
||||
float angular_velocity[3];
|
||||
};
|
||||
|
||||
#ifdef WITH_OPENSUBDIV
|
||||
struct DerivedMesh;
|
||||
void GPU_material_update_fvar_offset(GPUMaterial *gpu_material,
|
||||
|
||||
@@ -400,14 +400,6 @@ const char *GPU_builtin_name(GPUBuiltin builtin)
|
||||
return "unfobautobumpscale";
|
||||
else if (builtin == GPU_CAMERA_TEXCO_FACTORS)
|
||||
return "unfcameratexfactors";
|
||||
else if (builtin == GPU_PARTICLE_SCALAR_PROPS)
|
||||
return "unfparticlescalarprops";
|
||||
else if (builtin == GPU_PARTICLE_LOCATION)
|
||||
return "unfparticleco";
|
||||
else if (builtin == GPU_PARTICLE_VELOCITY)
|
||||
return "unfparticlevel";
|
||||
else if (builtin == GPU_PARTICLE_ANG_VELOCITY)
|
||||
return "unfparticleangvel";
|
||||
else
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -57,7 +57,6 @@
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_smoke_types.h"
|
||||
#include "DNA_view3d_types.h"
|
||||
#include "DNA_particle_types.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
@@ -1822,35 +1821,6 @@ void GPU_begin_object_materials(
|
||||
GPU_object_material_unbind();
|
||||
}
|
||||
|
||||
static int GPU_get_particle_info(GPUParticleInfo *pi)
|
||||
{
|
||||
DupliObject *dob = GMS.dob;
|
||||
if (dob->particle_system) {
|
||||
int ind;
|
||||
if (dob->persistent_id[0] < dob->particle_system->totpart)
|
||||
ind = dob->persistent_id[0];
|
||||
else {
|
||||
ind = dob->particle_system->child[dob->persistent_id[0] - dob->particle_system->totpart].parent;
|
||||
}
|
||||
if (ind >= 0) {
|
||||
ParticleData *p = &dob->particle_system->particles[ind];
|
||||
|
||||
pi->scalprops[0] = ind;
|
||||
pi->scalprops[1] = GMS.gscene->r.cfra - p->time;
|
||||
pi->scalprops[2] = p->lifetime;
|
||||
pi->scalprops[3] = p->size;
|
||||
|
||||
copy_v3_v3(pi->location, p->state.co);
|
||||
copy_v3_v3(pi->velocity, p->state.vel);
|
||||
copy_v3_v3(pi->angular_velocity, p->state.ave);
|
||||
return 1;
|
||||
}
|
||||
else return 0;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
int GPU_object_material_bind(int nr, void *attribs)
|
||||
{
|
||||
GPUVertexAttribs *gattribs = attribs;
|
||||
@@ -1909,22 +1879,18 @@ int GPU_object_material_bind(int nr, void *attribs)
|
||||
if (gattribs && GMS.gmatbuf[nr]) {
|
||||
/* bind glsl material and get attributes */
|
||||
Material *mat = GMS.gmatbuf[nr];
|
||||
GPUParticleInfo partile_info;
|
||||
|
||||
float auto_bump_scale;
|
||||
|
||||
GPUMaterial *gpumat = GPU_material_from_blender(GMS.gscene, mat, GMS.is_opensubdiv);
|
||||
GPU_material_vertex_attributes(gpumat, gattribs);
|
||||
|
||||
if (GMS.dob)
|
||||
GPU_get_particle_info(&partile_info);
|
||||
|
||||
GPU_material_bind(
|
||||
gpumat, GMS.gob->lay, GMS.glay, 1.0, !(GMS.gob->mode & OB_MODE_TEXTURE_PAINT),
|
||||
GMS.gviewmat, GMS.gviewinv, GMS.gviewcamtexcofac, GMS.gscenelock);
|
||||
|
||||
auto_bump_scale = GMS.gob->derivedFinal != NULL ? GMS.gob->derivedFinal->auto_bump_scale : 1.0f;
|
||||
GPU_material_bind_uniforms(gpumat, GMS.gob->obmat, GMS.gviewmat, GMS.gob->col, auto_bump_scale, &partile_info);
|
||||
GPU_material_bind_uniforms(gpumat, GMS.gob->obmat, GMS.gviewmat, GMS.gob->col, auto_bump_scale);
|
||||
GMS.gboundmat = mat;
|
||||
|
||||
/* for glsl use alpha blend mode, unless it's set to solid and
|
||||
|
||||
@@ -116,11 +116,6 @@ struct GPUMaterial {
|
||||
int obcolloc, obautobumpscaleloc;
|
||||
int cameratexcofacloc;
|
||||
|
||||
int partscalarpropsloc;
|
||||
int partcoloc;
|
||||
int partvel;
|
||||
int partangvel;
|
||||
|
||||
ListBase lamps;
|
||||
bool bound;
|
||||
|
||||
@@ -256,14 +251,6 @@ static int GPU_material_construct_end(GPUMaterial *material, const char *passnam
|
||||
material->obautobumpscaleloc = GPU_shader_get_uniform(shader, GPU_builtin_name(GPU_AUTO_BUMPSCALE));
|
||||
if (material->builtins & GPU_CAMERA_TEXCO_FACTORS)
|
||||
material->cameratexcofacloc = GPU_shader_get_uniform(shader, GPU_builtin_name(GPU_CAMERA_TEXCO_FACTORS));
|
||||
if (material->builtins & GPU_PARTICLE_SCALAR_PROPS)
|
||||
material->partscalarpropsloc = GPU_shader_get_uniform(shader, GPU_builtin_name(GPU_PARTICLE_SCALAR_PROPS));
|
||||
if (material->builtins & GPU_PARTICLE_LOCATION)
|
||||
material->partcoloc = GPU_shader_get_uniform(shader, GPU_builtin_name(GPU_PARTICLE_LOCATION));
|
||||
if (material->builtins & GPU_PARTICLE_VELOCITY)
|
||||
material->partvel = GPU_shader_get_uniform(shader, GPU_builtin_name(GPU_PARTICLE_VELOCITY));
|
||||
if (material->builtins & GPU_PARTICLE_ANG_VELOCITY)
|
||||
material->partangvel = GPU_shader_get_uniform(shader, GPU_builtin_name(GPU_PARTICLE_ANG_VELOCITY));
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -393,7 +380,7 @@ void GPU_material_bind(
|
||||
|
||||
void GPU_material_bind_uniforms(
|
||||
GPUMaterial *material, float obmat[4][4], float viewmat[4][4], float obcol[4],
|
||||
float autobumpscale, GPUParticleInfo *pi)
|
||||
float autobumpscale)
|
||||
{
|
||||
if (material->pass) {
|
||||
GPUShader *shader = GPU_pass_shader(material->pass);
|
||||
@@ -430,18 +417,6 @@ void GPU_material_bind_uniforms(
|
||||
if (material->builtins & GPU_AUTO_BUMPSCALE) {
|
||||
GPU_shader_uniform_vector(shader, material->obautobumpscaleloc, 1, 1, &autobumpscale);
|
||||
}
|
||||
if (material->builtins & GPU_PARTICLE_SCALAR_PROPS) {
|
||||
GPU_shader_uniform_vector(shader, material->partscalarpropsloc, 4, 1, pi->scalprops);
|
||||
}
|
||||
if (material->builtins & GPU_PARTICLE_LOCATION) {
|
||||
GPU_shader_uniform_vector(shader, material->partcoloc, 3, 1, pi->location);
|
||||
}
|
||||
if (material->builtins & GPU_PARTICLE_VELOCITY) {
|
||||
GPU_shader_uniform_vector(shader, material->partvel, 3, 1, pi->velocity);
|
||||
}
|
||||
if (material->builtins & GPU_PARTICLE_ANG_VELOCITY) {
|
||||
GPU_shader_uniform_vector(shader, material->partangvel, 3, 1, pi->angular_velocity);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,612 +0,0 @@
|
||||
/*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2007 by Janne Karhu.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
/** \file DNA_particle_types.h
|
||||
* \ingroup DNA
|
||||
*/
|
||||
|
||||
#ifndef __DNA_PARTICLE_TYPES_H__
|
||||
#define __DNA_PARTICLE_TYPES_H__
|
||||
|
||||
#include "DNA_defs.h"
|
||||
#include "DNA_ID.h"
|
||||
#include "DNA_boid_types.h"
|
||||
|
||||
struct AnimData;
|
||||
|
||||
typedef struct HairKey {
|
||||
float co[3]; /* location of hair vertex */
|
||||
float time; /* time along hair, default 0-100 */
|
||||
float weight; /* softbody weight */
|
||||
short editflag; /* saved particled edit mode flags */
|
||||
short pad;
|
||||
float world_co[3];
|
||||
} HairKey;
|
||||
|
||||
typedef struct ParticleKey { /* when changed update size of struct to copy_particleKey()!! */
|
||||
float co[3]; /* location */
|
||||
float vel[3]; /* velocity */
|
||||
float rot[4]; /* rotation quaternion */
|
||||
float ave[3]; /* angular velocity */
|
||||
float time; /* when this key happens */
|
||||
} ParticleKey;
|
||||
|
||||
typedef struct BoidParticle {
|
||||
struct Object *ground;
|
||||
struct BoidData data;
|
||||
float gravity[3];
|
||||
float wander[3];
|
||||
float rt;
|
||||
} BoidParticle;
|
||||
|
||||
typedef struct ParticleSpring {
|
||||
float rest_length;
|
||||
unsigned int particle_index[2], delete_flag;
|
||||
} ParticleSpring;
|
||||
|
||||
/* Child particles are created around or between parent particles */
|
||||
typedef struct ChildParticle {
|
||||
int num, parent; /* num is face index on the final derived mesh */
|
||||
int pa[4]; /* nearest particles to the child, used for the interpolation */
|
||||
float w[4]; /* interpolation weights for the above particles */
|
||||
float fuv[4], foffset; /* face vertex weights and offset */
|
||||
float rt;
|
||||
} ChildParticle;
|
||||
|
||||
typedef struct ParticleTarget {
|
||||
struct ParticleTarget *next, *prev;
|
||||
struct Object *ob;
|
||||
int psys;
|
||||
short flag, mode;
|
||||
float time, duration;
|
||||
} ParticleTarget;
|
||||
|
||||
typedef struct ParticleDupliWeight {
|
||||
struct ParticleDupliWeight *next, *prev;
|
||||
struct Object *ob;
|
||||
short count;
|
||||
short flag;
|
||||
short index, rt; /* only updated on file save and used on file load */
|
||||
} ParticleDupliWeight;
|
||||
|
||||
typedef struct ParticleData {
|
||||
ParticleKey state; /* current global coordinates */
|
||||
|
||||
ParticleKey prev_state; /* previous state */
|
||||
|
||||
HairKey *hair; /* hair vertices */
|
||||
|
||||
ParticleKey *keys; /* keyed keys */
|
||||
|
||||
BoidParticle *boid; /* boids data */
|
||||
|
||||
int totkey; /* amount of hair or keyed keys*/
|
||||
|
||||
float time, lifetime; /* dietime is not nescessarily time+lifetime as */
|
||||
float dietime; /* particles can die unnaturally (collision) */
|
||||
|
||||
/* WARNING! Those two indices, when not affected to vertices, are for !!! TESSELLATED FACES !!!, not POLYGONS! */
|
||||
int num; /* index to vert/edge/face */
|
||||
int num_dmcache; /* index to derived mesh data (face) to avoid slow lookups */
|
||||
|
||||
float fuv[4], foffset; /* coordinates on face/edge number "num" and depth along*/
|
||||
/* face normal for volume emission */
|
||||
|
||||
float size; /* size and multiplier so that we can update size when ever */
|
||||
|
||||
float sphdensity; /* density of sph particle */
|
||||
int pad;
|
||||
|
||||
int hair_index;
|
||||
short flag;
|
||||
short alive; /* the life state of a particle */
|
||||
} ParticleData;
|
||||
|
||||
typedef struct SPHFluidSettings {
|
||||
/*Particle Fluid*/
|
||||
float radius, spring_k, rest_length;
|
||||
float plasticity_constant, yield_ratio;
|
||||
float plasticity_balance, yield_balance;
|
||||
float viscosity_omega, viscosity_beta;
|
||||
float stiffness_k, stiffness_knear, rest_density;
|
||||
float buoyancy;
|
||||
int flag, spring_frames;
|
||||
short solver;
|
||||
short pad[3];
|
||||
} SPHFluidSettings;
|
||||
|
||||
/* fluid->flag */
|
||||
#define SPH_VISCOELASTIC_SPRINGS 1
|
||||
#define SPH_CURRENT_REST_LENGTH 2
|
||||
#define SPH_FAC_REPULSION 4
|
||||
#define SPH_FAC_DENSITY 8
|
||||
#define SPH_FAC_RADIUS 16
|
||||
#define SPH_FAC_VISCOSITY 32
|
||||
#define SPH_FAC_REST_LENGTH 64
|
||||
|
||||
/* fluid->solver (numerical ID field, not bitfield) */
|
||||
#define SPH_SOLVER_DDR 0
|
||||
#define SPH_SOLVER_CLASSICAL 1
|
||||
|
||||
typedef struct ParticleSettings {
|
||||
ID id;
|
||||
struct AnimData *adt;
|
||||
|
||||
struct BoidSettings *boids;
|
||||
struct SPHFluidSettings *fluid;
|
||||
|
||||
struct EffectorWeights *effector_weights;
|
||||
|
||||
int flag, rt;
|
||||
short type, from, distr, texact;
|
||||
/* physics modes */
|
||||
short phystype, rotmode, avemode, reactevent;
|
||||
int draw, pad1;
|
||||
short draw_as, draw_size, childtype, pad2;
|
||||
short ren_as, subframes, draw_col;
|
||||
/* number of path segments, power of 2 except */
|
||||
short draw_step, ren_step;
|
||||
short hair_step, keys_step;
|
||||
|
||||
/* adaptive path rendering */
|
||||
short adapt_angle, adapt_pix;
|
||||
|
||||
short disp, omat, interpolation, integrator;
|
||||
short rotfrom DNA_DEPRECATED;
|
||||
short kink, kink_axis;
|
||||
|
||||
/* billboards */
|
||||
short bb_align, bb_uv_split, bb_anim, bb_split_offset;
|
||||
float bb_tilt, bb_rand_tilt, bb_offset[2], bb_size[2], bb_vel_head, bb_vel_tail;
|
||||
|
||||
/* draw color */
|
||||
float color_vec_max;
|
||||
|
||||
/* simplification */
|
||||
short simplify_flag, simplify_refsize;
|
||||
float simplify_rate, simplify_transition;
|
||||
float simplify_viewport;
|
||||
|
||||
/* time and emission */
|
||||
float sta, end, lifetime, randlife;
|
||||
float timetweak, courant_target;
|
||||
float jitfac, eff_hair, grid_rand, ps_offset[1];
|
||||
int totpart, userjit, grid_res, effector_amount;
|
||||
short time_flag, time_pad[3];
|
||||
|
||||
/* initial velocity factors */
|
||||
float normfac, obfac, randfac, partfac, tanfac, tanphase, reactfac;
|
||||
float ob_vel[3];
|
||||
float avefac, phasefac, randrotfac, randphasefac;
|
||||
/* physical properties */
|
||||
float mass, size, randsize;
|
||||
/* global physical properties */
|
||||
float acc[3], dragfac, brownfac, dampfac;
|
||||
/* length */
|
||||
float randlength;
|
||||
/* children */
|
||||
int child_flag;
|
||||
int pad3;
|
||||
int child_nbr, ren_child_nbr;
|
||||
float parents, childsize, childrandsize;
|
||||
float childrad, childflat;
|
||||
/* clumping */
|
||||
float clumpfac, clumppow;
|
||||
/* kink */
|
||||
float kink_amp, kink_freq, kink_shape, kink_flat;
|
||||
float kink_amp_clump;
|
||||
int kink_extra_steps, pad4;
|
||||
float kink_axis_random, kink_amp_random;
|
||||
/* rough */
|
||||
float rough1, rough1_size;
|
||||
float rough2, rough2_size, rough2_thres;
|
||||
float rough_end, rough_end_shape;
|
||||
/* length */
|
||||
float clength, clength_thres;
|
||||
/* parting */
|
||||
float parting_fac;
|
||||
float parting_min, parting_max;
|
||||
/* branching */
|
||||
float branch_thres;
|
||||
/* drawing stuff */
|
||||
float draw_line[2];
|
||||
float path_start, path_end;
|
||||
int trail_count;
|
||||
/* keyed particles */
|
||||
int keyed_loops;
|
||||
struct CurveMapping *clumpcurve;
|
||||
struct CurveMapping *roughcurve;
|
||||
float clump_noise_size;
|
||||
|
||||
/* hair dynamics */
|
||||
float bending_random;
|
||||
|
||||
struct MTex *mtex[18]; /* MAX_MTEX */
|
||||
|
||||
struct Group *dup_group;
|
||||
struct ListBase dupliweights;
|
||||
struct Group *eff_group DNA_DEPRECATED; // deprecated
|
||||
struct Object *dup_ob;
|
||||
struct Object *bb_ob;
|
||||
struct Ipo *ipo DNA_DEPRECATED; /* old animation system, deprecated for 2.5 */
|
||||
struct PartDeflect *pd;
|
||||
struct PartDeflect *pd2;
|
||||
|
||||
/* modified dm support */
|
||||
short use_modifier_stack;
|
||||
short pad5[3];
|
||||
|
||||
} ParticleSettings;
|
||||
|
||||
typedef struct ParticleSystem {
|
||||
/* note1: make sure all (runtime) are NULL's in 'copy_particlesystem' XXX, this function is no more! - need to invstigate */
|
||||
/* note2: make sure any uses of this struct in DNA are accounted for in 'BKE_object_copy_particlesystems' */
|
||||
|
||||
struct ParticleSystem *next, *prev;
|
||||
|
||||
ParticleSettings *part; /* particle settings */
|
||||
|
||||
ParticleData *particles; /* (parent) particles */
|
||||
ChildParticle *child; /* child particles */
|
||||
|
||||
struct PTCacheEdit *edit; /* particle editmode (runtime) */
|
||||
void (*free_edit)(struct PTCacheEdit *edit); /* free callback */
|
||||
|
||||
struct ParticleCacheKey **pathcache; /* path cache (runtime) */
|
||||
struct ParticleCacheKey **childcache; /* child cache (runtime) */
|
||||
ListBase pathcachebufs, childcachebufs; /* buffers for the above */
|
||||
|
||||
struct ClothModifierData *clmd; /* cloth simulation for hair */
|
||||
struct DerivedMesh *hair_in_dm, *hair_out_dm; /* input/output for cloth simulation */
|
||||
|
||||
struct Object *target_ob;
|
||||
|
||||
struct LatticeDeformData *lattice_deform_data; /* run-time only lattice deformation data */
|
||||
|
||||
struct Object *parent; /* particles from global space -> parent space */
|
||||
|
||||
struct ListBase targets; /* used for keyed and boid physics */
|
||||
|
||||
char name[64]; /* particle system name, MAX_NAME */
|
||||
|
||||
float imat[4][4]; /* used for duplicators */
|
||||
float cfra, tree_frame, bvhtree_frame;
|
||||
int seed, child_seed;
|
||||
int flag, totpart, totunexist, totchild, totcached, totchildcache;
|
||||
short recalc, target_psys, totkeyed, bakespace;
|
||||
|
||||
char bb_uvname[3][64]; /* billboard uv name, MAX_CUSTOMDATA_LAYER_NAME */
|
||||
|
||||
/* if you change these remember to update array lengths to PSYS_TOT_VG! */
|
||||
short vgroup[12], vg_neg, rt3; /* vertex groups, 0==disable, 1==starting index */
|
||||
|
||||
/* temporary storage during render */
|
||||
struct ParticleRenderData *renderdata;
|
||||
|
||||
/* point cache */
|
||||
struct PointCache *pointcache;
|
||||
struct ListBase ptcaches;
|
||||
|
||||
struct ListBase *effectors;
|
||||
|
||||
ParticleSpring *fluid_springs;
|
||||
int tot_fluidsprings, alloc_fluidsprings;
|
||||
|
||||
struct KDTree *tree; /* used for interactions with self and other systems */
|
||||
struct BVHTree *bvhtree; /* used for interactions with self and other systems */
|
||||
|
||||
struct ParticleDrawData *pdd;
|
||||
|
||||
float dt_frac; /* current time step, as a fraction of a frame */
|
||||
float _pad; /* spare capacity */
|
||||
} ParticleSystem;
|
||||
|
||||
typedef enum eParticleDrawFlag {
|
||||
PART_DRAW_VEL = (1 << 0),
|
||||
PART_DRAW_GLOBAL_OB = (1 << 1),
|
||||
PART_DRAW_SIZE = (1 << 2),
|
||||
PART_DRAW_EMITTER = (1 << 3), /* render emitter also */
|
||||
PART_DRAW_HEALTH = (1 << 4),
|
||||
PART_ABS_PATH_TIME = (1 << 5),
|
||||
PART_DRAW_COUNT_GR = (1 << 6),
|
||||
PART_DRAW_BB_LOCK = (1 << 7), /* used with billboards */
|
||||
PART_DRAW_ROTATE_OB = (1 << 7), /* used with dupliobjects/groups */
|
||||
PART_DRAW_PARENT = (1 << 8),
|
||||
PART_DRAW_NUM = (1 << 9),
|
||||
PART_DRAW_RAND_GR = (1 << 10),
|
||||
PART_DRAW_REN_ADAPT = (1 << 11),
|
||||
PART_DRAW_VEL_LENGTH = (1 << 12),
|
||||
PART_DRAW_MAT_COL = (1 << 13), /* deprecated, but used in do_versions */
|
||||
PART_DRAW_WHOLE_GR = (1 << 14),
|
||||
PART_DRAW_REN_STRAND = (1 << 15),
|
||||
PART_DRAW_NO_SCALE_OB = (1 << 16), /* used with dupliobjects/groups */
|
||||
PART_DRAW_GUIDE_HAIRS = (1 << 17),
|
||||
PART_DRAW_HAIR_GRID = (1 << 18),
|
||||
} eParticleDrawFlag;
|
||||
|
||||
/* part->type */
|
||||
/* hair is allways baked static in object/geometry space */
|
||||
/* other types (normal particles) are in global space and not static baked */
|
||||
#define PART_EMITTER 0
|
||||
//#define PART_REACTOR 1
|
||||
#define PART_HAIR 2
|
||||
#define PART_FLUID 3
|
||||
|
||||
/* part->flag */
|
||||
#define PART_REACT_STA_END 1
|
||||
#define PART_REACT_MULTIPLE 2
|
||||
|
||||
//#define PART_LOOP 4 /* not used anymore */
|
||||
/* for dopesheet */
|
||||
#define PART_DS_EXPAND 8
|
||||
|
||||
#define PART_HAIR_REGROW 16 /* regrow hair for each frame */
|
||||
|
||||
#define PART_UNBORN 32 /*show unborn particles*/
|
||||
#define PART_DIED 64 /*show died particles*/
|
||||
|
||||
#define PART_TRAND 128
|
||||
#define PART_EDISTR 256 /* particle/face from face areas */
|
||||
|
||||
#define PART_ROTATIONS 512 /* calculate particle rotations (and store them in pointcache) */
|
||||
#define PART_DIE_ON_COL (1<<12)
|
||||
#define PART_SIZE_DEFL (1<<13) /* swept sphere deflections */
|
||||
#define PART_ROT_DYN (1<<14) /* dynamic rotation */
|
||||
#define PART_SIZEMASS (1<<16)
|
||||
|
||||
#define PART_HIDE_ADVANCED_HAIR (1<<15)
|
||||
|
||||
//#define PART_ABS_TIME (1<<17)
|
||||
//#define PART_GLOB_TIME (1<<18)
|
||||
|
||||
#define PART_BOIDS_2D (1<<19)
|
||||
|
||||
//#define PART_BRANCHING (1<<20)
|
||||
//#define PART_ANIM_BRANCHING (1<<21)
|
||||
|
||||
#define PART_HAIR_BSPLINE 1024
|
||||
|
||||
#define PART_GRID_HEXAGONAL (1<<24)
|
||||
#define PART_GRID_INVERT (1<<26)
|
||||
|
||||
#define PART_CHILD_EFFECT (1<<27)
|
||||
#define PART_CHILD_LONG_HAIR (1<<28)
|
||||
/* #define PART_CHILD_RENDER (1<<29) */ /*UNUSED*/
|
||||
#define PART_CHILD_GUIDE (1<<30)
|
||||
|
||||
#define PART_SELF_EFFECT (1<<22)
|
||||
|
||||
/* part->from */
|
||||
#define PART_FROM_VERT 0
|
||||
#define PART_FROM_FACE 1
|
||||
#define PART_FROM_VOLUME 2
|
||||
/* #define PART_FROM_PARTICLE 3 deprecated! */
|
||||
#define PART_FROM_CHILD 4
|
||||
|
||||
/* part->distr */
|
||||
#define PART_DISTR_JIT 0
|
||||
#define PART_DISTR_RAND 1
|
||||
#define PART_DISTR_GRID 2
|
||||
|
||||
/* part->phystype */
|
||||
#define PART_PHYS_NO 0
|
||||
#define PART_PHYS_NEWTON 1
|
||||
#define PART_PHYS_KEYED 2
|
||||
#define PART_PHYS_BOIDS 3
|
||||
#define PART_PHYS_FLUID 4
|
||||
|
||||
/* part->kink */
|
||||
typedef enum eParticleKink {
|
||||
PART_KINK_NO = 0,
|
||||
PART_KINK_CURL = 1,
|
||||
PART_KINK_RADIAL = 2,
|
||||
PART_KINK_WAVE = 3,
|
||||
PART_KINK_BRAID = 4,
|
||||
PART_KINK_SPIRAL = 5,
|
||||
} eParticleKink;
|
||||
|
||||
/* part->child_flag */
|
||||
typedef enum eParticleChildFlag {
|
||||
PART_CHILD_USE_CLUMP_NOISE = (1<<0),
|
||||
PART_CHILD_USE_CLUMP_CURVE = (1<<1),
|
||||
PART_CHILD_USE_ROUGH_CURVE = (1<<2),
|
||||
} eParticleChildFlag;
|
||||
|
||||
/* part->draw_col */
|
||||
#define PART_DRAW_COL_NONE 0
|
||||
#define PART_DRAW_COL_MAT 1
|
||||
#define PART_DRAW_COL_VEL 2
|
||||
#define PART_DRAW_COL_ACC 3
|
||||
|
||||
|
||||
/* part->simplify_flag */
|
||||
#define PART_SIMPLIFY_ENABLE 1
|
||||
#define PART_SIMPLIFY_VIEWPORT 2
|
||||
|
||||
/* part->time_flag */
|
||||
#define PART_TIME_AUTOSF 1 /* Automatic subframes */
|
||||
|
||||
/* part->bb_align */
|
||||
#define PART_BB_X 0
|
||||
#define PART_BB_Y 1
|
||||
#define PART_BB_Z 2
|
||||
#define PART_BB_VIEW 3
|
||||
#define PART_BB_VEL 4
|
||||
|
||||
/* part->bb_anim */
|
||||
#define PART_BB_ANIM_NONE 0
|
||||
#define PART_BB_ANIM_AGE 1
|
||||
#define PART_BB_ANIM_ANGLE 2
|
||||
#define PART_BB_ANIM_FRAME 3
|
||||
|
||||
/* part->bb_split_offset */
|
||||
#define PART_BB_OFF_NONE 0
|
||||
#define PART_BB_OFF_LINEAR 1
|
||||
#define PART_BB_OFF_RANDOM 2
|
||||
|
||||
/* part->draw_as */
|
||||
/* part->ren_as*/
|
||||
#define PART_DRAW_NOT 0
|
||||
#define PART_DRAW_DOT 1
|
||||
#define PART_DRAW_HALO 1
|
||||
#define PART_DRAW_CIRC 2
|
||||
#define PART_DRAW_CROSS 3
|
||||
#define PART_DRAW_AXIS 4
|
||||
#define PART_DRAW_LINE 5
|
||||
#define PART_DRAW_PATH 6
|
||||
#define PART_DRAW_OB 7
|
||||
#define PART_DRAW_GR 8
|
||||
#define PART_DRAW_BB 9
|
||||
#define PART_DRAW_REND 10
|
||||
|
||||
/* part->integrator */
|
||||
#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
|
||||
#define PART_ROT_VEL 2
|
||||
#define PART_ROT_GLOB_X 3
|
||||
#define PART_ROT_GLOB_Y 4
|
||||
#define PART_ROT_GLOB_Z 5
|
||||
#define PART_ROT_OB_X 6
|
||||
#define PART_ROT_OB_Y 7
|
||||
#define PART_ROT_OB_Z 8
|
||||
#define PART_ROT_NOR_TAN 9
|
||||
|
||||
/* part->avemode */
|
||||
#define PART_AVE_VELOCITY 1
|
||||
#define PART_AVE_RAND 2
|
||||
#define PART_AVE_HORIZONTAL 3
|
||||
#define PART_AVE_VERTICAL 4
|
||||
#define PART_AVE_GLOBAL_X 5
|
||||
#define PART_AVE_GLOBAL_Y 6
|
||||
#define PART_AVE_GLOBAL_Z 7
|
||||
|
||||
/* part->reactevent */
|
||||
#define PART_EVENT_DEATH 0
|
||||
#define PART_EVENT_COLLIDE 1
|
||||
#define PART_EVENT_NEAR 2
|
||||
|
||||
/* part->childtype */
|
||||
#define PART_CHILD_PARTICLES 1
|
||||
#define PART_CHILD_FACES 2
|
||||
|
||||
/* psys->recalc */
|
||||
/* starts from (1 << 3) so that the first bits can be ob->recalc */
|
||||
#define PSYS_RECALC_REDO (1 << 3) /* only do pathcache etc */
|
||||
#define PSYS_RECALC_RESET (1 << 4) /* reset everything including pointcache */
|
||||
#define PSYS_RECALC_TYPE (1 << 5) /* handle system type change */
|
||||
#define PSYS_RECALC_CHILD (1 << 6) /* only child settings changed */
|
||||
#define PSYS_RECALC_PHYS (1 << 7) /* physics type changed */
|
||||
#define PSYS_RECALC (PSYS_RECALC_REDO | PSYS_RECALC_RESET | PSYS_RECALC_TYPE | PSYS_RECALC_CHILD | PSYS_RECALC_PHYS)
|
||||
|
||||
/* psys->flag */
|
||||
#define PSYS_CURRENT 1
|
||||
#define PSYS_GLOBAL_HAIR 2
|
||||
#define PSYS_HAIR_DYNAMICS 4
|
||||
#define PSYS_KEYED_TIMING 8
|
||||
//#define PSYS_ENABLED 16 /* deprecated */
|
||||
#define PSYS_HAIR_UPDATED 32 /* signal for updating hair particle mode */
|
||||
#define PSYS_DRAWING 64
|
||||
#define PSYS_USE_IMAT 128
|
||||
#define PSYS_DELETE 256 /* remove particlesystem as soon as possible */
|
||||
#define PSYS_HAIR_DONE 512
|
||||
#define PSYS_KEYED 1024
|
||||
#define PSYS_EDITED 2048
|
||||
//#define PSYS_PROTECT_CACHE 4096 /* deprecated */
|
||||
#define PSYS_DISABLED 8192
|
||||
#define PSYS_OB_ANIM_RESTORE 16384 /* runtime flag */
|
||||
|
||||
/* pars->flag */
|
||||
#define PARS_UNEXIST 1
|
||||
#define PARS_NO_DISP 2
|
||||
//#define PARS_STICKY 4 /* deprecated */
|
||||
#define PARS_REKEY 8
|
||||
|
||||
/* pars->alive */
|
||||
//#define PARS_KILLED 0 /* deprecated */
|
||||
#define PARS_DEAD 1
|
||||
#define PARS_UNBORN 2
|
||||
#define PARS_ALIVE 3
|
||||
#define PARS_DYING 4
|
||||
|
||||
/* ParticleDupliWeight->flag */
|
||||
#define PART_DUPLIW_CURRENT 1
|
||||
|
||||
/* psys->vg */
|
||||
#define PSYS_TOT_VG 12
|
||||
|
||||
#define PSYS_VG_DENSITY 0
|
||||
#define PSYS_VG_VEL 1
|
||||
#define PSYS_VG_LENGTH 2
|
||||
#define PSYS_VG_CLUMP 3
|
||||
#define PSYS_VG_KINK 4
|
||||
#define PSYS_VG_ROUGH1 5
|
||||
#define PSYS_VG_ROUGH2 6
|
||||
#define PSYS_VG_ROUGHE 7
|
||||
#define PSYS_VG_SIZE 8
|
||||
#define PSYS_VG_TAN 9
|
||||
#define PSYS_VG_ROT 10
|
||||
#define PSYS_VG_EFFECTOR 11
|
||||
|
||||
/* ParticleTarget->flag */
|
||||
#define PTARGET_CURRENT 1
|
||||
#define PTARGET_VALID 2
|
||||
|
||||
/* ParticleTarget->mode */
|
||||
#define PTARGET_MODE_NEUTRAL 0
|
||||
#define PTARGET_MODE_FRIEND 1
|
||||
#define PTARGET_MODE_ENEMY 2
|
||||
|
||||
/* mapto */
|
||||
typedef enum eParticleTextureInfluence {
|
||||
/* init */
|
||||
PAMAP_TIME = (1<<0), /* emission time */
|
||||
PAMAP_LIFE = (1<<1), /* life time */
|
||||
PAMAP_DENS = (1<<2), /* density */
|
||||
PAMAP_SIZE = (1<<3), /* physical size */
|
||||
PAMAP_INIT = (PAMAP_TIME | PAMAP_LIFE | PAMAP_DENS | PAMAP_SIZE),
|
||||
/* reset */
|
||||
PAMAP_IVEL = (1<<5), /* initial velocity */
|
||||
/* physics */
|
||||
PAMAP_FIELD = (1<<6), /* force fields */
|
||||
PAMAP_GRAVITY = (1<<10),
|
||||
PAMAP_DAMP = (1<<11),
|
||||
PAMAP_PHYSICS = (PAMAP_FIELD | PAMAP_GRAVITY | PAMAP_DAMP),
|
||||
/* children */
|
||||
PAMAP_CLUMP = (1<<7),
|
||||
PAMAP_KINK_FREQ = (1<<8),
|
||||
PAMAP_KINK_AMP = (1<<12),
|
||||
PAMAP_ROUGH = (1<<9),
|
||||
PAMAP_LENGTH = (1<<4),
|
||||
PAMAP_CHILD = (PAMAP_CLUMP | PAMAP_KINK_FREQ | PAMAP_KINK_AMP | PAMAP_ROUGH | PAMAP_LENGTH),
|
||||
} eParticleTextureInfluence;
|
||||
|
||||
#endif
|
||||
@@ -114,7 +114,6 @@ static const char *includefiles[] = {
|
||||
"DNA_color_types.h",
|
||||
"DNA_brush_types.h",
|
||||
"DNA_customdata_types.h",
|
||||
"DNA_particle_types.h",
|
||||
"DNA_cloth_types.h",
|
||||
"DNA_gpencil_types.h",
|
||||
"DNA_windowmanager_types.h",
|
||||
@@ -1289,7 +1288,6 @@ int main(int argc, char **argv)
|
||||
#include "DNA_color_types.h"
|
||||
#include "DNA_brush_types.h"
|
||||
#include "DNA_customdata_types.h"
|
||||
#include "DNA_particle_types.h"
|
||||
#include "DNA_cloth_types.h"
|
||||
#include "DNA_gpencil_types.h"
|
||||
#include "DNA_windowmanager_types.h"
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
#include "DNA_brush_types.h"
|
||||
#include "DNA_group_types.h"
|
||||
#include "DNA_modifier_types.h"
|
||||
#include "DNA_particle_types.h"
|
||||
#include "DNA_rigidbody_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_linestyle_types.h"
|
||||
|
||||
@@ -50,12 +50,7 @@ static void node_shader_exec_particle_info(void *data, int UNUSED(thread), bNode
|
||||
|
||||
static int gpu_shader_particle_info(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
|
||||
{
|
||||
|
||||
return GPU_stack_link(mat, "particle_info", in, out,
|
||||
GPU_builtin(GPU_PARTICLE_SCALAR_PROPS),
|
||||
GPU_builtin(GPU_PARTICLE_LOCATION),
|
||||
GPU_builtin(GPU_PARTICLE_VELOCITY),
|
||||
GPU_builtin(GPU_PARTICLE_ANG_VELOCITY));
|
||||
return GPU_stack_link(mat, "particle_info", in, out);
|
||||
}
|
||||
|
||||
/* node type definition */
|
||||
|
||||
@@ -57,7 +57,6 @@
|
||||
#include "DNA_node_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_object_fluidsim.h"
|
||||
#include "DNA_particle_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_texture_types.h"
|
||||
|
||||
@@ -3638,7 +3637,6 @@ static int allow_render_object(Render *re, Object *ob, int nolamps, int onlysele
|
||||
|
||||
static int allow_render_dupli_instance(Render *UNUSED(re), DupliObject *dob, Object *obd)
|
||||
{
|
||||
ParticleSystem *psys;
|
||||
Material *ma;
|
||||
short a, *totmaterial;
|
||||
|
||||
@@ -3654,10 +3652,6 @@ static int allow_render_dupli_instance(Render *UNUSED(re), DupliObject *dob, Obj
|
||||
}
|
||||
}
|
||||
|
||||
for (psys=obd->particlesystem.first; psys; psys=psys->next)
|
||||
if (!ELEM(psys->part->ren_as, PART_DRAW_BB, PART_DRAW_LINE, PART_DRAW_PATH, PART_DRAW_OB, PART_DRAW_GR))
|
||||
return 0;
|
||||
|
||||
/* don't allow lamp, animated duplis, or radio render */
|
||||
return (render_object_type(obd->type) &&
|
||||
(!(dob->type == OB_DUPLIGROUP) || !dob->animated));
|
||||
@@ -3813,9 +3807,7 @@ static void database_init_objects(Render *re, unsigned int renderlay, int nolamp
|
||||
continue;
|
||||
|
||||
if (allow_render_dupli_instance(re, dob, obd)) {
|
||||
ParticleSystem *psys;
|
||||
ObjectRen *obr = NULL;
|
||||
int psysindex;
|
||||
float mat[4][4];
|
||||
|
||||
obi=NULL;
|
||||
@@ -3846,29 +3838,6 @@ static void database_init_objects(Render *re, unsigned int renderlay, int nolamp
|
||||
}
|
||||
}
|
||||
|
||||
/* same logic for particles, each particle system has it's own object, so
|
||||
* need to go over them separately */
|
||||
psysindex= 1;
|
||||
for (psys=obd->particlesystem.first; psys; psys=psys->next) {
|
||||
if (dob->type != OB_DUPLIGROUP || (obr=find_dupligroup_dupli(re, obd, psysindex))) {
|
||||
if (obi == NULL)
|
||||
mul_m4_m4m4(mat, re->viewmat, dob->mat);
|
||||
obi = RE_addRenderInstance(re, NULL, obd, ob, dob->persistent_id[0], psysindex++, mat, obd->lay, dob);
|
||||
|
||||
set_dupli_tex_mat(re, obi, dob, dob_extra->obmat);
|
||||
if (dob->type != OB_DUPLIGROUP) {
|
||||
copy_v3_v3(obi->dupliorco, dob->orco);
|
||||
obi->dupliuv[0]= dob->uv[0];
|
||||
obi->dupliuv[1]= dob->uv[1];
|
||||
}
|
||||
else {
|
||||
assign_dupligroup_dupli(re, obi, obr, dob);
|
||||
if (obd->transflag & OB_RENDER_DUPLI)
|
||||
find_dupli_instances(re, obr, dob);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (obi==NULL)
|
||||
/* can't instance, just create the object */
|
||||
init_render_object(re, obd, ob, dob, dob_extra->obmat, timeoffset);
|
||||
|
||||
@@ -45,7 +45,6 @@
|
||||
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_particle_types.h"
|
||||
#include "DNA_texture_types.h"
|
||||
|
||||
#include "BKE_deform.h"
|
||||
|
||||
@@ -70,7 +70,6 @@
|
||||
#include "DNA_material_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_texture_types.h"
|
||||
#include "DNA_particle_types.h"
|
||||
|
||||
#include "BKE_customdata.h"
|
||||
#include "BKE_DerivedMesh.h"
|
||||
@@ -1401,7 +1400,7 @@ void RE_updateRenderInstances(Render *re, int flag)
|
||||
|
||||
ObjectInstanceRen *RE_addRenderInstance(
|
||||
Render *re, ObjectRen *obr, Object *ob, Object *par,
|
||||
int index, int psysindex, float mat[4][4], int lay, const DupliObject *dob)
|
||||
int index, int psysindex, float mat[4][4], int lay, const DupliObject *UNUSED(dob))
|
||||
{
|
||||
ObjectInstanceRen *obi;
|
||||
float mat3[3][3];
|
||||
@@ -1414,35 +1413,6 @@ ObjectInstanceRen *RE_addRenderInstance(
|
||||
obi->psysindex= psysindex;
|
||||
obi->lay= lay;
|
||||
|
||||
/* Fill particle info */
|
||||
if (par && dob) {
|
||||
const ParticleSystem *psys = dob->particle_system;
|
||||
if (psys) {
|
||||
int part_index;
|
||||
if (obi->index < psys->totpart) {
|
||||
part_index = obi->index;
|
||||
}
|
||||
else if (psys->child) {
|
||||
part_index = psys->child[obi->index - psys->totpart].parent;
|
||||
}
|
||||
else {
|
||||
part_index = -1;
|
||||
}
|
||||
|
||||
if (part_index >= 0) {
|
||||
const ParticleData *p = &psys->particles[part_index];
|
||||
obi->part_index = part_index;
|
||||
obi->part_size = p->size;
|
||||
obi->part_age = RE_GetStats(re)->cfra - p->time;
|
||||
obi->part_lifetime = p->lifetime;
|
||||
|
||||
copy_v3_v3(obi->part_co, p->state.co);
|
||||
copy_v3_v3(obi->part_vel, p->state.vel);
|
||||
copy_v3_v3(obi->part_avel, p->state.ave);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RE_updateRenderInstance(re, obi, RE_OBJECT_INSTANCES_UPDATE_OBMAT | RE_OBJECT_INSTANCES_UPDATE_VIEW);
|
||||
|
||||
if (mat) {
|
||||
|
||||
@@ -39,7 +39,6 @@
|
||||
#include "DNA_lamp_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_material_types.h"
|
||||
#include "DNA_particle_types.h"
|
||||
|
||||
#include "BKE_scene.h"
|
||||
|
||||
|
||||
@@ -63,7 +63,6 @@
|
||||
#include "DNA_texture_types.h"
|
||||
#include "DNA_object_force.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_particle_types.h"
|
||||
#include "DNA_modifier_types.h"
|
||||
#include "DNA_smoke_types.h"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user