Welcome to mirror list, hosted at ThFree Co, Russian Federation.

node_shader_volume_info.cc « nodes « shader « nodes « blender « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 6a1bc070f6833a443a7451616a88ca82b1ae7fa4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/* SPDX-License-Identifier: GPL-2.0-or-later
 * Copyright 2005 Blender Foundation. All rights reserved. */

#include "node_shader_util.hh"

namespace blender::nodes::node_shader_volume_info_cc {

static void node_declare(NodeDeclarationBuilder &b)
{
  b.add_output<decl::Color>(N_("Color"));
  b.add_output<decl::Float>(N_("Density"));
  b.add_output<decl::Float>(N_("Flame"));
  b.add_output<decl::Float>(N_("Temperature"));
}

static int node_shader_gpu_volume_info(GPUMaterial *mat,
                                       bNode * /*node*/,
                                       bNodeExecData * /*execdata*/,
                                       GPUNodeStack * /*in*/,
                                       GPUNodeStack *out)
{
  if (out[0].hasoutput) {
    out[0].link = GPU_attribute(mat, CD_AUTO_FROM_NAME, "color");
    GPU_link(mat, "node_attribute_color", out[0].link, &out[0].link);
  }
  if (out[1].hasoutput) {
    out[1].link = GPU_attribute(mat, CD_AUTO_FROM_NAME, "density");
    GPU_link(mat, "node_attribute_density", out[1].link, &out[1].link);
  }
  if (out[2].hasoutput) {
    out[2].link = GPU_attribute(mat, CD_AUTO_FROM_NAME, "flame");
    GPU_link(mat, "node_attribute_flame", out[2].link, &out[2].link);
  }
  if (out[3].hasoutput) {
    out[3].link = GPU_attribute(mat, CD_AUTO_FROM_NAME, "temperature");
    GPU_link(mat, "node_attribute_temperature", out[3].link, &out[3].link);
  }

  return true;
}

}  // namespace blender::nodes::node_shader_volume_info_cc

void register_node_type_sh_volume_info()
{
  namespace file_ns = blender::nodes::node_shader_volume_info_cc;

  static bNodeType ntype;

  sh_node_type_base(&ntype, SH_NODE_VOLUME_INFO, "Volume Info", NODE_CLASS_INPUT);
  ntype.declare = file_ns::node_declare;
  ntype.gpu_fn = file_ns::node_shader_gpu_volume_info;

  nodeRegisterType(&ntype);
}