2023-08-16 00:20:26 +10:00
|
|
|
/* SPDX-FileCopyrightText: 2005 Blender Authors
|
2023-05-31 16:19:06 +02:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
2008-11-12 22:03:11 +00:00
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup nodes
|
2011-02-27 20:13:22 +00:00
|
|
|
*/
|
|
|
|
|
|
2012-02-17 18:59:41 +00:00
|
|
|
#pragma once
|
2008-11-12 22:03:11 +00:00
|
|
|
|
2023-05-15 15:14:22 +02:00
|
|
|
#include "BKE_node.hh"
|
2022-11-26 13:20:18 +01:00
|
|
|
|
|
|
|
|
#include "node_texture_register.hh"
|
2008-11-12 22:03:11 +00:00
|
|
|
|
2015-08-16 17:32:01 +10:00
|
|
|
#include "BLT_translation.h"
|
2012-06-02 19:58:12 +00:00
|
|
|
|
2020-11-09 15:42:38 +01:00
|
|
|
#include "RE_texture.h"
|
2008-11-12 22:03:11 +00:00
|
|
|
|
2020-06-30 14:01:34 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
2023-08-03 01:11:28 +02:00
|
|
|
struct bNodeThreadStack;
|
|
|
|
|
|
|
|
|
|
struct TexCallData {
|
2008-11-12 22:03:11 +00:00
|
|
|
TexResult *target;
|
2012-10-15 23:11:59 +00:00
|
|
|
/* all float[3] */
|
2020-10-01 16:56:24 +02:00
|
|
|
const float *co;
|
2009-08-17 20:30:11 +00:00
|
|
|
float *dxt, *dyt;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2010-02-16 15:45:19 +00:00
|
|
|
int osatex;
|
2014-02-24 20:18:51 +01:00
|
|
|
bool do_preview;
|
|
|
|
|
bool do_manage;
|
2008-11-12 22:03:11 +00:00
|
|
|
short thread;
|
|
|
|
|
short which_output;
|
2009-01-04 14:14:06 +00:00
|
|
|
int cfra;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2023-08-05 14:26:29 +10:00
|
|
|
const MTex *mtex;
|
2023-08-03 01:11:28 +02:00
|
|
|
};
|
2008-11-12 22:03:11 +00:00
|
|
|
|
2023-08-03 01:11:28 +02:00
|
|
|
struct TexParams {
|
2020-10-01 16:56:24 +02:00
|
|
|
const float *co;
|
2009-08-17 20:30:11 +00:00
|
|
|
float *dxt, *dyt;
|
2012-10-15 23:11:59 +00:00
|
|
|
const float *previewco;
|
2009-08-17 20:30:11 +00:00
|
|
|
int cfra;
|
2010-02-16 15:45:19 +00:00
|
|
|
int osatex;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2010-02-16 15:45:19 +00:00
|
|
|
/* optional. we don't really want these here, but image
|
2012-06-30 22:49:33 +00:00
|
|
|
* textures need to do mapping & color correction */
|
2023-08-05 14:26:29 +10:00
|
|
|
const MTex *mtex;
|
2023-08-03 01:11:28 +02:00
|
|
|
};
|
2009-08-17 20:30:11 +00:00
|
|
|
|
|
|
|
|
typedef void (*TexFn)(float *out, TexParams *params, bNode *node, bNodeStack **in, short thread);
|
2008-11-12 22:03:11 +00:00
|
|
|
|
2023-08-03 01:11:28 +02:00
|
|
|
struct TexDelegate {
|
2009-10-07 14:48:29 +00:00
|
|
|
TexCallData *cdata;
|
2008-11-12 22:03:11 +00:00
|
|
|
TexFn fn;
|
|
|
|
|
bNode *node;
|
2013-03-18 16:34:57 +00:00
|
|
|
bNodePreview *preview;
|
2008-11-12 22:03:11 +00:00
|
|
|
bNodeStack *in[MAX_SOCKET];
|
|
|
|
|
int type;
|
2023-08-03 01:11:28 +02:00
|
|
|
};
|
2008-11-12 22:03:11 +00:00
|
|
|
|
2023-08-03 01:11:28 +02:00
|
|
|
bool tex_node_poll_default(const bNodeType *ntype,
|
|
|
|
|
const bNodeTree *ntree,
|
2021-04-12 18:43:23 +02:00
|
|
|
const char **r_disabled_hint);
|
2023-08-03 01:11:28 +02:00
|
|
|
void tex_node_type_base(bNodeType *ntype, int type, const char *name, short nclass);
|
2013-03-18 16:34:57 +00:00
|
|
|
|
2009-08-17 20:30:11 +00:00
|
|
|
void tex_input_rgba(float *out, bNodeStack *in, TexParams *params, short thread);
|
|
|
|
|
void tex_input_vec(float *out, bNodeStack *in, TexParams *params, short thread);
|
|
|
|
|
float tex_input_value(bNodeStack *in, TexParams *params, short thread);
|
2008-11-12 22:03:11 +00:00
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
void tex_output(bNode *node,
|
|
|
|
|
bNodeExecData *execdata,
|
|
|
|
|
bNodeStack **in,
|
|
|
|
|
bNodeStack *out,
|
|
|
|
|
TexFn texfn,
|
|
|
|
|
TexCallData *data);
|
2008-11-12 22:03:11 +00:00
|
|
|
|
2009-08-17 20:30:11 +00:00
|
|
|
void params_from_cdata(TexParams *out, TexCallData *in);
|
|
|
|
|
|
2023-08-03 01:11:28 +02:00
|
|
|
bNodeThreadStack *ntreeGetThreadStack(bNodeTreeExec *exec, int thread);
|
|
|
|
|
void ntreeReleaseThreadStack(bNodeThreadStack *nts);
|
|
|
|
|
bool ntreeExecThreadNodes(bNodeTreeExec *exec,
|
|
|
|
|
bNodeThreadStack *nts,
|
2022-01-26 15:28:05 -05:00
|
|
|
void *callerdata,
|
|
|
|
|
int thread);
|
|
|
|
|
|
2023-08-03 01:11:28 +02:00
|
|
|
bNodeTreeExec *ntreeTexBeginExecTree_internal(bNodeExecContext *context,
|
|
|
|
|
bNodeTree *ntree,
|
|
|
|
|
bNodeInstanceKey parent_key);
|
|
|
|
|
void ntreeTexEndExecTree_internal(bNodeTreeExec *exec);
|
2022-01-26 15:28:05 -05:00
|
|
|
|
2020-06-30 14:01:34 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|