21 .default_value({0.0f, 0.0f, 0.0f})
24 .description(
"The vector to be transformed");
26 .default_value({0.0f, 0.0f, 0.0f})
30 .description(
"The amount of translation along each axis");
32 .default_value({0.0f, 0.0f, 0.0f})
36 .description(
"The amount of rotation along each axis, XYZ order");
38 .default_value({1.0f, 1.0f, 1.0f})
42 .description(
"The amount of scaling along each axis");
55 return "mapping_point";
57 return "mapping_texture";
59 return "mapping_vector";
61 return "mapping_normal";
89 NodeItem vector = get_input_value(
"Vector", NodeItem::Type::Vector3);
90 NodeItem
scale = get_input_value(
"Scale", NodeItem::Type::Vector3);
91 NodeItem rotation = get_input_value(
"Rotation", NodeItem::Type::Vector3) *
92 val(
float(180.0f /
M_PI));
94 int type = node_->custom1;
97 NodeItem location = get_input_value(
"Location", NodeItem::Type::Vector3);
98 return (vector *
scale).rotate(rotation) + location;
101 NodeItem location = get_input_value(
"Location", NodeItem::Type::Vector3);
102 return (vector - location).rotate(rotation,
true) /
scale;
105 return (
vector *
scale).rotate(rotation * val(MaterialX::Vector3(1.0f, 1.0f, -1.0f)));
108 return (vector /
scale).rotate(rotation).normalize();
128 ntype.
ui_description =
"Transform the input vector by applying translation, rotation, and scale";
131 ntype.
declare = file_ns::node_declare;
133 ntype.
gpu_fn = file_ns::gpu_shader_mapping;
134 ntype.
updatefunc = file_ns::node_shader_update_mapping;
#define NODE_CLASS_OP_VECTOR
#define BLI_assert_unreachable()
float3x3 scale(float3x3 mat, float2 scale)
@ NODE_MAPPING_TYPE_VECTOR
void node_register_type(bNodeType &ntype)
void node_set_socket_availability(bNodeTree &ntree, bNodeSocket &sock, bool is_available)
bNodeSocket * node_find_socket(bNode &node, eNodeSocketInOut in_out, UString identifier)
static const char * gpu_shader_get_name(int mode)
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)
static void node_shader_buts_mapping(ui::Layout &layout, bContext *, PointerRNA *ptr)
@ ITEM_R_SPLIT_EMPTY_NAME
bool GPU_stack_link(GPUMaterial *mat, const bNode *node, const char *name, GPUNodeStack *in, GPUNodeStack *out,...)
@ NODE_MAPPING_TYPE_VECTOR
@ NODE_MAPPING_TYPE_POINT
@ NODE_MAPPING_TYPE_NORMAL
@ NODE_MAPPING_TYPE_TEXTURE
void sh_node_type_base(bke::bNodeType *ntype, UString idname, const std::optional< int16_t > legacy_type)
void register_node_type_sh_mapping()
#define NODE_SHADER_MATERIALX_BEGIN
#define NODE_SHADER_MATERIALX_END
NodeMaterialXFunction materialx_fn
void(*) draw_buttons(ui::Layout &, bContext *C, PointerRNA *ptr)
std::string ui_description
void(*) updatefunc(bNodeTree *ntree, bNode *node)
NodeGPUExecFunction gpu_fn
const char * enum_name_legacy
NodeDeclareFunction declare
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< StringRef > name_opt, int icon, std::optional< StringRef > placeholder=std::nullopt)