From d83815847aa1159f2d3b462121d1935748ca8355 Mon Sep 17 00:00:00 2001 From: "nor..67" Date: Sun, 15 Jan 2012 04:38:52 +0000 Subject: [PATCH] - add size warning to TextureAtlas git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9051 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- engine/src/tools/jme3tools/optimize/TextureAtlas.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/engine/src/tools/jme3tools/optimize/TextureAtlas.java b/engine/src/tools/jme3tools/optimize/TextureAtlas.java index 559e5bffe..792d9e38f 100644 --- a/engine/src/tools/jme3tools/optimize/TextureAtlas.java +++ b/engine/src/tools/jme3tools/optimize/TextureAtlas.java @@ -53,6 +53,8 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.TreeMap; +import java.util.logging.Level; +import java.util.logging.Logger; /** * @@ -60,6 +62,7 @@ import java.util.TreeMap; */ public class TextureAtlas { + private static final Logger logger = Logger.getLogger(TextureAtlas.class.getName()); private Map images; private int atlasWidth, atlasHeight; private Format format = Format.ABGR8; @@ -348,7 +351,10 @@ public class TextureAtlas { GeometryBatchFactory.gatherGeoms(root, geometries); TextureAtlas atlas = new TextureAtlas(atlasSize, atlasSize); for (Geometry geometry : geometries) { - atlas.addGeometry(geometry); + if(!atlas.addGeometry(geometry)){ + logger.log(Level.WARNING, "Texture atlas size too small, cannot add all textures"); + return null; + } } return atlas; }