소스 검색

Merge remote-tracking branch 'github/master' into master-original

javasabr 8 년 전
부모
커밋
911b99330b
22개의 변경된 파일229개의 추가작업 그리고 54개의 파일을 삭제
  1. 36 2
      jme3-core/src/main/java/com/jme3/animation/Bone.java
  2. 3 3
      jme3-core/src/main/java/com/jme3/light/SpotLight.java
  3. 3 4
      jme3-core/src/main/java/com/jme3/math/FastMath.java
  4. 6 1
      jme3-core/src/main/java/com/jme3/renderer/Caps.java
  5. 28 0
      jme3-core/src/main/java/com/jme3/renderer/opengl/GL3.java
  6. 31 0
      jme3-core/src/main/java/com/jme3/renderer/opengl/GLImageFormats.java
  7. 4 0
      jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java
  8. 0 3
      jme3-core/src/main/java/com/jme3/scene/GeometryGroupNode.java
  9. 23 2
      jme3-core/src/main/java/com/jme3/shader/ShaderGenerator.java
  10. 2 2
      jme3-core/src/main/java/com/jme3/shadow/AbstractShadowRenderer.java
  11. 1 1
      jme3-core/src/main/java/com/jme3/shadow/DirectionalLightShadowRenderer.java
  12. 1 1
      jme3-core/src/main/java/com/jme3/shadow/ShadowUtil.java
  13. 6 3
      jme3-core/src/main/java/com/jme3/texture/FrameBuffer.java
  14. 27 1
      jme3-core/src/main/java/com/jme3/texture/Image.java
  15. 4 2
      jme3-core/src/main/java/com/jme3/util/ListSort.java
  16. 1 17
      jme3-core/src/main/java/com/jme3/util/TangentBinormalGenerator.java
  17. 29 0
      jme3-core/src/main/java/com/jme3/util/TangentUtils.java
  18. 4 3
      jme3-core/src/main/java/com/jme3/util/mikktspace/MikktspaceTangentGenerator.java
  19. 1 1
      jme3-core/src/main/resources/Common/MatDefs/Light/PBRLighting.frag
  20. 1 1
      jme3-core/src/main/resources/Common/MatDefs/Shadow/PostShadow.frag
  21. 0 5
      jme3-core/src/main/resources/Common/MatDefs/Shadow/PostShadowFilter15.frag
  22. 18 2
      jme3-examples/src/main/java/jme3test/light/pbr/TestPBRLighting.java

+ 36 - 2
jme3-core/src/main/java/com/jme3/animation/Bone.java

@@ -812,13 +812,47 @@ public final class Bone implements Savable {
         output.writeSavableArrayList(children, "children", null);
     }
 
+    /**
+     * Sets the rotation of the bone in object space.
+     * Warning: you need to call {@link #setUserControl(boolean)} with true to be able to do that operation
+     * @param rot
+     */
     public void setLocalRotation(Quaternion rot){
         if (!userControl) {
             throw new IllegalStateException("User control must be on bone to allow user transforms");
         }
-        this.localRot = rot;
+        this.localRot.set(rot);
     }
-    
+
+    /**
+     * Sets the position of the bone in object space.
+     * Warning: you need to call {@link #setUserControl(boolean)} with true to be able to do that operation
+     * @param pos
+     */
+    public void setLocalTranslation(Vector3f pos){
+        if (!userControl) {
+            throw new IllegalStateException("User control must be on bone to allow user transforms");
+        }
+        this.localPos.set(pos);
+    }
+
+    /**
+     * Sets the scale of the bone in object space.
+     * Warning: you need to call {@link #setUserControl(boolean)} with true to be able to do that operation
+     * @param scale the scale to apply
+     */
+    public void setLocalScale(Vector3f scale){
+        if (!userControl) {
+            throw new IllegalStateException("User control must be on bone to allow user transforms");
+        }
+        this.localScale.set(scale);
+    }
+
+    /**
+     * returns true if this bone can be directly manipulated by the user.
+     * @see #setUserControl(boolean)
+     * @return
+     */
     public boolean hasUserControl(){
         return userControl;
     }

