summaryrefslogtreecommitdiffstats
path: root/src/Runtime/res/effectlib/simpleGlossyBSDF.glsllib
diff options
context:
space:
mode:
authorMäättä Antti <antti.maatta@qt.io>2017-11-30 12:41:44 +0200
committerAntti Määttä <antti.maatta@qt.io>2018-01-10 12:41:04 +0000
commita15e4a54f78e330c613a2e63d8004169c05d94be (patch)
tree5f3f58b9a0cc2a1dd547ccc3276f28c49fa7c9cf /src/Runtime/res/effectlib/simpleGlossyBSDF.glsllib
parent16185339fc737bfabb415265cdc9beef7146407e (diff)
Improve custom material GLES2 support
Implement light shader property setting for custom materials when constant buffers are not supported. Remove floating point .f from glsllib. Task-number: QT3DS-36 Change-Id: I30df0ef8841daaa166910c2384613a1c9f4e6b46 Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io> Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Diffstat (limited to 'src/Runtime/res/effectlib/simpleGlossyBSDF.glsllib')
-rw-r--r--src/Runtime/res/effectlib/simpleGlossyBSDF.glsllib18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/Runtime/res/effectlib/simpleGlossyBSDF.glsllib b/src/Runtime/res/effectlib/simpleGlossyBSDF.glsllib
index 31a9ac50..be6024cc 100644
--- a/src/Runtime/res/effectlib/simpleGlossyBSDF.glsllib
+++ b/src/Runtime/res/effectlib/simpleGlossyBSDF.glsllib
@@ -31,10 +31,10 @@
vec4 simpleGlossyBSDF( in mat3 tanFrame, in vec3 L, vec3 V, in vec3 lightSpecular, in float ior
, in float roughnessU, in float roughnessV, int mode )
{
- vec4 rgba = vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ vec4 rgba = vec4( 0.0, 0.0, 0.0, 1.0 );
float cosTheta = dot( tanFrame[2], L );
- if ( 0.0f < cosTheta )
+ if ( 0.0 < cosTheta )
{
float roughness = calculateRoughness( tanFrame[2], roughnessU, roughnessV, tanFrame[0] );
@@ -42,7 +42,7 @@ vec4 simpleGlossyBSDF( in mat3 tanFrame, in vec3 L, vec3 V, in vec3 lightSpecula
{
vec3 R = reflect( -L, tanFrame[2] );
float cosine = dot( R, V );
- float shine = ( 0.0f < cosine ) ? ( ( 0.0f < roughness ) ? pow( cosine, 1.0f / roughness ) : ( 0.9999f <= cosine ) ? 1.0f : 0.0f ) : 0.0f;
+ float shine = ( 0.0 < cosine ) ? ( ( 0.0 < roughness ) ? pow( cosine, 1.0 / roughness ) : ( 0.9999 <= cosine ) ? 1.0 : 0.0 ) : 0.0;
rgba.rgb = shine * lightSpecular;
}
}
@@ -50,13 +50,13 @@ vec4 simpleGlossyBSDF( in mat3 tanFrame, in vec3 L, vec3 V, in vec3 lightSpecula
{
// check against total reflection
vec3 R = refract( -V, tanFrame[2], ior );
- if ( R == vec3( 0.0f, 0.0f, 0.0f ) )
+ if ( R == vec3( 0.0, 0.0, 0.0 ) )
{
- rgba.a = 1.0f;
+ rgba.a = 1.0;
}
else
{
- rgba.a = 0.0f;
+ rgba.a = 0.0;
}
}
@@ -65,17 +65,17 @@ vec4 simpleGlossyBSDF( in mat3 tanFrame, in vec3 L, vec3 V, in vec3 lightSpecula
vec4 simpleGlossyBSDFEnvironment( in mat3 tanFrame, in vec3 viewDir, in float roughnessU, in float roughnessV, int mode )
{
- vec3 rgb = vec3( 0.0f, 0.0f, 0.0f );
+ vec3 rgb = vec3( 0.0, 0.0, 0.0 );
#if !QT3DS_ENABLE_LIGHT_PROBE
if ( uEnvironmentMappingEnabled )
{
float roughness = calculateRoughness( tanFrame[2], roughnessU, roughnessV, tanFrame[0] );
vec3 R = reflect( -viewDir, tanFrame[2] );
rgb = evalEnvironmentMap( R, roughness );
- rgb = simpleGlossyBSDF( tanFrame, R, viewDir, rgb, 1.0f, roughnessU, roughnessV, scatter_reflect ).rgb;
+ rgb = simpleGlossyBSDF( tanFrame, R, viewDir, rgb, 1.0, roughnessU, roughnessV, scatter_reflect ).rgb;
}
#endif
- return( vec4( rgb, 1.0f ) );
+ return( vec4( rgb, 1.0 ) );
}
// RNM radiosity normal maps