22 "Scale of the texture");
27 .description(
"Amount of distortion");
54 float depth =
tex->depth;
72 builder.single_input<
float3>(
"Vector");
73 builder.single_input<
float>(
"Scale");
74 builder.single_input<
float>(
"Distortion");
76 builder.single_output<
float>(
"Fac", mf::ParamFlag::SupportsUnusedOutput);
92 const bool compute_factor = !r_fac.is_empty();
94 mask.foreach_index([&](
const int64_t i) {
96 const float distort = distortion[i];
97 float x =
sinf((co[0] + co[1] + co[2]) * 5.0f);
98 float y =
cosf((-co[0] + co[1] - co[2]) * 5.0f);
99 float z = -
cosf((-co[0] - co[1] + co[2]) * 5.0f);
105 y = -
cosf(x - y +
z);
117 x = -
cosf(-x + y -
z);
121 y = -
sinf(-x + y +
z);
125 y = -
cosf(-x + y +
z);
137 x = -
cosf(-x - y +
z);
141 y = -
sinf(x - y +
z);
154 if (distort != 0.0f) {
155 const float d = distort * 2.0f;
163 if (compute_factor) {
164 mask.foreach_index([&](
const int64_t i) {
165 r_fac[i] = (r_color[i].r + r_color[i].g + r_color[i].b) * (1.0f / 3.0f);
187 ntype.
declare = file_ns::sh_node_tex_magic_declare;
188 ntype.
draw_buttons = file_ns::node_shader_buts_tex_magic;
189 ntype.
initfunc = file_ns::node_shader_init_tex_magic;
192 ntype.
gpu_fn = file_ns::node_shader_gpu_tex_magic;
#define SH_NODE_TEX_MAGIC
#define NODE_CLASS_TEXTURE
void BKE_texture_mapping_default(struct TexMapping *texmap, int type)
void BKE_texture_colormapping_default(struct ColorMapping *colormap)
bool GPU_stack_link(GPUMaterial *mat, const bNode *node, const char *name, GPUNodeStack *in, GPUNodeStack *out,...)
GPUNodeLink * GPU_constant(const float *num)
void uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname, eUI_Item_Flag flag, const char *name, int icon)
@ UI_ITEM_R_SPLIT_EMPTY_NAME
SIMD_FORCE_INLINE const btScalar & z() const
Return the z value.
const Signature & signature() const
void set_signature(const Signature *signature)
void construct_and_set_matching_fn(Args &&...args)
void call(const IndexMask &mask, mf::Params params, mf::Context) const override
local_group_size(16, 16) .push_constant(Type b
void node_type_storage(bNodeType *ntype, const char *storagename, void(*freefunc)(bNode *node), void(*copyfunc)(bNodeTree *dest_ntree, bNode *dest_node, const bNode *src_node))
void node_register_type(bNodeType *ntype)
static void node_shader_buts_tex_magic(uiLayout *layout, bContext *, PointerRNA *ptr)
static void sh_node_tex_magic_declare(NodeDeclarationBuilder &b)
static void node_shader_init_tex_magic(bNodeTree *, bNode *node)
static void sh_node_magic_tex_build_multi_function(NodeMultiFunctionBuilder &builder)
static int node_shader_gpu_tex_magic(GPUMaterial *mat, bNode *node, bNodeExecData *, GPUNodeStack *in, GPUNodeStack *out)
ColorSceneLinear4f< eAlpha::Premultiplied > ColorGeometry4f
void register_node_type_sh_tex_magic()
void node_shader_gpu_tex_mapping(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *)
void node_shader_gpu_default_tex_coord(GPUMaterial *mat, bNode *node, GPUNodeLink **link)
void sh_fn_node_type_base(blender::bke::bNodeType *ntype, int type, const char *name, short nclass)
void node_free_standard_storage(bNode *node)
void node_copy_standard_storage(bNodeTree *, bNode *dest_node, const bNode *src_node)
void(* initfunc)(bNodeTree *ntree, bNode *node)
NodeGPUExecFunction gpu_fn
NodeMultiFunctionBuildFunction build_multi_function
void(* draw_buttons)(uiLayout *, bContext *C, PointerRNA *ptr)
NodeDeclareFunction declare