Blender V4.3
node_shader_fresnel.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2005 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#include "node_shader_util.hh"
6
8
10{
11 b.add_input<decl::Float>("IOR").default_value(1.5f).min(0.0f).max(1000.0f);
12 b.add_input<decl::Vector>("Normal").hide_value();
13 b.add_output<decl::Float>("Fac");
14}
15
17 bNode *node,
18 bNodeExecData * /*execdata*/,
19 GPUNodeStack *in,
20 GPUNodeStack *out)
21{
22 if (!in[1].link) {
23 GPU_link(mat, "world_normals_get", &in[1].link);
24 }
25
26 return GPU_stack_link(mat, node, "node_fresnel", in, out);
27}
28
30#ifdef WITH_MATERIALX
31{
32 /* TODO: some outputs expected be implemented within the next iteration
33 * (see node-definition `<artistic_ior>`). */
34 return get_input_value("IOR", NodeItem::Type::Float);
35}
36#endif
38
39} // namespace blender::nodes::node_shader_fresnel_cc
40
41/* node type definition */
43{
45
46 static blender::bke::bNodeType ntype;
47
49 ntype.declare = file_ns::node_declare;
50 ntype.gpu_fn = file_ns::node_shader_gpu_fresnel;
51 ntype.materialx_fn = file_ns::node_shader_materialx;
52
54}
#define SH_NODE_FRESNEL
Definition BKE_node.hh:916
#define NODE_CLASS_INPUT
Definition BKE_node.hh:404
bool GPU_stack_link(GPUMaterial *mat, const bNode *node, const char *name, GPUNodeStack *in, GPUNodeStack *out,...)
bool GPU_link(GPUMaterial *mat, const char *name,...)
local_group_size(16, 16) .push_constant(Type b
void node_register_type(bNodeType *ntype)
Definition node.cc:1708
static int node_shader_gpu_fresnel(GPUMaterial *mat, bNode *node, bNodeExecData *, GPUNodeStack *in, GPUNodeStack *out)
static void node_declare(NodeDeclarationBuilder &b)
#define NODE_SHADER_MATERIALX_BEGIN
#define NODE_SHADER_MATERIALX_END
void register_node_type_sh_fresnel()
void sh_node_type_base(blender::bke::bNodeType *ntype, int type, const char *name, short nclass)
Defines a node type.
Definition BKE_node.hh:218
NodeMaterialXFunction materialx_fn
Definition BKE_node.hh:320
NodeGPUExecFunction gpu_fn
Definition BKE_node.hh:318
NodeDeclareFunction declare
Definition BKE_node.hh:347