Closed afonsolage closed 2 years ago
Next step is load the atlas onto the AssetServer and update the shader to render the correct UV
Now that I'm reading my own PR, I think doesn't make sense to have multiple atlases for KindDescription, since it should be a single atlas always.
I'll change this...
A very primitive texturing is working:
There are some issues to be solved: 1- Fix texture rotation; 2- Add texture tiling; 3- Check if texture is working for different kinds;
In order to do the texture tiling, the following steps needs to be done, if I'm not mistaken:
TileTextureSize
which is the TileSize
in texture coordinates [0.0, 1.0]
. This is just a matter of 1.0 / TileSize
[0, N]
where N < TileCount
, to tiled UV UV * TileTextureSize
BaseTextCoord
which is the starting point of the tile in texture coordinates. This one can be calculated using TileOffset * TileTextureSize
TileTextureSize
, TiledUV
and BaseTextCoord
to the shader. The first one can be a UniformBuffer
, second and third may be a Vertex Data
uv = baseTextCoord + mod(tiledUV, tileTextureSize)
Texture tiling is working fine.
Next steps:
generate_vertices
and update_chunk
Texture rotation fixed
Found a bug were sometime the mesh::merge_faces
ignores the voxel kind:
Edit: Fixed!
I wasn't able to reproduce:
Fix chunks sometimes not rendering (maybe something related to system ordering)
Skipping it for now
Ok I think everything is good now.
This PR adds texture capabilities to the game. I've made some basic textures on GIMP and added just 4 basic textures to get things done.