Convert wall textures from 1D to 2D #338
Merged
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.
New feature implementation
Implemented feature
Walls' textures are now 2D instead of 1D, this allows mapping complex textures to wall and removing the glitches that appeared when some textures (such as tiles) were applied to walls.
Implementation description
To be fully honest I don't understand 100% the obj specification and whether the logic I added for the texture vertices is correct. I tried to follow the same ordering as the polygon vertices and "unwrap" the wall textures manually.
This implementation is only a starting point, followup work should parametrize texture scale for walls, as it happens for floors, as well as adding more wall specific textures. Now we are assuming 2.5m height x 1m width textures.
I split the results in a classic western way.
The good, what would happen if we parametrized the texture height and applied the correct scale to a tiles texture (example taken from airport world):
The bad, the state with the current PR, vertical scale is wrong since the texture is 1x1 but we assume 2.5x1:
The ugly, what it was before this PR (!)