summaryrefslogtreecommitdiffstats
path: root/res
diff options
context:
space:
mode:
authorJere Tuliniemi <jere.tuliniemi@qt.io>2018-05-23 15:18:06 +0300
committerJere Tuliniemi <jere.tuliniemi@qt.io>2018-05-23 12:31:35 +0000
commitb4a7f13326d86db82fe96b7b13cb7f1cdb3bdf33 (patch)
tree56447532936daaadf46dc6cc71e06626c2b29e50 /res
parent556fa62d1fa03ad0e216d12c9ffdeec81b55bfa8 (diff)
Remove the use of f for floats in shaders
Task-number: QT3DS-1765 Change-Id: If398f95fba9ed409761602937c49fc2d93fe46f6 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'res')
-rw-r--r--res/effectlib/Fxaa3_8.glsllib2
-rw-r--r--res/effectlib/average.glsllib2
-rw-r--r--res/effectlib/calculateRoughness.glsllib4
-rw-r--r--res/effectlib/customMaterial.glsllib10
-rw-r--r--res/effectlib/customMaterialFragBody.glsllib8
-rw-r--r--res/effectlib/customMaterialFragBodyAO.glsllib8
-rw-r--r--res/effectlib/diffuseReflectionBSDF.glsllib6
-rw-r--r--res/effectlib/diffuseTransmissionBSDF.glsllib6
-rw-r--r--res/effectlib/fileBumpTexture.glsllib2
-rw-r--r--res/effectlib/flakeNoiseBumpTexture.glsllib2
-rw-r--r--res/effectlib/flakeNoiseTexture.glsllib8
-rw-r--r--res/effectlib/fresnelLayer.glsllib18
-rw-r--r--res/effectlib/gradient3Recolor.glsllib14
-rw-r--r--res/effectlib/gradientGetPosition.glsllib14
-rw-r--r--res/effectlib/miNoise.glsllib22
-rw-r--r--res/effectlib/microfacetBSDF.glsllib14
-rw-r--r--res/effectlib/normalizedMix.glsllib2
-rw-r--r--res/effectlib/perlinNoise.glsllib68
-rw-r--r--res/effectlib/physGlossyBSDF.glsllib4
-rw-r--r--res/effectlib/sampleArea.glsllib2
-rw-r--r--res/effectlib/sampleLight.glsllib12
-rw-r--r--res/effectlib/simpleGlossyBSDF.glsllib18
-rw-r--r--res/effectlib/specularBSDF.glsllib6
-rw-r--r--res/effectlib/spotEdf.glsllib2
24 files changed, 127 insertions, 127 deletions
diff --git a/res/effectlib/Fxaa3_8.glsllib b/res/effectlib/Fxaa3_8.glsllib
index 7e76ecd..620f565 100644
--- a/res/effectlib/Fxaa3_8.glsllib
+++ b/res/effectlib/Fxaa3_8.glsllib
@@ -1370,7 +1370,7 @@ float4 FxaaPixelShader(
float2 posP = posN;
float2 offNP = horzSpan ?
FxaaFloat2(rcpFrame.x, 0.0) :
- FxaaFloat2(0.0f, rcpFrame.y);
+ FxaaFloat2(0.0, rcpFrame.y);
float lumaEndN;
float lumaEndP;
bool doneN = false;
diff --git a/res/effectlib/average.glsllib b/res/effectlib/average.glsllib
index 8c3f3fc..082eec0 100644
--- a/res/effectlib/average.glsllib
+++ b/res/effectlib/average.glsllib
@@ -30,6 +30,6 @@
float average( in vec3 v )
{
- return( ( v.x + v.y + v.z ) / 3.0f );
+ return( ( v.x + v.y + v.z ) / 3.0 );
}
diff --git a/res/effectlib/calculateRoughness.glsllib b/res/effectlib/calculateRoughness.glsllib
index d1e099b..a14083d 100644
--- a/res/effectlib/calculateRoughness.glsllib
+++ b/res/effectlib/calculateRoughness.glsllib
@@ -55,8 +55,8 @@ float calculateRoughness( in vec3 N, in float roughnessU, in float roughnessV, i
float cosPhi = dot( po, minorAxis );
// determine the polar coordinate of viewDir, take that radius as the roughness
- float excentricitySquare = 1.0f - square( b / a );
- roughness = b / sqrt( 1.0f - excentricitySquare * square( cosPhi ) );
+ float excentricitySquare = 1.0 - square( b / a );
+ roughness = b / sqrt( 1.0 - excentricitySquare * square( cosPhi ) );
}
return( roughness );
}
diff --git a/res/effectlib/customMaterial.glsllib b/res/effectlib/customMaterial.glsllib
index e99fa6e..0a4d88b 100644
--- a/res/effectlib/customMaterial.glsllib
+++ b/res/effectlib/customMaterial.glsllib
@@ -36,11 +36,11 @@ uniform sampler2D samplerName;
// some useful defines
#ifndef PI
-#define PI 3.14159265358979f
-#define PI_HALF ( 0.5f * PI )
-#define PI_TWO ( 2.0f * PI )
-#define ONE_OVER_PI ( 1.0f / PI )
-#define TWO_OVER_PI ( 2.0f / PI )
+#define PI 3.14159265358979
+#define PI_HALF ( 0.5 * PI )
+#define PI_TWO ( 2.0 * PI )
+#define ONE_OVER_PI ( 1.0 / PI )
+#define TWO_OVER_PI ( 2.0 / PI )
#define PI_SQUARE ( PI * PI )
#endif
diff --git a/res/effectlib/customMaterialFragBody.glsllib b/res/effectlib/customMaterialFragBody.glsllib
index 7a1b09a..c20c3e0 100644
--- a/res/effectlib/customMaterialFragBody.glsllib
+++ b/res/effectlib/customMaterialFragBody.glsllib
@@ -32,7 +32,7 @@
#define CUSTOM_MATERIAL_FRAG_BODY_GLSLLIB
bool twoSided = false;
- vec3 materialEmissive = vec3( 0.0f, 0.0f, 0.0f );
+ vec3 materialEmissive = vec3( 0.0, 0.0, 0.0 );
float materialIOR = computeIOR();
@@ -42,7 +42,7 @@
}
else
{
- materialIOR = 1.0f / materialIOR;
+ materialIOR = 1.0 / materialIOR;
twoSided = evalTwoSided();
if ( twoSided )
{
@@ -51,7 +51,7 @@
}
}
- vec4 rgba = vec4( materialEmissive, 0.0f );
+ vec4 rgba = vec4( materialEmissive, 0.0 );
vec3 lightAmbient, lightDiffuse, lightSpecular, L;
for ( int i=0 ; i<uNumLights ; i++ )
@@ -71,7 +71,7 @@
computeBackAreaColor( i, arealights[i].diffuse, arealights[i].specular );
}
- if ( 0.0f < alpha )
+ if ( 0.0 < alpha )
{
if (gl_FrontFacing)
computeFrontLayerEnvironment( normal, viewDir, 1.0 );
diff --git a/res/effectlib/customMaterialFragBodyAO.glsllib b/res/effectlib/customMaterialFragBodyAO.glsllib
index 4f98e09..4c79d8d 100644
--- a/res/effectlib/customMaterialFragBodyAO.glsllib
+++ b/res/effectlib/customMaterialFragBodyAO.glsllib
@@ -32,7 +32,7 @@
#define CUSTOM_MATERIAL_FRAG_BODY_AO_GLSLLIB
bool twoSided = false;
- vec3 materialEmissive = vec3( 0.0f, 0.0f, 0.0f );
+ vec3 materialEmissive = vec3( 0.0, 0.0, 0.0 );
float materialIOR = computeIOR();
@@ -42,7 +42,7 @@
}
else
{
- materialIOR = 1.0f / materialIOR;
+ materialIOR = 1.0 / materialIOR;
twoSided = evalTwoSided();
if ( twoSided )
{
@@ -51,7 +51,7 @@
}
}
- vec4 rgba = vec4( materialEmissive, 0.0f );
+ vec4 rgba = vec4( materialEmissive, 0.0 );
// compute ambient occlusion
float aoFactor = customMaterialAO( );
@@ -77,7 +77,7 @@
computeBackAreaColor( i, arealights[i].diffuse, arealights[i].specular );
}
- if ( 0.0f < alpha )
+ if ( 0.0 < alpha )
{
if (gl_FrontFacing)
computeFrontLayerEnvironment( normal, viewDir, aoFactor );
diff --git a/res/effectlib/diffuseReflectionBSDF.glsllib b/res/effectlib/diffuseReflectionBSDF.glsllib
index 9a66aef..a98509d 100644
--- a/res/effectlib/diffuseReflectionBSDF.glsllib
+++ b/res/effectlib/diffuseReflectionBSDF.glsllib
@@ -35,14 +35,14 @@ vec4 lambertReflectionBSDF( in vec3 N, in vec3 L, in vec3 lightDiffuse )
{
// If we're not going to use the roughness on the diffuse, there's no point
// in wasting the cycles for the branching.
- float cosThetaI = max( 0.0f, dot( N, L ) );
- return vec4( cosThetaI * lightDiffuse, 1.0f );
+ float cosThetaI = max( 0.0, dot( N, L ) );
+ return vec4( cosThetaI * lightDiffuse, 1.0 );
}
vec4 diffuseReflectionBSDFEnvironment( in vec3 N, in float roughness )
{
- return( vec4( 0.0f, 0.0f, 0.0f, 1.0f ) );
+ return( vec4( 0.0, 0.0, 0.0, 1.0 ) );
}
// RNM radiosity normal maps
diff --git a/res/effectlib/diffuseTransmissionBSDF.glsllib b/res/effectlib/diffuseTransmissionBSDF.glsllib
index 09d9a7e..c588f14 100644
--- a/res/effectlib/diffuseTransmissionBSDF.glsllib
+++ b/res/effectlib/diffuseTransmissionBSDF.glsllib
@@ -30,13 +30,13 @@
vec4 diffuseTransmissionBSDF( in vec3 N, in vec3 L, in vec3 viewDir, in vec3 lightDiffuse, in vec4 transmissiveColor, in float translucentFalloff, float lightWrap )
{
- float cosThetaI = max( 0.0f, (dot( N, L ) + lightWrap) / (1.0 + lightWrap) );
+ float cosThetaI = max( 0.0, (dot( N, L ) + lightWrap) / (1.0 + lightWrap) );
float factor = cosThetaI;
- float l = 0.2126f * transmissiveColor.r + 0.7152f * transmissiveColor.g + 0.0722f * transmissiveColor.b;
+ float l = 0.2126 * transmissiveColor.r + 0.7152 * transmissiveColor.g + 0.0722 * transmissiveColor.b;
float translucent_thickness = l * l;
float translucent_thickness_exp = exp( translucent_thickness * translucentFalloff);
- return( translucent_thickness_exp * vec4( factor * lightDiffuse, 1.0f ) );
+ return( translucent_thickness_exp * vec4( factor * lightDiffuse, 1.0 ) );
}
diff --git a/res/effectlib/fileBumpTexture.glsllib b/res/effectlib/fileBumpTexture.glsllib
index 0f27fd8..d0129a8 100644
--- a/res/effectlib/fileBumpTexture.glsllib
+++ b/res/effectlib/fileBumpTexture.glsllib
@@ -83,7 +83,7 @@ vec3 fileBumpTexture( in sampler2D sampler, in float factor, in int bumpSource
// currently no lod supported we use 3.3 GL
//float lod = textureQueryLod( sampler, uvw.position.xy ).x;
vec2 size = mix( vec2( textureSize( sampler, int( floor( lod ) ) ) ), vec2( textureSize( sampler, int( ceil( lod ) ) ) ), fract( lod ) );
- vec2 unitStep = 1.0f / size;
+ vec2 unitStep = 1.0 / size;
// Add an inveres scale to keep the original gradient values
// this makes the bumps a lot smoother.
diff --git a/res/effectlib/flakeNoiseBumpTexture.glsllib b/res/effectlib/flakeNoiseBumpTexture.glsllib
index 6bd5f7e..e8e427c 100644
--- a/res/effectlib/flakeNoiseBumpTexture.glsllib
+++ b/res/effectlib/flakeNoiseBumpTexture.glsllib
@@ -34,7 +34,7 @@ vec3 flakeNoiseBumpTexture( in texture_coordinate_info uvw, in float scale, in f
vec3 grad = miNoise( tex ).xyz;
// displace coordinate according to noise value
- tex += 2.0f * grad;
+ tex += 2.0 * grad;
// then use only integer coordinates, to make flakes transients harder and not wobbly
grad = miNoise( round( tex ) ).xyz;
diff --git a/res/effectlib/flakeNoiseTexture.glsllib b/res/effectlib/flakeNoiseTexture.glsllib
index 7a73968..92f15d3 100644
--- a/res/effectlib/flakeNoiseTexture.glsllib
+++ b/res/effectlib/flakeNoiseTexture.glsllib
@@ -34,11 +34,11 @@ texture_return flakeNoiseTexture( in texture_coordinate_info uvw, in float inten
vec3 grad = miNoise( tex ).xyz;
// displace coordinate according to noise value
- tex += 2.0f * grad;
+ tex += 2.0 * grad;
// then use only integer coordinates, to make flakes transients harder and not wobbly
vec4 noise = miNoise( floor( tex ) );
- float s = pow( noise.w, 1.0f / density ) * intensity;
+ float s = pow( noise.w, 1.0 / density ) * intensity;
texture_return tr;
tr.tint = vec3( noise.x, noise.y, noise.z );
@@ -53,11 +53,11 @@ texture_return flakeNoiseAndBumpTexture( in texture_coordinate_info uvw, in floa
vec3 grad = miNoise( tex ).xyz;
// displace coordinate according to noise value
- tex += 2.0f * grad;
+ tex += 2.0 * grad;
// then use only integer coordinates, to make flakes transients harder and not wobbly
vec4 noise = miNoise( round( tex ) );
- float s = pow( noise.w, 1.0f / density ) * intensity;
+ float s = pow( noise.w, 1.0 / density ) * intensity;
texture_return tr;
tr.tint = normalize( normal/strength + ( uvw.tangent_u * grad.x + uvw.tangent_v * grad.y + normal * abs( grad.z ) ) );
diff --git a/res/effectlib/fresnelLayer.glsllib b/res/effectlib/fresnelLayer.glsllib
index a9b4087..60d7176 100644
--- a/res/effectlib/fresnelLayer.glsllib
+++ b/res/effectlib/fresnelLayer.glsllib
@@ -61,8 +61,8 @@ vec3 pseudoFresnel( in vec3 N, in vec3 ior, float fresnelPower )
float fresnel( in float eta1, in float eta2, in float cosTheta1 )
{
float etaInv = eta1 / eta2;
- float cosTheta2 = 1.0f - ( 1.0f - cosTheta1 * cosTheta1 ) * ( etaInv * etaInv );
- if ( 0.0f <= cosTheta2 )
+ float cosTheta2 = 1.0 - ( 1.0 - cosTheta1 * cosTheta1 ) * ( etaInv * etaInv );
+ if ( 0.0 <= cosTheta2 )
{
cosTheta2 = sqrt( cosTheta2 );
float n1t1 = eta1 * cosTheta1;
@@ -71,29 +71,29 @@ float fresnel( in float eta1, in float eta2, in float cosTheta1 )
float n2t2 = eta2 * cosTheta2;
float rs = ( n1t1 - n2t2 ) / ( n1t1 + n2t2 );
float rp = ( n1t2 - n2t1 ) / ( n1t2 + n2t1 );
- float f = 0.5f * ( rs * rs + rp * rp );
+ float f = 0.5 * ( rs * rs + rp * rp );
return( clamp( f, 0.0, 1.0 ) );
}
else
{
- return( 1.0f );
+ return( 1.0 );
}
}
-// we assume, light rays run through air with ior == 1.0f
+// we assume, light rays run through air with ior == 1.0
// with eta = eta2 / eta1, we have
-// - when hitting a front face: eta2 == ior, eta1 == 1.0f => eta = ior
-// - when hitting a back face : eta2 == 1.0f, eta1 == ior => eta = 1.0f / ior
+// - when hitting a front face: eta2 == ior, eta1 == 1.0 => eta = ior
+// - when hitting a back face : eta2 == 1.0, eta1 == ior => eta = 1.0 / ior
vec3 fresnel( in vec3 N, in vec3 ior )
{
float cosTheta1 = dot( N, viewDir );
if ( gl_FrontFacing )
{
- return( vec3( fresnel( 1.0f, ior[0], cosTheta1 ), fresnel( 1.0f, ior[1], cosTheta1 ), fresnel( 1.0f, ior[2], cosTheta1 ) ) );
+ return( vec3( fresnel( 1.0, ior[0], cosTheta1 ), fresnel( 1.0, ior[1], cosTheta1 ), fresnel( 1.0, ior[2], cosTheta1 ) ) );
}
else
{
- return( vec3( fresnel( ior[0], 1.0f, cosTheta1 ), fresnel( ior[1], 1.0f, cosTheta1 ), fresnel( ior[2], 1.0f, cosTheta1 ) ) );
+ return( vec3( fresnel( ior[0], 1.0, cosTheta1 ), fresnel( ior[1], 1.0, cosTheta1 ), fresnel( ior[2], 1.0, cosTheta1 ) ) );
}
}
diff --git a/res/effectlib/gradient3Recolor.glsllib b/res/effectlib/gradient3Recolor.glsllib
index 18556f3..ba7d593 100644
--- a/res/effectlib/gradient3Recolor.glsllib
+++ b/res/effectlib/gradient3Recolor.glsllib
@@ -35,15 +35,15 @@ float gradientInterpolate( in int interpolationMode, in float value )
case gradient_interpolation_linear :
return( value );
case gradient_interpolation_off :
- return( 0.0f );
+ return( 0.0 );
case gradient_interpolation_ease_in :
- return( 1.0f - pow( 1.0f - value, 2.0f/3.0f ) );
+ return( 1.0 - pow( 1.0 - value, 2.0/3.0 ) );
case gradient_interpolation_ease_out :
- return( pow( value, 2.0f/3.0f ) );
+ return( pow( value, 2.0/3.0 ) );
case gradient_interpolation_ease_in_out :
- return( ( value <= 0.5f )
- ? 0.5f * pow( 2.0f * value, 2.0f/3.0f )
- : 0.5f + 0.5f * ( 1.0f - pow( 2.0f * ( 1.0f - value ), 2.0f/3.0f ) ) );
+ return( ( value <= 0.5 )
+ ? 0.5 * pow( 2.0 * value, 2.0/3.0 )
+ : 0.5 + 0.5 * ( 1.0 - pow( 2.0 * ( 1.0 - value ), 2.0/3.0 ) ) );
default:
return( value ); // default is linear
}
@@ -67,7 +67,7 @@ texture_return gradient3Recolor( in float gradientPositions[3], in vec3 gradient
float relPos = gradientInterpolate( interpolationModes[index], ( pos - gradientPositions[index] ) / ( gradientPositions[index+1] - gradientPositions[index] ) );
tr.tint = mix( gradientColors[index], gradientColors[index+1], relPos );
}
- tr.mono = 0.0f;
+ tr.mono = 0.0;
return( tr );
}
diff --git a/res/effectlib/gradientGetPosition.glsllib b/res/effectlib/gradientGetPosition.glsllib
index 26b687d..4ceece0 100644
--- a/res/effectlib/gradientGetPosition.glsllib
+++ b/res/effectlib/gradientGetPosition.glsllib
@@ -39,7 +39,7 @@ float hypot( in float x, in float y )
float t = min( x, y );
x = max( x, y );
t = t/x;
- return( x * sqrt( 1.0f + ( t * t ) ) );
+ return( x * sqrt( 1.0 + ( t * t ) ) );
}
float gradientGetPosition( in int gradientMode, in vec2 xy )
@@ -55,22 +55,22 @@ float gradientGetPosition( in int gradientMode, in vec2 xy )
return( tex.x * tex.x );
case gradient_box :
// gradient is based on the distance from the center
- return( max( abs( tex.x - 0.5f ), abs( tex.y - 0.5f ) ) );
+ return( max( abs( tex.x - 0.5 ), abs( tex.y - 0.5 ) ) );
case gradient_diagonal :
// gradient is based on the distance from the diagonal
- return( sqrt(2.0f) * abs( tex.x - tex.y ) );
+ return( sqrt(2.0) * abs( tex.x - tex.y ) );
case gradient_90_degree :
// Need to check
- return( 0.0f );
+ return( 0.0 );
case gradient_symmetric_90_degree :
// Need to check
- return( 0.0f );
+ return( 0.0 );
case gradient_radial :
// Distance from center
- return( 2.0f * hypot( tex.x - 0.5f, tex.y - 0.5f ) );
+ return( 2.0 * hypot( tex.x - 0.5, tex.y - 0.5 ) );
case gradient_360_degree :
// fall through need to check
default :
- return( 0.0f );
+ return( 0.0 );
}
}
diff --git a/res/effectlib/miNoise.glsllib b/res/effectlib/miNoise.glsllib
index f2daa81..5fbff37 100644
--- a/res/effectlib/miNoise.glsllib
+++ b/res/effectlib/miNoise.glsllib
@@ -30,7 +30,7 @@
vec4 miNoise( in vec3 xyz )
{
- const float div = 1.0f / 256.0f;
+ const float div = 1.0 / 256.0;
ivec3 itmp = ivec3( xyz );
ivec3 ixyz[3] = ivec3[]( itmp & 0xFF, itmp+1 & 0xFF, itmp+2 & 0xFF );
@@ -38,19 +38,19 @@ vec4 miNoise( in vec3 xyz )
vec3 dux, ux;
dux.z = fxyz.x * div;
- dux.y = div - 2.0f * dux.z;
+ dux.y = div - 2.0 * dux.z;
dux.x = dux.z - div;
- ux.z = 0.5f * fxyz.x * dux.z;
- ux.y = dux.z + 0.5f * ( div - fxyz.x * dux.z );
- ux.x = ux.z - dux.z + 0.5f * div;
+ ux.z = 0.5 * fxyz.x * dux.z;
+ ux.y = dux.z + 0.5 * ( div - fxyz.x * dux.z );
+ ux.x = ux.z - dux.z + 0.5 * div;
vec3 duy, uy;
duy.z = fxyz.y;
- duy.y = 1.0f - 2.0f * duy.z;
- duy.x = duy.z - 1.0f;
- uy.z = 0.5f * square( duy.z );
- uy.y = duy.z + 0.5f - square( duy.z );
- uy.x = uy.z - duy.z + 0.5f;
+ duy.y = 1.0 - 2.0 * duy.z;
+ duy.x = duy.z - 1.0;
+ uy.z = 0.5 * square( duy.z );
+ uy.y = duy.z + 0.5 - square( duy.z );
+ uy.x = uy.z - duy.z + 0.5;
float duz[3] = float[]( fxyz.z - 1.0, 1.0 - 2.0 * fxyz.z, fxyz.z );
float uz[3] = float[]( 0.5 * square( fxyz.z ) - fxyz.z + 0.5, fxyz.z + 0.5 - square( fxyz.z ), 0.5 * square( fxyz.z ) );
@@ -83,7 +83,7 @@ vec4 miNoise( in vec3 xyz )
int ixyzzz = ixyz[0].z ^ ixyz[1].z;
- vec4 ret = vec4( 0.0f, 0.0f, 0.0f, 0.0f );
+ vec4 ret = vec4( 0.0, 0.0, 0.0, 0.0 );
for ( int i=0 ; i<3 ; i++ )
{
diff --git a/res/effectlib/microfacetBSDF.glsllib b/res/effectlib/microfacetBSDF.glsllib
index e164fca..8e48910 100644
--- a/res/effectlib/microfacetBSDF.glsllib
+++ b/res/effectlib/microfacetBSDF.glsllib
@@ -93,7 +93,7 @@ float DtermGGXAniso( in mat3 tanFrame, in vec3 L, in vec3 V, in float roughnessU
vec4 microfacetBSDF( in mat3 tanFrame, in vec3 L, in vec3 V, in vec3 lightSpecular, 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 );
vec3 H = normalize(L + V);
float HdotL = clamp(dot(H, L), 0.0, 1.0);
float NdotL = dot(tanFrame[2], L);
@@ -123,17 +123,17 @@ vec4 microfacetBSDF( in mat3 tanFrame, in vec3 L, in vec3 V, in vec3 lightSpecul
vec4 microfacetBSDFEnvironment( 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 = 0.01 * evalEnvironmentMap( R, roughness );
- rgb = microfacetBSDF( tanFrame, R, viewDir, rgb, 1.0f, roughnessU, roughnessV, scatter_reflect ).rgb;
+ rgb = microfacetBSDF( tanFrame, R, viewDir, rgb, 1.0, roughnessU, roughnessV, scatter_reflect ).rgb;
}
#endif
- return( vec4( rgb, 1.0f ) );
+ return( vec4( rgb, 1.0 ) );
}
@@ -211,7 +211,7 @@ vec3 sampleEnv(in vec3 L, float pdf, uint sampleCount, float roughness )
float b = 0.5*log2( pdf * d );
// convert coord to 2D
- vec2 tc = vec2( ( atan( L.x, -L.z ) + PI ) / ( 2.0f * PI ), acos( -L.y ) / PI );
+ vec2 tc = vec2( ( atan( L.x, -L.z ) + PI ) / ( 2.0 * PI ), acos( -L.y ) / PI );
float weight = step( 0.0001, roughness );
float lod = max( 0.0, min( (a - b)*weight, envMapLevels ));
@@ -221,7 +221,7 @@ vec3 sampleEnv(in vec3 L, float pdf, uint sampleCount, float roughness )
vec4 microfacetSampledBSDF( 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 );
float roughness = clamp( calculateRoughness( tanFrame[2], roughnessU, roughnessV, tanFrame[0] ), 0.0, 1.0 );
@@ -253,7 +253,7 @@ vec4 microfacetSampledBSDF( in mat3 tanFrame, in vec3 viewDir, in float roughnes
rgb /= float(NumSamples);
- return( vec4( rgb, 1.0f ) );
+ return( vec4( rgb, 1.0 ) );
}
#endif
diff --git a/res/effectlib/normalizedMix.glsllib b/res/effectlib/normalizedMix.glsllib
index 7a44022..fc90b46 100644
--- a/res/effectlib/normalizedMix.glsllib
+++ b/res/effectlib/normalizedMix.glsllib
@@ -36,7 +36,7 @@ vec4 normalizedMix( in bsdf_component components[1] )
vec4 normalizedMix( in bsdf_component components[2] )
{
float sum = components[0].weight + components[1].weight;
- float invSum = ( sum <= 1.0f ) ? 1.0f : 1.0f / sum;
+ float invSum = ( sum <= 1.0 ) ? 1.0 : 1.0 / sum;
return( invSum * ( components[0].weight * components[0].component + components[1].weight * components[1].component ) );
}
diff --git a/res/effectlib/perlinNoise.glsllib b/res/effectlib/perlinNoise.glsllib
index 1fef880..347386c 100644
--- a/res/effectlib/perlinNoise.glsllib
+++ b/res/effectlib/perlinNoise.glsllib
@@ -45,13 +45,13 @@ vec2 fade( in vec2 x )
vec3 fade( in vec3 x )
{
return( x * x * x * ( x * ( x * 6.0 - 15.0 ) + 10.0 ));
- //return( x * x * ( 3.0f - 2.0f * x ) );
+ //return( x * x * ( 3.0 - 2.0 * x ) );
}
vec4 fade( in vec4 x )
{
return( x * x * x * ( x * ( x * 6.0 - 15.0 ) + 10.0 ));
- //return( x * x * ( 3.0f - 2.0f * x ) );
+ //return( x * x * ( 3.0 - 2.0 * x ) );
}
float influence( in int hash, in float x )
@@ -80,7 +80,7 @@ float perlinNoise( in float pos )
int intPos = int( floorPos );
float fracPos = pos - floorPos;
- return( mix( influence( random255X( intPos ), fracPos ), influence( random255X( intPos+1 ), fracPos - 1.0f ), fade( fracPos ) ) );
+ return( mix( influence( random255X( intPos ), fracPos ), influence( random255X( intPos+1 ), fracPos - 1.0 ), fade( fracPos ) ) );
}
float perlinNoise( in vec2 pos )
@@ -95,9 +95,9 @@ float perlinNoise( in vec2 pos )
int by = random255Y( int(floorPos.y) + 1 );
return( mix( mix( influence( ax^ay, fracPos.x, fracPos.y )
- , influence( bx^ay, fracPos.x - 1.0f, fracPos.y ), fadedPos.x )
- , mix( influence( ax^by, fracPos.x, fracPos.y - 1.0f )
- , influence( bx^by, fracPos.x - 1.0f, fracPos.y - 1.0f ), fadedPos.x ), fadedPos.y ) );
+ , influence( bx^ay, fracPos.x - 1.0, fracPos.y ), fadedPos.x )
+ , mix( influence( ax^by, fracPos.x, fracPos.y - 1.0 )
+ , influence( bx^by, fracPos.x - 1.0, fracPos.y - 1.0 ), fadedPos.x ), fadedPos.y ) );
}
float perlinNoise( in vec3 pos )
@@ -119,13 +119,13 @@ float perlinNoise( in vec3 pos )
int bxby = bx ^ by;
return( mix( mix( mix( influence( axay^az, fracPos.x, fracPos.y, fracPos.z )
- , influence( bxay^az, fracPos.x - 1.0f, fracPos.y, fracPos.z ), fadedPos.x )
- , mix( influence( axby^az, fracPos.x, fracPos.y - 1.0f, fracPos.z )
- , influence( bxby^az, fracPos.x - 1.0f, fracPos.y - 1.0f, fracPos.z ), fadedPos.x ), fadedPos.y )
- , mix( mix( influence( axay^bz, fracPos.x, fracPos.y , fracPos.z - 1.0f )
- , influence( bxay^bz, fracPos.x - 1.0f, fracPos.y , fracPos.z - 1.0f ), fadedPos.x )
- , mix( influence( axby^bz, fracPos.x, fracPos.y - 1.0f, fracPos.z - 1.0f )
- , influence( bxby^bz, fracPos.x - 1.0f, fracPos.y - 1.0f, fracPos.z - 1.0f ), fadedPos.x ), fadedPos.y ), fadedPos.z ) );
+ , influence( bxay^az, fracPos.x - 1.0, fracPos.y, fracPos.z ), fadedPos.x )
+ , mix( influence( axby^az, fracPos.x, fracPos.y - 1.0, fracPos.z )
+ , influence( bxby^az, fracPos.x - 1.0, fracPos.y - 1.0, fracPos.z ), fadedPos.x ), fadedPos.y )
+ , mix( mix( influence( axay^bz, fracPos.x, fracPos.y , fracPos.z - 1.0 )
+ , influence( bxay^bz, fracPos.x - 1.0, fracPos.y , fracPos.z - 1.0 ), fadedPos.x )
+ , mix( influence( axby^bz, fracPos.x, fracPos.y - 1.0, fracPos.z - 1.0 )
+ , influence( bxby^bz, fracPos.x - 1.0, fracPos.y - 1.0, fracPos.z - 1.0 ), fadedPos.x ), fadedPos.y ), fadedPos.z ) );
}
float perlinNoise( in vec4 pos )
@@ -154,45 +154,45 @@ float perlinNoise( in vec4 pos )
int bzaw = bz ^ aw;
result[i] = mix( mix( mix( influence( axay^azaw, fracPos.x, fracPos.y, fracPos.z, fracPos.w )
- , influence( bxay^azaw, fracPos.x - 1.0f, fracPos.y, fracPos.z, fracPos.w ), fadedPos.x )
- , mix( influence( axby^azaw, fracPos.x, fracPos.y - 1.0f, fracPos.z, fracPos.w )
- , influence( bxby^azaw, fracPos.x - 1.0f, fracPos.y - 1.0f, fracPos.z, fracPos.w ), fadedPos.x ), fadedPos.y )
- , mix( mix( influence( axay^bzaw, fracPos.x, fracPos.y, fracPos.z - 1.0f, fracPos.w )
- , influence( bxay^bzaw, fracPos.x - 1.0f, fracPos.y, fracPos.z - 1.0f, fracPos.w ), fadedPos.x )
- , mix( influence( axby^bzaw, fracPos.x, fracPos.y - 1.0f, fracPos.z - 1.0f, fracPos.w )
- , influence( bxby^bzaw, fracPos.x - 1.0f, fracPos.y - 1.0f, fracPos.z - 1.0f, fracPos.w ), fadedPos.x ), fadedPos.y ), fadedPos.z );
+ , influence( bxay^azaw, fracPos.x - 1.0, fracPos.y, fracPos.z, fracPos.w ), fadedPos.x )
+ , mix( influence( axby^azaw, fracPos.x, fracPos.y - 1.0, fracPos.z, fracPos.w )
+ , influence( bxby^azaw, fracPos.x - 1.0, fracPos.y - 1.0, fracPos.z, fracPos.w ), fadedPos.x ), fadedPos.y )
+ , mix( mix( influence( axay^bzaw, fracPos.x, fracPos.y, fracPos.z - 1.0, fracPos.w )
+ , influence( bxay^bzaw, fracPos.x - 1.0, fracPos.y, fracPos.z - 1.0, fracPos.w ), fadedPos.x )
+ , mix( influence( axby^bzaw, fracPos.x, fracPos.y - 1.0, fracPos.z - 1.0, fracPos.w )
+ , influence( bxby^bzaw, fracPos.x - 1.0, fracPos.y - 1.0, fracPos.z - 1.0, fracPos.w ), fadedPos.x ), fadedPos.y ), fadedPos.z );
aw = random255W( int(floorPos.w) + 1 );
- fracPos.w -= 1.0f;
+ fracPos.w -= 1.0;
}
return( mix( result[0], result[1], fadedPos.w ) );
}
float summedPerlinNoise( in vec3 pos, in int terms, in bool absNoise )
{
- float sum = 0.0f;
- float weight = 1.0f;
+ float sum = 0.0;
+ float weight = 1.0;
vec3 p = pos;
while ( terms-- != 0 )
{
float noise = perlinNoise( p );
sum += weight * ( absNoise ? abs(noise) : noise );
p += p;
- weight *= 0.5f;
+ weight *= 0.5;
}
return( sum );
}
float summedPerlinNoise( in vec4 pos, in int terms, in bool absNoise )
{
- float sum = 0.0f;
- float weight = 1.0f;
+ float sum = 0.0;
+ float weight = 1.0;
vec4 p = pos;
while ( terms-- != 0 )
{
float noise = perlinNoise( p );
sum += weight * ( absNoise ? abs(noise) : noise );
p += p;
- weight *= 0.5f;
+ weight *= 0.5;
}
return( sum );
}
@@ -200,34 +200,34 @@ float summedPerlinNoise( in vec4 pos, in int terms, in bool absNoise )
float perlinNoise( in vec3 pos, in float time, in int terms, in vec3 turbulenceWeight, in bool absoluteNoise, in bool applyMarble
, in bool applyDent, in float noiseBands, in float noiseThresholdHigh, in float noiseThresholdLow )
{
- float noise = ( time == 0.0f ) ? summedPerlinNoise( pos, terms, absoluteNoise ) : summedPerlinNoise( vec4( pos, time ), terms, absoluteNoise );
- if ( turbulenceWeight != vec3( 0.0f, 0.0f, 0.0f ) )
+ float noise = ( time == 0.0 ) ? summedPerlinNoise( pos, terms, absoluteNoise ) : summedPerlinNoise( vec4( pos, time ), terms, absoluteNoise );
+ if ( turbulenceWeight != vec3( 0.0, 0.0, 0.0 ) )
{
noise = sin( dot( pos, turbulenceWeight ) + noise );
}
if ( ! absoluteNoise )
{
- noise = 0.5f * noise + 0.5f; // scale [-1,1] to [0,1]
+ noise = 0.5 * noise + 0.5; // scale [-1,1] to [0,1]
}
if ( applyMarble )
{
- noise = cos( pos.x + 5.0f * noise ); // classic Perlin marble function, with magic 5.0f
+ noise = cos( pos.x + 5.0 * noise ); // classic Perlin marble function, with magic 5.0
}
if ( applyDent )
{
noise = cube( noise );
}
- if ( noiseBands != 1.0f )
+ if ( noiseBands != 1.0 )
{
// Create banding/stripes by using the fraction component only
noise *= noiseBands;
noise -= floor( noise );
- noise += pow( 1.0f - noise, 20.0f );
+ noise += pow( 1.0 - noise, 20.0 );
}
if ( noiseThresholdLow < noiseThresholdHigh )
{
// clamp the noise
- noise = clamp( ( noise - noiseThresholdLow ) / ( noiseThresholdHigh - noiseThresholdLow ), 0.0f, 1.0f );
+ noise = clamp( ( noise - noiseThresholdLow ) / ( noiseThresholdHigh - noiseThresholdLow ), 0.0, 1.0 );
}
return( noise );
}
diff --git a/res/effectlib/physGlossyBSDF.glsllib b/res/effectlib/physGlossyBSDF.glsllib
index ff0eb8c..ece836b 100644
--- a/res/effectlib/physGlossyBSDF.glsllib
+++ b/res/effectlib/physGlossyBSDF.glsllib
@@ -66,7 +66,7 @@ vec4 kggxGlossyBSDF( in mat3 tanFrame, in vec3 L, in vec3 V, in vec3 lightSpecul
float NdotL = dot(tanFrame[2], L);
float HdotL = clamp(dot(H, L), 0.0, 1.0);
- // if (0.0f < NdotL)
+ // if (0.0 < NdotL)
// {
vec3 Haf = L + V;
@@ -123,7 +123,7 @@ vec4 wardGlossyBSDF( in mat3 tanFrame, in vec3 L, in vec3 V, in vec3 lightSpecul
float NdotL = dot(tanFrame[2], L);
float HdotL = clamp(dot(H, L), 0.0, 1.0);
-// if (0.0f < NdotL)
+// if (0.0 < NdotL)
// {
vec3 Haf = L + V;
diff --git a/res/effectlib/sampleArea.glsllib b/res/effectlib/sampleArea.glsllib
index 2253359..01f3a74 100644
--- a/res/effectlib/sampleArea.glsllib
+++ b/res/effectlib/sampleArea.glsllib
@@ -168,7 +168,7 @@ vec4 sampleAreaDiffuseTransmissive( in mat3 tanFrame, in vec3 pos, in int lightI
arealights[lightIdx].up, arealights[lightIdx].right, pos, finalDir );
intensity *= clamp( dot(finalDir, -tanFrame[2]), 0.0, 1.0 );
- float l = 0.2126f * transmissiveColor.r + 0.7152f * transmissiveColor.g + 0.0722f * transmissiveColor.b;
+ float l = 0.2126 * transmissiveColor.r + 0.7152 * transmissiveColor.g + 0.0722 * transmissiveColor.b;
float I = max( 0.0, ((dot(finalDir, -tanFrame[2]) + lightWrap)/ (1.0 + lightWrap)) );
float translucent_thickness = l * l;
diff --git a/res/effectlib/sampleLight.glsllib b/res/effectlib/sampleLight.glsllib
index 3218cdf..8afd8e2 100644
--- a/res/effectlib/sampleLight.glsllib
+++ b/res/effectlib/sampleLight.glsllib
@@ -59,7 +59,7 @@ void sampleLight(in LightSource light,
out vec3 opSpecular)
{
float att = 1.0;
- if (light.position.w == 0.0f) // directional light
+ if (light.position.w == 0.0) // directional light
{
wi = normalize(light.position.xyz);
#if QT3DS_ENABLE_SSM
@@ -67,7 +67,7 @@ void sampleLight(in LightSource light,
att *= sampleOrthographic( shadowMaps[light.shadowIdx], light.shadowControls, light.shadowView, pos, vec2(1.0, light.shadowControls.z) );
#endif
}
- else if (light.width > 0.01f && light.height > 0.01f) // area light
+ else if (light.width > 0.01 && light.height > 0.01) // area light
{
// This approach is based on the 1994 Tech Report by James Arvo --
// The Irradiance Jacobian for Partially Occluded Polyhedral Sources
@@ -106,12 +106,12 @@ void sampleLight(in LightSource light,
wi = light.position.xyz - pos;
float dist = length(wi);
wi = wi / dist; // == normalize(wi);
- att = 1.0f / (light.constantAttenuation + (light.linearAttenuation + light.quadraticAttenuation * dist) * dist);
+ att = 1.0 / (light.constantAttenuation + (light.linearAttenuation + light.quadraticAttenuation * dist) * dist);
/*
- if (light.spotCutoff < 180.0f) // spot light
+ if (light.spotCutoff < 180.0) // spot light
{
- float spot = max(0.0f, dot(wi, -light.direction.xyz));
- att *= (spot >= cos(light.spotCutoff * PI / 180.0f)) ? pow(spot, light.spotExponent) : 0.0f;
+ float spot = max(0.0, dot(wi, -light.direction.xyz));
+ att *= (spot >= cos(light.spotCutoff * PI / 180.0)) ? pow(spot, light.spotExponent) : 0.0;
}
*/
#if QT3DS_ENABLE_SSM
diff --git a/res/effectlib/simpleGlossyBSDF.glsllib b/res/effectlib/simpleGlossyBSDF.glsllib
index 31a9ac5..be6024c 100644
--- a/res/effectlib/simpleGlossyBSDF.glsllib
+++ b/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
diff --git a/res/effectlib/specularBSDF.glsllib b/res/effectlib/specularBSDF.glsllib
index 9e31544..78e541a 100644
--- a/res/effectlib/specularBSDF.glsllib
+++ b/res/effectlib/specularBSDF.glsllib
@@ -34,14 +34,14 @@
vec4 specularBSDFEnvironment( in vec3 N, in vec3 viewDir, in vec3 tint, int mode )
{
- vec3 rgb = vec3( 0.0f, 0.0f, 0.0f );
+ vec3 rgb = vec3( 0.0, 0.0, 0.0 );
if ( uEnvironmentMappingEnabled )
{
vec3 R = reflect( -viewDir, N );
- rgb = evalEnvironmentMap( R, 0.0f );
+ rgb = evalEnvironmentMap( R, 0.0 );
rgb = specularBSDF( N, R, viewDir, rgb, 1.0, 256.0, tint, scatter_reflect ).rgb;
}
- return( vec4( rgb, 1.0f ) );
+ return( vec4( rgb, 1.0 ) );
}
#endif
diff --git a/res/effectlib/spotEdf.glsllib b/res/effectlib/spotEdf.glsllib
index 663bd8f..2abe194 100644
--- a/res/effectlib/spotEdf.glsllib
+++ b/res/effectlib/spotEdf.glsllib
@@ -35,7 +35,7 @@ float spotEdf( float exponent )
float dist = length(viewDir);
vec3 spotDir = viewDir / dist;
- float spot = max(0.0f, dot(spotDir, normal));
+ float spot = max(0.0, dot(spotDir, normal));
att = pow(spot, exponent);
return att;