Blender V2.61 - r43446

node_shader_util.h

Go to the documentation of this file.
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_SHADER_UTIL_H_
00034 #define NODE_SHADER_UTIL_H_
00035 
00036 #include <math.h>
00037 #include <float.h>
00038 #include <string.h>
00039 
00040 #include "MEM_guardedalloc.h"
00041 
00042 #include "DNA_color_types.h"
00043 #include "DNA_customdata_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 "NOD_shader.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 #include "GPU_material.h"
00079 
00080 /* ********* exec data struct, remains internal *********** */
00081 
00082 typedef struct ShaderCallData {
00083     ShadeInput *shi;        /* from render pipe */
00084     ShadeResult *shr;       /* from render pipe */
00085 } ShaderCallData;
00086 
00087 /* output socket defines */
00088 #define GEOM_OUT_GLOB   0
00089 #define GEOM_OUT_LOCAL  1
00090 #define GEOM_OUT_VIEW   2
00091 #define GEOM_OUT_ORCO   3
00092 #define GEOM_OUT_UV     4
00093 #define GEOM_OUT_NORMAL 5
00094 #define GEOM_OUT_VCOL   6
00095 #define GEOM_OUT_VCOL_ALPHA 7
00096 #define GEOM_OUT_FRONTBACK  8
00097 
00098 
00099 /* input socket defines */
00100 #define MAT_IN_COLOR    0
00101 #define MAT_IN_SPEC     1
00102 #define MAT_IN_REFL     2
00103 #define MAT_IN_NORMAL   3
00104 #define MAT_IN_MIR      4
00105 #define MAT_IN_AMB      5
00106 #define MAT_IN_EMIT 6
00107 #define MAT_IN_SPECTRA  7
00108 #define MAT_IN_RAY_MIRROR   8
00109 #define MAT_IN_ALPHA    9
00110 #define MAT_IN_TRANSLUCENCY 10
00111 #define NUM_MAT_IN      11  /* for array size */
00112 
00113 /* output socket defines */
00114 #define MAT_OUT_COLOR       0
00115 #define MAT_OUT_ALPHA       1
00116 #define MAT_OUT_NORMAL  2
00117 #define MAT_OUT_DIFFUSE 3
00118 #define MAT_OUT_SPEC        4
00119 #define MAT_OUT_AO      5
00120 
00121 
00122 extern void node_ID_title_cb(void *node_v, void *unused_v);
00123 void nodestack_get_vec(float *in, short type_in, bNodeStack *ns);
00124 
00125 void node_gpu_stack_from_data(struct GPUNodeStack *gs, int type, struct bNodeStack *ns);
00126 void node_data_from_gpu_stack(struct bNodeStack *ns, struct GPUNodeStack *gs);
00127 void node_shader_gpu_tex_mapping(struct GPUMaterial *mat, struct bNode *node, struct GPUNodeStack *in, struct GPUNodeStack *out);
00128 
00129 void ntreeExecGPUNodes(struct bNodeTreeExec *exec, struct GPUMaterial *mat, int do_outputs);
00130 
00131 void node_shader_pass_on(void *data, int thread, struct bNode *node, void *nodedata, struct bNodeStack **in, struct bNodeStack **out);
00132 int gpu_shader_pass_on(struct GPUMaterial *mat, struct bNode *node, void *nodedata, struct GPUNodeStack *in, struct GPUNodeStack *out);
00133 
00134 #endif