Fix #36882: cycles gamma node not working with glsl materials.
This commit is contained in:
@@ -2134,6 +2134,20 @@ void node_fresnel(float ior, vec3 N, vec3 I, out float result)
|
||||
result = fresnel_dielectric(I, N, (gl_FrontFacing)? eta: 1.0/eta);
|
||||
}
|
||||
|
||||
/* gamma */
|
||||
|
||||
void node_gamma(vec4 col, float gamma, out vec4 outcol)
|
||||
{
|
||||
outcol = col;
|
||||
|
||||
if(col.r > 0.0)
|
||||
outcol.r = compatible_pow(col.r, gamma);
|
||||
if(col.g > 0.0)
|
||||
outcol.g = compatible_pow(col.g, gamma);
|
||||
if(col.b > 0.0)
|
||||
outcol.b = compatible_pow(col.b, gamma);
|
||||
}
|
||||
|
||||
/* geometry */
|
||||
|
||||
void node_attribute(vec3 attr_uv, out vec4 outcol, out vec3 outvec, out float outf)
|
||||
|
||||
@@ -41,6 +41,11 @@ static bNodeSocketTemplate sh_node_gamma_out[] = {
|
||||
{ -1, 0, "" }
|
||||
};
|
||||
|
||||
static int node_shader_gpu_gamma(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
|
||||
{
|
||||
return GPU_stack_link(mat, "node_gamma", in, out);
|
||||
}
|
||||
|
||||
void register_node_type_sh_gamma(void)
|
||||
{
|
||||
static bNodeType ntype;
|
||||
@@ -50,6 +55,7 @@ void register_node_type_sh_gamma(void)
|
||||
node_type_socket_templates(&ntype, sh_node_gamma_in, sh_node_gamma_out);
|
||||
node_type_init(&ntype, NULL);
|
||||
node_type_storage(&ntype, "", NULL, NULL);
|
||||
node_type_gpu(&ntype, node_shader_gpu_gamma);
|
||||
|
||||
nodeRegisterType(&ntype);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user