vec3 variants for toLinear and toGamma

This commit is contained in:
Azaezel 2016-08-09 14:05:54 -05:00
parent 79f8b819ea
commit 07224ecd97
4 changed files with 96 additions and 2 deletions

View file

@ -304,6 +304,15 @@ vec4 toGamma(vec4 tex)
{
return tex;
}
vec3 toLinear(vec3 tex)
{
return tex;
}
// Encodes gamma.
vec3 toGamma(vec3 tex)
{
return tex;
}
#else
// Sample in linear space. Decodes gamma.
vec4 toLinear(vec4 tex)
@ -315,6 +324,16 @@ vec4 toGamma(vec4 tex)
{
return vec4(pow(abs(tex.rgb), vec3(1.0/2.2)), tex.a);
}
// Sample in linear space. Decodes gamma.
vec3 toLinear(vec3 tex)
{
return pow(abs(tex), vec3(2.2));
}
// Encodes gamma.
vec3 toGamma(vec3 tex)
{
return pow(abs(tex), vec3(1.0/2.2));
}
#endif //
#endif // _TORQUE_GLSL_

View file

@ -294,7 +294,25 @@ float4 toLinear(float4 tex)
return tex;
}
// Encodes gamma.
float4 toLinear(float4 tex)
float4 toGamma(float4 tex)
{
return tex;
}
float3 toLinear(float3 tex)
{
return tex;
}
// Encodes gamma.
float3 toGamma(float3 tex)
{
return tex;
}
float3 toLinear(float3 tex)
{
return tex;
}
// Encodes gamma.
float3 toLinear(float3 tex)
{
return tex;
}
@ -309,6 +327,16 @@ float4 toGamma(float4 tex)
{
return float4(pow(abs(tex.rgb), 1.0/2.2), tex.a);
}
// Sample in linear space. Decodes gamma.
float3 toLinear(float3 tex)
{
return pow(abs(tex.rgb), 2.2);
}
// Encodes gamma.
float3 toGamma(float3 tex)
{
return pow(abs(tex.rgb), 1.0/2.2);
}
#endif //
#endif // _TORQUE_HLSL_

View file

@ -304,6 +304,15 @@ vec4 toGamma(vec4 tex)
{
return tex;
}
vec3 toLinear(vec3 tex)
{
return tex;
}
// Encodes gamma.
vec3 toGamma(vec3 tex)
{
return tex;
}
#else
// Sample in linear space. Decodes gamma.
vec4 toLinear(vec4 tex)
@ -315,6 +324,16 @@ vec4 toGamma(vec4 tex)
{
return vec4(pow(abs(tex.rgb), vec3(1.0/2.2)), tex.a);
}
// Sample in linear space. Decodes gamma.
vec3 toLinear(vec3 tex)
{
return pow(abs(tex), vec3(2.2));
}
// Encodes gamma.
vec3 toGamma(vec3 tex)
{
return pow(abs(tex), vec3(1.0/2.2));
}
#endif //
#endif // _TORQUE_GLSL_

View file

@ -294,7 +294,25 @@ float4 toLinear(float4 tex)
return tex;
}
// Encodes gamma.
float4 toLinear(float4 tex)
float4 toGamma(float4 tex)
{
return tex;
}
float3 toLinear(float3 tex)
{
return tex;
}
// Encodes gamma.
float3 toGamma(float3 tex)
{
return tex;
}
float3 toLinear(float3 tex)
{
return tex;
}
// Encodes gamma.
float3 toLinear(float3 tex)
{
return tex;
}
@ -309,6 +327,16 @@ float4 toGamma(float4 tex)
{
return float4(pow(abs(tex.rgb), 1.0/2.2), tex.a);
}
// Sample in linear space. Decodes gamma.
float3 toLinear(float3 tex)
{
return pow(abs(tex.rgb), 2.2);
}
// Encodes gamma.
float3 toGamma(float3 tex)
{
return pow(abs(tex.rgb), 1.0/2.2);
}
#endif //
#endif // _TORQUE_HLSL_