@Override public float[] getTextureLocation(Color color) { if (colorPalette == null) initializePalette(); Integer pixelIndex = registeredColors.get(color); if (pixelIndex != null) { return getTextureLocation(pixelIndex); } else { int newPixelIndex = colorList.size(); if (newPixelIndex <= paletteSize * paletteSize) { colorList.add(color); registeredColors.put(color, newPixelIndex); writePixel(newPixelIndex, color); return getTextureLocation(newPixelIndex); } else { LogTools.error("Reached maximum capacity of the palette. Next colors will be wrong."); return new float[] {0.0f, 0.0f}; } } }
@Override public float[] getTextureLocation(Color color) { if (colorPalette == null) initializePalette(); Integer pixelIndex = registeredColors.get(color); if (pixelIndex != null) { return getTextureLocation(pixelIndex); } else { int newPixelIndex = colorList.size(); if (newPixelIndex <= paletteSize * paletteSize) { colorList.add(color); registeredColors.put(color, newPixelIndex); writePixel(newPixelIndex, color); return getTextureLocation(newPixelIndex); } else { PrintTools.error(this, "Reached maximum capacity of the palette. Next colors will be wrong."); return new float[] {0.0f, 0.0f}; } } }