/* SPDX-License-Identifier: GPL-2.0-or-later * Copyright 2005 Blender Foundation. All rights reserved. */ /** \file * \ingroup texnodes */ #include "NOD_texture.h" #include "node_texture_util.h" /* **************** INVERT ******************** */ static bNodeSocketTemplate inputs[] = { {SOCK_RGBA, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f}, {-1, ""}, }; static bNodeSocketTemplate outputs[] = { {SOCK_RGBA, N_("Color")}, {-1, ""}, }; static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread) { float col[4]; tex_input_rgba(col, in[0], p, thread); col[0] = 1.0f - col[0]; col[1] = 1.0f - col[1]; col[2] = 1.0f - col[2]; copy_v3_v3(out, col); out[3] = col[3]; } static void exec(void *data, int UNUSED(thread), bNode *node, bNodeExecData *execdata, bNodeStack **in, bNodeStack **out) { tex_output(node, execdata, in, out[0], &colorfn, data); } void register_node_type_tex_invert(void) { static bNodeType ntype; tex_node_type_base(&ntype, TEX_NODE_INVERT, "Invert", NODE_CLASS_OP_COLOR); node_type_socket_templates(&ntype, inputs, outputs); ntype.exec_fn = exec; nodeRegisterType(&ntype); }