forked from bartvdbraak/blender
Implement GLSL code for XYZ nodes.
This commit is contained in:
parent
2c105dd17d
commit
6cd5954246
@ -752,6 +752,18 @@ void combine_rgb(float r, float g, float b, out vec4 col)
|
|||||||
col = vec4(r, g, b, 1.0);
|
col = vec4(r, g, b, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void separate_xyz(vec3 vec, out float x, out float y, out float z)
|
||||||
|
{
|
||||||
|
x = vec.r;
|
||||||
|
y = vec.g;
|
||||||
|
z = vec.b;
|
||||||
|
}
|
||||||
|
|
||||||
|
void combine_xyz(float x, float y, float z, out vec3 vec)
|
||||||
|
{
|
||||||
|
vec = vec3(x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
void separate_hsv(vec4 col, out float h, out float s, out float v)
|
void separate_hsv(vec4 col, out float h, out float s, out float v)
|
||||||
{
|
{
|
||||||
vec4 hsv;
|
vec4 hsv;
|
||||||
|
@ -44,7 +44,7 @@ static bNodeSocketTemplate sh_node_sepxyz_out[] = {
|
|||||||
{ -1, 0, "" }
|
{ -1, 0, "" }
|
||||||
};
|
};
|
||||||
|
|
||||||
static int gpu_shader_sep(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
|
static int gpu_shader_sepxyz(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
|
||||||
{
|
{
|
||||||
return GPU_stack_link(mat, "separate_xyz", in, out);
|
return GPU_stack_link(mat, "separate_xyz", in, out);
|
||||||
}
|
}
|
||||||
@ -56,6 +56,7 @@ void register_node_type_sh_sepxyz(void)
|
|||||||
sh_node_type_base(&ntype, SH_NODE_SEPXYZ, "Separate XYZ", NODE_CLASS_CONVERTOR, 0);
|
sh_node_type_base(&ntype, SH_NODE_SEPXYZ, "Separate XYZ", NODE_CLASS_CONVERTOR, 0);
|
||||||
node_type_compatibility(&ntype, NODE_NEW_SHADING);
|
node_type_compatibility(&ntype, NODE_NEW_SHADING);
|
||||||
node_type_socket_templates(&ntype, sh_node_sepxyz_in, sh_node_sepxyz_out);
|
node_type_socket_templates(&ntype, sh_node_sepxyz_in, sh_node_sepxyz_out);
|
||||||
|
node_type_gpu(&ntype, gpu_shader_sepxyz);
|
||||||
|
|
||||||
nodeRegisterType(&ntype);
|
nodeRegisterType(&ntype);
|
||||||
}
|
}
|
||||||
@ -74,6 +75,11 @@ static bNodeSocketTemplate sh_node_combxyz_out[] = {
|
|||||||
{ -1, 0, "" }
|
{ -1, 0, "" }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static int gpu_shader_combxyz(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
|
||||||
|
{
|
||||||
|
return GPU_stack_link(mat, "combine_xyz", in, out);
|
||||||
|
}
|
||||||
|
|
||||||
void register_node_type_sh_combxyz(void)
|
void register_node_type_sh_combxyz(void)
|
||||||
{
|
{
|
||||||
static bNodeType ntype;
|
static bNodeType ntype;
|
||||||
@ -81,6 +87,7 @@ void register_node_type_sh_combxyz(void)
|
|||||||
sh_node_type_base(&ntype, SH_NODE_COMBXYZ, "Combine XYZ", NODE_CLASS_CONVERTOR, 0);
|
sh_node_type_base(&ntype, SH_NODE_COMBXYZ, "Combine XYZ", NODE_CLASS_CONVERTOR, 0);
|
||||||
node_type_compatibility(&ntype, NODE_NEW_SHADING);
|
node_type_compatibility(&ntype, NODE_NEW_SHADING);
|
||||||
node_type_socket_templates(&ntype, sh_node_combxyz_in, sh_node_combxyz_out);
|
node_type_socket_templates(&ntype, sh_node_combxyz_in, sh_node_combxyz_out);
|
||||||
|
node_type_gpu(&ntype, gpu_shader_combxyz);
|
||||||
|
|
||||||
nodeRegisterType(&ntype);
|
nodeRegisterType(&ntype);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user