forked from bartvdbraak/blender
Fix T46333: Particle Info Node broken w/ BI
Patch from @a.romanov This also fixes multiple particle systems - which never worked.
This commit is contained in:
parent
a451c480fa
commit
90b925f76d
@ -115,7 +115,9 @@ struct HaloRen *RE_inithalo_particle(struct Render *re, struct ObjectRen *obr, s
|
||||
struct StrandBuffer *RE_addStrandBuffer(struct ObjectRen *obr, int totvert);
|
||||
|
||||
struct ObjectRen *RE_addRenderObject(struct Render *re, struct Object *ob, struct Object *par, int index, int psysindex, int lay);
|
||||
struct ObjectInstanceRen *RE_addRenderInstance(struct Render *re, struct ObjectRen *obr, struct Object *ob, struct Object *par, int index, int psysindex, float mat[4][4], int lay);
|
||||
struct ObjectInstanceRen *RE_addRenderInstance(
|
||||
struct Render *re, struct ObjectRen *obr, struct Object *ob, struct Object *par,
|
||||
int index, int psysindex, float mat[4][4], int lay, const struct DupliObject *dob);
|
||||
void RE_makeRenderInstances(struct Render *re);
|
||||
|
||||
void RE_instance_rotate_ray_start(struct ObjectInstanceRen *obi, struct Isect *is);
|
||||
|
@ -4658,7 +4658,7 @@ static void add_render_object(Render *re, Object *ob, Object *par, DupliObject *
|
||||
|
||||
/* only add instance for objects that have not been used for dupli */
|
||||
if (!(ob->transflag & OB_RENDER_DUPLI)) {
|
||||
obi= RE_addRenderInstance(re, obr, ob, par, index, 0, NULL, ob->lay);
|
||||
obi = RE_addRenderInstance(re, obr, ob, par, index, 0, NULL, ob->lay, dob);
|
||||
if (dob) set_dupli_tex_mat(re, obi, dob, omat);
|
||||
}
|
||||
else
|
||||
@ -4692,7 +4692,7 @@ static void add_render_object(Render *re, Object *ob, Object *par, DupliObject *
|
||||
|
||||
/* only add instance for objects that have not been used for dupli */
|
||||
if (!(ob->transflag & OB_RENDER_DUPLI)) {
|
||||
obi= RE_addRenderInstance(re, obr, ob, par, index, psysindex, NULL, ob->lay);
|
||||
obi = RE_addRenderInstance(re, obr, ob, par, index, psysindex, NULL, ob->lay, dob);
|
||||
if (dob) set_dupli_tex_mat(re, obi, dob, omat);
|
||||
}
|
||||
else
|
||||
@ -5053,7 +5053,7 @@ static void database_init_objects(Render *re, unsigned int renderlay, int nolamp
|
||||
if (dob->type != OB_DUPLIGROUP || (obr=find_dupligroup_dupli(re, obd, 0))) {
|
||||
mul_m4_m4m4(mat, re->viewmat, dob->mat);
|
||||
/* ob = particle system, use that layer */
|
||||
obi= RE_addRenderInstance(re, NULL, obd, ob, dob->persistent_id[0], 0, mat, ob->lay);
|
||||
obi = RE_addRenderInstance(re, NULL, obd, ob, dob->persistent_id[0], 0, mat, ob->lay, dob);
|
||||
|
||||
/* fill in instance variables for texturing */
|
||||
set_dupli_tex_mat(re, obi, dob, dob_extra->obmat);
|
||||
@ -5080,7 +5080,7 @@ static void database_init_objects(Render *re, unsigned int renderlay, int nolamp
|
||||
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);
|
||||
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) {
|
||||
|
@ -1363,7 +1363,9 @@ void project_renderdata(Render *re,
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
ObjectInstanceRen *RE_addRenderInstance(Render *re, ObjectRen *obr, Object *ob, Object *par, int index, int psysindex, float mat[4][4], int lay)
|
||||
ObjectInstanceRen *RE_addRenderInstance(
|
||||
Render *re, ObjectRen *obr, Object *ob, Object *par,
|
||||
int index, int psysindex, float mat[4][4], int lay, const DupliObject *dob)
|
||||
{
|
||||
ObjectInstanceRen *obi;
|
||||
float mat3[3][3];
|
||||
@ -1377,24 +1379,22 @@ ObjectInstanceRen *RE_addRenderInstance(Render *re, ObjectRen *obr, Object *ob,
|
||||
obi->lay= lay;
|
||||
|
||||
/* Fill particle info */
|
||||
if (obi->psysindex > 0) {
|
||||
int psysindex = 1;
|
||||
int index;
|
||||
ParticleSystem *psys;
|
||||
if (obi->par) {
|
||||
for (psys = obi->par->particlesystem.first; psys; psys = psys->next) {
|
||||
if (psysindex == obi->psysindex)
|
||||
break;
|
||||
++psysindex;
|
||||
}
|
||||
if (par && dob) {
|
||||
const ParticleSystem *psys = dob->particle_system;
|
||||
if (psys) {
|
||||
if (obi->index < psys->totpart)
|
||||
int index;
|
||||
if (obi->index < psys->totpart) {
|
||||
index = obi->index;
|
||||
else {
|
||||
}
|
||||
else if (psys->child) {
|
||||
index = psys->child[obi->index - psys->totpart].parent;
|
||||
}
|
||||
else {
|
||||
index = -1;
|
||||
}
|
||||
|
||||
if (index >= 0) {
|
||||
ParticleData* p = &psys->particles[index];
|
||||
const ParticleData *p = &psys->particles[index];
|
||||
obi->part_index = index;
|
||||
obi->part_size = p->size;
|
||||
obi->part_age = RE_GetStats(re)->cfra - p->time;
|
||||
@ -1406,7 +1406,6 @@ ObjectInstanceRen *RE_addRenderInstance(Render *re, ObjectRen *obr, Object *ob,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mat) {
|
||||
copy_m4_m4(obi->mat, mat);
|
||||
|
Loading…
Reference in New Issue
Block a user