1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package main
import gpu "../.."
import app "../../app"
main :: proc() {
state, ok := app.init_window(1280, 720, "GPU - Model Loading")
if !ok {
return
}
defer app.shutdown(&state)
model := gpu.load_model("tests/assets/jersey/scene.gltf")
defer gpu.unload_model(model)
camera := gpu.Camera3D{
position = {0, 1.5, 4},
target = {0, 1, 0},
up = {0, 1, 0},
fovy = 45,
near = 0.1,
far = 100,
}
for !app.window_should_close(&state) {
app.update_camera(&state, &camera, .ORBITAL)
frame := app.begin_frame(&state, gpu.CORNFLOWER_BLUE)
gpu.set_camera_3d(&frame, camera)
_ = gpu.draw_model_frame(&frame, {model = model, position = {0, 0, 0}, scale = 1, tint = gpu.WHITE})
_ = gpu.draw_grid_frame(&frame, {slices = 10, spacing = 1})
_ = app.submit_frame(&state, &frame)
if app.is_key_pressed(&state, .Escape) {
break
}
}
}