init dump

This commit is contained in:
2024-05-05 17:01:56 +10:00
commit 608cf45822
53 changed files with 19224 additions and 0 deletions

View File

@ -0,0 +1,54 @@
import OrderedCollections
public struct Model: Resource
{
public let meshes: [Mesh]
}
public struct Mesh: Resource
{
public typealias Index = UInt16
public struct Vertex: Equatable
{
public let position: Vec3f
public let normal: Vec3f
public let texCoord: Vec2f
public init(position: Vec3f, normal: Vec3f, texCoord: Vec2f)
{
self.position = position
self.normal = normal
self.texCoord = texCoord
}
}
public struct SubMesh
{
public let start, length: Int
public init(start: Int, length: Int)
{
self.start = start
self.length = length
}
}
public let vertices: [Vertex]
public let indices: [Index]
public let subMeshes: OrderedDictionary<String, SubMesh>
}
public extension Mesh
{
static let empty = Self(vertices: .init(), indices: .init(), subMeshes: .init())
init(vertices: [Vertex], indices: [Index])
{
self.init(
vertices: vertices,
indices: indices,
subMeshes: .init())
}
}