summaryrefslogtreecommitdiff
path: root/examples/obj_loading/ex_obj_loading.c
diff options
context:
space:
mode:
authorJoshua Rowe <17525998+omnisci3nce@users.noreply.github.com>2024-04-20 18:33:05 +1000
committerGitHub <noreply@github.com>2024-04-20 18:33:05 +1000
commitb283835c5e6998bda9b986ff49ee4fd57fe68fc7 (patch)
treebe478c168506a669876ff9df8920b7e35539e98f /examples/obj_loading/ex_obj_loading.c
parentb240374c23365e33727d78ca74e901bcb383e077 (diff)
parent013e1c111e0717f6dc01a8e8582e13a4095e05bc (diff)
Merge pull request #7 from omnisci3nce/transform-hierarchy
Transform hierarchy
Diffstat (limited to 'examples/obj_loading/ex_obj_loading.c')
-rw-r--r--examples/obj_loading/ex_obj_loading.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/examples/obj_loading/ex_obj_loading.c b/examples/obj_loading/ex_obj_loading.c
index 6f1f12a..e225cb2 100644
--- a/examples/obj_loading/ex_obj_loading.c
+++ b/examples/obj_loading/ex_obj_loading.c
@@ -28,7 +28,7 @@ int main() {
// 2. upload vertex data to gpu
model_upload_meshes(&core->renderer, backpack);
// 3. create a camera
- vec3 camera_pos = vec3(3., 4., 10.);
+ vec3 camera_pos = vec3(3., 2., 10.);
vec3 camera_front = vec3_normalise(vec3_negate(camera_pos));
camera cam = camera_create(camera_pos, camera_front, VEC3_Y, deg_to_rad(45.0));
// 4. create lights
@@ -60,9 +60,10 @@ int main() {
render_frame_begin(&core->renderer);
// Draw the backpack
- transform model_tf =
- transform_create(VEC3_ZERO, quat_ident(), 2.0); // make the backpack a bit bigger
- draw_model(&core->renderer, &cam, backpack, model_tf, &our_scene);
+ transform model_tf = transform_create(vec3(0.0, -0.4, 0.0), quat_ident(),
+ 1.8); // make the backpack a bit bigger
+ mat4 model_matrix = transform_to_mat(&model_tf);
+ draw_model(&core->renderer, &cam, backpack, &model_matrix, &our_scene);
render_frame_end(&core->renderer);
}