From d5c766cc8bb4e13c735a1f51b7d1f3fe5bb81097 Mon Sep 17 00:00:00 2001 From: "nor..67" Date: Sun, 15 Jan 2012 02:12:42 +0000 Subject: [PATCH] - make GeometryBatchFactory check for diffuse texture before applying normal textures - make GeometryBatchFactory throw exception when atlas is full git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9042 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../optimize/GeometryBatchFactory.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/engine/src/tools/jme3tools/optimize/GeometryBatchFactory.java b/engine/src/tools/jme3tools/optimize/GeometryBatchFactory.java index 38974b877..cc8bd2834 100644 --- a/engine/src/tools/jme3tools/optimize/GeometryBatchFactory.java +++ b/engine/src/tools/jme3tools/optimize/GeometryBatchFactory.java @@ -339,13 +339,14 @@ public class GeometryBatchFactory { if (diffuse != null && diffuse.getKey() != null) { String keyName = diffuse.getKey().getName(); if (!atlas.addTexture(diffuse, "DiffuseMap")) { - logger.log(Level.WARNING, "Adding diffuse texture {0} to atlas failed, atlas full?", keyName); - } - if (normal != null && normal.getKey() != null) { - atlas.addTexture(diffuse, "NormalMap", keyName); - } - if (specular != null && specular.getKey() != null) { - atlas.addTexture(specular, "SpecularMap", keyName); + throw new IllegalStateException("Adding diffuse texture" + keyName + "to atlas failed, atlas full."); + } else { + if (normal != null && normal.getKey() != null) { + atlas.addTexture(diffuse, "NormalMap", keyName); + } + if (specular != null && specular.getKey() != null) { + atlas.addTexture(specular, "SpecularMap", keyName); + } } } } @@ -370,7 +371,7 @@ public class GeometryBatchFactory { mat.setTexture("SpecularMap", specularMap); } mat.setFloat("Shininess", 16.0f); - + geom.setMaterial(mat); return geom; }