diff --git a/demos/99-material.c b/demos/99-material.c index 429c1c2..f6bdde4 100644 --- a/demos/99-material.c +++ b/demos/99-material.c @@ -1,5 +1,3 @@ -// @todo: object_print(obj, ""); - #include "v4k.h" int main() { @@ -9,7 +7,7 @@ int main() { // create camera camera_t cam = camera(); // load video, RGB texture, no audio - video_t *v = video( "pexels-pachon-in-motion-17486489.mp4", VIDEO_RGB | VIDEO_NO_AUDIO ); video_seek(v, 30); + video_t *v = video( "pexels-pachon-in-motion-17486489.mp4", VIDEO_RGB | VIDEO_NO_AUDIO | VIDEO_LOOP ); video_seek(v, 30); // load texture texture_t t1 = texture("kgirl/g01_texture.png", TEXTURE_RGB); texture_t t2 = texture("matcaps/material3", 0); @@ -45,13 +43,12 @@ int main() { // draw environment viewport_color( RGB3(22,22,32) ); ddraw_grid(0); - ddraw_flush(); // update video video_decode( v ); // draw scene - scene_render(SCENE_FOREGROUND); + scene_render(SCENE_FOREGROUND|SCENE_BACKGROUND); // fps camera bool active = ui_active() || ui_hover() || gizmo_active() ? false : input(MOUSE_L) || input(MOUSE_M) || input(MOUSE_R); diff --git a/demos/99-video.c b/demos/99-video.c index 115f442..9efc475 100644 --- a/demos/99-video.c +++ b/demos/99-video.c @@ -10,7 +10,7 @@ int main() { // load video int is_rgb = flag("--rgb") ? 1 : 0; - video_t *v = video( "pexels-pachon-in-motion-17486489.mp4", is_rgb ? VIDEO_RGB : VIDEO_YCBCR ); + video_t *v = video( "pexels-pachon-in-motion-17486489.mp4", VIDEO_LOOP | (is_rgb ? VIDEO_RGB : VIDEO_YCBCR) ); while( window_swap() ) { // decode video frame and get associated textures (audio is automatically sent to audiomixer) diff --git a/demos/html5/MAKE.bat b/demos/html5/MAKE.bat index 4adbcd2..b3a0f60 100644 --- a/demos/html5/MAKE.bat +++ b/demos/html5/MAKE.bat @@ -1,37 +1,3 @@ -#!/bin/bash 2>nul || goto :windows - -if [ "$1" = "" ]; then - sh MAKE.bat demo_collide.c - exit -fi - -## clone emscripten sdk -git clone https://github.com/emscripten-core/emsdk ../../../../../emsdk -pushd ../../../../../emsdk - ./emsdk install 3.0.0 ## latest - ./emsdk activate 3.0.0 ## latest - source ./emsdk_env.sh -popd - -## cook art -if [ "$(uname)" = "Darwin" ]; then - chmod +x ../../tools/cook.osx - ../../tools/cook.osx --cook-jobs=1 --cook-ini=../../tools/cook.ini - cp .art[00].zip index.data -else - chmod +x ../../tools/cook.linux - ../../tools/cook.linux --cook-jobs=1 --cook-ini=../../tools/cook.ini - cp .art[00].zip index.data -fi - -## host webserver, compile and launch -python -m http.server --bind 127.0.0.1 8000 1> /dev/null 2> /dev/null & -emcc $@ -g ../../engine/v4k.c -I../../engine -o index.html -s FULL_ES3 -s USE_PTHREADS -s USE_GLFW=3 -s SINGLE_FILE=1 -s PRECISE_F32=1 -s TOTAL_MEMORY=256mb -s ENVIRONMENT=worker,web --shell-file template.html -Wfatal-errors --preload-file .art[00].zip -s ALLOW_MEMORY_GROWTH=1 -lidbfs.js && xdg-open http://localhost:8000/index.html - -exit - -:windows - if "%1"=="" MAKE.bat demo_collide.c del index.html 2>NUL >NUL @@ -53,5 +19,5 @@ rem cook art rem host webserver, compile and launch rem start python -m http.server --bind 127.0.0.1 8000 -emcc %* -g ..\..\engine\v4k.c -I..\..\engine -o index.html -pthread -s FULL_ES3 -s USE_PTHREADS -s USE_GLFW=3 -s SINGLE_FILE=1 -s PRECISE_F32=1 -s TOTAL_MEMORY=256mb -s ENVIRONMENT=worker,web --shell-file template.html -Wfatal-errors --preload-file .art[00].zip@index.zip -s ALLOW_MEMORY_GROWTH=1 -lidbfs.js -rem && start "" http://localhost:8000/index.html +call emcc %* -g ..\..\engine\v4k.c -I..\..\engine -o index.html -pthread -s FULL_ES3 -s USE_PTHREADS -s USE_GLFW=3 -s SINGLE_FILE=1 -s PRECISE_F32=1 -s TOTAL_MEMORY=256mb -s ENVIRONMENT=worker,web --shell-file template.html -Wfatal-errors --preload-file .art[00].zip@index.zip -lidbfs.js +rem emrun index.html diff --git a/demos/html5/demo_collide.c b/demos/html5/demo_collide.c index 10d9c5d..8f8d9ab 100644 --- a/demos/html5/demo_collide.c +++ b/demos/html5/demo_collide.c @@ -18,6 +18,9 @@ void game_loop(void *userdata) { // animation static float dx = 0, dy = 0; + static bool draw_skybox = 1; + static bool draw_cols = 1; + if (input_down(KEY_SPACE)) paused ^= 1; float delta = (0.25f / 60.f) * !paused; dx = dx + delta * 2.0f; @@ -69,16 +72,19 @@ void game_loop(void *userdata) { viewport_clip(vec2(0,0), vec2(window_width(), window_height())); #endif - // debug draw collisions - { // 3D glEnable(GL_DEPTH_TEST); - skybox_render(&sky, cam.proj, cam.view); + if (draw_skybox) + skybox_render(&sky, cam.proj, cam.view); // grid ddraw_grid(0); + if (draw_cols) + // debug draw collisions + { + { // Triangle-Ray Intersection*/ vec3 ro, rd; @@ -334,7 +340,7 @@ void game_loop(void *userdata) { } else ddraw_color(WHITE); ddraw_box(vec3(x,y,z), vec3(1,1,1)); - ddraw_sphere(s.c, 1); + ddraw_sphere(s.c, 1); } { // Capsule-Sphere intersection*/ @@ -580,16 +586,11 @@ void game_loop(void *userdata) { //ddraw_flush(); //fx_end(); - // if( ui_panel("Audio", 0) ) { - // if( ui_button("test audio") ) { - // // audio (both clips & streams) - // static audio_t voice; voice = audio_clip("coin.wav"); // "pew.sfxr" - // static audio_t stream; stream = audio_stream("wrath_of_the_djinn.xm"); // "larry.mid" - // audio_play(voice, 0); - // audio_play(stream, 0); - // } - // ui_panel_end(); - // } + if( ui_panel("Vis", 0) ) { + ui_bool("Skybox render", &draw_skybox); + ui_bool("Collisions render", &draw_cols); + ui_panel_end(); + } // if( ui_panel("FX", 0) ) { // for( int i = 0; i < 64; ++i ) { @@ -604,7 +605,7 @@ void game_loop(void *userdata) { int main(void) { // 75% sized, msaa x4 enabled - window_create(0.75f, WINDOW_MSAA4/*|WINDOW_FIXED*/); + window_create(1, 0); window_title( "V4K - SPACE pauses simulation" ); // fx_load("fx**.fs"); diff --git a/demos/html5/template.html b/demos/html5/template.html index 8cffb80..2202476 100644 --- a/demos/html5/template.html +++ b/demos/html5/template.html @@ -157,7 +157,5 @@ // document.addEventListener('MSFullscreenChange', exitFullscreen, false); // document.addEventListener('webkitfullscreenchange', exitFullscreen, false); - - diff --git a/demos/ports/doom/MAKE.bat b/demos/ports/doom/MAKE.bat index 2821efd..b89b887 100644 --- a/demos/ports/doom/MAKE.bat +++ b/demos/ports/doom/MAKE.bat @@ -1,9 +1,7 @@ -cl game.c PureDOOM.c -I ..\..\..\engine ..\..\..\engine\v4k.c ^ +..\..\..\tools\tcc game.c PureDOOM.c -I ..\..\..\engine ..\..\..\engine\v4k.c ^ -DWIN32 ^ - %* ^ - /link /SUBSYSTEM:WINDOWS /entry:mainCRTStartup + %* del *.obj del *.exp del *.lib -del *.pdb diff --git a/engine/art/fonts/B612-Bold.ttf b/engine/art/fonts/B612-Bold.ttf new file mode 100644 index 0000000..0f9ed6c Binary files /dev/null and b/engine/art/fonts/B612-Bold.ttf differ diff --git a/engine/art/fonts/B612-BoldItalic.ttf b/engine/art/fonts/B612-BoldItalic.ttf new file mode 100644 index 0000000..27e5d13 Binary files /dev/null and b/engine/art/fonts/B612-BoldItalic.ttf differ diff --git a/engine/art/fonts/B612-Italic.ttf b/engine/art/fonts/B612-Italic.ttf new file mode 100644 index 0000000..497253d Binary files /dev/null and b/engine/art/fonts/B612-Italic.ttf differ diff --git a/engine/art/fonts/B612-Regular.ttf b/engine/art/fonts/B612-Regular.ttf new file mode 100644 index 0000000..0574897 Binary files /dev/null and b/engine/art/fonts/B612-Regular.ttf differ diff --git a/engine/art/fonts/B612.license b/engine/art/fonts/B612.license new file mode 100644 index 0000000..3d44517 --- /dev/null +++ b/engine/art/fonts/B612.license @@ -0,0 +1,93 @@ +Copyright 2012 The B612 Project Authors (https://github.com/polarsys/b612) + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/engine/art/fonts/B612Mono-Bold.ttf b/engine/art/fonts/B612Mono-Bold.ttf new file mode 100644 index 0000000..1072d40 Binary files /dev/null and b/engine/art/fonts/B612Mono-Bold.ttf differ diff --git a/engine/art/fonts/B612Mono-BoldItalic.ttf b/engine/art/fonts/B612Mono-BoldItalic.ttf new file mode 100644 index 0000000..b8fd7ac Binary files /dev/null and b/engine/art/fonts/B612Mono-BoldItalic.ttf differ diff --git a/engine/art/fonts/B612Mono-Italic.ttf b/engine/art/fonts/B612Mono-Italic.ttf new file mode 100644 index 0000000..0473409 Binary files /dev/null and b/engine/art/fonts/B612Mono-Italic.ttf differ diff --git a/engine/art/fonts/B612Mono-Regular.ttf b/engine/art/fonts/B612Mono-Regular.ttf new file mode 100644 index 0000000..32bbdee Binary files /dev/null and b/engine/art/fonts/B612Mono-Regular.ttf differ diff --git a/engine/art/fonts/Carlito-BoldItalic.license b/engine/art/fonts/Carlito-BoldItalic.license deleted file mode 100644 index e999b31..0000000 --- a/engine/art/fonts/Carlito-BoldItalic.license +++ /dev/null @@ -1,95 +0,0 @@ -Copyright (c) 2010-2013 by tyPoland Lukasz Dziedzic with Reserved Font Name "Carlito". - -This Font Software is licensed under the SIL Open Font License, -Version 1.1 as shown below. - -SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 - -PREAMBLE The goals of the Open Font License (OFL) are to stimulate -worldwide development of collaborative font projects, to support the font -creation efforts of academic and linguistic communities, and to provide -a free and open framework in which fonts may be shared and improved in -partnership with others. - -The OFL allows the licensed fonts to be used, studied, modified and -redistributed freely as long as they are not sold by themselves. -The fonts, including any derivative works, can be bundled, embedded, -redistributed and/or sold with any software provided that any reserved -names are not used by derivative works. The fonts and derivatives, -however, cannot be released under any other type of license. The -requirement for fonts to remain under this license does not apply to -any document created using the fonts or their derivatives. - - -DEFINITIONS -"Font Software" refers to the set of files released by the Copyright -Holder(s) under this license and clearly marked as such. -This may include source files, build scripts and documentation. - -"Reserved Font Name" refers to any names specified as such after the -copyright statement(s). - -"Original Version" refers to the collection of Font Software components -as distributed by the Copyright Holder(s). - -"Modified Version" refers to any derivative made by adding to, deleting, -or substituting ? in part or in whole ? -any of the components of the Original Version, by changing formats or -by porting the Font Software to a new environment. - -"Author" refers to any designer, engineer, programmer, technical writer -or other person who contributed to the Font Software. - - -PERMISSION & CONDITIONS - -Permission is hereby granted, free of charge, to any person obtaining a -copy of the Font Software, to use, study, copy, merge, embed, modify, -redistribute, and sell modified and unmodified copies of the Font -Software, subject to the following conditions: - -1) Neither the Font Software nor any of its individual components,in - Original or Modified Versions, may be sold by itself. - -2) Original or Modified Versions of the Font Software may be bundled, - redistributed and/or sold with any software, provided that each copy - contains the above copyright notice and this license. These can be - included either as stand-alone text files, human-readable headers or - in the appropriate machine-readable metadata fields within text or - binary files as long as those fields can be easily viewed by the user. - -3) No Modified Version of the Font Software may use the Reserved Font - Name(s) unless explicit written permission is granted by the - corresponding Copyright Holder. This restriction only applies to the - primary font name as presented to the users. - -4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font - Software shall not be used to promote, endorse or advertise any - Modified Version, except to acknowledge the contribution(s) of the - Copyright Holder(s) and the Author(s) or with their explicit written - permission. - -5) The Font Software, modified or unmodified, in part or in whole, must - be distributed entirely under this license, and must not be distributed - under any other license. The requirement for fonts to remain under - this license does not apply to any document created using the Font - Software. - - - -TERMINATION -This license becomes null and void if any of the above conditions are not met. - - - -DISCLAIMER -THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT -OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE -COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL -DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER -DEALINGS IN THE FONT SOFTWARE. - diff --git a/engine/art/fonts/Carlito-BoldItalic.ttf b/engine/art/fonts/Carlito-BoldItalic.ttf deleted file mode 100644 index 0eaa04e..0000000 Binary files a/engine/art/fonts/Carlito-BoldItalic.ttf and /dev/null differ diff --git a/engine/art/fonts/Carlito-Regular.license b/engine/art/fonts/Carlito-Regular.license deleted file mode 100644 index e999b31..0000000 --- a/engine/art/fonts/Carlito-Regular.license +++ /dev/null @@ -1,95 +0,0 @@ -Copyright (c) 2010-2013 by tyPoland Lukasz Dziedzic with Reserved Font Name "Carlito". - -This Font Software is licensed under the SIL Open Font License, -Version 1.1 as shown below. - -SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 - -PREAMBLE The goals of the Open Font License (OFL) are to stimulate -worldwide development of collaborative font projects, to support the font -creation efforts of academic and linguistic communities, and to provide -a free and open framework in which fonts may be shared and improved in -partnership with others. - -The OFL allows the licensed fonts to be used, studied, modified and -redistributed freely as long as they are not sold by themselves. -The fonts, including any derivative works, can be bundled, embedded, -redistributed and/or sold with any software provided that any reserved -names are not used by derivative works. The fonts and derivatives, -however, cannot be released under any other type of license. The -requirement for fonts to remain under this license does not apply to -any document created using the fonts or their derivatives. - - -DEFINITIONS -"Font Software" refers to the set of files released by the Copyright -Holder(s) under this license and clearly marked as such. -This may include source files, build scripts and documentation. - -"Reserved Font Name" refers to any names specified as such after the -copyright statement(s). - -"Original Version" refers to the collection of Font Software components -as distributed by the Copyright Holder(s). - -"Modified Version" refers to any derivative made by adding to, deleting, -or substituting ? in part or in whole ? -any of the components of the Original Version, by changing formats or -by porting the Font Software to a new environment. - -"Author" refers to any designer, engineer, programmer, technical writer -or other person who contributed to the Font Software. - - -PERMISSION & CONDITIONS - -Permission is hereby granted, free of charge, to any person obtaining a -copy of the Font Software, to use, study, copy, merge, embed, modify, -redistribute, and sell modified and unmodified copies of the Font -Software, subject to the following conditions: - -1) Neither the Font Software nor any of its individual components,in - Original or Modified Versions, may be sold by itself. - -2) Original or Modified Versions of the Font Software may be bundled, - redistributed and/or sold with any software, provided that each copy - contains the above copyright notice and this license. These can be - included either as stand-alone text files, human-readable headers or - in the appropriate machine-readable metadata fields within text or - binary files as long as those fields can be easily viewed by the user. - -3) No Modified Version of the Font Software may use the Reserved Font - Name(s) unless explicit written permission is granted by the - corresponding Copyright Holder. This restriction only applies to the - primary font name as presented to the users. - -4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font - Software shall not be used to promote, endorse or advertise any - Modified Version, except to acknowledge the contribution(s) of the - Copyright Holder(s) and the Author(s) or with their explicit written - permission. - -5) The Font Software, modified or unmodified, in part or in whole, must - be distributed entirely under this license, and must not be distributed - under any other license. The requirement for fonts to remain under - this license does not apply to any document created using the Font - Software. - - - -TERMINATION -This license becomes null and void if any of the above conditions are not met. - - - -DISCLAIMER -THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT -OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE -COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL -DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER -DEALINGS IN THE FONT SOFTWARE. - diff --git a/engine/art/fonts/Carlito-Regular.ttf b/engine/art/fonts/Carlito-Regular.ttf deleted file mode 100644 index 6b7e0e3..0000000 Binary files a/engine/art/fonts/Carlito-Regular.ttf and /dev/null differ diff --git a/engine/bind/v4k.lua b/engine/bind/v4k.lua index 5c24e37..d2fb673 100644 --- a/engine/bind/v4k.lua +++ b/engine/bind/v4k.lua @@ -2852,9 +2852,10 @@ PANEL_OPEN = 1, int ui_demo(int do_windows); enum VIDEO_FLAGS { VIDEO_YCBCR = 0, -VIDEO_RGB = 1, +VIDEO_RGB = 2, VIDEO_AUDIO = 0, -VIDEO_NO_AUDIO = 2, +VIDEO_NO_AUDIO = 4, +VIDEO_LOOP = 8, }; typedef struct video_t video_t; video_t* video( const char *filename, int flags ); diff --git a/engine/joint/v4k.h b/engine/joint/v4k.h index e0f57f0..47fe034 100644 --- a/engine/joint/v4k.h +++ b/engine/joint/v4k.h @@ -17457,10 +17457,12 @@ API int ui_demo(int do_windows); enum VIDEO_FLAGS { VIDEO_YCBCR = 0, - VIDEO_RGB = 1, + VIDEO_RGB = 2, VIDEO_AUDIO = 0, - VIDEO_NO_AUDIO = 2, + VIDEO_NO_AUDIO = 4, + + VIDEO_LOOP = 8, }; typedef struct video_t video_t; @@ -344771,6 +344773,9 @@ camera_t camera() { cam.up = vec3(0,1,0); cam.fov = 45; + // update proj & view + camera_lookat(&cam,vec3(-5,0,-5)); + // @todo: remove this hack static int smoothing = -1; if( smoothing < 0 ) smoothing = flag("--camera-smooth"); if( smoothing ) { @@ -344780,9 +344785,6 @@ camera_t camera() { } } - // update proj & view - camera_lookat(&cam,vec3(-5,0,-5)); - last_camera = old; *camera_get_active() = cam; return cam; @@ -346427,6 +346429,13 @@ void thread_destroy( void *thd ) { //#define UI_ICONS_SMALL 1 #endif +#define UI_FONT_ENUM(carlito,b612) b612 // carlito + +#define UI_FONT_ICONS "MaterialIconsSharp-Regular.otf" // "MaterialIconsOutlined-Regular.otf" "MaterialIcons-Regular.ttf" // +#define UI_FONT_REGULAR UI_FONT_ENUM("Carlito", "B612") "-Regular.ttf" +#define UI_FONT_HEADING UI_FONT_ENUM("Carlito", "B612") "-BoldItalic.ttf" +#define UI_FONT_TERMINAL UI_FONT_ENUM("Inconsolata", "B612Mono") "-Regular.ttf" + #if UI_LESSER_SPACING enum { UI_SEPARATOR_HEIGHT = 5, UI_MENUBAR_ICON_HEIGHT = 20, UI_ROW_HEIGHT = 22, UI_MENUROW_HEIGHT = 32 }; #else @@ -346434,24 +346443,27 @@ void thread_destroy( void *thd ) { #endif #if UI_FONT_LARGE - #define UI_FONT_REGULAR_SIZE 18 - #define UI_FONT_BOLD_SIZE 20 + #define UI_FONT_REGULAR_SIZE UI_FONT_ENUM(18,17) + #define UI_FONT_HEADING_SIZE UI_FONT_ENUM(20,19) + #define UI_FONT_TERMINAL_SIZE UI_FONT_ENUM(14,14) #elif UI_FONT_SMALL - #define UI_FONT_REGULAR_SIZE 13 - #define UI_FONT_BOLD_SIZE 14.5f + #define UI_FONT_REGULAR_SIZE UI_FONT_ENUM(13,14) + #define UI_FONT_HEADING_SIZE UI_FONT_ENUM(14.5,15) + #define UI_FONT_TERMINAL_SIZE UI_FONT_ENUM(14,14) #else - #define UI_FONT_REGULAR_SIZE 14.5f - #define UI_FONT_BOLD_SIZE 16.0f + #define UI_FONT_REGULAR_SIZE UI_FONT_ENUM(14.5,15.5) + #define UI_FONT_HEADING_SIZE UI_FONT_ENUM(16,17) + #define UI_FONT_TERMINAL_SIZE UI_FONT_ENUM(14,14) #endif #if UI_ICONS_SMALL - #define UI_ICON_FONTSIZE 16.5f - #define UI_ICON_SPACING_X -2 - #define UI_ICON_SPACING_Y 4.5f + #define UI_ICON_FONTSIZE UI_FONT_ENUM(16.5f,16.5f) + #define UI_ICON_SPACING_X UI_FONT_ENUM(-2,-2) + #define UI_ICON_SPACING_Y UI_FONT_ENUM(4.5f,3.5f) #else - #define UI_ICON_FONTSIZE 20 - #define UI_ICON_SPACING_X 0 - #define UI_ICON_SPACING_Y 6.5f + #define UI_ICON_FONTSIZE UI_FONT_ENUM(20,20) + #define UI_ICON_SPACING_X UI_FONT_ENUM(0,0) + #define UI_ICON_SPACING_Y UI_FONT_ENUM(6.5f,4.5f) #endif #define MAX_VERTEX_MEMORY 512 * 1024 @@ -346469,8 +346481,6 @@ static void nk_config_custom_fonts() { #define UI_ICON_MED ICON_MAX_16_MD #define UI_ICON_MAX ICON_MAX_MD - #define UI_ICON_FONTNAME "MaterialIconsSharp-Regular.otf" // "MaterialIconsOutlined-Regular.otf" "MaterialIcons-Regular.ttf" // - #define ICON_BARS ICON_MD_MENU #define ICON_FILE ICON_MD_INSERT_DRIVE_FILE #define ICON_TRASH ICON_MD_DELETE @@ -346481,19 +346491,19 @@ static void nk_config_custom_fonts() { // Default font(#1)... - for( char *data = vfs_read("Carlito-Regular.ttf"); data; data = 0 ) { + for( char *data = vfs_read(UI_FONT_REGULAR); data; data = 0 ) { float font_size = UI_FONT_REGULAR_SIZE; struct nk_font_config cfg = nk_font_config(font_size); cfg.oversample_v = 2; cfg.pixel_snap = 0; // win32: struct nk_font *arial = nk_font_atlas_add_from_file(atlas, va("%s/fonts/arial.ttf",getenv("windir")), font_size, &cfg); font = arial ? arial : font; // struct nk_font *droid = nk_font_atlas_add_from_file(atlas, "nuklear/extra_font/DroidSans.ttf", font_size, &cfg); font = droid ? droid : font; - struct nk_font *regular = nk_font_atlas_add_from_memory(atlas, data, vfs_size("Carlito-Regular.ttf"), font_size, &cfg); font = regular ? regular : font; + struct nk_font *regular = nk_font_atlas_add_from_memory(atlas, data, vfs_size(UI_FONT_REGULAR), font_size, &cfg); font = regular ? regular : font; } // ...with icons embedded on it. - for( char *data = vfs_read(UI_ICON_FONTNAME); data; data = 0 ) { + for( char *data = vfs_read(UI_FONT_ICONS); data; data = 0 ) { static const nk_rune icon_range[] = {UI_ICON_MIN, UI_ICON_MED /*MAX*/, 0}; struct nk_font_config cfg = nk_font_config(UI_ICON_FONTSIZE); @@ -346509,30 +346519,30 @@ static void nk_config_custom_fonts() { cfg.oversample_v = 1; cfg.pixel_snap = 1; - struct nk_font *icons = nk_font_atlas_add_from_memory(atlas, data, vfs_size(UI_ICON_FONTNAME), UI_ICON_FONTSIZE, &cfg); + struct nk_font *icons = nk_font_atlas_add_from_memory(atlas, data, vfs_size(UI_FONT_ICONS), UI_ICON_FONTSIZE, &cfg); } // Monospaced font. Used in terminals or consoles. - for( char *data = vfs_read("Inconsolata-Regular.ttf"); data; data = 0 ) { - const float fontsize = 14.f; // 18.f; + for( char *data = vfs_read(UI_FONT_TERMINAL); data; data = 0 ) { + const float font_size = UI_FONT_REGULAR_SIZE; static const nk_rune icon_range[] = {32, 127, 0}; - struct nk_font_config cfg = nk_font_config(fontsize); + struct nk_font_config cfg = nk_font_config(font_size); cfg.range = icon_range; cfg.oversample_h = 1; cfg.oversample_v = 1; cfg.pixel_snap = 1; - // struct nk_font *proggy = nk_font_atlas_add_default(atlas, fontsize, &cfg); - struct nk_font *bold = nk_font_atlas_add_from_memory(atlas, data, vfs_size("Inconsolata-Regular.ttf"), fontsize, &cfg); + // struct nk_font *proggy = nk_font_atlas_add_default(atlas, font_size, &cfg); + struct nk_font *bold = nk_font_atlas_add_from_memory(atlas, data, vfs_size(UI_FONT_TERMINAL), font_size, &cfg); } // Extra optional fonts from here... - for( char *data = vfs_read("Carlito-BoldItalic.ttf"); data; data = 0 ) { - struct nk_font *bold = nk_font_atlas_add_from_memory(atlas, data, vfs_size("Carlito-BoldItalic.ttf"), UI_FONT_BOLD_SIZE, 0); // font = bold ? bold : font; + for( char *data = vfs_read(UI_FONT_HEADING); data; data = 0 ) { + struct nk_font *bold = nk_font_atlas_add_from_memory(atlas, data, vfs_size(UI_FONT_HEADING), UI_FONT_HEADING_SIZE, 0); // font = bold ? bold : font; } nk_glfw3_font_stash_end(&nk_glfw); // nk_sdl_font_stash_end(); @@ -348940,7 +348950,7 @@ video_t* video( const char *filename, int flags ) { v->has_audio = flags & VIDEO_NO_AUDIO ? 0 : 1; - plm_set_loop(plm, false); + plm_set_loop(plm, flags & VIDEO_LOOP); plm_set_video_decode_callback(plm, mpeg_video_callback, v); if( v->has_audio ) { plm_set_audio_enabled(plm, true); @@ -349265,6 +349275,9 @@ void window_hints(unsigned flags) { glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); // osx glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2); // osx, 2:#version150,3:330 #else + // Compute shaders need 4.5 otherwise. But... + // According to the GLFW docs, the context version hint acts as a minimum version. + // i.e, the context you actually get may be a higher or highest version (which is usually the case) glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2); #endif diff --git a/engine/split/v4k_scene.c b/engine/split/v4k_scene.c index d19ab63..b053a87 100644 --- a/engine/split/v4k_scene.c +++ b/engine/split/v4k_scene.c @@ -13,6 +13,9 @@ camera_t camera() { cam.up = vec3(0,1,0); cam.fov = 45; + // update proj & view + camera_lookat(&cam,vec3(-5,0,-5)); + // @todo: remove this hack static int smoothing = -1; if( smoothing < 0 ) smoothing = flag("--camera-smooth"); if( smoothing ) { @@ -22,9 +25,6 @@ camera_t camera() { } } - // update proj & view - camera_lookat(&cam,vec3(-5,0,-5)); - last_camera = old; *camera_get_active() = cam; return cam; diff --git a/engine/split/v4k_ui.c b/engine/split/v4k_ui.c index 35085f6..39f562f 100644 --- a/engine/split/v4k_ui.c +++ b/engine/split/v4k_ui.c @@ -3,6 +3,13 @@ //#define UI_ICONS_SMALL 1 #endif +#define UI_FONT_ENUM(carlito,b612) b612 // carlito + +#define UI_FONT_ICONS "MaterialIconsSharp-Regular.otf" // "MaterialIconsOutlined-Regular.otf" "MaterialIcons-Regular.ttf" // +#define UI_FONT_REGULAR UI_FONT_ENUM("Carlito", "B612") "-Regular.ttf" +#define UI_FONT_HEADING UI_FONT_ENUM("Carlito", "B612") "-BoldItalic.ttf" +#define UI_FONT_TERMINAL UI_FONT_ENUM("Inconsolata", "B612Mono") "-Regular.ttf" + #if UI_LESSER_SPACING enum { UI_SEPARATOR_HEIGHT = 5, UI_MENUBAR_ICON_HEIGHT = 20, UI_ROW_HEIGHT = 22, UI_MENUROW_HEIGHT = 32 }; #else @@ -10,24 +17,27 @@ #endif #if UI_FONT_LARGE - #define UI_FONT_REGULAR_SIZE 18 - #define UI_FONT_BOLD_SIZE 20 + #define UI_FONT_REGULAR_SIZE UI_FONT_ENUM(18,17) + #define UI_FONT_HEADING_SIZE UI_FONT_ENUM(20,19) + #define UI_FONT_TERMINAL_SIZE UI_FONT_ENUM(14,14) #elif UI_FONT_SMALL - #define UI_FONT_REGULAR_SIZE 13 - #define UI_FONT_BOLD_SIZE 14.5f + #define UI_FONT_REGULAR_SIZE UI_FONT_ENUM(13,14) + #define UI_FONT_HEADING_SIZE UI_FONT_ENUM(14.5,15) + #define UI_FONT_TERMINAL_SIZE UI_FONT_ENUM(14,14) #else - #define UI_FONT_REGULAR_SIZE 14.5f - #define UI_FONT_BOLD_SIZE 16.0f + #define UI_FONT_REGULAR_SIZE UI_FONT_ENUM(14.5,15.5) + #define UI_FONT_HEADING_SIZE UI_FONT_ENUM(16,17) + #define UI_FONT_TERMINAL_SIZE UI_FONT_ENUM(14,14) #endif #if UI_ICONS_SMALL - #define UI_ICON_FONTSIZE 16.5f - #define UI_ICON_SPACING_X -2 - #define UI_ICON_SPACING_Y 4.5f + #define UI_ICON_FONTSIZE UI_FONT_ENUM(16.5f,16.5f) + #define UI_ICON_SPACING_X UI_FONT_ENUM(-2,-2) + #define UI_ICON_SPACING_Y UI_FONT_ENUM(4.5f,3.5f) #else - #define UI_ICON_FONTSIZE 20 - #define UI_ICON_SPACING_X 0 - #define UI_ICON_SPACING_Y 6.5f + #define UI_ICON_FONTSIZE UI_FONT_ENUM(20,20) + #define UI_ICON_SPACING_X UI_FONT_ENUM(0,0) + #define UI_ICON_SPACING_Y UI_FONT_ENUM(6.5f,4.5f) #endif #define MAX_VERTEX_MEMORY 512 * 1024 @@ -45,8 +55,6 @@ static void nk_config_custom_fonts() { #define UI_ICON_MED ICON_MAX_16_MD #define UI_ICON_MAX ICON_MAX_MD - #define UI_ICON_FONTNAME "MaterialIconsSharp-Regular.otf" // "MaterialIconsOutlined-Regular.otf" "MaterialIcons-Regular.ttf" // - #define ICON_BARS ICON_MD_MENU #define ICON_FILE ICON_MD_INSERT_DRIVE_FILE #define ICON_TRASH ICON_MD_DELETE @@ -57,19 +65,19 @@ static void nk_config_custom_fonts() { // Default font(#1)... - for( char *data = vfs_read("Carlito-Regular.ttf"); data; data = 0 ) { + for( char *data = vfs_read(UI_FONT_REGULAR); data; data = 0 ) { float font_size = UI_FONT_REGULAR_SIZE; struct nk_font_config cfg = nk_font_config(font_size); cfg.oversample_v = 2; cfg.pixel_snap = 0; // win32: struct nk_font *arial = nk_font_atlas_add_from_file(atlas, va("%s/fonts/arial.ttf",getenv("windir")), font_size, &cfg); font = arial ? arial : font; // struct nk_font *droid = nk_font_atlas_add_from_file(atlas, "nuklear/extra_font/DroidSans.ttf", font_size, &cfg); font = droid ? droid : font; - struct nk_font *regular = nk_font_atlas_add_from_memory(atlas, data, vfs_size("Carlito-Regular.ttf"), font_size, &cfg); font = regular ? regular : font; + struct nk_font *regular = nk_font_atlas_add_from_memory(atlas, data, vfs_size(UI_FONT_REGULAR), font_size, &cfg); font = regular ? regular : font; } // ...with icons embedded on it. - for( char *data = vfs_read(UI_ICON_FONTNAME); data; data = 0 ) { + for( char *data = vfs_read(UI_FONT_ICONS); data; data = 0 ) { static const nk_rune icon_range[] = {UI_ICON_MIN, UI_ICON_MED /*MAX*/, 0}; struct nk_font_config cfg = nk_font_config(UI_ICON_FONTSIZE); @@ -85,30 +93,30 @@ static void nk_config_custom_fonts() { cfg.oversample_v = 1; cfg.pixel_snap = 1; - struct nk_font *icons = nk_font_atlas_add_from_memory(atlas, data, vfs_size(UI_ICON_FONTNAME), UI_ICON_FONTSIZE, &cfg); + struct nk_font *icons = nk_font_atlas_add_from_memory(atlas, data, vfs_size(UI_FONT_ICONS), UI_ICON_FONTSIZE, &cfg); } // Monospaced font. Used in terminals or consoles. - for( char *data = vfs_read("Inconsolata-Regular.ttf"); data; data = 0 ) { - const float fontsize = 14.f; // 18.f; + for( char *data = vfs_read(UI_FONT_TERMINAL); data; data = 0 ) { + const float font_size = UI_FONT_REGULAR_SIZE; static const nk_rune icon_range[] = {32, 127, 0}; - struct nk_font_config cfg = nk_font_config(fontsize); + struct nk_font_config cfg = nk_font_config(font_size); cfg.range = icon_range; cfg.oversample_h = 1; cfg.oversample_v = 1; cfg.pixel_snap = 1; - // struct nk_font *proggy = nk_font_atlas_add_default(atlas, fontsize, &cfg); - struct nk_font *bold = nk_font_atlas_add_from_memory(atlas, data, vfs_size("Inconsolata-Regular.ttf"), fontsize, &cfg); + // struct nk_font *proggy = nk_font_atlas_add_default(atlas, font_size, &cfg); + struct nk_font *bold = nk_font_atlas_add_from_memory(atlas, data, vfs_size(UI_FONT_TERMINAL), font_size, &cfg); } // Extra optional fonts from here... - for( char *data = vfs_read("Carlito-BoldItalic.ttf"); data; data = 0 ) { - struct nk_font *bold = nk_font_atlas_add_from_memory(atlas, data, vfs_size("Carlito-BoldItalic.ttf"), UI_FONT_BOLD_SIZE, 0); // font = bold ? bold : font; + for( char *data = vfs_read(UI_FONT_HEADING); data; data = 0 ) { + struct nk_font *bold = nk_font_atlas_add_from_memory(atlas, data, vfs_size(UI_FONT_HEADING), UI_FONT_HEADING_SIZE, 0); // font = bold ? bold : font; } nk_glfw3_font_stash_end(&nk_glfw); // nk_sdl_font_stash_end(); diff --git a/engine/split/v4k_video.c b/engine/split/v4k_video.c index 51bd39d..743ea87 100644 --- a/engine/split/v4k_video.c +++ b/engine/split/v4k_video.c @@ -82,7 +82,7 @@ video_t* video( const char *filename, int flags ) { v->has_audio = flags & VIDEO_NO_AUDIO ? 0 : 1; - plm_set_loop(plm, false); + plm_set_loop(plm, flags & VIDEO_LOOP); plm_set_video_decode_callback(plm, mpeg_video_callback, v); if( v->has_audio ) { plm_set_audio_enabled(plm, true); diff --git a/engine/split/v4k_video.h b/engine/split/v4k_video.h index 4fc68c2..fade524 100644 --- a/engine/split/v4k_video.h +++ b/engine/split/v4k_video.h @@ -7,10 +7,12 @@ enum VIDEO_FLAGS { VIDEO_YCBCR = 0, - VIDEO_RGB = 1, + VIDEO_RGB = 2, VIDEO_AUDIO = 0, - VIDEO_NO_AUDIO = 2, + VIDEO_NO_AUDIO = 4, + + VIDEO_LOOP = 8, }; typedef struct video_t video_t; diff --git a/engine/split/v4k_window.c b/engine/split/v4k_window.c index 08ba120..1a6f2b1 100644 --- a/engine/split/v4k_window.c +++ b/engine/split/v4k_window.c @@ -175,6 +175,9 @@ void window_hints(unsigned flags) { glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); // osx glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2); // osx, 2:#version150,3:330 #else + // Compute shaders need 4.5 otherwise. But... + // According to the GLFW docs, the context version hint acts as a minimum version. + // i.e, the context you actually get may be a higher or highest version (which is usually the case) glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2); #endif diff --git a/engine/v4k.c b/engine/v4k.c index 70a8194..b711358 100644 --- a/engine/v4k.c +++ b/engine/v4k.c @@ -15482,6 +15482,9 @@ camera_t camera() { cam.up = vec3(0,1,0); cam.fov = 45; + // update proj & view + camera_lookat(&cam,vec3(-5,0,-5)); + // @todo: remove this hack static int smoothing = -1; if( smoothing < 0 ) smoothing = flag("--camera-smooth"); if( smoothing ) { @@ -15491,9 +15494,6 @@ camera_t camera() { } } - // update proj & view - camera_lookat(&cam,vec3(-5,0,-5)); - last_camera = old; *camera_get_active() = cam; return cam; @@ -17138,6 +17138,13 @@ void thread_destroy( void *thd ) { //#define UI_ICONS_SMALL 1 #endif +#define UI_FONT_ENUM(carlito,b612) b612 // carlito + +#define UI_FONT_ICONS "MaterialIconsSharp-Regular.otf" // "MaterialIconsOutlined-Regular.otf" "MaterialIcons-Regular.ttf" // +#define UI_FONT_REGULAR UI_FONT_ENUM("Carlito", "B612") "-Regular.ttf" +#define UI_FONT_HEADING UI_FONT_ENUM("Carlito", "B612") "-BoldItalic.ttf" +#define UI_FONT_TERMINAL UI_FONT_ENUM("Inconsolata", "B612Mono") "-Regular.ttf" + #if UI_LESSER_SPACING enum { UI_SEPARATOR_HEIGHT = 5, UI_MENUBAR_ICON_HEIGHT = 20, UI_ROW_HEIGHT = 22, UI_MENUROW_HEIGHT = 32 }; #else @@ -17145,24 +17152,27 @@ void thread_destroy( void *thd ) { #endif #if UI_FONT_LARGE - #define UI_FONT_REGULAR_SIZE 18 - #define UI_FONT_BOLD_SIZE 20 + #define UI_FONT_REGULAR_SIZE UI_FONT_ENUM(18,17) + #define UI_FONT_HEADING_SIZE UI_FONT_ENUM(20,19) + #define UI_FONT_TERMINAL_SIZE UI_FONT_ENUM(14,14) #elif UI_FONT_SMALL - #define UI_FONT_REGULAR_SIZE 13 - #define UI_FONT_BOLD_SIZE 14.5f + #define UI_FONT_REGULAR_SIZE UI_FONT_ENUM(13,14) + #define UI_FONT_HEADING_SIZE UI_FONT_ENUM(14.5,15) + #define UI_FONT_TERMINAL_SIZE UI_FONT_ENUM(14,14) #else - #define UI_FONT_REGULAR_SIZE 14.5f - #define UI_FONT_BOLD_SIZE 16.0f + #define UI_FONT_REGULAR_SIZE UI_FONT_ENUM(14.5,15.5) + #define UI_FONT_HEADING_SIZE UI_FONT_ENUM(16,17) + #define UI_FONT_TERMINAL_SIZE UI_FONT_ENUM(14,14) #endif #if UI_ICONS_SMALL - #define UI_ICON_FONTSIZE 16.5f - #define UI_ICON_SPACING_X -2 - #define UI_ICON_SPACING_Y 4.5f + #define UI_ICON_FONTSIZE UI_FONT_ENUM(16.5f,16.5f) + #define UI_ICON_SPACING_X UI_FONT_ENUM(-2,-2) + #define UI_ICON_SPACING_Y UI_FONT_ENUM(4.5f,3.5f) #else - #define UI_ICON_FONTSIZE 20 - #define UI_ICON_SPACING_X 0 - #define UI_ICON_SPACING_Y 6.5f + #define UI_ICON_FONTSIZE UI_FONT_ENUM(20,20) + #define UI_ICON_SPACING_X UI_FONT_ENUM(0,0) + #define UI_ICON_SPACING_Y UI_FONT_ENUM(6.5f,4.5f) #endif #define MAX_VERTEX_MEMORY 512 * 1024 @@ -17180,8 +17190,6 @@ static void nk_config_custom_fonts() { #define UI_ICON_MED ICON_MAX_16_MD #define UI_ICON_MAX ICON_MAX_MD - #define UI_ICON_FONTNAME "MaterialIconsSharp-Regular.otf" // "MaterialIconsOutlined-Regular.otf" "MaterialIcons-Regular.ttf" // - #define ICON_BARS ICON_MD_MENU #define ICON_FILE ICON_MD_INSERT_DRIVE_FILE #define ICON_TRASH ICON_MD_DELETE @@ -17192,19 +17200,19 @@ static void nk_config_custom_fonts() { // Default font(#1)... - for( char *data = vfs_read("Carlito-Regular.ttf"); data; data = 0 ) { + for( char *data = vfs_read(UI_FONT_REGULAR); data; data = 0 ) { float font_size = UI_FONT_REGULAR_SIZE; struct nk_font_config cfg = nk_font_config(font_size); cfg.oversample_v = 2; cfg.pixel_snap = 0; // win32: struct nk_font *arial = nk_font_atlas_add_from_file(atlas, va("%s/fonts/arial.ttf",getenv("windir")), font_size, &cfg); font = arial ? arial : font; // struct nk_font *droid = nk_font_atlas_add_from_file(atlas, "nuklear/extra_font/DroidSans.ttf", font_size, &cfg); font = droid ? droid : font; - struct nk_font *regular = nk_font_atlas_add_from_memory(atlas, data, vfs_size("Carlito-Regular.ttf"), font_size, &cfg); font = regular ? regular : font; + struct nk_font *regular = nk_font_atlas_add_from_memory(atlas, data, vfs_size(UI_FONT_REGULAR), font_size, &cfg); font = regular ? regular : font; } // ...with icons embedded on it. - for( char *data = vfs_read(UI_ICON_FONTNAME); data; data = 0 ) { + for( char *data = vfs_read(UI_FONT_ICONS); data; data = 0 ) { static const nk_rune icon_range[] = {UI_ICON_MIN, UI_ICON_MED /*MAX*/, 0}; struct nk_font_config cfg = nk_font_config(UI_ICON_FONTSIZE); @@ -17220,30 +17228,30 @@ static void nk_config_custom_fonts() { cfg.oversample_v = 1; cfg.pixel_snap = 1; - struct nk_font *icons = nk_font_atlas_add_from_memory(atlas, data, vfs_size(UI_ICON_FONTNAME), UI_ICON_FONTSIZE, &cfg); + struct nk_font *icons = nk_font_atlas_add_from_memory(atlas, data, vfs_size(UI_FONT_ICONS), UI_ICON_FONTSIZE, &cfg); } // Monospaced font. Used in terminals or consoles. - for( char *data = vfs_read("Inconsolata-Regular.ttf"); data; data = 0 ) { - const float fontsize = 14.f; // 18.f; + for( char *data = vfs_read(UI_FONT_TERMINAL); data; data = 0 ) { + const float font_size = UI_FONT_REGULAR_SIZE; static const nk_rune icon_range[] = {32, 127, 0}; - struct nk_font_config cfg = nk_font_config(fontsize); + struct nk_font_config cfg = nk_font_config(font_size); cfg.range = icon_range; cfg.oversample_h = 1; cfg.oversample_v = 1; cfg.pixel_snap = 1; - // struct nk_font *proggy = nk_font_atlas_add_default(atlas, fontsize, &cfg); - struct nk_font *bold = nk_font_atlas_add_from_memory(atlas, data, vfs_size("Inconsolata-Regular.ttf"), fontsize, &cfg); + // struct nk_font *proggy = nk_font_atlas_add_default(atlas, font_size, &cfg); + struct nk_font *bold = nk_font_atlas_add_from_memory(atlas, data, vfs_size(UI_FONT_TERMINAL), font_size, &cfg); } // Extra optional fonts from here... - for( char *data = vfs_read("Carlito-BoldItalic.ttf"); data; data = 0 ) { - struct nk_font *bold = nk_font_atlas_add_from_memory(atlas, data, vfs_size("Carlito-BoldItalic.ttf"), UI_FONT_BOLD_SIZE, 0); // font = bold ? bold : font; + for( char *data = vfs_read(UI_FONT_HEADING); data; data = 0 ) { + struct nk_font *bold = nk_font_atlas_add_from_memory(atlas, data, vfs_size(UI_FONT_HEADING), UI_FONT_HEADING_SIZE, 0); // font = bold ? bold : font; } nk_glfw3_font_stash_end(&nk_glfw); // nk_sdl_font_stash_end(); @@ -19651,7 +19659,7 @@ video_t* video( const char *filename, int flags ) { v->has_audio = flags & VIDEO_NO_AUDIO ? 0 : 1; - plm_set_loop(plm, false); + plm_set_loop(plm, flags & VIDEO_LOOP); plm_set_video_decode_callback(plm, mpeg_video_callback, v); if( v->has_audio ) { plm_set_audio_enabled(plm, true); @@ -19976,6 +19984,9 @@ void window_hints(unsigned flags) { glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); // osx glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2); // osx, 2:#version150,3:330 #else + // Compute shaders need 4.5 otherwise. But... + // According to the GLFW docs, the context version hint acts as a minimum version. + // i.e, the context you actually get may be a higher or highest version (which is usually the case) glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2); #endif diff --git a/engine/v4k.h b/engine/v4k.h index a3031bc..f660207 100644 --- a/engine/v4k.h +++ b/engine/v4k.h @@ -3540,10 +3540,12 @@ API int ui_demo(int do_windows); enum VIDEO_FLAGS { VIDEO_YCBCR = 0, - VIDEO_RGB = 1, + VIDEO_RGB = 2, VIDEO_AUDIO = 0, - VIDEO_NO_AUDIO = 2, + VIDEO_NO_AUDIO = 4, + + VIDEO_LOOP = 8, }; typedef struct video_t video_t; diff --git a/tools/cook.ini b/tools/cook.ini index 969fb7d..501682a 100644 --- a/tools/cook.ini +++ b/tools/cook.ini @@ -1,4 +1,4 @@ -; this is where you specify and configure the FWK pipeline. +; this is where you specify and configure the V4K pipeline. ; tweak the pipeline and add new importers just by editing this file. ; there is no flow control in this script file: lines are parsed and evaluated, from top to bottom.