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