+ 3 - 3
jme3-core/src/main/java/com/jme3/light/SpotLight.java

@@ -102,7 +102,7 @@ public class SpotLight extends Light {
         this();
         setPosition(position);
         setDirection(direction);
-        this.spotRange = range;
+        setSpotRange(range);
     }
 
     /**
@@ -133,7 +133,7 @@ public class SpotLight extends Light {
         computeAngleParameters();
         setPosition(position);
         setDirection(direction);
-        this.spotRange = range;
+        setSpotRange(range);
     }
     
     /**
@@ -158,7 +158,7 @@ public class SpotLight extends Light {
         computeAngleParameters();
         setPosition(position);
         setDirection(direction);
-        this.spotRange = range;
+        setSpotRange(range);
     }  
     
 

+ 3 - 4
jme3-core/src/main/java/com/jme3/math/FastMath.java

@@ -942,8 +942,7 @@ final public class FastMath {
      * Converts a single precision (32 bit) floating point value
      * into half precision (16 bit).
      *
-     * <p>Source: <a href="http://www.fox-toolkit.org/ftp/fasthalffloatconversion.pdf">
-     * http://www.fox-toolkit.org/ftp/fasthalffloatconversion.pdf</a><br><strong>broken link</strong>
+     * <p>Source: <a href="ftp://www.fox-toolkit.org/pub/fasthalffloatconversion.pdf</a>
      *
      * @param half The half floating point value as a short.
      * @return floating point value of the half.
@@ -982,9 +981,9 @@ final public class FastMath {
             return 0x7bff;
         } else if (flt < -65504f) {
             return (short) (0x7bff | 0x8000);
-        } else if (flt > 0f && flt < 5.96046E-8f) {
+        } else if (flt > 0f && flt < 3.054738E-5f) {
             return 0x0001;
-        } else if (flt < 0f && flt > -5.96046E-8f) {
+        } else if (flt < 0f && flt > -3.054738E-5f) {
             return (short) 0x8001;
         }
 

+ 6 - 1
jme3-core/src/main/java/com/jme3/renderer/Caps.java

@@ -201,7 +201,12 @@ public enum Caps {
      * Supports floating point & half textures (Format.RGB16F)
      */
     FloatTexture,
-
+    
+    /**
+     * Supports integer textures
+     */
+    IntegerTexture,
+    
     /**
      * Supports floating point FBO color buffers (Format.RGB16F)
      */

+ 28 - 0
jme3-core/src/main/java/com/jme3/renderer/opengl/GL3.java

@@ -54,6 +54,34 @@ public interface GL3 extends GL2 {
     public static final int GL_TEXTURE_SWIZZLE_B = 0x8E44;
     public static final int GL_TEXTURE_SWIZZLE_G = 0x8E43;
     public static final int GL_TEXTURE_SWIZZLE_R = 0x8E42;
+    public static final int GL_R8I = 33329;
+    public static final int GL_R8UI = 33330;
+    public static final int GL_R16I = 33331;
+    public static final int GL_R16UI = 33332;
+    public static final int GL_R32I = 33333;
+    public static final int GL_R32UI = 33334;
+    public static final int GL_RG8I = 33335;
+    public static final int GL_RG8UI = 33336;
+    public static final int GL_RG16I = 33337;
+    public static final int GL_RG16UI = 33338;
+    public static final int GL_RG32I = 33339;
+    public static final int GL_RG32UI = 33340;  
+    public static final int GL_RGBA32UI = 36208;
+    public static final int GL_RGB32UI = 36209;
+    public static final int GL_RGBA16UI = 36214;
+    public static final int GL_RGB16UI = 36215;
+    public static final int GL_RGBA8UI = 36220;
+    public static final int GL_RGB8UI = 36221;
+    public static final int GL_RGBA32I = 36226;
+    public static final int GL_RGB32I = 36227;
+    public static final int GL_RGBA16I = 36232;
+    public static final int GL_RGB16I = 36233;
+    public static final int GL_RGBA8I = 36238;
+    public static final int GL_RGB8I = 36239;
+    public static final int GL_RED_INTEGER = 36244;
+    public static final int GL_RG_INTEGER = 33320;
+    public static final int GL_RGB_INTEGER = 36248;
+    public static final int GL_RGBA_INTEGER = 36249;
     
     public void glBindFragDataLocation(int param1, int param2, String param3); /// GL3+
     public void glBindVertexArray(int param1); /// GL3+

+ 31 - 0
jme3-core/src/main/java/com/jme3/renderer/opengl/GLImageFormats.java

@@ -233,6 +233,37 @@ public final class GLImageFormats {
             formatComp(formatToGL, Format.ETC1, GLExt.GL_ETC1_RGB8_OES,        GL.GL_RGB, GL.GL_UNSIGNED_BYTE);
         }
         
+        // Integer formats
+        if(caps.contains(Caps.IntegerTexture)) {     
+            format(formatToGL, Format.R8I, GL3.GL_R8I, GL3.GL_RED_INTEGER, GL.GL_BYTE);
+            format(formatToGL, Format.R8UI, GL3.GL_R8UI, GL3.GL_RED_INTEGER, GL.GL_UNSIGNED_BYTE);
+            format(formatToGL, Format.R16I, GL3.GL_R16I, GL3.GL_RED_INTEGER, GL.GL_SHORT);
+            format(formatToGL, Format.R16UI, GL3.GL_R16UI, GL3.GL_RED_INTEGER, GL.GL_UNSIGNED_SHORT);
+            format(formatToGL, Format.R32I, GL3.GL_R32I, GL3.GL_RED_INTEGER, GL.GL_INT);
+            format(formatToGL, Format.R32UI, GL3.GL_R32UI, GL3.GL_RED_INTEGER, GL.GL_UNSIGNED_INT);
+            
+            format(formatToGL, Format.RG8I, GL3.GL_RG8I, GL3.GL_RG_INTEGER, GL.GL_BYTE);
+            format(formatToGL, Format.RG8UI, GL3.GL_RG8UI, GL3.GL_RG_INTEGER, GL.GL_UNSIGNED_BYTE);
+            format(formatToGL, Format.RG16I, GL3.GL_RG16I, GL3.GL_RG_INTEGER, GL.GL_SHORT);
+            format(formatToGL, Format.RG16UI, GL3.GL_RG16UI, GL3.GL_RG_INTEGER, GL.GL_UNSIGNED_SHORT);
+            format(formatToGL, Format.RG32I, GL3.GL_RG32I, GL3.GL_RG_INTEGER, GL.GL_INT);
+            format(formatToGL, Format.RG32UI, GL3.GL_RG32UI, GL3.GL_RG_INTEGER, GL.GL_UNSIGNED_INT);
+            
+            format(formatToGL, Format.RGB8I, GL3.GL_RGB8I, GL3.GL_RGB_INTEGER, GL.GL_BYTE);
+            format(formatToGL, Format.RGB8UI, GL3.GL_RGB8UI, GL3.GL_RGB_INTEGER, GL.GL_UNSIGNED_BYTE);
+            format(formatToGL, Format.RGB16I, GL3.GL_RGB16I, GL3.GL_RGB_INTEGER, GL.GL_SHORT);
+            format(formatToGL, Format.RGB16UI, GL3.GL_RGB16UI, GL3.GL_RGB_INTEGER, GL.GL_UNSIGNED_SHORT);
+            format(formatToGL, Format.RGB32I, GL3.GL_RGB32I, GL3.GL_RGB_INTEGER, GL.GL_INT);
+            format(formatToGL, Format.RGB32UI, GL3.GL_RGB32UI, GL3.GL_RGB_INTEGER, GL.GL_UNSIGNED_INT);
+            
+            format(formatToGL, Format.RGBA8I, GL3.GL_RGBA8I, GL3.GL_RGBA_INTEGER, GL.GL_BYTE);
+            format(formatToGL, Format.RGBA8UI, GL3.GL_RGBA8UI, GL3.GL_RGBA_INTEGER, GL.GL_UNSIGNED_BYTE);
+            format(formatToGL, Format.RGBA16I, GL3.GL_RGBA16I, GL3.GL_RGBA_INTEGER, GL.GL_SHORT);
+            format(formatToGL, Format.RGBA16UI, GL3.GL_RGBA16UI, GL3.GL_RGBA_INTEGER, GL.GL_UNSIGNED_SHORT);
+            format(formatToGL, Format.RGBA32I, GL3.GL_RGBA32I, GL3.GL_RGBA_INTEGER, GL.GL_INT);
+            format(formatToGL, Format.RGBA32UI, GL3.GL_RGBA32UI, GL3.GL_RGBA_INTEGER, GL.GL_UNSIGNED_INT);
+        }
+        
         return formatToGL;
     }
 }

