Pārlūkot izejas kodu

Fixed #316 where some post processing effects were not working when using OPENGL_3 renderer due to an error in the fragment shader.

Daniel Johansson 10 gadi atpakaļ
vecāks
revīzija
109c5e80cf

+ 4 - 2
jme3-effects/src/main/resources/Common/MatDefs/Post/CrossHatch15.frag

@@ -17,7 +17,9 @@ uniform float m_Luminance5;
  
 uniform float m_LineDistance;
 uniform float m_LineThickness;
- 
+
+out vec4 fragColor;
+
 void main() {
     vec4 texVal = getColor(m_Texture, texCoord);
     float linePixel = 0;
@@ -49,5 +51,5 @@ void main() {
     // Mix paper color with existing color information
     vec4 paperColor = mix(m_PaperColor, texVal, m_ColorInfluencePaper);
  
-    gl_FragColor = mix(paperColor, lineColor, linePixel);
+    fragColor = mix(paperColor, lineColor, linePixel);
 }

+ 4 - 2
jme3-effects/src/main/resources/Common/MatDefs/Post/DepthOfField15.frag

@@ -11,6 +11,8 @@ uniform float m_YScale;
 
 vec2 m_NearFar = vec2( 0.1, 1000.0 );
 
+out vec4 fragColor;
+
 void main() {
 
     vec4 texVal = getColor( m_Texture, texCoord );
@@ -44,7 +46,7 @@ void main() {
     if( unfocus < 0.2 ) {
         // If we are mostly in focus then don't bother with the
         // convolution filter
-        gl_FragColor = texVal;
+        fragColor = texVal;
     } else {
     // Perform a wide convolution filter and we scatter it
     // a bit to avoid some texture look-ups.  Instead of
@@ -83,7 +85,7 @@ void main() {
 
     sum = sum / 12.0;
 
-    gl_FragColor = mix( texVal, sum, unfocus );
+    fragColor = mix( texVal, sum, unfocus );
 
     // I used this for debugging the range
     // gl_FragColor.r = unfocus;

+ 2 - 1
jme3-effects/src/main/resources/Common/MatDefs/Post/Fade15.frag

@@ -4,8 +4,9 @@ uniform COLORTEXTURE m_Texture;
 uniform float m_Value;
 
 in vec2 texCoord;
+out vec4 fragColor;
 
 void main() {
     vec4 texVal = getColor(m_Texture, texCoord);
-    gl_FragColor = texVal * m_Value;
+    fragColor = texVal * m_Value;
 }

+ 2 - 1
jme3-effects/src/main/resources/Common/MatDefs/Post/Fog15.frag

@@ -8,6 +8,7 @@ uniform float m_FogDensity;
 uniform float m_FogDistance;
 
 in vec2 texCoord;
+out vec4 fragColor;
 
 vec2 m_FrustumNearFar=vec2(1.0,m_FogDistance);
 const float LOG2 = 1.442695;
@@ -19,6 +20,6 @@ void main() {
 
        float fogFactor = exp2( -m_FogDensity * m_FogDensity * depth *  depth * LOG2 );
        fogFactor = clamp(fogFactor, 0.0, 1.0);
-       gl_FragColor =mix(m_FogColor,texVal,fogFactor);
+       fragColor =mix(m_FogColor,texVal,fogFactor);
 
 }

+ 2 - 1
jme3-effects/src/main/resources/Common/MatDefs/Post/Overlay15.frag

@@ -3,9 +3,10 @@
 uniform COLORTEXTURE m_Texture;
 uniform vec4 m_Color;
 in vec2 texCoord;
+out vec4 fragColor;
 
 void main() {
       vec4 texVal = getColor(m_Texture, texCoord);
-      gl_FragColor = texVal * m_Color;
+      fragColor = texVal * m_Color;
 }
 

+ 3 - 2
jme3-effects/src/main/resources/Common/MatDefs/Post/Posterization15.frag

@@ -2,7 +2,8 @@
  
 uniform COLORTEXTURE m_Texture;
 in vec2 texCoord;
- 
+out vec4 fragColor;
+
 uniform int m_NumColors;
 uniform float m_Gamma;
 uniform float m_Strength;
@@ -16,5 +17,5 @@ void main() {
     texVal = texVal / m_NumColors;
     texVal = pow(texVal, vec4(1.0/m_Gamma));
  
-    gl_FragColor = mix(getColor(m_Texture, texCoord), texVal, m_Strength);
+    fragColor = mix(getColor(m_Texture, texCoord), texVal, m_Strength);
 }

+ 2 - 1
jme3-effects/src/main/resources/Common/MatDefs/Post/bloomFinal15.frag

@@ -6,10 +6,11 @@ uniform sampler2D m_BloomTex;
 uniform float m_BloomIntensity;
 
 in vec2 texCoord;
+out vec4 fragColor;
 
 void main(){
   vec4 colorRes = getColor(m_Texture,texCoord);
   vec4 bloom = texture2D(m_BloomTex, texCoord);
-  gl_FragColor = bloom * m_BloomIntensity + colorRes;
+  fragColor = bloom * m_BloomIntensity + colorRes;
 }
 

+ 2 - 1
jme3-effects/src/main/resources/Common/MatDefs/SSAO/ssaoBlur15.frag

@@ -10,6 +10,7 @@ uniform float m_YScale;
 uniform vec2 m_FrustumNearFar;
 
 in vec2 texCoord;
+out vec4 fragColor;
 
 vec4 getResult(vec4 color){
  
@@ -125,7 +126,7 @@ float readDepth(in vec2 uv){
     void main(){
         //  float depth =texture2D(m_DepthTexture,uv).r;
 
-       gl_FragColor=getResult(convolutionFilter());
+       fragColor=getResult(convolutionFilter());
       // gl_FragColor=getResult(bilateralFilter());
       //  gl_FragColor=getColor(m_SSAOMap,texCoord);