Texture texture = textureRegion.getTexture();
if (!texture.getTextureData().isPrepared()) {
texture.getTextureData().prepare();
}
Pixmap pixmap = texture.getTextureData().consumePixmap();
o doku (bölge) yalnızca bir parçasını istiyorum, o zaman bazı manuel işlem yapmanız gerekecek:
for (int x = 0; x < textureRegion.getRegionWidth(); x++) {
for (int y = 0; y < textureRegion.getRegionHeight(); y++) {
int colorInt = pixmap.getPixel(textureRegion.getRegionX() + x, textureRegion.getRegionY() + y);
// you could now draw that color at (x, y) of another pixmap of the size (regionWidth, regionHeight)
}
}
sayesinde, ancak textureRegion.getTexture 'afaik()' irade tüm dokuyu (atlas) iade etmek? –
Evet, tam olarak öyle. Başka bir yolu yoktur, çünkü sadece tek bir doku vardır (bu bir atlasa sahip olmanın bütün noktasıdır). Kendi küçük pixmap'lerinizi yaratmanız ve bölgelerin bölümlerini kopyalamanız gerekecektir. – noone
Bunu nasıl yapabileceğiniz hakkında küçük bir kod snippet'i (denenmemiş) ekledim. – noone