diff --git a/src/common/version.h b/src/common/version.h index 676f945..46def51 100755 --- a/src/common/version.h +++ b/src/common/version.h @@ -4,7 +4,7 @@ /* Auto generated version file. DO NOT MODIFY */ #define SYMMETRY_VERSION_MAJOR 0 #define SYMMETRY_VERSION_MINOR 1 -#define SYMMETRY_VERSION_REVISION 304 +#define SYMMETRY_VERSION_REVISION 305 #define SYMMETRY_VERSION_BRANCH "dev" #endif \ No newline at end of file diff --git a/src/game/editor.c b/src/game/editor.c index 7500c75..b0ce6e0 100755 --- a/src/game/editor.c +++ b/src/game/editor.c @@ -781,7 +781,8 @@ void editor_scene_dialog(struct Editor* editor, struct nk_context* context) { copy_scene_filename = false; } - else if(scene_filename_state & NK_EDIT_COMMITED) + + if(scene_filename_state & NK_EDIT_COMMITED) { if(save) scene_save(scene, scene_filename, DIRT_INSTALL); @@ -1239,11 +1240,17 @@ void editor_on_key_release(const struct Event* event) scene_save(scene, scene->filename, DIRT_INSTALL); } - if(event->key.key == KEY_O && input_is_key_pressed(KEY_LCTRL) && !editor->camera_looking_around) + if(event->key.key == KEY_O && input_is_key_pressed(KEY_LCTRL) && !editor->camera_looking_around && editor->window_entity_dialog != 1) { editor->scene_operation_save = false; editor->window_scene_dialog = 1; } + + if(event->key.key == KEY_A && input_is_key_pressed(KEY_LSHIFT) && !editor->camera_looking_around && editor->window_scene_dialog != 1) + { + editor->entity_operation_save = false; + editor->window_entity_dialog = 1; + } } void editor_tool_set(struct Editor* editor, int tool) @@ -1508,10 +1515,7 @@ void editor_camera_update(struct Editor* editor, float dt) } } - debug_vars_show_texture("Editor Cam Depth", editor_camera->depth_tex); debug_vars_show_color_rgba("Editor Cam Clear Color", &editor_camera->clear_color); - debug_vars_show_int("Editor Cam Depth Index", editor_camera->depth_tex); - debug_vars_show_int("Editor Cam Render Index", editor_camera->render_tex); } void editor_widget_color_combov3(struct nk_context* context, vec3* color, int width, int height) @@ -2377,14 +2381,16 @@ void editor_entity_dialog(struct Editor* editor, struct nk_context* context) strncpy(entity_filename, scene->entity_archetypes[editor->selected_entity->archetype_index], MAX_FILENAME_LEN); } - int entity_filename_flags = NK_EDIT_SIG_ENTER | NK_EDIT_GOTO_END_ON_ACTIVATE | NK_EDIT_FIELD; + int entity_filename_flags = NK_EDIT_SIG_ENTER | NK_EDIT_GOTO_END_ON_ACTIVATE | NK_EDIT_FIELD | NK_EDIT_ALWAYS_INSERT_MODE; nk_edit_focus(context, entity_filename_flags); int entity_filename_state = nk_edit_string_zero_terminated(context, entity_filename_flags, entity_filename, MAX_FILENAME_LEN, NULL); + debug_vars_show_int("Edit State", entity_filename_state); if(entity_filename_state & NK_EDIT_ACTIVATED || entity_filename_state & NK_EDIT_ACTIVE) { copy_entity_filename = false; } - else if(entity_filename_state & NK_EDIT_COMMITED) + + if(entity_filename_state & NK_EDIT_COMMITED) { if(save) { diff --git a/src/game/geometry.c b/src/game/geometry.c index 1b737b8..c850f93 100755 --- a/src/game/geometry.c +++ b/src/game/geometry.c @@ -222,12 +222,14 @@ void geom_remove(int index) glDeleteBuffers(1, &geometry->index_vbo); glDeleteVertexArrays(1, &geometry->vao); - geometry->vertex_vbo = 0; - geometry->color_vbo = 0; - geometry->uv_vbo = 0; - geometry->normal_vbo = 0; - geometry->index_vbo = 0; - geometry->vao = 0; + geometry->vertex_vbo = 0; + geometry->color_vbo = 0; + geometry->uv_vbo = 0; + geometry->normal_vbo = 0; + geometry->index_vbo = 0; + geometry->vao = 0; + geometry->indices_length = 0; + geometry->vertices_length = 0; array_push(empty_indices, index, int); } @@ -265,7 +267,7 @@ void create_vao(struct Geometry* geometry, GL_STATIC_DRAW)); glEnableVertexAttribArray(0); glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0); - geometry->vertices_len = array_len(vertices); + geometry->vertices_length = array_len(vertices); if(array_len(normals) > 0) { @@ -312,7 +314,7 @@ void create_vao(struct Geometry* geometry, indices, GL_STATIC_DRAW); geometry->draw_indexed = 1; - geometry->indices_len = array_len(indices); + geometry->indices_length = array_len(indices); } glBindVertexArray(0); @@ -324,9 +326,9 @@ void geom_render(int index, enum Geometry_Draw_Mode draw_mode) struct Geometry* geo = &geometry_list[index]; glBindVertexArray(geo->vao); if(geo->draw_indexed) - glDrawElements(draw_modes[draw_mode], geo->indices_len, GL_UNSIGNED_INT, (void*)0); + glDrawElements(draw_modes[draw_mode], geo->indices_length, GL_UNSIGNED_INT, (void*)0); else - glDrawArrays(draw_modes[draw_mode], 0, geo->vertices_len); + glDrawArrays(draw_modes[draw_mode], 0, geo->vertices_length); glBindVertexArray(0); } @@ -351,7 +353,7 @@ int geom_render_in_frustum(int index, if(intersection == IT_INTERSECT || intersection == IT_INSIDE) { geom_render(index, draw_mode); - indices_rendered = array_len(geometry->indices_len); + indices_rendered = array_len(geometry->indices_length); } } return indices_rendered; diff --git a/src/game/geometry.h b/src/game/geometry.h index 5fabc13..58756a8 100755 --- a/src/game/geometry.h +++ b/src/game/geometry.h @@ -31,8 +31,8 @@ struct Geometry uint normal_vbo; uint color_vbo; uint index_vbo; - uint vertices_len; - uint indices_len; + uint vertices_length; + uint indices_length; int ref_count; struct Bounding_Box bounding_box; struct Bounding_Sphere bounding_sphere; diff --git a/src/game/renderer.c b/src/game/renderer.c index 88ceb9f..1b5ff94 100755 --- a/src/game/renderer.c +++ b/src/game/renderer.c @@ -189,7 +189,7 @@ void renderer_render(struct Renderer* renderer, struct Scene* scene) int intersection = bv_intersect_frustum_box(&active_camera->frustum, &mesh->base.derived_bounding_box); if(intersection == IT_INSIDE || intersection == IT_INTERSECT) { - renderer->num_indices += geometry->indices_len; + renderer->num_indices += geometry->indices_length; renderer->num_rendered++; } else diff --git a/todo.txt b/todo.txt index 84212b2..970fb4c 100644 --- a/todo.txt +++ b/todo.txt @@ -1,5 +1,4 @@ Todo: - - Shift-A to add entity to scene ? Only show bounding box for hovered entity instead of wireframe mesh - Fix crash where if an entity is hoverd in editor and deleted, the game crashes because the hovered variable in editor doesn't know that the entity was deleted ? Write entity flags to scene file or when saving entity to file? @@ -395,4 +394,5 @@ Done: * Save/Load base bounding boxes for entity types other than static mesh * Disabled picking when a tool is active in editor * Simplified rendering further and removed unnecessary intermediate fbos - * We no longer keep geoemtry data loaded from files as it is not needed after data is passed on to opengl \ No newline at end of file + * We no longer keep geoemtry data loaded from files as it is not needed after data is passed on to opengl + * Shift-A to add entity to scene \ No newline at end of file diff --git a/tools/clean_and_regen_project.bat b/tools/clean_and_regen_project.bat index 62a4090..a2afb98 100644 --- a/tools/clean_and_regen_project.bat +++ b/tools/clean_and_regen_project.bat @@ -1,5 +1,5 @@ @echo off chdir /D W:\build\ -rmdir /S /Q W:\build\vs2017 -W:\tools\genie.exe vs2017 +rmdir /S /Q W:\build\vs2019 +call regen_project.bat \ No newline at end of file