From a15e4a54f78e330c613a2e63d8004169c05d94be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A4=C3=A4tt=C3=A4=20Antti?= Date: Thu, 30 Nov 2017 12:41:44 +0200 Subject: Improve custom material GLES2 support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Tomi Korpipää --- src/Runtime/res/effectlib/simpleGlossyBSDF.glsllib | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/Runtime/res/effectlib/simpleGlossyBSDF.glsllib') 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 -- cgit v1.2.3