This fully implements renderer support for tiled textures. This works by taking the tuva and tuvm values from the TILE data of a packet, and restoring them to their original values. tuva points to the starting offset where wrapping occurs, and tuvm describes the size of the area that will be wrapped. UV coordinates are treated as base coordinates, where (0,0) is the start of tuva. When UV coordinates exceed the boundaries of tuvm, they will be wrapped.
To handle texture tiling, the fragment shader needed to be updated to receive the tiled area coordinates, and to perform tiled conversion on the UV coordinates. It's assumed that tiling width and tiling height can be independently assigned, meaning if the tiled width is zero, tiled height could still be non-zero and only affect the V coordinate, and so on.
Note: Objects will not be exported with tiled textures, because there's currently no way to preserve that information. Only the renderer can display tiled textures correctly. Exported models will have UVs displayed like they were before this commit, with each vertex UV converted to their tiled counterparts.
Refactor changes
Changed local variable stp in fragment shader to a bool... Because I didn't know bool was a supported type before.
Triangle.Uv and in_Uv are now Vector2s instead of Vector3s.
Mesh.SetData now allows null for individual list arguments. When null is passed, a zeroed list is created for assinging the buffer data.
Mesh.BufferData now performs all 3 GL calls, and handles creating a zeroed list when null. (Note that passing a null list instead to the GL call is valid, but this will produce garbage data).
Simplified MeshBatch.BindCube by skipping assignment of normalList and uvList, since they can now be passed as null.
Refactored MeshBatch.BindCube and BindMesh to handle assigning to lists of different element sizes (UVs and tiled areas).
Added TiledUV class to store tiled UV/area information in Triangles.
Added IsTiled property to Triangles, which returns true if the TiledUv property is non-null.
Added "Has Tiled Textures" display property to ModelEntity.
Fixed Triangle fromTriangle constructor not assigning AttachedNormalIndices, and also added assignment for TiledUv.
Added Logger.Write*Line(string) function overloads because passing just a string would default to calling the format args overload, which would treat text as a format string.
Renderer change
This fully implements renderer support for tiled textures. This works by taking the
tuva
andtuvm
values from theTILE
data of a packet, and restoring them to their original values.tuva
points to the starting offset where wrapping occurs, andtuvm
describes the size of the area that will be wrapped. UV coordinates are treated as base coordinates, where (0,0) is the start oftuva
. When UV coordinates exceed the boundaries oftuvm
, they will be wrapped.To handle texture tiling, the fragment shader needed to be updated to receive the tiled area coordinates, and to perform tiled conversion on the UV coordinates. It's assumed that tiling width and tiling height can be independently assigned, meaning if the tiled width is zero, tiled height could still be non-zero and only affect the V coordinate, and so on.
Note: Objects will not be exported with tiled textures, because there's currently no way to preserve that information. Only the renderer can display tiled textures correctly. Exported models will have UVs displayed like they were before this commit, with each vertex UV converted to their tiled counterparts.
Refactor changes
stp
in fragment shader to a bool... Because I didn't know bool was a supported type before.Triangle.Uv
andin_Uv
are now Vector2s instead of Vector3s.IsTiled
property to Triangles, which returns true if theTiledUv
property is non-null.AttachedNormalIndices
, and also added assignment forTiledUv
.Logger.Write*Line(string)
function overloads because passing just a string would default to calling the format args overload, which would treat text as a format string.