From 0ea5ee3e89a00ac8e4dab2d33da662aeafc67938 Mon Sep 17 00:00:00 2001 From: Shariq Shah Date: Thu, 12 Dec 2019 18:13:33 +1100 Subject: [PATCH] Fixed issue where cameras would use the render resolution set in config instead of actual resolution --- src/game/editor.c | 1 + src/game/player.c | 1 + src/system/platform.c | 6 ------ todo.txt | 4 ++-- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/game/editor.c b/src/game/editor.c index 55046e9..2d2fdcc 100755 --- a/src/game/editor.c +++ b/src/game/editor.c @@ -178,6 +178,7 @@ void editor_init_camera(struct Editor* editor, struct Hashmap* cvars) { int render_width = hashmap_int_get(cvars, "render_width"); int render_height = hashmap_int_get(cvars, "render_height"); + window_get_drawable_size(game_state_get()->window, &render_width, &render_height); camera_attach_fbo(editor_camera, render_width, render_height, true, true, true); } diff --git a/src/game/player.c b/src/game/player.c index f6dce16..3117290 100755 --- a/src/game/player.c +++ b/src/game/player.c @@ -44,6 +44,7 @@ void player_init(struct Player* player, struct Scene* scene) { int render_width = hashmap_int_get(config, "render_width"); int render_height = hashmap_int_get(config, "render_height"); + window_get_drawable_size(game_state->window, &render_width, &render_height); camera_attach_fbo(player_camera, render_width, render_height, true, true, true); } diff --git a/src/system/platform.c b/src/system/platform.c index b24037a..868437a 100755 --- a/src/system/platform.c +++ b/src/system/platform.c @@ -91,12 +91,6 @@ struct Window* window_create(const char* title, int width, int height, int msaa, SDL_GL_GetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, &major); SDL_GL_GetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, &minor); log_message("Window created and initialized with opengl core context %d.%d", major, minor); - - - int msaa_recieved = 0, msaa_recieved_levels = 0; - SDL_GL_GetAttribute(SDL_GL_MULTISAMPLEBUFFERS, &msaa_recieved); - SDL_GL_GetAttribute(SDL_GL_MULTISAMPLESAMPLES, &msaa_recieved_levels); - log_message("MSAA : %d MSAA Levels : %d", msaa_recieved, msaa_recieved_levels); return new_window; } diff --git a/todo.txt b/todo.txt index 1418c97..eea5c5a 100644 --- a/todo.txt +++ b/todo.txt @@ -1,5 +1,4 @@ Todo: - - Fix cameras not resizing to current resolution when scene is loaded/reloaded - Allow renaming scene objects in editor - Add parameter to entity_load command that renames the newly loaded object to whatever the second specified parameter is - Bring back debug variable display in editor and allow showing colours, textures etc @@ -343,4 +342,5 @@ Done: * Fixed bugs with meshes being registered to uninitialized materials and not rendering * Added EF_SKIP_RENDER flag to allow entites to skip rendering * Save default entity archetype to be loaded when there is not other archetype or in case of an error as fallback - * Ensure cameras are not initialized multiple times \ No newline at end of file + * Ensure cameras are not initialized multiple times + * Fixed cameras not resizing to current resolution when scene is loaded/reloaded \ No newline at end of file