The Skung Cave commit

This commit is contained in:
2024-05-09 20:52:01 +10:00
parent 446c444728
commit 06046cd163
36 changed files with 11988 additions and 9252 deletions

View File

@ -4,7 +4,7 @@ import OrderedCollections
class G3DbLoader: LoaderProtocol
{
typealias T = Mesh
typealias T = Mesh<VertexPositionNormalTexcoord>
func load(url: URL) -> T?
{
@ -12,6 +12,8 @@ class G3DbLoader: LoaderProtocol
else { return Optional.none }
return try? reader.read()
}
func load(url: URL, content: inout ContentManager) -> T? { return load(url: url) }
}
@ -27,15 +29,15 @@ fileprivate struct G3DbReader
self.reader = UBJsonReader(file: file)
}
mutating func read() throws -> Mesh
mutating func read() throws -> Mesh<VertexPositionNormalTexcoord>
{
let model = try readModel()
let mesh = model.meshes[0]
var vertices = [Mesh.Vertex]()
var vertices = [VertexPositionNormalTexcoord]()
var indices = [UInt16]()
var subMeshes = OrderedDictionary<String, Mesh.SubMesh>()
var subMeshes = OrderedDictionary<String, Mesh<VertexPositionNormalTexcoord>.SubMesh>()
let attributeSize =
{ (attrib: G3DAttribute) in