summaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--Studio/Content/Material Library/aluminium_anodized.material10
-rw-r--r--Studio/Content/Material Library/aluminium_anodized_emissive.material10
-rw-r--r--Studio/Content/Material Library/aluminum.material10
-rw-r--r--Studio/Content/Material Library/aluminum_anisotropic.material10
-rw-r--r--Studio/Content/Material Library/aluminum_brushed.material10
-rw-r--r--Studio/Content/Material Library/aluminum_emissive.material10
-rw-r--r--Studio/Content/Material Library/aluminum_textured_aniso.material10
-rw-r--r--Studio/Content/Material Library/asphalt.material10
-rw-r--r--Studio/Content/Material Library/bamboo_natural_matte.material10
-rw-r--r--Studio/Content/Material Library/bamboo_natural_matte_emissive.material10
-rw-r--r--Studio/Content/Material Library/carbon_fiber.material10
-rw-r--r--Studio/Content/Material Library/carbon_fiber_emissive.material10
-rw-r--r--Studio/Content/Material Library/carpaint_blue_standard.material2
-rw-r--r--Studio/Content/Material Library/carpaint_color_peel_2_layer.material2
-rw-r--r--Studio/Content/Material Library/carpaint_yellow_standard.material2
-rw-r--r--Studio/Content/Material Library/concrete.material10
-rw-r--r--Studio/Content/Material Library/copper.material10
-rw-r--r--Studio/Content/Material Library/leather_smoothed_black.material10
-rw-r--r--Studio/Content/Material Library/mesh_fence.material10
-rw-r--r--Studio/Content/Material Library/metal_mesh_fine.material10
-rw-r--r--Studio/Content/Material Library/paper_artistic.material2
-rw-r--r--Studio/Content/Material Library/paper_office.material2
-rw-r--r--Studio/Content/Material Library/plastic_structured_red.material2
-rw-r--r--Studio/Content/Material Library/plastic_structured_red_emissive.material2
-rw-r--r--Studio/Content/Material Library/porcelain.material2
-rw-r--r--Studio/Content/Material Library/powder_coat.material10
-rw-r--r--Studio/Content/Material Library/powder_coat_emissive.material10
-rw-r--r--Studio/Content/Material Library/rubber_studded_black.material10
-rw-r--r--Studio/Content/Material Library/rubber_studded_emissive.material10
-rw-r--r--Studio/Content/Material Library/simple_glass.material2
-rw-r--r--Studio/Content/Material Library/steel_milled_concentric.material2
-rw-r--r--Studio/Content/Material Library/thin_glass_frosted.material2
-rw-r--r--Studio/Content/Material Library/thin_glass_frosted_sp.material2
-rw-r--r--Studio/Content/Material Library/thin_glass_refractive.material2
-rw-r--r--Studio/Content/Material Library/walnut_matte.material10
-rw-r--r--examples/studio3d/SampleProject/materials/simple_glass.material2
-rw-r--r--src/Runtime/Qt3DSRuntimeStatic/Qt3DSRuntimeStatic.pro3
-rw-r--r--src/Runtime/Source/Qt3DSRuntimeRender/Include/Qt3DSRenderDefaultMaterialShaderGenerator.h5
-rw-r--r--src/Runtime/Source/Qt3DSRuntimeRender/Include/Qt3DSRenderLightConstantProperties.h198
-rw-r--r--src/Runtime/Source/Qt3DSRuntimeRender/Source/Qt3DSRenderCustomMaterialShaderGenerator.cpp188
-rw-r--r--src/Runtime/Source/Qt3DSRuntimeRender/Source/Qt3DSRenderDefaultMaterialShaderGenerator.cpp152
-rw-r--r--src/Runtime/res.qrc2
-rw-r--r--src/Runtime/res/effectlib/Fxaa3_8.glsllib2
-rw-r--r--src/Runtime/res/effectlib/average.glsllib2
-rw-r--r--src/Runtime/res/effectlib/calculateRoughness.glsllib4
-rw-r--r--src/Runtime/res/effectlib/customMaterial.glsllib10
-rw-r--r--src/Runtime/res/effectlib/customMaterialFragBody.glsllib8
-rw-r--r--src/Runtime/res/effectlib/customMaterialFragBodyAO.glsllib8
-rw-r--r--src/Runtime/res/effectlib/diffuseReflectionBSDF.glsllib6
-rw-r--r--src/Runtime/res/effectlib/diffuseTransmissionBSDF.glsllib6
-rw-r--r--src/Runtime/res/effectlib/fileBumpTexture.glsllib2
-rw-r--r--src/Runtime/res/effectlib/flakeNoiseBumpTexture.glsllib2
-rw-r--r--src/Runtime/res/effectlib/flakeNoiseTexture.glsllib8
-rw-r--r--src/Runtime/res/effectlib/fresnelLayer.glsllib18
-rw-r--r--src/Runtime/res/effectlib/gles2/evalEnvironmentMap.glsllib37
-rw-r--r--src/Runtime/res/effectlib/gles2/microfacetBSDF.glsllib233
-rw-r--r--src/Runtime/res/effectlib/gles2/refraction.glsllib87
-rw-r--r--src/Runtime/res/effectlib/gradient3Recolor.glsllib14
-rw-r--r--src/Runtime/res/effectlib/gradientGetPosition.glsllib14
-rw-r--r--src/Runtime/res/effectlib/miNoise.glsllib22
-rw-r--r--src/Runtime/res/effectlib/microfacetBSDF.glsllib14
-rw-r--r--src/Runtime/res/effectlib/normalizedMix.glsllib2
-rw-r--r--src/Runtime/res/effectlib/perlinNoise.glsllib68
-rw-r--r--src/Runtime/res/effectlib/physGlossyBSDF.glsllib4
-rw-r--r--src/Runtime/res/effectlib/sampleArea.glsllib2
-rw-r--r--src/Runtime/res/effectlib/sampleLight.glsllib14
-rw-r--r--src/Runtime/res/effectlib/simpleGlossyBSDF.glsllib18
-rw-r--r--src/Runtime/res/effectlib/specularBSDF.glsllib6
-rw-r--r--src/Runtime/res/effectlib/spotEdf.glsllib2
69 files changed, 956 insertions, 453 deletions
diff --git a/Studio/Content/Material Library/aluminium_anodized.material b/Studio/Content/Material Library/aluminium_anodized.material
index 9a4aac89..c846b67c 100644
--- a/Studio/Content/Material Library/aluminium_anodized.material
+++ b/Studio/Content/Material Library/aluminium_anodized.material
@@ -70,7 +70,7 @@ vec3 computeFrontMaterialEmissive()
void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor )
{
#if QT3DS_ENABLE_CG_LIGHTING
- layers[0].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, roughness, roughness, scatter_reflect );
#endif
@@ -79,7 +79,7 @@ void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir,
void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular )
{
#if QT3DS_ENABLE_CG_LIGHTING
- layers[0].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, roughness, roughness );
#endif
@@ -88,11 +88,11 @@ void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 light
void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor )
{
#if !QT3DS_ENABLE_LIGHT_PROBE
- layers[0].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, roughness, roughness, scatter_reflect );
#else
- layers[0].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, roughness, roughness );
#endif
@@ -132,7 +132,7 @@ void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFacto
float computeIOR()
{
- return( false ? 1.0f : luminance( vec3( 1, 1, 1 ) ) );
+ return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) );
}
float evalCutout()
diff --git a/Studio/Content/Material Library/aluminium_anodized_emissive.material b/Studio/Content/Material Library/aluminium_anodized_emissive.material
index 474a3105..6bd18906 100644
--- a/Studio/Content/Material Library/aluminium_anodized_emissive.material
+++ b/Studio/Content/Material Library/aluminium_anodized_emissive.material
@@ -105,7 +105,7 @@ vec3 computeFrontMaterialEmissive()
void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor )
{
#if QT3DS_ENABLE_CG_LIGHTING
- layers[0].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, roughness, roughness, scatter_reflect );
#endif
@@ -114,7 +114,7 @@ void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir,
void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular )
{
#if QT3DS_ENABLE_CG_LIGHTING
- layers[0].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, roughness, roughness );
#endif
@@ -123,11 +123,11 @@ void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 light
void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor )
{
#if !QT3DS_ENABLE_LIGHT_PROBE
- layers[0].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, roughness, roughness, scatter_reflect );
#else
- layers[0].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, roughness, roughness );
#endif
@@ -167,7 +167,7 @@ void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFacto
float computeIOR()
{
- return( false ? 1.0f : luminance( vec3( 1, 1, 1 ) ) );
+ return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) );
}
float evalCutout()
diff --git a/Studio/Content/Material Library/aluminum.material b/Studio/Content/Material Library/aluminum.material
index bd2a5ae2..da4e4e05 100644
--- a/Studio/Content/Material Library/aluminum.material
+++ b/Studio/Content/Material Library/aluminum.material
@@ -112,7 +112,7 @@ vec3 computeFrontMaterialEmissive()
void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor )
{
#if QT3DS_ENABLE_CG_LIGHTING
- layers[0].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, tmp2, tmp2, scatter_reflect );
#endif
@@ -121,7 +121,7 @@ void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir,
void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular )
{
#if QT3DS_ENABLE_CG_LIGHTING
- layers[0].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, tmp2, tmp2 );
#endif
@@ -130,11 +130,11 @@ void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 light
void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor )
{
#if !QT3DS_ENABLE_LIGHT_PROBE
- layers[0].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, tmp2, tmp2, scatter_reflect );
#else
- layers[0].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, tmp2, tmp2 );
#endif
@@ -174,7 +174,7 @@ void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFacto
float computeIOR()
{
- return( false ? 1.0f : luminance( vec3( 1, 1, 1 ) ) );
+ return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) );
}
float evalCutout()
diff --git a/Studio/Content/Material Library/aluminum_anisotropic.material b/Studio/Content/Material Library/aluminum_anisotropic.material
index e36671c2..446ef166 100644
--- a/Studio/Content/Material Library/aluminum_anisotropic.material
+++ b/Studio/Content/Material Library/aluminum_anisotropic.material
@@ -134,7 +134,7 @@ void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir,
#if QT3DS_ENABLE_CG_LIGHTING
layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, ftmp0, ftmp1, scatter_reflect );
- layers[1].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[1].layer += tmpShadowTerm * diffuseReflectionBSDF( normal, lightDir, viewDir, lightDiffuse, 0.000000 );
#endif
@@ -145,7 +145,7 @@ void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 light
#if QT3DS_ENABLE_CG_LIGHTING
layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, ftmp0, ftmp1 );
- layers[1].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[1].layer += tmpShadowTerm * lightDiffuse * sampleAreaDiffuse( layers[1].tanFrame, varWorldPos, lightIdx );
#endif
@@ -156,13 +156,13 @@ void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFact
#if !QT3DS_ENABLE_LIGHT_PROBE
layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, ftmp0, ftmp1, scatter_reflect );
- layers[1].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[1].layer += tmpShadowTerm * diffuseReflectionBSDFEnvironment( normal, 0.000000 ) * aoFactor;
#else
layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, ftmp0, ftmp1 );
- layers[1].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[1].layer += tmpShadowTerm * sampleDiffuse( layers[1].tanFrame ) * aoFactor;
#endif
@@ -202,7 +202,7 @@ void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFacto
float computeIOR()
{
- return( false ? 1.0f : luminance( vec3( 1, 1, 1 ) ) );
+ return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) );
}
float evalCutout()
diff --git a/Studio/Content/Material Library/aluminum_brushed.material b/Studio/Content/Material Library/aluminum_brushed.material
index 92f0d314..0af15733 100644
--- a/Studio/Content/Material Library/aluminum_brushed.material
+++ b/Studio/Content/Material Library/aluminum_brushed.material
@@ -112,7 +112,7 @@ vec3 computeFrontMaterialEmissive()
void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor )
{
#if QT3DS_ENABLE_CG_LIGHTING
- layers[0].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, ftmp1, ftmp2, scatter_reflect );
#endif
@@ -121,7 +121,7 @@ void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir,
void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular )
{
#if QT3DS_ENABLE_CG_LIGHTING
- layers[0].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, ftmp1, ftmp2 );
#endif
@@ -130,11 +130,11 @@ void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 light
void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor )
{
#if !QT3DS_ENABLE_LIGHT_PROBE
- layers[0].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, ftmp1, ftmp2, scatter_reflect );
#else
- layers[0].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, ftmp1, ftmp2 );
#endif
@@ -174,7 +174,7 @@ void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFacto
float computeIOR()
{
- return( false ? 1.0f : luminance( vec3( 1, 1, 1 ) ) );
+ return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) );
}
float evalCutout()
diff --git a/Studio/Content/Material Library/aluminum_emissive.material b/Studio/Content/Material Library/aluminum_emissive.material
index 67c87687..ba6e40cb 100644
--- a/Studio/Content/Material Library/aluminum_emissive.material
+++ b/Studio/Content/Material Library/aluminum_emissive.material
@@ -119,7 +119,7 @@ vec3 computeFrontMaterialEmissive()
void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor )
{
#if QT3DS_ENABLE_CG_LIGHTING
- layers[0].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, tmp3, tmp3, scatter_reflect );
#endif
@@ -128,7 +128,7 @@ void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir,
void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular )
{
#if QT3DS_ENABLE_CG_LIGHTING
- layers[0].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, tmp3, tmp3 );
#endif
@@ -137,11 +137,11 @@ void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 light
void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor )
{
#if !QT3DS_ENABLE_LIGHT_PROBE
- layers[0].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, tmp3, tmp3, scatter_reflect );
#else
- layers[0].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, tmp3, tmp3 );
#endif
@@ -181,7 +181,7 @@ void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFacto
float computeIOR()
{
- return( false ? 1.0f : luminance( vec3( 1, 1, 1 ) ) );
+ return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) );
}
float evalCutout()
diff --git a/Studio/Content/Material Library/aluminum_textured_aniso.material b/Studio/Content/Material Library/aluminum_textured_aniso.material
index 18165971..497db749 100644
--- a/Studio/Content/Material Library/aluminum_textured_aniso.material
+++ b/Studio/Content/Material Library/aluminum_textured_aniso.material
@@ -136,7 +136,7 @@ void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir,
#if QT3DS_ENABLE_CG_LIGHTING
layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, ftmp0, ftmp1, scatter_reflect );
- layers[1].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[1].layer += tmpShadowTerm * diffuseReflectionBSDF( normal, lightDir, viewDir, lightDiffuse, 0.000000 );
#endif
@@ -147,7 +147,7 @@ void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 light
#if QT3DS_ENABLE_CG_LIGHTING
layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, ftmp0, ftmp1 );
- layers[1].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[1].layer += tmpShadowTerm * lightDiffuse * sampleAreaDiffuse( layers[1].tanFrame, varWorldPos, lightIdx );
#endif
@@ -158,13 +158,13 @@ void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFact
#if !QT3DS_ENABLE_LIGHT_PROBE
layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, ftmp0, ftmp1, scatter_reflect );
- layers[1].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[1].layer += tmpShadowTerm * diffuseReflectionBSDFEnvironment( normal, 0.000000 ) * aoFactor;
#else
layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, ftmp0, ftmp1 );
- layers[1].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[1].layer += tmpShadowTerm * sampleDiffuse( layers[1].tanFrame ) * aoFactor;
#endif
@@ -204,7 +204,7 @@ void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFacto
float computeIOR()
{
- return( false ? 1.0f : luminance( vec3( 1, 1, 1 ) ) );
+ return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) );
}
float evalCutout()
diff --git a/Studio/Content/Material Library/asphalt.material b/Studio/Content/Material Library/asphalt.material
index 32923d76..66d13af9 100644
--- a/Studio/Content/Material Library/asphalt.material
+++ b/Studio/Content/Material Library/asphalt.material
@@ -114,7 +114,7 @@ void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir,
#if QT3DS_ENABLE_CG_LIGHTING
layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, roughness, roughness, scatter_reflect );
- layers[1].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[1].layer += tmpShadowTerm * diffuseReflectionBSDF( tmp5, lightDir, viewDir, lightDiffuse, 0.000000 );
#endif
@@ -125,7 +125,7 @@ void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 light
#if QT3DS_ENABLE_CG_LIGHTING
layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, roughness, roughness );
- layers[1].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[1].layer += tmpShadowTerm * lightDiffuse * sampleAreaDiffuse( layers[1].tanFrame, varWorldPos, lightIdx );
#endif
@@ -136,13 +136,13 @@ void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFact
#if !QT3DS_ENABLE_LIGHT_PROBE
layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, roughness, roughness, scatter_reflect );
- layers[1].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[1].layer += tmpShadowTerm * diffuseReflectionBSDFEnvironment( tmp5, 0.000000 ) * aoFactor;
#else
layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, roughness, roughness );
- layers[1].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[1].layer += tmpShadowTerm * sampleDiffuse( layers[1].tanFrame ) * aoFactor;
#endif
@@ -182,7 +182,7 @@ void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFacto
float computeIOR()
{
- return( false ? 1.0f : luminance( vec3( 1, 1, 1 ) ) );
+ return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) );
}
float evalCutout()
diff --git a/Studio/Content/Material Library/bamboo_natural_matte.material b/Studio/Content/Material Library/bamboo_natural_matte.material
index f32345b0..00abeb31 100644
--- a/Studio/Content/Material Library/bamboo_natural_matte.material
+++ b/Studio/Content/Material Library/bamboo_natural_matte.material
@@ -114,7 +114,7 @@ void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir,
#if QT3DS_ENABLE_CG_LIGHTING
layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, roughness, roughness, scatter_reflect );
- layers[1].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[1].layer += tmpShadowTerm * diffuseReflectionBSDF( tmp5, lightDir, viewDir, lightDiffuse, 0.000000 );
#endif
@@ -125,7 +125,7 @@ void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 light
#if QT3DS_ENABLE_CG_LIGHTING
layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, roughness, roughness );
- layers[1].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[1].layer += tmpShadowTerm * lightDiffuse * sampleAreaDiffuse( layers[1].tanFrame, varWorldPos, lightIdx );
#endif
@@ -136,13 +136,13 @@ void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFact
#if !QT3DS_ENABLE_LIGHT_PROBE
layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, roughness, roughness, scatter_reflect );
- layers[1].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[1].layer += tmpShadowTerm * diffuseReflectionBSDFEnvironment( tmp5, 0.000000 ) * aoFactor;
#else
layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, roughness, roughness );
- layers[1].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[1].layer += tmpShadowTerm * sampleDiffuse( layers[1].tanFrame ) * aoFactor;
#endif
@@ -182,7 +182,7 @@ void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFacto
float computeIOR()
{
- return( false ? 1.0f : luminance( vec3( 1, 1, 1 ) ) );
+ return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) );
}
float evalCutout()
diff --git a/Studio/Content/Material Library/bamboo_natural_matte_emissive.material b/Studio/Content/Material Library/bamboo_natural_matte_emissive.material
index 262713b2..8eb69826 100644
--- a/Studio/Content/Material Library/bamboo_natural_matte_emissive.material
+++ b/Studio/Content/Material Library/bamboo_natural_matte_emissive.material
@@ -119,7 +119,7 @@ void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir,
#if QT3DS_ENABLE_CG_LIGHTING
layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, roughness, roughness, scatter_reflect );
- layers[1].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[1].layer += tmpShadowTerm * diffuseReflectionBSDF( tmp6, lightDir, viewDir, lightDiffuse, 0.000000 );
#endif
@@ -130,7 +130,7 @@ void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 light
#if QT3DS_ENABLE_CG_LIGHTING
layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, roughness, roughness );
- layers[1].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[1].layer += tmpShadowTerm * lightDiffuse * sampleAreaDiffuse( layers[1].tanFrame, varWorldPos, lightIdx );
#endif
@@ -141,13 +141,13 @@ void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFact
#if !QT3DS_ENABLE_LIGHT_PROBE
layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, roughness, roughness, scatter_reflect );
- layers[1].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[1].layer += tmpShadowTerm * diffuseReflectionBSDFEnvironment( tmp6, 0.000000 ) * aoFactor;
#else
layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, roughness, roughness );
- layers[1].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[1].layer += tmpShadowTerm * sampleDiffuse( layers[1].tanFrame ) * aoFactor;
#endif
@@ -187,7 +187,7 @@ void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFacto
float computeIOR()
{
- return( false ? 1.0f : luminance( vec3( 1, 1, 1 ) ) );
+ return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) );
}
float evalCutout()
diff --git a/Studio/Content/Material Library/carbon_fiber.material b/Studio/Content/Material Library/carbon_fiber.material
index b74e5534..f02e0e1d 100644
--- a/Studio/Content/Material Library/carbon_fiber.material
+++ b/Studio/Content/Material Library/carbon_fiber.material
@@ -135,7 +135,7 @@ void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir,
layers[1].layer += tmpShadowTerm * microfacetBSDF( layers[1].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, ftmp0, ftmp1, scatter_reflect );
- layers[2].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[2].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[2].layer += tmpShadowTerm * diffuseReflectionBSDF( tmp6, lightDir, viewDir, lightDiffuse, 0.000000 );
#endif
@@ -148,7 +148,7 @@ void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 light
layers[1].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[1].tanFrame, varWorldPos, lightIdx, viewDir, ftmp0, ftmp1 );
- layers[2].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[2].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[2].layer += tmpShadowTerm * lightDiffuse * sampleAreaDiffuse( layers[2].tanFrame, varWorldPos, lightIdx );
#endif
@@ -161,7 +161,7 @@ void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFact
layers[1].layer += tmpShadowTerm * microfacetSampledBSDF( layers[1].tanFrame, viewDir, ftmp0, ftmp1, scatter_reflect );
- layers[2].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[2].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[2].layer += tmpShadowTerm * diffuseReflectionBSDFEnvironment( tmp6, 0.000000 ) * aoFactor;
#else
@@ -169,7 +169,7 @@ void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFact
layers[1].layer += tmpShadowTerm * sampleGlossyAniso( layers[1].tanFrame, viewDir, ftmp0, ftmp1 );
- layers[2].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[2].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[2].layer += tmpShadowTerm * sampleDiffuse( layers[2].tanFrame ) * aoFactor;
#endif
@@ -209,7 +209,7 @@ void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFacto
float computeIOR()
{
- return( false ? 1.0f : luminance( vec3( 1, 1, 1 ) ) );
+ return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) );
}
float evalCutout()
diff --git a/Studio/Content/Material Library/carbon_fiber_emissive.material b/Studio/Content/Material Library/carbon_fiber_emissive.material
index 53a27681..dcbe4a3e 100644
--- a/Studio/Content/Material Library/carbon_fiber_emissive.material
+++ b/Studio/Content/Material Library/carbon_fiber_emissive.material
@@ -140,7 +140,7 @@ void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir,
layers[1].layer += tmpShadowTerm * microfacetBSDF( layers[1].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, ftmp0, ftmp1, scatter_reflect );
- layers[2].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[2].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[2].layer += tmpShadowTerm * diffuseReflectionBSDF( tmp7, lightDir, viewDir, lightDiffuse, 0.000000 );
#endif
@@ -153,7 +153,7 @@ void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 light
layers[1].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[1].tanFrame, varWorldPos, lightIdx, viewDir, ftmp0, ftmp1 );
- layers[2].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[2].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[2].layer += tmpShadowTerm * lightDiffuse * sampleAreaDiffuse( layers[2].tanFrame, varWorldPos, lightIdx );
#endif
@@ -166,7 +166,7 @@ void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFact
layers[1].layer += tmpShadowTerm * microfacetSampledBSDF( layers[1].tanFrame, viewDir, ftmp0, ftmp1, scatter_reflect );
- layers[2].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[2].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[2].layer += tmpShadowTerm * diffuseReflectionBSDFEnvironment( tmp7, 0.000000 ) * aoFactor;
#else
@@ -174,7 +174,7 @@ void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFact
layers[1].layer += tmpShadowTerm * sampleGlossyAniso( layers[1].tanFrame, viewDir, ftmp0, ftmp1 );
- layers[2].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[2].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[2].layer += tmpShadowTerm * sampleDiffuse( layers[2].tanFrame ) * aoFactor;
#endif
@@ -214,7 +214,7 @@ void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFacto
float computeIOR()
{
- return( false ? 1.0f : luminance( vec3( 1, 1, 1 ) ) );
+ return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) );
}
float evalCutout()
diff --git a/Studio/Content/Material Library/carpaint_blue_standard.material b/Studio/Content/Material Library/carpaint_blue_standard.material
index 1be09404..6dfa9cb2 100644
--- a/Studio/Content/Material Library/carpaint_blue_standard.material
+++ b/Studio/Content/Material Library/carpaint_blue_standard.material
@@ -178,7 +178,7 @@ void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFacto
float computeIOR()
{
- return( false ? 1.0f : luminance( vec3( 1, 1, 1 ) ) );
+ return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) );
}
float evalCutout()
diff --git a/Studio/Content/Material Library/carpaint_color_peel_2_layer.material b/Studio/Content/Material Library/carpaint_color_peel_2_layer.material
index c38ca255..4312356e 100644
--- a/Studio/Content/Material Library/carpaint_color_peel_2_layer.material
+++ b/Studio/Content/Material Library/carpaint_color_peel_2_layer.material
@@ -196,7 +196,7 @@ void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFacto
float computeIOR()
{
- return( false ? 1.0f : luminance( vec3( 1, 1, 1 ) ) );
+ return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) );
}
float evalCutout()
diff --git a/Studio/Content/Material Library/carpaint_yellow_standard.material b/Studio/Content/Material Library/carpaint_yellow_standard.material
index 64305e5f..038c7507 100644
--- a/Studio/Content/Material Library/carpaint_yellow_standard.material
+++ b/Studio/Content/Material Library/carpaint_yellow_standard.material
@@ -178,7 +178,7 @@ void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFacto
float computeIOR()
{
- return( false ? 1.0f : luminance( vec3( 1, 1, 1 ) ) );
+ return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) );
}
float evalCutout()
diff --git a/Studio/Content/Material Library/concrete.material b/Studio/Content/Material Library/concrete.material
index 34e3ad1d..b98537fb 100644
--- a/Studio/Content/Material Library/concrete.material
+++ b/Studio/Content/Material Library/concrete.material
@@ -113,7 +113,7 @@ void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir,
#if QT3DS_ENABLE_CG_LIGHTING
layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, roughness, roughness, scatter_reflect );
- layers[1].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[1].layer += tmpShadowTerm * diffuseReflectionBSDF( tmp6, lightDir, viewDir, lightDiffuse, 0.000000 );
#endif
@@ -124,7 +124,7 @@ void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 light
#if QT3DS_ENABLE_CG_LIGHTING
layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, roughness, roughness );
- layers[1].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[1].layer += tmpShadowTerm * lightDiffuse * sampleAreaDiffuse( layers[1].tanFrame, varWorldPos, lightIdx );
#endif
@@ -135,13 +135,13 @@ void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFact
#if !QT3DS_ENABLE_LIGHT_PROBE
layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, roughness, roughness, scatter_reflect );
- layers[1].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[1].layer += tmpShadowTerm * diffuseReflectionBSDFEnvironment( tmp6, 0.000000 ) * aoFactor;
#else
layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, roughness, roughness );
- layers[1].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[1].layer += tmpShadowTerm * sampleDiffuse( layers[1].tanFrame ) * aoFactor;
#endif
@@ -181,7 +181,7 @@ void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFacto
float computeIOR()
{
- return( false ? 1.0f : luminance( vec3( 1, 1, 1 ) ) );
+ return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) );
}
float evalCutout()
diff --git a/Studio/Content/Material Library/copper.material b/Studio/Content/Material Library/copper.material
index a4fdfc72..b8939c27 100644
--- a/Studio/Content/Material Library/copper.material
+++ b/Studio/Content/Material Library/copper.material
@@ -70,7 +70,7 @@ vec3 computeFrontMaterialEmissive()
void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor )
{
#if QT3DS_ENABLE_CG_LIGHTING
- layers[0].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, roughness, roughness, scatter_reflect );
#endif
@@ -79,7 +79,7 @@ void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir,
void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular )
{
#if QT3DS_ENABLE_CG_LIGHTING
- layers[0].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, roughness, roughness );
#endif
@@ -88,11 +88,11 @@ void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 light
void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor )
{
#if !QT3DS_ENABLE_LIGHT_PROBE
- layers[0].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, roughness, roughness, scatter_reflect );
#else
- layers[0].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[0].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, roughness, roughness );
#endif
@@ -132,7 +132,7 @@ void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFacto
float computeIOR()
{
- return( false ? 1.0f : luminance( vec3( 1, 1, 1 ) ) );
+ return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) );
}
float evalCutout()
diff --git a/Studio/Content/Material Library/leather_smoothed_black.material b/Studio/Content/Material Library/leather_smoothed_black.material
index c0c2faec..9ad218a2 100644
--- a/Studio/Content/Material Library/leather_smoothed_black.material
+++ b/Studio/Content/Material Library/leather_smoothed_black.material
@@ -114,7 +114,7 @@ void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir,
#if QT3DS_ENABLE_CG_LIGHTING
layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, roughness, roughness, scatter_reflect );
- layers[1].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[1].layer += tmpShadowTerm * diffuseReflectionBSDF( tmp5, lightDir, viewDir, lightDiffuse, 0.000000 );
#endif
@@ -125,7 +125,7 @@ void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 light
#if QT3DS_ENABLE_CG_LIGHTING
layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, roughness, roughness );
- layers[1].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[1].layer += tmpShadowTerm * lightDiffuse * sampleAreaDiffuse( layers[1].tanFrame, varWorldPos, lightIdx );
#endif
@@ -136,13 +136,13 @@ void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFact
#if !QT3DS_ENABLE_LIGHT_PROBE
layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, roughness, roughness, scatter_reflect );
- layers[1].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[1].layer += tmpShadowTerm * diffuseReflectionBSDFEnvironment( tmp5, 0.000000 ) * aoFactor;
#else
layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, roughness, roughness );
- layers[1].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[1].layer += tmpShadowTerm * sampleDiffuse( layers[1].tanFrame ) * aoFactor;
#endif
@@ -182,7 +182,7 @@ void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFacto
float computeIOR()
{
- return( false ? 1.0f : luminance( vec3( 1, 1, 1 ) ) );
+ return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) );
}
float evalCutout()
diff --git a/Studio/Content/Material Library/mesh_fence.material b/Studio/Content/Material Library/mesh_fence.material
index d6c4f896..273fc514 100644
--- a/Studio/Content/Material Library/mesh_fence.material
+++ b/Studio/Content/Material Library/mesh_fence.material
@@ -114,7 +114,7 @@ void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir,
#if QT3DS_ENABLE_CG_LIGHTING
layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, roughness, roughness, scatter_reflect );
- layers[1].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[1].layer += tmpShadowTerm * diffuseReflectionBSDF( tmp5, lightDir, viewDir, lightDiffuse, 0.000000 );
#endif
@@ -125,7 +125,7 @@ void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 light
#if QT3DS_ENABLE_CG_LIGHTING
layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, roughness, roughness );
- layers[1].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[1].layer += tmpShadowTerm * lightDiffuse * sampleAreaDiffuse( layers[1].tanFrame, varWorldPos, lightIdx );
#endif
@@ -136,13 +136,13 @@ void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFact
#if !QT3DS_ENABLE_LIGHT_PROBE
layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, roughness, roughness, scatter_reflect );
- layers[1].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[1].layer += tmpShadowTerm * diffuseReflectionBSDFEnvironment( tmp5, 0.000000 ) * aoFactor;
#else
layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, roughness, roughness );
- layers[1].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[1].layer += tmpShadowTerm * sampleDiffuse( layers[1].tanFrame ) * aoFactor;
#endif
@@ -182,7 +182,7 @@ void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFacto
float computeIOR()
{
- return( false ? 1.0f : luminance( vec3( 1, 1, 1 ) ) );
+ return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) );
}
float evalCutout()
diff --git a/Studio/Content/Material Library/metal_mesh_fine.material b/Studio/Content/Material Library/metal_mesh_fine.material
index b4e09735..07e93a42 100644
--- a/Studio/Content/Material Library/metal_mesh_fine.material
+++ b/Studio/Content/Material Library/metal_mesh_fine.material
@@ -113,7 +113,7 @@ void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir,
#if QT3DS_ENABLE_CG_LIGHTING
layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, roughness, roughness, scatter_reflect );
- layers[1].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[1].layer += tmpShadowTerm * diffuseReflectionBSDF( tmp6, lightDir, viewDir, lightDiffuse, 0.000000 );
#endif
@@ -124,7 +124,7 @@ void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 light
#if QT3DS_ENABLE_CG_LIGHTING
layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, roughness, roughness );
- layers[1].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[1].layer += tmpShadowTerm * lightDiffuse * sampleAreaDiffuse( layers[1].tanFrame, varWorldPos, lightIdx );
#endif
@@ -135,13 +135,13 @@ void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFact
#if !QT3DS_ENABLE_LIGHT_PROBE
layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, roughness, roughness, scatter_reflect );
- layers[1].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[1].layer += tmpShadowTerm * diffuseReflectionBSDFEnvironment( tmp6, 0.000000 ) * aoFactor;
#else
layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, roughness, roughness );
- layers[1].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[1].layer += tmpShadowTerm * sampleDiffuse( layers[1].tanFrame ) * aoFactor;
#endif
@@ -181,7 +181,7 @@ void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFacto
float computeIOR()
{
- return( false ? 1.0f : luminance( vec3( 1, 1, 1 ) ) );
+ return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) );
}
float evalCutout()
diff --git a/Studio/Content/Material Library/paper_artistic.material b/Studio/Content/Material Library/paper_artistic.material
index 4ba682bb..32d85565 100644
--- a/Studio/Content/Material Library/paper_artistic.material
+++ b/Studio/Content/Material Library/paper_artistic.material
@@ -200,7 +200,7 @@ void computeBackLayerRnmColor( in vec3 normal, in vec3 rnmX, in vec3 rnmY, in ve
float computeIOR()
{
- return( false ? 1.0f : luminance( vec3( 1, 1, 1 ) ) );
+ return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) );
}
float evalCutout()
diff --git a/Studio/Content/Material Library/paper_office.material b/Studio/Content/Material Library/paper_office.material
index c784fbaa..cdb80057 100644
--- a/Studio/Content/Material Library/paper_office.material
+++ b/Studio/Content/Material Library/paper_office.material
@@ -199,7 +199,7 @@ void computeBackLayerRnmColor( in vec3 normal, in vec3 rnmX, in vec3 rnmY, in ve
float computeIOR()
{
- return( false ? 1.0f : luminance( vec3( 1, 1, 1 ) ) );
+ return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) );
}
float evalCutout()
diff --git a/Studio/Content/Material Library/plastic_structured_red.material b/Studio/Content/Material Library/plastic_structured_red.material
index cf91a943..474dcea6 100644
--- a/Studio/Content/Material Library/plastic_structured_red.material
+++ b/Studio/Content/Material Library/plastic_structured_red.material
@@ -158,7 +158,7 @@ void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFacto
float computeIOR()
{
- return( false ? 1.0f : luminance( vec3( 1, 1, 1 ) ) );
+ return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) );
}
float evalCutout()
diff --git a/Studio/Content/Material Library/plastic_structured_red_emissive.material b/Studio/Content/Material Library/plastic_structured_red_emissive.material
index f5c41786..5128136b 100644
--- a/Studio/Content/Material Library/plastic_structured_red_emissive.material
+++ b/Studio/Content/Material Library/plastic_structured_red_emissive.material
@@ -182,7 +182,7 @@ void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFacto
float computeIOR()
{
- return( false ? 1.0f : luminance( vec3( 1, 1, 1 ) ) );
+ return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) );
}
float evalCutout()
diff --git a/Studio/Content/Material Library/porcelain.material b/Studio/Content/Material Library/porcelain.material
index 111e89d7..931c606a 100644
--- a/Studio/Content/Material Library/porcelain.material
+++ b/Studio/Content/Material Library/porcelain.material
@@ -135,7 +135,7 @@ void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFacto
float computeIOR()
{
- return( false ? 1.0f : luminance( vec3( 1, 1, 1 ) ) );
+ return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) );
}
float evalCutout()
diff --git a/Studio/Content/Material Library/powder_coat.material b/Studio/Content/Material Library/powder_coat.material
index c16823f7..8e43774c 100644
--- a/Studio/Content/Material Library/powder_coat.material
+++ b/Studio/Content/Material Library/powder_coat.material
@@ -102,7 +102,7 @@ void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir,
#if QT3DS_ENABLE_CG_LIGHTING
layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, roughness, roughness, scatter_reflect );
- layers[1].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[1].layer += tmpShadowTerm * diffuseReflectionBSDF( normal, lightDir, viewDir, lightDiffuse, 0.000000 );
#endif
@@ -113,7 +113,7 @@ void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 light
#if QT3DS_ENABLE_CG_LIGHTING
layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, roughness, roughness );
- layers[1].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[1].layer += tmpShadowTerm * lightDiffuse * sampleAreaDiffuse( layers[1].tanFrame, varWorldPos, lightIdx );
#endif
@@ -124,13 +124,13 @@ void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFact
#if !QT3DS_ENABLE_LIGHT_PROBE
layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, roughness, roughness, scatter_reflect );
- layers[1].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[1].layer += tmpShadowTerm * diffuseReflectionBSDFEnvironment( normal, 0.000000 ) * aoFactor;
#else
layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, roughness, roughness );
- layers[1].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[1].layer += tmpShadowTerm * sampleDiffuse( layers[1].tanFrame ) * aoFactor;
#endif
@@ -170,7 +170,7 @@ void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFacto
float computeIOR()
{
- return( false ? 1.0f : luminance( vec3( 1, 1, 1 ) ) );
+ return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) );
}
float evalCutout()
diff --git a/Studio/Content/Material Library/powder_coat_emissive.material b/Studio/Content/Material Library/powder_coat_emissive.material
index 05f8ff7c..38cabb88 100644
--- a/Studio/Content/Material Library/powder_coat_emissive.material
+++ b/Studio/Content/Material Library/powder_coat_emissive.material
@@ -118,7 +118,7 @@ void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir,
#if QT3DS_ENABLE_CG_LIGHTING
layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, roughness, roughness, scatter_reflect );
- layers[1].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[1].layer += tmpShadowTerm * diffuseReflectionBSDF( normal, lightDir, viewDir, lightDiffuse, 0.000000 );
#endif
@@ -129,7 +129,7 @@ void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 light
#if QT3DS_ENABLE_CG_LIGHTING
layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, roughness, roughness );
- layers[1].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[1].layer += tmpShadowTerm * lightDiffuse * sampleAreaDiffuse( layers[1].tanFrame, varWorldPos, lightIdx );
#endif
@@ -140,13 +140,13 @@ void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFact
#if !QT3DS_ENABLE_LIGHT_PROBE
layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, roughness, roughness, scatter_reflect );
- layers[1].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[1].layer += tmpShadowTerm * diffuseReflectionBSDFEnvironment( normal, 0.000000 ) * aoFactor;
#else
layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, roughness, roughness );
- layers[1].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[1].layer += tmpShadowTerm * sampleDiffuse( layers[1].tanFrame ) * aoFactor;
#endif
@@ -204,7 +204,7 @@ void computeBackLayerRnmColor( in vec3 normal, in vec3 rnmX, in vec3 rnmY, in ve
float computeIOR()
{
- return( false ? 1.0f : luminance( vec3( 1, 1, 1 ) ) );
+ return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) );
}
float evalCutout()
diff --git a/Studio/Content/Material Library/rubber_studded_black.material b/Studio/Content/Material Library/rubber_studded_black.material
index 3f94c140..b50d4734 100644
--- a/Studio/Content/Material Library/rubber_studded_black.material
+++ b/Studio/Content/Material Library/rubber_studded_black.material
@@ -100,7 +100,7 @@ void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir,
#if QT3DS_ENABLE_CG_LIGHTING
layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, roughness, roughness, scatter_reflect );
- layers[1].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[1].layer += tmpShadowTerm * diffuseReflectionBSDF( tmp4, lightDir, viewDir, lightDiffuse, 0.000000 );
#endif
@@ -111,7 +111,7 @@ void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 light
#if QT3DS_ENABLE_CG_LIGHTING
layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, roughness, roughness );
- layers[1].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[1].layer += tmpShadowTerm * lightDiffuse * sampleAreaDiffuse( layers[1].tanFrame, varWorldPos, lightIdx );
#endif
@@ -122,13 +122,13 @@ void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFact
#if !QT3DS_ENABLE_LIGHT_PROBE
layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, roughness, roughness, scatter_reflect );
- layers[1].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[1].layer += tmpShadowTerm * diffuseReflectionBSDFEnvironment( tmp4, 0.000000 ) * aoFactor;
#else
layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, roughness, roughness );
- layers[1].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[1].layer += tmpShadowTerm * sampleDiffuse( layers[1].tanFrame ) * aoFactor;
#endif
@@ -168,7 +168,7 @@ void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFacto
float computeIOR()
{
- return( false ? 1.0f : luminance( vec3( 1, 1, 1 ) ) );
+ return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) );
}
float evalCutout()
diff --git a/Studio/Content/Material Library/rubber_studded_emissive.material b/Studio/Content/Material Library/rubber_studded_emissive.material
index b157af11..cbb8e09b 100644
--- a/Studio/Content/Material Library/rubber_studded_emissive.material
+++ b/Studio/Content/Material Library/rubber_studded_emissive.material
@@ -117,7 +117,7 @@ void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir,
#if QT3DS_ENABLE_CG_LIGHTING
layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, roughness, roughness, scatter_reflect );
- layers[1].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[1].layer += tmpShadowTerm * diffuseReflectionBSDF( tmp5, lightDir, viewDir, lightDiffuse, 0.000000 );
#endif
@@ -128,7 +128,7 @@ void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 light
#if QT3DS_ENABLE_CG_LIGHTING
layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, roughness, roughness );
- layers[1].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[1].layer += tmpShadowTerm * lightDiffuse * sampleAreaDiffuse( layers[1].tanFrame, varWorldPos, lightIdx );
#endif
@@ -139,13 +139,13 @@ void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFact
#if !QT3DS_ENABLE_LIGHT_PROBE
layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, roughness, roughness, scatter_reflect );
- layers[1].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[1].layer += tmpShadowTerm * diffuseReflectionBSDFEnvironment( tmp5, 0.000000 ) * aoFactor;
#else
layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, roughness, roughness );
- layers[1].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[1].layer += tmpShadowTerm * sampleDiffuse( layers[1].tanFrame ) * aoFactor;
#endif
@@ -185,7 +185,7 @@ void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFacto
float computeIOR()
{
- return( false ? 1.0f : luminance( vec3( 1, 1, 1 ) ) );
+ return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) );
}
float evalCutout()
diff --git a/Studio/Content/Material Library/simple_glass.material b/Studio/Content/Material Library/simple_glass.material
index 216a3fce..a6b4ee09 100644
--- a/Studio/Content/Material Library/simple_glass.material
+++ b/Studio/Content/Material Library/simple_glass.material
@@ -134,7 +134,7 @@ void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFacto
float computeIOR()
{
- return( true ? 1.0f : luminance( vec3( abbeNumberIOR(glass_ior, 0.000000 ) ) ) );
+ return( true ? 1.0 : luminance( vec3( abbeNumberIOR(glass_ior, 0.000000 ) ) ) );
}
float evalCutout()
diff --git a/Studio/Content/Material Library/steel_milled_concentric.material b/Studio/Content/Material Library/steel_milled_concentric.material
index 8ab2bad6..4407e038 100644
--- a/Studio/Content/Material Library/steel_milled_concentric.material
+++ b/Studio/Content/Material Library/steel_milled_concentric.material
@@ -183,7 +183,7 @@ void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFacto
float computeIOR()
{
- return( false ? 1.0f : luminance( vec3( 1, 1, 1 ) ) );
+ return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) );
}
float evalCutout()
diff --git a/Studio/Content/Material Library/thin_glass_frosted.material b/Studio/Content/Material Library/thin_glass_frosted.material
index 051e4769..228a3a1e 100644
--- a/Studio/Content/Material Library/thin_glass_frosted.material
+++ b/Studio/Content/Material Library/thin_glass_frosted.material
@@ -191,7 +191,7 @@ void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFacto
float computeIOR()
{
- return( false ? 1.0f : luminance( vec3( abbeNumberIOR(glass_ior, 0.000000 ) ) ) );
+ return( false ? 1.0 : luminance( vec3( abbeNumberIOR(glass_ior, 0.000000 ) ) ) );
}
float evalCutout()
diff --git a/Studio/Content/Material Library/thin_glass_frosted_sp.material b/Studio/Content/Material Library/thin_glass_frosted_sp.material
index 74cf84bf..d7741b8b 100644
--- a/Studio/Content/Material Library/thin_glass_frosted_sp.material
+++ b/Studio/Content/Material Library/thin_glass_frosted_sp.material
@@ -174,7 +174,7 @@ void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFacto
float computeIOR()
{
- return( false ? 1.0f : luminance( vec3( abbeNumberIOR(glass_ior, 0.000000 ) ) ) );
+ return( false ? 1.0 : luminance( vec3( abbeNumberIOR(glass_ior, 0.000000 ) ) ) );
}
float evalCutout()
diff --git a/Studio/Content/Material Library/thin_glass_refractive.material b/Studio/Content/Material Library/thin_glass_refractive.material
index 23663362..8c849921 100644
--- a/Studio/Content/Material Library/thin_glass_refractive.material
+++ b/Studio/Content/Material Library/thin_glass_refractive.material
@@ -136,7 +136,7 @@ void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFacto
float computeIOR()
{
- return( false ? 1.0f : luminance( vec3( abbeNumberIOR(glass_ior, 0.000000 ) ) ) );
+ return( false ? 1.0 : luminance( vec3( abbeNumberIOR(glass_ior, 0.000000 ) ) ) );
}
float evalCutout()
diff --git a/Studio/Content/Material Library/walnut_matte.material b/Studio/Content/Material Library/walnut_matte.material
index d117b9be..65bfb04d 100644
--- a/Studio/Content/Material Library/walnut_matte.material
+++ b/Studio/Content/Material Library/walnut_matte.material
@@ -114,7 +114,7 @@ void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir,
#if QT3DS_ENABLE_CG_LIGHTING
layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, roughness, roughness, scatter_reflect );
- layers[1].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[1].layer += tmpShadowTerm * diffuseReflectionBSDF( tmp5, lightDir, viewDir, lightDiffuse, 0.000000 );
#endif
@@ -125,7 +125,7 @@ void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 light
#if QT3DS_ENABLE_CG_LIGHTING
layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, roughness, roughness );
- layers[1].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[1].layer += tmpShadowTerm * lightDiffuse * sampleAreaDiffuse( layers[1].tanFrame, varWorldPos, lightIdx );
#endif
@@ -136,13 +136,13 @@ void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFact
#if !QT3DS_ENABLE_LIGHT_PROBE
layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, roughness, roughness, scatter_reflect );
- layers[1].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[1].layer += tmpShadowTerm * diffuseReflectionBSDFEnvironment( tmp5, 0.000000 ) * aoFactor;
#else
layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, roughness, roughness );
- layers[1].base += tmpShadowTerm * vec4( 0.0f, 0.0f, 0.0f, 1.0f );
+ layers[1].base += tmpShadowTerm * vec4( 0.0, 0.0, 0.0, 1.0 );
layers[1].layer += tmpShadowTerm * sampleDiffuse( layers[1].tanFrame ) * aoFactor;
#endif
@@ -182,7 +182,7 @@ void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFacto
float computeIOR()
{
- return( false ? 1.0f : luminance( vec3( 1, 1, 1 ) ) );
+ return( false ? 1.0 : luminance( vec3( 1, 1, 1 ) ) );
}
float evalCutout()
diff --git a/examples/studio3d/SampleProject/materials/simple_glass.material b/examples/studio3d/SampleProject/materials/simple_glass.material
index 216a3fce..a6b4ee09 100644
--- a/examples/studio3d/SampleProject/materials/simple_glass.material
+++ b/examples/studio3d/SampleProject/materials/simple_glass.material
@@ -134,7 +134,7 @@ void computeBackLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFacto
float computeIOR()
{
- return( true ? 1.0f : luminance( vec3( abbeNumberIOR(glass_ior, 0.000000 ) ) ) );
+ return( true ? 1.0 : luminance( vec3( abbeNumberIOR(glass_ior, 0.000000 ) ) ) );
}
float evalCutout()
diff --git a/src/Runtime/Qt3DSRuntimeStatic/Qt3DSRuntimeStatic.pro b/src/Runtime/Qt3DSRuntimeStatic/Qt3DSRuntimeStatic.pro
index 9836a500..d915897b 100644
--- a/src/Runtime/Qt3DSRuntimeStatic/Qt3DSRuntimeStatic.pro
+++ b/src/Runtime/Qt3DSRuntimeStatic/Qt3DSRuntimeStatic.pro
@@ -481,7 +481,8 @@ HEADERS += \
../Source/Engine/Include/Qt3DSEGLWindowSystem.h \
../Source/Engine/Include/Qt3DSPluginDLL.h \
../Source/Engine/Include/Qt3DSWindowSystem.h \
- ../Source/Qt3DSRuntimeRender/Include/Qt3DSRenderContextCore.h
+ ../Source/Qt3DSRuntimeRender/Include/Qt3DSRenderContextCore.h \
+ ../Source/Qt3DSRuntimeRender/Include/Qt3DSRenderLightConstantProperties.h
win32 {
SOURCES += \
diff --git a/src/Runtime/Source/Qt3DSRuntimeRender/Include/Qt3DSRenderDefaultMaterialShaderGenerator.h b/src/Runtime/Source/Qt3DSRuntimeRender/Include/Qt3DSRenderDefaultMaterialShaderGenerator.h
index 8303a425..54c9367e 100644
--- a/src/Runtime/Source/Qt3DSRuntimeRender/Include/Qt3DSRenderDefaultMaterialShaderGenerator.h
+++ b/src/Runtime/Source/Qt3DSRuntimeRender/Include/Qt3DSRenderDefaultMaterialShaderGenerator.h
@@ -31,13 +31,13 @@
#ifndef QT3DS_RENDER_DEFAULT_MATERIAL_SHADER_GENERATOR_H
#define QT3DS_RENDER_DEFAULT_MATERIAL_SHADER_GENERATOR_H
#include "Qt3DSRenderMaterialShaderGenerator.h"
+#include "Qt3DSRenderLightConstantProperties.h"
namespace qt3ds {
namespace render {
class Qt3DSShadowMap;
struct SShaderGeneratorGeneratedShader;
- struct SLightConstantProperties;
class IDefaultMaterialVertexPipeline : public IShaderStageGenerator
{
@@ -113,7 +113,8 @@ namespace render {
static IDefaultMaterialShaderGenerator &
CreateDefaultMaterialShaderGenerator(IQt3DSRenderContext &inRenderContext);
- SLightConstantProperties *GetLightConstantProperties(SShaderGeneratorGeneratedShader &shader);
+ SLightConstantProperties<SShaderGeneratorGeneratedShader>
+ *GetLightConstantProperties(SShaderGeneratorGeneratedShader &shader);
};
}
}
diff --git a/src/Runtime/Source/Qt3DSRuntimeRender/Include/Qt3DSRenderLightConstantProperties.h b/src/Runtime/Source/Qt3DSRuntimeRender/Include/Qt3DSRenderLightConstantProperties.h
new file mode 100644
index 00000000..a0f0cc06
--- /dev/null
+++ b/src/Runtime/Source/Qt3DSRuntimeRender/Include/Qt3DSRenderLightConstantProperties.h
@@ -0,0 +1,198 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DS_RENDER_LIGHT_CONSTANT_PROPERTIES
+#define QT3DS_RENDER_LIGHT_CONSTANT_PROPERTIES
+
+#include "render/Qt3DSRenderShaderProgram.h"
+
+namespace qt3ds {
+namespace render {
+
+static const QStringList lconstantnames = {
+ QStringLiteral("position"),
+ QStringLiteral("direction"),
+ QStringLiteral("up"),
+ QStringLiteral("right"),
+ QStringLiteral("diffuse"),
+ QStringLiteral("ambient"),
+ QStringLiteral("specular"),
+ QStringLiteral("spotExponent"),
+ QStringLiteral("spotCutoff"),
+ QStringLiteral("constantAttenuation"),
+ QStringLiteral("linearAttenuation"),
+ QStringLiteral("quadraticAttenuation"),
+ QStringLiteral("range"),
+ QStringLiteral("width"),
+ QStringLiteral("height"),
+ QStringLiteral("shadowControls"),
+ QStringLiteral("shadowView"),
+ QStringLiteral("shadowIdx"),
+ QStringLiteral("attenuation")
+};
+
+#define LCSEED QStringLiteral("%1%2")
+
+template <typename GeneratedShader>
+struct SLightConstantProperties
+{
+ struct LightConstants
+ {
+ NVRenderCachedShaderProperty<QT3DSVec4> m_position;
+ NVRenderCachedShaderProperty<QT3DSVec4> m_direction;
+ NVRenderCachedShaderProperty<QT3DSVec4> m_up;
+ NVRenderCachedShaderProperty<QT3DSVec4> m_right;
+ NVRenderCachedShaderProperty<QT3DSVec4> m_diffuse;
+ NVRenderCachedShaderProperty<QT3DSVec4> m_ambient;
+ NVRenderCachedShaderProperty<QT3DSVec4> m_specular;
+ NVRenderCachedShaderProperty<QT3DSF32> m_spotExponent;
+ NVRenderCachedShaderProperty<QT3DSF32> m_spotCutoff;
+ NVRenderCachedShaderProperty<QT3DSF32> m_constantAttenuation;
+ NVRenderCachedShaderProperty<QT3DSF32> m_linearAttenuation;
+ NVRenderCachedShaderProperty<QT3DSF32> m_quadraticAttenuation;
+ NVRenderCachedShaderProperty<QT3DSF32> m_range;
+ NVRenderCachedShaderProperty<QT3DSF32> m_width;
+ NVRenderCachedShaderProperty<QT3DSF32> m_height;
+ NVRenderCachedShaderProperty<QT3DSVec4> m_shadowControls;
+ NVRenderCachedShaderProperty<QT3DSMat44> m_shadowView;
+ NVRenderCachedShaderProperty<QT3DSI32> m_shadowIdx;
+ NVRenderCachedShaderProperty<QT3DSVec3> m_attenuation;
+
+ LightConstants(const QString &lightRef, render::NVRenderShaderProgram &shader)
+ : m_position(LCSEED.arg(lightRef, lconstantnames[0]), shader)
+ , m_direction(LCSEED.arg(lightRef).arg(lconstantnames[1]), shader)
+ , m_up(LCSEED.arg(lightRef, lconstantnames[2]), shader)
+ , m_right(LCSEED.arg(lightRef, lconstantnames[3]), shader)
+ , m_diffuse(LCSEED.arg(lightRef, lconstantnames[4]), shader)
+ , m_ambient(LCSEED.arg(lightRef, lconstantnames[5]), shader)
+ , m_specular(LCSEED.arg(lightRef, lconstantnames[6]), shader)
+ , m_spotExponent(LCSEED.arg(lightRef, lconstantnames[7]), shader)
+ , m_spotCutoff(LCSEED.arg(lightRef, lconstantnames[8]), shader)
+ , m_constantAttenuation(LCSEED.arg(lightRef, lconstantnames[9]), shader)
+ , m_linearAttenuation(LCSEED.arg(lightRef, lconstantnames[10]), shader)
+ , m_quadraticAttenuation(LCSEED.arg(lightRef, lconstantnames[11]), shader)
+ , m_range(LCSEED.arg(lightRef, lconstantnames[12]), shader)
+ , m_width(LCSEED.arg(lightRef, lconstantnames[13]), shader)
+ , m_height(LCSEED.arg(lightRef, lconstantnames[14]), shader)
+ , m_shadowControls(LCSEED.arg(lightRef, lconstantnames[15]), shader)
+ , m_shadowView(LCSEED.arg(lightRef, lconstantnames[16]), shader)
+ , m_shadowIdx(LCSEED.arg(lightRef, lconstantnames[17]), shader)
+ , m_attenuation(LCSEED.arg(lightRef, lconstantnames[18]), shader)
+ {
+
+ }
+
+ template <typename LightProps>
+ void updateLights(LightProps &props)
+ {
+ m_position.Set(props.m_position);
+ m_direction.Set(props.m_direction);
+ m_up.Set(props.m_up);
+ m_right.Set(props.m_right);
+ m_diffuse.Set(props.m_diffuse);
+ m_ambient.Set(props.m_ambient);
+ m_specular.Set(props.m_specular);
+ m_spotExponent.Set(props.m_spotExponent);
+ m_spotCutoff.Set(props.m_spotCutoff);
+ m_constantAttenuation.Set(props.m_constantAttenuation);
+ m_linearAttenuation.Set(props.m_linearAttenuation);
+ m_quadraticAttenuation.Set(props.m_quadraticAttenuation);
+ m_range.Set(props.m_range);
+ m_width.Set(props.m_width);
+ m_height.Set(props.m_height);
+ m_shadowControls.Set(props.m_shadowControls);
+ m_shadowView.Set(props.m_shadowView);
+ m_shadowIdx.Set(props.m_shadowIdx);
+ m_attenuation.Set(QT3DSVec3(props.m_constantAttenuation,
+ props.m_linearAttenuation,
+ props.m_quadraticAttenuation));
+ }
+ };
+
+ SLightConstantProperties(GeneratedShader &shader, bool packed)
+ : m_lightCount("uNumLights", shader.m_Shader)
+ {
+ m_constants.resize(shader.m_Lights.size());
+ for (unsigned int i = 0; i < shader.m_Lights.size(); ++i) {
+ QString lref;
+ if (packed)
+ lref = QStringLiteral("light_%1_");
+ else
+ lref = QStringLiteral("lights[%1].");
+ lref = lref.arg(i);
+ m_constants[i] = new LightConstants(lref, shader.m_Shader);
+ }
+ m_lightCount.Set(shader.m_Lights.size());
+ m_lightCountInt = shader.m_Lights.size();
+ }
+
+ SLightConstantProperties(const QString &lseed, const QString &lcount,
+ GeneratedShader &shader, bool packed, int count)
+ : m_lightCount(lcount, shader.m_Shader)
+ {
+ m_constants.resize(count);
+ for (unsigned int i = 0; i < count; ++i) {
+ QString lref;
+ if (packed)
+ lref = lseed + QStringLiteral("_%1_");
+ else
+ lref = lseed + QStringLiteral("[%1].");
+ lref = lref.arg(i);
+ m_constants[i] = new LightConstants(lref, shader.m_Shader);
+ }
+ m_lightCount.Set(count);
+ m_lightCountInt = count;
+ }
+
+ ~SLightConstantProperties()
+ {
+ qDeleteAll(m_constants);
+ }
+
+ void updateLights(GeneratedShader &shader)
+ {
+ for (int i = 0; i < m_constants.size(); ++i)
+ m_constants[i]->updateLights(shader.m_Lights[i].m_LightData);
+ }
+ template <typename LightProps>
+ void updateLights(const QVector<LightProps*> &props)
+ {
+ for (int i = 0; i < m_constants.size(); ++i)
+ m_constants[i]->updateLights(props[i]->m_LightData);
+ }
+
+ QVector<LightConstants *> m_constants;
+ NVRenderCachedShaderProperty<QT3DSI32> m_lightCount;
+ int m_lightCountInt;
+};
+
+}
+}
+
+#endif
diff --git a/src/Runtime/Source/Qt3DSRuntimeRender/Source/Qt3DSRenderCustomMaterialShaderGenerator.cpp b/src/Runtime/Source/Qt3DSRuntimeRender/Source/Qt3DSRenderCustomMaterialShaderGenerator.cpp
index 0feb8bae..bf6feff7 100644
--- a/src/Runtime/Source/Qt3DSRuntimeRender/Source/Qt3DSRenderCustomMaterialShaderGenerator.cpp
+++ b/src/Runtime/Source/Qt3DSRuntimeRender/Source/Qt3DSRenderCustomMaterialShaderGenerator.cpp
@@ -41,6 +41,7 @@
#include "Qt3DSRenderShadowMap.h"
#include "Qt3DSRenderCustomMaterial.h"
#include "Qt3DSRenderCustomMaterialSystem.h"
+#include "Qt3DSRenderLightConstantProperties.h"
using namespace qt3ds::render;
using qt3ds::render::NVRenderCachedShaderProperty;
@@ -176,6 +177,9 @@ struct SShaderGeneratorGeneratedShader
NVRenderCachedShaderBuffer<qt3ds::render::NVRenderShaderConstantBuffer *> m_LightsBuffer;
NVRenderCachedShaderBuffer<qt3ds::render::NVRenderShaderConstantBuffer *> m_AreaLightsBuffer;
+ SLightConstantProperties<SShaderGeneratorGeneratedShader> *m_lightsProperties;
+ SLightConstantProperties<SShaderGeneratorGeneratedShader> *m_areaLightsProperties;
+
// Cache the image property name lookups
TCustomMaterialImagMap m_Images; // Images external to custom material usage
volatile QT3DSI32 m_RefCount;
@@ -207,13 +211,20 @@ struct SShaderGeneratorGeneratedShader
, m_AoShadowParams("cbAoShadow", inShader)
, m_LightsBuffer("cbBufferLights", inShader)
, m_AreaLightsBuffer("cbBufferAreaLights", inShader)
+ , m_lightsProperties(nullptr)
+ , m_areaLightsProperties(nullptr)
, m_Images(inContext.GetAllocator(), "SShaderGeneratorGeneratedShader::m_Images")
, m_RefCount(0)
{
m_Shader.addRef();
}
- ~SShaderGeneratorGeneratedShader() { m_Shader.release(); }
+ ~SShaderGeneratorGeneratedShader()
+ {
+ m_Shader.release();
+ delete m_lightsProperties;
+ delete m_areaLightsProperties;
+ }
void addRef() { ++m_RefCount; }
void release()
@@ -224,6 +235,27 @@ struct SShaderGeneratorGeneratedShader
NVDelete(alloc, this);
}
}
+
+ SLightConstantProperties<SShaderGeneratorGeneratedShader> *GetLightProperties(int count)
+ {
+ if (!m_lightsProperties || m_areaLightsProperties->m_lightCountInt < count) {
+ if (m_lightsProperties)
+ delete m_lightsProperties;
+ m_lightsProperties = new SLightConstantProperties<SShaderGeneratorGeneratedShader>
+ ("lights", "uNumLights", *this, false, count);
+ }
+ return m_lightsProperties;
+ }
+ SLightConstantProperties<SShaderGeneratorGeneratedShader> *GetAreaLightProperties(int count)
+ {
+ if (!m_areaLightsProperties || m_areaLightsProperties->m_lightCountInt < count) {
+ if (m_areaLightsProperties)
+ delete m_areaLightsProperties;
+ m_areaLightsProperties = new SLightConstantProperties<SShaderGeneratorGeneratedShader>
+ ("areaLights", "uNumAreaLights", *this, false, count);
+ }
+ return m_areaLightsProperties;
+ }
};
struct SShaderGenerator : public ICustomMaterialShaderGenerator
@@ -574,68 +606,106 @@ struct SShaderGenerator : public ICustomMaterialShaderGenerator
theShader.m_ProjMatrix.Set(vProjMat);
}
- // this call setsup the constant buffer for ambient occlusion and shadow
- theShader.m_AoShadowParams.Set();
-
- //
- NVRenderConstantBuffer *pLightCb =
- GetLightConstantBuffer("cbBufferLights", inLights.size());
- NVRenderConstantBuffer *pAreaLightCb =
- GetLightConstantBuffer("cbBufferAreaLights", inLights.size());
-
// set lights separate for area lights
QT3DSI32 cgLights = 0, areaLights = 0;
QT3DSI32 numShadowMaps = 0, numShadowCubes = 0;
- // Split the count between CG lights and area lights
- for (QT3DSU32 lightIdx = 0; lightIdx < inLights.size() && pLightCb; ++lightIdx) {
- SShadowMapEntry *theShadow = NULL;
- if (inShadowMaps) {
- theShadow = inShadowMaps->GetShadowMapEntry(lightIdx);
- }
-
- QT3DSI32 shdwIdx = (inLights[lightIdx]->m_LightType != RenderLightTypes::Directional)
- ? numShadowCubes
- : numShadowMaps;
- SetShadowMaps(inProgram, theShadow, numShadowMaps, numShadowCubes);
+ // this call setup the constant buffer for ambient occlusion and shadow
+ theShader.m_AoShadowParams.Set();
- if (inLights[lightIdx]->m_LightType == RenderLightTypes::Area) {
- SShaderLightProperties *theAreaLightEntry =
- SetLight(inProgram, lightIdx, areaLights, inLights[lightIdx], theShadow,
- shdwIdx, inCamera.m_ClipFar);
+ if (m_RenderContext.GetRenderContext().GetConstantBufferSupport()) {
+ NVRenderConstantBuffer *pLightCb =
+ GetLightConstantBuffer("cbBufferLights", inLights.size());
+ NVRenderConstantBuffer *pAreaLightCb =
+ GetLightConstantBuffer("cbBufferAreaLights", inLights.size());
+
+ // Split the count between CG lights and area lights
+ for (QT3DSU32 lightIdx = 0; lightIdx < inLights.size() && pLightCb; ++lightIdx) {
+ SShadowMapEntry *theShadow = NULL;
+ if (inShadowMaps)
+ theShadow = inShadowMaps->GetShadowMapEntry(lightIdx);
+
+ QT3DSI32 shdwIdx = (inLights[lightIdx]->m_LightType
+ != RenderLightTypes::Directional)
+ ? numShadowCubes
+ : numShadowMaps;
+ SetShadowMaps(inProgram, theShadow, numShadowMaps, numShadowCubes);
+
+ if (inLights[lightIdx]->m_LightType == RenderLightTypes::Area) {
+ SShaderLightProperties *theAreaLightEntry =
+ SetLight(inProgram, lightIdx, areaLights, inLights[lightIdx], theShadow,
+ shdwIdx, inCamera.m_ClipFar);
+
+ if (theAreaLightEntry && pAreaLightCb) {
+ pAreaLightCb->UpdateRaw(
+ areaLights * sizeof(SLightSourceShader) + (4 * sizeof(QT3DSI32)),
+ NVDataRef<QT3DSU8>((QT3DSU8 *)&theAreaLightEntry->m_LightData,
+ sizeof(SLightSourceShader)));
+ }
- if (theAreaLightEntry && pAreaLightCb)
- pAreaLightCb->UpdateRaw(areaLights * sizeof(SLightSourceShader)
- + (4 * sizeof(QT3DSI32)),
- NVDataRef<QT3DSU8>((QT3DSU8 *)&theAreaLightEntry->m_LightData,
+ areaLights++;
+ } else {
+ SShaderLightProperties *theLightEntry =
+ SetLight(inProgram, lightIdx, cgLights, inLights[lightIdx], theShadow,
+ shdwIdx, inCamera.m_ClipFar);
+
+ if (theLightEntry && pLightCb) {
+ pLightCb->UpdateRaw(
+ cgLights * sizeof(SLightSourceShader) + (4 * sizeof(QT3DSI32)),
+ NVDataRef<QT3DSU8>((QT3DSU8 *)&theLightEntry->m_LightData,
sizeof(SLightSourceShader)));
+ }
- areaLights++;
- } else {
- SShaderLightProperties *theLightEntry =
- SetLight(inProgram, lightIdx, cgLights, inLights[lightIdx], theShadow, shdwIdx,
- inCamera.m_ClipFar);
+ cgLights++;
+ }
+ }
- if (theLightEntry && pLightCb)
- pLightCb->UpdateRaw(cgLights * sizeof(SLightSourceShader) + (4 * sizeof(QT3DSI32)),
- NVDataRef<QT3DSU8>((QT3DSU8 *)&theLightEntry->m_LightData,
- sizeof(SLightSourceShader)));
+ if (pLightCb) {
+ pLightCb->UpdateRaw(0, NVDataRef<QT3DSU8>((QT3DSU8 *)&cgLights, sizeof(QT3DSI32)));
+ theShader.m_LightsBuffer.Set();
+ }
+ if (pAreaLightCb) {
+ pAreaLightCb->UpdateRaw(0, NVDataRef<QT3DSU8>((QT3DSU8 *)&areaLights,
+ sizeof(QT3DSI32)));
+ theShader.m_AreaLightsBuffer.Set();
+ }
- cgLights++;
+ theShader.m_LightCount.Set(cgLights);
+ theShader.m_AreaLightCount.Set(areaLights);
+ } else {
+ QVector<SShaderLightProperties *> lprop;
+ QVector<SShaderLightProperties *> alprop;
+ for (int lightIdx = 0; lightIdx < inLights.size(); ++lightIdx) {
+
+ SShadowMapEntry *theShadow = NULL;
+ if (inShadowMaps)
+ theShadow = inShadowMaps->GetShadowMapEntry(lightIdx);
+
+ QT3DSI32 shdwIdx = (inLights[lightIdx]->m_LightType
+ != RenderLightTypes::Directional)
+ ? numShadowCubes
+ : numShadowMaps;
+ SetShadowMaps(inProgram, theShadow, numShadowMaps, numShadowCubes);
+
+ SShaderLightProperties *p = SetLight(inProgram, lightIdx, areaLights,
+ inLights[lightIdx], theShadow,
+ shdwIdx, inCamera.m_ClipFar);
+ if (inLights[lightIdx]->m_LightType == RenderLightTypes::Area)
+ alprop.push_back(p);
+ else
+ lprop.push_back(p);
}
- }
+ SLightConstantProperties<SShaderGeneratorGeneratedShader> *lightProperties
+ = theShader.GetLightProperties(lprop.size());
+ SLightConstantProperties<SShaderGeneratorGeneratedShader> *areaLightProperties
+ = theShader.GetAreaLightProperties(alprop.size());
- if (pLightCb) {
- pLightCb->UpdateRaw(0, NVDataRef<QT3DSU8>((QT3DSU8 *)&cgLights, sizeof(QT3DSI32)));
- theShader.m_LightsBuffer.Set();
- }
- if (pAreaLightCb) {
- pAreaLightCb->UpdateRaw(0, NVDataRef<QT3DSU8>((QT3DSU8 *)&areaLights, sizeof(QT3DSI32)));
- theShader.m_AreaLightsBuffer.Set();
- }
+ lightProperties->updateLights(lprop);
+ areaLightProperties->updateLights(alprop);
- theShader.m_LightCount.Set(cgLights);
- theShader.m_AreaLightCount.Set(areaLights);
+ theShader.m_LightCount.Set(lprop.size());
+ theShader.m_AreaLightCount.Set(alprop.size());
+ }
theShader.m_ShadowMapCount.Set(numShadowMaps);
theShader.m_ShadowCubeCount.Set(numShadowCubes);
}
@@ -950,6 +1020,15 @@ struct SShaderGenerator : public ICustomMaterialShaderGenerator
eastl::string srcString(fragSource);
+ if (m_RenderContext.GetRenderContext().GetRenderContextType()
+ == NVRenderContextValues::GLES2) {
+ eastl::string::size_type pos = 0;
+ while ((pos = srcString.find("out vec4 fragColor", pos)) != eastl::string::npos) {
+ srcString.insert(pos, "//");
+ pos += strlen("//out vec4 fragColor");
+ }
+ }
+
fragmentShader << "#define FRAGMENT_SHADER\n\n";
if (srcString.find("void main()") == eastl::string::npos)
@@ -963,7 +1042,7 @@ struct SShaderGenerator : public ICustomMaterialShaderGenerator
fragmentShader << "#define QT3DS_ENABLE_RNM 0\n\n";
- fragmentShader << fragSource << Endl;
+ fragmentShader << srcString.data() << Endl;
if (srcString.find("void main()") != eastl::string::npos) // If a "main()" is already
// written, we'll assume that the
@@ -1046,8 +1125,11 @@ struct SShaderGenerator : public ICustomMaterialShaderGenerator
fragmentShader.Append("\trgba = mix( vec4(0.0, 1.0, 0.0, 1.0), rgba, mixVal);");
}
-
- fragmentShader << " fragColor = rgba;" << Endl;
+ if (m_RenderContext.GetRenderContext().GetRenderContextType()
+ == NVRenderContextValues::GLES2)
+ fragmentShader << " gl_FragColor = rgba;" << Endl;
+ else
+ fragmentShader << " fragColor = rgba;" << Endl;
}
NVRenderShaderProgram *GenerateCustomMaterialShader(const char8_t *inShaderPrefix,
diff --git a/src/Runtime/Source/Qt3DSRuntimeRender/Source/Qt3DSRenderDefaultMaterialShaderGenerator.cpp b/src/Runtime/Source/Qt3DSRuntimeRender/Source/Qt3DSRenderDefaultMaterialShaderGenerator.cpp
index 6e9e4001..f4e64541 100644
--- a/src/Runtime/Source/Qt3DSRuntimeRender/Source/Qt3DSRenderDefaultMaterialShaderGenerator.cpp
+++ b/src/Runtime/Source/Qt3DSRuntimeRender/Source/Qt3DSRenderDefaultMaterialShaderGenerator.cpp
@@ -41,6 +41,7 @@
#include "Qt3DSRenderCustomMaterial.h"
#include "Qt3DSRenderDynamicObjectSystem.h"
#include "render/Qt3DSRenderShaderProgram.h"
+#include "Qt3DSRenderLightConstantProperties.h"
using namespace qt3ds::render;
using qt3ds::render::NVRenderCachedShaderProperty;
@@ -128,45 +129,6 @@ struct SShadowMapProperties
}
};
-struct SShaderGeneratorGeneratedShader;
-
-struct SLightConstantProperties
-{
- struct LightConstants
- {
- NVRenderCachedShaderProperty<QT3DSVec4> m_position;
- NVRenderCachedShaderProperty<QT3DSVec4> m_direction;
- NVRenderCachedShaderProperty<QT3DSVec4> m_up;
- NVRenderCachedShaderProperty<QT3DSVec4> m_right;
- NVRenderCachedShaderProperty<QT3DSVec4> m_diffuse;
- NVRenderCachedShaderProperty<QT3DSVec4> m_ambient;
- NVRenderCachedShaderProperty<QT3DSVec4> m_specular;
- NVRenderCachedShaderProperty<QT3DSF32> m_spotExponent;
- NVRenderCachedShaderProperty<QT3DSF32> m_spotCutoff;
- NVRenderCachedShaderProperty<QT3DSF32> m_constantAttenuation;
- NVRenderCachedShaderProperty<QT3DSF32> m_linearAttenuation;
- NVRenderCachedShaderProperty<QT3DSF32> m_quadraticAttenuation;
- NVRenderCachedShaderProperty<QT3DSF32> m_range;
- NVRenderCachedShaderProperty<QT3DSF32> m_width;
- NVRenderCachedShaderProperty<QT3DSF32> m_height;
- NVRenderCachedShaderProperty<QT3DSVec4> m_shadowControls;
- NVRenderCachedShaderProperty<QT3DSMat44> m_shadowView;
- NVRenderCachedShaderProperty<QT3DSI32> m_shadowIdx;
- NVRenderCachedShaderProperty<QT3DSVec3> m_attenuation;
-
- LightConstants(const QString &lightRef, NVRenderShaderProgram &shader);
-
- void updateLights(int lIdx, SShaderGeneratorGeneratedShader &shader);
- };
-
- SLightConstantProperties(SShaderGeneratorGeneratedShader &shader, bool packed);
- ~SLightConstantProperties();
- void updateLights(SShaderGeneratorGeneratedShader &shader);
-
- QVector<LightConstants *> m_constants;
- NVRenderCachedShaderProperty<QT3DSI32> m_lightCount;
-};
-
/**
* The results of generating a shader. Caches all possible variable names into
* typesafe objects.
@@ -212,7 +174,7 @@ struct SShaderGeneratorGeneratedShader
NVRenderCachedShaderBuffer<qt3ds::render::NVRenderShaderConstantBuffer *> m_AoShadowParams;
NVRenderCachedShaderBuffer<qt3ds::render::NVRenderShaderConstantBuffer *> m_LightsBuffer;
- SLightConstantProperties *m_lightConstantProperties;
+ SLightConstantProperties<SShaderGeneratorGeneratedShader> *m_lightConstantProperties;
// Cache the image property name lookups
nvvector<SShaderTextureProperties> m_Images;
@@ -282,108 +244,6 @@ struct SShaderGeneratorGeneratedShader
}
};
-static const QStringList lconstantnames = {
- QStringLiteral("position"),
- QStringLiteral("direction"),
- QStringLiteral("up"),
- QStringLiteral("right"),
- QStringLiteral("diffuse"),
- QStringLiteral("ambient"),
- QStringLiteral("specular"),
- QStringLiteral("spotExponent"),
- QStringLiteral("spotCutoff"),
- QStringLiteral("constantAttenuation"),
- QStringLiteral("linearAttenuation"),
- QStringLiteral("quadraticAttenuation"),
- QStringLiteral("range"),
- QStringLiteral("width"),
- QStringLiteral("height"),
- QStringLiteral("shadowControls"),
- QStringLiteral("shadowView"),
- QStringLiteral("shadowIdx"),
- QStringLiteral("attenuation")
-};
-
-SLightConstantProperties::LightConstants::LightConstants(const QString &lightRef,
- NVRenderShaderProgram &shader)
- : m_position(QString("%1%2").arg(lightRef, lconstantnames[0]), shader)
- , m_direction(QString("%1%2").arg(lightRef).arg(lconstantnames[1]), shader)
- , m_up(QString("%1%2").arg(lightRef, lconstantnames[2]), shader)
- , m_right(QString("%1%2").arg(lightRef, lconstantnames[3]), shader)
- , m_diffuse(QString("%1%2").arg(lightRef, lconstantnames[4]), shader)
- , m_ambient(QString("%1%2").arg(lightRef, lconstantnames[5]), shader)
- , m_specular(QString("%1%2").arg(lightRef, lconstantnames[6]), shader)
- , m_spotExponent(QString("%1%2").arg(lightRef, lconstantnames[7]), shader)
- , m_spotCutoff(QString("%1%2").arg(lightRef, lconstantnames[8]), shader)
- , m_constantAttenuation(QString("%1%2").arg(lightRef, lconstantnames[9]), shader)
- , m_linearAttenuation(QString("%1%2").arg(lightRef, lconstantnames[10]), shader)
- , m_quadraticAttenuation(QString("%1%2").arg(lightRef, lconstantnames[11]), shader)
- , m_range(QString("%1%2").arg(lightRef, lconstantnames[12]), shader)
- , m_width(QString("%1%2").arg(lightRef, lconstantnames[13]), shader)
- , m_height(QString("%1%2").arg(lightRef, lconstantnames[14]), shader)
- , m_shadowControls(QString("%1%2").arg(lightRef, lconstantnames[15]), shader)
- , m_shadowView(QString("%1%2").arg(lightRef, lconstantnames[16]), shader)
- , m_shadowIdx(QString("%1%2").arg(lightRef, lconstantnames[17]), shader)
- , m_attenuation(QString("%1%2").arg(lightRef, lconstantnames[18]), shader)
-{
-
-}
-
-void SLightConstantProperties::LightConstants::updateLights(int lIdx,
- SShaderGeneratorGeneratedShader &shader)
-{
- m_position.Set(shader.m_Lights[lIdx].m_LightData.m_position);
- m_direction.Set(shader.m_Lights[lIdx].m_LightData.m_direction);
- m_up.Set(shader.m_Lights[lIdx].m_LightData.m_up);
- m_right.Set(shader.m_Lights[lIdx].m_LightData.m_right);
- m_diffuse.Set(shader.m_Lights[lIdx].m_LightData.m_diffuse);
- m_ambient.Set(shader.m_Lights[lIdx].m_LightData.m_ambient);
- m_specular.Set(shader.m_Lights[lIdx].m_LightData.m_specular);
- m_spotExponent.Set(shader.m_Lights[lIdx].m_LightData.m_spotExponent);
- m_spotCutoff.Set(shader.m_Lights[lIdx].m_LightData.m_spotCutoff);
- m_constantAttenuation.Set(shader.m_Lights[lIdx].m_LightData.m_constantAttenuation);
- m_linearAttenuation.Set(shader.m_Lights[lIdx].m_LightData.m_linearAttenuation);
- m_quadraticAttenuation.Set(shader.m_Lights[lIdx].m_LightData.m_quadraticAttenuation);
- m_range.Set(shader.m_Lights[lIdx].m_LightData.m_range);
- m_width.Set(shader.m_Lights[lIdx].m_LightData.m_width);
- m_height.Set(shader.m_Lights[lIdx].m_LightData.m_height);
- m_shadowControls.Set(shader.m_Lights[lIdx].m_LightData.m_shadowControls);
- m_shadowView.Set(shader.m_Lights[lIdx].m_LightData.m_shadowView);
- m_shadowIdx.Set(shader.m_Lights[lIdx].m_LightData.m_shadowIdx);
- m_attenuation.Set(QT3DSVec3(shader.m_Lights[lIdx].m_LightData.m_constantAttenuation,
- shader.m_Lights[lIdx].m_LightData.m_linearAttenuation,
- shader.m_Lights[lIdx].m_LightData.m_quadraticAttenuation));
-}
-
-
-SLightConstantProperties::SLightConstantProperties(SShaderGeneratorGeneratedShader &shader,
- bool packed)
- : m_lightCount("uNumLights", shader.m_Shader)
-{
- m_constants.resize(shader.m_Lights.size());
- for (unsigned int i = 0; i < shader.m_Lights.size(); ++i) {
- QString lref;
- if (packed)
- lref = QStringLiteral("light_%1_");
- else
- lref = QStringLiteral("lights[%1].");
- lref = lref.arg(i);
- m_constants[i] = new LightConstants(lref, shader.m_Shader);
- }
- m_lightCount.Set(shader.m_Lights.size());
-}
-
-SLightConstantProperties::~SLightConstantProperties()
-{
- qDeleteAll(m_constants);
-}
-
-void SLightConstantProperties::updateLights(SShaderGeneratorGeneratedShader &shader)
-{
- for (int i = 0; i < m_constants.size(); ++i)
- m_constants[i]->updateLights(i, shader);
-}
-
#ifndef EA_PLATFORM_WINDOWS
#define _snprintf snprintf
@@ -1935,7 +1795,8 @@ struct SShaderGenerator : public IDefaultMaterialShaderGenerator
shader.m_LightsBuffer.Set();
}
} else {
- SLightConstantProperties *pLightConstants = GetLightConstantProperties(shader);
+ SLightConstantProperties<SShaderGeneratorGeneratedShader> *pLightConstants
+ = GetLightConstantProperties(shader);
// if we have lights we need a light buffer
QT3DS_ASSERT(shader.m_Lights.size() == 0 || pLightConstants);
@@ -2045,14 +1906,15 @@ struct SShaderGenerator : public IDefaultMaterialShaderGenerator
inRenderProperties.m_Probe2Fade, inRenderProperties.m_ProbeFOV);
}
- SLightConstantProperties *GetLightConstantProperties(SShaderGeneratorGeneratedShader &shader)
+ SLightConstantProperties<SShaderGeneratorGeneratedShader> *GetLightConstantProperties(SShaderGeneratorGeneratedShader &shader)
{
if (!shader.m_lightConstantProperties
|| shader.m_Lights.size() > !shader.m_lightConstantProperties->m_constants.size()) {
if (shader.m_lightConstantProperties)
delete shader.m_lightConstantProperties;
shader.m_lightConstantProperties
- = new SLightConstantProperties(shader, m_LightsAsSeparateUniforms);
+ = new SLightConstantProperties<SShaderGeneratorGeneratedShader>(
+ shader, m_LightsAsSeparateUniforms);
}
return shader.m_lightConstantProperties;
}
diff --git a/src/Runtime/res.qrc b/src/Runtime/res.qrc
index c1744d28..6472c2d5 100644
--- a/src/Runtime/res.qrc
+++ b/src/Runtime/res.qrc
@@ -97,6 +97,8 @@
<file>res/effectlib/gles2/shadowMapping.glsllib</file>
<file>res/effectlib/gles2/tangentSpaceNormalTexture.glsllib</file>
<file>res/effectlib/gles2/defaultMaterialBumpNoLod.glsllib</file>
+ <file>res/effectlib/gles2/evalEnvironmentMap.glsllib</file>
+ <file>res/effectlib/gles2/microfacetBSDF.glsllib</file>
<file>res/primitives/Cone.mesh</file>
<file>res/primitives/Cube.mesh</file>
<file>res/primitives/Cylinder.mesh</file>
diff --git a/src/Runtime/res/effectlib/Fxaa3_8.glsllib b/src/Runtime/res/effectlib/Fxaa3_8.glsllib
index 7e76ecde..620f5650 100644
--- a/src/Runtime/res/effectlib/Fxaa3_8.glsllib
+++ b/src/Runtime/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/src/Runtime/res/effectlib/average.glsllib b/src/Runtime/res/effectlib/average.glsllib
index 8c3f3fc2..082eec0c 100644
--- a/src/Runtime/res/effectlib/average.glsllib
+++ b/src/Runtime/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/src/Runtime/res/effectlib/calculateRoughness.glsllib b/src/Runtime/res/effectlib/calculateRoughness.glsllib
index d1e099bd..a14083d6 100644
--- a/src/Runtime/res/effectlib/calculateRoughness.glsllib
+++ b/src/Runtime/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/src/Runtime/res/effectlib/customMaterial.glsllib b/src/Runtime/res/effectlib/customMaterial.glsllib
index e99fa6e6..0a4d88b9 100644
--- a/src/Runtime/res/effectlib/customMaterial.glsllib
+++ b/src/Runtime/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/src/Runtime/res/effectlib/customMaterialFragBody.glsllib b/src/Runtime/res/effectlib/customMaterialFragBody.glsllib
index d237bc02..fccb8e05 100644
--- a/src/Runtime/res/effectlib/customMaterialFragBody.glsllib
+++ b/src/Runtime/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/src/Runtime/res/effectlib/customMaterialFragBodyAO.glsllib b/src/Runtime/res/effectlib/customMaterialFragBodyAO.glsllib
index 19302191..d194569e 100644
--- a/src/Runtime/res/effectlib/customMaterialFragBodyAO.glsllib
+++ b/src/Runtime/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/src/Runtime/res/effectlib/diffuseReflectionBSDF.glsllib b/src/Runtime/res/effectlib/diffuseReflectionBSDF.glsllib
index 9a66aef1..a98509d9 100644
--- a/src/Runtime/res/effectlib/diffuseReflectionBSDF.glsllib
+++ b/src/Runtime/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/src/Runtime/res/effectlib/diffuseTransmissionBSDF.glsllib b/src/Runtime/res/effectlib/diffuseTransmissionBSDF.glsllib
index 16b70b04..f6e5f52b 100644
--- a/src/Runtime/res/effectlib/diffuseTransmissionBSDF.glsllib
+++ b/src/Runtime/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/src/Runtime/res/effectlib/fileBumpTexture.glsllib b/src/Runtime/res/effectlib/fileBumpTexture.glsllib
index 0f27fd80..d0129a81 100644
--- a/src/Runtime/res/effectlib/fileBumpTexture.glsllib
+++ b/src/Runtime/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/src/Runtime/res/effectlib/flakeNoiseBumpTexture.glsllib b/src/Runtime/res/effectlib/flakeNoiseBumpTexture.glsllib
index 6bd5f7e4..e8e427ce 100644
--- a/src/Runtime/res/effectlib/flakeNoiseBumpTexture.glsllib
+++ b/src/Runtime/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/src/Runtime/res/effectlib/flakeNoiseTexture.glsllib b/src/Runtime/res/effectlib/flakeNoiseTexture.glsllib
index 7a73968e..92f15d30 100644
--- a/src/Runtime/res/effectlib/flakeNoiseTexture.glsllib
+++ b/src/Runtime/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/src/Runtime/res/effectlib/fresnelLayer.glsllib b/src/Runtime/res/effectlib/fresnelLayer.glsllib
index a9b4087b..60d71764 100644
--- a/src/Runtime/res/effectlib/fresnelLayer.glsllib
+++ b/src/Runtime/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/src/Runtime/res/effectlib/gles2/evalEnvironmentMap.glsllib b/src/Runtime/res/effectlib/gles2/evalEnvironmentMap.glsllib
new file mode 100644
index 00000000..ac9851e2
--- /dev/null
+++ b/src/Runtime/res/effectlib/gles2/evalEnvironmentMap.glsllib
@@ -0,0 +1,37 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 NVIDIA Corporation.
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+vec3 evalEnvironmentMap( in vec3 R, float roughness )
+{
+ // convert R to spherical texture coordinates
+ vec2 tc = vec2( ( atan( R.x, -R.z ) + PI ) / ( PI_TWO ), acos( -R.y ) / PI );
+
+ return( textureLod( uEnvironmentTexture, tc, 0.0 ).rgb );
+}
diff --git a/src/Runtime/res/effectlib/gles2/microfacetBSDF.glsllib b/src/Runtime/res/effectlib/gles2/microfacetBSDF.glsllib
new file mode 100644
index 00000000..7173a743
--- /dev/null
+++ b/src/Runtime/res/effectlib/gles2/microfacetBSDF.glsllib
@@ -0,0 +1,233 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 NVIDIA Corporation.
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef MICROFACET_BSDF_GLSLLIB
+#define MICROFACET_BSDF_GLSLLIB 1
+
+
+float GtermSchlick( in mat3 tanFrame, in vec3 l, in vec3 v, in float roughness )
+{
+ float NdotV = clamp(dot(tanFrame[2], v), 0.0, 1.0);
+ float NdotL = clamp(dot(tanFrame[2], l), 0.0, 1.0);
+ float k = roughness*roughness*0.79788;
+
+ float G_V = NdotV / (NdotV * (1.0 + k) + k);
+ float G_L = NdotL / (NdotL * (1.0 + k) + k);
+
+ return clamp(( G_V * G_L ), 0.0, 1.0);
+}
+
+float GtermGGX( in mat3 tanFrame, in vec3 l, in vec3 v, in float roughness )
+{
+ float NdotV = clamp(dot(tanFrame[2], v), 0.0, 1.0);
+ float NdotL = clamp(dot(tanFrame[2], l), 0.0, 1.0);
+ float k = clamp(roughness*roughness, 0.00, 1.0);
+
+ float G_V = NdotV + sqrt( (NdotV - NdotV * k) * NdotV + k );
+ float G_L = NdotL + sqrt( (NdotL - NdotL * k) * NdotL + k );
+
+ return clamp( 2.0 / ( G_V * G_L ), 0.0, 1.0);
+}
+
+float DtermGGX( in mat3 tanFrame, in vec3 L, in vec3 V, in float roughness )
+{
+ float m = clamp(roughness, 0.04, 1.0);
+ float m2 = m*m;
+
+ vec3 H = normalize(L + V);
+ float NdotH = clamp(dot( tanFrame[2], H ), 0.0001, 1.0);
+ float NdotH2 = NdotH * NdotH;
+
+ float denom = NdotH2 * (m2 - 1.0) + 1.0;
+ float D = m2 / (PI * denom * denom);
+
+ return max( 0.0, D);
+}
+
+float DtermGGXAniso( in mat3 tanFrame, in vec3 L, in vec3 V, in float roughnessU, float roughnessV )
+{
+ float roughU = clamp(roughnessU, 0.04, 1.0);
+ float roughV = clamp(roughnessV, 0.04, 1.0);
+ vec3 H = normalize(L + V);
+ float NdotH = clamp( dot(tanFrame[2], H), 0.0001, 1.0 );
+ float m = PI * roughU * roughV;
+ float HdotX = clamp( abs(dot(H, tanFrame[0])), 0.0001, 1.0 );
+ float HdotY = clamp( abs(dot(H, tanFrame[1])), 0.0001, 1.0 );
+
+ float x2 = roughU*roughU;
+ float y2 = roughV*roughV;
+
+ float D = (HdotX*HdotX/x2) + (HdotY*HdotY/y2) + (NdotH*NdotH);
+ D = 1.0 / ( m * D * D );
+
+ return max( 0.0, D);
+}
+
+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.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);
+
+ if ( NdotL > 0.0 )
+ {
+ if ( ( mode == scatter_reflect ) || ( mode == scatter_reflect_transmit ) )
+ {
+ float roughness = calculateRoughness( tanFrame[2], roughnessU, roughnessV, tanFrame[0] );
+ // G term
+ //float G = GtermSchlick( tanFrame, L, V, roughness );
+ float G = GtermGGX( tanFrame, L, V, roughness );
+
+ //float D = DtermGGX( tanFrame, L, V, roughness );
+ float D = DtermGGXAniso( tanFrame, L, V, roughnessU, roughnessV );
+ rgba.rgb = G * D * NdotL * lightSpecular;
+ }
+
+ if ( ( mode == scatter_transmit ) || ( mode == scatter_reflect_transmit ) )
+ {
+ rgba.a = pow(1.0 - clamp(HdotL, 0.0, 1.0), 5.0);
+ }
+ }
+
+ return rgba;
+}
+
+vec4 microfacetBSDFEnvironment( in mat3 tanFrame, in vec3 viewDir, in float roughnessU,
+ in float roughnessV, int mode )
+{
+ 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.0, roughnessU, roughnessV,
+ scatter_reflect ).rgb;
+ }
+#endif
+ return( vec4( rgb, 1.0 ) );
+}
+
+vec3 ImportanceGGX( in mat3 tanFrame, vec2 Xi, float roughness , vec3 N )
+{
+ float a = roughness * roughness;
+ float Phi = 2.0 * PI * Xi.y;
+ float CosTheta = (1.0 - Xi.x);
+ float SinTheta = sqrt( 1.0 - CosTheta * CosTheta );
+
+ vec3 H;
+ H.x = SinTheta * cos( Phi );
+ H.y = SinTheta * sin( Phi );
+ H.z = CosTheta;
+
+ // Tangent to world space
+ return tanFrame[0] * H.x + tanFrame[1] * H.y + tanFrame[2] * H.z;
+}
+
+float DtermGGXAnisoSampled( in mat3 tanFrame, in vec3 H, in float roughnessU, float roughnessV )
+{
+#if (MATERIAL_IS_NON_DIELECTRIC == 1)
+ float roughU = clamp(roughnessU*roughnessU, 0.01, 1.0);
+ float roughV = clamp(roughnessV*roughnessV, 0.01, 1.0);
+#else
+ float roughU = clamp(roughnessU, 0.02, 1.0);
+ float roughV = clamp(roughnessV, 0.02, 1.0);
+#endif
+
+ float NdotH = clamp( dot(tanFrame[2], H), 0.0001, 1.0 );
+ float m = PI * roughU * roughV;
+ float HdotX = clamp( abs(dot(H, tanFrame[0])), 0.0001, 1.0 );
+ float HdotY = clamp( abs(dot(H, tanFrame[1])), 0.0001, 1.0 );
+
+ float x2 = roughU*roughU;
+ float y2 = roughV*roughV;
+
+ float pdf = (HdotX*HdotX/x2) + (HdotY*HdotY/y2) + (NdotH*NdotH);
+ float D = 1.0 / ( m * pdf * pdf );
+
+ return max( 0.0, D);
+}
+
+vec3 sampleEnv(in vec3 L, float pdf, int sampleCount, float roughness )
+{
+ // convert coord to 2D
+ vec2 tc = vec2( ( atan( L.x, -L.z ) + PI ) / ( 2.0 * PI ), acos( -L.y ) / PI );
+ return( textureLod( uEnvironmentTexture, tc, 0.0 ).rgb );
+}
+
+vec4 microfacetSampledBSDF( in mat3 tanFrame, in vec3 viewDir, in float roughnessU,
+ in float roughnessV, int mode )
+{
+ vec2 hammersly[4];
+ hammersly[0] = vec2(0.0, 0.0);
+ hammersly[1] = vec2(0.25, 0.5);
+ hammersly[2] = vec2(0.5, 0.25);
+ hammersly[3] = vec2(0.75, 0.75);
+
+ vec3 rgb = vec3( 0.0, 0.0, 0.0 );
+
+ float roughness = clamp( calculateRoughness( tanFrame[2], roughnessU, roughnessV, tanFrame[0] ),
+ 0.0, 1.0 );
+
+ vec3 R = reflect( -viewDir, tanFrame[2] );
+
+ const int NumSamples = 4;
+ for( int i = 0; i < NumSamples; i++ )
+ {
+ vec2 Xi = hammersly[i]; // pre computed values
+ //vec2 Xi = hammersley2d(i, NumSamples);
+ vec3 Half = ImportanceGGX( tanFrame, Xi, roughness , tanFrame[2] );
+ vec3 H = normalize( Half );
+
+ vec3 L = 2.0 * dot( viewDir, Half ) * Half - viewDir;
+ float NdotV = clamp( dot( tanFrame[2], viewDir ), 0.0001, 1.0 );
+ float NdotR = clamp( dot( tanFrame[2], R ), 0.0, 1.0 );
+ float NdotH = clamp( dot( tanFrame[2], H ), 0.0001, 1.0 );
+
+ if( NdotV > 0.0001 )
+ {
+ float G = GtermGGX( tanFrame, L, viewDir, roughness );
+ float D = DtermGGXAnisoSampled( tanFrame, H, roughnessU, roughnessV);
+
+ vec3 envColor = 0.01 * sampleEnv( L, D, NumSamples, roughness );
+
+ rgb += (envColor * G * D * NdotR) / ( 4.0 * NdotV * NdotH);
+ }
+ }
+
+ rgb /= float(NumSamples);
+
+ return( vec4( rgb, 1.0 ) );
+}
+
+#endif
diff --git a/src/Runtime/res/effectlib/gles2/refraction.glsllib b/src/Runtime/res/effectlib/gles2/refraction.glsllib
new file mode 100644
index 00000000..837d7f50
--- /dev/null
+++ b/src/Runtime/res/effectlib/gles2/refraction.glsllib
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 NVIDIA Corporation.
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// this is entirly phiysical incorrect
+// We just use this to fake distortion when we have no environment available
+// The displacement is calculated on ior
+vec3 refraction( in sampler2D sampler, in float materialIOR )
+{
+ vec3 displace = fresnel( viewDir, vec3( materialIOR ));
+
+ float xdir = abs( viewDir.x );
+ float ydir = abs( viewDir.y );
+
+ vec2 texSize = vec2( textureSize( sampler, 0 ) );
+ vec2 newUV = vec2(gl_FragCoord.xy/texSize);
+ if ( xdir > ydir)
+ {
+ newUV = ( viewDir.x > 0.0) ? newUV + displace.xy : newUV - displace.xy;
+ }
+ else
+ {
+ newUV = ( viewDir.y > 0.0) ? newUV - displace.xy : newUV + displace.xy;
+ }
+
+ vec3 refractColor = texture( sampler, newUV ).rgb;
+
+ return refractColor;
+}
+
+// This should really not be used, but it's there for the sake of testing.
+vec3 refractBlur( in sampler2D sampler, in vec3 viewDir, in float materialIOR, in float blurWidth )
+{
+ // This is really terrible, but at least is a little better than
+ vec3 displace = viewDir * materialIOR;
+
+ vec2 texSize = vec2( textureSize( sampler, 0 ) );
+ texSize = vec2(1.0) / texSize;
+ vec2 newUV = vec2(gl_FragCoord.xy * texSize);
+ newUV += displace.xy * 0.005;
+
+ //vec3 refractColor = texture( sampler, newUV ).rgb;
+ vec3 refractColor = vec3(0);
+ int sz = int(ceil(blurWidth));
+ float wtsum = 0.0;
+
+ for (int y = -sz; y <= sz; ++y)
+ {
+ for (int x = -sz; x <= sz; ++x)
+ {
+ float wt = float(x*x + y*y) / (blurWidth * 0.5);
+ wt = exp2(-wt);
+ //refractColor += wt * textureOffset( sampler, newUV, ivec2(x, y) ).rgb;
+ vec2 uvOfs = vec2(x, y) * texSize;
+ refractColor += wt * texture( sampler, newUV+uvOfs).rgb;
+ wtsum += wt;
+ }
+ }
+
+ return refractColor / wtsum;
+}
diff --git a/src/Runtime/res/effectlib/gradient3Recolor.glsllib b/src/Runtime/res/effectlib/gradient3Recolor.glsllib
index 18556f3e..ba7d5937 100644
--- a/src/Runtime/res/effectlib/gradient3Recolor.glsllib
+++ b/src/Runtime/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/src/Runtime/res/effectlib/gradientGetPosition.glsllib b/src/Runtime/res/effectlib/gradientGetPosition.glsllib
index 26b687d6..4ceece04 100644
--- a/src/Runtime/res/effectlib/gradientGetPosition.glsllib
+++ b/src/Runtime/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/src/Runtime/res/effectlib/miNoise.glsllib b/src/Runtime/res/effectlib/miNoise.glsllib
index f2daa814..5fbff37d 100644
--- a/src/Runtime/res/effectlib/miNoise.glsllib
+++ b/src/Runtime/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/src/Runtime/res/effectlib/microfacetBSDF.glsllib b/src/Runtime/res/effectlib/microfacetBSDF.glsllib
index e164fcad..8e489107 100644
--- a/src/Runtime/res/effectlib/microfacetBSDF.glsllib
+++ b/src/Runtime/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/src/Runtime/res/effectlib/normalizedMix.glsllib b/src/Runtime/res/effectlib/normalizedMix.glsllib
index 7a440224..fc90b46d 100644
--- a/src/Runtime/res/effectlib/normalizedMix.glsllib
+++ b/src/Runtime/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/src/Runtime/res/effectlib/perlinNoise.glsllib b/src/Runtime/res/effectlib/perlinNoise.glsllib
index 1fef880d..347386c4 100644
--- a/src/Runtime/res/effectlib/perlinNoise.glsllib
+++ b/src/Runtime/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/src/Runtime/res/effectlib/physGlossyBSDF.glsllib b/src/Runtime/res/effectlib/physGlossyBSDF.glsllib
index ff0eb8cb..ece836b5 100644
--- a/src/Runtime/res/effectlib/physGlossyBSDF.glsllib
+++ b/src/Runtime/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/src/Runtime/res/effectlib/sampleArea.glsllib b/src/Runtime/res/effectlib/sampleArea.glsllib
index 70c7ae0d..d55c0ce4 100644
--- a/src/Runtime/res/effectlib/sampleArea.glsllib
+++ b/src/Runtime/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/src/Runtime/res/effectlib/sampleLight.glsllib b/src/Runtime/res/effectlib/sampleLight.glsllib
index 3218cdf5..05ad5b4b 100644
--- a/src/Runtime/res/effectlib/sampleLight.glsllib
+++ b/src/Runtime/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);
- /*
- if (light.spotCutoff < 180.0f) // spot light
+ att = 1.0 / (light.constantAttenuation + (light.linearAttenuation + light.quadraticAttenuation * dist) * dist);
+ /*
+ 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/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
diff --git a/src/Runtime/res/effectlib/specularBSDF.glsllib b/src/Runtime/res/effectlib/specularBSDF.glsllib
index 9e315441..78e541a5 100644
--- a/src/Runtime/res/effectlib/specularBSDF.glsllib
+++ b/src/Runtime/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/src/Runtime/res/effectlib/spotEdf.glsllib b/src/Runtime/res/effectlib/spotEdf.glsllib
index 663bd8f0..2abe194e 100644
--- a/src/Runtime/res/effectlib/spotEdf.glsllib
+++ b/src/Runtime/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;