20 #include "../node_shader_util.h"
25 {
SOCK_RGBA,
N_(
"Color"), 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 1.0f},
26 {
SOCK_STRING,
N_(
"Color Attribute"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
27 {
SOCK_FLOAT,
N_(
"Density"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f},
28 {
SOCK_STRING,
N_(
"Density Attribute"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
30 {
SOCK_RGBA,
N_(
"Absorption Color"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
31 {
SOCK_FLOAT,
N_(
"Emission Strength"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1000.0f},
32 {
SOCK_RGBA,
N_(
"Emission Color"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f},
34 {
SOCK_RGBA,
N_(
"Blackbody Tint"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f},
35 {
SOCK_FLOAT,
N_(
"Temperature"), 1000.0f, 0.0f, 0.0f, 0.0f, 0.0f, 6500.0f},
36 {
SOCK_STRING,
N_(
"Temperature Attribute"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
48 if (
STREQ(sock->name,
"Density Attribute")) {
51 else if (
STREQ(sock->name,
"Temperature Attribute")) {
64 bool use_blackbody = (in[8].
link || in[8].
vec[0] != 0.0f);
75 const char *attribute_name = value->
value;
76 if (attribute_name[0] ==
'\0') {
80 if (
STREQ(sock->name,
"Density Attribute")) {
83 else if (
STREQ(sock->name,
"Color Attribute")) {
86 else if (use_blackbody &&
STREQ(sock->name,
"Temperature Attribute")) {
93 static float one = 1.0f;
97 static float white[4] = {1.0f, 1.0f, 1.0f, 1.0f};
101 static float one = 1.0f;
119 "node_volume_principled",
void node_type_gpu(struct bNodeType *ntype, NodeGPUExecFunction gpu_fn)
void node_type_socket_templates(struct bNodeType *ntype, struct bNodeSocketTemplate *inputs, struct bNodeSocketTemplate *outputs)
void node_type_init(struct bNodeType *ntype, void(*initfunc)(struct bNodeTree *ntree, struct bNode *node))
void node_type_size_preset(struct bNodeType *ntype, eNodeSizePreset size)
void node_type_storage(struct bNodeType *ntype, const char *storagename, void(*freefunc)(struct bNode *node), void(*copyfunc)(struct bNodeTree *dest_ntree, struct bNode *dest_node, const struct bNode *src_node))
#define NODE_CLASS_SHADER
void nodeRegisterType(struct bNodeType *ntype)
#define LISTBASE_FOREACH(type, var, list)
void blackbody_temperature_to_rgb_table(float *r_table, int width, float min, float max)
GPUNodeLink * GPU_color_band(GPUMaterial *mat, int size, float *pixels, float *row)
GPUNodeLink * GPU_constant(const float *num)
GPUNodeLink * GPU_volume_grid(GPUMaterial *mat, const char *name, eGPUVolumeDefaultValue default_value)
bool GPU_stack_link(GPUMaterial *mat, struct bNode *node, const char *name, GPUNodeStack *in, GPUNodeStack *out,...)
Group RGB to Bright Vector Camera Vector Combine Material Light Line Style Layer Add Ambient Diffuse Glossy Refraction Transparent Toon Principled Hair Volume SH_NODE_VOLUME_PRINCIPLED
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
void *(* MEM_callocN)(size_t len, const char *str)
void *(* MEM_mallocN)(size_t len, const char *str)
void sh_node_type_base(struct bNodeType *ntype, int type, const char *name, short nclass, short flag)
static bNodeSocketTemplate sh_node_volume_principled_out[]
static void node_shader_init_volume_principled(bNodeTree *UNUSED(ntree), bNode *node)
static int node_shader_gpu_volume_principled(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
static bNodeSocketTemplate sh_node_volume_principled_in[]
void register_node_type_sh_volume_principled(void)
struct GPUNodeLink * link
Compact definition of a node socket.