19 .default_value({0.0f, 0.0f, 0.0f})
24 .default_value({0.0f, 0.0f, 0.0f})
28 .description(
"The amount of translation along each axis");
30 .default_value({0.0f, 0.0f, 0.0f})
34 .description(
"The amount of rotation along each axis, XYZ order");
36 .default_value({1.0f, 1.0f, 1.0f})
40 .description(
"The amount of scaling along each axis");
53 return "mapping_point";
55 return "mapping_texture";
57 return "mapping_vector";
59 return "mapping_normal";
87 NodeItem
vector = get_input_value(
"Vector", NodeItem::Type::Vector3);
88 NodeItem scale = get_input_value(
"Scale", NodeItem::Type::Vector3);
89 NodeItem rotation = get_input_value(
"Rotation", NodeItem::Type::Vector3) *
90 val(
float(180.0f /
M_PI));
92 int type = node_->custom1;
95 NodeItem location = get_input_value(
"Location", NodeItem::Type::Vector3);
96 return (
vector * scale).rotate(rotation) + location;
99 NodeItem location = get_input_value(
"Location", NodeItem::Type::Vector3);
100 return (
vector - location).rotate(rotation,
true) / scale;
103 return (
vector * scale).rotate(rotation * val(MaterialX::Vector3(1.0f, 1.0f, -1.0f)));
106 return (
vector / scale).rotate(rotation).normalize();
125 ntype.
declare = file_ns::node_declare;
127 ntype.
gpu_fn = file_ns::gpu_shader_mapping;
128 ntype.
updatefunc = file_ns::node_shader_update_mapping;
#define NODE_CLASS_OP_VECTOR
#define BLI_assert_unreachable()
@ NODE_MAPPING_TYPE_POINT
@ NODE_MAPPING_TYPE_VECTOR
@ NODE_MAPPING_TYPE_TEXTURE
@ NODE_MAPPING_TYPE_NORMAL
bool GPU_stack_link(GPUMaterial *mat, const bNode *node, const char *name, GPUNodeStack *in, GPUNodeStack *out,...)
void uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname, eUI_Item_Flag flag, const char *name, int icon)
@ UI_ITEM_R_SPLIT_EMPTY_NAME
local_group_size(16, 16) .push_constant(Type b
void node_set_socket_availability(bNodeTree *ntree, bNodeSocket *sock, bool is_available)
void node_register_type(bNodeType *ntype)
bNodeSocket * node_find_socket(bNode *node, eNodeSocketInOut in_out, StringRef identifier)
static const char * gpu_shader_get_name(int mode)
static void node_shader_buts_mapping(uiLayout *layout, bContext *, PointerRNA *ptr)
static void node_shader_update_mapping(bNodeTree *ntree, bNode *node)
static void node_declare(NodeDeclarationBuilder &b)
static int gpu_shader_mapping(GPUMaterial *mat, bNode *node, bNodeExecData *, GPUNodeStack *in, GPUNodeStack *out)
#define NODE_SHADER_MATERIALX_BEGIN
#define NODE_SHADER_MATERIALX_END
void register_node_type_sh_mapping()
void sh_node_type_base(blender::bke::bNodeType *ntype, int type, const char *name, short nclass)
NodeMaterialXFunction materialx_fn
NodeGPUExecFunction gpu_fn
void(* draw_buttons)(uiLayout *, bContext *C, PointerRNA *ptr)
NodeDeclareFunction declare
void(* updatefunc)(bNodeTree *ntree, bNode *node)