Files
voxelotl-engine/Sources/Voxelotl/Renderer/Mesh.swift

24 lines
611 B
Swift
Raw Normal View History

2024-09-01 23:34:32 +10:00
public struct Mesh<VertexType: Vertex, IndexType: UnsignedInteger>: Equatable {
2024-09-01 21:16:05 +10:00
public let vertices: [VertexType]
public let indices: [IndexType]
}
public extension Mesh {
static var empty: Self { .init(vertices: .init(), indices: .init()) }
}
public protocol Vertex: Equatable {}
public struct VertexPositionNormalTexcoord: Vertex {
var position: SIMD3<Float>
var normal: SIMD3<Float>
var texCoord: SIMD2<Float>
}
2024-09-01 23:34:32 +10:00
public struct VertexPositionNormalColorTexcoord: Vertex {
var position: SIMD3<Float>
var normal: SIMD3<Float>
var color: SIMD4<Float16>
var texCoord: SIMD2<Float>
}