From b0ed053472916801e301c32afd7faa1793511000 Mon Sep 17 00:00:00 2001 From: Nehon Date: Sun, 15 Jan 2017 20:32:42 +0100 Subject: [PATCH] Fixed a cloning issue and some tests --- .../plugins/java/com/jme3/material/plugins/J3MLoader.java | 8 ++++++-- .../test/java/com/jme3/asset/LoadShaderSourceTest.java | 1 + .../test/java/com/jme3/renderer/OpaqueComparatorTest.java | 5 +---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/jme3-core/src/plugins/java/com/jme3/material/plugins/J3MLoader.java b/jme3-core/src/plugins/java/com/jme3/material/plugins/J3MLoader.java index 8cecbb6de..0dfaafd3c 100644 --- a/jme3-core/src/plugins/java/com/jme3/material/plugins/J3MLoader.java +++ b/jme3-core/src/plugins/java/com/jme3/material/plugins/J3MLoader.java @@ -615,7 +615,6 @@ public class J3MLoader implements AssetLoader { private void readTechnique(Statement techStat) throws IOException{ isUseNodes = false; String[] split = techStat.getLine().split(whitespacePattern); - Cloner cloner = new Cloner(); String name; if (split.length == 1) { @@ -670,7 +669,12 @@ public class J3MLoader implements AssetLoader { }else if (shaderNames.containsKey(Shader.ShaderType.Vertex) && shaderNames.containsKey(Shader.ShaderType.Fragment)) { if (shaderLanguages.size() > 1) { for (int i = 1; i < shaderLanguages.size(); i++) { - TechniqueDef td = cloner.clone(technique); + TechniqueDef td = null; + try { + td = (TechniqueDef) technique.clone(); + } catch (CloneNotSupportedException e) { + e.printStackTrace(); + } td.setShaderFile(shaderNames, shaderLanguages.get(i)); techniqueDefs.add(td); } 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 4e9999b20..0007bca2c 100644 --- a/jme3-core/src/test/java/com/jme3/asset/LoadShaderSourceTest.java +++ b/jme3-core/src/test/java/com/jme3/asset/LoadShaderSourceTest.java @@ -45,6 +45,7 @@ public class LoadShaderSourceTest { AssetManager assetManager = new DesktopAssetManager(); assetManager.registerLocator(null, ClasspathLocator.class); assetManager.registerLoader(GLSLLoader.class, "frag"); + assetManager.registerLoader(GLSLLoader.class, "glsllib"); String showNormals = (String) assetManager.loadAsset("Common/MatDefs/Misc/ShowNormals.frag"); System.out.println(showNormals); } diff --git a/jme3-core/src/test/java/com/jme3/renderer/OpaqueComparatorTest.java b/jme3-core/src/test/java/com/jme3/renderer/OpaqueComparatorTest.java index ee4d279fd..0d29ad869 100644 --- a/jme3-core/src/test/java/com/jme3/renderer/OpaqueComparatorTest.java +++ b/jme3-core/src/test/java/com/jme3/renderer/OpaqueComparatorTest.java @@ -168,14 +168,11 @@ public class OpaqueComparatorTest { lightingMatPreNormalPass.setName("TechNorm"); lightingMatPreNormalPass.selectTechnique("PreNormalPass", renderManager); - lightingMatGBuf.setName("TechGBuf"); - lightingMatGBuf.selectTechnique("GBuf", renderManager); - lightingMatGlow.setName("TechGlow"); lightingMatGlow.selectTechnique("Glow", renderManager); testSort(lightingMatGlow, lightingPreShadow, lightingMatPreNormalPass, - lightingMatDefault, lightingPostShadow, lightingMatGBuf); + lightingMatDefault, lightingPostShadow); } @Test(expected = AssertionError.class)