Repository navigation
Tilemap rects without a texture path use the mesh texture - #144
Open
WaruGameDev wants to merge 2 commits into
Open
WaruGameDev wants to merge 2 commits into
WaruGameDev wants to merge 2 commits into
Conversation
Tilemap::addRect only creates a submesh when it gets a texture path. With the texture set by Mesh::setTexture (a path or TextureData) and rects added without one, numSubmeshes stayed 0 and createTilemap skipped every tile, with no error. createTilemap now counts submesh 0, where setTexture puts the texture, when the tilemap has rects and no submesh. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…bmesh createTilemap waits for a tile's texture to know its size before it normalizes pixel rects, but it skipped the rects without a submesh of their own (submeshId -1), the ones drawn with submesh 0. A scene loaded from file then built the mesh before the texture size arrived, kept the pixel rects and drew the whole texture in every tile. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Tilemap::addRectonly creates a submesh when it gets a texture path. If the texture is set withMesh::setTexture(a path orTextureData) and the rects are added without a path,numSubmeshesstays 0, socreateTilemapdrops every tile and logs nothing:Fix
A rect without its own texture path already uses submesh 0, where
Mesh::setTextureputs the texture.createTilemapnow counts that submesh when the tilemap has rects and no submesh yet. Rects added with a path keep creating their own submeshes as before.Testing
The snippet above (two tiles), reading the
MeshComponentaftercreateTilemap():main:numSubmeshes == 0, 0 indicesnumSubmeshes == 1, 12 indicesThe engine library builds with MSVC (VS 2022, Debug).
🤖 Generated with Claude Code