4 * ***** BEGIN GPL LICENSE BLOCK *****
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 * The Original Code is Copyright (C) 2006 Blender Foundation
21 * All rights reserved.
23 * ***** END GPL LICENSE BLOCK *****
35 struct ObjectInstanceRen obi;
42 /* needed to calculate shadow and AO for an entire pixel */
43 typedef struct ShadeSample {
44 int tot; /* amount of shi in use, can be 1 for not FULL_OSA */
46 RenderLayer *rlpp[RE_MAX_OSA]; /* fast lookup from sample to renderlayer (fullsample buf) */
48 /* could be malloced once */
49 ShadeInput shi[RE_MAX_OSA];
50 ShadeResult shr[RE_MAX_OSA];
54 /* also the node shader callback */
55 void shade_material_loop(struct ShadeInput *shi, struct ShadeResult *shr);
56 void shade_volume_loop(struct ShadeInput *shi, struct ShadeResult *shr);
58 void shade_input_set_triangle_i(struct ShadeInput *shi, struct ObjectInstanceRen *obi, struct VlakRen *vlr, short i1, short i2, short i3);
59 void shade_input_set_triangle(struct ShadeInput *shi, volatile int obi, volatile int facenr, int normal_flip);
60 void shade_input_copy_triangle(struct ShadeInput *shi, struct ShadeInput *from);
61 void shade_input_calc_viewco(struct ShadeInput *shi, float x, float y, float z, float *view, float *dxyview, float *co, float *dxco, float *dyco);
62 void shade_input_set_viewco(struct ShadeInput *shi, float x, float y, float sx, float sy, float z);
63 void shade_input_set_uv(struct ShadeInput *shi);
64 void shade_input_set_normals(struct ShadeInput *shi);
65 void shade_input_flip_normals(struct ShadeInput *shi);
66 void shade_input_set_shade_texco(struct ShadeInput *shi);
67 void shade_input_set_strand(struct ShadeInput *shi, struct StrandRen *strand, struct StrandPoint *spoint);
68 void shade_input_set_strand_texco(struct ShadeInput *shi, struct StrandRen *strand, struct StrandVert *svert, struct StrandPoint *spoint);
69 void shade_input_do_shade(struct ShadeInput *shi, struct ShadeResult *shr);
71 void shade_input_initialize(struct ShadeInput *shi, struct RenderPart *pa, struct RenderLayer *rl, int sample);
73 void shade_sample_initialize(struct ShadeSample *ssamp, struct RenderPart *pa, struct RenderLayer *rl);
74 void shade_samples_do_AO(struct ShadeSample *ssamp);
75 void shade_samples_fill_with_ps(struct ShadeSample *ssamp, struct PixStr *ps, int x, int y);
76 int shade_samples(struct ShadeSample *ssamp, struct PixStr *ps, int x, int y);
78 void vlr_set_uv_indices(struct VlakRen *vlr, int *i1, int *i2, int *i3);
80 void calc_R_ref(struct ShadeInput *shi);
84 void shade_lamp_loop(struct ShadeInput *shi, struct ShadeResult *shr);
86 void shade_color(struct ShadeInput *shi, ShadeResult *shr);
88 void ambient_occlusion_to_diffuse(struct ShadeInput *shi, float *diff);
89 void ambient_occlusion(struct ShadeInput *shi);
91 ListBase *get_lights(struct ShadeInput *shi);
92 float lamp_get_visibility(struct LampRen *lar, float *co, float *lv, float *dist);
93 void lamp_get_shadow(struct LampRen *lar, ShadeInput *shi, float inp, float *shadfac, int do_real);
95 float fresnel_fac(float *view, float *vn, float fresnel, float fac);
98 extern void shade_ray(struct Isect *is, struct ShadeInput *shi, struct ShadeResult *shr);