Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/shader/nodes/node_shader_uvmap.c
- This file was moved from source/blender/nodes/shader/nodes/node_shader_uvmap.cc.
| Show All 11 Lines | |||||
| * You should have received a copy of the GNU General Public License | * You should have received a copy of the GNU General Public License | ||||
| * along with this program; if not, write to the Free Software Foundation, | * along with this program; if not, write to the Free Software Foundation, | ||||
| * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||||
| * | * | ||||
| * The Original Code is Copyright (C) 2005 Blender Foundation. | * The Original Code is Copyright (C) 2005 Blender Foundation. | ||||
| * All rights reserved. | * All rights reserved. | ||||
| */ | */ | ||||
| #include "node_shader_util.hh" | #include "../node_shader_util.h" | ||||
| #include "DNA_customdata_types.h" | #include "DNA_customdata_types.h" | ||||
| /* **************** OUTPUT ******************** */ | /* **************** OUTPUT ******************** */ | ||||
| namespace blender::nodes::node_shader_uvmap_cc { | |||||
| static bNodeSocketTemplate sh_node_uvmap_out[] = { | static bNodeSocketTemplate sh_node_uvmap_out[] = { | ||||
| {SOCK_VECTOR, N_("UV"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, | {SOCK_VECTOR, N_("UV"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, | ||||
| {-1, ""}, | {-1, ""}, | ||||
| }; | }; | ||||
| static void node_shader_init_uvmap(bNodeTree *UNUSED(ntree), bNode *node) | static void node_shader_init_uvmap(bNodeTree *UNUSED(ntree), bNode *node) | ||||
| { | { | ||||
| NodeShaderUVMap *attr = (NodeShaderUVMap *)MEM_callocN(sizeof(NodeShaderUVMap), | NodeShaderUVMap *attr = MEM_callocN(sizeof(NodeShaderUVMap), "NodeShaderUVMap"); | ||||
| "NodeShaderUVMap"); | |||||
| node->storage = attr; | node->storage = attr; | ||||
| } | } | ||||
| static int node_shader_gpu_uvmap(GPUMaterial *mat, | static int node_shader_gpu_uvmap(GPUMaterial *mat, | ||||
| bNode *node, | bNode *node, | ||||
| bNodeExecData *UNUSED(execdata), | bNodeExecData *UNUSED(execdata), | ||||
| GPUNodeStack *in, | GPUNodeStack *in, | ||||
| GPUNodeStack *out) | GPUNodeStack *out) | ||||
| { | { | ||||
| NodeShaderUVMap *attr = (NodeShaderUVMap *)node->storage; | NodeShaderUVMap *attr = node->storage; | ||||
| GPUNodeLink *mtface = GPU_attribute(mat, CD_MTFACE, attr->uv_map); | GPUNodeLink *mtface = GPU_attribute(mat, CD_MTFACE, attr->uv_map); | ||||
| GPU_stack_link(mat, node, "node_uvmap", in, out, mtface); | GPU_stack_link(mat, node, "node_uvmap", in, out, mtface); | ||||
| node_shader_gpu_bump_tex_coord(mat, node, &out[0].link); | node_shader_gpu_bump_tex_coord(mat, node, &out[0].link); | ||||
| return 1; | return 1; | ||||
| } | } | ||||
| } // namespace blender::nodes::node_shader_uvmap_cc | |||||
| /* node type definition */ | /* node type definition */ | ||||
| void register_node_type_sh_uvmap() | void register_node_type_sh_uvmap(void) | ||||
| { | { | ||||
| namespace file_ns = blender::nodes::node_shader_uvmap_cc; | |||||
| static bNodeType ntype; | static bNodeType ntype; | ||||
| sh_node_type_base(&ntype, SH_NODE_UVMAP, "UV Map", NODE_CLASS_INPUT, 0); | sh_node_type_base(&ntype, SH_NODE_UVMAP, "UV Map", NODE_CLASS_INPUT, 0); | ||||
| node_type_socket_templates(&ntype, nullptr, file_ns::sh_node_uvmap_out); | node_type_socket_templates(&ntype, NULL, sh_node_uvmap_out); | ||||
| node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); | node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); | ||||
| node_type_init(&ntype, file_ns::node_shader_init_uvmap); | node_type_init(&ntype, node_shader_init_uvmap); | ||||
| node_type_storage( | node_type_storage( | ||||
| &ntype, "NodeShaderUVMap", node_free_standard_storage, node_copy_standard_storage); | &ntype, "NodeShaderUVMap", node_free_standard_storage, node_copy_standard_storage); | ||||
| node_type_gpu(&ntype, file_ns::node_shader_gpu_uvmap); | node_type_gpu(&ntype, node_shader_gpu_uvmap); | ||||
| nodeRegisterType(&ntype); | nodeRegisterType(&ntype); | ||||
| } | } | ||||