private String getLocalMeshTextureName(final Mesh mesh) { final String textureName; if (mesh.getLocalRenderState(StateType.Texture) != null) { final TextureState textureState = (TextureState) mesh.getLocalRenderState(StateType.Texture); if (textureState.isEnabled() && textureState.getTexture() != null) { final TextureKey tKey = textureState.getTexture().getTextureKey();
protected Mesh clone(final Mesh original) { Mesh copy = null; try { copy = original.getClass().newInstance(); } catch (final InstantiationException e) { logger.log(Level.SEVERE, "Could not access final constructor of class " + original.getClass().getCanonicalName(), e); throw new RuntimeException(e); } catch (final IllegalAccessException e) { logger.log(Level.SEVERE, "Could not access final constructor of class " + original.getClass().getCanonicalName(), e); throw new RuntimeException(e); } copy.setName(original.getName() + "_copy"); copy.getSceneHints().set(original.getSceneHints()); copy.setTransform(original.getTransform()); copy.setDefaultColor(original.getDefaultColor()); for (final StateType type : StateType.values()) { final RenderState state = original.getLocalRenderState(type); if (state != null) { copy.setRenderState(state); } } return copy; }
protected Mesh clone(final Mesh original) { Mesh copy = null; try { copy = original.getClass().newInstance(); } catch (final InstantiationException e) { logger.log(Level.SEVERE, "Could not access final constructor of class " + original.getClass().getCanonicalName(), e); throw new RuntimeException(e); } catch (final IllegalAccessException e) { logger.log(Level.SEVERE, "Could not access final constructor of class " + original.getClass().getCanonicalName(), e); throw new RuntimeException(e); } copy.setName(original.getName() + "_copy"); copy.getSceneHints().set(original.getSceneHints()); copy.setTransform(original.getTransform()); copy.setDefaultColor(original.getDefaultColor()); for (final StateType type : StateType.values()) { final RenderState state = original.getLocalRenderState(type); if (state != null) { copy.setRenderState(state); } } return copy; }
public void createAtlases(final AtlasTextureParameter atlasTextureParameter) { for (final ByteBuffer data : dataBuffers) { data.rewind(); final ImageDataFormat fmt = useAlpha ? ImageDataFormat.RGBA : ImageDataFormat.RGB; final Image image = new Image(fmt, PixelDataType.UnsignedByte, atlasWidth, atlasHeight, data, null); final TextureStoreFormat format = atlasTextureParameter.compress ? TextureStoreFormat.GuessCompressedFormat : TextureStoreFormat.GuessNoCompressedFormat; final Texture texture = TextureManager.loadFromImage(image, atlasTextureParameter.minificationFilter, format); texture.setMagnificationFilter(atlasTextureParameter.magnificationFilter); texture.setWrap(atlasTextureParameter.wrapMode); textures.add(texture); } for (final List<TextureParameter> paramList : cachedAtlases.values()) { for (final TextureParameter param : paramList) { final Texture texture = textures.get(param.getAtlasIndex()); final TextureState ts = (TextureState) param.getMesh().getLocalRenderState(StateType.Texture); ts.setTexture(texture, param.getTargetTextureIndex()); ts.setNeedsRefresh(true); } } TexturePacker.logger.info(nrTextures + " textures packed into " + packers.size() + " atlases."); }
TextureState tState = (TextureState) mesh.getLocalRenderState(RenderState.StateType.Texture); if (tState == null) { tState = new TextureState();