Skip to content

Commit cca4413

Browse files
committed
add support for ultrawide displays (#13)
This change includes fixes in the underlying engine that support non-16:9 aspect ratios.
1 parent 04dc504 commit cca4413

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

3d_model_viewer.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ typedef struct
7373
pg_camera camera; // align: 4
7474
} application_state;
7575

76-
GLOBAL pg_config config = {.input_gamepad_count = 1,
76+
GLOBAL pg_config config = {.gamepad_count = 1,
7777
.input_repeat_rate = 750.0f,
7878
.fixed_time_step = (1.0f / 480.0f) * PG_MS_IN_S,
7979
.permanent_mem_size = 1250u * PG_MEBIBYTE,
@@ -268,6 +268,7 @@ FUNCTION void
268268
update_app(pg_assets* assets,
269269
pg_input* input,
270270
pg_f32_2x previous_cursor_position,
271+
pg_f32_2x render_res,
271272
pg_mesh** meshes,
272273
u32* mesh_count,
273274
pg_dynamic_cb_data* dynamic_cb_data,
@@ -376,17 +377,17 @@ update_app(pg_assets* assets,
376377

377378
pg_f32_4x4 world_from_model
378379
= pg_f32_4x4_world_from_model(model_scaling[app_state.art_id],
379-
app_state.rotation,
380-
(pg_f32_3x){0});
380+
app_state.rotation,
381+
(pg_f32_3x){0});
381382
pg_f32_4x4 view_from_world
382383
= pg_f32_4x4_view_from_world(camera_position,
383384
app_state.camera.focal_point,
384385
app_state.camera.up_axis);
385-
pg_f32_4x4 clip_from_view
386-
= pg_f32_4x4_clip_from_view_perspective(27.0f,
387-
16.0f / 9.0f,
388-
0.1f,
389-
100.0f);
386+
pg_f32_4x4 clip_from_view = pg_f32_4x4_clip_from_view_perspective(
387+
27.0f,
388+
render_res.width / render_res.height,
389+
0.1f,
390+
100.0f);
390391

391392
pg_assets_get_meshes(assets,
392393
&app_state.art_id,
@@ -470,6 +471,7 @@ wWinMain(HINSTANCE inst, HINSTANCE prev_inst, WCHAR* cmd_args, s32 show_code)
470471
update_app(&assets,
471472
&windows.input,
472473
previous_cursor_position,
474+
windows.window.render_res,
473475
&meshes,
474476
&mesh_count,
475477
&dynamic_cb_data,

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ download and run the application.
3131
* Arcball camera (camera is rotated on a sphere around the model)
3232
* Mouse/keyboard and gamepad controls for model selection, rotation, zoom, etc.
3333
* UI for displaying model names, performance metrics, etc.
34+
* Ultrawide support
3435

3536
## Models
3637
The included 3D models are processed from their original glTF 2.0 binary format

0 commit comments

Comments
 (0)