Using samplers created from GLTF data for textures.
Replacing the ad-hoc on demand texture creation approach with one where all textures are created when the scene is parsed: this improves rendering stability and enables async loading of textures.
Bonus!
It appears that the changes here also close #12!
Background
Colour spaces are a complicated rabbit hole, for this PR just being aware that the same image data can be interpreted in two different ways by textures in Vulkan (sRGB vs linear) is sufficient.
Textures were being created on demand because there's no direct way to know whether one should be in sRGB or linear format: this decision was deferred all the way to a Material requesting a texture of the corresponding format at render time. This PR uses the GLTF material spec to encode the desired colour space of each texture in the returned GLTF scene data, which is then used by Scene to create corresponding textures right after parsing that data.
Changes
Replace on-demand texture creation with material-based ColourSpace decisions.
Remove TextureProvider.
Add check for Id<Camera> if attached to Node being added.
Context
This PR addresses two broad points:
Bonus!
It appears that the changes here also close #12!
Background
Colour spaces are a complicated rabbit hole, for this PR just being aware that the same image data can be interpreted in two different ways by textures in Vulkan (sRGB vs linear) is sufficient.
Textures were being created on demand because there's no direct way to know whether one should be in sRGB or linear format: this decision was deferred all the way to a
Material
requesting a texture of the corresponding format at render time. This PR uses the GLTF material spec to encode the desired colour space of each texture in the returned GLTF scene data, which is then used byScene
to create corresponding textures right after parsing that data.Changes
ColourSpace
decisions.TextureProvider
.Id<Camera>
if attached toNode
being added.TestMaterial
toLitMaterial
.Close #16