|
Blender
V2.59
|
00001 /* 00002 * 00003 * ***** BEGIN GPL LICENSE BLOCK ***** 00004 * 00005 * This program is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU General Public License 00007 * as published by the Free Software Foundation; either version 2 00008 * of the License, or (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software Foundation, 00017 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00018 * 00019 * The Original Code is Copyright (C) 2005 Blender Foundation. 00020 * All rights reserved. 00021 * 00022 * The Original Code is: all of this file. 00023 * 00024 * Contributor(s): none yet. 00025 * 00026 * ***** END GPL LICENSE BLOCK ***** 00027 */ 00028 00034 #ifndef TEX_NODE_UTIL_H_ 00035 #define TEX_NODE_UTIL_H_ 00036 00037 #include <math.h> 00038 #include <string.h> 00039 00040 #include "MEM_guardedalloc.h" 00041 00042 #include "DNA_color_types.h" 00043 #include "DNA_ipo_types.h" 00044 #include "DNA_ID.h" 00045 #include "DNA_image_types.h" 00046 #include "DNA_material_types.h" 00047 #include "DNA_node_types.h" 00048 #include "DNA_object_types.h" 00049 #include "DNA_scene_types.h" 00050 #include "DNA_texture_types.h" 00051 00052 #include "BKE_blender.h" 00053 #include "BKE_colortools.h" 00054 #include "BKE_global.h" 00055 #include "BKE_image.h" 00056 #include "BKE_main.h" 00057 #include "BKE_material.h" 00058 #include "BKE_node.h" 00059 #include "BKE_texture.h" 00060 00061 #include "BKE_library.h" 00062 00063 #include "../SHD_node.h" 00064 #include "node_util.h" 00065 00066 #include "BLI_math.h" 00067 #include "BLI_blenlib.h" 00068 #include "BLI_rand.h" 00069 #include "BLI_threads.h" 00070 #include "BLI_utildefines.h" 00071 00072 #include "IMB_imbuf_types.h" 00073 #include "IMB_imbuf.h" 00074 00075 #include "RE_pipeline.h" 00076 #include "RE_shader_ext.h" 00077 00078 typedef struct TexCallData { 00079 TexResult *target; 00080 float *co; 00081 float *dxt, *dyt; 00082 int osatex; 00083 char do_preview; 00084 short thread; 00085 short which_output; 00086 int cfra; 00087 00088 ShadeInput *shi; 00089 MTex *mtex; 00090 } TexCallData; 00091 00092 typedef struct TexParams { 00093 float *co; 00094 float *dxt, *dyt; 00095 float *previewco; 00096 int cfra; 00097 int osatex; 00098 00099 /* optional. we don't really want these here, but image 00100 textures need to do mapping & color correction */ 00101 ShadeInput *shi; 00102 MTex *mtex; 00103 } TexParams; 00104 00105 typedef void(*TexFn) (float *out, TexParams *params, bNode *node, bNodeStack **in, short thread); 00106 00107 typedef struct TexDelegate { 00108 TexCallData *cdata; 00109 TexFn fn; 00110 bNode *node; 00111 bNodeStack *in[MAX_SOCKET]; 00112 int type; 00113 } TexDelegate; 00114 00115 void tex_call_delegate(TexDelegate*, float *out, TexParams *params, short thread); 00116 00117 void tex_input_rgba(float *out, bNodeStack *in, TexParams *params, short thread); 00118 void tex_input_vec(float *out, bNodeStack *in, TexParams *params, short thread); 00119 float tex_input_value(bNodeStack *in, TexParams *params, short thread); 00120 00121 void tex_output(bNode *node, bNodeStack **in, bNodeStack *out, TexFn texfn, TexCallData *data); 00122 void tex_do_preview(bNode *node, float *coord, float *col); 00123 00124 void params_from_cdata(TexParams *out, TexCallData *in); 00125 00126 #endif