diff --git a/engine/split/v4k_audio.c b/engine/split/v4k_audio.c index c430fa2..71abc45 100644 --- a/engine/split/v4k_audio.c +++ b/engine/split/v4k_audio.c @@ -520,7 +520,7 @@ int audio_queue( const void *samples, int num_samples, int flags ) { if( audio_queue_voice < 0 ) return 0; } - audio_queue_t *aq = MALLOC(sizeof(audio_queue_t) + bytes << (channels == 1)); // dupe space if going to be converted from mono to stereo + audio_queue_t *aq = MALLOC(sizeof(audio_queue_t) + (bytes << (channels == 1))); // dupe space if going to be converted from mono to stereo aq->cursor = 0; aq->avail = bytes; aq->flags = flags; diff --git a/engine/split/v4k_profile.c b/engine/split/v4k_profile.c index 2f1d7e1..5c5142e 100644 --- a/engine/split/v4k_profile.c +++ b/engine/split/v4k_profile.c @@ -19,6 +19,9 @@ void (profile_render)() { if( has_menu ? ui_window("Profiler", 0) : ui_panel("Profiler", 0) ) { + double fps = window_fps(); + profile_setstat("Render.num_fps", fps); + if(1) { // @todo: ui_plot() // draw fps-meter: 300 samples, [0..70] range each, 70px height plot. nk_layout_row_dynamic(ui_ctx, 70, 1); @@ -26,7 +29,7 @@ void (profile_render)() { enum { COUNT = 300 }; static float values[COUNT] = {0}; static int offset = 0; - values[offset=(offset+1)%COUNT] = window_fps(); + values[offset=(offset+1)%COUNT] = fps; int index = -1; if( nk_chart_begin(ui_ctx, NK_CHART_LINES, COUNT, 0.f, 70.f) ) { diff --git a/engine/split/v4k_render.c b/engine/split/v4k_render.c index d7674c9..6f41924 100644 --- a/engine/split/v4k_render.c +++ b/engine/split/v4k_render.c @@ -2359,6 +2359,21 @@ mesh_t mesh() { return z; } +aabb mesh_bounds(mesh_t *m) { + aabb b = {{1e9,1e9,1e9},{-1e9,-1e9,-1e9}}; + for( int i = 0; i < array_count(m->in_vertex3); ++i ) { + if( m->in_vertex3[i].x < b.min.x ) b.min.x = m->in_vertex3[i].x; + if( m->in_vertex3[i].x > b.max.x ) b.max.x = m->in_vertex3[i].x; + + if( m->in_vertex3[i].y < b.min.y ) b.min.y = m->in_vertex3[i].y; + if( m->in_vertex3[i].y > b.max.y ) b.max.y = m->in_vertex3[i].y; + + if( m->in_vertex3[i].z < b.min.z ) b.min.z = m->in_vertex3[i].z; + if( m->in_vertex3[i].z > b.max.z ) b.max.z = m->in_vertex3[i].z; + } + return b; +} + void mesh_update(mesh_t *m, const char *format, int vertex_stride,int vertex_count,const void *vertex_data, int index_count,const void *index_data, int flags) { m->flags = flags; diff --git a/engine/split/v4k_system.c b/engine/split/v4k_system.c index 2a533c7..3d77c19 100644 --- a/engine/split/v4k_system.c +++ b/engine/split/v4k_system.c @@ -862,6 +862,9 @@ int tty_cols() { #endif return 80; } +void tty_detach() { + ifdef(win32, FreeConsole()); +} void tty_attach() { #if is(win32) // in order to have a Windows gui application with console: diff --git a/engine/split/v4k_system.h b/engine/split/v4k_system.h index d668a37..9f3f326 100644 --- a/engine/split/v4k_system.h +++ b/engine/split/v4k_system.h @@ -19,6 +19,7 @@ API float optionf(const char *commalist, float defaults); // app_option? API void tty_color(unsigned color); API void tty_reset(); API void tty_attach(); +API void tty_detach(); API const char* app_exec(const char *command); // returns ("%15d %s", retcode, output_last_line) API int app_cores();