try to load model on click

This commit is contained in:
Михаил Капелько committed 2026-10-19 18:25:35 +03:00
1 parent 5c93de7764
commit cc29a5fc93
5 files changed
+22 -9

No files matched your search

@@ -34,21 +34,13 @@ final class RenderGLView: NSOpenGLView {
RENDER_SHADER_MAIN_VS, RENDER_SHADER_MAIN_FS,
RENDER_SHADER_SHADOW_VS, RENDER_SHADER_SHADOW_FS,
RENDER_CONFIG)
loadModel()
//loadModel()
startTime = CACurrentMediaTime()
ready = true
renderSet(F.willPrepareGLContext, true)
}
private func loadModel() {
guard let resources = Bundle.main.resourceURL else { return }
let path = resources.appendingPathComponent("assets/cube.gltf").path
if FileManager.default.fileExists(atPath: path) {
sr_load_model(path)
}
}
override func reshape() {
super.reshape()
needsDisplay = true
+2
View File
@@ -11,6 +11,8 @@ let RENDER_CONFIG = sr_config(
let RENDER_FPS = 60.0
let RENDER_MODEL_CUBE = "/assets/cube.gltf"
let RENDER_OPENGL_ATTRS: [NSOpenGLPixelFormatAttribute] = [
UInt32(NSOpenGLPFAOpenGLProfile), UInt32(NSOpenGLProfileVersion3_2Core),
UInt32(NSOpenGLPFAColorSize), 24,
+7
View File
@@ -1,4 +1,11 @@
import Foundation
import RaylibBridge
func renderLoadCubeModel() {
let path = Bundle.main.resourceURL!.path + RENDER_MODEL_CUBE
print("ИГР renderLCB path: '\(path)'")
sr_load_model(path)
}
func renderStartTimer(_ vm: RenderVM) {
// Schedule repaints every once in FPS seconds