+ 4 - 0
jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java

@@ -298,6 +298,10 @@ public final class GLRenderer implements Renderer {
         if (hasFloatTexture) {
             caps.add(Caps.FloatTexture);
         }
+        
+        // integer texture format extensions
+        if(hasExtension("GL_EXT_texture_integer") || caps.contains(Caps.OpenGL30))
+            caps.add(Caps.IntegerTexture);
 
         if (hasExtension("GL_OES_depth_texture") || gl2 != null) {
             caps.add(Caps.DepthTexture);

+ 0 - 3
jme3-core/src/main/java/com/jme3/scene/GeometryGroupNode.java

@@ -9,9 +9,6 @@ package com.jme3.scene;
 public abstract class GeometryGroupNode extends Node {
     
     public static int getGeometryStartIndex(Geometry geom) {
-        if (geom.startIndex == -1) {
-            throw new AssertionError();
-        }
         return geom.startIndex;
     }
     

+ 23 - 2
jme3-core/src/main/java/com/jme3/shader/ShaderGenerator.java

@@ -38,6 +38,7 @@ import com.jme3.material.Technique;
 import com.jme3.material.TechniqueDef;
 import com.jme3.shader.Shader.ShaderType;
 import java.util.List;
+import java.util.regex.*;
 
 /**
  * This class is the base for a shader generator using the ShaderNodes system,
@@ -59,7 +60,11 @@ public abstract class ShaderGenerator {
     /**
      * the technique def to use for the shader generation
      */
-    protected TechniqueDef techniqueDef = null;    
+    protected TechniqueDef techniqueDef = null;
+    /**
+     * Extension pattern
+     */
+    Pattern extensions = Pattern.compile("(#extension.*\\s+)");
 
     /**
      * Build a shaderGenerator
@@ -142,7 +147,23 @@ public abstract class ShaderGenerator {
 
         sourceDeclaration.append(source);
 
-        return sourceDeclaration.toString();
+        return moveExtensionsUp(sourceDeclaration);
+    }
+
+    /**
+     * parses the source and moves all the extensions at the top of the shader source as having extension declarations
+     * in the middle of a shader is against the specs and not supported by all drivers.
+     * @param sourceDeclaration
+     * @return
+     */
+    private String moveExtensionsUp(StringBuilder sourceDeclaration) {
+        Matcher m = extensions.matcher( sourceDeclaration.toString());
+        StringBuilder finalSource = new StringBuilder();
+        while(m.find()){
+            finalSource.append(m.group());
+        }
+        finalSource.append(m.replaceAll(""));
+        return finalSource.toString();
     }
 
     /**

+ 2 - 2
jme3-core/src/main/java/com/jme3/shadow/AbstractShadowRenderer.java

@@ -94,7 +94,7 @@ public abstract class AbstractShadowRenderer implements SceneProcessor, Savable
     protected CompareMode shadowCompareMode = CompareMode.Hardware;
     protected Picture[] dispPic;
     protected RenderState forcedRenderState = new RenderState();
-    protected Boolean renderBackFacesShadows;
+    protected Boolean renderBackFacesShadows = true;
 
     /**
      * true if the fallback material should be used, otherwise false
@@ -725,7 +725,7 @@ public abstract class AbstractShadowRenderer implements SceneProcessor, Savable
     }
 
     /**
-     * Sets the shadow edges thickness. default is 1, setting it to lower values
+     * Sets the shadow edges thickness. default is 10, setting it to lower values
      * can help to reduce the jagged effect of the shadow edges
      *
      * @param edgesThickness

+ 1 - 1
jme3-core/src/main/java/com/jme3/shadow/DirectionalLightShadowRenderer.java

@@ -145,7 +145,7 @@ public class DirectionalLightShadowRenderer extends AbstractShadowRenderer {
         float frustumNear = Math.max(viewCam.getFrustumNear(), 0.001f);
         ShadowUtil.updateFrustumPoints(viewCam, frustumNear, zFar, 1.0f, points);
 
-        //shadowCam.setDirection(direction);
+        shadowCam.setFrustumFar(zFar);
         shadowCam.getRotation().lookAt(light.getDirection(), shadowCam.getUp());
         shadowCam.update();
         shadowCam.updateViewProjection();

+ 1 - 1
jme3-core/src/main/java/com/jme3/shadow/ShadowUtil.java

@@ -465,7 +465,7 @@ public class ShadowUtil {
         shadowCam.setProjectionMatrix(null);
 
         if (ortho) {
-            shadowCam.setFrustum(-1, 1, -1, 1, 1, -1);
+            shadowCam.setFrustum(-shadowCam.getFrustumFar(), shadowCam.getFrustumFar(), -1, 1, 1, -1);
         }
 
         // create transform to rotate points to viewspace        

+ 6 - 3
jme3-core/src/main/java/com/jme3/texture/FrameBuffer.java

@@ -510,14 +510,17 @@ public class FrameBuffer extends NativeObject {
     }
 
     /**
-     * @return The first color buffer attached to this FrameBuffer, or null
+     * @return The color buffer with the index set by {@link #setTargetIndex(int), or null
      * if no color buffers are attached.
+	 * If MRT is disabled, the first color buffer is returned.
      */
     public RenderBuffer getColorBuffer() {
         if (colorBufs.isEmpty())
             return null;
-        
-        return colorBufs.get(0);
+        if (colorBufIndex<0 || colorBufIndex>=colorBufs.size()) {
+			return colorBufs.get(0);
+		}
+        return colorBufs.get(colorBufIndex);
     }
 
     /**

+ 27 - 1
jme3-core/src/main/java/com/jme3/texture/Image.java

@@ -299,7 +299,33 @@ public class Image extends NativeObject implements Savable /*, Cloneable*/ {
          * 
          * Requires {@link Caps#TextureCompressionETC1}.
          */
-        ETC1(4, false, true, false);
+        ETC1(4, false, true, false),
+            
+        R8I(8), 	  	  	  	 
+        R8UI(8),  	  	  	 
+        R16I(16), 	  	  	  	 
+        R16UI(16),	  	  	 
+        R32I(32),  	  	  	 
+        R32UI(32), 	  	  	 
+        RG8I(16),   	  	 
+        RG8UI(16), 	  	  	 
+        RG16I(32),   	  	 
+        RG16UI(32), 	  	 
+        RG32I(64),   	  	 
+        RG32UI(64), 	  	 
+        RGB8I(24),   	 
+        RGB8UI(24),   	 
+        RGB16I(48),   	 
+        RGB16UI(48), 	  	 
+        RGB32I(96), 	  	 
+        RGB32UI(96),  	 
+        RGBA8I(32), 
+        RGBA8UI(32), 	 
+        RGBA16I(64),	 
+        RGBA16UI(64),  
+        RGBA32I(128),  
+        RGBA32UI(128) 
+        ;
 
         private int bpp;
         private boolean isDepth;

+ 4 - 2
jme3-core/src/main/java/com/jme3/util/ListSort.java

@@ -698,9 +698,11 @@ public class ListSort<T> {
             System.arraycopy(arr, iterB, arr, dest, lengthB);
             // The last element of run A belongs at the end of the merge.
             arr[dest + lengthB] = tempArray[iterA];
-        } else if(lengthA== 0){
+        } else if(lengthA == 0){
             throw new UnsupportedOperationException("Compare function result changed! " +
-                                                    "Make sure you do not modify the scene from another thread!");
+                                                    "Make sure you do not modify the scene from"
+                                                    + " another thread and that the comparisons are not based"
+                                                    + " on NaN values.");
         } else {//Fail label
             System.arraycopy(tempArray, iterA, arr, dest, lengthA);
         }

+ 1 - 17
jme3-core/src/main/java/com/jme3/util/TangentBinormalGenerator.java

@@ -226,23 +226,7 @@ public class TangentBinormalGenerator {
         processTriangleData(mesh, vertices, approxTangents,splitMirrored);
 
         //if the mesh has a bind pose, we need to generate the bind pose for the tangent buffer
-        if (mesh.getBuffer(Type.BindPosePosition) != null) {
-            
-            VertexBuffer tangents = mesh.getBuffer(Type.Tangent);
-            if (tangents != null) {
-                VertexBuffer bindTangents = new VertexBuffer(Type.BindPoseTangent);
-                bindTangents.setupData(Usage.CpuOnly,
-                        4,
-                        Format.Float,
-                        BufferUtils.clone(tangents.getData()));
-                
-                if (mesh.getBuffer(Type.BindPoseTangent) != null) {
-                    mesh.clearBuffer(Type.BindPoseTangent);
-                }
-                mesh.setBuffer(bindTangents);
-                tangents.setUsage(Usage.Stream);
-            }
-        }
+        TangentUtils.generateBindPoseTangentsIfNecessary(mesh);
     }
     
     public static void generate(Mesh mesh, boolean approxTangents) {

+ 29 - 0
jme3-core/src/main/java/com/jme3/util/TangentUtils.java

@@ -0,0 +1,29 @@
+package com.jme3.util;
+
+import com.jme3.scene.*;
+
+/**
+ * Created by Nehon on 03/10/2016.
+ */
+public class TangentUtils {
+
+    public static void generateBindPoseTangentsIfNecessary(Mesh mesh){
+        if (mesh.getBuffer(VertexBuffer.Type.BindPosePosition) != null) {
+
+            VertexBuffer tangents = mesh.getBuffer(VertexBuffer.Type.Tangent);
+            if (tangents != null) {
+                VertexBuffer bindTangents = new VertexBuffer(VertexBuffer.Type.BindPoseTangent);
+                bindTangents.setupData(VertexBuffer.Usage.CpuOnly,
+                        4,
+                        VertexBuffer.Format.Float,
+                        BufferUtils.clone(tangents.getData()));
+
+                if (mesh.getBuffer(VertexBuffer.Type.BindPoseTangent) != null) {
+                    mesh.clearBuffer(VertexBuffer.Type.BindPoseTangent);
+                }
+                mesh.setBuffer(bindTangents);
+                tangents.setUsage(VertexBuffer.Usage.Stream);
+            }
+        }
+    }
+}

+ 4 - 3
jme3-core/src/main/java/com/jme3/util/mikktspace/MikktspaceTangentGenerator.java

@@ -7,9 +7,9 @@ package com.jme3.util.mikktspace;
 
 import com.jme3.math.FastMath;
 import com.jme3.math.Vector3f;
-import com.jme3.scene.Geometry;
-import com.jme3.scene.Node;
-import com.jme3.scene.Spatial;
+import com.jme3.scene.*;
+import com.jme3.util.*;
+
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
@@ -84,6 +84,7 @@ public class MikktspaceTangentGenerator {
             if(!genTangSpaceDefault(context)){
                 Logger.getLogger(MikktspaceTangentGenerator.class.getName()).log(Level.SEVERE, "Failed to generate tangents for geometry " + g.getName());
             }
+            TangentUtils.generateBindPoseTangentsIfNecessary(g.getMesh());
         }
     }
     

+ 1 - 1
jme3-core/src/main/resources/Common/MatDefs/Light/PBRLighting.frag

@@ -1,6 +1,6 @@
+#import "Common/ShaderLib/PBR.glsllib"
 #import "Common/ShaderLib/GLSLCompat.glsllib"
 #import "Common/ShaderLib/Parallax.glsllib"
-#import "Common/ShaderLib/PBR.glsllib"
 #import "Common/ShaderLib/Lighting.glsllib"
 
 

+ 1 - 1
jme3-core/src/main/resources/Common/MatDefs/Shadow/PostShadow.frag

@@ -80,7 +80,7 @@ void main(){
     #endif   
 
     #ifdef FADE
-        shadow = max(0.0,mix(shadow,1.0,(shadowPosition - m_FadeInfo.x) * m_FadeInfo.y));
+        shadow = max(0.0, mix(shadow, 1.0, max(0.0, (shadowPosition - m_FadeInfo.x) * m_FadeInfo.y)));
     #endif
 
     shadow = shadow * m_ShadowIntensity + (1.0 - m_ShadowIntensity);

+ 0 - 5
jme3-core/src/main/resources/Common/MatDefs/Shadow/PostShadowFilter15.frag

@@ -136,11 +136,6 @@ vec4 main_multiSample(in int numSample){
 
 void main(){  
 
-    #if !defined( RENDER_SHADOWS )
-          outFragColor = fetchTextureSample(m_Texture,texCoord,0);
-          return;
-    #endif
-    
     #ifdef RESOLVE_MS
         vec4 color = vec4(0.0);
         for (int i = 0; i < m_NumSamples; i++){

+ 18 - 2
jme3-examples/src/main/java/jme3test/light/pbr/TestPBRLighting.java

@@ -33,11 +33,11 @@ package jme3test.light.pbr;
 
 import com.jme3.app.SimpleApplication;
 import com.jme3.bounding.BoundingSphere;
+import com.jme3.environment.util.*;
 import com.jme3.light.LightProbe;
 import com.jme3.environment.LightProbeFactory;
 import com.jme3.environment.EnvironmentCamera;
 import com.jme3.environment.generation.JobProgressAdapter;
-import com.jme3.environment.util.LightsDebugState;
 import com.jme3.input.ChaseCamera;
 import com.jme3.input.KeyInput;
 import com.jme3.input.controls.ActionListener;
@@ -71,6 +71,10 @@ public class TestPBRLighting extends SimpleApplication {
         TestPBRLighting app = new TestPBRLighting();
         app.start();
     }
+
+    private Node tex;
+    private Node tex2;
+
     private Geometry model;
     private DirectionalLight dl;
     private Node modelNode;
@@ -135,7 +139,17 @@ public class TestPBRLighting extends SimpleApplication {
             @Override
             public void onAction(String name, boolean isPressed, float tpf) {
                 if (name.equals("debug") && isPressed) {
-                    //envCam.toggleDebug();
+                    if (tex == null) {
+                        return;
+                    }
+                    if (tex.getParent() == null && tex2.getParent() == null) {
+                        guiNode.attachChild(tex);
+                    } else if (tex2.getParent() == null){
+                        tex.removeFromParent();
+                        guiNode.attachChild(tex2);
+                    } else {
+                        tex2.removeFromParent();
+                    }
                 }
 
                 if (name.equals("up") && isPressed) {
@@ -183,6 +197,8 @@ public class TestPBRLighting extends SimpleApplication {
                 @Override
                 public void done(LightProbe result) {
                     System.err.println("Done rendering env maps");
+                    tex = EnvMapUtils.getCubeMapCrossDebugViewWithMipMaps(result.getPrefilteredEnvMap(), assetManager);
+                    tex2 = EnvMapUtils.getCubeMapCrossDebugView(result.getIrradianceMap(), assetManager);
                 }
             });
             ((BoundingSphere)probe.getBounds()).setRadius(100);