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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
#include <assert.h>
#include <glfw3.h>
#include "camera.h"
#include "core.h"
#include "loaders.h"
#include "log.h"
#include "maths.h"
#include "maths_types.h"
#include "render_types.h"
int main() {
double currentFrame = glfwGetTime();
double lastFrame = currentFrame;
double deltaTime;
Core_Bringup("Skinned Animation", NULL);
ModelHandle handle = ModelLoad_gltf("assets/models/gltf/SimpleSkin/glTF/SimpleSkin.gltf", false);
Model* simple_skin = MODEL_GET(handle);
// Okay, right here we've loaded the model. let's assert some facts
// assert(simple_skin->animations->len == 1);
// assert(simple_skin->animations->data[0].rotation != NULL);
// assert(simple_skin->animations->data[0].translation == NULL);
// assert(simple_skin->animations->data[0].scale == NULL);
// mesh* m = &simple_skin->meshes->data[0];
// assert(m->is_skinned);
// assert(m->bones->len == 2); // 1 root and 1 extra joint
// assert(false);
// model_upload_meshes(&core->renderer, simple_skin);
// scene our_scene = make_default_scene();
Vec3 cam_pos = vec3_create(0, 5, -8);
Camera camera =
Camera_Create(cam_pos, vec3_normalise(vec3_negate(cam_pos)), VEC3_Y, deg_to_rad(45.0));
// Main loop
const f32 camera_lateral_speed = 0.2;
const f32 camera_zoom_speed = 0.10;
// animation
// animation_clip track = simple_skin->animations->data[0];
// f64 total_time = 0.0;
while (!ShouldExit()) {
Frame_Begin();
currentFrame = glfwGetTime();
deltaTime = currentFrame - lastFrame;
lastFrame = currentFrame;
// total_time += deltaTime;
// printf("delta time %f\n", deltaTime);
// f64 t = fmod(total_time, track.rotation->max);
// INFO("Total time: %f", t);
// bone rotation
// Quat rot = animation_sample(track.rotation, t).rotation;
// m->bones->data[1].transform_components.rotation = rot;
// quat rot = quat_ident();
Transform tf = transform_create(VEC3_ZERO, quat_ident(), 1.0);
// TODO: Drawing should still just use the PBR pipeline
// draw_skinned_model(&core->renderer, &game.camera, simple_skin, tf, &our_scene);
Frame_End();
}
INFO("Shutting down");
return 0;
}
|