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();
126 ntype.
ui_description =
"Transform the input vector by applying translation, rotation, and scale";
129 ntype.
declare = file_ns::node_declare;
131 ntype.
gpu_fn = file_ns::gpu_shader_mapping;
132 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,...)
@ UI_ITEM_R_SPLIT_EMPTY_NAME
bNodeSocket * node_find_socket(bNode &node, eNodeSocketInOut in_out, StringRef identifier)
void node_register_type(bNodeType &ntype)
void node_set_socket_availability(bNodeTree &ntree, bNodeSocket &sock, bool is_available)
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, std::string idname, const std::optional< int16_t > legacy_type)
NodeMaterialXFunction materialx_fn
std::string ui_description
NodeGPUExecFunction gpu_fn
const char * enum_name_legacy
void(* draw_buttons)(uiLayout *, bContext *C, PointerRNA *ptr)
NodeDeclareFunction declare
void(* updatefunc)(bNodeTree *ntree, bNode *node)
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< blender::StringRef > name_opt, int icon, std::optional< blender::StringRef > placeholder=std::nullopt)