From faa40bb20636683f242640153db6a459ac509f83 Mon Sep 17 00:00:00 2001 From: Shariq Shah Date: Wed, 29 Mar 2017 00:32:28 +0500 Subject: [PATCH] Added string and boolean types to variant --- README | 352 +++++++++++++++++++++++++++++++++++++++---------- orgfile.org | 55 +++++++- src/game.c | 3 + src/geometry.c | 1 - src/gui.c | 3 +- src/input.c | 1 - src/model.c | 4 +- src/sound.c | 1 + src/variant.c | 47 ++++--- src/variant.h | 5 + 10 files changed, 371 insertions(+), 101 deletions(-) diff --git a/README b/README index 20c9d14..d093e19 100644 --- a/README +++ b/README @@ -11,8 +11,12 @@ _________________ 1 Project Symmetry .. 1.1 What? -.. 1.2 Why? -.. 1.3 License +.. 1.2 License +.. 1.3 File format specifications +..... 1.3.1 Entity +..... 1.3.2 Configuration Variables a.k.a cvars +..... 1.3.3 Keybindings +..... 1.3.4 Level/Scene 2 Things TODO .. 2.1 DONE Input .. 2.2 DONE Shaders @@ -45,40 +49,70 @@ _________________ .. 2.29 DONE Lights! .. 2.30 DONE Fix problems with texture units .. 2.31 CANCELED Draw light volumes -.. 2.32 TODO Fix problems with frustrum culling +.. 2.32 DONE Fix problems with frustrum culling .. 2.33 TODO 2d drawing routines .. 2.34 DONE Gui .. 2.35 CANCELED Image based lighting? .. 2.36 CANCELED Deferred rendering? -.. 2.37 TODO Fix mouse bugs on windows -.. 2.38 DONE Fix mousewheel bugs and gui not responding to mousewheel input -.. 2.39 TODO Ability to mark meshes for debug rendering with possibility of different color for each? -.. 2.40 TODO Setup cross compilation with mingw or stick to msvc? -.. 2.41 DONE Toggleable debug drawing for meshes -.. 2.42 TODO Interleaved vbos for meshes and changes to blender exporter accordingly -.. 2.43 TODO Enumerate and save all the uniform and attribute positions in shader when it is added and cache them in shader object? -.. 2.44 TODO Physics/Collision detection in 2d -.. 2.45 TODO Complete gui integration -.. 2.46 TODO Allow passsing base path as commandline argument? -.. 2.47 TODO Sprite sheet animations -.. 2.48 DONE Resizable framebuffers and textures -.. 2.49 DONE Support for multiple color attachments in framebuffers? -.. 2.50 TODO Multisampled textures and framebuffers -.. 2.51 DONE Better way to store and manage textures attached to framebuffers -.. 2.52 TODO Validate necessary assets at game launch -.. 2.53 TODO Variant type -.. 2.54 TODO Log and debug/stats output in gui -.. 2.55 TODO Editor -.. 2.56 TODO Event Subsystem -.. 2.57 TODO Keybindings for gui? -.. 2.58 DONE Compile and test on windows -.. 2.59 TODO Array based string type comptible with cstring(char*) -.. 2.60 DONE Fix mouse bugs -.. 2.61 DONE Fix -.. 2.62 TODO issues with opengl context showing 2.1 only -.. 2.63 TODO Improve this readme -.. 2.64 TODO ??? -.. 2.65 TODO Profit! +.. 2.37 DONE Fix mouse bugs on windows +.. 2.38 TODO Configuration/Settings load/save handling +.. 2.39 DONE Fix mousewheel bugs and gui not responding to mousewheel input +.. 2.40 TODO Ability to mark meshes for debug rendering with possibility of different color for each? +.. 2.41 TODO Setup cross compilation with mingw or stick to msvc? +.. 2.42 TODO Add marking or queuing up custom meshes for debug render with particular transform and color for rendering bounding spheres for example +.. 2.43 DONE Toggleable debug drawing for meshes +.. 2.44 TODO Interleaved vbos for meshes and changes to blender exporter accordingly +.. 2.45 TODO Enumerate and save all the uniform and attribute positions in shader when it is added and cache them in shader object? +.. 2.46 TODO Physics/Collision detection in 2d +.. 2.47 TODO Complete gui integration +.. 2.48 TODO Allow passsing base path as commandline argument? +.. 2.49 DONE Add strings and booleans to variant types +.. 2.50 DONE Fix Key release not being reported +.. 2.51 TODO Better handling incase assets folder is not found? +.. 2.52 DONE OpenAL not working in releasebuilds +.. 2.53 DONE 3d sound using OpenAL +.. 2.54 TODO Ogg format loading and playback +.. 2.55 TODO Sound streaming +.. 2.56 TODO Implment missing sound source properties (inner/outer cone, getting sound source data) +.. 2.57 TODO Ingame console and console commands etc +.. 2.58 TODO Allow binding/unbinding input maps to functions at runtime, for example if input map "Recompute" is triggered, it would call some function that can recompute bounding spheres. +.. 2.59 TODO Better handling of wav format checking at load time +.. 2.60 TODO Array-based Hashmaps +.. 2.61 TODO Sprite sheet animations +.. 2.62 TODO Replace orgfile with simple text readme and reduce duplication? +.. 2.63 TODO Ray picking +.. 2.64 TODO Shadow maps +.. 2.65 TODO Log output to file on every run +.. 2.66 TODO Print processor stats and machine capabilites RAM etc on every run to log. +.. 2.67 TODO Milestone: Pong! +.. 2.68 TODO Do input maps really need to be queried by their string names? +.. 2.69 TODO Reloading shaders? +.. 2.70 TODO Separate Debug/Editor camera from the active camera in the scene that can be switched to at any time +.. 2.71 DONE Live data views in editor +.. 2.72 DONE Camera resize on window reisze +.. 2.73 DONE Resizable framebuffers and textures +.. 2.74 DONE Support for multiple color attachments in framebuffers? +.. 2.75 TODO Multisampled textures and framebuffers +.. 2.76 DONE Better way to store and manage textures attached to framebuffers +.. 2.77 TODO Validate necessary assets at game launch +.. 2.78 TODO Gamma correctness +.. 2.79 DONE Variant type +.. 2.80 TODO Log and debug/stats output in gui +.. 2.81 TODO Editor +.. 2.82 TODO Event Subsystem +.. 2.83 TODO Keybindings for gui? +.. 2.84 TODO Textual/Binary format for data serialization and persistance +.. 2.85 TODO Better logging +.. 2.86 TODO Hatching/Ink rendering style +.. 2.87 DONE Fix frustum culling sometimes not working +.. 2.88 DONE Compile and test on windows +.. 2.89 TODO Array based string type comptible with cstring(char*) +.. 2.90 DONE Fix mouse bugs +.. 2.91 DONE Fix +.. 2.92 DONE issues with opengl context showing 2.1 only +.. 2.93 TODO Improve this readme +.. 2.94 TODO ??? +.. 2.95 TODO Profit! 1 Project Symmetry @@ -90,21 +124,44 @@ _________________ A topdown 2D shooter exploring symmetry. -1.2 Why? -~~~~~~~~ - - - To create a platform on which i will base further projects on. - - To learn and remove as many black boxes as possible. - - Profit!?! - - -1.3 License +1.2 License ~~~~~~~~~~~ All the code in this repository is under GPLv3, see LICENSE for more information +1.3 File format specifications +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +1.3.1 Entity +------------ + + // Comment, Sample entity definition in file, paremeters left out are + set to defaults // Empty line at the end specifies end of entity + definition entity: "Something" position: 0 0 0 scale: 1 1 1 rotation: + 0 0 0 1 model: "suzanne.pamesh" material: "blinn_phong" diffuse_color: + 1 0 0 1 diffuse_texture: "checkered.tga" specular: 0.55 + + +1.3.2 Configuration Variables a.k.a cvars +----------------------------------------- + + // Comment render_width: 1024 render_height: 1024 fog_enabled: 1 + fog_color: 0.5 0.2 0.2 1 // There can be comments or empty newlines in + between unlike entity definitions + + ambient_light: 0.1 0.1 0.1 1 msaa: 1 msaa_levels: 8 + + +1.3.3 Keybindings +----------------- + + +1.3.4 Level/Scene +----------------- + + 2 Things TODO ============= @@ -292,10 +349,10 @@ _________________ Deferred rendering on hold for now. -2.32 TODO Fix problems with frustrum culling +2.32 DONE Fix problems with frustrum culling ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - Recalculate bounding boxes for rotated meshes? + - State "DONE" from "TODO" [2017-03-26 Sun 01:33] 2.33 TODO 2d drawing routines @@ -324,43 +381,53 @@ _________________ Sticking with forward rendering for now and focusing on tools etc. -2.37 TODO Fix mouse bugs on windows +2.37 DONE Fix mouse bugs on windows ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + - State "DONE" from "TODO" [2017-03-25 Sat 17:27] + + +2.38 TODO Configuration/Settings load/save handling +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + -2.38 DONE Fix mousewheel bugs and gui not responding to mousewheel input +2.39 DONE Fix mousewheel bugs and gui not responding to mousewheel input ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - State "DONE" from "TODO" [2017-03-19 Sun 01:31] -2.39 TODO Ability to mark meshes for debug rendering with possibility of different color for each? +2.40 TODO Ability to mark meshes for debug rendering with possibility of different color for each? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -2.40 TODO Setup cross compilation with mingw or stick to msvc? +2.41 TODO Setup cross compilation with mingw or stick to msvc? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -2.41 DONE Toggleable debug drawing for meshes +2.42 TODO Add marking or queuing up custom meshes for debug render with particular transform and color for rendering bounding spheres for example +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + +2.43 DONE Toggleable debug drawing for meshes ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - State "DONE" from "TODO" [2017-03-18 Sat 16:18] -2.42 TODO Interleaved vbos for meshes and changes to blender exporter accordingly +2.44 TODO Interleaved vbos for meshes and changes to blender exporter accordingly ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -2.43 TODO Enumerate and save all the uniform and attribute positions in shader when it is added and cache them in shader object? +2.45 TODO Enumerate and save all the uniform and attribute positions in shader when it is added and cache them in shader object? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -2.44 TODO Physics/Collision detection in 2d +2.46 TODO Physics/Collision detection in 2d ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -2.45 TODO Complete gui integration +2.47 TODO Complete gui integration ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ x Font selection x Font atlas proper cleanup @@ -368,93 +435,234 @@ _________________ - Custom rendering for gui -2.46 TODO Allow passsing base path as commandline argument? +2.48 TODO Allow passsing base path as commandline argument? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -2.47 TODO Sprite sheet animations +2.49 DONE Add strings and booleans to variant types +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + - State "DONE" from "TODO" [2017-03-29 Wed 00:23] + + +2.50 DONE Fix Key release not being reported +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + - State "DONE" from "TODO" [2017-03-26 Sun 01:16] + + +2.51 TODO Better handling incase assets folder is not found? +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + +2.52 DONE OpenAL not working in releasebuilds +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + - State "DONE" from "TODO" [2017-03-25 Sat 02:06] + + +2.53 DONE 3d sound using OpenAL +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + - State "DONE" from "TODO" [2017-03-23 Thu 01:43] + + +2.54 TODO Ogg format loading and playback +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + +2.55 TODO Sound streaming +~~~~~~~~~~~~~~~~~~~~~~~~~ + + +2.56 TODO Implment missing sound source properties (inner/outer cone, getting sound source data) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + +2.57 TODO Ingame console and console commands etc +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + +2.58 TODO Allow binding/unbinding input maps to functions at runtime, for example if input map "Recompute" is triggered, it would call some function that can recompute bounding spheres. +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + +2.59 TODO Better handling of wav format checking at load time +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + +2.60 TODO Array-based Hashmaps +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + +2.61 TODO Sprite sheet animations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -2.48 DONE Resizable framebuffers and textures +2.62 TODO Replace orgfile with simple text readme and reduce duplication? +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + +2.63 TODO Ray picking +~~~~~~~~~~~~~~~~~~~~~ + + +2.64 TODO Shadow maps +~~~~~~~~~~~~~~~~~~~~~ + + +2.65 TODO Log output to file on every run +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + +2.66 TODO Print processor stats and machine capabilites RAM etc on every run to log. +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + +2.67 TODO Milestone: Pong! +~~~~~~~~~~~~~~~~~~~~~~~~~~ + + - In order to put things into perspective and get a feel for what + really needs to be prioritized, a very small but actual game release + is necessary. + - Release platforms: Windows and Linux + - Makefile additions. Try to compile game as a dynamically loaded + library with ability to reload on recompile + - Separation between game and engine base + - Game .so with init, update and cleanup functions + - Configuration files and "cvars" load/reload + - Keybindings in config + - Log output on every run. + + +2.68 TODO Do input maps really need to be queried by their string names? +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + +2.69 TODO Reloading shaders? +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + +2.70 TODO Separate Debug/Editor camera from the active camera in the scene that can be switched to at any time +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + +2.71 DONE Live data views in editor +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + - State "DONE" from "TODO" [2017-03-22 Wed 02:14] + + +2.72 DONE Camera resize on window reisze +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + - State "DONE" from "TODO" [2017-03-20 Mon 15:22] + + +2.73 DONE Resizable framebuffers and textures ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - State "DONE" from "TODO" [2017-03-16 Thu 22:50] -2.49 DONE Support for multiple color attachments in framebuffers? +2.74 DONE Support for multiple color attachments in framebuffers? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - State "DONE" from "TODO" [2017-03-16 Thu 22:51] -2.50 TODO Multisampled textures and framebuffers +2.75 TODO Multisampled textures and framebuffers ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -2.51 DONE Better way to store and manage textures attached to framebuffers +2.76 DONE Better way to store and manage textures attached to framebuffers ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - State "DONE" from "TODO" [2017-03-16 Thu 22:51] -2.52 TODO Validate necessary assets at game launch +2.77 TODO Validate necessary assets at game launch ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -2.53 TODO Variant type +2.78 TODO Gamma correctness +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + +2.79 DONE Variant type ~~~~~~~~~~~~~~~~~~~~~~ + - State "DONE" from "TODO" [2017-03-22 Wed 02:14] -2.54 TODO Log and debug/stats output in gui + +2.80 TODO Log and debug/stats output in gui ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -2.55 TODO Editor +2.81 TODO Editor ~~~~~~~~~~~~~~~~ -2.56 TODO Event Subsystem +2.82 TODO Event Subsystem ~~~~~~~~~~~~~~~~~~~~~~~~~ -2.57 TODO Keybindings for gui? +2.83 TODO Keybindings for gui? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -2.58 DONE Compile and test on windows +2.84 TODO Textual/Binary format for data serialization and persistance +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + +2.85 TODO Better logging +~~~~~~~~~~~~~~~~~~~~~~~~ + + +2.86 TODO Hatching/Ink rendering style +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + +2.87 DONE Fix frustum culling sometimes not working +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + - State "DONE" from "TODO" [2017-03-25 Sat 19:10] + + +2.88 DONE Compile and test on windows ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - State "DONE" from "TODO" [2017-03-14 Tue 00:32] -2.59 TODO Array based string type comptible with cstring(char*) +2.89 TODO Array based string type comptible with cstring(char*) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -2.60 DONE Fix mouse bugs +2.90 DONE Fix mouse bugs ~~~~~~~~~~~~~~~~~~~~~~~~ - State "DONE" from "TODO" [2017-03-01 Wed 00:45] -2.61 DONE Fix +2.91 DONE Fix ~~~~~~~~~~~~~ -2.62 TODO issues with opengl context showing 2.1 only +2.92 DONE issues with opengl context showing 2.1 only ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + - State "DONE" from "TODO" [2017-03-19 Sun 14:03] - State "DONE" from "TODO" [2017-02-26 Sun 15:39] -2.63 TODO Improve this readme +2.93 TODO Improve this readme ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -2.64 TODO ??? +2.94 TODO ??? ~~~~~~~~~~~~~ -2.65 TODO Profit! +2.95 TODO Profit! ~~~~~~~~~~~~~~~~~ diff --git a/orgfile.org b/orgfile.org index 0a3cba0..de50e5d 100644 --- a/orgfile.org +++ b/orgfile.org @@ -6,14 +6,37 @@ ** What? A topdown 2D shooter exploring symmetry. -** Why? -- To create a platform on which i will base further projects on. -- To learn and remove as many black boxes as possible. -- Profit!?! - ** License All the code in this repository is under GPLv3, see LICENSE for more information +** File format specifications +*** Entity +// Comment, Sample entity definition in file, paremeters left out are set to defaults +// Empty line at the end specifies end of entity definition +entity: "Something" +position: 0 0 0 +scale: 1 1 1 +rotation: 0 0 0 1 +model: "suzanne.pamesh" +material: "blinn_phong" +diffuse_color: 1 0 0 1 +diffuse_texture: "checkered.tga" +specular: 0.55 + +*** Configuration Variables a.k.a cvars +// Comment +render_width: 1024 +render_height: 1024 +fog_enabled: 1 +fog_color: 0.5 0.2 0.2 1 +// There can be comments or empty newlines in between unlike entity definitions + +ambient_light: 0.1 0.1 0.1 1 +msaa: 1 +msaa_levels: 8 + +*** Keybindings +*** Level/Scene * Things TODO ** DONE Input - State "DONE" from "TODO" [2015-07-02 Thu 01:24] @@ -80,8 +103,8 @@ All the code in this repository is under GPLv3, see LICENSE for more information ** CANCELED Draw light volumes - State "CANCELED" from "TODO" [2017-02-26 Sun 15:39] \\ Deferred rendering on hold for now. -** TODO Fix problems with frustrum culling -- Recalculate bounding boxes for rotated meshes? +** DONE Fix problems with frustrum culling +- State "DONE" from "TODO" [2017-03-26 Sun 01:33] ** TODO 2d drawing routines - Sprite batching ** DONE Gui @@ -111,6 +134,8 @@ x Font atlas proper cleanup - Decoupled event handling of gui and input if possible - Custom rendering for gui ** TODO Allow passsing base path as commandline argument? +** DONE Add strings and booleans to variant types +- State "DONE" from "TODO" [2017-03-29 Wed 00:23] ** DONE Fix Key release not being reported - State "DONE" from "TODO" [2017-03-26 Sun 01:16] ** TODO Better handling incase assets folder is not found? @@ -121,12 +146,28 @@ x Font atlas proper cleanup ** TODO Ogg format loading and playback ** TODO Sound streaming ** TODO Implment missing sound source properties (inner/outer cone, getting sound source data) +** TODO Ingame console and console commands etc +** TODO Allow binding/unbinding input maps to functions at runtime, for example if input map "Recompute" is triggered, it would call some function that can recompute bounding spheres. ** TODO Better handling of wav format checking at load time ** TODO Array-based Hashmaps ** TODO Sprite sheet animations ** TODO Replace orgfile with simple text readme and reduce duplication? ** TODO Ray picking +** TODO Shadow maps +** TODO Log output to file on every run +** TODO Print processor stats and machine capabilites RAM etc on every run to log. +** TODO Milestone: Pong! +- In order to put things into perspective and get a feel for what really needs to be prioritized, a very small but actual game release is necessary. +- Release platforms: Windows and Linux +- Makefile additions. Try to compile game as a dynamically loaded library with ability to reload on recompile +- Separation between game and engine base +- Game .so with init, update and cleanup functions +- Configuration files and "cvars" load/reload +- Keybindings in config +- Log output on every run. ** TODO Do input maps really need to be queried by their string names? +** TODO Reloading shaders? +** TODO Separate Debug/Editor camera from the active camera in the scene that can be switched to at any time ** DONE Live data views in editor - State "DONE" from "TODO" [2017-03-22 Wed 02:14] ** DONE Camera resize on window reisze diff --git a/src/game.c b/src/game.c index 5f885fb..0545c5c 100644 --- a/src/game.c +++ b/src/game.c @@ -33,6 +33,8 @@ #define LEN(a) (sizeof(a)/sizeof(a)[0]) +#define MAX_FRAME_TIME 1.f + static void run(void); static void update(float dt, int* window_should_close); static void render(void); @@ -361,6 +363,7 @@ void run(void) uint32 curr_time = platform_get_ticks(); float delta_time = (float)(curr_time - last_time) / 1000.f; last_time = curr_time; + if(delta_time > MAX_FRAME_TIME) delta_time = (1.f / 60.f); /* To deal with resuming from breakpoint we artificially set delta time */ update(delta_time, &should_window_close); render(); diff --git a/src/geometry.c b/src/geometry.c index 7840777..eecc034 100644 --- a/src/geometry.c +++ b/src/geometry.c @@ -97,7 +97,6 @@ void geom_bounding_volume_generate(int index) vec3 len_vec; vec3_sub(&len_vec, &box->max, &sphere->center); sphere->radius = fabsf(vec3_len(&len_vec)); - log_message("Radius : %.3f", sphere->radius); } void geom_bounding_volume_generate_all(void) diff --git a/src/gui.c b/src/gui.c index a4eb63a..cfc3932 100644 --- a/src/gui.c +++ b/src/gui.c @@ -130,10 +130,11 @@ void gui_render(enum nk_anti_aliasing AA, int max_vertex_buffer, int max_element struct Game_State* game_state = game_state_get(); window_get_size(game_state->window, &width, &height); window_get_drawable_size(game_state->window, &display_width, &display_height); - mat4_ortho(&gui_mat, 0, width, height, 0, -100, 100); + mat4_ortho(&gui_mat, 0, display_width, display_height, 0, -100, 100); scale.x = (float)display_width/(float)width; scale.y = (float)display_height/(float)height; + /* setup global state */ glViewport(0,0,display_width,display_height); diff --git a/src/input.c b/src/input.c index a8e9955..e8693b4 100644 --- a/src/input.c +++ b/src/input.c @@ -70,7 +70,6 @@ void input_mouse_pos_set(int xpos, int ypos) void input_on_key(int key, int scancode, int state, int mod_ctrl, int mod_shift) { - log_message("Key %s", state == KS_PRESSED ? "Pressed" : "Released"); for(int i = 0; i < array_len(input_map_list); i++) { struct Input_Map* map = &input_map_list[i]; diff --git a/src/model.c b/src/model.c index 531a3d2..7e9ae5d 100644 --- a/src/model.c +++ b/src/model.c @@ -392,7 +392,6 @@ void model_render_all_debug(struct Camera* camera, const vec4* debug_color) { assert(debug_shader > -1); - int geometry = geom_create_from_file("sphere.pamesh"); shader_bind(debug_shader); { static mat4 mvp; @@ -402,10 +401,9 @@ void model_render_all_debug(struct Camera* camera, struct Model* model = &model_list[i]; struct Entity* entity = entity_get(model->node); struct Transform* transform = entity_component_get(entity, C_TRANSFORM); - int geometry_ac = model->geometry_index; + int geometry = model->geometry_index; mat4_identity(&mvp); mat4_mul(&mvp, &camera->view_proj_mat, &transform->trans_mat); - //mat4_mul(&mvp, &camera->view_proj_mat, &temp_trans.trans_mat); shader_set_uniform_mat4(debug_shader, "mvp", &mvp); geom_render(geometry, draw_mode); } diff --git a/src/sound.c b/src/sound.c index 32f07ca..4edf2f1 100644 --- a/src/sound.c +++ b/src/sound.c @@ -276,6 +276,7 @@ void sound_source_load_wav(struct Sound_Source* source, const char* file_name) } else { + /* TODO: FIX THIS!!!! This should resemble the if condition */ if(wav_spec.format == AUDIO_U8) format = AL_FORMAT_STEREO8; else if(wav_spec.format == AUDIO_S16) diff --git a/src/variant.c b/src/variant.c index eb10976..0e0d697 100644 --- a/src/variant.c +++ b/src/variant.c @@ -1,5 +1,7 @@ #include "variant.h" #include "log.h" +#include "string_utils.h" + #include void variant_init_empty(struct Variant* variant) @@ -44,6 +46,20 @@ void variant_assign_double(struct Variant* variant, double value) variant->val_double = value; } +void variant_assign_bool(struct Variant* variant, int value) +{ + if(variant->type != VT_BOOL) variant_free(variant); + variant->type = VT_BOOL; + variant->val_int = value; +} + +void variant_assign_str(struct Variant* variant, const char* value) +{ + if(variant->type != VT_STR) variant_free(variant); + variant->type = VT_STR; + variant->val_str = str_new(value); +} + void variant_assign_vec2(struct Variant* variant, vec2* value) { if(variant->type != VT_VEC2) variant_free(variant); @@ -72,27 +88,26 @@ void variant_assign_quat(struct Variant* variant, quat* value) quat_assign(&variant->val_quat, value); } - - - -void variant_free_mat4(struct Variant* variant) +void variant_free(struct Variant* variant) { - if(variant->type == VT_MAT4) + switch(variant->type) { + case VT_MAT4: if(variant->val_voidptr) { free(variant->val_voidptr); variant->val_voidptr = NULL; } - } - else - { - log_error("variant:free_mat4", "Cannot free, variant is not of MAT4 type"); - } -} - -void variant_free(struct Variant* variant) -{ - if(variant->type == VT_MAT4) - variant_free_mat4(variant); + break; + case VT_STR: + if(variant->val_str) + { + free(variant->val_str); + variant->val_str = NULL; + } + break; + default: /* Nothing to be done for the rest*/ + break; + }; + variant->type = VT_NONE; } diff --git a/src/variant.h b/src/variant.h index 4215488..75752ab 100644 --- a/src/variant.h +++ b/src/variant.h @@ -9,6 +9,8 @@ enum Variant_Type VT_INT, VT_FLOAT, VT_DOUBLE, + VT_BOOL, + VT_STR, VT_VEC2, VT_VEC3, VT_VEC4, @@ -26,6 +28,7 @@ struct Variant int val_int; float val_float; double val_double; + char* val_str; vec2 val_vec2; vec3 val_vec3; vec4 val_vec4; @@ -39,6 +42,8 @@ void variant_assign_mat4(struct Variant* variant, const mat4* source); void variant_assign_float(struct Variant* variant, float value); void variant_assign_int(struct Variant* variant, int value); void variant_assign_double(struct Variant* variant, double value); +void variant_assign_bool(struct Variant* variant, int value); +void variant_assign_str(struct Variant* variant, const char* value); void variant_assign_vec2(struct Variant* variant, vec2* value); void variant_assign_vec3(struct Variant* variant, vec3* value); void variant_assign_vec4(struct Variant* variant, vec4* value);