Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/composite/nodes/node_composite_tonemap.cc
- This file was moved from source/blender/nodes/composite/nodes/node_composite_tonemap.c.
| Show All 15 Lines | |||||
| * The Original Code is Copyright (C) 2006 Blender Foundation. | * The Original Code is Copyright (C) 2006 Blender Foundation. | ||||
| * All rights reserved. | * All rights reserved. | ||||
| */ | */ | ||||
| /** \file | /** \file | ||||
| * \ingroup cmpnodes | * \ingroup cmpnodes | ||||
| */ | */ | ||||
| #include "node_composite_util.h" | #include "node_composite_util.hh" | ||||
| static bNodeSocketTemplate cmp_node_tonemap_in[] = { | namespace blender::nodes { | ||||
| {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, | |||||
| {-1, ""}, | static void cmp_node_tonemap_declare(NodeDeclarationBuilder &b) | ||||
| }; | { | ||||
| static bNodeSocketTemplate cmp_node_tonemap_out[] = { | b.add_input<decl::Color>("Image").default_value({1.0f, 1.0f, 1.0f, 1.0f}); | ||||
| {SOCK_RGBA, N_("Image")}, | b.add_output<decl::Color>("Image"); | ||||
| {-1, ""}, | } | ||||
| }; | |||||
| } // namespace blender::nodes | |||||
| static void node_composit_init_tonemap(bNodeTree *UNUSED(ntree), bNode *node) | static void node_composit_init_tonemap(bNodeTree *UNUSED(ntree), bNode *node) | ||||
| { | { | ||||
| NodeTonemap *ntm = MEM_callocN(sizeof(NodeTonemap), "node tonemap data"); | NodeTonemap *ntm = (NodeTonemap *)MEM_callocN(sizeof(NodeTonemap), "node tonemap data"); | ||||
| ntm->type = 1; | ntm->type = 1; | ||||
| ntm->key = 0.18; | ntm->key = 0.18; | ||||
| ntm->offset = 1; | ntm->offset = 1; | ||||
| ntm->gamma = 1; | ntm->gamma = 1; | ||||
| ntm->f = 0; | ntm->f = 0; | ||||
| ntm->m = 0; /* Actual value is set according to input. */ | ntm->m = 0; /* Actual value is set according to input. */ | ||||
| /* Default a of 1 works well with natural HDR images, but not always so for CGI. | /* Default a of 1 works well with natural HDR images, but not always so for CGI. | ||||
| * Maybe should use 0 or at least lower initial value instead. */ | * Maybe should use 0 or at least lower initial value instead. */ | ||||
| ntm->a = 1; | ntm->a = 1; | ||||
| ntm->c = 0; | ntm->c = 0; | ||||
| node->storage = ntm; | node->storage = ntm; | ||||
| } | } | ||||
| void register_node_type_cmp_tonemap(void) | void register_node_type_cmp_tonemap(void) | ||||
| { | { | ||||
| static bNodeType ntype; | static bNodeType ntype; | ||||
| cmp_node_type_base(&ntype, CMP_NODE_TONEMAP, "Tonemap", NODE_CLASS_OP_COLOR, 0); | cmp_node_type_base(&ntype, CMP_NODE_TONEMAP, "Tonemap", NODE_CLASS_OP_COLOR, 0); | ||||
| node_type_socket_templates(&ntype, cmp_node_tonemap_in, cmp_node_tonemap_out); | ntype.declare = blender::nodes::cmp_node_tonemap_declare; | ||||
| node_type_init(&ntype, node_composit_init_tonemap); | node_type_init(&ntype, node_composit_init_tonemap); | ||||
| node_type_storage(&ntype, "NodeTonemap", node_free_standard_storage, node_copy_standard_storage); | node_type_storage(&ntype, "NodeTonemap", node_free_standard_storage, node_copy_standard_storage); | ||||
| nodeRegisterType(&ntype); | nodeRegisterType(&ntype); | ||||
| } | } | ||||