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 by Blender Foundation 00019 * All rights reserved. 00020 * 00021 * The Original Code is: all of this file. 00022 * 00023 * Contributor(s): none yet. 00024 * 00025 * ***** END GPL/BL DUAL LICENSE BLOCK ***** 00026 */ 00032 #ifndef RE_SHADER_EXT_H 00033 #define RE_SHADER_EXT_H 00034 00035 /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ 00036 /* this include is for shading and texture exports */ 00037 /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ 00038 00039 /* localized texture result data */ 00040 /* note; tr tg tb ta has to remain in this order */ 00041 typedef struct TexResult { 00042 float tin, tr, tg, tb, ta; 00043 int talpha; 00044 float *nor; 00045 } TexResult; 00046 00047 /* localized shade result data */ 00048 typedef struct ShadeResult 00049 { 00050 float combined[4]; 00051 float col[4]; 00052 float alpha, mist, z; 00053 float emit[3]; 00054 float diff[3]; /* no ramps, shadow, etc */ 00055 float spec[3]; 00056 float shad[4]; /* shad[3] is shadow intensity */ 00057 float ao[3]; 00058 float env[3]; 00059 float indirect[3]; 00060 float refl[3]; 00061 float refr[3]; 00062 float nor[3]; 00063 float winspeed[4]; 00064 float rayhits[4]; 00065 } ShadeResult; 00066 00067 /* only here for quick copy */ 00068 struct ShadeInputCopy { 00069 00070 struct Material *mat; 00071 struct VlakRen *vlr; 00072 struct StrandRen *strand; 00073 struct ObjectInstanceRen *obi; 00074 struct ObjectRen *obr; 00075 int facenr; 00076 float facenor[3]; /* copy from face */ 00077 short flippednor; /* is facenor flipped? */ 00078 struct VertRen *v1, *v2, *v3; /* vertices can be in any order for quads... */ 00079 short i1, i2, i3; /* original vertex indices */ 00080 short puno; 00081 short osatex; 00082 float vn[3], vno[3]; /* actual render normal, and a copy to restore it */ 00083 float n1[3], n2[3], n3[3]; /* vertex normals, corrected */ 00084 int mode; /* base material mode (OR-ed result of entire node tree) */ 00085 }; 00086 00087 typedef struct ShadeInputUV { 00088 float dxuv[3], dyuv[3], uv[3]; 00089 char *name; 00090 } ShadeInputUV; 00091 00092 typedef struct ShadeInputCol { 00093 float col[4]; 00094 char *name; 00095 } ShadeInputCol; 00096 00097 /* localized renderloop data */ 00098 typedef struct ShadeInput 00099 { 00100 /* copy from face, also to extract tria from quad */ 00101 /* note it mirrors a struct above for quick copy */ 00102 00103 struct Material *mat; 00104 struct VlakRen *vlr; 00105 struct StrandRen *strand; 00106 struct ObjectInstanceRen *obi; 00107 struct ObjectRen *obr; 00108 int facenr; 00109 float facenor[3]; /* copy from face */ 00110 short flippednor; /* is facenor flipped? */ 00111 struct VertRen *v1, *v2, *v3; /* vertices can be in any order for quads... */ 00112 short i1, i2, i3; /* original vertex indices */ 00113 short puno; 00114 short osatex; 00115 float vn[3], vno[3]; /* actual render normal, and a copy to restore it */ 00116 float n1[3], n2[3], n3[3]; /* vertex normals, corrected */ 00117 int mode; /* base material mode (OR-ed result of entire node tree) */ 00118 00119 /* internal face coordinates */ 00120 float u, v, dx_u, dx_v, dy_u, dy_v; 00121 float co[3], view[3], camera_co[3]; 00122 00123 /* copy from material, keep synced so we can do memcopy */ 00124 /* current size: 23*4 */ 00125 float r, g, b; 00126 float specr, specg, specb; 00127 float mirr, mirg, mirb; 00128 float ambr, ambb, ambg; 00129 00130 float amb, emit, ang, spectra, ray_mirror; 00131 float alpha, refl, spec, zoffs, add; 00132 float translucency; 00133 /* end direct copy from material */ 00134 00135 /* individual copies: */ 00136 int har; /* hardness */ 00137 00138 /* texture coordinates */ 00139 float lo[3], gl[3], ref[3], orn[3], winco[3], sticky[3], vcol[4]; 00140 float refcol[4], displace[3]; 00141 float strandco, tang[3], nmapnorm[3], nmaptang[4], stress, winspeed[4]; 00142 float duplilo[3], dupliuv[3]; 00143 00144 ShadeInputUV uv[8]; /* 8 = MAX_MTFACE */ 00145 ShadeInputCol col[8]; /* 8 = MAX_MCOL */ 00146 int totuv, totcol, actuv, actcol; 00147 00148 /* dx/dy OSA coordinates */ 00149 float dxco[3], dyco[3]; 00150 float dxlo[3], dylo[3], dxgl[3], dygl[3]; 00151 float dxref[3], dyref[3], dxorn[3], dyorn[3]; 00152 float dxno[3], dyno[3], dxview, dyview; 00153 float dxlv[3], dylv[3]; 00154 float dxwin[3], dywin[3]; 00155 float dxsticky[3], dysticky[3]; 00156 float dxrefract[3], dyrefract[3]; 00157 float dxstrand, dystrand; 00158 00159 /* AO is a pre-process now */ 00160 float ao[3], indirect[3], env[3]; 00161 00162 int xs, ys; /* pixel to be rendered */ 00163 int mask; /* subsample mask */ 00164 float scanco[3]; /* original scanline coordinate without jitter */ 00165 00166 int samplenr; /* sample counter, to detect if we should do shadow again */ 00167 int depth; /* 1 or larger on raytrace shading */ 00168 int volume_depth; /* number of intersections through volumes */ 00169 00170 /* for strand shading, normal at the surface */ 00171 float surfnor[3], surfdist; 00172 00173 /* from initialize, part or renderlayer */ 00174 short do_preview; /* for nodes, in previewrender */ 00175 short do_manage; /* color management flag */ 00176 short thread, sample; /* sample: ShadeSample array index */ 00177 short nodes; /* indicate node shading, temp hack to prevent recursion */ 00178 00179 unsigned int lay; 00180 int layflag, passflag, combinedflag; 00181 struct Group *light_override; 00182 struct Material *mat_override; 00183 00184 #ifdef RE_RAYCOUNTER 00185 RayCounter raycounter; 00186 #endif 00187 00188 } ShadeInput; 00189 00190 00191 /* node shaders... */ 00192 struct Tex; 00193 struct MTex; 00194 struct ImBuf; 00195 00196 /* this one uses nodes */ 00197 int multitex_ext(struct Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, struct TexResult *texres); 00198 /* nodes disabled */ 00199 int multitex_ext_safe(struct Tex *tex, float *texvec, struct TexResult *texres); 00200 /* only for internal node usage */ 00201 int multitex_nodes(struct Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, struct TexResult *texres, 00202 short thread, short which_output, struct ShadeInput *shi, struct MTex *mtex); 00203 00204 /* shaded view and bake */ 00205 struct Render; 00206 struct Image; 00207 struct Object; 00208 00209 int RE_bake_shade_all_selected(struct Render *re, int type, struct Object *actob, short *do_update, float *progress); 00210 struct Image *RE_bake_shade_get_image(void); 00211 void RE_bake_ibuf_filter(struct ImBuf *ibuf, char *mask, const int filter); 00212 00213 #endif /* RE_SHADER_EXT_H */