-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3f15ffd
commit 7d5cb3e
Showing
18 changed files
with
268 additions
and
325 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// | ||
// Basic3DPresenter.swift | ||
// BasicSurfaces | ||
// | ||
// Copyright © 2024 Colin Ford. All rights reserved. | ||
// | ||
|
||
import MetalUI | ||
import MetalKit | ||
|
||
class Basic3DPresenter: MTKView, MetalPresenting { | ||
var renderer: MetalRendering! | ||
var surface: BasicSurface! | ||
|
||
required init() { | ||
super.init(frame: .zero, device: MTLCreateSystemDefaultDevice()) | ||
configure(device: device) | ||
} | ||
|
||
required init(coder: NSCoder) { | ||
fatalError("init(coder:) has not been implemented") | ||
} | ||
|
||
func configureMTKView() { | ||
colorPixelFormat = .bgra8Unorm | ||
clearColor = MTLClearColor(red: 0, green: 0, blue: 0.1, alpha: 1) | ||
depthStencilPixelFormat = .depth32Float | ||
clearDepth = 1.0 | ||
} | ||
|
||
func renderer(forDevice device: MTLDevice) -> MetalRendering { | ||
surface = Sphere(device: device)//, radius: 2, vertexCount: 10240) | ||
return Basic3DRenderer(mtkView: self, vertices: surface.vertices, device: device) | ||
} | ||
} | ||
|
Oops, something went wrong.