54 float gradient_type =
tex->gradient_type;
68 builder.single_input<
float3>(
"Vector");
69 builder.single_output<
ColorGeometry4f>(
"Color", mf::ParamFlag::SupportsUnusedOutput);
70 builder.single_output<
float>(
"Fac");
84 const bool compute_color = !r_color.is_empty();
86 switch (gradient_type_) {
88 mask.foreach_index([&](
const int64_t i) { fac[i] =
vector[i].x; });
92 mask.foreach_index([&](
const int64_t i) {
93 const float r = std::max(
vector[i].x, 0.0f);
99 mask.foreach_index([&](
const int64_t i) {
100 const float r = std::min(std::max(
vector[i].x, 0.0f), 1.0f);
101 const float t = r * r;
102 fac[i] = (3.0f * t - 2.0f * t * r);
111 mask.foreach_index([&](
const int64_t i) {
117 mask.foreach_index([&](
const int64_t i) {
127 mask.foreach_index([&](
const int64_t i) {
154 const int gradient_type =
tex->gradient_type;
155 NodeItem
vector = get_input_link(
"Vector", NodeItem::Type::Vector2);
159 NodeItem res = empty();
161 switch (gradient_type) {
171 res = res * res * (val(3.0f) - val(2.0f) * res);
203 ntype.
declare = file_ns::sh_node_tex_gradient_declare;
204 ntype.
draw_buttons = file_ns::node_shader_buts_tex_gradient;
205 ntype.
initfunc = file_ns::node_shader_init_tex_gradient;
208 ntype.
gpu_fn = file_ns::node_shader_gpu_tex_gradient;
#define SH_NODE_TEX_GRADIENT
#define NODE_CLASS_TEXTURE
void BKE_texture_mapping_default(struct TexMapping *texmap, int type)
void BKE_texture_colormapping_default(struct ColorMapping *colormap)
#define BLI_assert_unreachable()
@ SHD_BLEND_QUADRATIC_SPHERE
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
const Signature & signature() const
void set_signature(const Signature *signature)
void construct_and_set_matching_fn(Args &&...args)
GradientFunction(int gradient_type)
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)
T length(const VecBase< T, Size > &a)
static void node_shader_init_tex_gradient(bNodeTree *, bNode *node)
static void sh_node_tex_gradient_declare(NodeDeclarationBuilder &b)
static int node_shader_gpu_tex_gradient(GPUMaterial *mat, bNode *node, bNodeExecData *, GPUNodeStack *in, GPUNodeStack *out)
static void node_shader_buts_tex_gradient(uiLayout *layout, bContext *, PointerRNA *ptr)
static void sh_node_gradient_tex_build_multi_function(NodeMultiFunctionBuilder &builder)
ColorSceneLinear4f< eAlpha::Premultiplied > ColorGeometry4f
#define NODE_SHADER_MATERIALX_BEGIN
#define NODE_SHADER_MATERIALX_END
void register_node_type_sh_tex_gradient()
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)
NodeMaterialXFunction materialx_fn
void(* initfunc)(bNodeTree *ntree, bNode *node)
NodeGPUExecFunction gpu_fn
NodeMultiFunctionBuildFunction build_multi_function
void(* draw_buttons)(uiLayout *, bContext *C, PointerRNA *ptr)
NodeDeclareFunction declare