diff --git a/jme3-core/src/main/java/com/jme3/shadow/ShadowUtil.java b/jme3-core/src/main/java/com/jme3/shadow/ShadowUtil.java index b6ed55135..a7ea7b380 100644 --- a/jme3-core/src/main/java/com/jme3/shadow/ShadowUtil.java +++ b/jme3-core/src/main/java/com/jme3/shadow/ShadowUtil.java @@ -32,7 +32,9 @@ package com.jme3.shadow; import com.jme3.bounding.BoundingBox; +import com.jme3.bounding.BoundingSphere; import com.jme3.bounding.BoundingVolume; +import com.jme3.collision.UnsupportedCollisionException; import com.jme3.math.FastMath; import com.jme3.math.Matrix4f; import com.jme3.math.Transform; @@ -42,6 +44,7 @@ import com.jme3.renderer.Camera; import com.jme3.renderer.ViewPort; import com.jme3.renderer.queue.GeometryList; import com.jme3.renderer.queue.RenderQueue; +import com.jme3.renderer.queue.RenderQueue.ShadowMode; import com.jme3.scene.Geometry; import com.jme3.scene.Node; import com.jme3.scene.Spatial; diff --git a/jme3-core/src/plugins/java/com/jme3/shader/plugins/GLSLLoader.java b/jme3-core/src/plugins/java/com/jme3/shader/plugins/GLSLLoader.java index 5545f480d..ce3264b2d 100644 --- a/jme3-core/src/plugins/java/com/jme3/shader/plugins/GLSLLoader.java +++ b/jme3-core/src/plugins/java/com/jme3/shader/plugins/GLSLLoader.java @@ -34,10 +34,7 @@ package com.jme3.shader.plugins; import com.jme3.asset.*; import com.jme3.asset.cache.AssetCache; -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.Reader; +import java.io.*; import java.util.*; /** @@ -160,18 +157,27 @@ public class GLSLLoader implements AssetLoader { if (node.getDependencies().isEmpty()) { return node.getSource(); } else { - StringBuilder sb = new StringBuilder(node.getSource()); - List resolvedShaderNodes = new ArrayList<>(); + if (injectDependencies) { + StringBuilder sb = new StringBuilder(node.getSource()); + List resolvedShaderNodes = new ArrayList<>(); - for (ShaderDependencyNode dependencyNode : node.getDependencies()) { - resolvedShaderNodes.add(resolveDependencies(dependencyNode, alreadyInjectedSet, extensions)); - } - List injectIndices = node.getDependencyInjectIndices(); - for (int i = resolvedShaderNodes.size() - 1; i >= 0; i--) { - // Must insert them backwards .. - sb.insert(injectIndices.get(i), resolvedShaderNodes.get(i)); + for (ShaderDependencyNode dependencyNode : node.getDependencies()) { + resolvedShaderNodes.add(resolveDependencies(dependencyNode, alreadyInjectedSet, extensions, injectDependencies)); + } + + List injectIndices = node.getDependencyInjectIndices(); + for (int i = resolvedShaderNodes.size() - 1; i >= 0; i--) { + // Must insert them backwards .. + sb.insert(injectIndices.get(i), resolvedShaderNodes.get(i)); + } + return sb.toString(); + } else { + for (ShaderDependencyNode dependencyNode : node.getDependencies()) { + resolveDependencies(dependencyNode, alreadyInjectedSet, extensions, injectDependencies); + } + return null; } - return sb.toString(); + } } @@ -185,8 +191,7 @@ public class GLSLLoader implements AssetLoader { if (info.getKey() instanceof ShaderAssetKey) { injectDependencies = ((ShaderAssetKey) info.getKey()).isInjectDependencies(); } - String extension = info.getKey().getExtension(); - if (extension.equals("glsllib") || extension.equals("glsl")) { + if (info.getKey().getExtension().equals("glsllib")) { // NOTE: Loopback, GLSLLIB is loaded by this loader // and needs data as InputStream return reader;