Skip to content

Commit 27aecbf

Browse files
Increase max supported texture size when stitching textures for 3D models
1 parent 371da30 commit 27aecbf

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

rainbow/src/main/java/org/geysermc/rainbow/mapping/texture/StitchedTextures.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
import java.util.stream.Stream;
2424

2525
public record StitchedTextures(Map<String, TextureAtlasSprite> sprites, Supplier<NativeImage> stitched, int width, int height) {
26+
// Not sure if 16384 should be the max supported texture size, but it seems to work well enough.
27+
// Max supported texture size seems to mostly be a driver thing, to not let the stitched texture get too big for uploading it to the GPU
28+
// This is not an issue for us
29+
private static final int MAX_TEXTURE_SIZE = 1 << 14;
2630

2731
public Optional<TextureAtlasSprite> getSprite(String key) {
2832
if (TextureSlotsAccessor.invokeIsTextureReference(key)) {
@@ -48,8 +52,7 @@ public static StitchedTextures stitchModelTextures(TextureSlots textures, PackCo
4852

4953
private static SpriteLoader.Preparations prepareStitching(Stream<ResourceLocation> textures, PackContext context) {
5054
// Atlas ID doesn't matter much here, but BLOCKS is the most appropriate
51-
// Not sure if 1024 should be the max supported texture size, but it seems to work
52-
SpriteLoader spriteLoader = new SpriteLoader(AtlasIds.BLOCKS, 1024, 16, 16);
55+
SpriteLoader spriteLoader = new SpriteLoader(AtlasIds.BLOCKS, MAX_TEXTURE_SIZE, 16, 16);
5356
List<SpriteContents> sprites = textures.distinct()
5457
.map(texture -> readSpriteContents(texture, context))
5558
.<SpriteContents>mapMulti(Optional::ifPresent)

0 commit comments

Comments
 (0)