Created
March 3, 2024 20:22
-
-
Save patskovn/adb4b55b3893829ca715f0877c6391a2 to your computer and use it in GitHub Desktop.
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
var sceneConstants: SceneConstants = ... | |
public func draw(in view: MTKView) { | |
guard let drawable = view.currentDrawable else { return } | |
... | |
let deltaTime = 1 / Float(view.preferredFramesPerSecond) | |
sceneConstants.t += deltaTime | |
commandEncoder.setVertexBytes(&sceneConstants, | |
length: MemoryLayout<SceneConstants>.stride, | |
index: 2) | |
... | |
commandEncoder.endEncoding() | |
commandBuffer.present(drawable) | |
commandBuffer.commit() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment