Fixed a cloning issue and some tests

native-compilation-test
Nehon 8 years ago
parent d537a1c22e
commit b0ed053472
  1. 8
      jme3-core/src/plugins/java/com/jme3/material/plugins/J3MLoader.java
  2. 1
      jme3-core/src/test/java/com/jme3/asset/LoadShaderSourceTest.java
  3. 5
      jme3-core/src/test/java/com/jme3/renderer/OpaqueComparatorTest.java

@ -615,7 +615,6 @@ public class J3MLoader implements AssetLoader {
private void readTechnique(Statement techStat) throws IOException{ private void readTechnique(Statement techStat) throws IOException{
isUseNodes = false; isUseNodes = false;
String[] split = techStat.getLine().split(whitespacePattern); String[] split = techStat.getLine().split(whitespacePattern);
Cloner cloner = new Cloner();
String name; String name;
if (split.length == 1) { 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)) { }else if (shaderNames.containsKey(Shader.ShaderType.Vertex) && shaderNames.containsKey(Shader.ShaderType.Fragment)) {
if (shaderLanguages.size() > 1) { if (shaderLanguages.size() > 1) {
for (int i = 1; i < shaderLanguages.size(); i++) { 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)); td.setShaderFile(shaderNames, shaderLanguages.get(i));
techniqueDefs.add(td); techniqueDefs.add(td);
} }

@ -45,6 +45,7 @@ public class LoadShaderSourceTest {
AssetManager assetManager = new DesktopAssetManager(); AssetManager assetManager = new DesktopAssetManager();
assetManager.registerLocator(null, ClasspathLocator.class); assetManager.registerLocator(null, ClasspathLocator.class);
assetManager.registerLoader(GLSLLoader.class, "frag"); assetManager.registerLoader(GLSLLoader.class, "frag");
assetManager.registerLoader(GLSLLoader.class, "glsllib");
String showNormals = (String) assetManager.loadAsset("Common/MatDefs/Misc/ShowNormals.frag"); String showNormals = (String) assetManager.loadAsset("Common/MatDefs/Misc/ShowNormals.frag");
System.out.println(showNormals); System.out.println(showNormals);
} }

@ -168,14 +168,11 @@ public class OpaqueComparatorTest {
lightingMatPreNormalPass.setName("TechNorm"); lightingMatPreNormalPass.setName("TechNorm");
lightingMatPreNormalPass.selectTechnique("PreNormalPass", renderManager); lightingMatPreNormalPass.selectTechnique("PreNormalPass", renderManager);
lightingMatGBuf.setName("TechGBuf");
lightingMatGBuf.selectTechnique("GBuf", renderManager);
lightingMatGlow.setName("TechGlow"); lightingMatGlow.setName("TechGlow");
lightingMatGlow.selectTechnique("Glow", renderManager); lightingMatGlow.selectTechnique("Glow", renderManager);
testSort(lightingMatGlow, lightingPreShadow, lightingMatPreNormalPass, testSort(lightingMatGlow, lightingPreShadow, lightingMatPreNormalPass,
lightingMatDefault, lightingPostShadow, lightingMatGBuf); lightingMatDefault, lightingPostShadow);
} }
@Test(expected = AssertionError.class) @Test(expected = AssertionError.class)

Loading…
Cancel
Save