diff --git a/src/game/game.c b/src/game/game.c index c25ab37..e695f57 100755 --- a/src/game/game.c +++ b/src/game/game.c @@ -345,30 +345,30 @@ void game_scene_setup(void) void game_debug(float dt) { - if(input_is_key_pressed(KEY_SPACE)) + if(input_is_key_pressed(KEY_PAGEDOWN)) { - struct Entity* model = scene_find(game_state->scene, "Light_Ent"); + struct Entity* model = scene_find(game_state->scene, "Suzanne_Test_Parent"); vec3 x_axis = {0, 1, 0}; transform_rotate(model, &x_axis, 25.f * dt, TS_WORLD); } - if(input_is_key_pressed(KEY_M)) + if(input_is_key_pressed(KEY_PAGEUP)) { - struct Entity* model = scene_find(game_state->scene, "Model_Entity"); + struct Entity* model = scene_find(game_state->scene, "Suzanne_Test_Parent"); //vec3 y_axis = {0, 0, 1}; //transform_rotate(mod_tran, &y_axis, 25.f * dt, TS_LOCAL); vec3 amount = {0, 0, -5 * dt}; transform_translate(model, &amount, TS_LOCAL); } - if(input_is_key_pressed(KEY_N)) - { - struct Entity* model = scene_find(game_state->scene, "Model_Entity"); - /* vec3 y_axis = {0, 0, 1}; */ - /* transform_rotate(mod_tran, &y_axis, 25.f * dt, TS_WORLD); */ - vec3 amount = {0, 0, 5 * dt}; - transform_translate(model, &amount, TS_LOCAL); - } +// if(input_is_key_pressed(KEY_N)) +// { +// struct Entity* model = scene_find(game_state->scene, "Model_Entity"); +// /* vec3 y_axis = {0, 0, 1}; */ +// /* transform_rotate(mod_tran, &y_axis, 25.f * dt, TS_WORLD); */ +// vec3 amount = {0, 0, 5 * dt}; +// transform_translate(model, &amount, TS_LOCAL); +// } /*struct Entity* model = scene_find("Model_Entity"); vec3 x_axis = {0, 1, 0}; @@ -549,6 +549,10 @@ void game_update(float dt, bool* window_should_close) { game_state->game_mode = GAME_MODE_EDITOR; game_state->scene->active_camera_index = CAM_EDITOR; + input_mouse_mode_set(MM_NORMAL); + int width = 0, height = 0; + window_get_drawable_size(game_state_get()->window, &width, &height); + platform_mouse_position_set(game_state_get()->window, width / 2, height / 2); } } diff --git a/src/game/renderer.c b/src/game/renderer.c index f53e5ed..1f40d16 100755 --- a/src/game/renderer.c +++ b/src/game/renderer.c @@ -325,7 +325,8 @@ void renderer_render(struct Renderer* renderer, struct Scene* scene) struct Camera* active_camera = &scene->cameras[scene->active_camera_index]; int width, height; struct Game_State* game_state = game_state_get(); - window_get_size(game_state->window, &width, &height); + //window_get_size(game_state->window, &width, &height); + window_get_drawable_size(game_state->window, &width, &height); glViewport(0, 0, width, height); GL_CHECK(glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)); shader_bind(renderer->composition_shader); diff --git a/src/game/scene.c b/src/game/scene.c index b1966a5..3331b75 100755 --- a/src/game/scene.c +++ b/src/game/scene.c @@ -428,12 +428,6 @@ void scene_post_update(struct Scene* scene) if(light->base.transform.is_modified) light->base.transform.is_modified = false; } - for(int i = 0; i < MAX_ENTITIES; i++) - { - struct Entity* entity = &scene->entities[i]; - if(!(entity->flags & EF_ACTIVE)) continue; - } - if(scene->player.base.transform.is_modified) { scene->player.base.transform.is_modified = false; diff --git a/src/game/transform.c b/src/game/transform.c index dcb7cf8..4834bb3 100755 --- a/src/game/transform.c +++ b/src/game/transform.c @@ -91,9 +91,9 @@ void transform_copy(struct Entity* copy_to, struct Entity* copy_from, bool copy_ { copy_to->transform.parent = current_parent; } - copy_to->transform.is_modified = true; copy_to->transform.children = current_children; + transform_update_transmat(copy_to); } void transform_translate(struct Entity* entity, vec3* amount, enum Transform_Space space) diff --git a/todo.txt b/todo.txt index c90ca67..a982536 100644 --- a/todo.txt +++ b/todo.txt @@ -1,6 +1,4 @@ Todo: - - Fix hierarchical transforms not working in editor mode - - Fix weird rotational bug when rotation resets or inverts after 180 degrees - Better, more accurate picking - Add editor undo for transformation operations - Add material export for blender exporter? @@ -14,13 +12,14 @@ Todo: - Command history in console - Bring back debug variable display in editor and allow showing colours, textures etc - Serialize player, camera properties to file + - Multisampled buffers to bring back aa - Implement behaviour that avoids writing normal entities that do not have children or parent to file to avoid inconsistencies when loading them - Change mouse behaviour to lock cursor when looking around so as not to interfere with gui elements when in editor mode - Editor functionality to read/write scene to/from file - Folder management api to create/delete folders when none exist. Dirent would suffice for our simple needs? - Display default mesh when selected entity type in editor does not have a mesh - Allow picking and selecting other entity types in editor i.e. the ones that don't have meshes - - Separate entity types in entity heirarchy view by the entity type or use a tree view to show parent/child relation or use different colours for different entity types + - Separate entity types in entity hierarchy view by the entity type or use a tree view to show parent/child relation or use different colours for different entity types ? Entity creator window to create new types of entities and write them to disk - Entity browser window which lists all existing entity types from @@ -53,14 +52,14 @@ Todo: - Refactor all global application state into 'Application_Context' struct. A single global instance of which is available everywhere ? Improve bounding sphere calculation - Change the way lights are set as uniforms to remove snprintf calls per frame for every light attribute - - Filter Scene heirarchy by search using entity name + - Filter Scene hierarchy by search using entity name - Command interface that allows applying commands to selected entity like r x 30 would rotate the selected entity or entities on x axis by 30 degrees - Quick scene filter and entity selection by popping up a menu which has list of entities and fuzzy matches them based on the typed name - Screen mouse coordinates to world-coordinates for aiming - Player projectiles and sounds - Console command history - Console command help - - Debug drawing/variable display that also works in game mode. Can be toggled with a console command. Can show variable values or plots their graphs or debug textures etc + - Debug drawing/variable display that also works in game mode. Can be toggled with a console command. Can show variable values or plots thier graphs or debug textures etc - Space partitioning and scene handling - Move Gui_State and Editor_State into game_state and modify usage as needed - Get editor camera speed and other settings from config file @@ -99,7 +98,7 @@ Todo: - Implment missing sound source properties (inner/outer cone, getting sound source data) - Shadow maps - Print processor stats and machine capabilites RAM etc on every run to log. - - Do input maps really need to be queried by their string names? + - Do input maps really need to be queried by thier string names? - Write default config/keybindings etc to file if none are found in preferences dir - Multisampled textures and framebuffers - Validate necessary assets at game launch @@ -133,8 +132,9 @@ Bugs: - Fix arc angles resetting when rotating - Fix shader preprocessor failing when the file in //include directive is empty - Fix bug with blinn shader reaching maximum uniform number on mac - - Fix delete in editor not working when the cursor is hovering over scene heirarchy window + - Fix delete in editor not working when the cursor is hovering over scene hierarchy window - Investigate memory leaks caused by nuklear or opengl related operations in gui_update + - Fix weird rotational bug when rotation resets or inverts after 180 degrees Done: * Input @@ -184,7 +184,7 @@ Done: * 3d sound using OpenAL * Fix frustum culling bugs * Array-based Hashmaps - * Fix bugs with heirarchical transformations + * Fix bugs with hierarchical transformations * Remove reduntant "settings" structures and move all configuration stuff to config variables * Log output to file on every run * Add option to specify where to read/write files from instead of being hard-coded assets dir @@ -356,4 +356,5 @@ Done: * Added parameter to entity_load command that renames the newly loaded object to whatever the second specified parameter is * Implment/Test reading/writing scene that has a mixture of default entites and entity archetypes * Add simple player fps controls - * Fixed gimbal lock in fps camera by fixing the order of quaternion multiplication when getting absolute rotation \ No newline at end of file + * Fixed gimbal lock in fps camera by fixing the order of quaternion multiplication when getting absolute rotation + * Fix hierarchical transforms not working in editor mode \ No newline at end of file