diff --git a/modules/javafx.graphics/src/main/java/com/sun/prism/es2/ES2Context.java b/modules/javafx.graphics/src/main/java/com/sun/prism/es2/ES2Context.java index 8dd3994d34..eccad0ab55 100644 --- a/modules/javafx.graphics/src/main/java/com/sun/prism/es2/ES2Context.java +++ b/modules/javafx.graphics/src/main/java/com/sun/prism/es2/ES2Context.java @@ -449,9 +449,6 @@ void setAmbientLight(long nativeHandle, float r, float g, float b) { glContext.setAmbientLight(nativeHandle, r, g, b); } - /* - * FacloTheBold: - new operator, added parameters for attenuation coefficients - */ void setPointLight(long nativeHandle, int index, float x, float y, float z, float r, float g, float b, float w, float ra, float ca, float la, float qa) { glContext.setPointLight(nativeHandle, index, x, y, z, r, g, b, w, ra, ca, la, qa); } diff --git a/modules/javafx.graphics/src/main/native-prism-d3d/D3DLight.h b/modules/javafx.graphics/src/main/native-prism-d3d/D3DLight.h index a601af1f29..7e85301b9e 100644 --- a/modules/javafx.graphics/src/main/native-prism-d3d/D3DLight.h +++ b/modules/javafx.graphics/src/main/native-prism-d3d/D3DLight.h @@ -47,5 +47,3 @@ class D3DLight { }; #endif /* D3DLIGHT_H */ - - diff --git a/modules/javafx.graphics/src/main/resources/com/sun/prism/es2/glsl/main1Light.frag b/modules/javafx.graphics/src/main/resources/com/sun/prism/es2/glsl/main1Light.frag index ee10202d80..084af33b81 100644 --- a/modules/javafx.graphics/src/main/resources/com/sun/prism/es2/glsl/main1Light.frag +++ b/modules/javafx.graphics/src/main/resources/com/sun/prism/es2/glsl/main1Light.frag @@ -83,12 +83,11 @@ void main() float power = specular.a; vec3 l = normalize(lightTangentSpacePositions[0].xyz); - d = clamp(dot(n,l), 0.0, 1.0)*(lights[0].color).rgb; - s = pow(clamp(dot(-refl, l), 0.0, 1.0), power)*lights[0].color.rgb; + float att = 1.0 / (lights[0].atten.ca + lights[0].atten.la * dist + lights[0].atten.qa * (dist * dist)); + d = clamp(dot(n,l), 0.0, 1.0)*(lights[0].color).rgb * att; + s = pow(clamp(dot(-refl, l), 0.0, 1.0), power)*lights[0].color.rgb * att; - float att = 1.0 / (lights[0].atten.ca + lights[0].atten.la * dist + lights[0].atten.qa * (dist * dist))); - - vec3 rez = (ambientColor+d) * (att * (diffuse.xyz + s*specular.rgb)); + vec3 rez = (ambientColor+d) * (diffuse.xyz + s*specular.rgb); rez += apply_selfIllum().xyz; gl_FragColor = vec4(clamp(rez, 0.0, 1.0) , diffuse.a); diff --git a/modules/javafx.graphics/src/main/resources/com/sun/prism/es2/glsl/main2Lights.frag b/modules/javafx.graphics/src/main/resources/com/sun/prism/es2/glsl/main2Lights.frag index 2dbc8c89d6..800579bbe0 100644 --- a/modules/javafx.graphics/src/main/resources/com/sun/prism/es2/glsl/main2Lights.frag +++ b/modules/javafx.graphics/src/main/resources/com/sun/prism/es2/glsl/main2Lights.frag @@ -75,6 +75,7 @@ void main() vec3 d = vec3(0.0); vec3 s = vec3(0.0); + vec3 rez = vec3(0.0); vec3 refl = reflect(normalize(eyePos), n); vec4 specular = apply_specular(); @@ -84,10 +85,10 @@ void main() float dist = (lights[i].pos.xyz - gl_Position); if(dist <= lights[i].atten.range){ vec3 l = normalize(lightTangentSpacePositions[i].xyz); - d += clamp(dot(n,l), 0.0, 1.0)*(lights[i].color).rgb; - s += pow(clamp(dot(-refl, l), 0.0, 1.0), power) * lights[i].color.rgb; - float att = 1.0 / (lights[i]].atten.ca + lights[i].atten.la * dist + lights[i].atten.qa * (dist * dist))); - vec3 rez = (ambientColor+d) * (att * (diffuse.xyz + s*specular.rgb)); + float att = 1.0 / (lights[i]].atten.ca + lights[i].atten.la * dist + lights[i].atten.qa * (dist * dist)); + d += clamp(dot(n,l), 0.0, 1.0)*(lights[i].color).rgb * att; + s += pow(clamp(dot(-refl, l), 0.0, 1.0), power) * lights[i].color.rgb *att; + rez = (ambientColor+d) * (diffuse.xyz + s*specular.rgb); } } rez += apply_selfIllum().xyz; diff --git a/modules/javafx.graphics/src/main/resources/com/sun/prism/es2/glsl/main3Lights.frag b/modules/javafx.graphics/src/main/resources/com/sun/prism/es2/glsl/main3Lights.frag index dad45555cf..669ce5e6d1 100644 --- a/modules/javafx.graphics/src/main/resources/com/sun/prism/es2/glsl/main3Lights.frag +++ b/modules/javafx.graphics/src/main/resources/com/sun/prism/es2/glsl/main3Lights.frag @@ -75,6 +75,7 @@ void main() vec3 d = vec3(0.0); vec3 s = vec3(0.0); + vec3 rez = vec3(0.0); vec3 refl = reflect(normalize(eyePos), n); vec4 specular = apply_specular(); @@ -84,10 +85,10 @@ void main() float dist = (lights[i].pos.xyz - gl_Position); if(dist <= lights[i].atten.range){ vec3 l = normalize(lightTangentSpacePositions[i].xyz); - d += clamp(dot(n,l), 0.0, 1.0)*(lights[i].color).rgb; - s += pow(clamp(dot(-refl, l), 0.0, 1.0), power) * lights[i].color.rgb; - float att = 1.0 / (lights[i]].atten.ca + lights[i].atten.la * dist + lights[i].atten.qa * (dist * dist))); - vec3 rez = (ambientColor+d) * (att * (diffuse.xyz + s*specular.rgb)); + float att = 1.0 / (lights[i]].atten.ca + lights[i].atten.la * dist + lights[i].atten.qa * (dist * dist)); + d += clamp(dot(n,l), 0.0, 1.0)*(lights[i].color).rgb * att; + s += pow(clamp(dot(-refl, l), 0.0, 1.0), power) * lights[i].color.rgb *att; + rez = (ambientColor+d) * (diffuse.xyz + s*specular.rgb); } } rez += apply_selfIllum().xyz;