26 .
description(
"Strength of the normal mapping effect");
28 .default_value({0.5f, 0.5f, 1.0f, 1.0f})
29 .description(
"Color that encodes the normal map in the specified space");
72 strength = in[0].link;
74 else if (node->runtime->original) {
87 newnormal = in[1].link;
89 else if (node->runtime->original) {
99 const char *color_to_normal_fnc_name =
"color_to_normal_new_shading";
101 color_to_normal_fnc_name =
"color_to_blender_normal_new_shading";
104 GPU_link(mat, color_to_normal_fnc_name, newnormal, &newnormal);
119 GPU_link(mat,
"normal_transform_object_to_world", newnormal, &newnormal);
128 GPU_link(mat,
"node_normal_map_mix", strength, newnormal, &out[0].link);
137 NodeItem color = get_input_value(
"Color", NodeItem::Type::Vector3);
138 NodeItem strength = get_input_value(
"Strength", NodeItem::Type::Float);
141 switch (normal_map_node->
space) {
158 return create_node(
"normalmap",
159 NodeItem::Type::Vector3,
160 {{
"in", color}, {
"scale", strength}, {
"space", val(space)}});
175 ntype.
declare = file_ns::node_declare;
176 ntype.
draw_buttons = file_ns::node_shader_buts_normal_map;
178 ntype.
initfunc = file_ns::node_shader_init_normal_map;
181 ntype.
gpu_fn = file_ns::gpu_shader_normal_map;
PointerRNA CTX_data_pointer_get(const bContext *C, const char *member)
Depsgraph * CTX_data_depsgraph_pointer(const bContext *C)
#define SH_NODE_NORMAL_MAP
#define NODE_CLASS_OP_VECTOR
#define BLI_assert_unreachable()
void * BLI_findlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void DEG_get_evaluated_rna_pointer(const Depsgraph *depsgraph, PointerRNA *ptr, PointerRNA *r_ptr_eval)
@ SHD_SPACE_BLENDER_OBJECT
@ SHD_SPACE_BLENDER_WORLD
GPUNodeLink * GPU_constant(const float *num)
@ GPU_MATFLAG_OBJECT_INFO
void GPU_material_flag_set(GPUMaterial *mat, eGPUMaterialFlag flag)
GPUNodeLink * GPU_attribute(GPUMaterial *mat, eCustomDataType type, const char *name)
bool GPU_link(GPUMaterial *mat, const char *name,...)
GPUNodeLink * GPU_uniform(const float *num)
void uiItemPointerR(uiLayout *layout, PointerRNA *ptr, const char *propname, PointerRNA *searchptr, const char *searchpropname, const char *name, int icon)
void uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname, eUI_Item_Flag flag, const char *name, int icon)
@ UI_ITEM_R_SPLIT_EMPTY_NAME
local_group_size(16, 16) .push_constant(Type b
const Depsgraph * depsgraph
void node_type_size_preset(bNodeType *ntype, eNodeSizePreset size)
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 int gpu_shader_normal_map(GPUMaterial *mat, bNode *node, bNodeExecData *, GPUNodeStack *in, GPUNodeStack *out)
static void node_shader_buts_normal_map(uiLayout *layout, bContext *C, PointerRNA *ptr)
static void node_declare(NodeDeclarationBuilder &b)
static void node_shader_init_normal_map(bNodeTree *, bNode *node)
#define NODE_SHADER_MATERIALX_BEGIN
#define NODE_SHADER_MATERIALX_END
void register_node_type_sh_normal_map()
void sh_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)
PointerRNA RNA_pointer_get(PointerRNA *ptr, const char *name)
int RNA_enum_get(PointerRNA *ptr, const char *name)
NodeMaterialXFunction materialx_fn
void(* initfunc)(bNodeTree *ntree, bNode *node)
NodeGPUExecFunction gpu_fn
void(* draw_buttons)(uiLayout *, bContext *C, PointerRNA *ptr)
NodeDeclareFunction declare