summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/extras/shaders/es3/light.inc.frag16
-rw-r--r--src/extras/shaders/es3/metalrough.inc.frag6
2 files changed, 11 insertions, 11 deletions
diff --git a/src/extras/shaders/es3/light.inc.frag b/src/extras/shaders/es3/light.inc.frag
index 9d03fca54..18012ccc1 100644
--- a/src/extras/shaders/es3/light.inc.frag
+++ b/src/extras/shaders/es3/light.inc.frag
@@ -4,14 +4,14 @@ const int TYPE_DIRECTIONAL = 1;
const int TYPE_SPOT = 2;
struct Light {
int type;
- vec3 position;
- vec3 color;
- float intensity;
- vec3 direction;
- float constantAttenuation;
- float linearAttenuation;
- float quadraticAttenuation;
- float cutOffAngle;
+ FP vec3 position;
+ FP vec3 color;
+ FP float intensity;
+ FP vec3 direction;
+ FP float constantAttenuation;
+ FP float linearAttenuation;
+ FP float quadraticAttenuation;
+ FP float cutOffAngle;
};
uniform Light lights[MAX_LIGHTS];
uniform int lightCount;
diff --git a/src/extras/shaders/es3/metalrough.inc.frag b/src/extras/shaders/es3/metalrough.inc.frag
index f145e90f8..188a367f5 100644
--- a/src/extras/shaders/es3/metalrough.inc.frag
+++ b/src/extras/shaders/es3/metalrough.inc.frag
@@ -66,7 +66,7 @@ int mipLevelCount(const in FP samplerCube cube)
return nMips;
}
-float remapRoughness(const in FP float roughness)
+FP float remapRoughness(const in FP float roughness)
{
// As per page 14 of
// http://www.frostbite.com/wp-content/uploads/2014/11/course_notes_moving_frostbite_to_pbr.pdf
@@ -177,7 +177,7 @@ FP vec3 pbrModel(const in int lightIndex,
if (lights[lightIndex].type != TYPE_DIRECTIONAL) {
// Point and Spot lights
- vec3 sUnnormalized = vec3(lights[lightIndex].position) - wPosition;
+ FP vec3 sUnnormalized = vec3(lights[lightIndex].position) - wPosition;
s = normalize(sUnnormalized);
// Calculate the attenuation factor
@@ -186,7 +186,7 @@ FP vec3 pbrModel(const in int lightIndex,
if (lights[lightIndex].constantAttenuation != 0.0
|| lights[lightIndex].linearAttenuation != 0.0
|| lights[lightIndex].quadraticAttenuation != 0.0) {
- float dist = length(sUnnormalized);
+ FP float dist = length(sUnnormalized);
att = 1.0 / (lights[lightIndex].constantAttenuation +
lights[lightIndex].linearAttenuation * dist +
lights[lightIndex].quadraticAttenuation * dist * dist);