Changeset View
Changeset View
Standalone View
Standalone View
source/blender/render/intern/source/shadeinput.c
| Show All 33 Lines | |||||
| #include "BLI_math.h" | #include "BLI_math.h" | ||||
| #include "BLI_utildefines.h" | #include "BLI_utildefines.h" | ||||
| #include "DNA_lamp_types.h" | #include "DNA_lamp_types.h" | ||||
| #include "DNA_meshdata_types.h" | #include "DNA_meshdata_types.h" | ||||
| #include "DNA_material_types.h" | #include "DNA_material_types.h" | ||||
| #include "DNA_particle_types.h" | |||||
| #include "BKE_scene.h" | #include "BKE_scene.h" | ||||
| #include "BKE_node.h" | #include "BKE_node.h" | ||||
| /* local include */ | /* local include */ | ||||
| #include "raycounter.h" | #include "raycounter.h" | ||||
| #include "render_types.h" | #include "render_types.h" | ||||
| ▲ Show 20 Lines • Show All 818 Lines • ▼ Show 20 Lines | void shade_input_set_shade_texco(ShadeInput *shi) | ||||
| ObjectInstanceRen *obi = shi->obi; | ObjectInstanceRen *obi = shi->obi; | ||||
| ObjectRen *obr = shi->obr; | ObjectRen *obr = shi->obr; | ||||
| VertRen *v1 = shi->v1, *v2 = shi->v2, *v3 = shi->v3; | VertRen *v1 = shi->v1, *v2 = shi->v2, *v3 = shi->v3; | ||||
| float u = shi->u, v = shi->v; | float u = shi->u, v = shi->v; | ||||
| float l = 1.0f + u + v, dl; | float l = 1.0f + u + v, dl; | ||||
| int mode = shi->mode; /* or-ed result for all nodes */ | int mode = shi->mode; /* or-ed result for all nodes */ | ||||
| short texco = shi->mat->texco; | short texco = shi->mat->texco; | ||||
| /* Fill particle info */ | |||||
| if (obi->psysindex >= 0) { | |||||
| int psysindex = 0; | |||||
| int index; | |||||
| ParticleSystem *psys; | |||||
| if (obi->par) { | |||||
| for (psys=obi->par->particlesystem.first; psys; psys=psys->next) { | |||||
| if(psysindex == obi->psysindex) | |||||
| break; | |||||
| ++psysindex; | |||||
| } | |||||
| 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]; | |||||
| shi->part_index = index; | |||||
| shi->part_size = p->size; | |||||
| shi->part_age = shi->cfra - p->time; | |||||
| shi->part_lifetime = p->lifetime; | |||||
| copy_v3_v3(shi->part_co, p->state.co); | |||||
| copy_v3_v3(shi->part_vel, p->state.vel); | |||||
| copy_v3_v3(shi->part_avel, p->state.ave); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| /* calculate dxno */ | /* calculate dxno */ | ||||
| if (shi->vlr->flag & R_SMOOTH) { | if (shi->vlr->flag & R_SMOOTH) { | ||||
| if (shi->osatex && (texco & (TEXCO_NORM | TEXCO_REFL)) ) { | if (shi->osatex && (texco & (TEXCO_NORM | TEXCO_REFL)) ) { | ||||
| const float *n1 = shi->n1, *n2 = shi->n2, *n3 = shi->n3; | const float *n1 = shi->n1, *n2 = shi->n2, *n3 = shi->n3; | ||||
| dl = shi->dx_u + shi->dx_v; | dl = shi->dx_u + shi->dx_v; | ||||
| shi->dxno[0] = dl * n3[0] - shi->dx_u * n1[0] - shi->dx_v * n2[0]; | shi->dxno[0] = dl * n3[0] - shi->dx_u * n1[0] - shi->dx_v * n2[0]; | ||||
| ▲ Show 20 Lines • Show All 431 Lines • ▼ Show 20 Lines | void shade_input_initialize(ShadeInput *shi, RenderPart *pa, RenderLayer *rl, int sample) | ||||
| shi->do_manage = BKE_scene_check_color_management_enabled(R.scene); | shi->do_manage = BKE_scene_check_color_management_enabled(R.scene); | ||||
| shi->lay = rl->lay; | shi->lay = rl->lay; | ||||
| shi->layflag = rl->layflag; | shi->layflag = rl->layflag; | ||||
| shi->passflag = rl->passflag; | shi->passflag = rl->passflag; | ||||
| shi->combinedflag = ~rl->pass_xor; | shi->combinedflag = ~rl->pass_xor; | ||||
| shi->mat_override = rl->mat_override; | shi->mat_override = rl->mat_override; | ||||
| shi->light_override = rl->light_override; | shi->light_override = rl->light_override; | ||||
| shi->cfra = R.r.cfra; | |||||
psy-fi: No need for this, shaderinput.c has access to R, check
extern struct Render R; | |||||
| // shi->rl= rl; | // shi->rl= rl; | ||||
| /* note shi.depth==0 means first hit, not raytracing */ | /* note shi.depth==0 means first hit, not raytracing */ | ||||
| } | } | ||||
| /* initialize per part, not per pixel! */ | /* initialize per part, not per pixel! */ | ||||
| void shade_sample_initialize(ShadeSample *ssamp, RenderPart *pa, RenderLayer *rl) | void shade_sample_initialize(ShadeSample *ssamp, RenderPart *pa, RenderLayer *rl) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 137 Lines • Show Last 20 Lines | |||||
No need for this, shaderinput.c has access to R, check
extern struct Render R;