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) 2005 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 LICENSE BLOCK ***** 00026 */ 00027 00033 #ifndef NODE_TEXTURE_UTIL_H_ 00034 #define NODE_TEXTURE_UTIL_H_ 00035 00036 #include <math.h> 00037 #include <string.h> 00038 00039 #include "MEM_guardedalloc.h" 00040 00041 #include "DNA_color_types.h" 00042 #include "DNA_ipo_types.h" 00043 #include "DNA_ID.h" 00044 #include "DNA_image_types.h" 00045 #include "DNA_material_types.h" 00046 #include "DNA_node_types.h" 00047 #include "DNA_object_types.h" 00048 #include "DNA_scene_types.h" 00049 #include "DNA_texture_types.h" 00050 00051 #include "BKE_blender.h" 00052 #include "BKE_colortools.h" 00053 #include "BKE_global.h" 00054 #include "BKE_image.h" 00055 #include "BKE_main.h" 00056 #include "BKE_material.h" 00057 #include "BKE_node.h" 00058 #include "BKE_texture.h" 00059 00060 #include "BKE_library.h" 00061 00062 #include "node_util.h" 00063 00064 #include "BLI_math.h" 00065 #include "BLI_blenlib.h" 00066 #include "BLI_rand.h" 00067 #include "BLI_threads.h" 00068 #include "BLI_utildefines.h" 00069 00070 #include "IMB_imbuf_types.h" 00071 #include "IMB_imbuf.h" 00072 00073 #include "RE_pipeline.h" 00074 #include "RE_shader_ext.h" 00075 00076 typedef struct TexCallData { 00077 TexResult *target; 00078 float *co; 00079 float *dxt, *dyt; 00080 int osatex; 00081 char do_preview; 00082 short thread; 00083 short which_output; 00084 int cfra; 00085 00086 ShadeInput *shi; 00087 MTex *mtex; 00088 } TexCallData; 00089 00090 typedef struct TexParams { 00091 float *co; 00092 float *dxt, *dyt; 00093 float *previewco; 00094 int cfra; 00095 int osatex; 00096 00097 /* optional. we don't really want these here, but image 00098 textures need to do mapping & color correction */ 00099 ShadeInput *shi; 00100 MTex *mtex; 00101 } TexParams; 00102 00103 typedef void(*TexFn) (float *out, TexParams *params, bNode *node, bNodeStack **in, short thread); 00104 00105 typedef struct TexDelegate { 00106 TexCallData *cdata; 00107 TexFn fn; 00108 bNode *node; 00109 bNodeStack *in[MAX_SOCKET]; 00110 int type; 00111 } TexDelegate; 00112 00113 void tex_input_rgba(float *out, bNodeStack *in, TexParams *params, short thread); 00114 void tex_input_vec(float *out, bNodeStack *in, TexParams *params, short thread); 00115 float tex_input_value(bNodeStack *in, TexParams *params, short thread); 00116 00117 void tex_output(bNode *node, bNodeStack **in, bNodeStack *out, TexFn texfn, TexCallData *data); 00118 void tex_do_preview(bNode *node, float *coord, float *col); 00119 00120 void params_from_cdata(TexParams *out, TexCallData *in); 00121 00122 void node_tex_pass_on(void *data, int thread, struct bNode *node, void *nodedata, struct bNodeStack **in, struct bNodeStack **out); 00123 00124 #endif