From a9afcecc41b54feaac253e38d2f2282c8c6027fc Mon Sep 17 00:00:00 2001 From: Riccardo Balbo Date: Mon, 2 Sep 2019 09:25:41 +0200 Subject: [PATCH] Recognize .glsl files as glsllib. --- .../src/plugins/java/com/jme3/shader/plugins/GLSLLoader.java | 2 +- .../src/test/java/com/jme3/asset/LoadShaderSourceTest.java | 1 + jme3-core/src/tools/java/jme3tools/shadercheck/ShaderCheck.java | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) 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 ce3264b2d..3c4dd9130 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 @@ -191,7 +191,7 @@ public class GLSLLoader implements AssetLoader { if (info.getKey() instanceof ShaderAssetKey) { injectDependencies = ((ShaderAssetKey) info.getKey()).isInjectDependencies(); } - if (info.getKey().getExtension().equals("glsllib")) { + if (info.getKey().getExtension().equals("glsllib")||info.getKey().getExtension().equals("glsl")) { // NOTE: Loopback, GLSLLIB is loaded by this loader // and needs data as InputStream return reader; diff --git a/jme3-core/src/test/java/com/jme3/asset/LoadShaderSourceTest.java b/jme3-core/src/test/java/com/jme3/asset/LoadShaderSourceTest.java index 0007bca2c..e4f3e57a8 100644 --- a/jme3-core/src/test/java/com/jme3/asset/LoadShaderSourceTest.java +++ b/jme3-core/src/test/java/com/jme3/asset/LoadShaderSourceTest.java @@ -46,6 +46,7 @@ public class LoadShaderSourceTest { assetManager.registerLocator(null, ClasspathLocator.class); assetManager.registerLoader(GLSLLoader.class, "frag"); assetManager.registerLoader(GLSLLoader.class, "glsllib"); + assetManager.registerLoader(GLSLLoader.class, "glsl"); String showNormals = (String) assetManager.loadAsset("Common/MatDefs/Misc/ShowNormals.frag"); System.out.println(showNormals); } diff --git a/jme3-core/src/tools/java/jme3tools/shadercheck/ShaderCheck.java b/jme3-core/src/tools/java/jme3tools/shadercheck/ShaderCheck.java index 98d379b38..ad4bf1dd1 100644 --- a/jme3-core/src/tools/java/jme3tools/shadercheck/ShaderCheck.java +++ b/jme3-core/src/tools/java/jme3tools/shadercheck/ShaderCheck.java @@ -31,7 +31,7 @@ public class ShaderCheck { assetManager.registerLocator("/", ClasspathLocator.class); assetManager.registerLoader(J3MLoader.class, "j3m"); assetManager.registerLoader(J3MLoader.class, "j3md"); - assetManager.registerLoader(GLSLLoader.class, "vert", "frag","geom","tsctrl","tseval","glsllib"); + assetManager.registerLoader(GLSLLoader.class, "vert", "frag","geom","tsctrl","tseval","glsllib","glsl"); } private static void checkMatDef(String matdefName) {