2011-02-23 10:52:22 +00:00
|
|
|
/*
|
2008-11-12 22:03:11 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
2018-06-01 18:19:39 +02:00
|
|
|
* of the License, or (at your option) any later version.
|
2008-11-12 22:03:11 +00:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2008-11-12 22:03:11 +00:00
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2005 Blender Foundation.
|
|
|
|
* All rights reserved.
|
|
|
|
*/
|
|
|
|
|
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
|
|
|
|
|
|
|
#include <math.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
|
|
|
|
#include "DNA_ID.h"
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "DNA_color_types.h"
|
2008-11-12 22:03:11 +00:00
|
|
|
#include "DNA_image_types.h"
|
|
|
|
#include "DNA_material_types.h"
|
|
|
|
#include "DNA_node_types.h"
|
|
|
|
#include "DNA_object_types.h"
|
|
|
|
#include "DNA_scene_types.h"
|
|
|
|
#include "DNA_texture_types.h"
|
|
|
|
|
2013-01-24 21:57:13 +00:00
|
|
|
#include "BLI_blenlib.h"
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "BLI_math.h"
|
2013-01-24 21:57:13 +00:00
|
|
|
#include "BLI_rand.h"
|
|
|
|
#include "BLI_threads.h"
|
|
|
|
#include "BLI_utildefines.h"
|
|
|
|
|
2017-12-07 15:36:26 +11:00
|
|
|
#include "BKE_colorband.h"
|
2008-11-12 22:03:11 +00:00
|
|
|
#include "BKE_colortools.h"
|
|
|
|
#include "BKE_global.h"
|
|
|
|
#include "BKE_image.h"
|
|
|
|
#include "BKE_main.h"
|
|
|
|
#include "BKE_material.h"
|
2011-02-08 09:02:16 +00:00
|
|
|
#include "BKE_node.h"
|
2008-11-12 22:03:11 +00:00
|
|
|
#include "BKE_texture.h"
|
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
#include "NOD_texture.h"
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "node_util.h"
|
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
|
|
|
|
2008-11-12 22:03:11 +00:00
|
|
|
#include "IMB_imbuf.h"
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "IMB_imbuf_types.h"
|
2008-11-12 22:03:11 +00:00
|
|
|
|
|
|
|
#include "RE_pipeline.h"
|
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
|
|
|
|
|
2008-11-12 22:03:11 +00:00
|
|
|
typedef struct TexCallData {
|
|
|
|
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
|
|
|
|
2010-02-16 15:45:19 +00:00
|
|
|
MTex *mtex;
|
2008-11-12 22:03:11 +00:00
|
|
|
} TexCallData;
|
|
|
|
|
2009-08-17 20:30:11 +00:00
|
|
|
typedef 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 */
|
2010-02-16 15:45:19 +00:00
|
|
|
MTex *mtex;
|
2009-08-17 20:30:11 +00:00
|
|
|
} TexParams;
|
|
|
|
|
|
|
|
typedef void (*TexFn)(float *out, TexParams *params, bNode *node, bNodeStack **in, short thread);
|
2008-11-12 22:03:11 +00:00
|
|
|
|
|
|
|
typedef 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;
|
|
|
|
} TexDelegate;
|
|
|
|
|
2021-04-12 18:43:23 +02:00
|
|
|
bool tex_node_poll_default(struct bNodeType *ntype,
|
|
|
|
struct bNodeTree *ntree,
|
|
|
|
const char **r_disabled_hint);
|
2013-03-18 16:34:57 +00:00
|
|
|
void tex_node_type_base(
|
|
|
|
struct bNodeType *ntype, int type, const char *name, short nclass, short flag);
|
|
|
|
|
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);
|
2014-02-24 20:18:51 +01:00
|
|
|
void tex_do_preview(bNodePreview *preview,
|
|
|
|
const float coord[2],
|
|
|
|
const float col[4],
|
|
|
|
bool do_manage);
|
2008-11-12 22:03:11 +00:00
|
|
|
|
2009-08-17 20:30:11 +00:00
|
|
|
void params_from_cdata(TexParams *out, TexCallData *in);
|
|
|
|
|
2020-06-30 14:01:34 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|