Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/shader/nodes/node_shader_camera.cc
| Show All 18 Lines | |||||
| /** \file | /** \file | ||||
| * \ingroup shdnodes | * \ingroup shdnodes | ||||
| */ | */ | ||||
| #include "node_shader_util.hh" | #include "node_shader_util.hh" | ||||
| /* **************** CAMERA INFO ******************** */ | /* **************** CAMERA INFO ******************** */ | ||||
| namespace blender::nodes::node_shader_camera_cc { | |||||
| static bNodeSocketTemplate sh_node_camera_out[] = { | static bNodeSocketTemplate sh_node_camera_out[] = { | ||||
| {SOCK_VECTOR, N_("View Vector")}, | {SOCK_VECTOR, N_("View Vector")}, | ||||
| {SOCK_FLOAT, N_("View Z Depth")}, | {SOCK_FLOAT, N_("View Z Depth")}, | ||||
| {SOCK_FLOAT, N_("View Distance")}, | {SOCK_FLOAT, N_("View Distance")}, | ||||
| {-1, ""}, | {-1, ""}, | ||||
| }; | }; | ||||
| static int gpu_shader_camera(GPUMaterial *mat, | static int gpu_shader_camera(GPUMaterial *mat, | ||||
| bNode *node, | bNode *node, | ||||
| bNodeExecData *UNUSED(execdata), | bNodeExecData *UNUSED(execdata), | ||||
| GPUNodeStack *in, | GPUNodeStack *in, | ||||
| GPUNodeStack *out) | GPUNodeStack *out) | ||||
| { | { | ||||
| GPUNodeLink *viewvec; | GPUNodeLink *viewvec; | ||||
| viewvec = GPU_builtin(GPU_VIEW_POSITION); | viewvec = GPU_builtin(GPU_VIEW_POSITION); | ||||
| GPU_link(mat, "invert_z", viewvec, &viewvec); | GPU_link(mat, "invert_z", viewvec, &viewvec); | ||||
| return GPU_stack_link(mat, node, "camera", in, out, viewvec); | return GPU_stack_link(mat, node, "camera", in, out, viewvec); | ||||
| } | } | ||||
| } // namespace blender::nodes::node_shader_camera_cc | |||||
| void register_node_type_sh_camera() | void register_node_type_sh_camera() | ||||
| { | { | ||||
| namespace file_ns = blender::nodes::node_shader_camera_cc; | |||||
| static bNodeType ntype; | static bNodeType ntype; | ||||
| sh_node_type_base(&ntype, SH_NODE_CAMERA, "Camera Data", NODE_CLASS_INPUT, 0); | sh_node_type_base(&ntype, SH_NODE_CAMERA, "Camera Data", NODE_CLASS_INPUT, 0); | ||||
| node_type_socket_templates(&ntype, nullptr, sh_node_camera_out); | node_type_socket_templates(&ntype, nullptr, file_ns::sh_node_camera_out); | ||||
| node_type_storage(&ntype, "", nullptr, nullptr); | node_type_storage(&ntype, "", nullptr, nullptr); | ||||
| node_type_gpu(&ntype, gpu_shader_camera); | node_type_gpu(&ntype, file_ns::gpu_shader_camera); | ||||
| nodeRegisterType(&ntype); | nodeRegisterType(&ntype); | ||||
| } | } | ||||