Blender V2.61 - r43446
|
00001 /* 00002 * ***** BEGIN GPL LICENSE BLOCK ***** 00003 * 00004 * This program is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU General Public License 00006 * as published by the Free Software Foundation; either version 2 00007 * of the License, or (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software Foundation, 00016 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00017 * 00018 * The Original Code is Copyright (C) 2006 Blender Foundation 00019 * All rights reserved. 00020 * 00021 * ***** END GPL LICENSE BLOCK ***** 00022 */ 00023 00029 struct ShadeInput; 00030 struct ShadeResult; 00031 struct RenderPart; 00032 struct RenderLayer; 00033 struct PixStr; 00034 struct LampRen; 00035 struct VlakRen; 00036 struct StrandSegment; 00037 struct StrandPoint; 00038 struct ObjectInstanceRen; 00039 struct Isect; 00040 00041 /* shadeinput.c */ 00042 00043 #define RE_MAX_OSA 16 00044 00045 /* needed to calculate shadow and AO for an entire pixel */ 00046 typedef struct ShadeSample { 00047 int tot; /* amount of shi in use, can be 1 for not FULL_OSA */ 00048 00049 RenderLayer *rlpp[RE_MAX_OSA]; /* fast lookup from sample to renderlayer (fullsample buf) */ 00050 00051 /* could be malloced once */ 00052 ShadeInput shi[RE_MAX_OSA]; 00053 ShadeResult shr[RE_MAX_OSA]; 00054 } ShadeSample; 00055 00056 00057 /* also the node shader callback */ 00058 void shade_material_loop(struct ShadeInput *shi, struct ShadeResult *shr); 00059 void shade_volume_loop(struct ShadeInput *shi, struct ShadeResult *shr); 00060 00061 void shade_input_set_triangle_i(struct ShadeInput *shi, struct ObjectInstanceRen *obi, struct VlakRen *vlr, short i1, short i2, short i3); 00062 void shade_input_set_triangle(struct ShadeInput *shi, volatile int obi, volatile int facenr, int normal_flip); 00063 void shade_input_copy_triangle(struct ShadeInput *shi, struct ShadeInput *from); 00064 void shade_input_calc_viewco(struct ShadeInput *shi, float x, float y, float z, float view[3], float *dxyview, float *co, float *dxco, float *dyco); 00065 void shade_input_set_viewco(struct ShadeInput *shi, float x, float y, float sx, float sy, float z); 00066 void shade_input_set_uv(struct ShadeInput *shi); 00067 void shade_input_set_normals(struct ShadeInput *shi); 00068 void shade_input_set_vertex_normals(struct ShadeInput *shi); 00069 void shade_input_flip_normals(struct ShadeInput *shi); 00070 void shade_input_set_shade_texco(struct ShadeInput *shi); 00071 void shade_input_set_strand(struct ShadeInput *shi, struct StrandRen *strand, struct StrandPoint *spoint); 00072 void shade_input_set_strand_texco(struct ShadeInput *shi, struct StrandRen *strand, struct StrandVert *svert, struct StrandPoint *spoint); 00073 void shade_input_do_shade(struct ShadeInput *shi, struct ShadeResult *shr); 00074 00075 void shade_input_init_material(struct ShadeInput *shi); 00076 void shade_input_initialize(struct ShadeInput *shi, struct RenderPart *pa, struct RenderLayer *rl, int sample); 00077 00078 void shade_sample_initialize(struct ShadeSample *ssamp, struct RenderPart *pa, struct RenderLayer *rl); 00079 void shade_samples_do_AO(struct ShadeSample *ssamp); 00080 void shade_samples_fill_with_ps(struct ShadeSample *ssamp, struct PixStr *ps, int x, int y); 00081 int shade_samples(struct ShadeSample *ssamp, struct PixStr *ps, int x, int y); 00082 00083 void vlr_set_uv_indices(struct VlakRen *vlr, int *i1, int *i2, int *i3); 00084 00085 void calc_R_ref(struct ShadeInput *shi); 00086 00087 00088 /* shadeoutput. */ 00089 void shade_lamp_loop(struct ShadeInput *shi, struct ShadeResult *shr); 00090 00091 void shade_color(struct ShadeInput *shi, ShadeResult *shr); 00092 00093 void ambient_occlusion(struct ShadeInput *shi); 00094 void environment_lighting_apply(struct ShadeInput *shi, struct ShadeResult *shr); 00095 00096 ListBase *get_lights(struct ShadeInput *shi); 00097 float lamp_get_visibility(struct LampRen *lar, const float co[3], float lv[3], float *dist); 00098 void lamp_get_shadow(struct LampRen *lar, ShadeInput *shi, float inp, float shadfac[4], int do_real); 00099 00100 float fresnel_fac(float *view, float *vn, float fresnel, float fac); 00101 00102 /* rayshade.c */ 00103 extern void shade_ray(struct Isect *is, struct ShadeInput *shi, struct ShadeResult *shr);