This file contains hidden or 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
class BlendedCirclesRenderer: NSObject, MTKViewDelegate { | |
var device: MTLDevice! | |
var commandQueue: MTLCommandQueue! | |
var pipelineState: MTLRenderPipelineState! | |
var time: Float = 0.0 | |
init(device: MTLDevice = MTLCreateSystemDefaultDevice()!) { | |
self.device = device | |
self.commandQueue = device.makeCommandQueue() | |
This file contains hidden or 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
class MultiCircleRenderer: NSObject, MTKViewDelegate { | |
var device: MTLDevice! | |
var commandQueue: MTLCommandQueue! | |
var pipelineState: MTLRenderPipelineState! | |
var time: Float = 0.0 | |
init(device: MTLDevice = MTLCreateSystemDefaultDevice()!) { | |
self.device = device | |
self.commandQueue = device.makeCommandQueue() | |
This file contains hidden or 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
struct AnimatedCircleMetalView: UIViewRepresentable { | |
func makeUIView(context: Context) -> MTKView { | |
let metalView = MTKView() | |
metalView.device = MTLCreateSystemDefaultDevice() | |
metalView.framebufferOnly = false | |
metalView.colorPixelFormat = .bgra8Unorm | |
metalView.delegate = context.coordinator | |
return metalView | |
} | |
This file contains hidden or 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
class AnimatedCircleRenderer: NSObject, MTKViewDelegate { | |
var device: MTLDevice! | |
var commandQueue: MTLCommandQueue! | |
var pipelineState: MTLRenderPipelineState! | |
var time: Float = 0.0 // New time variable for animation | |
init(device: MTLDevice = MTLCreateSystemDefaultDevice()!) { | |
self.device = device | |
self.commandQueue = device.makeCommandQueue() | |
This file contains hidden or 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
class SmoothCircleRenderer: NSObject, MTKViewDelegate { | |
var device: MTLDevice! | |
var commandQueue: MTLCommandQueue! | |
var pipelineState: MTLRenderPipelineState! | |
init(device: MTLDevice = MTLCreateSystemDefaultDevice()!) { | |
self.device = device | |
self.commandQueue = device.makeCommandQueue() | |
let library = device.makeDefaultLibrary() |