28 b.use_custom_socket_order();
29 b.allow_any_socket_order();
30 b.add_default_layout();
33 b.add_input<
decl::Vector>(
"Center").description(
"Point to rotate around");
39 .description(
"Axis to rotate around");
42 .
description(
"Angle to rotate the input vector by");
47 "The amount of rotation on each axis, around the X, Y, then Z axes in that order");
60 return "node_vector_rotate_axis_angle";
62 return "node_vector_rotate_axis_x";
64 return "node_vector_rotate_axis_y";
66 return "node_vector_rotate_axis_z";
68 return "node_vector_rotate_euler_xyz";
82 if (
name !=
nullptr) {
125 static auto fn = mf::build::SI4_SO<float3, float3, float3, float, float3>(
132 static auto fn = mf::build::SI4_SO<float3, float3, float3, float, float3>(
142 static auto fn = mf::build::SI3_SO<float3, float3, float, float3>(
148 static auto fn = mf::build::SI3_SO<float3, float3, float, float3>(
157 static auto fn = mf::build::SI3_SO<float3, float3, float, float3>(
163 static auto fn = mf::build::SI3_SO<float3, float3, float, float3>(
172 static auto fn = mf::build::SI3_SO<float3, float3, float, float3>(
178 static auto fn = mf::build::SI3_SO<float3, float3, float, float3>(
186 static auto fn = mf::build::SI3_SO<float3, float3, float3, float3>(
192 static auto fn = mf::build::SI3_SO<float3, float3, float3, float3>(
226 int mode = node_->custom1;
227 bool invert = node_->custom2;
229 NodeItem
vector = get_input_value(
"Vector", NodeItem::Type::Vector3);
230 NodeItem center = get_input_value(
"Center", NodeItem::Type::Vector3) *
231 val(MaterialX::Vector3(1.0f, 1.0f, -1.0f));
235 NodeItem rotation = get_input_value(
"Rotation", NodeItem::Type::Vector3) *
236 val(MaterialX::Vector3(1.0f, 1.0f, -1.0f) * 180.0f /
M_PI);
241 NodeItem
angle = get_input_value(
"Angle", NodeItem::Type::Float) * val(
float(180.0f /
M_PI));
242 NodeItem axis = empty();
245 axis = get_input_value(
"Axis", NodeItem::Type::Vector3) *
246 val(MaterialX::Vector3(1.0f, 1.0f, -1.0f));
249 axis = val(MaterialX::Vector3(1.0f, 0.0f, 0.0f));
252 axis = val(MaterialX::Vector3(0.0f, 1.0f, 0.0f));
255 axis = val(MaterialX::Vector3(0.0f, 0.0f, -1.0f));
275 ntype.
ui_name =
"Vector Rotate";
276 ntype.
ui_description =
"Rotate a vector around a pivot point (center)";
279 ntype.
declare = file_ns::sh_node_vector_rotate_declare;
280 ntype.
draw_buttons = file_ns::node_shader_buts_vector_rotate;
281 ntype.
gpu_fn = file_ns::gpu_shader_vector_rotate;
282 ntype.
updatefunc = file_ns::node_shader_update_vector_rotate;
#define NODE_CLASS_OP_VECTOR
#define SH_NODE_VECTOR_ROTATE
#define BLI_assert_unreachable()
void mul_m3_v3(const float M[3][3], float r[3])
bool invert_m3(float mat[3][3])
void eul_to_mat3(float mat[3][3], const float eul[3])
void axis_angle_to_mat3(float R[3][3], const float axis[3], float angle)
@ NODE_VECTOR_ROTATE_TYPE_AXIS
@ NODE_VECTOR_ROTATE_TYPE_AXIS_Z
@ NODE_VECTOR_ROTATE_TYPE_AXIS_X
@ NODE_VECTOR_ROTATE_TYPE_EULER_XYZ
@ NODE_VECTOR_ROTATE_TYPE_AXIS_Y
bool GPU_stack_link(GPUMaterial *mat, const bNode *node, const char *name, GPUNodeStack *in, GPUNodeStack *out,...)
GPUNodeLink * GPU_constant(const float *num)
static double angle(const Eigen::Vector3d &v1, const Eigen::Vector3d &v2)
@ UI_ITEM_R_SPLIT_EMPTY_NAME
void set_matching_fn(const mf::MultiFunction *fn)
void make_available(bNode &node) const
CCL_NAMESPACE_BEGIN ccl_device float invert(const float color, const float factor)
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 float3 sh_node_vector_rotate_around_axis(const float3 &vector, const float3 ¢er, const float3 &axis, const float angle)
static void sh_node_vector_rotate_declare(NodeDeclarationBuilder &b)
static void node_shader_buts_vector_rotate(uiLayout *layout, bContext *, PointerRNA *ptr)
static const mf::MultiFunction * get_multi_function(const bNode &node)
static void sh_node_vector_rotate_build_multi_function(NodeMultiFunctionBuilder &builder)
static float3 sh_node_vector_rotate_euler(const float3 &vector, const float3 ¢er, const float3 &rotation, const bool invert)
static const char * gpu_shader_get_name(int mode)
static int gpu_shader_vector_rotate(GPUMaterial *mat, bNode *node, bNodeExecData *, GPUNodeStack *in, GPUNodeStack *out)
static void node_shader_update_vector_rotate(bNodeTree *ntree, bNode *node)
VecBase< float, 3 > float3
#define NODE_SHADER_MATERIALX_BEGIN
#define NODE_SHADER_MATERIALX_END
void common_node_type_base(blender::bke::bNodeType *ntype, std::string idname, const std::optional< int16_t > legacy_type)
void register_node_type_sh_vector_rotate()
NodeMaterialXFunction materialx_fn
std::string ui_description
NodeGPUExecFunction gpu_fn
NodeMultiFunctionBuildFunction build_multi_function
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)