Blender  V2.93
node_texture_util.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2005 Blender Foundation.
17  * All rights reserved.
18  */
19 
24 #pragma once
25 
26 #include <math.h>
27 #include <string.h>
28 
29 #include "MEM_guardedalloc.h"
30 
31 #include "DNA_ID.h"
32 #include "DNA_color_types.h"
33 #include "DNA_image_types.h"
34 #include "DNA_material_types.h"
35 #include "DNA_node_types.h"
36 #include "DNA_object_types.h"
37 #include "DNA_scene_types.h"
38 #include "DNA_texture_types.h"
39 
40 #include "BLI_blenlib.h"
41 #include "BLI_math.h"
42 #include "BLI_rand.h"
43 #include "BLI_threads.h"
44 #include "BLI_utildefines.h"
45 
46 #include "BKE_colorband.h"
47 #include "BKE_colortools.h"
48 #include "BKE_global.h"
49 #include "BKE_image.h"
50 #include "BKE_main.h"
51 #include "BKE_material.h"
52 #include "BKE_node.h"
53 #include "BKE_texture.h"
54 
55 #include "NOD_texture.h"
56 #include "node_util.h"
57 
58 #include "BLT_translation.h"
59 
60 #include "IMB_imbuf.h"
61 #include "IMB_imbuf_types.h"
62 
63 #include "RE_pipeline.h"
64 #include "RE_texture.h"
65 
66 #ifdef __cplusplus
67 extern "C" {
68 #endif
69 
70 typedef struct TexCallData {
72  /* all float[3] */
73  const float *co;
74  float *dxt, *dyt;
75 
76  int osatex;
77  bool do_preview;
78  bool do_manage;
79  short thread;
80  short which_output;
81  int cfra;
82 
85 
86 typedef struct TexParams {
87  const float *co;
88  float *dxt, *dyt;
89  const float *previewco;
90  int cfra;
91  int osatex;
92 
93  /* optional. we don't really want these here, but image
94  * textures need to do mapping & color correction */
97 
98 typedef void (*TexFn)(float *out, TexParams *params, bNode *node, bNodeStack **in, short thread);
99 
100 typedef struct TexDelegate {
106  int type;
108 
109 bool tex_node_poll_default(struct bNodeType *ntype,
110  struct bNodeTree *ntree,
111  const char **r_disabled_hint);
112 void tex_node_type_base(
113  struct bNodeType *ntype, int type, const char *name, short nclass, short flag);
114 
115 void tex_input_rgba(float *out, bNodeStack *in, TexParams *params, short thread);
116 void tex_input_vec(float *out, bNodeStack *in, TexParams *params, short thread);
117 float tex_input_value(bNodeStack *in, TexParams *params, short thread);
118 
119 void tex_output(bNode *node,
120  bNodeExecData *execdata,
121  bNodeStack **in,
122  bNodeStack *out,
123  TexFn texfn,
124  TexCallData *data);
125 void tex_do_preview(bNodePreview *preview,
126  const float coord[2],
127  const float col[4],
128  bool do_manage);
129 
130 void params_from_cdata(TexParams *out, TexCallData *in);
131 
132 #ifdef __cplusplus
133 }
134 #endif
General operations, lookup, etc. for materials.
#define MAX_SOCKET
Definition: BKE_node.h:41
Random number functions.
ID and Library types, which are fundamental for sdna.
Object is a sort of wrapper for general info.
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
Contains defines and structs used throughout the imbuf module.
Read Guarded memory(de)allocation.
OperationNode * node
bNodeTree * ntree
uint col
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
static void texfn(float *result, TexParams *p, bNode *node, bNodeStack **in, char is_normal, MapFn map_inputs, short thread)
struct TexCallData TexCallData
void tex_do_preview(bNodePreview *preview, const float coord[2], const float col[4], bool do_manage)
void tex_input_vec(float *out, bNodeStack *in, TexParams *params, short thread)
void tex_node_type_base(struct bNodeType *ntype, int type, const char *name, short nclass, short flag)
float tex_input_value(bNodeStack *in, TexParams *params, short thread)
void tex_input_rgba(float *out, bNodeStack *in, TexParams *params, short thread)
void(* TexFn)(float *out, TexParams *params, bNode *node, bNodeStack **in, short thread)
struct TexDelegate TexDelegate
bool tex_node_poll_default(struct bNodeType *ntype, struct bNodeTree *ntree, const char **r_disabled_hint)
void params_from_cdata(TexParams *out, TexCallData *in)
struct TexParams TexParams
void tex_output(bNode *node, bNodeExecData *execdata, bNodeStack **in, bNodeStack *out, TexFn texfn, TexCallData *data)
const float * co
TexResult * target
bNodePreview * preview
bNodeStack * in[MAX_SOCKET]
TexCallData * cdata
const float * co
const float * previewco
Defines a node type.
Definition: BKE_node.h:221