Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/composite/nodes/node_composite_tonemap.cc
| Show All 17 Lines | |||||
| */ | */ | ||||
| /** \file | /** \file | ||||
| * \ingroup cmpnodes | * \ingroup cmpnodes | ||||
| */ | */ | ||||
| #include "node_composite_util.hh" | #include "node_composite_util.hh" | ||||
| namespace blender::nodes { | namespace blender::nodes::node_cmp_tonemap_cc { | ||||
| static void cmp_node_tonemap_declare(NodeDeclarationBuilder &b) | static void cmp_node_tonemap_declare(NodeDeclarationBuilder &b) | ||||
| { | { | ||||
| b.add_input<decl::Color>(N_("Image")).default_value({1.0f, 1.0f, 1.0f, 1.0f}); | b.add_input<decl::Color>(N_("Image")).default_value({1.0f, 1.0f, 1.0f, 1.0f}); | ||||
| b.add_output<decl::Color>(N_("Image")); | b.add_output<decl::Color>(N_("Image")); | ||||
| } | } | ||||
| } // 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 = (NodeTonemap *)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; | ||||
| } | } | ||||
| } // namespace blender::nodes::node_cmp_tonemap_cc | |||||
| void register_node_type_cmp_tonemap(void) | void register_node_type_cmp_tonemap(void) | ||||
| { | { | ||||
| namespace file_ns = blender::nodes::node_cmp_tonemap_cc; | |||||
| 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); | ||||
| ntype.declare = blender::nodes::cmp_node_tonemap_declare; | ntype.declare = file_ns::cmp_node_tonemap_declare; | ||||
| node_type_init(&ntype, node_composit_init_tonemap); | node_type_init(&ntype, file_ns::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); | ||||
| } | } | ||||