Blender  V3.3
node_texture_util.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2005 Blender Foundation. All rights reserved. */
3 
8 #pragma once
9 
10 #include <math.h>
11 #include <string.h>
12 
13 #include "MEM_guardedalloc.h"
14 
15 #include "DNA_ID.h"
16 #include "DNA_color_types.h"
17 #include "DNA_image_types.h"
18 #include "DNA_material_types.h"
19 #include "DNA_node_types.h"
20 #include "DNA_object_types.h"
21 #include "DNA_scene_types.h"
22 #include "DNA_texture_types.h"
23 
24 #include "BLI_math_vector.h"
25 #include "BLI_rand.h"
26 #include "BLI_threads.h"
27 #include "BLI_utildefines.h"
28 
29 #include "BKE_colorband.h"
30 #include "BKE_colortools.h"
31 #include "BKE_global.h"
32 #include "BKE_image.h"
33 #include "BKE_main.h"
34 #include "BKE_material.h"
35 #include "BKE_node.h"
36 #include "BKE_texture.h"
37 
38 #include "NOD_texture.h"
39 #include "node_util.h"
40 
41 #include "BLT_translation.h"
42 
43 #include "IMB_imbuf.h"
44 #include "IMB_imbuf_types.h"
45 
46 #include "RE_pipeline.h"
47 #include "RE_texture.h"
48 
49 #ifdef __cplusplus
50 extern "C" {
51 #endif
52 
53 typedef struct TexCallData {
55  /* all float[3] */
56  const float *co;
57  float *dxt, *dyt;
58 
59  int osatex;
60  bool do_preview;
61  bool do_manage;
62  short thread;
63  short which_output;
64  int cfra;
65 
68 
69 typedef struct TexParams {
70  const float *co;
71  float *dxt, *dyt;
72  const float *previewco;
73  int cfra;
74  int osatex;
75 
76  /* optional. we don't really want these here, but image
77  * textures need to do mapping & color correction */
80 
81 typedef void (*TexFn)(float *out, TexParams *params, bNode *node, bNodeStack **in, short thread);
82 
83 typedef struct TexDelegate {
89  int type;
91 
92 bool tex_node_poll_default(struct bNodeType *ntype,
93  struct bNodeTree *ntree,
94  const char **r_disabled_hint);
95 void tex_node_type_base(struct bNodeType *ntype, int type, const char *name, short nclass);
96 
97 void tex_input_rgba(float *out, bNodeStack *in, TexParams *params, short thread);
98 void tex_input_vec(float *out, bNodeStack *in, TexParams *params, short thread);
100 
101 void tex_output(bNode *node,
102  bNodeExecData *execdata,
103  bNodeStack **in,
104  bNodeStack *out,
105  TexFn texfn,
106  TexCallData *data);
107 
109 
111 void ntreeReleaseThreadStack(struct bNodeThreadStack *nts);
113  struct bNodeThreadStack *nts,
114  void *callerdata,
115  int thread);
116 
118  struct bNodeTree *ntree,
119  bNodeInstanceKey parent_key);
121 
122 #ifdef __cplusplus
123 }
124 #endif
General operations, lookup, etc. for materials.
#define MAX_SOCKET
Definition: BKE_node.h:30
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.
Definition: thread.h:34
OperationNode * node
SyclQueue void void size_t num_bytes void
bNodeTree * ntree
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
static const pxr::TfToken out("out", pxr::TfToken::Immortal)
static void exec(void *data, int UNUSED(thread), bNode *node, bNodeExecData *execdata, bNodeStack **in, bNodeStack **out)
static void texfn(float *result, TexParams *p, bNode *node, bNodeStack **in, MapFn map_inputs, short thread)
void ntreeReleaseThreadStack(struct bNodeThreadStack *nts)
struct TexCallData TexCallData
void tex_input_vec(float *out, bNodeStack *in, TexParams *params, short thread)
struct bNodeTreeExec * ntreeTexBeginExecTree_internal(struct bNodeExecContext *context, struct bNodeTree *ntree, bNodeInstanceKey parent_key)
float tex_input_value(bNodeStack *in, TexParams *params, short thread)
struct bNodeThreadStack * ntreeGetThreadStack(struct bNodeTreeExec *exec, int 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)
void tex_node_type_base(struct bNodeType *ntype, int type, const char *name, short nclass)
void ntreeTexEndExecTree_internal(struct bNodeTreeExec *exec)
struct TexDelegate TexDelegate
bool tex_node_poll_default(struct bNodeType *ntype, struct bNodeTree *ntree, const char **r_disabled_hint)
bool ntreeExecThreadNodes(struct bNodeTreeExec *exec, struct bNodeThreadStack *nts, void *callerdata, int thread)
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:226