17 b.add_input<
decl::Vector>(
"Vector").
min(-10000.0f).max(10000.0f).implicit_field(
20 .default_value({0.8f, 0.8f, 0.8f, 1.0f})
21 .description(
"Color of the first checker");
23 .default_value({0.2f, 0.2f, 0.2f, 1.0f})
24 .description(
"Color of the second checker");
31 "Overall texture scale.\n"
32 "The scale is a factor of the bounding box of the face divided by the Scale value");
65 builder.single_input<
float3>(
"Vector");
68 builder.single_input<
float>(
"Scale");
69 builder.single_output<
ColorGeometry4f>(
"Color", mf::ParamFlag::SupportsUnusedOutput);
70 builder.single_output<
float>(
"Fac");
88 mask.foreach_index([&](
const int64_t i) {
90 const float3 p = (
vector[i] * scale[i] + 0.000001f) * 0.999999f;
96 r_fac[i] = ((xi % 2 == yi % 2) == (zi % 2)) ? 1.0f : 0.0f;
99 if (!r_color.is_empty()) {
101 [&](
const int64_t i) { r_color[i] = (r_fac[i] == 1.0f) ? color1[i] : color2[i]; });
115 NodeItem
vector = get_input_link(
"Vector", NodeItem::Type::Vector2);
119 NodeItem value1 = val(1.0f);
120 NodeItem value2 = val(0.0f);
121 if (
STREQ(socket_out_->name,
"Color")) {
122 value1 = get_input_value(
"Color1", NodeItem::Type::Color4);
123 value2 = get_input_value(
"Color2", NodeItem::Type::Color4);
125 NodeItem scale = get_input_value(
"Scale", NodeItem::Type::Float);
129 .if_else(NodeItem::CompareOp::Eq, val(1.0f), value1, value2);
143 ntype.
declare = file_ns::sh_node_tex_checker_declare;
144 ntype.
initfunc = file_ns::node_shader_init_tex_checker;
147 ntype.
gpu_fn = file_ns::node_shader_gpu_tex_checker;
#define SH_NODE_TEX_CHECKER
#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,...)
const Signature & signature() const
void set_signature(const Signature *signature)
void set_matching_fn(const mf::MultiFunction *fn)
void call(const IndexMask &mask, mf::Params params, mf::Context) const override
local_group_size(16, 16) .push_constant(Type b
ccl_device_inline float2 floor(const float2 a)
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 sh_node_tex_checker_declare(NodeDeclarationBuilder &b)
static void sh_node_tex_checker_build_multi_function(NodeMultiFunctionBuilder &builder)
static void node_shader_init_tex_checker(bNodeTree *, bNode *node)
static int node_shader_gpu_tex_checker(GPUMaterial *mat, bNode *node, bNodeExecData *, GPUNodeStack *in, GPUNodeStack *out)
#define NODE_SHADER_MATERIALX_BEGIN
#define NODE_SHADER_MATERIALX_END
void register_node_type_sh_tex_checker()
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
NodeDeclareFunction declare
ccl_device_inline int abs(int x)