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 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 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_makeRenderInstances(struct Render *re);
|
||||||
|
|
||||||
void RE_instance_rotate_ray_start(struct ObjectInstanceRen *obi, struct Isect *is);
|
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 */
|
/* only add instance for objects that have not been used for dupli */
|
||||||
if (!(ob->transflag & OB_RENDER_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);
|
if (dob) set_dupli_tex_mat(re, obi, dob, omat);
|
||||||
}
|
}
|
||||||
else
|
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 */
|
/* only add instance for objects that have not been used for dupli */
|
||||||
if (!(ob->transflag & OB_RENDER_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);
|
if (dob) set_dupli_tex_mat(re, obi, dob, omat);
|
||||||
}
|
}
|
||||||
else
|
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))) {
|
if (dob->type != OB_DUPLIGROUP || (obr=find_dupligroup_dupli(re, obd, 0))) {
|
||||||
mul_m4_m4m4(mat, re->viewmat, dob->mat);
|
mul_m4_m4m4(mat, re->viewmat, dob->mat);
|
||||||
/* ob = particle system, use that layer */
|
/* 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 */
|
/* fill in instance variables for texturing */
|
||||||
set_dupli_tex_mat(re, obi, dob, dob_extra->obmat);
|
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 (dob->type != OB_DUPLIGROUP || (obr=find_dupligroup_dupli(re, obd, psysindex))) {
|
||||||
if (obi == NULL)
|
if (obi == NULL)
|
||||||
mul_m4_m4m4(mat, re->viewmat, dob->mat);
|
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);
|
set_dupli_tex_mat(re, obi, dob, dob_extra->obmat);
|
||||||
if (dob->type != OB_DUPLIGROUP) {
|
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;
|
ObjectInstanceRen *obi;
|
||||||
float mat3[3][3];
|
float mat3[3][3];
|
||||||
@ -1377,33 +1379,30 @@ ObjectInstanceRen *RE_addRenderInstance(Render *re, ObjectRen *obr, Object *ob,
|
|||||||
obi->lay= lay;
|
obi->lay= lay;
|
||||||
|
|
||||||
/* Fill particle info */
|
/* Fill particle info */
|
||||||
if (obi->psysindex > 0) {
|
if (par && dob) {
|
||||||
int psysindex = 1;
|
const ParticleSystem *psys = dob->particle_system;
|
||||||
int index;
|
if (psys) {
|
||||||
ParticleSystem *psys;
|
int index;
|
||||||
if (obi->par) {
|
if (obi->index < psys->totpart) {
|
||||||
for (psys = obi->par->particlesystem.first; psys; psys = psys->next) {
|
index = obi->index;
|
||||||
if (psysindex == obi->psysindex)
|
}
|
||||||
break;
|
else if (psys->child) {
|
||||||
++psysindex;
|
index = psys->child[obi->index - psys->totpart].parent;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
index = -1;
|
||||||
}
|
}
|
||||||
if (psys) {
|
|
||||||
if (obi->index < psys->totpart)
|
|
||||||
index = obi->index;
|
|
||||||
else {
|
|
||||||
index = psys->child[obi->index - psys->totpart].parent;
|
|
||||||
}
|
|
||||||
if (index >= 0) {
|
|
||||||
ParticleData* p = &psys->particles[index];
|
|
||||||
obi->part_index = 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);
|
if (index >= 0) {
|
||||||
copy_v3_v3(obi->part_vel, p->state.vel);
|
const ParticleData *p = &psys->particles[index];
|
||||||
copy_v3_v3(obi->part_avel, p->state.ave);
|
obi->part_index = 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user