diff --git a/bin/data/config.json b/bin/data/config.json index 1e991d0a..8e939401 100644 --- a/bin/data/config.json +++ b/bin/data/config.json @@ -1,16 +1,16 @@ { "engine": { "scenes": { - "start": "SH2_McDonalds", + "start": "McDonalds", "lights": { "max": 512, "enabled": true }, "shadows": { "enabled": true, - "update": 4, + "update": 2, "max": 8, - "samples": 4, + "samples": 2, "experimental mode": 1 }, "textures": { @@ -21,16 +21,16 @@ } }, "vxgi": { - "limiter": 0.5, + "limiter": 1, "size": 96, "dispatch": 8, - "cascades": 3, - "cascadePower": 3, - "shadows": 4, - "granularity": 2, + "cascades": 7, + "cascadePower": 1.5, + "shadows": 0, + "granularity": 4, "extents": { - "min": [ -2, -2, -2 ], - "max": [ 2, 2, 2 ] + "min": [ -2.5, -2.5, -2.5 ], + "max": [ 2.5, 2.5, 2.5 ] } } }, @@ -53,7 +53,7 @@ // "size": [ 640, 480, "NEAREST" ], // "size": [ 256, 224, "NEAREST" ], // "msaa": 16 - "msaa": 8 + "msaa": 4 }, "experimental": { "rebuild on tick begin": false, diff --git a/bin/data/entities/playerModel.json b/bin/data/entities/playerModel.json index 495a7825..540be740 100644 --- a/bin/data/entities/playerModel.json +++ b/bin/data/entities/playerModel.json @@ -1,7 +1,7 @@ { "type": "Object", "name": "Player: Model", - "ignore": true, + "ignore": false, "assets": [ // "/player/bear.glb" { "filename": "%root%/models/player/bear/graph.json", "delay": 0, "single threaded": false, "category": "models" } diff --git a/bin/data/scenes/construct/gm_construct.json b/bin/data/scenes/construct/gm_construct.json index 07d754aa..303aba6e 100644 --- a/bin/data/scenes/construct/gm_construct.json +++ b/bin/data/scenes/construct/gm_construct.json @@ -49,7 +49,7 @@ "shadows": false }, "tags": { - "worldspawn_2": { "collision": "static mesh" }, + "worldspawn_2": { "collision": { "type": "mesh", "dynamic": false } }, "info_player_spawn": { "action": "attach", "filename": "./player.json", diff --git a/bin/data/scenes/construct/scene.json b/bin/data/scenes/construct/scene.json index b5145776..44129421 100644 --- a/bin/data/scenes/construct/scene.json +++ b/bin/data/scenes/construct/scene.json @@ -53,7 +53,7 @@ "shadows": true }, "noise": { - "size": [ 128, 128, 128 ] + "size": [ 32, 32, 32 ] } } } \ No newline at end of file diff --git a/bin/data/scenes/cornell/cornell.json b/bin/data/scenes/cornell/cornell.json deleted file mode 100644 index 9ba0ec4a..00000000 --- a/bin/data/scenes/cornell/cornell.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "type": "Object", - "name": "Map", - "ignore": false, - "assets": [ - { "filename": "./models/cornell.glb", "delay": 0, "single threaded": false } - // { "filename": "./models/cornell/graph.json", "delay": 0, "single threaded": false, "category": "models" } - ], - "behaviors": [ - "LoadingBehavior" - ], - "transform": { - "position": [ 0, 0, 0 ], - "rotation": { - "axis": [ 0, 1, 0 ], - "angle": 0 - }, - "scale": [ 1, 1, 1 ] - }, - "metadata": { - "model": { - "debug": { - "no cleanup": false, - "print tree": false, - "print stats": false, - "export": { - "should": false, - "combined": false, - "compression": false, - "precision": 4 - } - }, - // "lightmap": "./lightmap.png", - "ambient": [ 0.125, 0.125, 0.125 ], - "flags": { - "ATLAS": true, - "INVERT": false, - "TRANSFORM": false, - - "RENDER": true, - "COLLISION": false, - "SEPARATE": false, - "NORMALS": false, - "LOAD": false - }, - "lights": { - "shadows": true - }, - "tags": { - "cornellBox.000": { "collision": "static mesh" }, - "Camera": { "action": "attach", "filename": "./player.json", "preserve orientation": true } - } - } - } -} \ No newline at end of file diff --git a/bin/data/scenes/cornell/loading.json b/bin/data/scenes/cornell/loading.json deleted file mode 100644 index 04031e7c..00000000 --- a/bin/data/scenes/cornell/loading.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "Gui: Loading", - "type": "Object", - "behaviors": [ - // "GuiBehavior" - ], - "assets": [ - { "filename": "./cornell.json", "delay": 0 } - ], - "ignore": false, - "transform": { - "position": [ -0.830591, -0.699509, 0 ], - "rotation": { - "axis": [ 1, 0, 0 ], - "angle": 0 - }, - "scale": [ 0.258737, 0.115371, 1 ] - }, - "metadata": { - "uv": [ 0, 0, 1, 1 ], - "color": [ 1, 1, 1, 0.1 ], - "location": "", - "scaling": "relative", - "text settings": { - "stroke": [ 1, 0.749, 0.368, 1 ], - "color": [ 1, 0.749, 0.368, 1 ], - - "string": "Loading...", - "string1": "コマンド" - } - } -} \ No newline at end of file diff --git a/bin/data/scenes/cornell/player.json b/bin/data/scenes/cornell/player.json deleted file mode 100644 index dec26007..00000000 --- a/bin/data/scenes/cornell/player.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "import": "/player.json", - "assets": [ - // { "filename": "/gui/hud/hud.json", "delay": 0 } - ], - "metadata": { - "overlay": { - "floating": true - }, - "collider": true, - "light": { - "should": false, - "color": [1, 1, 1], - "position": [ 0, 2.5, 0 ], - "power": 1, - "radius": [0.001, 32] - } - } -} \ No newline at end of file diff --git a/bin/data/scenes/cornell/scene.json b/bin/data/scenes/cornell/scene.json deleted file mode 100644 index 26dbd3e1..00000000 --- a/bin/data/scenes/cornell/scene.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "import": "/scene.json", - "assets": [ - "./loading.json" - ], - "system": { - "hot reload": { - "enabled": true - }, - "renderer": { - "shader": { - "mode": 1, - "scalar": 16, - "parameters": [ 0, 0, 0, 0 ] - }, - "clear values": [ - [ 1, 1, 1, 0 ] - ] - } - }, - "metadata": { - "menus": { - "pause": "/gui/pause/menu.json" - }, - "volumes": { - "sfx": 0.25, - "bgm": 0.75, - "voice": 1.0 - }, - "light": { - "exposure": 1.0, - "gamma": 1.0, - "ambient": [ 0.125, 0.125, 0.125 ], - "kexp": 0, - "fog": { - "color": [ 0.25, 0.25, 0.25 ], - "range": [ 8, 32 ], - "step scale": 4, - "absorbtion": 0.07, - "density": { - "threshold": 0.35, - "multiplier": 5.0, - "scale": 25.0, - "offset": [0, -1, 1], - "timescale": 8 - } - }, - "should": true - } - } -} \ No newline at end of file diff --git a/bin/data/scenes/marchingcubes/marching.json b/bin/data/scenes/marchingcubes/marching.json deleted file mode 100644 index 86578e70..00000000 --- a/bin/data/scenes/marchingcubes/marching.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "type": "Marching", - "ignore": false, - "assets": [ - "./data/textures/texture.png" - ], - "hot reload": { - "enabled": true - }, - "metadata": { - "parameters": { - "size": [ 32, 32, 32 ], - "noise": [ 6, 6, 6 ], - "amplitude": 1, - "isolevel": 0.65, - "color": 0.5, - "invert": false - } - } -} \ No newline at end of file diff --git a/bin/data/scenes/marchingcubes/scene.json b/bin/data/scenes/marchingcubes/scene.json deleted file mode 100644 index 0659b922..00000000 --- a/bin/data/scenes/marchingcubes/scene.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "type": "MarchingCubes", - "assets": [ - "/gui.json", - "/player.json", - "./marching.json" - ], - "system": { - "hot reload": { - "enabled": true - }, - "clear color": [ 0.5, 0.5, 0.5, 1 ] - }, - "metadata": { - "light": { - "ambient": [ 0.2, 0.2, 0.2 ], - "kexp": 10, - "fog": { - "color": [ 0.1, 0.1, 0.1 ], - "range": [ 32, 64 ] - }, - "should": true - } - } -} \ No newline at end of file diff --git a/bin/data/scenes/mcdonalds/mcdonalds.json b/bin/data/scenes/mcdonalds/mcdonalds.json index ff584ccd..9321c121 100644 --- a/bin/data/scenes/mcdonalds/mcdonalds.json +++ b/bin/data/scenes/mcdonalds/mcdonalds.json @@ -27,7 +27,7 @@ "print stats": false, "export": { "should": true, - "combined": true, + "combined": false, "compression": false, "precision": 4 } @@ -49,7 +49,6 @@ "LOAD": false }, "lights": { - // "renderMode": { "target": "worldspawn_1" }, "shadows": true }, "tags": { diff --git a/bin/data/scenes/mcdonalds/scene.json b/bin/data/scenes/mcdonalds/scene.json index abdde7fb..1ba5f6c8 100644 --- a/bin/data/scenes/mcdonalds/scene.json +++ b/bin/data/scenes/mcdonalds/scene.json @@ -52,7 +52,7 @@ "shadows": true }, "noise": { - "size": [ 32, 32, 32 ] + "size": [ 16, 16, 16 ] } } } \ No newline at end of file diff --git a/bin/data/scenes/raytracing/scene.json b/bin/data/scenes/raytracing/scene.json deleted file mode 100644 index 421c2b4b..00000000 --- a/bin/data/scenes/raytracing/scene.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "type": "Scene", - "behaviors": [ - "SceneBehavior", - "ExtSceneBehavior", - "RayTracingSceneBehavior" - ], - "assets": [ - "/gui.json", - "./light.json", - "/player.json" - ], - "system": { - "hot reload": { - "enabled": true - }, - "renderer": { - "clear values": [ - [ 0.3, 0.3, 0.3, 0 ] - ] - }, - "physics": { - "collision": true, - "single threaded": false, - "sort": false, - "use": { - "strongest": false, - "worker": true, - "queue": false - }, - "optimizations": { - "ignore static entities": true, - "ignore duplicate tests": true, - "entity-local update": true - } - } - }, - "metadata": { - "menus": { - "pause": "/gui/pause/menu.json" - }, - "rays": { - "marching steps": 0, - "ray bounces": 2, - "shadow factor": 0.5, - "reflection": { - "strength": 0.4, - "falloff": 0.5 - } - }, - "volumes": { - "sfx": 0.25, - "bgm": 0.75, - "voice": 1.0 - }, - "light": { - "ambient": [ 0.1, 0.1, 0.1 ], - "kexp": 0, - "fog": { - "color": [ 0.1, 0.1, 0.1 ], - "range": [ 32, 64 ] - }, - "should": true - } - } -} \ No newline at end of file diff --git a/bin/data/scenes/sh2/loading.json b/bin/data/scenes/sh2/loading.json deleted file mode 100644 index 9981a50f..00000000 --- a/bin/data/scenes/sh2/loading.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "Gui: Loading", - "type": "Object", - "behaviors": [ - "GuiBehavior" - ], - "assets": [ - { "filename": "./sh.json", "delay": 0 } - ], - "ignore": false, - "transform": { - "position": [ -0.830591, -0.699509, 0 ], - "rotation": { - "axis": [ 1, 0, 0 ], - "angle": 0 - }, - "scale": [ 0.258737, 0.115371, 1 ] - }, - "metadata": { - "uv": [ 0, 0, 1, 1 ], - "color": [ 1, 1, 1, 0.1 ], - "location": "", - "scaling": "relative", - "text settings": { - "stroke": [ 1, 0.749, 0.368, 1 ], - "color": [ 1, 0.749, 0.368, 1 ], - - "string": "Loading...", - "string1": "コマンド" - } - } -} \ No newline at end of file diff --git a/bin/data/scenes/sh2/player.json b/bin/data/scenes/sh2/player.json deleted file mode 100644 index 65bc77be..00000000 --- a/bin/data/scenes/sh2/player.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "import": "/player.json", - "assets": [ - // { "filename": "/gui/hud/hud.json", "delay": 0 }, - ], - "system": { - "physics": { - "gravity": [ 0, 0, 0 ] - } - }, - "metadata": { - "overlay": { - "floating": true - }, - "collider": true, - "light": { - "should": true, - "color": [1, 1, 1], - "position": [ 0, 2.5, 0 ], - "power": 1, - "radius": [0.001, 32] - } - } -} \ No newline at end of file diff --git a/bin/data/scenes/sh2/scene.json b/bin/data/scenes/sh2/scene.json deleted file mode 100644 index a2e639fd..00000000 --- a/bin/data/scenes/sh2/scene.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "import": "/scene.json", - "assets": [ - "./audio/soundscape/ambience.ogg", - "./loading.json" - ], - "system": { - "hot reload": { - "enabled": true - }, - "renderer": { - "clear values": [ - [ 1, 1, 1, 0 ] - ], - "shader": { - "mode": 1, - "scalar": 16, - "parameters": [ 0, 0, 0, 0 ] - } - } - }, - "metadata": { - "menus": { - "pause": "/gui/pause/menu.json" - }, - "volumes": { - "sfx": 0.25, - "bgm": 0.75, - "voice": 1.0 - }, - "noise": { - "size": [ 512, 512, 512 ], - "coefficients": [ 3, 2, 5 ], - "amplitude": 1.02 - }, - "light": { - "exposure": 1.0, - "gamma": 1.0, - - "ambient": [ 0.45, 0.45, 0.45 ], - - "fog": { - "color": [ 0.45, 0.45, 0.45 ], - // "range": [ 32, 64 ], - "range": [ 0, 0 ], - "step scale": 4, - "absorbtion": 0.07, - "density": { - "threshold": 0.35, - "multiplier": 5.0, - "scale": 25.0, - "offset": [0, -1, 1], - "timescale": 8 - } - }, - "should": true, - "shadows": true - } - } -} \ No newline at end of file diff --git a/bin/data/scenes/sh2/sh.json b/bin/data/scenes/sh2/sh.json deleted file mode 100644 index 3dab53d9..00000000 --- a/bin/data/scenes/sh2/sh.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "type": "Object", - "name": "MedSci", - "ignore": false, - "assets": [ - { "filename": "./models/the_town.glb", "delay": 0, "single threaded": false } - // { "filename": "./models/the_town/graph.json", "delay": 0, "single threaded": false } - - // { "filename": "./models/start.glb", "delay": 0, "single threaded": false } - // { "filename": "./models/start/graph.json", "delay": 0, "single threaded": false, "category": "models" } - ], - "behaviors": [ - "LoadingBehavior" - ], - "transform": { - "position": [ 0, 0, 0 ], - "rotation": { - "axis": [ 0, 1, 0 ], - "angle": 0 - }, - "scale": [ 1, 1, 1 ] - }, - "metadata": { - "model": { - "debug": { - "no cleanup": false, - "print tree": false, - "print stats": false, - "export": { - "should": false, - "combined": false, - "compression": false, - "precision": 4 - } - }, - // "lightmap": "./lightmap.png", - "filter": "LINEAR", - "flags": { - "ATLAS": true, - "INVERT": false, - "TRANSFORM": false, - - "RENDER": true, - "COLLISION": false, - "SEPARATE": false, - "NORMALS": false, - "LOAD": false - }, - "lights": { - "shadows": true - }, - "tags": { - "cb": { "collision": "static mesh" }, - "info_player_spawn": { - "action": "attach", - "filename": "./player.json", - "preserve orientation": true - } - } - } - } -} \ No newline at end of file diff --git a/bin/data/scenes/sh2_mcdonalds/scene.json b/bin/data/scenes/sh2_mcdonalds/scene.json index 6041ac4c..423c330b 100644 --- a/bin/data/scenes/sh2_mcdonalds/scene.json +++ b/bin/data/scenes/sh2_mcdonalds/scene.json @@ -52,7 +52,7 @@ "shadows": true }, "noise": { - "size": [ 32, 32, 32 ] + "size": [ 16, 16, 16 ] } } } \ No newline at end of file diff --git a/bin/data/scenes/sh2_mcdonalds/sh2_mcdonalds.json b/bin/data/scenes/sh2_mcdonalds/sh2_mcdonalds.json index 7f97fa55..0617cb44 100644 --- a/bin/data/scenes/sh2_mcdonalds/sh2_mcdonalds.json +++ b/bin/data/scenes/sh2_mcdonalds/sh2_mcdonalds.json @@ -27,7 +27,7 @@ "print stats": false, "export": { "should": true, - "combined": true, + "combined": false, "compression": false, "precision": 4 } diff --git a/bin/data/scenes/ss2/medsci.json b/bin/data/scenes/ss2/medsci.json index 878c0e32..afd3bf62 100644 --- a/bin/data/scenes/ss2/medsci.json +++ b/bin/data/scenes/ss2/medsci.json @@ -31,7 +31,7 @@ "print tree": false, "print stats": false, "export": { - "should": false, + "should": true, "combined": false, "compression": false, "precision": 4 diff --git a/bin/data/scenes/worldscape/gui/battle/actions.json b/bin/data/scenes/worldscape/gui/battle/actions.json deleted file mode 100644 index 0b7ff53c..00000000 --- a/bin/data/scenes/worldscape/gui/battle/actions.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "member-attack": "Attack", - "member-skill": "Skill", - "inventory": "Item", - "talk": "Talk", - "transients": "Party", - "escape": "Escape", - "analyze": "Analyze", - "pass": "Pass" -} \ No newline at end of file diff --git a/bin/data/scenes/worldscape/gui/battle/battle-option.json b/bin/data/scenes/worldscape/gui/battle/battle-option.json deleted file mode 100644 index a7ed2426..00000000 --- a/bin/data/scenes/worldscape/gui/battle/battle-option.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "Menu: Battle Option", - "type": "Gui", - "ignore": false, - "transform": { - "position": [ -0.907025, -0.556947, 0 ], - "position": [ -0.945836, 0.282013, 0 ], - "position": [ -0.979556, 0.518861, 0 ], - "rotation": { - "axis": [ 0, 0, 1 ], - "angle": 0 - }, - "scale": [ 0.156407, 0.0788377, 1 ] - }, - "metadata": { - "uv": [ 0, 0, 1, 1 ], - "location": "", - "scaling": "relative", - "text settings": { - "stroke": [ 0, 0, 0, 1 ], - "color": [ 1, 1, 1, 1 ], - - "direction": "up", - - "string": "" - } - } -} \ No newline at end of file diff --git a/bin/data/scenes/worldscape/gui/battle/battle-text.json b/bin/data/scenes/worldscape/gui/battle/battle-text.json deleted file mode 100644 index 3a4a2d3e..00000000 --- a/bin/data/scenes/worldscape/gui/battle/battle-text.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "name": "Menu: Battle Text", - "type": "Gui", - "ignore": false, - "transform": { - "position": [ -0.948393, -0.920823, 0 ], - "rotation": { - "axis": [ 0, 0, 1 ], - "angle": 0 - }, - "scale": [ 0.156407, 0.0788377, 1 ] - }, - "metadata": { - "uv": [ 0, 0, 1, 1 ], - "location": "", - "scaling": "relative", - "text settings": { - "stroke": [ 0, 0, 0, 1 ], - "color": [ 1, 1, 1, 1 ], - - "string": "", - - "fade in": 1.0, - "scroll speed": 0.0125 - } - } -} \ No newline at end of file diff --git a/bin/data/scenes/worldscape/gui/battle/circle-in.json b/bin/data/scenes/worldscape/gui/battle/circle-in.json deleted file mode 100644 index 729a92c5..00000000 --- a/bin/data/scenes/worldscape/gui/battle/circle-in.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "Menu: Circle Inner", - "type": "Gui", - "ignore": false, - "transform": { - "position": [ -0.86, 0.86, 0 ], - "rotation": { - "axis": [ 1, 0, 0 ], - "angle": 0 - }, - "scale": [ 0.64, 1, 1 ] - }, - "metadata": { - "uv": [ 0, 0, 1, 1 ], - "color": [ 1, 1, 1, 0.1 ], - "location": "", - "scaling": "relative", - "depth": 0.1 - }, - "assets": [ - "https://cdn..xyz//unity/Android/sprite/sprite_magiccircle_in.png" - ] -} \ No newline at end of file diff --git a/bin/data/scenes/worldscape/gui/battle/circle-out.json b/bin/data/scenes/worldscape/gui/battle/circle-out.json deleted file mode 100644 index 206cece0..00000000 --- a/bin/data/scenes/worldscape/gui/battle/circle-out.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "Menu: Circle Outer", - "type": "Gui", - "ignore": false, - "transform": { - "position": [ -0.86, 0.86, 0 ], - "rotation": { - "axis": [ 1, 0, 0 ], - "angle": 0 - }, - "scale": [ 0.64, 1, 1 ] - }, - "hoverable": true, - "metadata": { - "uv": [ 0, 0, 1, 1 ], - "color": [ 1, 1, 1, 0.4 ], - "location": "", - "scaling": "relative", - "depth": 0.1 - }, - "assets": [ - "https://cdn..xyz//unity/Android/sprite/sprite_magiccircle_out.png" - ] -} \ No newline at end of file diff --git a/bin/data/scenes/worldscape/gui/battle/critCutIn.json b/bin/data/scenes/worldscape/gui/battle/critCutIn.json deleted file mode 100644 index eaa96f6c..00000000 --- a/bin/data/scenes/worldscape/gui/battle/critCutIn.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "Menu: Crit Cut In", - "type": "Gui", - "ignore": false, - "transform": { - "position": [ 0, 0.407656, 0 ], - "rotation": { - "axis": [ 1, 0, 0 ], - "angle": 0 - }, - "scale": [ 0.4617, 0.2097, 1 ] - }, - "metadata": { - "uv": [ 0, 0, 1, 1 ], - "color": [ 1, 1, 1, 1.0 ], - "location": "", - "scaling": "relative", - "debug": { - "moveable": true - }, - "shaders": { - "fragment": "./data/shaders/gui.gradient.frag.spv" - } - }, - "assets": [ - "./data/smtsamo/ci/ci_tsathoggua01.png" - ] -} \ No newline at end of file diff --git a/bin/data/scenes/worldscape/gui/battle/critCutinBackground.json b/bin/data/scenes/worldscape/gui/battle/critCutinBackground.json deleted file mode 100644 index 94213ac1..00000000 --- a/bin/data/scenes/worldscape/gui/battle/critCutinBackground.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name": "Menu: Crit Cut In Background", - "type": "Gui", - "ignore": false, - "transform": { - "position": [ 0, 0.407656, 0 ], - "rotation": { - "axis": [ 1, 0, 0 ], - "angle": 0 - }, - "scale": [ 1, 0.2097, 1 ] - }, - "metadata": { - "uv": [ 0, 0, 1, 1 ], - "color": [ 1, 1, 1, 0.7 ], - "location": "", - "scaling": "relative", - "debug": { - "moveable": true - } - }, - "assets": [ - "./data/smtsamo/ci/ci_background.png" - ] -} \ No newline at end of file diff --git a/bin/data/scenes/worldscape/gui/battle/damageText.json b/bin/data/scenes/worldscape/gui/battle/damageText.json deleted file mode 100644 index d0cb00e8..00000000 --- a/bin/data/scenes/worldscape/gui/battle/damageText.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "name": "Menu: Damage Text", - "type": "Gui", - "ignore": false, - "transform": { - "position": [ -0.593853, 0.810848, 0 ], - "rotation": { - "axis": [ 1, 0, 0 ], - "angle": 0 - }, - "scale": [ 0.0673643, 0.104402, 1 ] - }, - "metadata": { - "uv": [ 0, 0, 1, 1 ], - "location": "", - "scaling": "relative", - - "text settings": { - "stroke": [ 0, 0, 0, 1 ], - "color": [ 1, 1, 1, 1 ], - - "string": "0" - } - }, - "assets": [ - ] -} \ No newline at end of file diff --git a/bin/data/scenes/worldscape/gui/battle/menu.json b/bin/data/scenes/worldscape/gui/battle/menu.json deleted file mode 100644 index b7ea250e..00000000 --- a/bin/data/scenes/worldscape/gui/battle/menu.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "Gui: Menu", - "type": "Gui", - "ignore": false, - "transform": { - "position": [ 0, 0, 0 ], - "rotation": { - "axis": [ 0, 0, 1 ], - "angle": 0 - }, - "scale": [ 1, 1, 1 ] - }, - "metadata": { - "uv": [ 0, 0, 1, 1 ], - "color": [ 1, 1, 1, 1 ], - "location": "", - "scaling": "relative", - "depth": 0.1 - }, - "assets": [ - ] -} \ No newline at end of file diff --git a/bin/data/scenes/worldscape/gui/battle/optionsBackground.json b/bin/data/scenes/worldscape/gui/battle/optionsBackground.json deleted file mode 100644 index 5a3cb333..00000000 --- a/bin/data/scenes/worldscape/gui/battle/optionsBackground.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "Menu: Options Background", - "type": "Gui", - "ignore": false, - "transform": { - "position": [ -0.619073, 0.488956, 0 ], - "rotation": { - "axis": [ 0, 0, 1 ], - "angle": 0 - }, - "scale": [ 0.375937, 0.291338, 1 ], - "scale": [ 0, 0, 1 ] - }, - "metadata": { - "uv": [ 0, 0, 1, 1 ], - "location": "", - "scaling": "relative" - }, - "assets": [ - "./textures/background.png" - ] -} \ No newline at end of file diff --git a/bin/data/scenes/worldscape/gui/battle/partyMemberBars.json b/bin/data/scenes/worldscape/gui/battle/partyMemberBars.json deleted file mode 100644 index 7fb235f8..00000000 --- a/bin/data/scenes/worldscape/gui/battle/partyMemberBars.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "Menu: Party Member Bars", - "type": "Gui", - "ignore": false, - "transform": { - "position": [ -0.593853, 0.810848, 0 ], - "rotation": { - "axis": [ 1, 0, 0 ], - "angle": 0 - }, - "scale": [ 0.0673643, 0.104402, 1 ] - }, - "metadata": { - "uv": [ 0, 0, 1, 1 ], - "location": "", - "scaling": "relative" - }, - "assets": [ - "./textures/bars.png" - ] -} \ No newline at end of file diff --git a/bin/data/scenes/worldscape/gui/battle/partyMemberButton.json b/bin/data/scenes/worldscape/gui/battle/partyMemberButton.json deleted file mode 100644 index 110a1e87..00000000 --- a/bin/data/scenes/worldscape/gui/battle/partyMemberButton.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "Menu: Party Member Button", - "type": "Gui", - "ignore": true, - "transform": { - "position": [ 0.807418, -0.810225, 0 ], - "rotation": { - "axis": [ 1, 0, 0 ], - "angle": 0 - }, - "scale": [ 0, 0, 1 ] - }, - "metadata": { - "uv": [ 0, 0, 1, 1 ], - "color": [ 0.1, 0.1, 0.1, 0.1 ], - "location": "", - "scaling": "relative" - } -} \ No newline at end of file diff --git a/bin/data/scenes/worldscape/gui/battle/partyMemberCommandCircle.json b/bin/data/scenes/worldscape/gui/battle/partyMemberCommandCircle.json deleted file mode 100644 index b0d8ddc1..00000000 --- a/bin/data/scenes/worldscape/gui/battle/partyMemberCommandCircle.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "Menu: Party Member Command Circle", - "type": "Gui", - "ignore": false, - "transform": { - "position": [ 0, 0, 0 ], - "rotation": { - "axis": [ 1, 0, 0 ], - "angle": 0 - }, - "scale": [ 0.0939269, 0.153013, 1 ] - }, - "metadata": { - "uv": [ 0, 0, 1, 1 ], - "color": [ 0.5625, 0, 1, 1 ], - "location": "", - "scaling": "relative", - "shader": 1 - }, - "assets": [ - "./textures/command.png" - ] -} \ No newline at end of file diff --git a/bin/data/scenes/worldscape/gui/battle/partyMemberHP.json b/bin/data/scenes/worldscape/gui/battle/partyMemberHP.json deleted file mode 100644 index 5dcc3ed2..00000000 --- a/bin/data/scenes/worldscape/gui/battle/partyMemberHP.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "Menu: Party Member HP Bar", - "type": "Gui", - "ignore": false, - "transform": { - "position": [ -0.593853, 0.810848, 0 ], - "rotation": { - "axis": [ 1, 0, 0 ], - "angle": 0 - }, - "scale": [ 0.0673643, 0.104402, 1 ] - }, - "metadata": { - "uv": [ 0, 0, 1, 1 ], - "location": "", - "scaling": "relative" - }, - "assets": [ - "./textures/hp.png" - ] -} \ No newline at end of file diff --git a/bin/data/scenes/worldscape/gui/battle/partyMemberIcon.json b/bin/data/scenes/worldscape/gui/battle/partyMemberIcon.json deleted file mode 100644 index 43d0ef5a..00000000 --- a/bin/data/scenes/worldscape/gui/battle/partyMemberIcon.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "Menu: Party Member Icon", - "type": "Gui", - "ignore": false, - "transform": { - "position": [ -0.693853, 0.810848, 0 ], - "rotation": { - "axis": [ 1, 0, 0 ], - "angle": 0 - }, - "scale": [ 0.0673643, 0.104402, 1 ] - }, - "metadata": { - "uv": [ 0, 0, 1, 1 ], - "color": [ 1, 1, 1, 1 ], - "location": "", - "scaling": "relative" - }, - "assets": [ - ] -} \ No newline at end of file diff --git a/bin/data/scenes/worldscape/gui/battle/partyMemberIconShadow.json b/bin/data/scenes/worldscape/gui/battle/partyMemberIconShadow.json deleted file mode 100644 index a41fa004..00000000 --- a/bin/data/scenes/worldscape/gui/battle/partyMemberIconShadow.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "Menu: Party Member Shadow", - "type": "Gui", - "ignore": false, - "transform": { - "position": [ -0.693853, 0.810848, 0 ], - "rotation": { - "axis": [ 1, 0, 0 ], - "angle": 0 - }, - "scale": [ 0.0673643, 0.104402, 1 ] - }, - "metadata": { - "uv": [ 0, 0, 1, 1 ], - "color": [ 1, 0, 1, 1 ], - "location": "", - "scaling": "relative", - "shader": 1 - }, - "assets": [ - ] -} \ No newline at end of file diff --git a/bin/data/scenes/worldscape/gui/battle/partyMemberMP.json b/bin/data/scenes/worldscape/gui/battle/partyMemberMP.json deleted file mode 100644 index ec577f24..00000000 --- a/bin/data/scenes/worldscape/gui/battle/partyMemberMP.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "Menu: Party Member MP Bar", - "type": "Gui", - "ignore": false, - "transform": { - "position": [ -0.593853, 0.810848, 0 ], - "rotation": { - "axis": [ 1, 0, 0 ], - "angle": 0 - }, - "scale": [ 0.0673643, 0.104402, 1 ] - }, - "metadata": { - "uv": [ 0, 0, 1, 1 ], - "location": "", - "scaling": "relative" - }, - "assets": [ - "./textures/mp.png" - ] -} \ No newline at end of file diff --git a/bin/data/scenes/worldscape/gui/battle/partyMemberText.json b/bin/data/scenes/worldscape/gui/battle/partyMemberText.json deleted file mode 100644 index e50e67ad..00000000 --- a/bin/data/scenes/worldscape/gui/battle/partyMemberText.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "Menu: Party Member Text", - "type": "Gui", - "ignore": false, - "transform": { - "position": [ -0.693853, 0.810848, 0 ], - "rotation": { - "axis": [ 1, 0, 0 ], - "angle": 0 - }, - "scale": [ 0.0673643, 0.104402, 1 ] - }, - "metadata": { - "uv": [ 0, 0, 1, 1 ], - "location": "", - "scaling": "relative", - - "text settings": { - "stroke": [ 0, 0, 0, 1 ], - "color": [ 1, 1, 1, 1 ], - - "scale": 1, - - "string": "HP: -/-\nMP: -/-" - } - }, - "assets": [ - ] -} \ No newline at end of file diff --git a/bin/data/scenes/worldscape/gui/battle/thing-icons.json b/bin/data/scenes/worldscape/gui/battle/thing-icons.json deleted file mode 100644 index c37c93ad..00000000 --- a/bin/data/scenes/worldscape/gui/battle/thing-icons.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "Menu: Portraits", - "type": "Gui", - "ignore": true, - "transform": { - "position": [ 0.836487, -0.715143, 0 ], - "rotation": { - "axis": [ 1, 0, 0 ], - "angle": 0 - }, - "scale": [ 0.11813, 0.195829, 1 ] - }, - "metadata": { - "uv": [ 0, 0, 1, 1 ], - "color": [ 1, 1, 1, 0.8 ], - "location": "", - "scaling": "relative", - "depth": 0.1 - }, - "assets": [ - "./textures/rodandtuatgua.png" - ] -} \ No newline at end of file diff --git a/bin/data/scenes/worldscape/gui/battle/turnCounter.json b/bin/data/scenes/worldscape/gui/battle/turnCounter.json deleted file mode 100644 index af2e0dda..00000000 --- a/bin/data/scenes/worldscape/gui/battle/turnCounter.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "Menu: Turn Counter", - "type": "Gui", - "ignore": false, - "transform": { - "position": [ 0.908587, 0.862859, 0 ], - "rotation": { - "axis": [ 1, 0, 0 ], - "angle": 0 - }, - "scale": [ 0.0673643, 0.104402, 1 ] - }, - "metadata": { - "uv": [ 0, 0, 1, 1 ], - "location": "", - "scaling": "relative" - }, - "assets": [ - "./textures/turnCounter.png" - ] -} \ No newline at end of file diff --git a/bin/data/scenes/worldscape/gui/battle/turnCounters.json b/bin/data/scenes/worldscape/gui/battle/turnCounters.json deleted file mode 100644 index bc63bcc1..00000000 --- a/bin/data/scenes/worldscape/gui/battle/turnCounters.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "Menu: Turn Counters", - "type": "Gui", - "ignore": false, - "transform": { - "position": [ 0.908587, 0.862859, 0 ], - "rotation": { - "axis": [ 1, 0, 0 ], - "angle": 0 - }, - "scale": [ 0.0673643, 0.104402, 1 ] - }, - "metadata": { - "uv": [ 0, 0, 1, 1 ], - "location": "", - "scaling": "relative" - } -} \ No newline at end of file diff --git a/bin/data/scenes/worldscape/gui/dialogue/dialogue-option.json b/bin/data/scenes/worldscape/gui/dialogue/dialogue-option.json deleted file mode 100644 index fc1e7e2d..00000000 --- a/bin/data/scenes/worldscape/gui/dialogue/dialogue-option.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "Menu: Battle Option", - "type": "Gui", - "ignore": false, - "transform": { - "position": [ -0.745836, 0.282013, 0 ], - "position": [ -0.979556, 0.518861, 0 ], - "rotation": { - "axis": [ 0, 0, 1 ], - "angle": 0 - }, - "scale": [ 0.156407, 0.0788377, 1 ] - }, - "metadata": { - "uv": [ 0, 0, 1, 1 ], - "location": "", - "scaling": "relative", - - - "debug": { - "moveable": true - }, - - "text settings": { - "string": "" - } - } -} \ No newline at end of file diff --git a/bin/data/scenes/worldscape/gui/dialogue/dialogue-text.json b/bin/data/scenes/worldscape/gui/dialogue/dialogue-text.json deleted file mode 100644 index fd074922..00000000 --- a/bin/data/scenes/worldscape/gui/dialogue/dialogue-text.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "Menu: Battle Text", - "type": "Gui", - "ignore": false, - "transform": { - "position": [ -0.917143, -0.781932, 0 ], - "position": [ -0.948393, -0.920823, 0 ], - "rotation": { - "axis": [ 0, 0, 1 ], - "angle": 0 - }, - "scale": [ 0.156407, 0.0788377, 1 ] - }, - "metadata": { - "uv": [ 0, 0, 1, 1 ], - "location": "", - "scaling": "relative", - - "text settings": { - "string": "", - - "fade in": 1.0, - "scroll speed": 0.05 - } - } -} \ No newline at end of file diff --git a/bin/data/scenes/worldscape/gui/dialogue/menu.json b/bin/data/scenes/worldscape/gui/dialogue/menu.json deleted file mode 100644 index 91a4f817..00000000 --- a/bin/data/scenes/worldscape/gui/dialogue/menu.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "Gui: Menu", - "type": "Gui", - "ignore": false, - "transform": { - "position": [ 0, 0, 0 ], - "rotation": { - "axis": [ 0, 0, 1 ], - "angle": 0 - }, - "scale": [ 1, 1, 1 ] - }, - "metadata": { - "uv": [ 0, 0, 1, 1 ], - "color": [ 1, 1, 1, 1 ], - "location": "", - "scaling": "relative", - "depth": 0.1 - } -} \ No newline at end of file diff --git a/bin/data/scenes/worldscape/gui/pause/circle-in.json b/bin/data/scenes/worldscape/gui/pause/circle-in.json deleted file mode 100644 index 28da4e68..00000000 --- a/bin/data/scenes/worldscape/gui/pause/circle-in.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "Menu: Circle Inner", - "type": "Gui", - "ignore": false, - "transform": { - "position": [ -0.86, 0.86, 0 ], - "rotation": { - "axis": [ 1, 0, 0 ], - "angle": 0 - }, - "scale": [ 0.64, 1, 1 ] - }, - "metadata": { - "uv": [ 0, 0, 1, 1 ], - "color": [ 1, 1, 1, 0.8 ], - "location": "", - "scaling": "relative" - }, - "assets": [ - "https://cdn..xyz//unity/Android/sprite/sprite_magiccircle_in.png" - ] -} \ No newline at end of file diff --git a/bin/data/scenes/worldscape/gui/pause/circle-out.json b/bin/data/scenes/worldscape/gui/pause/circle-out.json deleted file mode 100644 index e55df669..00000000 --- a/bin/data/scenes/worldscape/gui/pause/circle-out.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "Menu: Circle Outer", - "type": "Gui", - "ignore": false, - "transform": { - "position": [ -0.86, 0.86, 0 ], - "rotation": { - "axis": [ 1, 0, 0 ], - "angle": 0 - }, - "scale": [ 0.64, 1, 1 ] - }, - "clickable": false, - "hoverable": true, - "metadata": { - "uv": [ 0, 0, 1, 1 ], - "color": [ 1, 1, 1, 0.8 ], - "location": "", - "scaling": "relative" - }, - "assets": [ - "https://cdn..xyz//unity/Android/sprite/sprite_magiccircle_out.png" - ] -} \ No newline at end of file diff --git a/bin/data/scenes/worldscape/gui/pause/close.json b/bin/data/scenes/worldscape/gui/pause/close.json deleted file mode 100644 index 2c863137..00000000 --- a/bin/data/scenes/worldscape/gui/pause/close.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "Menu: Close Option", - "type": "Gui", - "ignore": false, - "transform": { - "position": [ -0.65544, -0.339642, 0 ], - "rotation": { - "axis": [ 0, 0, 1 ], - "angle": 0 - }, - "scale": [ 0.156407, 0.0788377, 1 ] - }, - "clickable": true, - "hoverable": true, - "metadata": { - "uv": [ 0, 0, 1, 1 ], - "location": "", - "scaling": "relative", - "events": { - "click": { - "name": "menu:Close.%P-UID%", - "payload": {} - } - }, - "text settings": { - "string": "Close", - "string1": "クローズ" - } - } -} \ No newline at end of file diff --git a/bin/data/scenes/worldscape/gui/pause/command-text.json b/bin/data/scenes/worldscape/gui/pause/command-text.json deleted file mode 100644 index 303cd2b1..00000000 --- a/bin/data/scenes/worldscape/gui/pause/command-text.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name": "Menu: Command Text", - "type": "Gui", - "ignore": false, - "transform": { - "position": [ -0.830591, -0.699509, 0 ], - "rotation": { - "axis": [ 1, 0, 0 ], - "angle": 0 - }, - "scale": [ 0.258737, 0.115371, 1 ] - }, - "metadata": { - "uv": [ 0, 0, 1, 1 ], - "location": "", - "scaling": "relative", - "text settings": { - "stroke": [ 1, 0.749, 0.368, 1 ], - "color": [ 1, 0.749, 0.368, 1 ], - - "string": "Menu", - "string1": "コマンド" - } - } -} \ No newline at end of file diff --git a/bin/data/scenes/worldscape/gui/pause/icon.json b/bin/data/scenes/worldscape/gui/pause/icon.json deleted file mode 100644 index 3176abf4..00000000 --- a/bin/data/scenes/worldscape/gui/pause/icon.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name": "Gui: Icon", - "type": "Gui", - "ignore": false, - "transform": { - "position": [ 0, 0, 0 ], - "rotation": { - "axis": [ 0, 0, 1 ], - "angle": 0 - }, - "scale": [ 1, 1, 1 ] - }, - "metadata": { - "gui": { - "position": [ -0.875, -0.775, 0 ], - "uv": [ 0, 0, 1, 1 ], - "color": [ 1, 1, 1, 1 ], - "location": "", - "scaling": "fixed" - } - }, - "assets": [ - "https://cdn..xyz//unity/Android/icon/icon_agyou01_skin1.png" - ] -} \ No newline at end of file diff --git a/bin/data/scenes/worldscape/gui/pause/main-text.json b/bin/data/scenes/worldscape/gui/pause/main-text.json deleted file mode 100644 index 244c0a0f..00000000 --- a/bin/data/scenes/worldscape/gui/pause/main-text.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "Menu: Main Scroller", - "type": "Gui", - "ignore": true, - "transform": { - "position": [ 0.98, -2, 0 ], - "rotation": { - "axis": [ 0, 0, 1 ], - "angle": 1.5707963 - }, - "scale": [ 0.16, 1, 1 ] - }, - "hoverable": true, - "metadata": { - "uv": [ 0, 0, 1, 1 ], - "color": [ 0.113, 0.756, 0.988, 0.4 ], - "location": "", - "scaling": "relative" - }, - "assets": [ - "./textures/main.png" - ] -} \ No newline at end of file diff --git a/bin/data/scenes/worldscape/gui/pause/menu.json b/bin/data/scenes/worldscape/gui/pause/menu.json deleted file mode 100644 index 3b66aafc..00000000 --- a/bin/data/scenes/worldscape/gui/pause/menu.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "Gui: Menu", - "type": "Gui", - "behaviors": [ - "GuiBehavior", - "GuiWorldPauseMenuBehavior" - ], - "ignore": false, - "transform": { - "position": [ 0, 0, 0 ], - "rotation": { - "axis": [ 0, 0, 1 ], - "angle": 0 - }, - "scale": [ 1, 1, 1 ] - }, - "metadata": { - "uv": [ 0, 0, 1, 1 ], - "color": [ 0.1, 0.05, 0.1, 1 ], - "location": "", - "scaling": "relative", - "depth": 0.2, - "alpha": 0.4, - "mode": 1 - }, - "assets": [ - "./textures/menu.png" - ] -} \ No newline at end of file diff --git a/bin/data/scenes/worldscape/gui/pause/quit.json b/bin/data/scenes/worldscape/gui/pause/quit.json deleted file mode 100644 index 3d86ab15..00000000 --- a/bin/data/scenes/worldscape/gui/pause/quit.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "name": "Menu: Close Option", - "type": "Gui", - "ignore": false, - "transform": { - "position": [ -0.65544, -0.157698, 0 ], - "rotation": { - "axis": [ 0, 0, 1 ], - "angle": 0 - }, - "scale": [ 0.156407, 0.0788377, 1 ] - }, - "clickable": true, - "hoverable": true, - "metadata": { - "uv": [ 0, 0, 1, 1 ], - "location": "", - "scaling": "relative", - "debug": { - "moveable": true - }, - "events": { - "click": [ - { - "name": "menu:Close.%P-UID%", - "payload": { - "callback": { - "name": "system:Quit", - "payload": { - "scene": "StartMenu" - }, - "scope": "scene" - } - } - } - ] - }, - "text settings": { - "string": "Quit", - "string1": "終了する" - } - } -} \ No newline at end of file diff --git a/bin/data/scenes/worldscape/gui/pause/tenkousei.json b/bin/data/scenes/worldscape/gui/pause/tenkousei.json deleted file mode 100644 index 373b5f35..00000000 --- a/bin/data/scenes/worldscape/gui/pause/tenkousei.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "Menu: Tenkousei Option", - "type": "Gui", - "ignore": true, - "transform": { - "position": [ -0.65544, -0.52853, 0 ], - "rotation": { - "axis": [ 0, 0, 1 ], - "angle": 0 - }, - "scale": [ 0.156407, 0.0788377, 1 ] - }, - "clickable": true, - "hoverable": true, - "metadata": { - "uv": [ 0, 0, 1, 1 ], - "location": "", - "scaling": "relative", - "text settings": { - "string": "", - "string1": "「転光生」" - } - } -} \ No newline at end of file diff --git a/bin/data/scenes/worldscape/gui/pause/transient-portrait.json b/bin/data/scenes/worldscape/gui/pause/transient-portrait.json deleted file mode 100644 index 616418ae..00000000 --- a/bin/data/scenes/worldscape/gui/pause/transient-portrait.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "Menu: Transient Portrait", - "type": "Gui", - "ignore": true, - "transform": { - "position": [ 0.76, 0.2, 0 ], - "rotation": { - "axis": [ 1, 0, 0 ], - "angle": 0 - }, - "scale": [ 0.43, 1, 1 ] - }, - "clickable": true, - "metadata": { - "uv": [ 0, 0, 1, 1 ], - "color": [ 1, 1, 1, 0 ], - "location": "", - "scaling": "relative", - "depth": 0.1 - } -} \ No newline at end of file diff --git a/bin/data/scenes/worldscape/gui/pause/transient-shadow.json b/bin/data/scenes/worldscape/gui/pause/transient-shadow.json deleted file mode 100644 index 908f7c47..00000000 --- a/bin/data/scenes/worldscape/gui/pause/transient-shadow.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "Menu: Transient Shadow", - "type": "Gui", - "ignore": true, - "transform": { - "position": [ 0.46, 0, 0 ], - "rotation": { - "axis": [ 1, 0, 0 ], - "angle": 0 - }, - "scale": [ 0.43, 1, 1 ] - }, - "metadata": { - "uv": [ 0, 0, 1, 1 ], - "color": [ 1, 1, 1, 0 ], - "location": "", - "scaling": "relative", - "shader": 1, - "depth": 0.1 - } -} \ No newline at end of file diff --git a/bin/data/scenes/worldscape/gui/pause/yellow-box.json b/bin/data/scenes/worldscape/gui/pause/yellow-box.json deleted file mode 100644 index 4e9c95b1..00000000 --- a/bin/data/scenes/worldscape/gui/pause/yellow-box.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "Menu: Left Rectangle", - "type": "Gui", - "ignore": false, - "transform": { - "position": [ -0.933374, 0, 0 ], - "rotation": { - "axis": [ 1, 0, 0 ], - "angle": 0 - }, - "scale": [ 0.067, 1, 1 ] - }, - "metadata": { - "uv": [ 0, 0, 1, 1 ], - // "color": [ 1, 0.749, 0.368, 1 ], - "color": [ 1, 0.749, 0.368, 0.5 ], - "location": "", - "scaling": "relative", - "shader": 1 - }, - "assets": [ - "./textures/square.png" - ] -} \ No newline at end of file diff --git a/bin/data/scenes/worldscape/harlot.json b/bin/data/scenes/worldscape/harlot.json deleted file mode 100644 index 1f608e15..00000000 --- a/bin/data/scenes/worldscape/harlot.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "type": "Housamo", - "ignore": false, - "transform": { - "position": [ 0, 0, 0 ], - "rotation": { - "axis": [ 0, 1, 0 ], - "angle": 0.0 - }, - // "scale": [ 8.475, 6, 1 ] - "scale": [ 6.35625, 4.5, 1 ] - }, - "metadata": { - "region": { - "track": true, - "persist": false - }, - "collision": { - "should": true, - "jump": [ 0, 8, 0 ], - "gravity": [ 0, -9.81, 0 ] - }, - "system": { - "onCollision": "battle" - }, - "": { "party": ["800203"], "transients": { "800203": { - "id": "800203", "lv": 90, "hp": 5000, "max hp": 5000, "mp": 1000, "max mp": 1000, "skin": null, - "skills": [ "0", "513", "174", "91", "157", "200", "355", "93", "130" ] - } } }, - "music": "./data/audio/battle/fiend.ogg" - }, - "assets": [ - "./data/smtsamo/fg/fg_motherHarlot01.png" - ] -} \ No newline at end of file diff --git a/bin/data/scenes/worldscape/housamo.json b/bin/data/scenes/worldscape/housamo.json deleted file mode 100644 index 08318520..00000000 --- a/bin/data/scenes/worldscape/housamo.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "type": "Object", - "behaviors": [ - "CraetureBehavior", - "HousamoSpriteBehavior" - ], - "ignore": false, - "transform": { - "position": [ 0, 0, 0 ], - "rotation": { - "axis": [ 0, 1, 0 ], - "angle": 0.0 - }, - "scale": [ 3, 4.2375, 1 ] - }, - "system": { - "hot reload": { - "enabled": true - } - }, - "physics": { - "collision": false, - "gravity": [ 0, -9.81, 0 ], - "walk": 1, - "move": 4, - "run": 8, - "rotate": 1.25, - "crouch": 1, - "jump": [ 0, 4, 0 ] - }, - "metadata": { - "color": [ 1, 1, 1, 1 ], - "region": { - "track": true, - "persist": false - }, - "system":{ - "onCollision": "battle" - } - } -} \ No newline at end of file diff --git a/bin/data/scenes/worldscape/loading.json b/bin/data/scenes/worldscape/loading.json deleted file mode 100644 index 71e1e2ff..00000000 --- a/bin/data/scenes/worldscape/loading.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "name": "Gui: Loading", - "type": "Object", - "behaviors": [ - "GuiBehavior" - ], - "assets": [ - { "filename": "./terrain.json", "delay": 0 }, - { "filename": "/overworld/dungeon_intro.ogg", "delay": 0 } - ], - "ignore": false, - "transform": { - "position": [ -0.830591, -0.699509, 0 ], - "rotation": { - "axis": [ 1, 0, 0 ], - "angle": 0 - }, - "scale": [ 0.258737, 0.115371, 1 ] - }, - "metadata": { - "uv": [ 0, 0, 1, 1 ], - "color": [ 1, 1, 1, 0.1 ], - "location": "", - "scaling": "relative", - "text settings": { - "stroke": [ 1, 0.749, 0.368, 1 ], - "color": [ 1, 0.749, 0.368, 1 ], - - "string": "Loading...", - "string1": "コマンド" - } - } -} \ No newline at end of file diff --git a/bin/data/scenes/worldscape/player.json b/bin/data/scenes/worldscape/player.json deleted file mode 100644 index 9c9693a0..00000000 --- a/bin/data/scenes/worldscape/player.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "import": "/player.json", - "metadata": { - "camera1": { - "offset": [ 0, 0, 0 ], - "position" : [ 0, 2.75, 0 ], - "invert": [ false, false, false ], - "limit": { - "minima": [ null, -0.4, null ], - "maxima": [ null, 0.4, null ], - "current": [ null, 0, null ] - }, - "ortho": true, - "settings": { - "left": -4, - "right": 4, - "bottom": -4, - "top": 4, - "near": -256, - "far": 4, - "size" : [ 0, 0 ] - } - }, - "": { - "transients": { - "140901": { "id": "140901", "lv": 82, "skin": "skin1" }, - "111901": { "id": "111901", "lv": 89, "skin": "skin8" }, - "123901": { "id": "123901", "lv": 90, "skin": null }, - "111701": { "id": "111701", "lv": 91, "skin": "skin4" }, - - "990101": { "id": "990101", "lv": 86, "str": 28, "mag": 39, "vit": 28, "agi": 33, "luk": 20, "skin": null }, - "990201": { "id": "990201", "lv": 87, "skin": null }, - "800101": { "id": "800101", "lv": 88, "skin": null }, - - "990202": { "id": "990202", "lv": 85, "skin": null }, - - "113501": { "id": "113501", "lv": 84, "skin": "skin1" }, - "145801": { "id": "145801", "lv": 90, "skin": null }, - "112101": { "id": "112101", "lv": 90, "skin": "skin5" }, - "113801": { "id": "113801", "lv": 92, "skin": "skin1" }, - "114601": { "id": "114601", "lv": 88, "skin": "skin1" } - }, - "party": [ "123901", "140901", "111901" ] - // "party": [ "123901", "140901", "111701", "111901" ] - // "party": [ "123901", "140901", "990101", "111901" ] - // "party": [ "123901", "140901", "990101", "111901" ] - // "party": [ "990101", "123901", "990202", "800101" ] - } - } -} \ No newline at end of file diff --git a/bin/data/scenes/worldscape/pongy.json b/bin/data/scenes/worldscape/pongy.json deleted file mode 100644 index d96a5225..00000000 --- a/bin/data/scenes/worldscape/pongy.json +++ /dev/null @@ -1,135 +0,0 @@ -{ - "type": "Object", - "behaviors": [ - "CraetureBehavior", - "HousamoSpriteBehavior" - ], - "ignore": false, - "transform": { - "position": [ 0, 0, 0 ], - "rotation": { - "axis": [ 0, 1, 0 ], - "angle": 0.0 - }, - "scale": [ 3, 4.2375, 1 ] - }, - "system": { - "hot reload": { - "enabled": true - } - }, - "physics": { - "collision": false, - "gravity": [ 0, -9.81, 0 ], - "walk": 1, - "move": 4, - "run": 8, - "rotate": 1.25, - "crouch": 1, - "jump": [ 0, 4, 0 ] - }, - "metadata": { - "color": [ 1, 1, 1, 1 ], - "region": { - "track": true, - "persist": false - }, - "": { - "party": ["990401"], - "transients": { "990401": { "id": "990401", "lv": 120 } } - }, - "system": { - "onCollision": "npc" - }, - "dialogue": { - "quit": { - "message": "", - "quit": true - }, - "0": { - "message": "Ahh, welcome to the Velvet Room.", - "music": "./data/audio/overworld/poem.ogg", - "voice": { - "id": "990401", - "key": "greeting" - }, - "actions": { - "1": "Fuse Transients", - "2": "Check requests/compendium", - "3": "Talk", - "4": "Battle", - "quit": "Leave" - } - }, - "1": { - "message": "[Fusion]", - "actions": { - "quit": "" - }, - "hooks": [ - { - "name": "menu:Pause", - "payload": {}, - "timeout": 1 - }, - { - "name": "menu:Dialogue.Turn.%UID%", - "payload": { - "index": "quit" - }, - "timeout": 1 - } - ] - }, - "2": { - "message": "[Compendium]", - "actions": { - "quit": "" - } - }, - "3": { - "message": "Oh, so you came? It's a little messy in here but...\nwell, sit wherever.\nI can get you some coffee at least.", - "actions": { - "quit": "" - } - }, - "4": { - "message": "Don't get hurt.", - "voice": { - "id": "113801", - "key": "attack" - }, - "actions": { - "quit": "" - }, - "hooks": [ - { - "name": "world:Battle.Prepare", - "payload": { - "": { "party": ["990401"], "transients": { "990401": { - "id": "990401", "lv": 110, "hp": 5000, "max hp": 5000, "mp": 1000, "max mp": 1000, "skin": null, - "skills": [ "71", "83", "91", "127", "143", "153", "52" ] - } } }, - "music": "./data/audio/battle/strength.ogg" - }, - "timeout": 2 - }, - { - "name": "world:Entity.LoadAsset-0", - "payload": { - "asset": "./data/smtsamo/fg/fg_hellbiker01.png" - }, - "timeout": 2 - }, - { - "name": "menu:Dialogue.Turn.%UID%", - "payload": { - "index": "quit" - }, - "timeout": 2 - } - ] - } - } - } -} \ No newline at end of file diff --git a/bin/data/scenes/worldscape/region.json b/bin/data/scenes/worldscape/region.json deleted file mode 100644 index 43bfeae7..00000000 --- a/bin/data/scenes/worldscape/region.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "Region", - "type": "Object", - "behaviors": [ - "RegionBehavior" - ], - "ignore": false, - "transform": { - "position": [ 0, 0, 0 ], - "rotation": { - "axis": [ 1, 0, 0 ], - "angle": 0 - } - } -} \ No newline at end of file diff --git a/bin/data/scenes/worldscape/scene.json b/bin/data/scenes/worldscape/scene.json deleted file mode 100644 index fe8b30a7..00000000 --- a/bin/data/scenes/worldscape/scene.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "name": "World", - "type": "Scene", - "behaviors": [ - "SceneCollisionBehavior", - "SceneBehavior", - "ExtSceneBehavior", - "WorldScapeSceneBehavior" - ], - "assets": [ - "./terrain.json", - "/gui.json", - "/player.json", - "/portal.json", - // "/overworld/largemap.ogg" - "/overworld/dungeon_intro.ogg" - ], - "system": { - "hot reload": { - "enabled": true - }, - "renderer": { - "clear values": [ - [ 0, 0, 0, 0 ] - ] - }, - "physics": { - "collision": true, - "single threaded": false, - "sort": false, - "use": { - "strongest": false, - "worker": true, - "queue": false - }, - "optimizations": { - "ignore static entities": true, - "ignore duplicate tests": true, - "entity-local update": true - } - } - }, - "metadata": { - "menus": { - "pause": "/gui/pause/menu.json" - }, - "volumes": { - "sfx": 0.25, - "bgm": 0.15, - "voice": 1.0 - }, - "shaders": { - // "sprite": { "suffix": "dither4" }, - // "gui": { "suffix": "dither4" }, - // "region": { "suffix": "dither4" } - }, - "light": { - "ambient": [ 0.4, 0.4, 0.4 ], - "kexp": 0, - "fog": { - "color": [ 0.01, 0.01, 0.01 ], - "range": [ 4, 24 ] - }, - "should": true - } - } -} \ No newline at end of file diff --git a/bin/data/scenes/worldscape/shiro.json b/bin/data/scenes/worldscape/shiro.json deleted file mode 100644 index 4b3dbcd4..00000000 --- a/bin/data/scenes/worldscape/shiro.json +++ /dev/null @@ -1,127 +0,0 @@ -{ - "type": "Object", - "behaviors": [ - "CraetureBehavior", - "HousamoSpriteBehavior" - ], - "ignore": false, - "transform": { - "position": [ 0, 0, 0 ], - "rotation": { - "axis": [ 0, 1, 0 ], - "angle": 0.0 - }, - "scale": [ 3, 4.2375, 1 ] - }, - "system": { - "hot reload": { - "enabled": true - } - }, - "physics": { - "collision": false, - "gravity": [ 0, -9.81, 0 ], - "walk": 1, - "move": 4, - "run": 8, - "rotate": 1.25, - "crouch": 1, - "jump": [ 0, 4, 0 ] - }, - "metadata": { - "color": [ 1, 1, 1, 1 ], - "region": { - "track": true, - "persist": false - }, - "": { - "party": ["990301"], - "transients": { "990301": { "id": "990301", "lv": 120 } } - }, - "system": { - "onCollision": "npc" - }, - "dialogue": { - "quit": { - "message": "", - "quit": true - }, - "0": { - "message": "Welcome to the Velvet Room.\nHow may I help you today?", - "music": "./data/audio/overworld/poem.ogg", - "actions": { - "1": "Fuse Transients", - "2": "Check requests/compendium", - "3": "Talk", - "4": "Battle", - "quit": "Leave" - } - }, - "1": { - "message": "[Fusion]", - "actions": { - "quit": "" - }, - "hooks": [ - { - "name": "menu:Pause", - "payload": {}, - "timeout": 1 - }, - { - "name": "menu:Dialogue.Turn.%UID%", - "payload": { - "index": "quit" - }, - "timeout": 1 - } - ] - }, - "2": { - "message": "[Compendium]", - "actions": { - "quit": "" - } - }, - "3": { - "message": "Should I have worn pants after all?", - "actions": { - "quit": "" - } - }, - "4": { - "message": "[Battle]", - "actions": { - "quit": "" - }, - "hooks": [ - { - "name": "world:Battle.Prepare", - "payload": { - "": { "party": ["990301"], "transients": { "990301": { - "id": "990301", "lv": 90, "hp": 5000, "max hp": 5000, "mp": 1000, "max mp": 1000, "skin": null, - "skills": [ "0", "517", "76", "515", "514", "200" ] - } } }, - "music": "./data/audio/battle/strength.ogg" - }, - "timeout": 2 - }, - { - "name": "world:Entity.LoadAsset-0", - "payload": { - "asset": "./data/smtsamo/fg/fg_hellbiker01.png" - }, - "timeout": 2 - }, - { - "name": "menu:Dialogue.Turn.%UID%", - "payload": { - "index": "quit" - }, - "timeout": 2 - } - ] - } - } - } -} \ No newline at end of file diff --git a/bin/data/scenes/worldscape/terrain.json b/bin/data/scenes/worldscape/terrain.json deleted file mode 100644 index 1da514f3..00000000 --- a/bin/data/scenes/worldscape/terrain.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "type": "Terrain", - "ignore": false, - "transform": { - "position": [ 0, 0, 0 ], - "rotation": { - "axis": [ 0, 1, 0 ], - "angle": 0.0 - } - }, - "assets": [ - "/texture.png" - ], - "metadata": { - "terrain": { - "radius": [ 2, 1, 2 ], - "load limiter": 15, - "seed": "penisland", - "unified": false - }, - "region": { - "size": [ 24, 12, 24 ], - "modulus": 1, - "subdivisions": 1, - "lights": { - "should": true, - "rate": 0.001 - }, - "": { - "should": true, - "NPCs": true, - "rate": 0.3, - "amount": 1, - "list": [ - // { "party": ["113501"], "transients": { "113501": { "id": "113501", "lv": 90, "skin": "skin4" } } }, - { "party": ["111701"], "transients": { "111701": { "id": "111701", "lv": 90, "skin": null } } }, - { "party": ["111701"], "transients": { "111701": { "id": "111701", "lv": 90, "skin": "skin4" } } }, - { "party": ["145801"], "transients": { "145801": { "id": "145801", "lv": 90, "skin": null } } }, - { "party": ["112101"], "transients": { "112101": { "id": "112101", "lv": 90, "skin": "skin4" } } }, - { "party": ["112101"], "transients": { "112101": { "id": "112101", "lv": 90, "skin": "skin5" } } }, - { "party": ["113801"], "transients": { "113801": { "id": "113801", "lv": 90, "skin": "skin1" } } }, - { "party": ["140901"], "transients": { "140901": { "id": "140901", "lv": 90, "skin": null } } }, - { "party": ["140901"], "transients": { "140901": { "id": "140901", "lv": 90, "skin": "skin1" } } }, - { "party": ["114601"], "transients": { "114601": { "id": "114601", "lv": 90, "skin": "skin1" } } }, - { "party": ["123901"], "transients": { "123901": { "id": "123901", "lv": 90, "skin": null } }}, - { "party": ["123901"], "transients": { "123901": { "id": "123901", "lv": 90, "skin": "skin1" } }}, - { "party": ["123901"], "transients": { "123901": { "id": "123901", "lv": 90, "skin": "skin2" } }}, - { "party": ["111901"], "transients": { "111901": { "id": "111901", "lv": 90, "skin": null } }}, - { "party": ["139101"], "transients": { "139101": { "id": "139101", "lv": 90, "skin": null } }}, - { "party": ["139101"], "transients": { "139101": { "id": "139101", "lv": 90, "skin": null } }} - ], - // "music": "https://cdn..xyz//utage_enc/Android/sound/bgm/bgm_benten.ogg" - "music": [ - "./data/audio/battle/normal_intro.ogg", - "./data/audio/battle/unavoidable.ogg", - "./data/audio/battle/boss.ogg", - "./data/audio/battle/shadow_intro.ogg", - "./data/audio/battle/street.ogg" - ] - } - } - } -} \ No newline at end of file diff --git a/client/client/ext.cpp b/client/client/ext.cpp index 74f1c7ac..2f935d59 100644 --- a/client/client/ext.cpp +++ b/client/client/ext.cpp @@ -101,6 +101,8 @@ void client::initialize() { } ); uf::hooks.addHook( "window:Resized", [&](const ext::json::Value& json){ pod::Vector2i size = uf::vector::decode( json["window"]["size"], pod::Vector2i{} ); + if ( size.x == uf::renderer::settings::width && size.y == uf::renderer::settings::height ) return; + if ( json["invoker"] != "os" ) client::window.setSize(size); // Update viewport if ( !ext::json::isArray( client::config["engine"]["ext"]["vulkan"]["framebuffer"]["size"] ) ) { @@ -108,7 +110,6 @@ void client::initialize() { uf::renderer::settings::width = size.x * scale; uf::renderer::settings::height = size.y * scale; } - uf::renderer::states::resized = true; } ); } diff --git a/engine/inc/uf/engine/instantiator/instantiator.inl b/engine/inc/uf/engine/instantiator/instantiator.inl index 2ec88cee..1f98d9c4 100644 --- a/engine/inc/uf/engine/instantiator/instantiator.inl +++ b/engine/inc/uf/engine/instantiator/instantiator.inl @@ -52,7 +52,9 @@ template void uf::instantiator::registerObject( const std::string& n .behaviors = {} }); - if ( UF_INSTANTIATOR_ANNOUNCE ) UF_DEBUG_MSG("Registered instantiation for " << name); + #if UF_INSTANTIATOR_ANNOUNCE + UF_MSG_DEBUG("Registered instantiation for " << name); + #endif } #if 0 template void uf::instantiator::registerBehavior( const std::string& name ) { @@ -66,7 +68,9 @@ template void uf::instantiator::registerBehavior( const std::string& .destroy = T::destroy, }); - if ( UF_INSTANTIATOR_ANNOUNCE ) UF_DEBUG_MSG("Registered behavior for " << name); + #if UF_INSTANTIATOR_ANNOUNCE + UF_MSG_DEBUG("Registered behavior for " << name); + #endif } #endif template void uf::instantiator::registerBinding( const std::string& name ) { @@ -75,7 +79,9 @@ template void uf::instantiator::registerBinding( const std::string& auto& instantiator = container.get(); instantiator.behaviors.emplace_back(name); - if ( UF_INSTANTIATOR_ANNOUNCE ) UF_DEBUG_MSG("Registered binding for " << name); + #if UF_INSTANTIATOR_ANNOUNCE + UF_MSG_DEBUG("Registered binding for " << name); + #endif } template diff --git a/engine/inc/uf/ext/oal/oal.h b/engine/inc/uf/ext/oal/oal.h index 9065d85e..9428396a 100644 --- a/engine/inc/uf/ext/oal/oal.h +++ b/engine/inc/uf/ext/oal/oal.h @@ -13,11 +13,11 @@ #define AL_CHECK_RESULT(f) {\ (f);\ ALCenum error = alGetError();\ - if ( error != AL_NO_ERROR ) UF_DEBUG_MSG("AL error: " << ext::al::getError(error) << ": " << #f);\ + if ( error != AL_NO_ERROR ) UF_MSG_ERROR("AL error: " << ext::al::getError(error) << ": " << #f);\ } // std::string errorString = alutGetErrorString(alutGetError()); -// if ( errorString != "No ALUT error found" ) UF_DEBUG_MSG("AL error: " << errorString); +// if ( errorString != "No ALUT error found" ) UF_MSG_ERROR("AL error: " << errorString); #include "source.h" #include "buffer.h" diff --git a/engine/inc/uf/ext/opengl/ogl.h b/engine/inc/uf/ext/opengl/ogl.h index eacee951..442d52c2 100644 --- a/engine/inc/uf/ext/opengl/ogl.h +++ b/engine/inc/uf/ext/opengl/ogl.h @@ -45,7 +45,7 @@ #define UF_USE_OPENGL_IMMEDIATE_MODE 0 -#define GL_DEBUG_MESSAGE(...) UF_DEBUG_MSG(__VA_ARGS__); +#define GL_DEBUG_MESSAGE(...) UF_MSG_ERROR(__VA_ARGS__); #define GL_VALIDATION_MESSAGE(...) if ( ext::opengl::settings::validation ) GL_DEBUG_MESSAGE(__VA_ARGS__); #if UF_ENV_DREAMCAST diff --git a/engine/inc/uf/ext/vulkan/graphic.h b/engine/inc/uf/ext/vulkan/graphic.h index fff21156..12943c3b 100644 --- a/engine/inc/uf/ext/vulkan/graphic.h +++ b/engine/inc/uf/ext/vulkan/graphic.h @@ -23,7 +23,11 @@ namespace ext { VkDescriptorSet descriptorSet; GraphicDescriptor descriptor; - uf::Serializer metadata; + struct { + uf::Serializer json; + + std::string type = ""; + } metadata; void initialize( Graphic& graphic ); void initialize( Graphic& graphic, GraphicDescriptor& descriptor ); @@ -41,7 +45,10 @@ namespace ext { std::vector samplers; std::vector textures; std::vector shaders; - uf::Serializer metadata; + + struct { + uf::Serializer json; + } metadata; void initialize( Device& device ); void destroy(); @@ -60,7 +67,7 @@ namespace ext { bool initialized = false; bool process = true; Material material; - std::unordered_map pipelines; + std::unordered_map pipelines; ~Graphic(); void initialize( const std::string& = "" ); diff --git a/engine/inc/uf/ext/vulkan/rendermode.h b/engine/inc/uf/ext/vulkan/rendermode.h index 84cc66fe..b8c70839 100644 --- a/engine/inc/uf/ext/vulkan/rendermode.h +++ b/engine/inc/uf/ext/vulkan/rendermode.h @@ -14,7 +14,23 @@ namespace ext { bool rebuild = false; uint32_t width = 0; uint32_t height = 0; - uf::Serializer metadata; + struct { + uf::Serializer json; + + std::string name = ""; + std::string type = ""; + std::string target = ""; + std::vector outputs; + + uint8_t subpasses = 1; + uint8_t samples = 1; + uint8_t eyes = 1; + + size_t lightBufferIndex = 0; + size_t materialBufferIndex = 0; + size_t textureBufferIndex = 0; + size_t drawCallBufferIndex = 0; + } metadata; Device* device = VK_NULL_HANDLE; RenderTarget renderTarget; @@ -43,7 +59,6 @@ namespace ext { virtual commands_container_t& getCommands( std::thread::id ); virtual GraphicDescriptor bindGraphicDescriptor( const GraphicDescriptor&, size_t = 0 ); - virtual void bindGraphicPushConstants( ext::vulkan::Graphic*, size_t = 0 ); virtual void initialize( Device& device ); virtual void createCommandBuffers(); diff --git a/engine/inc/uf/ext/vulkan/shader.h b/engine/inc/uf/ext/vulkan/shader.h index 8c60e7a8..f998fcc0 100644 --- a/engine/inc/uf/ext/vulkan/shader.h +++ b/engine/inc/uf/ext/vulkan/shader.h @@ -32,7 +32,12 @@ namespace ext { std::vector specializationMapEntries; VkSpecializationInfo specializationInfo; - uf::Serializer metadata; + struct { + uf::Serializer json; + + std::string pipeline = ""; + std::string type = ""; + } metadata; ext::vulkan::userdata_t specializationConstants; std::vector pushConstants; diff --git a/engine/inc/uf/ext/vulkan/vk.h b/engine/inc/uf/ext/vulkan/vk.h index e10c05a7..eac4155c 100644 --- a/engine/inc/uf/ext/vulkan/vk.h +++ b/engine/inc/uf/ext/vulkan/vk.h @@ -9,16 +9,12 @@ #include #include -#define VK_DEBUG_MESSAGE(...) UF_DEBUG_MSG(__VA_ARGS__); +#define VK_DEBUG_MESSAGE(...) UF_MSG_ERROR(__VA_ARGS__); #define VK_VALIDATION_MESSAGE(...) if ( ext::vulkan::settings::validation ) VK_DEBUG_MESSAGE(__VA_ARGS__); -#define VK_CHECK_RESULT(f) { \ - VkResult res = (f); \ - if (res != VK_SUCCESS) { \ - std::string errorString = ext::vulkan::errorString( res ); \ - VK_DEBUG_MESSAGE(errorString); \ - UF_EXCEPTION(errorString); \ - } \ +#define VK_CHECK_RESULT(f) {\ + VkResult res = (f);\ + if (res != VK_SUCCESS) UF_EXCEPTION(ext::vulkan::errorString( res ));\ } #define VK_FLAGS_NONE 0 diff --git a/engine/inc/uf/macros.h b/engine/inc/uf/macros.h index 64f12420..0713829e 100644 --- a/engine/inc/uf/macros.h +++ b/engine/inc/uf/macros.h @@ -5,7 +5,9 @@ #define TIMER(x, ...) auto TOKEN_PASTE(TIMER, __LINE__) = []( double every = 1 ) {\ static uf::Timer timer(false);\ - if ( !timer.running() ) timer.start();\ + if ( !timer.running() ) {\ + timer.start(uf::Time(-x, uf::Time::seconds));\ + }\ double time = 0;\ if ( (time = timer.elapsed().asDouble()) >= every ) {\ timer.reset();\ @@ -20,21 +22,31 @@ #include #include #endif -#define UF_MSG(X) std::cout << __FILE__ << ":" << __FUNCTION__ << "@" << __LINE__ << ": " << X << std::endl; -#define UF_MSG_DEBUG(X) if ( UF_DEBUG ) UF_MSG(X); -#define UF_DEBUG_PRINT_MARKER() UF_MSG_DEBUG(""); +// uf::iostream +#define UF_IO_COUT std::cout +// "\n" +#define UF_IO_ENDL std::endl -#define UF_MSG_INFO(X) UF_MSG_DEBUG("[ INFO ] " << X); -#define UF_MSG_WARNING(X) UF_MSG_DEBUG("[WARNING] " << X); -#define UF_MSG_ERROR(X) UF_MSG_DEBUG("[ ERROR ] " << X); +#define UF_MSG(Y, X) UF_IO_COUT << "[" << X << "] " << __FILE__ << ":" << __FUNCTION__ << "@" << __LINE__ << ": " << Y << UF_IO_ENDL; + +#define UF_MSG_DEBUG(X) if (UF_DEBUG) UF_MSG(X, " DEBUG "); +#define UF_MSG_INFO(X) UF_MSG(X, " INFO "); +#define UF_MSG_WARNING(X) UF_MSG(X, " WARNING "); +#define UF_MSG_ERROR(X) UF_MSG(X, " ERROR "); #if UF_NO_EXCEPTIONS - #define UF_EXCEPTION(X) UF_ERROR_MSG(X) + #define UF_EXCEPTION(X) UF_MSG_ERROR(X) #else - #define UF_EXCEPTION(X) throw std::runtime_error(X) + #define UF_EXCEPTION(X) { UF_MSG_ERROR(X); throw std::runtime_error(X); } #endif +#define UF_ASSERT_BREAK(condition, ...) if ( !(condition) ) { UF_MSG_ERROR("Assert failed: " << #condition); break; } +#define UF_ASSERT_SAFE(condition) if ( !(condition) ) { UF_MSG_ERROR("Assertion failed: " << #condition); } + +#define UF_ASSERT_BREAK_MSG(condition, ...) if ( !(condition) ) { UF_MSG_ERROR("Assert failed: " << #condition << " " << __VA_ARGS__); break; } +#define UF_ASSERT_SAFE_MSG(condition, ...) if ( !(condition) ) { UF_MSG_ERROR("Assertion failed: " << #condition << " " << __VA_ARGS__); } + #define UF_TIMER_TRACE_INIT() uf::Timer TIMER_TRACE; #define UF_TIMER_TRACE(X) {\ @@ -61,8 +73,5 @@ #define UF_TIMER_MULTITRACE_END(X) UF_MSG_DEBUG(X); -// alias -#define UF_DEBUG_MSG(X) UF_MSG_DEBUG(X); - #define MIN(X, Y) X < Y ? X : Y #define MAX(X, Y) X > Y ? X : Y \ No newline at end of file diff --git a/engine/inc/uf/utils/graphic/descriptor.h b/engine/inc/uf/utils/graphic/descriptor.h index 37e89a9b..224e1073 100644 --- a/engine/inc/uf/utils/graphic/descriptor.h +++ b/engine/inc/uf/utils/graphic/descriptor.h @@ -50,6 +50,12 @@ namespace uf { namespace ext { namespace RENDERER { struct UF_API GraphicDescriptor { + #if UF_GRAPHIC_DESCRIPTOR_USE_STRING + typedef std::string hash_t; + #else + typedef size_t hash_t; + #endif + std::string renderMode = ""; std::string pipeline = ""; @@ -82,7 +88,7 @@ namespace ext { } bias; } depth; bool invalidated = false; - std::string hash() const; + hash_t hash() const; void parse( ext::json::Value& ); bool operator==( const GraphicDescriptor& right ) const { return this->hash() == right.hash(); } }; diff --git a/engine/inc/uf/utils/math/quaternion.h b/engine/inc/uf/utils/math/quaternion.h index 37a44853..ec3282dd 100644 --- a/engine/inc/uf/utils/math/quaternion.h +++ b/engine/inc/uf/utils/math/quaternion.h @@ -27,7 +27,7 @@ namespace uf { template bool /*UF_API*/ equals( const T& left, const T& right ); // Equality check between two vectors (equals) // Basic arithmetic template T /*UF_API*/ multiply( const T& left, const T& right ); // Multiplies two vectors of same type and size together - template pod::Quaternion /*UF_API*/ identity(); // Multiplies two vectors of same type and size together + template pod::Quaternion /*UF_API*/ identity(); // Multiplies two vectors of same type and size together template pod::Vector3t /*UF_API*/ rotate( const pod::Quaternion& left, const pod::Vector3t& right ); // Multiplies two vectors of same type and size together template pod::Vector4t /*UF_API*/ rotate( const pod::Quaternion& left, const pod::Vector4t& right ); // Multiplies two vectors of same type and size together template typename T::type_t /*UF_API*/ sum( const T& vector ); // Compute the sum of all components @@ -41,11 +41,11 @@ namespace uf { template typename T::type_t /*UF_API*/ dot( const T& left, const T& right ); // Compute the dot product between two vectors template pod::Angle /*UF_API*/ angle( const T& a, const T& b ); // Compute the angle between two vectors - template T /*UF_API*/ lerp( const T& from, const T& to, double delta ); // Linearly interpolate between two vectors - template T /*UF_API*/ slerp( const T& from, const T& to, double delta ); // Spherically interpolate between two vectors + template T /*UF_API*/ lerp( const T& from, const T& to, typename T::type_t delta ); // Linearly interpolate between two vectors + template T /*UF_API*/ slerp( const T& from, const T& to, typename T::type_t delta ); // Spherically interpolate between two vectors - template typename T::type_t /*UF_API*/ distanceSquared( const T& a, const T& b ); // Gets the magnitude of the vector - template typename T::type_t /*UF_API*/ distance( const T& a, const T& b ); // Gets the magnitude of the vector + template typename T::type_t /*UF_API*/ distanceSquared( const T& a, const T& b ); // Gets the magnitude of the vector + template typename T::type_t /*UF_API*/ distance( const T& a, const T& b ); // Gets the magnitude of the vector template typename T::type_t /*UF_API*/ magnitude( const T& vector ); // Gets the magnitude of the vector template typename T::type_t /*UF_API*/ norm( const T& vector ); // Compute the norm of the vector template T /*UF_API*/ normalize( const T& vector ); // Normalizes a vector @@ -120,8 +120,8 @@ public: inline T dot( const Quaternion right ) const; // Compute the dot product between two quaternions inline pod::Angle angle( const Quaternion& b ) const; // Compute the angle between two quaternions - inline uf::Quaternion lerp( const Quaternion to, double delta ) const; // Linearly interpolate between two quaternions - inline uf::Quaternion slerp( const Quaternion to, double delta ) const; // Spherically interpolate between two quaternions + inline uf::Quaternion lerp( const Quaternion to, typename T::type_t delta ) const; // Linearly interpolate between two quaternions + inline uf::Quaternion slerp( const Quaternion to, typename T::type_t delta ) const; // Spherically interpolate between two quaternions inline T distanceSquared( const Quaternion b ) const; // Compute the distance between two quaternions (doesn't sqrt) inline T distance( const Quaternion b ) const; // Compute the distance between two quaternions diff --git a/engine/inc/uf/utils/math/quaternion/class.inl b/engine/inc/uf/utils/math/quaternion/class.inl index 00dd3c9b..b9a00260 100644 --- a/engine/inc/uf/utils/math/quaternion/class.inl +++ b/engine/inc/uf/utils/math/quaternion/class.inl @@ -128,12 +128,12 @@ inline pod::Angle uf::Quaternion::angle( const Quaternion& b ) const { // Linearly interpolate between two quaternions template -inline uf::Quaternion uf::Quaternion::lerp( const Quaternion to, double delta ) const { +inline uf::Quaternion uf::Quaternion::lerp( const Quaternion to, typename T::type_t delta ) const { return uf::quaternion::lerp( this->m_pod, to.m_pod, delta ); } // Spherically interpolate between two quaternions template -inline uf::Quaternion uf::Quaternion::slerp( const Quaternion to, double delta ) const { +inline uf::Quaternion uf::Quaternion::slerp( const Quaternion to, typename T::type_t delta ) const { return uf::quaternion::slerp( this->m_pod, to.m_pod, delta ); } diff --git a/engine/inc/uf/utils/math/quaternion/pod.inl b/engine/inc/uf/utils/math/quaternion/pod.inl index b7e4f460..c362b269 100644 --- a/engine/inc/uf/utils/math/quaternion/pod.inl +++ b/engine/inc/uf/utils/math/quaternion/pod.inl @@ -44,7 +44,7 @@ template T& uf::quaternion::multiply( T& left, const T& right ) { template pod::Vector3t uf::quaternion::rotate( const pod::Quaternion& left, const pod::Vector3t& right ) { pod::Vector3t qVec = { left.x, left.y, left.z }; T s = left.w; - return uf::vector::multiply( qVec, 2 * uf::vector::dot( qVec, right ) ) + uf::vector::multiply( right, s*s - uf::vector::dot( qVec, qVec )) + ( uf::vector::cross( qVec, right ) * 2 * s ); + return uf::vector::multiply( qVec, static_cast(2) * uf::vector::dot( qVec, right ) ) + uf::vector::multiply( right, s*s - uf::vector::dot( qVec, qVec )) + ( uf::vector::cross( qVec, right ) * static_cast(2) * s ); } template pod::Vector4t uf::quaternion::rotate( const pod::Quaternion& left, const pod::Vector4t& right ) { pod::Vector3t vector = uf::quaternion::rotate( left, {right.x, right.y, right.z} ); @@ -112,28 +112,21 @@ template T uf::quaternion::roll( const pod::Quaternion& q ) { } // Linearly interpolate between two quaternions -template T uf::quaternion::lerp( const T& from, const T& to, double delta ) { +template T uf::quaternion::lerp( const T& from, const T& to, typename T::type_t delta ) { return uf::vector::lerp( from, to, delta ); } // Spherically interpolate between two quaternions -template T uf::quaternion::slerp( const T& x, const T& y, double a ) { -// return uf::vector::slerp( from, to, delta ); +template T uf::quaternion::slerp( const T& x, const T& y, typename T::type_t a ) { T z = y; - auto cosTheta = uf::quaternion::dot( x, y ); - - // If cosTheta < 0, the interpolation will take the long way around the sphere. - // To fix this, one quat must be negated. if( cosTheta < 0 ) { z = -y; cosTheta = -cosTheta; } - - // Perform a linear interpolation when cosTheta is close to 1 to avoid side effect of sin(angle) becoming a zero denominator if( cosTheta > 1 - std::numeric_limits::epsilon() ) return uf::vector::mix( x, z, a ); - // Essential Mathematics, page 467 typename T::type_t angle = acos(cosTheta); - return (x * sin((1 - a) * angle) + z * sin(a * angle)) / sin(angle); + return uf::vector::divide( uf::vector::add(uf::vector::multiply(x, sin(static_cast(1) - a * angle)), uf::vector::multiply(z, sin(a * angle))), sin(angle) ); +// return (x * sin((static_cast(1) - a) * angle) + z * sin(a * angle)) / sin(angle); } // Compute the distance between two quaternions (doesn't sqrt) diff --git a/engine/inc/uf/utils/mesh/mesh.h b/engine/inc/uf/utils/mesh/mesh.h index 7889d779..3f172494 100644 --- a/engine/inc/uf/utils/mesh/mesh.h +++ b/engine/inc/uf/utils/mesh/mesh.h @@ -23,9 +23,11 @@ namespace uf { class /*UF_API*/ BaseMesh : public BaseGeometry { public: typedef T vertex_t; - typedef U indices_t; + typedef U index_t; + typedef vertex_t vertices_t; + typedef index_t indices_t; std::vector vertices; - std::vector indices; + std::vector indices; void initialize( size_t = SIZE_MAX ); void destroy(); diff --git a/engine/inc/uf/utils/mesh/mesh.inl b/engine/inc/uf/utils/mesh/mesh.inl index 00440a5a..6b14ba80 100644 --- a/engine/inc/uf/utils/mesh/mesh.inl +++ b/engine/inc/uf/utils/mesh/mesh.inl @@ -29,7 +29,7 @@ void uf::BaseMesh::expand( bool check ) { } // invalid index, mark cache as invalid if ( index >= _vertices.size() ) { - UF_DEBUG_MSG("Invalid index: Max: " << _vertices.size() << "\tGot: " << index); + UF_MSG_DEBUG("Invalid index: Max: " << _vertices.size() << "\tGot: " << index); valid = false; cache.emplace_back( cache.empty() ? vertex_t{} : cache.back() ); continue; diff --git a/engine/src/engine/asset/asset.cpp b/engine/src/engine/asset/asset.cpp index 67f74251..902e0c97 100644 --- a/engine/src/engine/asset/asset.cpp +++ b/engine/src/engine/asset/asset.cpp @@ -22,13 +22,13 @@ namespace { bool retrieve( const std::string& url, const std::string& filename, const std::string& hash = "" ) { uf::Http http = uf::http::get( url ); if ( http.code < 200 || http.code > 300 ) { - UF_DEBUG_MSG("HTTP Error " << http.code << " on GET " << url); + UF_MSG_ERROR("HTTP Error " << http.code << " on GET " << url); return false; } std::string actual = hash; if ( hash != "" && (actual = uf::string::sha256(url)) != hash ) { - UF_DEBUG_MSG("HTTP hash mismatch on GET " << url << ": expected " << hash << ", got " << actual); + UF_MSG_ERROR("HTTP hash mismatch on GET " << url << ": expected " << hash << ", got " << actual); return false; } @@ -102,18 +102,18 @@ std::string uf::Asset::cache( const std::string& uri, const std::string& hash, c std::string hash = hashed( uri ); std::string cached = uf::io::root + "/cache/http/" + hash + "." + extension; if ( !uf::io::exists( cached ) && !retrieve( uri, cached, hash ) ) { - UF_DEBUG_MSG("Failed to preload `" + uri + "` (`" + cached + "`): HTTP error"); + UF_MSG_ERROR("Failed to preload `" + uri + "` (`" + cached + "`): HTTP error"); return ""; } filename = cached; } if ( !uf::io::exists( filename ) ) { - UF_DEBUG_MSG("Failed to preload `" + filename + "`: Does not exist"); + UF_MSG_ERROR("Failed to preload `" + filename + "`: Does not exist"); return ""; } std::string actual = hash; if ( hash != "" && (actual = uf::io::hash( filename )) != hash ) { - UF_DEBUG_MSG("Failed to preload `" << filename << "`: Hash mismatch; expected " << hash << ", got " << actual); + UF_MSG_ERROR("Failed to preload `" << filename << "`: Hash mismatch; expected " << hash << ", got " << actual); return ""; } return filename; @@ -125,18 +125,18 @@ std::string uf::Asset::load( const std::string& uri, const std::string& hash, co std::string hash = hashed( uri ); std::string cached = uf::io::root + "/cache/http/" + hash + "." + extension; if ( !uf::io::exists( cached ) && !retrieve( uri, cached, hash ) ) { - UF_DEBUG_MSG("Failed to load `" + uri + "` (`" + cached + "`): HTTP error"); + UF_MSG_ERROR("Failed to load `" + uri + "` (`" + cached + "`): HTTP error"); return ""; } filename = cached; } if ( !uf::io::exists( filename ) ) { - UF_DEBUG_MSG("Failed to load `" + filename + "`: Does not exist"); + UF_MSG_ERROR("Failed to load `" + filename + "`: Does not exist"); return ""; } std::string actual = hash; if ( hash != "" && (actual = uf::io::hash( filename )) != hash ) { - UF_DEBUG_MSG("Failed to load `" << filename << "`: Hash mismatch; expected " << hash << ", got " << actual); + UF_MSG_ERROR("Failed to load `" << filename << "`: Hash mismatch; expected " << hash << ", got " << actual); return ""; } #define UF_ASSET_REGISTER(type)\ @@ -190,12 +190,12 @@ std::string uf::Asset::load( const std::string& uri, const std::string& hash, co asset = uf::graph::load( filename, LOAD_FLAGS, metadata[uri] ); uf::graph::process( asset ); - if ( asset.metadata["debug"]["print stats"].as() ) UF_DEBUG_MSG(uf::graph::stats( asset ).dump(1,'\t')); - if ( asset.metadata["debug"]["print tree"].as() ) UF_DEBUG_MSG(uf::graph::print( asset )); + if ( asset.metadata["debug"]["print stats"].as() ) UF_MSG_INFO(uf::graph::stats( asset ).dump(1,'\t')); + if ( asset.metadata["debug"]["print tree"].as() ) UF_MSG_INFO(uf::graph::print( asset )); if ( !asset.metadata["debug"]["no cleanup"].as() ) uf::graph::cleanup( asset ); //uf::graph::process( asset ); } else { - UF_DEBUG_MSG("Failed to parse `" + filename + "`: Unimplemented extension: " + extension + " or category: " + category ); + UF_MSG_ERROR("Failed to parse `" + filename + "`: Unimplemented extension: " + extension + " or category: " + category ); } return filename; } diff --git a/engine/src/engine/entity/entity.cpp b/engine/src/engine/entity/entity.cpp index b0a3af30..408616e4 100644 --- a/engine/src/engine/entity/entity.cpp +++ b/engine/src/engine/entity/entity.cpp @@ -13,7 +13,7 @@ uf::Entity::~Entity(){ } bool uf::Entity::isValid() const { if ( uf::Entity::memoryPool.size() > 0 && !uf::Entity::memoryPool.exists((void*) this) ) return false; - return this && 0 < this->m_uid && this->m_uid <= uf::Entity::uids; + return this != NULL && (0 < this->m_uid && this->m_uid <= uf::Entity::uids); } void uf::Entity::setUid() { uf::scene::invalidateGraphs(); @@ -78,7 +78,7 @@ void uf::Entity::operator delete( void* pointer ) { } uf::Entity* uf::Entity::findByName( const std::string& name ) { - for ( uf::Entity* entity : this->getChildren() ) { + for ( uf::Entity* entity : this->m_children ) { if ( entity->getName() == name ) return entity; uf::Entity* p = entity->findByName(name); if ( p ) return p; @@ -86,7 +86,7 @@ uf::Entity* uf::Entity::findByName( const std::string& name ) { return (uf::Entity*) NULL; }; uf::Entity* uf::Entity::findByUid( std::size_t id ) { - for ( uf::Entity* entity : this->getChildren() ) { + for ( uf::Entity* entity : this->m_children ) { if ( entity->getUid() == id ) return entity; uf::Entity* p = entity->findByUid(id); if ( p ) return p; @@ -95,7 +95,7 @@ uf::Entity* uf::Entity::findByUid( std::size_t id ) { }; const uf::Entity* uf::Entity::findByName( const std::string& name ) const { - for ( uf::Entity* entity : this->getChildren() ) { + for ( uf::Entity* entity : this->m_children ) { if ( entity->getName() == name ) return entity; uf::Entity* p = entity->findByName(name); if ( p ) return p; @@ -103,7 +103,7 @@ const uf::Entity* uf::Entity::findByName( const std::string& name ) const { return (uf::Entity*) NULL; }; const uf::Entity* uf::Entity::findByUid( std::size_t id ) const { - for ( const uf::Entity* entity : this->getChildren() ) { + for ( const uf::Entity* entity : this->m_children ) { if ( entity->getUid() == id ) return entity; const uf::Entity* p = entity->findByUid(id); if ( p ) return p; @@ -113,14 +113,14 @@ const uf::Entity* uf::Entity::findByUid( std::size_t id ) const { void uf::Entity::process( std::function fn ) { fn(this); - for ( uf::Entity* entity : this->getChildren() ) { + for ( uf::Entity* entity : this->m_children ) { if ( !entity ) continue; entity->process(fn); } } void uf::Entity::process( std::function fn, int depth ) { fn(this, depth); - for ( uf::Entity* entity : this->getChildren() ) { + for ( uf::Entity* entity : this->m_children ) { if ( !entity ) continue; entity->process(fn, depth + 1); } diff --git a/engine/src/engine/graph/graph.cpp b/engine/src/engine/graph/graph.cpp index 52d96459..5fe5ef53 100644 --- a/engine/src/engine/graph/graph.cpp +++ b/engine/src/engine/graph/graph.cpp @@ -50,7 +50,7 @@ namespace { }; auto& specializationConstants = shader.specializationConstants.get(); specializationConstants.passes = uf::renderer::settings::maxViews; - ext::json::forEach( shader.metadata["specializationConstants"], [&]( ext::json::Value& sc ){ + ext::json::forEach( shader.metadata.json["specializationConstants"], [&]( ext::json::Value& sc ){ if ( sc["name"].as() == "PASSES" ) sc["value"] = specializationConstants.passes; }); } @@ -61,11 +61,11 @@ namespace { }; auto& specializationConstants = shader.specializationConstants.get(); specializationConstants.textures = texture2Ds; - ext::json::forEach( shader.metadata["specializationConstants"], [&]( ext::json::Value& sc ){ + ext::json::forEach( shader.metadata.json["specializationConstants"], [&]( ext::json::Value& sc ){ if ( sc["name"].as() == "TEXTURES" ) sc["value"] = specializationConstants.textures; }); - ext::json::forEach( shader.metadata["definitions"]["textures"], [&]( ext::json::Value& t ){ + ext::json::forEach( shader.metadata.json["definitions"]["textures"], [&]( ext::json::Value& t ){ if ( t["name"].as() != "samplerTextures" ) return; size_t binding = t["binding"].as(); for ( auto& layout : shader.descriptorSetLayoutBindings ) { @@ -105,18 +105,12 @@ namespace { size_t maxTextures = texture2Ds; size_t maxCascades = texture3Ds / 4; - ext::json::forEach( shader.metadata["specializationConstants"], [&]( size_t i, ext::json::Value& sc ){ + ext::json::forEach( shader.metadata.json["specializationConstants"], [&]( size_t i, ext::json::Value& sc ){ std::string name = sc["name"].as(); - if ( name == "TEXTURES" ) { - sc["value"] = (specializationConstants[i] = maxTextures); - // sc["value"] = specializationConstants.textures; - } - else if ( name == "CASCADES" ) { - sc["value"] = (specializationConstants[i] = maxCascades); - // sc["value"] = specializationConstants.cascades; - } + if ( name == "TEXTURES" ) sc["value"] = (specializationConstants[i] = maxTextures); + else if ( name == "CASCADES" ) sc["value"] = (specializationConstants[i] = maxCascades); }); - ext::json::forEach( shader.metadata["definitions"]["textures"], [&]( ext::json::Value& t ){ + ext::json::forEach( shader.metadata.json["definitions"]["textures"], [&]( ext::json::Value& t ){ size_t binding = t["binding"].as(); std::string name = t["name"].as(); for ( auto& layout : shader.descriptorSetLayoutBindings ) { @@ -466,7 +460,7 @@ void uf::graph::process( pod::Graph& graph ) { auto center = uf::vector::decode( graph.metadata["grid"]["center"], grid.center() ); auto indices = grid.get<>( center ); graphic.descriptor.indices = indices.size(); - UF_DEBUG_MSG("Center: " << uf::vector::toString(center) << " | Indices: " << indices.size()); + UF_MSG_DEBUG("Center: " << uf::vector::toString(center) << " | Indices: " << indices.size()); int32_t indexBuffer = -1; for ( size_t i = 0; i < graphic.buffers.size(); ++i ) { if ( graphic.buffers[i].usage & uf::renderer::enums::Buffer::INDEX ) indexBuffer = i; @@ -491,8 +485,8 @@ void uf::graph::process( pod::Graph& graph ) { float mass = info["collision"]["mass"].as(); bool dynamic = !info["collision"]["static"].as(); bool recenter = info["collision"]["recenter"].as(); - pod::Vector3f corner = (max - min) * 0.5; - pod::Vector3f center = (max + min) * 0.5; + pod::Vector3f corner = (max - min) * 0.5f; + pod::Vector3f center = (max + min) * 0.5f; #if UF_USE_BULLET if ( type == "mesh" ) { auto& collider = ext::bullet::create( entity->as(), mesh, dynamic ); @@ -513,10 +507,8 @@ void uf::graph::process( pod::Graph& graph ) { } }); -// if ( ext::json::isNull( graph.metadata["extents"]["min"] ) ) - graph.metadata["extents"]["min"] = uf::vector::encode( extentMin * graph.metadata["extents"]["scale"].as(1.0f) ); -// if ( ext::json::isNull( graph.metadata["extents"]["max"] ) ) - graph.metadata["extents"]["max"] = uf::vector::encode( extentMax * graph.metadata["extents"]["scale"].as(1.0f) ); + graph.metadata["extents"]["min"] = uf::vector::encode( extentMin * graph.metadata["extents"]["scale"].as(1.0f) ); + graph.metadata["extents"]["max"] = uf::vector::encode( extentMax * graph.metadata["extents"]["scale"].as(1.0f) ); } void uf::graph::process( pod::Graph& graph, int32_t index, uf::Object& parent ) { auto& node = graph.nodes[index]; @@ -978,29 +970,46 @@ namespace { pod::Skin& decode( ext::json::Value& json, pod::Skin& skin ) { return skin = decodeSkin( json ); } - pod::Graph::Mesh decodeMesh( ext::json::Value& json ) { + pod::Graph::Mesh decodeMesh( ext::json::Value& json, const std::string& directory = "" ) { pod::Graph::Mesh mesh; - mesh.vertices.reserve( json["vertices"].size() ); - ext::json::forEach( json["vertices"], [&]( ext::json::Value& value ){ - auto& vertex = mesh.vertices.emplace_back(); - size_t attr = 0; - vertex.position = uf::vector::decode( value[attr++], pod::Vector3f{} ); - vertex.uv = uf::vector::decode( value[attr++], pod::Vector2f{} ); - vertex.st = uf::vector::decode( value[attr++], pod::Vector2f{} ); - vertex.normal = uf::vector::decode( value[attr++], pod::Vector3f{} ); - vertex.tangent = uf::vector::decode( value[attr++], pod::Vector4f{} ); - vertex.id = uf::vector::decode( value[attr++], pod::Vector2ui{} ); - vertex.joints = uf::vector::decode( value[attr++], pod::Vector4ui{} ); - vertex.weights = uf::vector::decode( value[attr++], pod::Vector4f{} ); - }); - mesh.indices.reserve( json["indices"].size() ); - ext::json::forEach( json["indices"], [&]( ext::json::Value& value ){ - mesh.indices.emplace_back( value.as() ); - }); + if ( json["vertices"].is() ) { + std::string filename = json["vertices"].as(); + auto buffer = uf::io::readAsBuffer( directory + "/" + filename ); + size_t vertices = buffer.size() / sizeof(pod::Graph::Mesh::vertex_t); + mesh.vertices.resize( vertices ); + memcpy( mesh.vertices.data(), buffer.data(), buffer.size() ); + } else if ( ext::json::isArray( json["vertices"] ) ) { + mesh.vertices.reserve( json["vertices"].size() ); + ext::json::forEach( json["vertices"], [&]( ext::json::Value& value ){ + auto& vertex = mesh.vertices.emplace_back(); + size_t attr = 0; + vertex.position = uf::vector::decode( value[attr++], pod::Vector3f{} ); + vertex.uv = uf::vector::decode( value[attr++], pod::Vector2f{} ); + vertex.st = uf::vector::decode( value[attr++], pod::Vector2f{} ); + vertex.normal = uf::vector::decode( value[attr++], pod::Vector3f{} ); + vertex.tangent = uf::vector::decode( value[attr++], pod::Vector4f{} ); + vertex.id = uf::vector::decode( value[attr++], pod::Vector2ui{} ); + vertex.joints = uf::vector::decode( value[attr++], pod::Vector4ui{} ); + vertex.weights = uf::vector::decode( value[attr++], pod::Vector4f{} ); + }); + } + if ( json["indices"].is() ) { + std::string filename = json["indices"].as(); + auto buffer = uf::io::readAsBuffer( directory + "/" + filename ); + size_t indices = buffer.size() / sizeof(pod::Graph::Mesh::index_t); + mesh.indices.resize( indices ); + memcpy( mesh.indices.data(), buffer.data(), buffer.size() ); + + } else if ( ext::json::isArray( json["indices"] ) ) { + mesh.indices.reserve( json["indices"].size() ); + ext::json::forEach( json["indices"], [&]( ext::json::Value& value ){ + mesh.indices.emplace_back( value.as() ); + }); + } return mesh; } - pod::Graph::Mesh& decode( ext::json::Value& json, pod::Graph::Mesh& mesh ) { - return mesh = decodeMesh( json ); + pod::Graph::Mesh& decode( ext::json::Value& json, pod::Graph::Mesh& mesh, const std::string& directory = "" ) { + return mesh = decodeMesh( json, directory ); } pod::Node decodeNode( ext::json::Value& json ) { @@ -1024,18 +1033,20 @@ namespace { pod::Graph uf::graph::load( const std::string& filename, uf::graph::load_mode_t mode, const uf::Serializer& metadata ) { #if UF_ENV_DREAMCAST - #define UF_DEBUG_TRACE_MSG(X) UF_DEBUG_MSG(X); //malloc_stats(); - uf::Timer timer(false); - if ( !timer.running() ) timer.start(); + #define UF_DEBUG_TIMER_MULTITRACE_START(...) UF_TIMER_MULTITRACE_START(__VA_ARGS__) + #define UF_DEBUG_TIMER_MULTITRACE(...) UF_TIMER_MULTITRACE(__VA_ARGS__) + #define UF_DEBUG_TIMER_MULTITRACE_END(...) UF_TIMER_MULTITRACE_END(__VA_ARGS__) #else - #define UF_DEBUG_TRACE_MSG(X) + #define UF_DEBUG_TIMER_MULTITRACE_START(...) + #define UF_DEBUG_TIMER_MULTITRACE(...) + #define UF_DEBUG_TIMER_MULTITRACE_END(...) #endif std::string extension = uf::io::extension( filename ); if ( extension == "glb" || extension == "gltf" ) return ext::gltf::load( filename, mode, metadata ); std::string directory = uf::io::directory( filename ) + "/"; pod::Graph graph; uf::Serializer serializer; - UF_DEBUG_TRACE_MSG("Reading " << filename); + UF_DEBUG_TIMER_MULTITRACE_START("Reading " << filename); serializer.readFromFile( filename ); // load metadata graph.name = filename; //serializer["name"].as(); @@ -1045,43 +1056,43 @@ pod::Graph uf::graph::load( const std::string& filename, uf::graph::load_mode_t std::vector> jobs; jobs.emplace_back([&]{ // load mesh information - UF_DEBUG_TRACE_MSG("Reading meshes..."); + UF_DEBUG_TIMER_MULTITRACE("Reading meshes..."); graph.meshes.reserve( serializer["meshes"].size() ); ext::json::forEach( serializer["meshes"], [&]( ext::json::Value& value ){ auto& mesh = graph.meshes.emplace_back(); if ( value.is() ) { - UF_DEBUG_TRACE_MSG(directory + "/" + value.as()); + UF_DEBUG_TIMER_MULTITRACE(directory + "/" + value.as()); uf::Serializer json; json.readFromFile( directory + "/" + value.as() ); decode( json, mesh ); } else { - decode( value, mesh ); + decode( value, mesh, directory ); } }); return 0; }); jobs.emplace_back([&]{ if ( !ext::json::isNull( serializer["atlas"] ) ) { - UF_DEBUG_TRACE_MSG("Reading atlas..."); + UF_DEBUG_TIMER_MULTITRACE("Reading atlas..."); auto& image = graph.atlas.getAtlas(); auto& value = serializer["atlas"]; if ( value.is() ) { std::string filename = directory + "/" + value.as(); - UF_DEBUG_TRACE_MSG("Reading atlas " << filename); + UF_DEBUG_TIMER_MULTITRACE("Reading atlas " << filename); image.open(filename, false); } else { decode( value, image ); } } // load images - UF_DEBUG_TRACE_MSG("Reading images..."); + UF_DEBUG_TIMER_MULTITRACE("Reading images..."); graph.images.reserve( serializer["images"].size() ); ext::json::forEach( serializer["images"], [&]( ext::json::Value& value ){ auto& image = graph.images.emplace_back(); if ( value.is() ) { std::string filename = directory + "/" + value.as(); - UF_DEBUG_TRACE_MSG("Reading image " << filename); + UF_DEBUG_TIMER_MULTITRACE("Reading image " << filename); image.open(filename, false); } else { decode( value, image ); @@ -1091,7 +1102,7 @@ pod::Graph uf::graph::load( const std::string& filename, uf::graph::load_mode_t }); jobs.emplace_back([&]{ // load texture information - UF_DEBUG_TRACE_MSG("Reading texture information..."); + UF_DEBUG_TIMER_MULTITRACE("Reading texture information..."); graph.textures.reserve( serializer["textures"].size() ); ext::json::forEach( serializer["textures"], [&]( ext::json::Value& value ){ decode( value, graph.textures.emplace_back() ); @@ -1100,7 +1111,7 @@ pod::Graph uf::graph::load( const std::string& filename, uf::graph::load_mode_t }); jobs.emplace_back([&]{ // load sampler information - UF_DEBUG_TRACE_MSG("Reading sampler information..."); + UF_DEBUG_TIMER_MULTITRACE("Reading sampler information..."); graph.samplers.reserve( serializer["samplers"].size() ); ext::json::forEach( serializer["samplers"], [&]( ext::json::Value& value ){ decode( value, graph.samplers.emplace_back() ); @@ -1109,7 +1120,7 @@ pod::Graph uf::graph::load( const std::string& filename, uf::graph::load_mode_t }); jobs.emplace_back([&]{ // load material information - UF_DEBUG_TRACE_MSG("Reading material information..."); + UF_DEBUG_TIMER_MULTITRACE("Reading material information..."); graph.materials.reserve( serializer["materials"].size() ); ext::json::forEach( serializer["materials"], [&]( ext::json::Value& value ){ decode( value, graph.materials.emplace_back() ); @@ -1118,7 +1129,7 @@ pod::Graph uf::graph::load( const std::string& filename, uf::graph::load_mode_t }); jobs.emplace_back([&]{ // load light information - UF_DEBUG_TRACE_MSG("Reading lighting information..."); + UF_DEBUG_TIMER_MULTITRACE("Reading lighting information..."); graph.lights.reserve( serializer["lighting"].size() ); ext::json::forEach( serializer["lighting"], [&]( ext::json::Value& value ){ decode( value, graph.lights.emplace_back() ); @@ -1127,7 +1138,7 @@ pod::Graph uf::graph::load( const std::string& filename, uf::graph::load_mode_t }); jobs.emplace_back([&]{ // load animation information - UF_DEBUG_TRACE_MSG("Reading animation information..."); + UF_DEBUG_TIMER_MULTITRACE("Reading animation information..."); graph.animations.reserve( serializer["animations"].size() ); ext::json::forEach( serializer["animations"], [&]( ext::json::Value& value ){ if ( value.is() ) { @@ -1144,7 +1155,7 @@ pod::Graph uf::graph::load( const std::string& filename, uf::graph::load_mode_t }); jobs.emplace_back([&]{ // load skin information - UF_DEBUG_TRACE_MSG("Reading skinning information..."); + UF_DEBUG_TIMER_MULTITRACE("Reading skinning information..."); graph.skins.reserve( serializer["skins"].size() ); ext::json::forEach( serializer["skins"], [&]( ext::json::Value& value ){ decode( value, graph.skins.emplace_back() ); @@ -1153,7 +1164,7 @@ pod::Graph uf::graph::load( const std::string& filename, uf::graph::load_mode_t }); jobs.emplace_back([&]{ // load node information - UF_DEBUG_TRACE_MSG("Reading nodes..."); + UF_DEBUG_TIMER_MULTITRACE("Reading nodes..."); graph.nodes.reserve( serializer["nodes"].size() ); ext::json::forEach( serializer["nodes"], [&]( ext::json::Value& value ){ decode( value, graph.nodes.emplace_back() ); @@ -1164,71 +1175,71 @@ pod::Graph uf::graph::load( const std::string& filename, uf::graph::load_mode_t if ( !jobs.empty() ) uf::thread::batchWorkers( jobs ); #else // load mesh information - UF_DEBUG_TRACE_MSG("Reading meshes..."); + UF_DEBUG_TIMER_MULTITRACE("Reading meshes..."); graph.meshes.reserve( serializer["meshes"].size() ); ext::json::forEach( serializer["meshes"], [&]( ext::json::Value& value ){ auto& mesh = graph.meshes.emplace_back(); if ( value.is() ) { - UF_DEBUG_TRACE_MSG(directory + "/" + value.as()); + UF_DEBUG_TIMER_MULTITRACE(directory + "/" + value.as()); uf::Serializer json; json.readFromFile( directory + "/" + value.as() ); - decode( json, mesh ); + decode( json, mesh, directory ); } else { - decode( value, mesh ); + decode( value, mesh, directory ); } }); // load images if ( !ext::json::isNull( serializer["atlas"] ) ) { - UF_DEBUG_TRACE_MSG("Reading atlas..."); + UF_DEBUG_TIMER_MULTITRACE("Reading atlas..."); auto& image = graph.atlas.getAtlas(); auto& value = serializer["atlas"]; if ( value.is() ) { std::string filename = directory + "/" + value.as(); - UF_DEBUG_TRACE_MSG("Reading atlas " << filename); + UF_DEBUG_TIMER_MULTITRACE("Reading atlas " << filename); image.open(filename, false); } else { decode( value, image ); } } - UF_DEBUG_TRACE_MSG("Reading images..."); + UF_DEBUG_TIMER_MULTITRACE("Reading images..."); graph.images.reserve( serializer["images"].size() ); ext::json::forEach( serializer["images"], [&]( ext::json::Value& value ){ auto& image = graph.images.emplace_back(); if ( value.is() ) { std::string filename = directory + "/" + value.as(); - UF_DEBUG_TRACE_MSG("Reading image " << filename); + UF_DEBUG_TIMER_MULTITRACE("Reading image " << filename); image.open(filename, false); } else { decode( value, image ); } }); // load texture information - UF_DEBUG_TRACE_MSG("Reading texture information..."); + UF_DEBUG_TIMER_MULTITRACE("Reading texture information..."); graph.textures.reserve( serializer["textures"].size() ); ext::json::forEach( serializer["textures"], [&]( ext::json::Value& value ){ decode( value, graph.textures.emplace_back() ); }); // load sampler information - UF_DEBUG_TRACE_MSG("Reading sampler information..."); + UF_DEBUG_TIMER_MULTITRACE("Reading sampler information..."); graph.samplers.reserve( serializer["samplers"].size() ); ext::json::forEach( serializer["samplers"], [&]( ext::json::Value& value ){ decode( value, graph.samplers.emplace_back() ); }); // load material information - UF_DEBUG_TRACE_MSG("Reading material information..."); + UF_DEBUG_TIMER_MULTITRACE("Reading material information..."); graph.materials.reserve( serializer["materials"].size() ); ext::json::forEach( serializer["materials"], [&]( ext::json::Value& value ){ decode( value, graph.materials.emplace_back() ); }); // load light information - UF_DEBUG_TRACE_MSG("Reading lighting information..."); + UF_DEBUG_TIMER_MULTITRACE("Reading lighting information..."); graph.lights.reserve( serializer["lighting"].size() ); ext::json::forEach( serializer["lighting"], [&]( ext::json::Value& value ){ decode( value, graph.lights.emplace_back() ); }); // load animation information - UF_DEBUG_TRACE_MSG("Reading animation information..."); + UF_DEBUG_TIMER_MULTITRACE("Reading animation information..."); graph.animations.reserve( serializer["animations"].size() ); ext::json::forEach( serializer["animations"], [&]( ext::json::Value& value ){ if ( value.is() ) { @@ -1242,13 +1253,13 @@ pod::Graph uf::graph::load( const std::string& filename, uf::graph::load_mode_t } }); // load skin information - UF_DEBUG_TRACE_MSG("Reading skinning information..."); + UF_DEBUG_TIMER_MULTITRACE("Reading skinning information..."); graph.skins.reserve( serializer["skins"].size() ); ext::json::forEach( serializer["skins"], [&]( ext::json::Value& value ){ decode( value, graph.skins.emplace_back() ); }); // load node information - UF_DEBUG_TRACE_MSG("Reading nodes..."); + UF_DEBUG_TIMER_MULTITRACE("Reading nodes..."); graph.nodes.reserve( serializer["nodes"].size() ); ext::json::forEach( serializer["nodes"], [&]( ext::json::Value& value ){ decode( value, graph.nodes.emplace_back() ); @@ -1258,7 +1269,7 @@ pod::Graph uf::graph::load( const std::string& filename, uf::graph::load_mode_t #if 0 // generate atlas if ( graph.metadata["flags"]["ATLAS"].as() ) { - UF_DEBUG_TRACE_MSG("Generating atlas..."); + UF_DEBUG_TIMER_MULTITRACE("Generating atlas..."); graph.atlas.generate( graph.images ); graph.atlas.clear(false); } @@ -1269,7 +1280,7 @@ pod::Graph uf::graph::load( const std::string& filename, uf::graph::load_mode_t node.transform.reference = &graph.nodes[node.parent].transform; } } - UF_DEBUG_TRACE_MSG("Processing graph..."); + UF_DEBUG_TIMER_MULTITRACE_END("Processing graph..."); return graph; } @@ -1364,7 +1375,7 @@ namespace { json["inverseBindMatrices"].emplace_back( uf::matrix::encode(inverseBindMatrix, compress) ); return json; } - uf::Serializer encode( const pod::Graph::Mesh& mesh, bool compress = false ) { + uf::Serializer encode( const pod::Graph::Mesh& mesh, const std::string& target, bool compress = false ) { uf::Serializer json; ext::json::reserve( json["attributes"], mesh.attributes.descriptor.size() ); for ( auto& attribute : mesh.attributes.descriptor ) { @@ -1376,20 +1387,34 @@ namespace { a["offset"] = attribute.offset; a["components"] = attribute.components; } - ext::json::reserve( json["vertices"], mesh.vertices.size() ); - for ( auto& vertex : mesh.vertices ) { - auto& v = json["vertices"].emplace_back(); - v.emplace_back(!vertex.position ? ext::json::array() : uf::vector::encode(vertex.position, compress)); - v.emplace_back(!vertex.uv ? ext::json::array() : uf::vector::encode(vertex.uv, compress)); - v.emplace_back(!vertex.st ? ext::json::array() : uf::vector::encode(vertex.st, compress)); - v.emplace_back(!vertex.normal ? ext::json::array() : uf::vector::encode(vertex.normal, compress)); - v.emplace_back(!vertex.tangent ? ext::json::array() : uf::vector::encode(vertex.tangent, compress)); - v.emplace_back(!vertex.id ? ext::json::array() : uf::vector::encode(vertex.id, compress)); - v.emplace_back(!vertex.joints ? ext::json::array() : uf::vector::encode(vertex.joints, compress)); - v.emplace_back(!vertex.weights ? ext::json::array() : uf::vector::encode(vertex.weights, compress)); + + const bool serializeMesh = uf::io::extension(target) == "json"; + if ( serializeMesh ){ + ext::json::reserve( json["vertices"], mesh.vertices.size() ); + for ( auto& vertex : mesh.vertices ) { + auto& v = json["vertices"].emplace_back(); + v.emplace_back(!vertex.position ? ext::json::array() : uf::vector::encode(vertex.position, compress)); + v.emplace_back(!vertex.uv ? ext::json::array() : uf::vector::encode(vertex.uv, compress)); + v.emplace_back(!vertex.st ? ext::json::array() : uf::vector::encode(vertex.st, compress)); + v.emplace_back(!vertex.normal ? ext::json::array() : uf::vector::encode(vertex.normal, compress)); + v.emplace_back(!vertex.tangent ? ext::json::array() : uf::vector::encode(vertex.tangent, compress)); + v.emplace_back(!vertex.id ? ext::json::array() : uf::vector::encode(vertex.id, compress)); + v.emplace_back(!vertex.joints ? ext::json::array() : uf::vector::encode(vertex.joints, compress)); + v.emplace_back(!vertex.weights ? ext::json::array() : uf::vector::encode(vertex.weights, compress)); + } + ext::json::reserve( json["indices"], mesh.indices.size() ); + for ( auto& index : mesh.indices ) json["indices"].emplace_back(index); + } else { + std::string verticesFilename = target + ".vertices.bin"; + uf::io::write( verticesFilename, mesh.vertices.data(), mesh.vertices.size() * sizeof(pod::Graph::Mesh::vertex_t) ); + json["vertices"] = uf::io::filename( verticesFilename ); + + if ( !mesh.indices.empty() ) { + std::string indicesFilename = target + ".indices.bin"; + uf::io::write( indicesFilename, mesh.indices.data(), mesh.indices.size() * sizeof(pod::Graph::Mesh::index_t) ); + json["indices"] = uf::io::filename( indicesFilename ); + } } - ext::json::reserve( json["indices"], mesh.indices.size() ); - for ( auto& index : mesh.indices ) json["indices"].emplace_back(index); return json; } uf::Serializer encode( const pod::Node& node, bool compress = false ) { @@ -1419,8 +1444,9 @@ void uf::graph::save( const pod::Graph& graph, const std::string& filename ) { serializer["metadata"] = graph.metadata; serializer["metadata"]["mesh optimization"] = 0; */ - bool saveSeparately = !metadata["debug"]["export"]["combined"].as(); - bool compression = metadata["debug"]["export"]["compression"].as(); + const bool saveSeparately = !metadata["debug"]["export"]["combined"].as(); + const bool compression = metadata["debug"]["export"]["compression"].as(); + const bool serializeMesh = false; // store images if ( saveSeparately ) uf::io::mkdir(directory); @@ -1499,12 +1525,17 @@ void uf::graph::save( const pod::Graph& graph, const std::string& filename ) { ext::json::reserve( serializer["meshes"], graph.meshes.size() ); if ( saveSeparately ) { for ( size_t i = 0; i < graph.meshes.size(); ++i ) { - std::string f = "mesh."+std::to_string(i)+".json"; - encode(graph.meshes[i], compression).writeToFile(directory+"/" + f); - serializer["meshes"].emplace_back(f); + std::string f = "mesh."+std::to_string(i); + if ( serializeMesh ) { + encode(graph.meshes[i], f, compression).writeToFile(directory+"/" + f + ".json"); + serializer["meshes"].emplace_back(f); + } else { + auto json = encode(graph.meshes[i], directory + "/" + f, compression); + serializer["meshes"].emplace_back(json); + } } } else { - for ( auto& mesh : graph.meshes ) serializer["meshes"].emplace_back( encode(mesh, compression) ); + for ( auto& mesh : graph.meshes ) serializer["meshes"].emplace_back( encode(mesh, ".json", compression) ); } return 0; }); @@ -1567,9 +1598,14 @@ void uf::graph::save( const pod::Graph& graph, const std::string& filename ) { ext::json::reserve( serializer["meshes"], graph.meshes.size() ); if ( saveSeparately ) { for ( size_t i = 0; i < graph.meshes.size(); ++i ) { - std::string f = "mesh."+std::to_string(i)+".json"; - encode(graph.meshes[i], compression).writeToFile(directory+"/" + f); - serializer["meshes"].emplace_back(f); + std::string f = "mesh."+std::to_string(i); + if ( serializeMesh ) { + encode(graph.meshes[i], f, compression).writeToFile(directory+"/" + f + ".json"); + serializer["meshes"].emplace_back(f); + } else { + auto json = encode(graph.meshes[i], directory + "/" + f, compression); + serializer["meshes"].emplace_back(json); + } } } else { for ( auto& mesh : graph.meshes ) serializer["meshes"].emplace_back( encode(mesh, compression) ); @@ -1633,7 +1669,7 @@ uf::Serializer uf::graph::stats( const pod::Graph& graph ) { for ( auto& image : graph.images ) memoryImages += image.getPixels().size(); for ( auto& mesh : graph.meshes ) { memoryMeshes += sizeof(uf::graph::mesh_t::vertex_t) * mesh.vertices.size(); - memoryMeshes += sizeof(uf::graph::mesh_t::indices_t) * mesh.indices.size(); + memoryMeshes += sizeof(uf::graph::mesh_t::index_t) * mesh.indices.size(); } for ( auto pair : graph.animations ) { memoryAnimations += sizeof(float) * 3; diff --git a/engine/src/engine/instantiator/instantiator.cpp b/engine/src/engine/instantiator/instantiator.cpp index 18e0aba5..3197545a 100644 --- a/engine/src/engine/instantiator/instantiator.cpp +++ b/engine/src/engine/instantiator/instantiator.cpp @@ -97,7 +97,9 @@ bool uf::instantiator::valid( uf::Entity* pointer ) { void uf::instantiator::registerBehavior( const std::string& name, const pod::Behavior& behavior ) { if ( !uf::instantiator::behaviors ) uf::instantiator::behaviors = new std::unordered_map;\ (*uf::instantiator::behaviors)[name] = behavior; - if ( UF_INSTANTIATOR_ANNOUNCE ) UF_DEBUG_MSG("Registered behavior for " << name << " | " << behavior.type); +#if UF_INSTANTIATOR_ANNOUNCE + UF_MSG_DEBUG("Registered behavior for " << name << " | " << behavior.type); +#endif } void uf::instantiator::registerBinding( const std::string& object, const std::string& behavior ) { if ( !objects ) objects = new pod::NamedTypes; @@ -105,7 +107,9 @@ void uf::instantiator::registerBinding( const std::string& object, const std::st auto& instantiator = uf::instantiator::objects->get( object ); instantiator.behaviors.emplace_back( behavior ); - if ( UF_INSTANTIATOR_ANNOUNCE ) UF_DEBUG_MSG("Registered binding: " << object << " and " << behavior << ": " << instantiator.behaviors.size()); +#if UF_INSTANTIATOR_ANNOUNCE + UF_MSG_DEBUG("Registered binding: " << object << " and " << behavior << ": " << instantiator.behaviors.size()); +#endif } uf::Entity& uf::instantiator::instantiate( const std::string& name ) { @@ -124,14 +128,18 @@ void uf::instantiator::bind( const std::string& name, uf::Entity& entity ) { if ( !uf::instantiator::objects->has( name, false ) ) { if ( uf::instantiator::behaviors->count( name ) == 0 ) return; auto& behavior = (*uf::instantiator::behaviors)[name]; - if ( UF_INSTANTIATOR_ANNOUNCE ) UF_DEBUG_MSG("Attaching " << name << " | " << behavior.type << " to " << entity.getName()); + #if UF_INSTANTIATOR_ANNOUNCE + UF_MSG_DEBUG("Attaching " << name << " | " << behavior.type << " to " << entity.getName()); + #endif entity.addBehavior(behavior); return; } auto& instantiator = uf::instantiator::objects->get( name ); for ( auto& name : instantiator.behaviors ) { auto& behavior = (*uf::instantiator::behaviors)[name]; - if ( UF_INSTANTIATOR_ANNOUNCE ) UF_DEBUG_MSG("Attaching " << name << " | " << behavior.type << " to " << entity.getName()); + #if UF_INSTANTIATOR_ANNOUNCE + UF_MSG_DEBUG("Attaching " << name << " | " << behavior.type << " to " << entity.getName()); + #endif entity.addBehavior(behavior); } } diff --git a/engine/src/engine/object/object.cpp b/engine/src/engine/object/object.cpp index 453b101e..87621a55 100644 --- a/engine/src/engine/object/object.cpp +++ b/engine/src/engine/object/object.cpp @@ -123,7 +123,6 @@ bool uf::Object::reload( bool hard ) { transform.reference = reference; } payload["new"] = metadata; -// UF_DEBUG_MSG("Updated metadata for " << uf::string::toString( this )); this->queueHook("object:Reload.%UID%", payload); return true; } diff --git a/engine/src/ext/bullet/bullet.cpp b/engine/src/ext/bullet/bullet.cpp index 5c5c501c..c7849195 100644 --- a/engine/src/ext/bullet/bullet.cpp +++ b/engine/src/ext/bullet/bullet.cpp @@ -185,7 +185,7 @@ void ext::bullet::syncToBullet() { body->setCenterOfMassTransform(t); // auto T = uf::transform::flatten( transform ); - // UF_DEBUG_MSG( entity->getName() << ": " << entity->getUid() << " " << uf::vector::toString( T.position ) ); + // UF_MSG_DEBUG( entity->getName() << ": " << entity->getUid() << " " << uf::vector::toString( T.position ) ); } } } @@ -379,7 +379,7 @@ pod::Bullet& ext::bullet::create( uf::Object& object, float radius, float height collider.body->setCcdMotionThreshold(1e-7); collider.body->setCcdSweptSphereRadius(0.25 * 0.2); -// UF_DEBUG_MSG( collider.body->getLinearDamping() << " " << collider.body->getAngularDamping() ); +// UF_MSG_DEBUG( collider.body->getLinearDamping() << " " << collider.body->getAngularDamping() ); // collider.body->setDamping( 0.8, 0.8 ); return collider; diff --git a/engine/src/ext/gltf/gltf.cpp b/engine/src/ext/gltf/gltf.cpp index 483eb7ef..9a055f7f 100644 --- a/engine/src/ext/gltf/gltf.cpp +++ b/engine/src/ext/gltf/gltf.cpp @@ -128,9 +128,9 @@ pod::Graph ext::gltf::load( const std::string& filename, uf::graph::load_mode_t graph.mode = mode; graph.metadata = metadata; - if ( !warn.empty() ) UF_DEBUG_MSG("glTF warning: " << warn); - if ( !err.empty() ) UF_DEBUG_MSG("glTF error: " << err); - if ( !ret ) { UF_DEBUG_MSG("glTF error: failed to parse file: " << filename); + if ( !warn.empty() ) UF_MSG_WARNING("glTF warning: " << warn); + if ( !err.empty() ) UF_MSG_ERROR("glTF error: " << err); + if ( !ret ) { UF_MSG_ERROR("glTF error: failed to parse file: " << filename); return graph; } @@ -225,7 +225,7 @@ pod::Graph ext::gltf::load( const std::string& filename, uf::graph::load_mode_t } else if ( material.alphaMode == "MASK" ) { material.storage.modeAlpha = 2; } else { - UF_DEBUG_MSG("Unhandled alpha mode: " << material.alphaMode) + UF_MSG_WARNING("Unhandled alpha mode: " << material.alphaMode) } if ( m.doubleSided && graph.metadata["cull mode"].as() == "auto" ) { graph.metadata["cull mode"] = "none"; @@ -365,10 +365,10 @@ pod::Graph ext::gltf::load( const std::string& filename, uf::graph::load_mode_t mesh.updateDescriptor(); /* - UF_DEBUG_MSG( "Indices: " << mesh.indices.size() << " | Vertices: " << mesh.vertices.size() ); + UF_MSG_DEBUG( "Indices: " << mesh.indices.size() << " | Vertices: " << mesh.vertices.size() ); size_t o = graph.metadata["mesh optimization"].is() ? graph.metadata["mesh optimization"].as() : SIZE_MAX; if ( o > 0 ) mesh.optimize(o); - UF_DEBUG_MSG( "Indices: " << mesh.indices.size() << " | Vertices: " << mesh.vertices.size() ); + UF_MSG_DEBUG( "Indices: " << mesh.indices.size() << " | Vertices: " << mesh.vertices.size() ); */ } } diff --git a/engine/src/ext/json/json.cpp b/engine/src/ext/json/json.cpp index a7679777..733b4b0f 100644 --- a/engine/src/ext/json/json.cpp +++ b/engine/src/ext/json/json.cpp @@ -2,9 +2,6 @@ #include #include -//#define SAFE_ASSERT(...) if ( !(__VA_ARGS__) ) UF_DEBUG_MSG("ASSERTION FAILED:" << #__VA_ARGS__); -#define SAFE_ASSERT(...) UF_DEBUG_MSG("ASSERTION FAILED: " << #__VA_ARGS__); - ext::json::Value& ext::json::Value::operator=( const ext::json::Value& json ) { ext::json::base_value::operator=( (const ext::json::base_value&) json ); return *this; @@ -25,26 +22,26 @@ ext::json::Value& ext::json::Value::reserve( size_t n ) { #endif void ext::json::forEach( ext::json::Value& json, const std::function& function ) { -// SAFE_ASSERT( ext::json::isArray(json) || ext::json::isObject(json) ); +// UF_ASSERT_SAFE( ext::json::isArray(json) || ext::json::isObject(json) ); // for ( auto it = json.begin(); it != json.end(); ++it ) { auto& v = *it; for ( auto& v : json ) { function( (ext::json::Value&) v ); } } void ext::json::forEach( ext::json::Value& json, const std::function& function ) { -// SAFE_ASSERT( ext::json::isArray(json) ); +// UF_ASSERT_SAFE( ext::json::isArray(json) ); for ( size_t i = 0; i < json.size(); ++i ) { function( i, (ext::json::Value&) json[i] ); } } void ext::json::forEach( ext::json::Value& json, const std::function& function ) { -// SAFE_ASSERT( ext::json::isObject(json) ); +// UF_ASSERT_SAFE( ext::json::isObject(json) ); for ( auto it = json.begin(); it != json.end(); ++it ) { function( it.key(), (ext::json::Value&) *it ); } } void ext::json::forEach( ext::json::Value& json, const std::function& function ) { -// SAFE_ASSERT( ext::json::isArray(json) || ext::json::isObject(json) ); +// UF_ASSERT_SAFE( ext::json::isArray(json) || ext::json::isObject(json) ); // for ( auto it = json.begin(); it != json.end(); ++it ) { auto& v = *it; for ( auto& v : json ) { bool breaks = false; @@ -53,7 +50,7 @@ void ext::json::forEach( ext::json::Value& json, const std::function& function ) { -// SAFE_ASSERT( ext::json::isArray(json) ); +// UF_ASSERT_SAFE( ext::json::isArray(json) ); for ( size_t i = 0; i < json.size(); ++i ) { bool breaks = false; function( i, (ext::json::Value&) json[i], breaks ); @@ -61,7 +58,7 @@ void ext::json::forEach( ext::json::Value& json, const std::function& function ) { -// SAFE_ASSERT( ext::json::isObject(json) ); +// UF_ASSERT_SAFE( ext::json::isObject(json) ); for ( auto it = json.begin(); it != json.end(); ++it ) { bool breaks = false; function( it.key(), (ext::json::Value&) *it, breaks ); @@ -70,19 +67,19 @@ void ext::json::forEach( ext::json::Value& json, const std::function& function ) { -// SAFE_ASSERT( ext::json::isArray(json) ); +// UF_ASSERT_SAFE( ext::json::isArray(json) ); for ( size_t i = 0; i < json.size(); ++i ) { function( i, (const ext::json::Value&) json[i] ); } } void ext::json::forEach( const ext::json::Value& json, const std::function& function ) { -// SAFE_ASSERT( ext::json::isObject(json) ); +// UF_ASSERT_SAFE( ext::json::isObject(json) ); for ( auto it = json.begin(); it != json.end(); ++it ) { function( it.key(), (const ext::json::Value&) *it ); } } void ext::json::forEach( const ext::json::Value& json, const std::function& function ) { -// SAFE_ASSERT( ext::json::isArray(json) ); +// UF_ASSERT_SAFE( ext::json::isArray(json) ); for ( size_t i = 0; i < json.size(); ++i ) { bool breaks = false; function( i, (const ext::json::Value&) json[i], breaks ); @@ -90,7 +87,7 @@ void ext::json::forEach( const ext::json::Value& json, const std::function& function ) { -// SAFE_ASSERT( ext::json::isObject(json) ); +// UF_ASSERT_SAFE( ext::json::isObject(json) ); for ( auto it = json.begin(); it != json.end(); ++it ) { bool breaks = false; function( it.key(), (const ext::json::Value&) *it, breaks ); @@ -98,14 +95,14 @@ void ext::json::forEach( const ext::json::Value& json, const std::function& function ) { -// SAFE_ASSERT( ext::json::isArray(json) || ext::json::isObject(json) ); +// UF_ASSERT_SAFE( ext::json::isArray(json) || ext::json::isObject(json) ); // for ( auto it = json.begin(); it != json.end(); ++it ) { auto& v = *it; for ( auto& v : json ) { function( (const ext::json::Value&) v ); } } void ext::json::forEach( const ext::json::Value& json, const std::function& function ) { -// SAFE_ASSERT( ext::json::isArray(json) || ext::json::isObject(json) ); +// UF_ASSERT_SAFE( ext::json::isArray(json) || ext::json::isObject(json) ); // for ( auto it = json.begin(); it != json.end(); ++it ) { auto& v = *it; for ( auto& v : json ) { bool breaks = false; diff --git a/engine/src/ext/oal/oal.cpp b/engine/src/ext/oal/oal.cpp index 1e5d08f1..09dfa0f9 100644 --- a/engine/src/ext/oal/oal.cpp +++ b/engine/src/ext/oal/oal.cpp @@ -32,11 +32,7 @@ void ext::al::initialize() { } return this->m_initialized = true; */ - if ( alutInit(NULL, NULL) != AL_TRUE ) { - std::string errorString = alutGetErrorString(alutGetError()); - UF_DEBUG_MSG("AL error: " << errorString); - return; - } + if ( alutInit(NULL, NULL) != AL_TRUE ) UF_EXCEPTION("AL error: " + std::string(alutGetErrorString(alutGetError()))); } void ext::al::destroy() { /* @@ -55,20 +51,20 @@ void ext::al::listener( ALenum name, const ALfloat* f ) { AL_CHECK_RESULT(alList void ext::al::listener( const std::string& string, ALfloat x ) { // alSourcef if ( string == "GAIN" ) return ext::al::listener( AL_GAIN, x ); -// UF_DEBUG_MSG("AL error: Invalid enum requested: " << string); + UF_MSG_ERROR("AL error: Invalid enum requested: " << string); } void ext::al::listener( const std::string& string, ALfloat x, ALfloat y, ALfloat z ) { // alSourcefv if ( string == "POSITION" ) return ext::al::listener( AL_POSITION, x, y, z ); if ( string == "VELOCITY" ) return ext::al::listener( AL_VELOCITY, x, y, z ); -// UF_DEBUG_MSG("AL error: Invalid enum requested: " << string); + UF_MSG_ERROR("AL error: Invalid enum requested: " << string); } void ext::al::listener( const std::string& string, const ALfloat* f ) { // alSourcefv if ( string == "POSITION" ) return ext::al::listener( AL_POSITION, f ); if ( string == "VELOCITY" ) return ext::al::listener( AL_VELOCITY, f ); if ( string == "ORIENTATION" ) return ext::al::listener( AL_DIRECTION, f ); -// UF_DEBUG_MSG("AL error: Invalid enum requested: " << string); + UF_MSG_ERROR("AL error: Invalid enum requested: " << string); } #endif std::string ext::al::getError( ALCenum error ) { @@ -84,7 +80,6 @@ std::string ext::al::getError( ALCenum error ) { return "AL_UNKNOWN(" + std::to_string(error) + ")"; } uf::audio::Metadata* ext::al::create( const std::string& filename, bool streamed, uint8_t buffers ) { -// UF_DEBUG_MSG( "Audio file: " << filename << " " << buffers << " " << streamed ); #if UF_MEMORYPOOL_INVALID_MALLOC uf::audio::Metadata* pointer = &uf::MemoryPool::global.alloc(); #else @@ -201,21 +196,21 @@ void ext::al::Source::get( const std::string& string, ALfloat& x ) { if ( string == "CONE_OUTER_ANGLE" ) return this->get( AL_CONE_OUTER_ANGLE, x ); if ( string == "REFERENCE_DISTANCE" ) return this->get( AL_REFERENCE_DISTANCE, x ); if ( string == "SEC_OFFSET" ) return this->get( AL_SEC_OFFSET, x ); -// UF_DEBUG_MSG("AL error: Invalid enum requested: " << string); + UF_MSG_ERROR("AL error: Invalid enum requested: " << string); } void ext::al::Source::get( const std::string& string, ALfloat& x, ALfloat& y, ALfloat& z ) { // alSourcefv if ( string == "POSITION" ) return this->get( AL_POSITION, x, y, z ); if ( string == "VELOCITY" ) return this->get( AL_VELOCITY, x, y, z ); if ( string == "DIRECTION" ) return this->get( AL_DIRECTION, x, y, z ); -// UF_DEBUG_MSG("AL error: Invalid enum requested: " << string); + UF_MSG_ERROR("AL error: Invalid enum requested: " << string); } void ext::al::Source::get( const std::string& string, ALfloat* f ) { // alSourcefv if ( string == "POSITION" ) return this->get( AL_POSITION, f ); if ( string == "VELOCITY" ) return this->get( AL_VELOCITY, f ); if ( string == "DIRECTION" ) return this->get( AL_DIRECTION, f ); -// UF_DEBUG_MSG("AL error: Invalid enum requested: " << string); + UF_MSG_ERROR("AL error: Invalid enum requested: " << string); } void ext::al::Source::get( const std::string& string, ALint& x ) { // alSourcei @@ -225,21 +220,21 @@ void ext::al::Source::get( const std::string& string, ALint& x ) { if ( string == "LOOPING" ) return this->get( AL_LOOPING, x ); if ( string == "BUFFER" ) return this->get( AL_BUFFER, x ); if ( string == "SOURCE_STATE" ) return this->get( AL_SOURCE_STATE, x ); -// UF_DEBUG_MSG("AL error: Invalid enum requested: " << string); + UF_MSG_ERROR("AL error: Invalid enum requested: " << string); } void ext::al::Source::get( const std::string& string, ALint& x, ALint& y, ALint& z ) { // alSourceiv if ( string == "POSITION" ) return this->get( AL_POSITION, x, y, z ); if ( string == "VELOCITY" ) return this->get( AL_VELOCITY, x, y, z ); if ( string == "DIRECTION" ) return this->get( AL_DIRECTION, x, y, z ); -// UF_DEBUG_MSG("AL error: Invalid enum requested: " << string); + UF_MSG_ERROR("AL error: Invalid enum requested: " << string); } void ext::al::Source::get( const std::string& string, ALint* f ) { // alSourceiv if ( string == "POSITION" ) return this->get( AL_POSITION, f ); if ( string == "VELOCITY" ) return this->get( AL_VELOCITY, f ); if ( string == "DIRECTION" ) return this->get( AL_DIRECTION, f ); -// UF_DEBUG_MSG("AL error: Invalid enum requested: " << string); + UF_MSG_ERROR("AL error: Invalid enum requested: " << string); } void ext::al::Source::set( ALenum name, ALfloat x ) { AL_CHECK_RESULT(alSourcef( this->m_index, name, x )); } void ext::al::Source::set( ALenum name, ALfloat x, ALfloat y, ALfloat z ) { AL_CHECK_RESULT(alSource3f( this->m_index, name, x, y, z )); } @@ -262,21 +257,21 @@ void ext::al::Source::set( const std::string& string, ALfloat x ) { if ( string == "CONE_OUTER_ANGLE" ) return this->set( AL_CONE_OUTER_ANGLE, x ); if ( string == "REFERENCE_DISTANCE" ) return this->set( AL_REFERENCE_DISTANCE, x ); if ( string == "SEC_OFFSET" ) return this->set( AL_SEC_OFFSET, x ); -// UF_DEBUG_MSG("AL error: Invalid enum requested: " << string); + UF_MSG_ERROR("AL error: Invalid enum requested: " << string); } void ext::al::Source::set( const std::string& string, ALfloat x, ALfloat y, ALfloat z ) { // alSourcefv if ( string == "POSITION" ) return this->set( AL_POSITION, x, y, z ); if ( string == "VELOCITY" ) return this->set( AL_VELOCITY, x, y, z ); if ( string == "DIRECTION" ) return this->set( AL_DIRECTION, x, y, z ); -// UF_DEBUG_MSG("AL error: Invalid enum requested: " << string); + UF_MSG_ERROR("AL error: Invalid enum requested: " << string); } void ext::al::Source::set( const std::string& string, const ALfloat* f ) { // alSourcefv if ( string == "POSITION" ) return this->set( AL_POSITION, f ); if ( string == "VELOCITY" ) return this->set( AL_VELOCITY, f ); if ( string == "DIRECTION" ) return this->set( AL_DIRECTION, f ); -// UF_DEBUG_MSG("AL error: Invalid enum requested: " << string); + UF_MSG_ERROR("AL error: Invalid enum requested: " << string); } void ext::al::Source::set( const std::string& string, ALint x ) { // alSourcei @@ -286,21 +281,21 @@ void ext::al::Source::set( const std::string& string, ALint x ) { if ( string == "LOOPING" ) return this->set( AL_LOOPING, x ); if ( string == "BUFFER" ) return this->set( AL_BUFFER, x ); if ( string == "SOURCE_STATE" ) return this->set( AL_SOURCE_STATE, x ); -// UF_DEBUG_MSG("AL error: Invalid enum requested: " << string); + UF_MSG_ERROR("AL error: Invalid enum requested: " << string); } void ext::al::Source::set( const std::string& string, ALint x, ALint y, ALint z ) { // alSourceiv if ( string == "POSITION" ) return this->set( AL_POSITION, x, y, z ); if ( string == "VELOCITY" ) return this->set( AL_VELOCITY, x, y, z ); if ( string == "DIRECTION" ) return this->set( AL_DIRECTION, x, y, z ); -// UF_DEBUG_MSG("AL error: Invalid enum requested: " << string); + UF_MSG_ERROR("AL error: Invalid enum requested: " << string); } void ext::al::Source::set( const std::string& string, const ALint* f ) { // alSourceiv if ( string == "POSITION" ) return this->set( AL_POSITION, f ); if ( string == "VELOCITY" ) return this->set( AL_VELOCITY, f ); if ( string == "DIRECTION" ) return this->set( AL_DIRECTION, f ); -// UF_DEBUG_MSG("AL error: Invalid enum requested: " << string); + UF_MSG_ERROR("AL error: Invalid enum requested: " << string); } #if 0 void ext::al::Source::get( ALenum name, std::vector& parameters ) { diff --git a/engine/src/ext/opengl/commands.cpp b/engine/src/ext/opengl/commands.cpp index 0d98bfae..f08d9010 100644 --- a/engine/src/ext/opengl/commands.cpp +++ b/engine/src/ext/opengl/commands.cpp @@ -668,7 +668,7 @@ void ext::opengl::CommandBuffer::drawIndexed( const ext::opengl::CommandBuffer:: uf::Timer TIMER_TRACE; long long prevTime = 0; long long curTime = 0; - UF_DEBUG_MSG("==== START RENDER ===="); + UF_MSG_DEBUG("==== START RENDER ===="); ext::opengl::Buffer::Descriptor vertexBuffer = {}; ext::opengl::Buffer::Descriptor indexBuffer = {}; @@ -857,7 +857,7 @@ void ext::opengl::CommandBuffer::drawIndexed( const ext::opengl::CommandBuffer:: GL_ERROR_CHECK(glDisable(info->descriptor.viewType)); } curTime = TIMER_TRACE.elapsed().asMicroseconds(); - UF_DEBUG_MSG(curTime << " us\t" << (curTime - prevTime) << " us\t" << textureId); + UF_MSG_DEBUG(curTime << " us\t" << (curTime - prevTime) << " us\t" << textureId); prevTime = curTime; } } diff --git a/engine/src/ext/opengl/texture.cpp b/engine/src/ext/opengl/texture.cpp index d87f9cb3..cfde7cf7 100644 --- a/engine/src/ext/opengl/texture.cpp +++ b/engine/src/ext/opengl/texture.cpp @@ -100,7 +100,6 @@ void ext::opengl::Texture::loadFromImage( Device& device, enums::Format::type_t format ) { -// UF_DEBUG_MSG( image.getFilename() << " | " << std::bitset<32>(image.getFormat()) ); if ( image.getFormat() != 0 ) { internalFormat = image.getFormat(); } else { diff --git a/engine/src/ext/openvr/openvr.cpp b/engine/src/ext/openvr/openvr.cpp index 2007ae58..52674ec5 100644 --- a/engine/src/ext/openvr/openvr.cpp +++ b/engine/src/ext/openvr/openvr.cpp @@ -432,8 +432,8 @@ void ext::openvr::submit() { bool invert = swapEyes; float width = renderMode.width > 0 ? renderMode.width : uf::renderer::settings::width; float height = renderMode.height > 0 ? renderMode.height : uf::renderer::settings::height; - auto& leftOutputAttachment = renderMode.renderTarget.attachments[renderMode.metadata["outputs"][0].as()]; - auto& rightOutputAttachment = renderMode.renderTarget.attachments[renderMode.metadata["outputs"][1].as()]; + auto& leftOutputAttachment = renderMode.renderTarget.attachments[renderMode.metadata.outputs[0]]; + auto& rightOutputAttachment = renderMode.renderTarget.attachments[renderMode.metadata.outputs[1]]; // Submit to SteamVR vr::VRTextureBounds_t bounds; diff --git a/engine/src/ext/vulkan/graphic.cpp b/engine/src/ext/vulkan/graphic.cpp index d5ab01b0..46c74704 100644 --- a/engine/src/ext/vulkan/graphic.cpp +++ b/engine/src/ext/vulkan/graphic.cpp @@ -24,8 +24,8 @@ void ext::vulkan::Pipeline::initialize( Graphic& graphic ) { void ext::vulkan::Pipeline::initialize( Graphic& graphic, GraphicDescriptor& descriptor ) { this->device = graphic.device; this->descriptor = descriptor; + this->metadata.type = descriptor.pipeline; Device& device = *graphic.device; - metadata["name"] = descriptor.pipeline; // VK_VALIDATION_MESSAGE(&graphic << ": Shaders: " << graphic.material.shaders.size() << " Textures: " << graphic.material.textures.size()); auto shaders = getShaders( graphic.material.shaders ); @@ -241,7 +241,7 @@ void ext::vulkan::Pipeline::initialize( Graphic& graphic, GraphicDescriptor& des size_t len = shader.specializationConstants.data().len; bool invalidated = true; for ( size_t i = 0; i < len / 4; ++i ) { - auto& payload = shader.metadata["specializationConstants"][i]; + auto& payload = shader.metadata.json["specializationConstants"][i]; std::string type = payload["type"].as(); if ( type == "int32_t" ) { int32_t& v = ((int32_t*) s)[i]; @@ -272,7 +272,7 @@ void ext::vulkan::Pipeline::initialize( Graphic& graphic, GraphicDescriptor& des payload["value"] = v; } } - VK_DEBUG_VALIDATION_MESSAGE("Specialization constants for shader `" << shader.filename << "`: " << shader.metadata["specializationConstants"].dump(1, '\t')); + VK_DEBUG_VALIDATION_MESSAGE("Specialization constants for shader `" << shader.filename << "`: " << shader.metadata.json["specializationConstants"].dump(1, '\t')); if ( invalidated ) { // shader.specializationInfo = {}; // shader.specializationInfo.mapEntryCount = shader.specializationMapEntries.size(); @@ -330,7 +330,7 @@ void ext::vulkan::Pipeline::record( Graphic& graphic, VkCommandBuffer commandBuf size_t offset = 0; for ( auto& pushConstant : shader.pushConstants ) { // - if ( ext::json::isObject( shader.metadata["definitions"]["pushConstants"]["PushConstant"] ) ) { + if ( ext::json::isObject( shader.metadata.json["definitions"]["pushConstants"]["PushConstant"] ) ) { if ( shader.descriptor.stage == VK_SHADER_STAGE_VERTEX_BIT ) { struct PushConstant { uint32_t pass; @@ -444,7 +444,7 @@ void ext::vulkan::Pipeline::update( Graphic& graphic, GraphicDescriptor& descrip case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE: { consumes += layout.descriptorCount; std::string binding = std::to_string(layout.binding); - std::string imageType = shader.metadata["definitions"]["textures"][binding]["type"].as(); + std::string imageType = shader.metadata.json["definitions"]["textures"][binding]["type"].as(); types.reserve(consumes); for ( size_t i = 0; i < layout.descriptorCount; ++i ) types.emplace_back(imageType); } break; @@ -489,15 +489,14 @@ void ext::vulkan::Pipeline::update( Graphic& graphic, GraphicDescriptor& descrip auto inputInfo = infos.input.begin(); - #define BREAK_ASSERT(condition, ...) if ( condition ) { VK_VALIDATION_MESSAGE(#condition << "\t" << __VA_ARGS__); break; } std::vector writeDescriptorSets; for ( auto* shaderPointer : shaders ) { auto& shader = *shaderPointer; - // UF_DEBUG_MSG(shader.filename << ": "); - // UF_DEBUG_MSG("\tAVAILABLE UNIFORM BUFFERS: " << infos.uniform.size()); - // UF_DEBUG_MSG("\tAVAILABLE STORAGE BUFFERS: " << infos.storage.size()); - // UF_DEBUG_MSG("\tCONSUMING : " << shader.descriptorSetLayoutBindings.size()); + // UF_MSG_DEBUG(shader.filename << ": "); + // UF_MSG_DEBUG("\tAVAILABLE UNIFORM BUFFERS: " << infos.uniform.size()); + // UF_MSG_DEBUG("\tAVAILABLE STORAGE BUFFERS: " << infos.storage.size()); + // UF_MSG_DEBUG("\tCONSUMING : " << shader.descriptorSetLayoutBindings.size()); for ( auto& layout : shader.descriptorSetLayoutBindings ) { // VK_VALIDATION_MESSAGE(shader.filename << "\tType: " << layout.descriptorType << "\tConsuming: " << layout.descriptorCount); @@ -506,17 +505,17 @@ void ext::vulkan::Pipeline::update( Graphic& graphic, GraphicDescriptor& descrip case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER: case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE: case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE: { - // UF_DEBUG_MSG("\t["<< layout.binding << "] INSERTING " << layout.descriptorCount << " IMAGE"); - // if ( layout.descriptorType == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER ) UF_DEBUG_MSG("\t\tCOMBINED_IMAGE_SAMPLER"); - // if ( layout.descriptorType == VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE ) UF_DEBUG_MSG("\t\tSAMPLED_IMAGE"); - // if ( layout.descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_IMAGE ) UF_DEBUG_MSG("\t\tSTORAGE_IMAGE"); - // if ( layout.descriptorCount == 1 ) UF_DEBUG_MSG(i.imageView << "\t" << (*imageInfo).imageLayout); + // UF_MSG_DEBUG("\t["<< layout.binding << "] INSERTING " << layout.descriptorCount << " IMAGE"); + // if ( layout.descriptorType == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER ) UF_MSG_DEBUG("\t\tCOMBINED_IMAGE_SAMPLER"); + // if ( layout.descriptorType == VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE ) UF_MSG_DEBUG("\t\tSAMPLED_IMAGE"); + // if ( layout.descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_IMAGE ) UF_MSG_DEBUG("\t\tSTORAGE_IMAGE"); + // if ( layout.descriptorCount == 1 ) UF_MSG_DEBUG(i.imageView << "\t" << (*imageInfo).imageLayout); #if 1 std::string binding = std::to_string(layout.binding); - std::string imageType = shader.metadata["definitions"]["textures"][binding]["type"].as(); + std::string imageType = shader.metadata.json["definitions"]["textures"][binding]["type"].as(); if ( imageType == "2D" ) { - BREAK_ASSERT( image2DInfo == infos.image2D.end(), "Filename: " << shader.filename << "\tCount: " << layout.descriptorCount ) + UF_ASSERT_BREAK_MSG( image2DInfo != infos.image2D.end(), "Filename: " << shader.filename << "\tCount: " << layout.descriptorCount ) writeDescriptorSets.push_back(ext::vulkan::initializers::writeDescriptorSet( descriptorSet, layout.descriptorType, @@ -526,7 +525,7 @@ void ext::vulkan::Pipeline::update( Graphic& graphic, GraphicDescriptor& descrip )); image2DInfo += layout.descriptorCount; } else if ( imageType == "Cube" ) { - BREAK_ASSERT( imageCubeInfo == infos.imageCube.end(), "Filename: " << shader.filename << "\tCount: " << layout.descriptorCount ) + UF_ASSERT_BREAK_MSG( imageCubeInfo != infos.imageCube.end(), "Filename: " << shader.filename << "\tCount: " << layout.descriptorCount ) writeDescriptorSets.push_back(ext::vulkan::initializers::writeDescriptorSet( descriptorSet, layout.descriptorType, @@ -536,7 +535,7 @@ void ext::vulkan::Pipeline::update( Graphic& graphic, GraphicDescriptor& descrip )); imageCubeInfo += layout.descriptorCount; } else if ( imageType == "3D" ) { - BREAK_ASSERT( image3DInfo == infos.image3D.end(), "Filename: " << shader.filename << "\tCount: " << layout.descriptorCount ) + UF_ASSERT_BREAK_MSG( image3DInfo != infos.image3D.end(), "Filename: " << shader.filename << "\tCount: " << layout.descriptorCount ) writeDescriptorSets.push_back(ext::vulkan::initializers::writeDescriptorSet( descriptorSet, layout.descriptorType, @@ -546,7 +545,7 @@ void ext::vulkan::Pipeline::update( Graphic& graphic, GraphicDescriptor& descrip )); image3DInfo += layout.descriptorCount; } else { - BREAK_ASSERT( imageUnknownInfo == infos.imageUnknown.end(), "Filename: " << shader.filename << "\tCount: " << layout.descriptorCount ) + UF_ASSERT_BREAK_MSG( imageUnknownInfo != infos.imageUnknown.end(), "Filename: " << shader.filename << "\tCount: " << layout.descriptorCount ) writeDescriptorSets.push_back(ext::vulkan::initializers::writeDescriptorSet( descriptorSet, layout.descriptorType, @@ -557,7 +556,7 @@ void ext::vulkan::Pipeline::update( Graphic& graphic, GraphicDescriptor& descrip imageUnknownInfo += layout.descriptorCount; } #else - BREAK_ASSERT( imageInfo == infos.image.end(), "Filename: " << shader.filename << "\tCount: " << layout.descriptorCount ) + UF_ASSERT_BREAK_MSG( imageInfo != infos.image.end(), "Filename: " << shader.filename << "\tCount: " << layout.descriptorCount ) writeDescriptorSets.push_back(ext::vulkan::initializers::writeDescriptorSet( descriptorSet, layout.descriptorType, @@ -569,8 +568,8 @@ void ext::vulkan::Pipeline::update( Graphic& graphic, GraphicDescriptor& descrip #endif } break; case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT: { - // UF_DEBUG_MSG("\t["<< layout.binding << "] INSERTING " << layout.descriptorCount << " INPUT_ATTACHMENT"); - BREAK_ASSERT( inputInfo == infos.input.end(), "Filename: " << shader.filename << "\tCount: " << layout.descriptorCount ) + // UF_MSG_DEBUG("\t["<< layout.binding << "] INSERTING " << layout.descriptorCount << " INPUT_ATTACHMENT"); + UF_ASSERT_BREAK_MSG( inputInfo != infos.input.end(), "Filename: " << shader.filename << "\tCount: " << layout.descriptorCount ) writeDescriptorSets.push_back(ext::vulkan::initializers::writeDescriptorSet( descriptorSet, layout.descriptorType, @@ -581,8 +580,8 @@ void ext::vulkan::Pipeline::update( Graphic& graphic, GraphicDescriptor& descrip inputInfo += layout.descriptorCount; } break; case VK_DESCRIPTOR_TYPE_SAMPLER: { - // UF_DEBUG_MSG("\t["<< layout.binding << "] INSERTING " << layout.descriptorCount << " SAMPLER"); - BREAK_ASSERT( samplerInfo == infos.sampler.end(), "Filename: " << shader.filename << "\tCount: " << layout.descriptorCount ) + // UF_MSG_DEBUG("\t["<< layout.binding << "] INSERTING " << layout.descriptorCount << " SAMPLER"); + UF_ASSERT_BREAK_MSG( samplerInfo != infos.sampler.end(), "Filename: " << shader.filename << "\tCount: " << layout.descriptorCount ) writeDescriptorSets.push_back(ext::vulkan::initializers::writeDescriptorSet( descriptorSet, layout.descriptorType, @@ -593,8 +592,8 @@ void ext::vulkan::Pipeline::update( Graphic& graphic, GraphicDescriptor& descrip samplerInfo += layout.descriptorCount; } break; case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER: { - // UF_DEBUG_MSG("\t["<< layout.binding << "] INSERTING " << layout.descriptorCount << " UNIFORM_BUFFER"); - BREAK_ASSERT( uniformBufferInfo == infos.uniform.end(), "Filename: " << shader.filename << "\tCount: " << layout.descriptorCount ) + // UF_MSG_DEBUG("\t["<< layout.binding << "] INSERTING " << layout.descriptorCount << " UNIFORM_BUFFER"); + UF_ASSERT_BREAK_MSG( uniformBufferInfo != infos.uniform.end(), "Filename: " << shader.filename << "\tCount: " << layout.descriptorCount ) writeDescriptorSets.push_back(ext::vulkan::initializers::writeDescriptorSet( descriptorSet, layout.descriptorType, @@ -605,8 +604,8 @@ void ext::vulkan::Pipeline::update( Graphic& graphic, GraphicDescriptor& descrip uniformBufferInfo += layout.descriptorCount; } break; case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER: { - // UF_DEBUG_MSG("\t["<< layout.binding << "] INSERTING " << layout.descriptorCount << " STORAGE_BUFFER"); - BREAK_ASSERT( storageBufferInfo == infos.storage.end(), "Filename: " << shader.filename << "\tCount: " << layout.descriptorCount ) + // UF_MSG_DEBUG("\t["<< layout.binding << "] INSERTING " << layout.descriptorCount << " STORAGE_BUFFER"); + UF_ASSERT_BREAK_MSG( storageBufferInfo != infos.storage.end(), "Filename: " << shader.filename << "\tCount: " << layout.descriptorCount ) writeDescriptorSets.push_back(ext::vulkan::initializers::writeDescriptorSet( descriptorSet, layout.descriptorType, @@ -634,15 +633,16 @@ void ext::vulkan::Pipeline::update( Graphic& graphic, GraphicDescriptor& descrip descriptor.descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_IMAGE || descriptor.descriptorType == VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT ) { - if ( descriptor.pImageInfo[i].imageView == VK_NULL_HANDLE) { - VK_DEBUG_VALIDATION_MESSAGE("Null image view, replacing with fallback texture..."); + if ( descriptor.pImageInfo[i].imageView == VK_NULL_HANDLE || descriptor.pImageInfo[i].imageLayout == VK_IMAGE_LAYOUT_UNDEFINED ) { + // if ( descriptor.pImageInfo[i].imageView == VK_NULL_HANDLE ) { + VK_DEBUG_VALIDATION_MESSAGE("Null image view or layout is undefined, replacing with fallback texture..."); auto pointer = const_cast(&descriptor.pImageInfo[i]); std::string binding = std::to_string(descriptor.dstBinding); std::string imageType = ""; for ( auto* shaderPointer : shaders ) { auto& shader = *shaderPointer; - auto& info = shader.metadata["definitions"]["textures"][binding]; + auto& info = shader.metadata.json["definitions"]["textures"][binding]; if ( ext::json::isNull(info) ) continue; imageType = info["type"].as(); break; @@ -715,42 +715,23 @@ void ext::vulkan::Pipeline::destroy() { } } std::vector ext::vulkan::Pipeline::getShaders( std::vector& shaders ) { - std::string pipelineName = metadata["name"].as(); std::unordered_map map; std::vector res; +/* + std::string pipelineName = metadata["name"].as(); for ( auto& shader : shaders ) { - std::string target = shader.metadata["pipeline"].as(); - std::string type = shader.metadata["type"].as(); + std::string target = shader.metadata.json["pipeline"].as(); + std::string type = shader.metadata.json["type"].as(); if ( target != "" && target != pipelineName ) continue; map[type] = &shader; } - for ( auto pair : map ) { - res.insert( res.begin(), pair.second); - } - -/* - std::string pipelineName = metadata["name"].as(); - std::vector res; - std::unordered_map map; - - // first push base pipeline - for ( auto& shader : shaders ) { - if ( shader.metadata["pipeline"].as() != "" ) continue; - map[shader.metadata["type"].as()] = res.size(); - res.emplace_back(&shader); - } - // then add requested ones - if ( pipelineName != "" ) for ( auto& shader : shaders ) { - if ( shader.metadata["pipeline"].as() != pipelineName ) continue; - if ( map.count(shader.metadata["type"].as()) == 0 ) { - res.emplace_back(&shader); - } else { - size_t index = map.at(shader.metadata["type"].as()); - res[index] = &shader; - } - } */ + for ( auto& shader : shaders ) { + if ( shader.metadata.pipeline != "" && shader.metadata.pipeline != metadata.type ) continue; + map[shader.metadata.type] = &shader; + } + for ( auto pair : map ) res.insert( res.begin(), pair.second); return res; } @@ -796,11 +777,11 @@ void ext::vulkan::Material::attachShader( const std::string& filename, VkShaderS case VK_SHADER_STAGE_INTERSECTION_BIT_KHR: type = "intersection"; break; case VK_SHADER_STAGE_CALLABLE_BIT_KHR: type = "callable"; break; } - shader.metadata["pipeline"] = pipeline; - shader.metadata["type"] = type; + shader.metadata.pipeline = pipeline; + shader.metadata.type = type; - metadata["shaders"][pipeline][type]["index"] = shaders.size() - 1; - metadata["shaders"][pipeline][type]["filename"] = filename; + metadata.json["shaders"][pipeline][type]["index"] = shaders.size() - 1; + metadata.json["shaders"][pipeline][type]["index"] = shaders.size() - 1; } void ext::vulkan::Material::initializeShaders( const std::vector>& layout, const std::string& pipeline ) { shaders.clear(); shaders.reserve( layout.size() ); @@ -809,14 +790,14 @@ void ext::vulkan::Material::initializeShaders( const std::vector(); + size_t index = metadata.json["shaders"][pipeline][type]["index"].as(); return shaders.at(index); } bool ext::vulkan::Material::validate() { @@ -984,7 +965,7 @@ ext::vulkan::Buffer* ext::vulkan::Graphic::getStorageBuffer( const std::string& size_t storageIndex = -1; for ( auto& shader : material.shaders ) { if ( !shader.hasStorage(name) ) continue; - storageIndex = shader.metadata["definitions"]["storage"][name]["index"].as(); + storageIndex = shader.metadata.json["definitions"]["storage"][name]["index"].as(); break; } for ( size_t bufferIndex = 0, storageCounter = 0; bufferIndex < buffers.size(); ++bufferIndex ) { @@ -1043,11 +1024,13 @@ void ext::vulkan::GraphicDescriptor::parse( ext::json::Value& metadata ) { depth.bias.clamp = metadata["depth bias"]["clamp"].as(); } } -std::string ext::vulkan::GraphicDescriptor::hash() const { +ext::vulkan::GraphicDescriptor::hash_t ext::vulkan::GraphicDescriptor::hash() const { +#if UF_GRAPHIC_DESCRIPTOR_USE_STRING uf::Serializer serializer; serializer["subpass"] = subpass; - if ( settings::experimental::individualPipelines ) serializer["renderMode"] = renderMode; + if ( settings::experimental::individualPipelines ) + serializer["renderMode"] = renderMode; serializer["renderTarget"] = renderTarget; serializer["geometry"]["sizes"]["vertex"] = geometry.attributes.vertex.size; @@ -1056,14 +1039,11 @@ std::string ext::vulkan::GraphicDescriptor::hash() const { serializer["offsets"]["vertex"] = offsets.vertex; serializer["offsets"]["index"] = offsets.index; - { - int i = 0; - for ( auto& attribute : geometry.attributes.descriptor ) { - serializer["geometry"]["attributes"][i]["format"] = attribute.format; - serializer["geometry"]["attributes"][i]["offset"] = attribute.offset; - ++i; - } + for ( uint8_t i = 0; i < geometry.attributes.descriptor.size(); ++i ) { + serializer["geometry"]["attributes"][i]["format"] = geometry.attributes.descriptor[i].format; + serializer["geometry"]["attributes"][i]["offset"] = geometry.attributes.descriptor[i].offset; } + serializer["topology"] = topology; serializer["cullMode"] = cullMode; serializer["fill"] = fill; @@ -1077,9 +1057,42 @@ std::string ext::vulkan::GraphicDescriptor::hash() const { serializer["depth"]["bias"]["slope"] = depth.bias.slope; serializer["depth"]["bias"]["clamp"] = depth.bias.clamp; -// if ( renderMode != "Gui" ) uf::iostream << this << ": " << indices << ": " << renderMode << ": " << subpass << ": " << serializer << "\n"; -// return uf::string::sha256( serializer.serialize() ); - return serializer.dump(); + return uf::string::sha256( serializer.serialize() ); +// return serializer.dump(); +#else + size_t hash{}; + + hash += std::hash{}(subpass); + if ( settings::experimental::individualPipelines ) + hash += std::hash{}(renderMode); + + hash += std::hash{}(renderTarget); + hash += std::hash{}(geometry.attributes.vertex.size); + hash += std::hash{}(geometry.attributes.index.size); + hash += std::hash{}(indices); + hash += std::hash{}(offsets.vertex); + hash += std::hash{}(offsets.index); + + for ( uint8_t i = 0; i < geometry.attributes.descriptor.size(); ++i ) { + hash += std::hash{}(geometry.attributes.descriptor[i].format); + hash += std::hash{}(geometry.attributes.descriptor[i].offset); + } + + hash += std::hash{}(topology); + hash += std::hash{}(cullMode); + hash += std::hash{}(fill); + hash += std::hash{}(lineWidth); + hash += std::hash{}(frontFace); + hash += std::hash{}(depth.test); + hash += std::hash{}(depth.write); + hash += std::hash{}(depth.operation); + hash += std::hash{}(depth.bias.enable); + hash += std::hash{}(depth.bias.constant); + hash += std::hash{}(depth.bias.slope); + hash += std::hash{}(depth.bias.clamp); + + return hash; +#endif } #endif \ No newline at end of file diff --git a/engine/src/ext/vulkan/rendermode.cpp b/engine/src/ext/vulkan/rendermode.cpp index d5eaed8f..1ee42cf9 100644 --- a/engine/src/ext/vulkan/rendermode.cpp +++ b/engine/src/ext/vulkan/rendermode.cpp @@ -20,8 +20,9 @@ const std::string ext::vulkan::RenderMode::getType() const { return ""; } const std::string ext::vulkan::RenderMode::getName() const { - auto& metadata = *const_cast(&this->metadata); - return metadata["name"].as(); +// auto& metadata = *const_cast(&this->metadata); +// return metadata["name"].as(); + return metadata.name; } ext::vulkan::RenderTarget& ext::vulkan::RenderMode::getRenderTarget( size_t i ) { return renderTarget; @@ -162,29 +163,9 @@ ext::vulkan::GraphicDescriptor ext::vulkan::RenderMode::bindGraphicDescriptor( c ext::vulkan::GraphicDescriptor descriptor = reference; // descriptor.renderMode = this->getName(); descriptor.subpass = pass; - descriptor.parse( metadata ); + descriptor.parse( metadata.json["descriptor"] ); return descriptor; } -void ext::vulkan::RenderMode::bindGraphicPushConstants( ext::vulkan::Graphic* pointer, size_t pass ) { - auto& graphic = *pointer; - // bind vertex shader push constants - { - auto& shader = graphic.material.getShader("vertex"); - auto& metadata = shader.metadata["definitions"]["pushConstants"]["PushConstant"]; - struct PushConstant { - uint32_t pass = 0; - }; - if ( ext::json::isObject( metadata ) ) { - auto& pushConstant = shader.pushConstants.at( metadata["index"].as() ).get(); - pushConstant.pass = pass; - } - } - // bind fragment shader push constants - { - auto& shader = graphic.material.getShader("fragment"); - auto& metadata = shader.metadata["definitions"]["pushConstants"]["PushConstant"]; - } -} void ext::vulkan::RenderMode::createCommandBuffers() { this->execute = true; @@ -258,7 +239,7 @@ void ext::vulkan::RenderMode::bindPipelines( const std::vector() == descriptor.pipeline ) ++shaders; + if ( shader.metadata.pipeline == descriptor.pipeline ) ++shaders; } if ( shaders == 0 ) continue; graphic.initializePipeline( descriptor ); diff --git a/engine/src/ext/vulkan/rendermodes/base.cpp b/engine/src/ext/vulkan/rendermodes/base.cpp index 3db80363..18768282 100644 --- a/engine/src/ext/vulkan/rendermodes/base.cpp +++ b/engine/src/ext/vulkan/rendermodes/base.cpp @@ -98,7 +98,7 @@ void ext::vulkan::BaseRenderMode::render() { } void ext::vulkan::BaseRenderMode::initialize( Device& device ) { - this->metadata["name"] = "Swapchain"; + this->metadata.name = "Swapchain"; auto windowSize = device.window->getSize(); this->width = windowSize.x; this->height = windowSize.y; diff --git a/engine/src/ext/vulkan/rendermodes/deferred.cpp b/engine/src/ext/vulkan/rendermodes/deferred.cpp index 7417327c..00d711c5 100644 --- a/engine/src/ext/vulkan/rendermodes/deferred.cpp +++ b/engine/src/ext/vulkan/rendermodes/deferred.cpp @@ -28,8 +28,7 @@ std::vector ext::vulkan::DeferredRenderMode::getBlitters( } void ext::vulkan::DeferredRenderMode::initialize( Device& device ) { - if ( !metadata["eyes"].is() ) metadata["eyes"] = 1; - metadata["outputs"] = ext::json::array(); + if ( metadata.eyes == 0 ) metadata.eyes = 1; { float width = this->width > 0 ? this->width : ext::vulkan::settings::width; float height = this->height > 0 ? this->height : ext::vulkan::settings::height; @@ -41,9 +40,8 @@ void ext::vulkan::DeferredRenderMode::initialize( Device& device ) { ext::vulkan::RenderMode::initialize( device ); renderTarget.device = &device; - size_t eyes = metadata["eyes"].as(); size_t msaa = ext::vulkan::settings::msaa; - for ( size_t eye = 0; eye < eyes; ++eye ) { + for ( size_t eye = 0; eye < metadata.eyes; ++eye ) { struct { size_t id, normals, uvs, albedo, depth, output, debug; } attachments; @@ -128,7 +126,7 @@ void ext::vulkan::DeferredRenderMode::initialize( Device& device ) { /*.blend =*/ false, /*.samples =*/ 1, }); - metadata["outputs"].emplace_back(attachments.output); + metadata.outputs.emplace_back(attachments.output); #if 0 attachments.debug = renderTarget.attach(RenderTarget::Attachment::Descriptor{ /*.format = */VK_FORMAT_R16G16B16A16_SFLOAT, @@ -242,13 +240,13 @@ void ext::vulkan::DeferredRenderMode::initialize( Device& device ) { specializationConstants.maxCascades = maxCascades; */ uint32_t* specializationConstants = (uint32_t*) (void*) &shader.specializationConstants; - ext::json::forEach( shader.metadata["specializationConstants"], [&]( size_t i, ext::json::Value& sc ){ + ext::json::forEach( shader.metadata.json["specializationConstants"], [&]( size_t i, ext::json::Value& sc ){ std::string name = sc["name"].as(); if ( name == "TEXTURES" ) sc["value"] = (specializationConstants[i] = maxTextures2D); else if ( name == "CUBEMAPS" ) sc["value"] = (specializationConstants[i] = maxTexturesCube); else if ( name == "CASCADES" ) sc["value"] = (specializationConstants[i] = maxCascades); }); - ext::json::forEach( shader.metadata["definitions"]["textures"], [&]( ext::json::Value& t ){ + ext::json::forEach( shader.metadata.json["definitions"]["textures"], [&]( ext::json::Value& t ){ size_t binding = t["binding"].as(); std::string name = t["name"].as(); for ( auto& layout : shader.descriptorSetLayoutBindings ) { @@ -272,13 +270,13 @@ void ext::vulkan::DeferredRenderMode::initialize( Device& device ) { specializationConstants.maxTexturesCube = maxTexturesCube; */ uint32_t* specializationConstants = (uint32_t*) (void*) &shader.specializationConstants; - ext::json::forEach( shader.metadata["specializationConstants"], [&]( size_t i, ext::json::Value& sc ){ + ext::json::forEach( shader.metadata.json["specializationConstants"], [&]( size_t i, ext::json::Value& sc ){ std::string name = sc["name"].as(); if ( name == "TEXTURES" ) sc["value"] = (specializationConstants[i] = maxTextures2D); else if ( name == "CUBEMAPS" ) sc["value"] = (specializationConstants[i] = maxTexturesCube); }); - ext::json::forEach( shader.metadata["definitions"]["textures"], [&]( ext::json::Value& t ){ + ext::json::forEach( shader.metadata.json["definitions"]["textures"], [&]( ext::json::Value& t ){ size_t binding = t["binding"].as(); std::string name = t["name"].as(); for ( auto& layout : shader.descriptorSetLayoutBindings ) { @@ -296,31 +294,31 @@ void ext::vulkan::DeferredRenderMode::initialize( Device& device ) { for ( auto& material : materials ) material.colorBase = {0,0,0,0}; - this->metadata["lightBufferIndex"] = blitter.initializeBuffer( + metadata.lightBufferIndex = blitter.initializeBuffer( (void*) lights.data(), lights.size() * sizeof(pod::Light::Storage), VK_BUFFER_USAGE_STORAGE_BUFFER_BIT ); - this->metadata["materialBufferIndex"] = blitter.initializeBuffer( + metadata.materialBufferIndex = blitter.initializeBuffer( (void*) materials.data(), materials.size() * sizeof(pod::Material::Storage), VK_BUFFER_USAGE_STORAGE_BUFFER_BIT ); - this->metadata["textureBufferIndex"] = blitter.initializeBuffer( + metadata.textureBufferIndex = blitter.initializeBuffer( (void*) textures.data(), textures.size() * sizeof(pod::Texture::Storage), VK_BUFFER_USAGE_STORAGE_BUFFER_BIT ); - this->metadata["drawCallBufferIndex"] = blitter.initializeBuffer( + metadata.drawCallBufferIndex = blitter.initializeBuffer( (void*) drawCalls.data(), drawCalls.size() * sizeof(pod::DrawCall::Storage), VK_BUFFER_USAGE_STORAGE_BUFFER_BIT ); } // blitter.initializePipeline(); - for ( size_t eye = 0; eye < eyes; ++eye ) { + for ( size_t eye = 0; eye < metadata.eyes; ++eye ) { blitter.descriptor.subpass = 2 * eye + 1; if ( blitter.hasPipeline( blitter.descriptor ) ) continue; blitter.initializePipeline( blitter.descriptor ); @@ -331,20 +329,20 @@ void ext::vulkan::DeferredRenderMode::initialize( Device& device ) { void ext::vulkan::DeferredRenderMode::tick() { ext::vulkan::RenderMode::tick(); - if ( ext::vulkan::states::resized ) { + bool resized = this->width == 0 && this->height == 0 && ext::vulkan::states::resized; + bool rebuild = resized || ext::vulkan::states::rebuild || this->rebuild; + + if ( resized ) { renderTarget.initialize( *renderTarget.device ); - // update blitter descriptor set - if ( blitter.initialized ) { - size_t eyes = metadata["eyes"].as(); - for ( size_t eye = 0; eye < eyes; ++eye ) { - blitter.descriptor.subpass = 2 * eye + 1; - if ( !blitter.hasPipeline( blitter.descriptor ) ) continue; - blitter.getPipeline( blitter.descriptor ).update( blitter, blitter.descriptor ); - } - blitter.descriptor.subpass = 1; - // blitter.getPipeline().update( blitter ); - // blitter.updatePipelines(); + } + // update blitter descriptor set + if ( rebuild && blitter.initialized ) { + for ( size_t eye = 0; eye < metadata.eyes; ++eye ) { + blitter.descriptor.subpass = 2 * eye + 1; + if ( !blitter.hasPipeline( blitter.descriptor ) ) continue; + blitter.getPipeline( blitter.descriptor ).update( blitter, blitter.descriptor ); } + blitter.descriptor.subpass = 1; } } void ext::vulkan::DeferredRenderMode::destroy() { @@ -360,9 +358,6 @@ void ext::vulkan::DeferredRenderMode::createCommandBuffers( const std::vectorwidth > 0 ? this->width : ext::vulkan::settings::width; float height = this->height > 0 ? this->height : ext::vulkan::settings::height; - if ( !metadata["eyes"].is() ) metadata["eyes"] = 1; - size_t eyes = metadata["eyes"].as(); - VkCommandBufferBeginInfo cmdBufInfo = {}; cmdBufInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO; cmdBufInfo.pNext = nullptr; @@ -442,7 +437,7 @@ void ext::vulkan::DeferredRenderMode::createCommandBuffers( const std::vector 0 ? swapchainRender.height : ext::vulkan::settings::height, 1 }; - auto& outputAttachment = renderTarget.attachments[metadata["outputs"][0].as()]; + auto& outputAttachment = renderTarget.attachments[metadata.outputs.front()]; // Transition to KHR { imageMemoryBarrier.image = outputAttachment.image; diff --git a/engine/src/ext/vulkan/rendermodes/rendertarget.cpp b/engine/src/ext/vulkan/rendermodes/rendertarget.cpp index a0f7fd87..88b5797b 100644 --- a/engine/src/ext/vulkan/rendermodes/rendertarget.cpp +++ b/engine/src/ext/vulkan/rendermodes/rendertarget.cpp @@ -9,11 +9,13 @@ #include const std::string ext::vulkan::RenderTargetRenderMode::getTarget() const { - auto& metadata = *const_cast(&this->metadata); - return metadata["target"].as(); +// auto& metadata = *const_cast(&this->metadata); +// return metadata["target"].as(); + return metadata.target; } void ext::vulkan::RenderTargetRenderMode::setTarget( const std::string& target ) { - this->metadata["target"] = target; +// this->metadata["target"] = target; + metadata.target = target; } void ext::vulkan::RenderTargetRenderMode::bindCallback( int32_t subpass, const ext::vulkan::RenderTargetRenderMode::callback_t& callback ) { commandBufferCallbacks[subpass] = callback; @@ -34,20 +36,18 @@ std::vector ext::vulkan::RenderTargetRenderMode::getBlitt ext::vulkan::GraphicDescriptor ext::vulkan::RenderTargetRenderMode::bindGraphicDescriptor( const ext::vulkan::GraphicDescriptor& reference, size_t pass ) { ext::vulkan::GraphicDescriptor descriptor = ext::vulkan::RenderMode::bindGraphicDescriptor(reference, pass); - descriptor.parse(metadata["descriptor"]); - std::string type = metadata["type"].as(); - std::string target = metadata["target"].as(); - size_t subpasses = metadata["subpasses"].as(); - if ( 0 <= pass && pass < subpasses && type == "vxgi" ) { + descriptor.parse(metadata.json["descriptor"]); + + if ( 0 <= pass && pass < metadata.subpasses && metadata.type == "vxgi" ) { descriptor.cullMode = VK_CULL_MODE_NONE; descriptor.depth.test = false; descriptor.depth.write = false; descriptor.pipeline = "vxgi"; - } else if ( type == "depth" ) { + } else if ( metadata.type == "depth" ) { descriptor.cullMode = VK_CULL_MODE_NONE; } // invalidate - if ( target != "" && descriptor.renderMode != this->getName() && descriptor.renderMode != target ) { + if ( metadata.target != "" && descriptor.renderMode != this->getName() && descriptor.renderMode != metadata.target ) { descriptor.invalidated = true; } else { descriptor.renderMode = this->getName(); @@ -59,14 +59,11 @@ void ext::vulkan::RenderTargetRenderMode::initialize( Device& device ) { ext::vulkan::RenderMode::initialize( device ); this->setTarget( this->getName() ); - std::string type = metadata["type"].as(); - size_t subpasses = metadata["subpasses"].as(); - size_t msaa = metadata["samples"].is() ? ext::vulkan::sampleCount(metadata["samples"].as()) : ext::vulkan::settings::msaa; - metadata["outputs"] = ext::json::array(); - if ( subpasses == 0 ) subpasses = 1; + uint8_t msaa = ext::vulkan::sampleCount(metadata.samples); + if ( metadata.subpasses == 0 ) metadata.subpasses = 1; renderTarget.device = &device; - if ( type == "depth" || type == "vxgi" ) { - renderTarget.views = subpasses; + if ( metadata.type == "depth" || metadata.type == "vxgi" ) { + renderTarget.views = metadata.subpasses; struct { size_t depth; } attachments; @@ -78,7 +75,7 @@ void ext::vulkan::RenderTargetRenderMode::initialize( Device& device ) { /*.blend = */ false, /*.samples = */ 1, }); - for ( size_t currentPass = 0; currentPass < subpasses; ++currentPass ) { + for ( size_t currentPass = 0; currentPass < metadata.subpasses; ++currentPass ) { renderTarget.addPass( VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, {}, @@ -90,8 +87,8 @@ void ext::vulkan::RenderTargetRenderMode::initialize( Device& device ) { ); } } else { - for ( size_t currentPass = 0; currentPass < subpasses; ++currentPass ) { - if ( type == "depth" || type == "vxgi" ) { + for ( size_t currentPass = 0; currentPass < metadata.subpasses; ++currentPass ) { + if ( metadata.type == "depth" || metadata.type == "vxgi" ) { struct { size_t depth; } attachments; @@ -112,7 +109,7 @@ void ext::vulkan::RenderTargetRenderMode::initialize( Device& device ) { 0, true ); - } else if ( type == "single" ) { + } else if ( metadata.type == "single" ) { struct { size_t albedo, depth; } attachments; @@ -297,8 +294,7 @@ void ext::vulkan::RenderTargetRenderMode::initialize( Device& device ) { ); } } - // metadata["outputs"][0] = attachments.output; - metadata["outputs"].emplace_back(attachments.output); + metadata.outputs.emplace_back(attachments.output); #endif } } @@ -321,9 +317,9 @@ void ext::vulkan::RenderTargetRenderMode::initialize( Device& device ) { blitter.device = &device; blitter.material.device = &device; blitter.initializeMesh( mesh ); - if ( ext::json::isArray( metadata["shaders"] ) ) { - ext::json::forEach( metadata["shaders"], [&]( ext::json::Value& value ){ - ext::vulkan::enums::Shader::type_t type; + if ( ext::json::isArray( metadata.json["shaders"] ) ) { + ext::json::forEach( metadata.json["shaders"], [&]( ext::json::Value& value ){ + ext::vulkan::enums::Shader::type_t type{}; std::string filename = ""; std::string pipeline = ""; @@ -350,9 +346,9 @@ void ext::vulkan::RenderTargetRenderMode::initialize( Device& device ) { blitter.material.attachShader( uf::io::root+filename, type, pipeline ); }); - } else if ( ext::json::isObject( metadata["shaders"] ) ) { - ext::json::forEach( metadata["shaders"], [&]( const std::string& key, ext::json::Value& value ){ - ext::vulkan::enums::Shader::type_t type; + } else if ( ext::json::isObject( metadata.json["shaders"] ) ) { + ext::json::forEach( metadata.json["shaders"], [&]( const std::string& key, ext::json::Value& value ){ + ext::vulkan::enums::Shader::type_t type{}; std::string filename = ""; std::string pipeline = ""; if ( value.is() ) { @@ -368,7 +364,7 @@ void ext::vulkan::RenderTargetRenderMode::initialize( Device& device ) { blitter.material.attachShader( uf::io::root+filename, type, pipeline ); }); - } else if ( metadata["shaders"].is() && !metadata["shaders"].as() ) { + } else if ( metadata.json["shaders"].is() && !metadata.json["shaders"].as() ) { // do not attach if we're requesting no blitter shaders blitter.process = false; } else { @@ -378,7 +374,7 @@ void ext::vulkan::RenderTargetRenderMode::initialize( Device& device ) { {uf::io::root+"/shaders/display/renderTarget." + fragmentShaderFilename + "frag.spv", VK_SHADER_STAGE_FRAGMENT_BIT} }); } - if ( metadata["type"].as() == "vxgi" ) { + if ( metadata.type == "vxgi" ) { auto& scene = uf::scene::getCurrentScene(); auto& sceneMetadataJson = scene.getComponent(); @@ -389,26 +385,16 @@ void ext::vulkan::RenderTargetRenderMode::initialize( Device& device ) { size_t maxCascades = sceneMetadataJson["system"]["config"]["engine"]["scenes"]["vxgi"]["cascades"].as(16); auto& shader = blitter.material.getShader("compute"); - /* - struct SpecializationConstant { - uint32_t maxTextures2D = 512; - uint32_t maxTexturesCube = 128; - uint32_t maxCascades = 16; - }; - auto& specializationConstants = shader.specializationConstants.get(); - specializationConstants.maxTextures2D = maxTextures2D; - specializationConstants.maxTexturesCube = maxTexturesCube; - specializationConstants.maxCascades = maxCascades; - */ + uint32_t* specializationConstants = (uint32_t*) (void*) &shader.specializationConstants; - ext::json::forEach( shader.metadata["specializationConstants"], [&]( size_t i, ext::json::Value& sc ){ + ext::json::forEach( shader.metadata.json["specializationConstants"], [&]( size_t i, ext::json::Value& sc ){ std::string name = sc["name"].as(); if ( name == "TEXTURES" ) sc["value"] = (specializationConstants[i] = maxTextures2D); else if ( name == "CUBEMAPS" ) sc["value"] = (specializationConstants[i] = maxTexturesCube); else if ( name == "CASCADES" ) sc["value"] = (specializationConstants[i] = maxCascades); }); - ext::json::forEach( shader.metadata["definitions"]["textures"], [&]( ext::json::Value& t ){ + ext::json::forEach( shader.metadata.json["definitions"]["textures"], [&]( ext::json::Value& t ){ size_t binding = t["binding"].as(); std::string name = t["name"].as(); for ( auto& layout : shader.descriptorSetLayoutBindings ) { @@ -429,24 +415,24 @@ void ext::vulkan::RenderTargetRenderMode::initialize( Device& device ) { for ( auto& material : materials ) material.colorBase = {0,0,0,0}; - this->metadata["lightBufferIndex"] = blitter.initializeBuffer( + metadata.lightBufferIndex = blitter.initializeBuffer( (void*) lights.data(), lights.size() * sizeof(pod::Light::Storage), VK_BUFFER_USAGE_STORAGE_BUFFER_BIT ); - this->metadata["materialBufferIndex"] = blitter.initializeBuffer( + metadata.materialBufferIndex = blitter.initializeBuffer( (void*) materials.data(), materials.size() * sizeof(pod::Material::Storage), VK_BUFFER_USAGE_STORAGE_BUFFER_BIT ); - this->metadata["textureBufferIndex"] = blitter.initializeBuffer( + metadata.textureBufferIndex = blitter.initializeBuffer( (void*) textures.data(), textures.size() * sizeof(pod::Texture::Storage), VK_BUFFER_USAGE_STORAGE_BUFFER_BIT ); - this->metadata["drawCallBufferIndex"] = blitter.initializeBuffer( + metadata.drawCallBufferIndex = blitter.initializeBuffer( (void*) drawCalls.data(), drawCalls.size() * sizeof(pod::DrawCall::Storage), VK_BUFFER_USAGE_STORAGE_BUFFER_BIT @@ -485,18 +471,21 @@ void ext::vulkan::RenderTargetRenderMode::initialize( Device& device ) { void ext::vulkan::RenderTargetRenderMode::tick() { ext::vulkan::RenderMode::tick(); - if ( metadata["type"].as() == "vxgi" ) { - if ( ext::vulkan::states::resized ) { + + bool resized = this->width == 0 && this->height == 0 && ext::vulkan::states::resized; + bool rebuild = resized || ext::vulkan::states::rebuild || this->rebuild; + + if ( metadata.type == "vxgi" ) { + if ( resized ) { renderTarget.initialize( *renderTarget.device ); - if ( blitter.process ) { - blitter.getPipeline().update( blitter ); - } + } + if ( rebuild && blitter.process ) { + blitter.getPipeline().update( blitter ); } return; } - if ( ext::vulkan::states::resized ) { + if ( resized ) { renderTarget.initialize( *renderTarget.device ); - // for ( auto& texture : blitter.material.textures ) texture.sampler.destroy(); blitter.material.textures.clear(); for ( auto& attachment : renderTarget.attachments ) { if ( !(attachment.descriptor.usage & VK_IMAGE_USAGE_SAMPLED_BIT) ) continue; @@ -507,20 +496,18 @@ void ext::vulkan::RenderTargetRenderMode::tick() { texture.sampler.descriptor.filter.mag = filter; texture.aliasAttachment(attachment); } - if ( blitter.process ) { - auto& mainRenderMode = ext::vulkan::getRenderMode(""); - size_t eyes = mainRenderMode.metadata["eyes"].as(); - for ( size_t eye = 0; eye < eyes; ++eye ) { - ext::vulkan::GraphicDescriptor descriptor = blitter.descriptor; - descriptor.subpass = 2 * eye + 1; - if ( !blitter.hasPipeline( descriptor ) ) { - // continue; - blitter.initializePipeline( descriptor ); - } else { - blitter.getPipeline( descriptor ).update( blitter, descriptor ); - } + } + if ( rebuild && blitter.process ) { + auto& mainRenderMode = ext::vulkan::getRenderMode(""); + size_t eyes = mainRenderMode.metadata.eyes; + for ( size_t eye = 0; eye < eyes; ++eye ) { + ext::vulkan::GraphicDescriptor descriptor = blitter.descriptor; + descriptor.subpass = 2 * eye + 1; + if ( !blitter.hasPipeline( descriptor ) ) { + blitter.initializePipeline( descriptor ); + } else { + blitter.getPipeline( descriptor ).update( blitter, descriptor ); } - // blitter.getPipeline().update( blitter ); } } } diff --git a/engine/src/ext/vulkan/rendertarget.cpp b/engine/src/ext/vulkan/rendertarget.cpp index b86efa19..d11c1c6a 100644 --- a/engine/src/ext/vulkan/rendertarget.cpp +++ b/engine/src/ext/vulkan/rendertarget.cpp @@ -231,9 +231,9 @@ void ext::vulkan::RenderTarget::initialize( Device& device ) { descriptions.push_back(description); #if 0 - UF_DEBUG_MSG("Pass: " << descriptions.size() - 1); - for ( auto& color : pass.colors ) UF_DEBUG_MSG("Color: " << color.attachment << "\t" << std::hex << color.layout << "\t" << this->attachments[color.attachment].image); - for ( auto& input : pass.inputs ) UF_DEBUG_MSG("Input: " << input.attachment << "\t" << std::hex << input.layout << "\t" << this->attachments[input.attachment].image); + UF_MSG_DEBUG("Pass: " << descriptions.size() - 1); + for ( auto& color : pass.colors ) UF_MSG_DEBUG("Color: " << color.attachment << "\t" << std::hex << color.layout << "\t" << this->attachments[color.attachment].image); + for ( auto& input : pass.inputs ) UF_MSG_DEBUG("Input: " << input.attachment << "\t" << std::hex << input.layout << "\t" << this->attachments[input.attachment].image); std::cout << std::endl; #endif // transition dependency between subpasses @@ -289,9 +289,9 @@ void ext::vulkan::RenderTarget::initialize( Device& device ) { #if 0 for ( auto& dependency : dependencies ) { - UF_DEBUG_MSG("Pass: " << dependency.srcSubpass << " -> " << dependency.dstSubpass); - UF_DEBUG_MSG("\tStage: " << std::hex << dependency.srcStageMask << " -> " << std::hex << dependency.dstStageMask); - UF_DEBUG_MSG("\tAccess: " << std::hex << dependency.srcAccessMask << " -> " << std::hex << dependency.dstAccessMask); + UF_MSG_DEBUG("Pass: " << dependency.srcSubpass << " -> " << dependency.dstSubpass); + UF_MSG_DEBUG("\tStage: " << std::hex << dependency.srcStageMask << " -> " << std::hex << dependency.dstStageMask); + UF_MSG_DEBUG("\tAccess: " << std::hex << dependency.srcAccessMask << " -> " << std::hex << dependency.dstAccessMask); } std::cout << std::endl; #endif diff --git a/engine/src/ext/vulkan/shader.cpp b/engine/src/ext/vulkan/shader.cpp index 71d7739d..bdeb021a 100644 --- a/engine/src/ext/vulkan/shader.cpp +++ b/engine/src/ext/vulkan/shader.cpp @@ -272,7 +272,7 @@ ext::vulkan::userdata_t ext::vulkan::jsonToUserdata( const ext::json::Value& pay if ( !variableName.empty() ) variableName.pop_back(); #endif }; - auto& definitions = metadata["definitions"]["uniforms"][name]; + auto& definitions = metadata.json["definitions"]["uniforms"][name]; #if UF_SHADER_TRACK_NAMES VK_VALIDATION_MESSAGE("Updating " << name << " in " << filename); VK_VALIDATION_MESSAGE("Iterator: " << (void*) byteBuffer << "\t" << (void*) byteBufferEnd << "\t" << (byteBufferEnd - byteBuffer)); @@ -323,8 +323,8 @@ void ext::vulkan::Shader::initialize( ext::vulkan::Device& device, const std::st } // set up metadata { - metadata["filename"] = filename; - metadata["type"] = ""; + metadata.json["filename"] = filename; + metadata.type = ""; } // do reflection { @@ -465,11 +465,11 @@ void ext::vulkan::Shader::initialize( ext::vulkan::Device& device, const std::st } size_t binding = comp.get_decoration(resource.id, spv::DecorationBinding); std::string key = std::to_string(binding); - metadata["definitions"]["textures"][key]["name"] = name; - metadata["definitions"]["textures"][key]["index"] = index; - metadata["definitions"]["textures"][key]["binding"] = binding; - metadata["definitions"]["textures"][key]["size"] = arraySize; - metadata["definitions"]["textures"][key]["type"] = tname; + metadata.json["definitions"]["textures"][key]["name"] = name; + metadata.json["definitions"]["textures"][key]["index"] = index; + metadata.json["definitions"]["textures"][key]["binding"] = binding; + metadata.json["definitions"]["textures"][key]["size"] = arraySize; + metadata.json["definitions"]["textures"][key]["type"] = tname; } break; case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER: { size_t bufferSize = comp.get_declared_struct_size(base_type); @@ -490,18 +490,18 @@ void ext::vulkan::Shader::initialize( ext::vulkan::Device& device, const std::st } // generate definition to JSON { - metadata["definitions"]["uniforms"][name]["name"] = name; - metadata["definitions"]["uniforms"][name]["index"] = index; - metadata["definitions"]["uniforms"][name]["size"] = bufferSize; - metadata["definitions"]["uniforms"][name]["members"] = parseMembers(resource.type_id); + metadata.json["definitions"]["uniforms"][name]["name"] = name; + metadata.json["definitions"]["uniforms"][name]["index"] = index; + metadata.json["definitions"]["uniforms"][name]["size"] = bufferSize; + metadata.json["definitions"]["uniforms"][name]["members"] = parseMembers(resource.type_id); } } break; case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER: { // generate definition to JSON { - metadata["definitions"]["storage"][name]["name"] = name; - metadata["definitions"]["storage"][name]["index"] = index; - metadata["definitions"]["storage"][name]["members"] = parseMembers(resource.type_id); + metadata.json["definitions"]["storage"][name]["name"] = name; + metadata.json["definitions"]["storage"][name]["index"] = index; + metadata.json["definitions"]["storage"][name]["members"] = parseMembers(resource.type_id); } // test { @@ -552,10 +552,10 @@ void ext::vulkan::Shader::initialize( ext::vulkan::Device& device, const std::st } // generate definition to JSON { - metadata["definitions"]["pushConstants"][name]["name"] = name; - metadata["definitions"]["pushConstants"][name]["size"] = size; - metadata["definitions"]["pushConstants"][name]["index"] = pushConstants.size() - 1; - metadata["definitions"]["pushConstants"][name]["members"] = parseMembers(resource.type_id); + metadata.json["definitions"]["pushConstants"][name]["name"] = name; + metadata.json["definitions"]["pushConstants"][name]["size"] = size; + metadata.json["definitions"]["pushConstants"][name]["index"] = pushConstants.size() - 1; + metadata.json["definitions"]["pushConstants"][name]["members"] = parseMembers(resource.type_id); } } @@ -579,7 +579,7 @@ void ext::vulkan::Shader::initialize( ext::vulkan::Device& device, const std::st uint8_t* s = (uint8_t*) (void*) specializationConstants; size_t offset = 0; - metadata["specializationConstants"] = ext::json::array(); + metadata.json["specializationConstants"] = ext::json::array(); for ( const auto& constant : comp.get_specialization_constants() ) { const auto& value = comp.get_constant(constant.id); const auto& type = comp.get_type(value.constant_type); @@ -623,7 +623,7 @@ void ext::vulkan::Shader::initialize( ext::vulkan::Device& device, const std::st member["size"] = size; member["default"] = member["value"]; VK_DEBUG_VALIDATION_MESSAGE("Specialization constant: " << member["type"].as() << " " << name << " = " << member["value"].dump() << "; at offset " << offset << " for shader " << filename ); - metadata["specializationConstants"].emplace_back(member); + metadata.json["specializationConstants"].emplace_back(member); memcpy( &s[offset], &buffer, size ); offset += size; @@ -698,11 +698,11 @@ bool ext::vulkan::Shader::validate() { return valid; } bool ext::vulkan::Shader::hasUniform( const std::string& name ) { - return !ext::json::isNull(metadata["definitions"]["uniforms"][name]); + return !ext::json::isNull(metadata.json["definitions"]["uniforms"][name]); } ext::vulkan::Buffer* ext::vulkan::Shader::getUniformBuffer( const std::string& name ) { if ( !hasUniform(name) ) return NULL; - size_t uniformIndex = metadata["definitions"]["uniforms"][name]["index"].as(); + size_t uniformIndex = metadata.json["definitions"]["uniforms"][name]["index"].as(); for ( size_t bufferIndex = 0, uniformCounter = 0; bufferIndex < buffers.size(); ++bufferIndex ) { if ( !(buffers[bufferIndex].usage & VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT) ) continue; if ( uniformCounter++ != uniformIndex ) continue; @@ -715,7 +715,7 @@ ext::vulkan::userdata_t& ext::vulkan::Shader::getUniform( const std::string& nam static ext::vulkan::userdata_t null; return null; } - auto& definition = metadata["definitions"]["uniforms"][name]; + auto& definition = metadata.json["definitions"]["uniforms"][name]; size_t uniformSize = definition["size"].as(); size_t uniformIndex = definition["index"].as(); auto& userdata = uniforms[uniformIndex]; @@ -730,21 +730,21 @@ bool ext::vulkan::Shader::updateUniform( const std::string& name, const ext::vul if ( !hasUniform(name) ) return false; auto* bufferObject = getUniformBuffer(name); if ( !bufferObject ) return false; - size_t size = std::max(metadata["definitions"]["uniforms"][name]["size"].as(), bufferObject->allocationInfo.size); + size_t size = std::max(metadata.json["definitions"]["uniforms"][name]["size"].as(), bufferObject->allocationInfo.size); updateBuffer( (void*) userdata, size, *bufferObject ); return true; } uf::Serializer ext::vulkan::Shader::getUniformJson( const std::string& name, bool cache ) { if ( !hasUniform(name) ) return ext::json::null(); - if ( cache && !ext::json::isNull(metadata["uniforms"][name]) ) return metadata["uniforms"][name]; - auto& definition = metadata["definitions"]["uniforms"][name]; - if ( cache ) return metadata["uniforms"][name] = definitionToJson(definition); + if ( cache && !ext::json::isNull(metadata.json["uniforms"][name]) ) return metadata.json["uniforms"][name]; + auto& definition = metadata.json["definitions"]["uniforms"][name]; + if ( cache ) return metadata.json["uniforms"][name] = definitionToJson(definition); return definitionToJson(definition); } ext::vulkan::userdata_t ext::vulkan::Shader::getUniformUserdata( const std::string& name, const ext::json::Value& payload ) { if ( !hasUniform(name) ) return false; - return jsonToUserdata(payload, metadata["definitions"]["uniforms"][name]); + return jsonToUserdata(payload, metadata.json["definitions"]["uniforms"][name]); } bool ext::vulkan::Shader::updateUniform( const std::string& name, const ext::json::Value& payload ) { if ( !hasUniform(name) ) return false; @@ -758,12 +758,12 @@ bool ext::vulkan::Shader::updateUniform( const std::string& name, const ext::jso } bool ext::vulkan::Shader::hasStorage( const std::string& name ) { - return !ext::json::isNull(metadata["definitions"]["storage"][name]); + return !ext::json::isNull(metadata.json["definitions"]["storage"][name]); } ext::vulkan::Buffer* ext::vulkan::Shader::getStorageBuffer( const std::string& name ) { if ( !hasStorage(name) ) return NULL; - size_t storageIndex = metadata["definitions"]["storage"][name]["index"].as(); + size_t storageIndex = metadata.json["definitions"]["storage"][name]["index"].as(); for ( size_t bufferIndex = 0, storageCounter = 0; bufferIndex < buffers.size(); ++bufferIndex ) { if ( !(buffers[bufferIndex].usage & VK_BUFFER_USAGE_STORAGE_BUFFER_BIT) ) continue; if ( storageCounter++ != storageIndex ) continue; @@ -773,14 +773,14 @@ ext::vulkan::Buffer* ext::vulkan::Shader::getStorageBuffer( const std::string& n } uf::Serializer ext::vulkan::Shader::getStorageJson( const std::string& name, bool cache ) { if ( !hasStorage(name) ) return ext::json::null(); - if ( cache && !ext::json::isNull(metadata["storage"][name]) ) return metadata["storage"][name]; - auto& definition = metadata["definitions"]["storage"][name]; - if ( cache ) return metadata["storage"][name] = definitionToJson(definition); + if ( cache && !ext::json::isNull(metadata.json["storage"][name]) ) return metadata.json["storage"][name]; + auto& definition = metadata.json["definitions"]["storage"][name]; + if ( cache ) return metadata.json["storage"][name] = definitionToJson(definition); return definitionToJson(definition); } ext::vulkan::userdata_t ext::vulkan::Shader::getStorageUserdata( const std::string& name, const ext::json::Value& payload ) { if ( !hasStorage(name) ) return false; - return jsonToUserdata(payload, metadata["definitions"]["storage"][name]); + return jsonToUserdata(payload, metadata.json["definitions"]["storage"][name]); } #endif \ No newline at end of file diff --git a/engine/src/ext/vulkan/texture.cpp b/engine/src/ext/vulkan/texture.cpp index 68fffb7d..442f365f 100644 --- a/engine/src/ext/vulkan/texture.cpp +++ b/engine/src/ext/vulkan/texture.cpp @@ -462,13 +462,34 @@ void ext::vulkan::Texture::fromBuffers( viewCreateInfo.image = image; VK_CHECK_RESULT(vkCreateImageView(device.logicalDevice, &viewCreateInfo, nullptr, &view)); - if ( data ) { + if ( data && bufferSize ) { uint8_t* layerPointer = (uint8_t*) data; VkDeviceSize layerSize = bufferSize / this->layers; for ( size_t layer = 0; layer < this->layers; ++layer ) { this->update( (void*) layerPointer, layerSize, imageLayout, layer ); layerPointer += layerSize; } + } else { + // Create image view + VkImageSubresourceRange subresourceRange = {}; + subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + subresourceRange.baseMipLevel = 0; + subresourceRange.baseArrayLayer = 0; + subresourceRange.levelCount = this->mips; + subresourceRange.layerCount = this->layers; + + VkCommandBuffer commandBuffer = device.createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true); + setImageLayout( + commandBuffer, + image, + this->imageLayout, + imageLayout, + subresourceRange + ); + device.flushCommandBuffer(commandBuffer); + + this->imageLayout = imageLayout; + this->updateDescriptors(); } /* if ( this->layers > 1 ) { @@ -610,7 +631,7 @@ void ext::vulkan::Texture::update( uf::Image& image, VkImageLayout targetImageLa return this->update( (void*) image.getPixelsPtr(), image.getPixels().size(), layer ); } void ext::vulkan::Texture::update( void* data, VkDeviceSize bufferSize, VkImageLayout targetImageLayout, uint32_t layer ) { - // Update descriptor image info member that can be used for setting up descriptor sets + // Update descriptor image info member that can be used for setting up descriptor sets auto& device = *this->device; diff --git a/engine/src/ext/vulkan/vulkan.cpp b/engine/src/ext/vulkan/vulkan.cpp index b60338c6..cbbe3c11 100644 --- a/engine/src/ext/vulkan/vulkan.cpp +++ b/engine/src/ext/vulkan/vulkan.cpp @@ -81,7 +81,7 @@ VKAPI_ATTR VkBool32 VKAPI_CALL ext::vulkan::debugCallback( for ( auto& filter : ext::vulkan::settings::validationFilters ) { if ( message.find(filter) != std::string::npos ) return VK_FALSE; } - uf::iostream << "[Validation Layer] " << message << "\n"; + UF_MSG_ERROR("[Validation Layer] " << message); return VK_FALSE; } @@ -160,7 +160,7 @@ bool ext::vulkan::hasRenderMode( const std::string& name, bool isName ) { } ext::vulkan::RenderMode& ext::vulkan::addRenderMode( ext::vulkan::RenderMode* mode, const std::string& name ) { - mode->metadata["name"] = name; + mode->metadata.name = name; renderModes.push_back(mode); VK_VALIDATION_MESSAGE("Adding RenderMode: " << name << ": " << mode->getType()); // reorder @@ -367,6 +367,7 @@ void ext::vulkan::destroy() { Texture3D::empty.destroy(); TextureCube::empty.destroy(); +/* auto& scene = uf::scene::getCurrentScene(); auto& graph = scene.getGraph(); for ( auto entity : graph ) { @@ -374,6 +375,7 @@ void ext::vulkan::destroy() { uf::Graphic& graphic = entity->getComponent(); graphic.destroy(); } +*/ for ( auto& renderMode : renderModes ) { if ( !renderMode ) continue; diff --git a/engine/src/ext/xatlas/xatlas.cpp b/engine/src/ext/xatlas/xatlas.cpp index 2941a524..722b9ee8 100644 --- a/engine/src/ext/xatlas/xatlas.cpp +++ b/engine/src/ext/xatlas/xatlas.cpp @@ -38,7 +38,7 @@ pod::Vector2ui UF_API ext::xatlas::unwrap( pod::Graph& graph ) { ::xatlas::AddMeshError error = ::xatlas::AddMesh(atlas, meshDecl, graph.meshes.size()); if (error != ::xatlas::AddMeshError::Success) { ::xatlas::Destroy(atlas); - UF_DEBUG_MSG(::xatlas::StringForEnum(error)); + UF_MSG_ERROR(::xatlas::StringForEnum(error)); return {}; } } diff --git a/engine/src/spec/controller/dreamcast.cpp b/engine/src/spec/controller/dreamcast.cpp index 643131f4..4ce523c5 100644 --- a/engine/src/spec/controller/dreamcast.cpp +++ b/engine/src/spec/controller/dreamcast.cpp @@ -84,7 +84,7 @@ void spec::dreamcast::controller::tick() { if ( pressed("R_DPAD_DOWN") ) str.emplace_back("R_DPAD_DOWN"); if ( pressed("R_DPAD_LEFT") ) str.emplace_back("R_DPAD_LEFT"); if ( pressed("R_DPAD_RIGHT") ) str.emplace_back("R_DPAD_RIGHT"); - if ( !str.empty() ) UF_DEBUG_MSG(uf::string::join( str, " | " )); + if ( !str.empty() ) UF_MSG_DEBUG(uf::string::join( str, " | " )); #endif } void spec::dreamcast::controller::terminate() { diff --git a/engine/src/utils/image/image.cpp b/engine/src/utils/image/image.cpp index 6ca06a4a..ade44bfa 100644 --- a/engine/src/utils/image/image.cpp +++ b/engine/src/utils/image/image.cpp @@ -86,17 +86,17 @@ std::string uf::Image::getFilename() const { ((((uint16_t)r & 0xf8) << 8) | (((uint16_t) g & 0xfc) << 3) | ((uint16_t) b >> 3)) // from file -bool uf::Image::open( const std::string& _filename, bool flip ) { - std::string filename = _filename; +bool uf::Image::open( const std::string& filename, bool flip ) { #if UF_ENV_DREAMCAST - std::string dtex = uf::string::replace( filename, ".png", ".dtex" ); - if ( uf::io::exists(dtex) ) { - UF_DEBUG_MSG("Loading dtex instead for: " << filename); - filename = dtex; + std::string extension = uf::io::extension(filename); + if ( extension != "dtex" ) { + std::string dtex = uf::string::replace( filename, ".png", ".dtex" ); + if ( uf::io::exists(dtex) ) { + UF_MSG_DEBUG("Loading dtex instead for: " << filename); + return this->open(dtex, flip); } #endif if ( !uf::io::exists(filename) ) UF_EXCEPTION("does not exist: " + filename); - std::string extension = uf::io::extension(filename); this->m_filename = filename; this->m_pixels.clear(); int width = 0, height = 0, channelsDud = 0, bit_depth = 8, channels = 4; @@ -147,7 +147,7 @@ bool uf::Image::open( const std::string& _filename, bool flip ) { } } else { UF_EXCEPTION(filename << ": not a compressed texture"); return false; } /* - UF_DEBUG_MSG("DTEX Header: " << header.id[0] << header.id[1] << header.id[2] << header.id[3] << " | " + UF_MSG_DEBUG("DTEX Header: " << header.id[0] << header.id[1] << header.id[2] << header.id[3] << " | " << header.width << " x " << header.height << " | " << twiddled << " | " << compressed << " | " diff --git a/engine/src/utils/math/collision/gjk.cpp b/engine/src/utils/math/collision/gjk.cpp index 17015b3e..1555ce11 100644 --- a/engine/src/utils/math/collision/gjk.cpp +++ b/engine/src/utils/math/collision/gjk.cpp @@ -45,7 +45,7 @@ pod::Collider::Manifold UF_API pod::Collider::intersects( const pod::Collider& y if( simplex.size == 0 ) { simplex.b = a; - direction = direction * -1; + direction = uf::vector::multiply(direction, -1); simplex.size = 1; continue; } @@ -87,7 +87,7 @@ pod::Collider::Manifold UF_API pod::Collider::intersects( const pod::Collider& y simplex.d = simplex.b; simplex.b = a; - direction = abc * -1; + direction = uf::vector::multiply(abc, -1); simplex.size = 3; continue; } diff --git a/engine/src/utils/mesh/grid.cpp b/engine/src/utils/mesh/grid.cpp index cbc14c9c..c5da4bd4 100644 --- a/engine/src/utils/mesh/grid.cpp +++ b/engine/src/utils/mesh/grid.cpp @@ -86,7 +86,7 @@ const uf::MeshGrid::Node& uf::MeshGrid::at( const pod::Vector3f& point ) const { return this->m_nodes.front(); } pod::Vector3f uf::MeshGrid::centroid( const pod::Vector3f& p1, const pod::Vector3f& p2, const pod::Vector3f& p3 ) const { - return (p1 + p2 + p3) / 3; + return uf::vector::divide(p1 + p2 + p3, 3.0f); } const pod::Vector3f& uf::MeshGrid::center() const { return this->m_center; } @@ -157,7 +157,7 @@ void uf::MeshGrid::insert( uint32_t i1, uint32_t i2, uint32_t i3, const pod::Vec void uf::MeshGrid::analyze() const { pod::Vector3f min = this->m_center - this->m_extent; pod::Vector3f max = this->m_center + this->m_extent; - UF_DEBUG_MSG( + UF_MSG_DEBUG( "Region count: " << this->m_nodes.size() << " | " "Size: " << uf::vector::toString(this->m_size) << " | " "Center: " << uf::vector::toString(this->m_center) << " | " @@ -169,7 +169,7 @@ void uf::MeshGrid::analyze() const { for ( auto& node : this->m_nodes ) total += node.indices.size(); for ( size_t i = 0; i < this->m_nodes.size(); ++i ) { auto& node = this->m_nodes[i]; - UF_DEBUG_MSG("Node[" << i << "]: Center: " << uf::vector::toString(node.center) << " | Percentage: " << ( 100.0f * (float) node.indices.size() / (float) total ) << "%" ); + UF_MSG_DEBUG("Node[" << i << "]: Center: " << uf::vector::toString(node.center) << " | Percentage: " << ( 100.0f * (float) node.indices.size() / (float) total ) << "%" ); } } diff --git a/ext/behaviors/baking/behavior.cpp b/ext/behaviors/baking/behavior.cpp index d0735f5c..64cab45c 100644 --- a/ext/behaviors/baking/behavior.cpp +++ b/ext/behaviors/baking/behavior.cpp @@ -28,7 +28,7 @@ void ext::BakingBehavior::initialize( uf::Object& self ) { if ( metadataJson["baking"]["resolution"].is() ) metadata.size = { metadataJson["baking"]["resolution"].as(), metadataJson["baking"]["resolution"].as() }; metadata.shadows = metadataJson["baking"]["shadows"].as(); - UF_DEBUG_MSG("Unwrapping..."); + UF_MSG_DEBUG("Unwrapping..."); auto& graph = this->getComponent(); graph = ext::gltf::load( metadata.names.model, uf::graph::LoadMode::ATLAS ); @@ -36,7 +36,7 @@ void ext::BakingBehavior::initialize( uf::Object& self ) { if ( size.x == 0 && size.y == 0 ) return; if ( metadata.size.x == 0 && metadata.size.y == 0 ) metadata.size = size; if ( metadata.names.output.model != "" ) { - UF_DEBUG_MSG("Saving to " << metadata.names.output.model); + UF_MSG_DEBUG("Saving to " << metadata.names.output.model); uf::graph::save( graph, metadata.names.output.model ); } @@ -114,8 +114,9 @@ void ext::BakingBehavior::initialize( uf::Object& self ) { auto& renderMode = this->getComponent(); uf::renderer::addRenderMode( &renderMode, metadata.names.renderMode ); - renderMode.metadata["type"] = "single"; - renderMode.metadata["samples"] = 1; + + renderMode.metadata.type = "single"; + renderMode.metadata.samples = 1; renderMode.width = metadata.size.x; renderMode.height = metadata.size.y; @@ -155,7 +156,7 @@ void ext::BakingBehavior::initialize( uf::Object& self ) { uf::renderer::enums::Buffer::STORAGE ); - UF_DEBUG_MSG("Unwrapped model"); + UF_MSG_DEBUG("Unwrapped model"); }); this->queueHook( "entity:PostInitialization.%UID%", ext::json::null(), 2.0f ); @@ -168,7 +169,7 @@ void ext::BakingBehavior::tick( uf::Object& self ) { auto& metadata = this->getComponent(); auto& renderMode = this->getComponent(); if ( renderMode.executed && !metadata.initialized.renderMode ) { - UF_DEBUG_MSG("Preparing graphics to bake..."); + UF_MSG_DEBUG("Preparing graphics to bake..."); auto& graph = this->getComponent(); auto& mesh = this->getComponent(); auto& renderMode = this->getComponent(); @@ -295,7 +296,7 @@ void ext::BakingBehavior::tick( uf::Object& self ) { graphic.process = true; metadata.initialized.renderMode = true; - UF_DEBUG_MSG("Graphic configured, ready to bake"); + UF_MSG_DEBUG("Graphic configured, ready to bake"); } else if ( renderMode.executed && !metadata.initialized.map ) { TIMER(1.0, (metadata.trigger.mode == "rendered" || (metadata.trigger.mode == "key" && uf::Window::isKeyPressed(metadata.trigger.value))) && ) { goto SAVE; @@ -304,12 +305,12 @@ void ext::BakingBehavior::tick( uf::Object& self ) { return; SAVE: renderMode.execute = false; - UF_DEBUG_MSG("Baking..."); + UF_MSG_DEBUG("Baking..."); auto image = renderMode.screenshot(); std::string filename = metadata.names.output.map; bool status = image.save(filename); - UF_DEBUG_MSG("Writing to " << filename << ": " << status); - UF_DEBUG_MSG("Baked."); + UF_MSG_DEBUG("Writing to " << filename << ": " << status); + UF_MSG_DEBUG("Baked."); metadata.initialized.map = true; uf::Serializer payload; diff --git a/ext/behaviors/light/behavior.cpp b/ext/behaviors/light/behavior.cpp index e556dc99..f055f7be 100644 --- a/ext/behaviors/light/behavior.cpp +++ b/ext/behaviors/light/behavior.cpp @@ -74,17 +74,16 @@ void ext::LightBehavior::initialize( uf::Object& self ) { ::roundRobin.lights.emplace_back(this); auto& renderMode = this->getComponent(); - renderMode.metadata["type"] = "depth"; - renderMode.metadata["depth bias"] = metadataJson["light"]["bias"]; - renderMode.metadata["renderMode"] = metadataJson["renderMode"]; + // renderMode.metadata["type"] = "depth"; + renderMode.metadata.type = "depth"; + renderMode.metadata.json["descriptor"]["depth bias"] = metadataJson["light"]["bias"]; + renderMode.metadata.json["descriptor"]["renderMode"] = metadataJson["renderMode"]; if ( metadataJson["light"]["type"].as() == "point" ) { metadataJson["light"]["fov"] = 90.0f; - renderMode.metadata["subpasses"] = 6; - } - if ( metadataJson["light"]["fov"].is() ) { - camera.setFov( metadataJson["light"]["fov"].as() ); + renderMode.metadata.subpasses = 6; } + camera.setFov( metadataJson["light"]["fov"].as(90) ); camera.updateView(); camera.updateProjection(); @@ -94,7 +93,7 @@ void ext::LightBehavior::initialize( uf::Object& self ) { auto& cameraSize = camera.getSize(); renderMode.width = cameraSize.x; renderMode.height = cameraSize.y; - // UF_DEBUG_MSG(this->getName() << ": " << renderMode.metadata << " | " << metadataJson["light"]); + // UF_MSG_DEBUG(this->getName() << ": " << renderMode.metadata << " | " << metadataJson["light"]); } metadata.serialize = [&](){ diff --git a/ext/behaviors/player/behavior.cpp b/ext/behaviors/player/behavior.cpp index 5921358e..e533e171 100644 --- a/ext/behaviors/player/behavior.cpp +++ b/ext/behaviors/player/behavior.cpp @@ -431,7 +431,7 @@ void ext::PlayerBehavior::tick( uf::Object& self ) { bool state = !stats.noclipped; metadata.system.noclipped = state; - UF_DEBUG_MSG( (state ? "En" : "Dis") << "abled noclip: " << uf::vector::toString(transform.position)); + UF_MSG_DEBUG( (state ? "En" : "Dis") << "abled noclip: " << uf::vector::toString(transform.position)); if ( state ) { #if UF_USE_BULLET if ( collider.body ) { @@ -478,7 +478,7 @@ void ext::PlayerBehavior::tick( uf::Object& self ) { } pod::Vector3f queued = {}; if ( keys.forward || keys.backwards ) { - int polarity = keys.forward ? 1 : -1; + float polarity = keys.forward ? 1 : -1; float mag = uf::vector::magnitude(physics.linear.velocity); // * pod::Vector3{1, 0, 1}); if ( mag < speed.limitSquared ) { mag = uf::vector::magnitude(physics.linear.velocity + translator.forward * speed.move * polarity); @@ -504,7 +504,7 @@ void ext::PlayerBehavior::tick( uf::Object& self ) { stats.updateCamera = (stats.walking = true); } if ( keys.left || keys.right ) { - int polarity = keys.right ? 1 : -1; + float polarity = keys.right ? 1 : -1; float mag = uf::vector::magnitude(physics.linear.velocity); // * pod::Vector3{1, 0, 1}); if ( mag < speed.limitSquared ) { mag = uf::vector::magnitude(physics.linear.velocity + translator.right * speed.move * polarity); @@ -557,7 +557,7 @@ void ext::PlayerBehavior::tick( uf::Object& self ) { ext::bullet::move( collider, physics.linear.velocity ); #endif } else { - transform.position += yump * uf::physics::time::delta; + transform.position += uf::vector::multiply(yump, uf::physics::time::delta); } } } @@ -595,7 +595,7 @@ void ext::PlayerBehavior::tick( uf::Object& self ) { } } else { if ( !metadata.system.physics.collision ) { - transform.position -= yump * uf::physics::time::delta; + transform.position -= uf::vector::multiply(yump, uf::physics::time::delta); } else { if ( !metadata.system.crouching ) stats.deltaCrouch = true; metadata.system.crouching = true; diff --git a/ext/behaviors/scene/behavior.cpp b/ext/behaviors/scene/behavior.cpp index 95cac3d4..e1189407 100644 --- a/ext/behaviors/scene/behavior.cpp +++ b/ext/behaviors/scene/behavior.cpp @@ -32,33 +32,15 @@ UF_BEHAVIOR_REGISTER_CPP(ext::ExtSceneBehavior) #define this ((uf::Scene*) &self) void ext::ExtSceneBehavior::initialize( uf::Object& self ) { - uf::Asset& assetLoader = this->getComponent(); - uf::Serializer& metadataJson = this->getComponent(); + auto& assetLoader = this->getComponent(); + auto& metadata = this->getComponent(); + auto& metadataJson = this->getComponent(); this->addHook( "system:Quit.%UID%", [&](ext::json::Value& json){ - std::cout << json << std::endl; + UF_MSG_DEBUG(json); ext::ready = false; }); -/* - this->addHook( "world:Music.LoadPrevious.%UID%", [&](ext::json::Value& json){ - if ( metadataJson["previous bgm"]["filename"] == "" ) return; - - std::string filename = metadataJson["previous bgm"]["filename"].as(); - float timestamp = metadataJson["previous bgm"]["timestamp"].as(); - - uf::Audio& audio = this->getComponent(); - if ( audio.playing() ) { - metadataJson["previous bgm"]["filename"] = audio.getFilename(); - metadataJson["previous bgm"]["timestamp"] = audio.getTime(); - audio.stop(); - } - audio.stream(filename); - audio.setVolume(metadataJson["volumes"]["bgm"].as()); - audio.setTime(timestamp); - audio.play(); - }); -*/ this->addHook( "asset:Load.%UID%", [&](ext::json::Value& json){ std::string filename = json["filename"].as(); std::string category = json["category"].as(); @@ -68,7 +50,7 @@ void ext::ExtSceneBehavior::initialize( uf::Object& self ) { if ( !assetLoader.has(filename) ) return; auto& asset = assetLoader.get(filename); - uf::Audio& audio = this->getComponent(); + auto& audio = this->getComponent(); audio.destroy(); audio = std::move(asset); @@ -96,7 +78,6 @@ void ext::ExtSceneBehavior::initialize( uf::Object& self ) { metadataJson["menu"] = json["menu"]; gui.initialize(); - // return payload; }); this->addHook( "world:Entity.LoadAsset", [&](ext::json::Value& json){ std::string asset = json["asset"].as(); @@ -104,18 +85,20 @@ void ext::ExtSceneBehavior::initialize( uf::Object& self ) { assetLoader.load(asset, "asset:Load." + uid); }); - this->addHook( "shader:Update.%UID%", [&](ext::json::Value& _json){ - uf::Serializer json = _json; - json["mode"] = json["mode"].as() | metadataJson["system"]["renderer"]["shader"]["mode"].as(); - metadataJson["system"]["renderer"]["shader"]["mode"] = json["mode"]; - metadataJson["system"]["renderer"]["shader"]["parameters"] = json["parameters"]; + this->addHook( "shader:Update.%UID%", [&](ext::json::Value& json){ + metadata.shader.mode = json["mode"].as(); + metadata.shader.scalar = json["scalar"].as(); + metadata.shader.parameters = uf::vector::decode( json["parameters"], metadata.shader.parameters ); + ext::json::forEach( metadataJson["system"]["renderer"]["shader"]["parameters"], [&]( uint32_t i, const ext::json::Value& value ){ + if ( value.as() == "time" ) metadata.shader.time = i; + }); + if ( 0 <= metadata.shader.time && metadata.shader.time < 4 ) { + metadata.shader.parameters[metadata.shader.time] = uf::physics::time::current; + } }); /* store viewport size */ this->addHook( "window:Resized", [&](ext::json::Value& json){ - pod::Vector2ui size = uf::vector::decode( json["window"]["size"], pod::Vector2i{} ); { - // size.x = json["window"]["size"]["x"].as(); - // size.y = json["window"]["size"]["y"].as(); - } + pod::Vector2ui size = uf::vector::decode( json["window"]["size"], pod::Vector2i{} ); metadataJson["system"]["window"] = json["system"]["window"]; ext::gui::size.current = size; @@ -150,9 +133,9 @@ void ext::ExtSceneBehavior::initialize( uf::Object& self ) { std::vector pixels(size.x * size.y * size.z); std::vector perlins(size.x * size.y * size.z); #pragma omp parallel for - for ( size_t z = 0; z < size.z; ++z ) { - for ( size_t y = 0; y < size.y; ++y ) { - for ( size_t x = 0; x < size.x; ++x ) { + for ( uint32_t z = 0; z < size.z; ++z ) { + for ( uint32_t y = 0; y < size.y; ++y ) { + for ( uint32_t x = 0; x < size.x; ++x ) { float nx = (float) x / (float) size.x; float ny = (float) y / (float) size.y; float nz = (float) z / (float) size.z; @@ -164,7 +147,7 @@ void ext::ExtSceneBehavior::initialize( uf::Object& self ) { } } } - for ( size_t i = 0; i < perlins.size(); ++i ) { + for ( uint32_t i = 0; i < perlins.size(); ++i ) { float n = perlins[i]; n = n - floor(n); float normalized = (n - low) / (high - low); @@ -188,7 +171,7 @@ void ext::ExtSceneBehavior::initialize( uf::Object& self ) { pod::Vector2ui size = {0,0}; auto& texture = sceneTextures.skybox; - for ( size_t i = 0; i < filenames.size(); ++i ) { + for ( uint32_t i = 0; i < filenames.size(); ++i ) { auto& filename = filenames[i]; auto& image = images[i]; image.open(filename); @@ -209,7 +192,6 @@ void ext::ExtSceneBehavior::initialize( uf::Object& self ) { } #endif - auto& metadata = this->getComponent(); metadata.serialize = [&]() { metadataJson["light"]["should"] = metadata.light.enabled; @@ -236,18 +218,18 @@ void ext::ExtSceneBehavior::initialize( uf::Object& self ) { if ( !metadataJson["light"]["point light eye depth scale"].is() ) metadataJson["light"]["point light eye depth scale"] = ext::config["engine"]["scenes"]["lights"]["point light eye depth scale"]; - metadata.max.textures2D = ext::config["engine"]["scenes"]["textures"]["max"]["2D"].as(); - metadata.max.texturesCube = ext::config["engine"]["scenes"]["textures"]["max"]["cube"].as(); - metadata.max.textures3D = ext::config["engine"]["scenes"]["textures"]["max"]["3D"].as(); - metadata.max.lights = ext::config["engine"]["scenes"]["lights"]["max"].as(); + metadata.max.textures2D = ext::config["engine"]["scenes"]["textures"]["max"]["2D"].as(metadata.max.textures2D); + metadata.max.texturesCube = ext::config["engine"]["scenes"]["textures"]["max"]["cube"].as(metadata.max.texturesCube); + metadata.max.textures3D = ext::config["engine"]["scenes"]["textures"]["max"]["3D"].as(metadata.max.textures3D); + metadata.max.lights = ext::config["engine"]["scenes"]["lights"]["max"].as(metadata.max.lights); metadata.light.enabled = ext::config["engine"]["scenes"]["lights"]["enabled"].as(true) && metadataJson["light"]["should"].as(true); metadata.shadow.enabled = ext::config["engine"]["scenes"]["shadows"]["enabled"].as(true) && metadataJson["light"]["shadows"].as(true); - metadata.shadow.samples = ext::config["engine"]["scenes"]["shadows"]["samples"].as(); - metadata.shadow.max = ext::config["engine"]["scenes"]["shadows"]["max"].as(); - metadata.shadow.update = ext::config["engine"]["scenes"]["shadows"]["update"].as(); - metadata.shadow.experimentalMode = ext::config["engine"]["scenes"]["shadows"]["experimental mode"].as(0); + metadata.shadow.samples = ext::config["engine"]["scenes"]["shadows"]["samples"].as(); + metadata.shadow.max = ext::config["engine"]["scenes"]["shadows"]["max"].as(); + metadata.shadow.update = ext::config["engine"]["scenes"]["shadows"]["update"].as(); + metadata.shadow.experimentalMode = ext::config["engine"]["scenes"]["shadows"]["experimental mode"].as(0); metadata.light.ambient = uf::vector::decode( metadataJson["light"]["ambient"], pod::Vector4f{ 1, 1, 1, 1 } ); metadata.light.specular = uf::vector::decode( metadataJson["light"]["specular"], pod::Vector4f{ 1, 1, 1, 1 } ); @@ -264,10 +246,10 @@ void ext::ExtSceneBehavior::initialize( uf::Object& self ) { metadata.fog.density.multiplier = metadataJson["light"]["fog"]["density"]["multiplier"].as(); metadata.fog.density.scale = metadataJson["light"]["fog"]["density"]["scale"].as(); - metadata.shader.mode = metadataJson["system"]["renderer"]["shader"]["mode"].as(); - metadata.shader.scalar = metadataJson["system"]["renderer"]["shader"]["scalar"].as(); + metadata.shader.mode = metadataJson["system"]["renderer"]["shader"]["mode"].as(); + metadata.shader.scalar = metadataJson["system"]["renderer"]["shader"]["scalar"].as(); metadata.shader.parameters = uf::vector::decode( metadataJson["system"]["renderer"]["shader"]["parameters"], pod::Vector4f{0,0,0,0} ); - ext::json::forEach( metadataJson["system"]["renderer"]["shader"]["parameters"], [&]( size_t i, const ext::json::Value& value ){ + ext::json::forEach( metadataJson["system"]["renderer"]["shader"]["parameters"], [&]( uint32_t i, const ext::json::Value& value ){ if ( value.as() == "time" ) metadata.shader.time = i; }); if ( 0 <= metadata.shader.time && metadata.shader.time < 4 ) { @@ -286,6 +268,7 @@ void ext::ExtSceneBehavior::tick( uf::Object& self ) { auto& metadataJson = this->getComponent(); #if 1 uf::hooks.call("game:Frame.Start"); + metadata.shader.invalidated = false; /* Print World Tree */ { TIMER(1, uf::Window::isKeyPressed("U") && ) { @@ -401,19 +384,19 @@ void ext::ExtSceneBehavior::tick( uf::Object& self ) { } TIMER(1, uf::Window::isKeyPressed("J") && ) { - UF_DEBUG_MSG("metadata.fog.color: " << uf::vector::toString( metadata.fog.color) ); - UF_DEBUG_MSG("metadata.fog.stepScale: " << metadata.fog.stepScale); - UF_DEBUG_MSG("metadata.fog.absorbtion: " << metadata.fog.absorbtion); - UF_DEBUG_MSG("metadata.fog.range: " << metadata.fog.range); - UF_DEBUG_MSG("metadata.fog.density.offset: " << uf::vector::toString( metadata.fog.density.offset ) ); - UF_DEBUG_MSG("metadata.fog.density.timescale: " << metadata.fog.density.timescale); - UF_DEBUG_MSG("metadata.fog.density.threshold: " << metadata.fog.density.threshold); - UF_DEBUG_MSG("metadata.fog.density.multiplier: " << metadata.fog.density.multiplier); - UF_DEBUG_MSG("metadata.fog.density.scale: " << metadata.fog.density.scale); - UF_DEBUG_MSG("metadata.shader.mode: " << (int) metadata.shader.mode); - UF_DEBUG_MSG("metadata.shader.scalar: " << (int) metadata.shader.scalar); - UF_DEBUG_MSG("metadata.shader.parameters: " << uf::vector::toString( metadata.shader.parameters ) ); - UF_DEBUG_MSG("metadata.shader.time: " << (int) metadata.shader.time); + UF_MSG_DEBUG("metadata.fog.color: " << uf::vector::toString( metadata.fog.color) ); + UF_MSG_DEBUG("metadata.fog.stepScale: " << metadata.fog.stepScale); + UF_MSG_DEBUG("metadata.fog.absorbtion: " << metadata.fog.absorbtion); + UF_MSG_DEBUG("metadata.fog.range: " << metadata.fog.range); + UF_MSG_DEBUG("metadata.fog.density.offset: " << uf::vector::toString( metadata.fog.density.offset ) ); + UF_MSG_DEBUG("metadata.fog.density.timescale: " << metadata.fog.density.timescale); + UF_MSG_DEBUG("metadata.fog.density.threshold: " << metadata.fog.density.threshold); + UF_MSG_DEBUG("metadata.fog.density.multiplier: " << metadata.fog.density.multiplier); + UF_MSG_DEBUG("metadata.fog.density.scale: " << metadata.fog.density.scale); + UF_MSG_DEBUG("metadata.shader.mode: " << (int) metadata.shader.mode); + UF_MSG_DEBUG("metadata.shader.scalar: " << (int) metadata.shader.scalar); + UF_MSG_DEBUG("metadata.shader.parameters: " << uf::vector::toString( metadata.shader.parameters ) ); + UF_MSG_DEBUG("metadata.shader.time: " << (int) metadata.shader.time); } #endif /* Update lights */ if ( uf::renderer::settings::experimental::deferredMode != "vxgi" ) { @@ -467,11 +450,11 @@ void ext::ExtSceneBehavior::bindBuffers( uf::Object& self, const std::string& re static GLint glMaxLights = 0; if ( !glMaxLights ) glGetIntegerv(GL_MAX_LIGHTS, &glMaxLights); - metadata.max.lights = std::min( (size_t) glMaxLights, metadata.max.lights ); + metadata.max.lights = std::min( (uint32_t) glMaxLights, metadata.max.lights ); // add lighting { - size_t i = 0; + uint32_t i = 0; for ( ; i < entities.size() && i < metadata.max.lights; ++i ) { auto& info = entities[i]; uf::Entity* entity = info.entity; @@ -561,8 +544,13 @@ void ext::ExtSceneBehavior::bindBuffers( uf::Object& self, const std::string& re // struct that contains our skybox cubemap, noise texture, and VXGI voxels auto& sceneTextures = this->getComponent(); std::vector textures2D; + textures2D.reserve( metadata.max.textures2D ); + std::vector textures3D; + textures3D.reserve( metadata.max.textures3D ); + std::vector texturesCube; + texturesCube.reserve( metadata.max.texturesCube ); // lighting information std::vector lights; @@ -638,7 +626,7 @@ void ext::ExtSceneBehavior::bindBuffers( uf::Object& self, const std::string& re // bind noise texture textures3D.emplace_back().aliasTexture(sceneTextures.noise); // bind lighting and requested shadow maps - for ( size_t i = 0; i < entities.size() && lights.size() < metadata.max.lights; ++i ) { + for ( uint32_t i = 0; i < entities.size() && lights.size() < metadata.max.lights; ++i ) { auto& info = entities[i]; uf::Entity* entity = info.entity; @@ -698,12 +686,6 @@ void ext::ExtSceneBehavior::bindBuffers( uf::Object& self, const std::string& re if ( !(attachment.descriptor.usage & VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT) ) continue; if ( attachment.descriptor.layout == VK_IMAGE_LAYOUT_PRESENT_SRC_KHR ) continue; for ( size_t view = 0; view < renderMode.renderTarget.views; ++view ) { - /* - light.indexMap = textures2D.size(); - light.view = lightCamera.getView(view); - light.projection = lightCamera.getProjection(view); - lights.emplace_back(light); - */ lights.emplace_back(pod::Light::Storage{ .position = info.position, .color = info.color, @@ -757,7 +739,7 @@ void ext::ExtSceneBehavior::bindBuffers( uf::Object& self, const std::string& re .color = metadata.fog.color, .stepScale = metadata.fog.stepScale, - .offset = metadata.fog.density.offset * uf::physics::time::current * metadata.fog.density.timescale, + .offset = metadata.fog.density.offset * (float) metadata.fog.density.timescale * (float) uf::physics::time::current, .densityScale = metadata.fog.density.scale, .range = metadata.fog.range, @@ -775,10 +757,10 @@ void ext::ExtSceneBehavior::bindBuffers( uf::Object& self, const std::string& re }; uniforms.lengths = UniformDescriptor::Lengths{ - .lights = std::min( lights.size(), metadata.max.lights ), - .materials = std::min( materials.size(), metadata.max.textures2D ), - .textures = std::min( textures.size(), metadata.max.textures2D ), - .drawCalls = std::min( drawCalls.size(), metadata.max.textures2D ), + .lights = MIN( lights.size(), metadata.max.lights ), + .materials = MIN( materials.size(), metadata.max.textures2D ), + .textures = MIN( textures.size(), metadata.max.textures2D ), + .drawCalls = MIN( drawCalls.size(), metadata.max.textures2D ), }; uniforms.ambient = metadata.light.ambient; @@ -806,26 +788,19 @@ void ext::ExtSceneBehavior::bindBuffers( uf::Object& self, const std::string& re for ( auto& t : textures3D ) graphic.material.textures.emplace_back().aliasTexture(t); // trigger an update when we have differing bound texture sizes - bool shouldUpdate = graphic.material.textures.size() != previousTextures.size(); - for ( size_t i = 0; !shouldUpdate && i < previousTextures.size() && i < graphic.material.textures.size(); ++i ) { + bool shouldUpdate = metadata.shader.invalidated || graphic.material.textures.size() != previousTextures.size(); + for ( uint32_t i = 0; !shouldUpdate && i < previousTextures.size() && i < graphic.material.textures.size(); ++i ) { if ( previousTextures[i] != graphic.material.textures[i].image ) shouldUpdate = true; } // update lighting buffer - size_t lightBufferIndex = renderMode.metadata["lightBufferIndex"].as(); - graphic.updateBuffer( (void*) lights.data(), uniforms.lengths.lights * sizeof(pod::Light::Storage), lightBufferIndex, false ); - + graphic.updateBuffer( (void*) lights.data(), uniforms.lengths.lights * sizeof(pod::Light::Storage), renderMode.metadata.lightBufferIndex, false ); // if ( shouldUpdate ) { - size_t materialBufferIndex = renderMode.metadata["materialBufferIndex"].as(); - graphic.updateBuffer( (void*) materials.data(), uniforms.lengths.materials * sizeof(pod::Material::Storage), materialBufferIndex, false ); - - size_t textureBufferIndex = renderMode.metadata["textureBufferIndex"].as(); - graphic.updateBuffer( (void*) textures.data(), uniforms.lengths.textures * sizeof(pod::Texture::Storage), textureBufferIndex, false ); - - size_t drawCallBufferIndex = renderMode.metadata["drawCallBufferIndex"].as(); - graphic.updateBuffer( (void*) drawCalls.data(), uniforms.lengths.drawCalls * sizeof(pod::DrawCall::Storage), drawCallBufferIndex, false ); + graphic.updateBuffer( (void*) materials.data(), uniforms.lengths.materials * sizeof(pod::Material::Storage), renderMode.metadata.materialBufferIndex, false ); + graphic.updateBuffer( (void*) textures.data(), uniforms.lengths.textures * sizeof(pod::Texture::Storage), renderMode.metadata.textureBufferIndex, false ); + graphic.updateBuffer( (void*) drawCalls.data(), uniforms.lengths.drawCalls * sizeof(pod::DrawCall::Storage), renderMode.metadata.drawCallBufferIndex, false ); graphic.updatePipelines(); } diff --git a/ext/behaviors/scene/behavior.h b/ext/behaviors/scene/behavior.h index 2a850970..6094a4cb 100644 --- a/ext/behaviors/scene/behavior.h +++ b/ext/behaviors/scene/behavior.h @@ -17,10 +17,10 @@ namespace ext { struct Metadata { struct { - size_t textures2D = 512; - size_t texturesCube = 128; - size_t textures3D = 128; - size_t lights = 256; + uint32_t textures2D = 512; + uint32_t texturesCube = 128; + uint32_t textures3D = 128; + uint32_t lights = 256; } max; struct { bool enabled = true; @@ -33,15 +33,16 @@ namespace ext { bool enabled = true; int samples = 4; int max = 8; - size_t update = 4; + uint32_t update = 4; - size_t experimentalMode = 0; + uint32_t experimentalMode = 0; } shadow; struct { uint32_t mode; uint32_t scalar; pod::Vector4f parameters = {0,0,0,0}; int8_t time = 3; + bool invalidated = true; } shader; struct { pod::Vector3f color = {1,1,1}; @@ -57,6 +58,7 @@ namespace ext { } density; } fog; + std::function serialize; std::function deserialize; }; diff --git a/ext/behaviors/voxelizer/behavior.cpp b/ext/behaviors/voxelizer/behavior.cpp index 7065bce2..9587de77 100644 --- a/ext/behaviors/voxelizer/behavior.cpp +++ b/ext/behaviors/voxelizer/behavior.cpp @@ -78,15 +78,16 @@ void ext::VoxelizerBehavior::initialize( uf::Object& self ) { auto& renderMode = this->getComponent(); metadata.renderModeName = "VXGI:" + std::to_string((int) this->getUid()); uf::renderer::addRenderMode( &renderMode, metadata.renderModeName ); - renderMode.metadata["type"] = "vxgi"; - renderMode.metadata["samples"] = 1; - renderMode.metadata["subpasses"] = metadata.cascades; + + renderMode.metadata.type = "vxgi"; + renderMode.metadata.samples = 1; + renderMode.metadata.subpasses = metadata.cascades; renderMode.blitter.device = &ext::vulkan::device; renderMode.width = metadata.fragmentSize.x; renderMode.height = metadata.fragmentSize.y; - renderMode.metadata["shaders"]["compute"] = "/shaders/display/vxgi.comp.spv"; + renderMode.metadata.json["shaders"]["compute"] = "/shaders/display/vxgi.comp.spv"; renderMode.blitter.descriptor.renderMode = metadata.renderModeName; renderMode.blitter.descriptor.subpass = -1; renderMode.blitter.process = true; diff --git a/ext/main.cpp b/ext/main.cpp index fd08e1c7..5d3a31c6 100644 --- a/ext/main.cpp +++ b/ext/main.cpp @@ -447,9 +447,8 @@ void EXT_API ext::initialize() { if ( ::config["engine"]["render modes"]["deferred"].as() ) { uf::renderer::addRenderMode( new uf::renderer::DeferredRenderMode, "" ); auto& renderMode = uf::renderer::getRenderMode("Deferred", true); - // renderMode.metadata["system"]["config"] = ::config; if ( ::config["engine"]["render modes"]["stereo deferred"].as() ) { - renderMode.metadata["eyes"] = 2; + renderMode.metadata.eyes = 2; } } #endif @@ -687,7 +686,7 @@ void EXT_API ext::tick() { bool announce = gc["announce"].as(); TIMER( every ) { size_t collected = uf::instantiator::collect( mode ); - if ( announce && collected > 0 ) UF_DEBUG_MSG("GC collected " << (int) collected << " unused entities"); + if ( announce && collected > 0 ) UF_MSG_DEBUG("GC collected " << (int) collected << " unused entities"); } } } @@ -713,7 +712,7 @@ void EXT_API ext::tick() { ++::times.frames; double every = fps["every"].as(); TIMER( every ) { - UF_DEBUG_MSG("System: " << (every * 1000.0/::times.frames) << " ms/frame | Time: " << time << " | Frames: " << ::times.frames << " | FPS: " << ::times.frames / time); + UF_MSG_DEBUG("System: " << (every * 1000.0/::times.frames) << " ms/frame | Time: " << time << " | Frames: " << ::times.frames << " | FPS: " << ::times.frames / time); ::times.frames = 0; } }