Commit for 2021.06.19 23-17-31.7z
This commit is contained in:
parent
84a2b0cd8d
commit
7233a59fa1
@ -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,
|
||||
|
||||
@ -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" }
|
||||
|
||||
@ -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",
|
||||
|
||||
@ -53,7 +53,7 @@
|
||||
"shadows": true
|
||||
},
|
||||
"noise": {
|
||||
"size": [ 128, 128, 128 ]
|
||||
"size": [ 32, 32, 32 ]
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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 }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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": "コマンド"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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]
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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": {
|
||||
|
||||
@ -52,7 +52,7 @@
|
||||
"shadows": true
|
||||
},
|
||||
"noise": {
|
||||
"size": [ 32, 32, 32 ]
|
||||
"size": [ 16, 16, 16 ]
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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": "コマンド"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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]
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -52,7 +52,7 @@
|
||||
"shadows": true
|
||||
},
|
||||
"noise": {
|
||||
"size": [ 32, 32, 32 ]
|
||||
"size": [ 16, 16, 16 ]
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -27,7 +27,7 @@
|
||||
"print stats": false,
|
||||
"export": {
|
||||
"should": true,
|
||||
"combined": true,
|
||||
"combined": false,
|
||||
"compression": false,
|
||||
"precision": 4
|
||||
}
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
"print tree": false,
|
||||
"print stats": false,
|
||||
"export": {
|
||||
"should": false,
|
||||
"should": true,
|
||||
"combined": false,
|
||||
"compression": false,
|
||||
"precision": 4
|
||||
|
||||
@ -1,10 +0,0 @@
|
||||
{
|
||||
"member-attack": "Attack",
|
||||
"member-skill": "Skill",
|
||||
"inventory": "Item",
|
||||
"talk": "Talk",
|
||||
"transients": "Party",
|
||||
"escape": "Escape",
|
||||
"analyze": "Analyze",
|
||||
"pass": "Pass"
|
||||
}
|
||||
@ -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": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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"
|
||||
]
|
||||
}
|
||||
@ -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"
|
||||
]
|
||||
}
|
||||
@ -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"
|
||||
]
|
||||
}
|
||||
@ -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"
|
||||
]
|
||||
}
|
||||
@ -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": [
|
||||
]
|
||||
}
|
||||
@ -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": [
|
||||
]
|
||||
}
|
||||
@ -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"
|
||||
]
|
||||
}
|
||||
@ -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"
|
||||
]
|
||||
}
|
||||
@ -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"
|
||||
}
|
||||
}
|
||||
@ -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"
|
||||
]
|
||||
}
|
||||
@ -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"
|
||||
]
|
||||
}
|
||||
@ -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": [
|
||||
]
|
||||
}
|
||||
@ -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": [
|
||||
]
|
||||
}
|
||||
@ -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"
|
||||
]
|
||||
}
|
||||
@ -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": [
|
||||
]
|
||||
}
|
||||
@ -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"
|
||||
]
|
||||
}
|
||||
@ -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"
|
||||
]
|
||||
}
|
||||
@ -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"
|
||||
}
|
||||
}
|
||||
@ -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": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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
|
||||
}
|
||||
}
|
||||
@ -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"
|
||||
]
|
||||
}
|
||||
@ -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"
|
||||
]
|
||||
}
|
||||
@ -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": "クローズ"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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": "コマンド"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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"
|
||||
]
|
||||
}
|
||||
@ -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"
|
||||
]
|
||||
}
|
||||
@ -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"
|
||||
]
|
||||
}
|
||||
@ -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": "終了する"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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": "「転光生」"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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
|
||||
}
|
||||
}
|
||||
@ -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
|
||||
}
|
||||
}
|
||||
@ -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"
|
||||
]
|
||||
}
|
||||
@ -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"
|
||||
]
|
||||
}
|
||||
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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": "コマンド"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,15 +0,0 @@
|
||||
{
|
||||
"name": "Region",
|
||||
"type": "Object",
|
||||
"behaviors": [
|
||||
"RegionBehavior"
|
||||
],
|
||||
"ignore": false,
|
||||
"transform": {
|
||||
"position": [ 0, 0, 0 ],
|
||||
"rotation": {
|
||||
"axis": [ 1, 0, 0 ],
|
||||
"angle": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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;
|
||||
} );
|
||||
}
|
||||
|
||||
@ -52,7 +52,9 @@ template<typename T> 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<typename T> void uf::instantiator::registerBehavior( const std::string& name ) {
|
||||
@ -66,7 +68,9 @@ template<typename T> 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<typename T> void uf::instantiator::registerBinding( const std::string& name ) {
|
||||
@ -75,7 +79,9 @@ template<typename T> void uf::instantiator::registerBinding( const std::string&
|
||||
auto& instantiator = container.get<T>();
|
||||
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<typename T>
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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<Sampler> samplers;
|
||||
std::vector<Texture2D> textures;
|
||||
std::vector<Shader> 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<std::string, Pipeline> pipelines;
|
||||
std::unordered_map<GraphicDescriptor::hash_t, Pipeline> pipelines;
|
||||
|
||||
~Graphic();
|
||||
void initialize( const std::string& = "" );
|
||||
|
||||
@ -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<uint8_t> 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();
|
||||
|
||||
@ -32,7 +32,12 @@ namespace ext {
|
||||
std::vector<VkSpecializationMapEntry> specializationMapEntries;
|
||||
VkSpecializationInfo specializationInfo;
|
||||
|
||||
uf::Serializer metadata;
|
||||
struct {
|
||||
uf::Serializer json;
|
||||
|
||||
std::string pipeline = "";
|
||||
std::string type = "";
|
||||
} metadata;
|
||||
|
||||
ext::vulkan::userdata_t specializationConstants;
|
||||
std::vector<ext::vulkan::userdata_t> pushConstants;
|
||||
|
||||
@ -9,16 +9,12 @@
|
||||
#include <cassert>
|
||||
#include <mutex>
|
||||
|
||||
#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
|
||||
|
||||
@ -5,7 +5,9 @@
|
||||
|
||||
#define TIMER(x, ...) auto TOKEN_PASTE(TIMER, __LINE__) = []( double every = 1 ) {\
|
||||
static uf::Timer<long long> timer(false);\
|
||||
if ( !timer.running() ) timer.start();\
|
||||
if ( !timer.running() ) {\
|
||||
timer.start(uf::Time<long long>(-x, uf::Time<long long>::seconds));\
|
||||
}\
|
||||
double time = 0;\
|
||||
if ( (time = timer.elapsed().asDouble()) >= every ) {\
|
||||
timer.reset();\
|
||||
@ -20,21 +22,31 @@
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#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<long long> 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
|
||||
@ -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(); }
|
||||
};
|
||||
|
||||
@ -27,7 +27,7 @@ namespace uf {
|
||||
template<typename T> bool /*UF_API*/ equals( const T& left, const T& right ); // Equality check between two vectors (equals)
|
||||
// Basic arithmetic
|
||||
template<typename T> T /*UF_API*/ multiply( const T& left, const T& right ); // Multiplies two vectors of same type and size together
|
||||
template<typename T = pod::Math::num_t> pod::Quaternion<T> /*UF_API*/ identity(); // Multiplies two vectors of same type and size together
|
||||
template<typename T = pod::Math::num_t> pod::Quaternion<T> /*UF_API*/ identity(); // Multiplies two vectors of same type and size together
|
||||
template<typename T> pod::Vector3t<T> /*UF_API*/ rotate( const pod::Quaternion<T>& left, const pod::Vector3t<T>& right ); // Multiplies two vectors of same type and size together
|
||||
template<typename T> pod::Vector4t<T> /*UF_API*/ rotate( const pod::Quaternion<T>& left, const pod::Vector4t<T>& right ); // Multiplies two vectors of same type and size together
|
||||
template<typename T> 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> typename T::type_t /*UF_API*/ dot( const T& left, const T& right ); // Compute the dot product between two vectors
|
||||
template<typename T> pod::Angle /*UF_API*/ angle( const T& a, const T& b ); // Compute the angle between two vectors
|
||||
|
||||
template<typename T> T /*UF_API*/ lerp( const T& from, const T& to, double delta ); // Linearly interpolate between two vectors
|
||||
template<typename T> T /*UF_API*/ slerp( const T& from, const T& to, double delta ); // Spherically interpolate between two vectors
|
||||
template<typename T> T /*UF_API*/ lerp( const T& from, const T& to, typename T::type_t delta ); // Linearly interpolate between two vectors
|
||||
template<typename T> T /*UF_API*/ slerp( const T& from, const T& to, typename T::type_t delta ); // Spherically interpolate between two vectors
|
||||
|
||||
template<typename T> typename T::type_t /*UF_API*/ distanceSquared( const T& a, const T& b ); // Gets the magnitude of the vector
|
||||
template<typename T> typename T::type_t /*UF_API*/ distance( const T& a, const T& b ); // Gets the magnitude of the vector
|
||||
template<typename T> typename T::type_t /*UF_API*/ distanceSquared( const T& a, const T& b ); // Gets the magnitude of the vector
|
||||
template<typename T> typename T::type_t /*UF_API*/ distance( const T& a, const T& b ); // Gets the magnitude of the vector
|
||||
template<typename T> typename T::type_t /*UF_API*/ magnitude( const T& vector ); // Gets the magnitude of the vector
|
||||
template<typename T> typename T::type_t /*UF_API*/ norm( const T& vector ); // Compute the norm of the vector
|
||||
template<typename T> T /*UF_API*/ normalize( const T& vector ); // Normalizes a vector
|
||||
@ -120,8 +120,8 @@ public:
|
||||
inline T dot( const Quaternion<T> right ) const; // Compute the dot product between two quaternions
|
||||
inline pod::Angle angle( const Quaternion<T>& b ) const; // Compute the angle between two quaternions
|
||||
|
||||
inline uf::Quaternion<T> lerp( const Quaternion<T> to, double delta ) const; // Linearly interpolate between two quaternions
|
||||
inline uf::Quaternion<T> slerp( const Quaternion<T> to, double delta ) const; // Spherically interpolate between two quaternions
|
||||
inline uf::Quaternion<T> lerp( const Quaternion<T> to, typename T::type_t delta ) const; // Linearly interpolate between two quaternions
|
||||
inline uf::Quaternion<T> slerp( const Quaternion<T> to, typename T::type_t delta ) const; // Spherically interpolate between two quaternions
|
||||
|
||||
inline T distanceSquared( const Quaternion<T> b ) const; // Compute the distance between two quaternions (doesn't sqrt)
|
||||
inline T distance( const Quaternion<T> b ) const; // Compute the distance between two quaternions
|
||||
|
||||
@ -128,12 +128,12 @@ inline pod::Angle uf::Quaternion<T>::angle( const Quaternion<T>& b ) const {
|
||||
|
||||
// Linearly interpolate between two quaternions
|
||||
template<typename T>
|
||||
inline uf::Quaternion<T> uf::Quaternion<T>::lerp( const Quaternion<T> to, double delta ) const {
|
||||
inline uf::Quaternion<T> uf::Quaternion<T>::lerp( const Quaternion<T> to, typename T::type_t delta ) const {
|
||||
return uf::quaternion::lerp( this->m_pod, to.m_pod, delta );
|
||||
}
|
||||
// Spherically interpolate between two quaternions
|
||||
template<typename T>
|
||||
inline uf::Quaternion<T> uf::Quaternion<T>::slerp( const Quaternion<T> to, double delta ) const {
|
||||
inline uf::Quaternion<T> uf::Quaternion<T>::slerp( const Quaternion<T> to, typename T::type_t delta ) const {
|
||||
return uf::quaternion::slerp( this->m_pod, to.m_pod, delta );
|
||||
}
|
||||
|
||||
|
||||
@ -44,7 +44,7 @@ template<typename T> T& uf::quaternion::multiply( T& left, const T& right ) {
|
||||
template<typename T> pod::Vector3t<T> uf::quaternion::rotate( const pod::Quaternion<T>& left, const pod::Vector3t<T>& right ) {
|
||||
pod::Vector3t<T> 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<T>(2) * uf::vector::dot( qVec, right ) ) + uf::vector::multiply( right, s*s - uf::vector::dot( qVec, qVec )) + ( uf::vector::cross( qVec, right ) * static_cast<T>(2) * s );
|
||||
}
|
||||
template<typename T> pod::Vector4t<T> uf::quaternion::rotate( const pod::Quaternion<T>& left, const pod::Vector4t<T>& right ) {
|
||||
pod::Vector3t<T> vector = uf::quaternion::rotate( left, {right.x, right.y, right.z} );
|
||||
@ -112,28 +112,21 @@ template<typename T> T uf::quaternion::roll( const pod::Quaternion<T>& q ) {
|
||||
}
|
||||
|
||||
// Linearly interpolate between two quaternions
|
||||
template<typename T> T uf::quaternion::lerp( const T& from, const T& to, double delta ) {
|
||||
template<typename T> 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<typename T> T uf::quaternion::slerp( const T& x, const T& y, double a ) {
|
||||
// return uf::vector::slerp( from, to, delta );
|
||||
template<typename T> 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<typename T::type_t>::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<typename T::type_t>(1) - a * angle)), uf::vector::multiply(z, sin(a * angle))), sin(angle) );
|
||||
// return (x * sin((static_cast<typename T::type_t>(1) - a) * angle) + z * sin(a * angle)) / sin(angle);
|
||||
}
|
||||
|
||||
// Compute the distance between two quaternions (doesn't sqrt)
|
||||
|
||||
@ -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<vertex_t> vertices;
|
||||
std::vector<indices_t> indices;
|
||||
std::vector<index_t> indices;
|
||||
|
||||
void initialize( size_t = SIZE_MAX );
|
||||
void destroy();
|
||||
|
||||
@ -29,7 +29,7 @@ void uf::BaseMesh<T, U>::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;
|
||||
|
||||
@ -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<bool>() ) UF_DEBUG_MSG(uf::graph::stats( asset ).dump(1,'\t'));
|
||||
if ( asset.metadata["debug"]["print tree"].as<bool>() ) UF_DEBUG_MSG(uf::graph::print( asset ));
|
||||
if ( asset.metadata["debug"]["print stats"].as<bool>() ) UF_MSG_INFO(uf::graph::stats( asset ).dump(1,'\t'));
|
||||
if ( asset.metadata["debug"]["print tree"].as<bool>() ) UF_MSG_INFO(uf::graph::print( asset ));
|
||||
if ( !asset.metadata["debug"]["no cleanup"].as<bool>() ) 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;
|
||||
}
|
||||
|
||||
@ -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<void(uf::Entity*)> 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<void(uf::Entity*, int)> 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);
|
||||
}
|
||||
|
||||
@ -50,7 +50,7 @@ namespace {
|
||||
};
|
||||
auto& specializationConstants = shader.specializationConstants.get<SpecializationConstant>();
|
||||
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<std::string>() == "PASSES" ) sc["value"] = specializationConstants.passes;
|
||||
});
|
||||
}
|
||||
@ -61,11 +61,11 @@ namespace {
|
||||
};
|
||||
auto& specializationConstants = shader.specializationConstants.get<SpecializationConstant>();
|
||||
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<std::string>() == "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<std::string>() != "samplerTextures" ) return;
|
||||
size_t binding = t["binding"].as<size_t>();
|
||||
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<std::string>();
|
||||
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<size_t>();
|
||||
std::string name = t["name"].as<std::string>();
|
||||
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<float>();
|
||||
bool dynamic = !info["collision"]["static"].as<bool>();
|
||||
bool recenter = info["collision"]["recenter"].as<bool>();
|
||||
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<uf::Object>(), 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<float>(1.0f) );
|
||||
// if ( ext::json::isNull( graph.metadata["extents"]["max"] ) )
|
||||
graph.metadata["extents"]["max"] = uf::vector::encode( extentMax * graph.metadata["extents"]["scale"].as<float>(1.0f) );
|
||||
graph.metadata["extents"]["min"] = uf::vector::encode( extentMin * graph.metadata["extents"]["scale"].as<float>(1.0f) );
|
||||
graph.metadata["extents"]["max"] = uf::vector::encode( extentMax * graph.metadata["extents"]["scale"].as<float>(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<size_t>() );
|
||||
});
|
||||
if ( json["vertices"].is<std::string>() ) {
|
||||
std::string filename = json["vertices"].as<std::string>();
|
||||
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>() ) {
|
||||
std::string filename = json["indices"].as<std::string>();
|
||||
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<size_t>() );
|
||||
});
|
||||
}
|
||||
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<long long> 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<std::string>();
|
||||
@ -1045,43 +1056,43 @@ pod::Graph uf::graph::load( const std::string& filename, uf::graph::load_mode_t
|
||||
std::vector<std::function<int()>> 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<std::string>() ) {
|
||||
UF_DEBUG_TRACE_MSG(directory + "/" + value.as<std::string>());
|
||||
UF_DEBUG_TIMER_MULTITRACE(directory + "/" + value.as<std::string>());
|
||||
uf::Serializer json;
|
||||
json.readFromFile( directory + "/" + value.as<std::string>() );
|
||||
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>() ) {
|
||||
std::string filename = directory + "/" + value.as<std::string>();
|
||||
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>() ) {
|
||||
std::string filename = directory + "/" + value.as<std::string>();
|
||||
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<std::string>() ) {
|
||||
@ -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<std::string>() ) {
|
||||
UF_DEBUG_TRACE_MSG(directory + "/" + value.as<std::string>());
|
||||
UF_DEBUG_TIMER_MULTITRACE(directory + "/" + value.as<std::string>());
|
||||
uf::Serializer json;
|
||||
json.readFromFile( directory + "/" + value.as<std::string>() );
|
||||
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>() ) {
|
||||
std::string filename = directory + "/" + value.as<std::string>();
|
||||
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>() ) {
|
||||
std::string filename = directory + "/" + value.as<std::string>();
|
||||
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<std::string>() ) {
|
||||
@ -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<bool>() ) {
|
||||
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>();
|
||||
bool compression = metadata["debug"]["export"]["compression"].as<bool>();
|
||||
const bool saveSeparately = !metadata["debug"]["export"]["combined"].as<bool>();
|
||||
const bool compression = metadata["debug"]["export"]["compression"].as<bool>();
|
||||
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;
|
||||
|
||||
@ -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<std::string, pod::Behavior>;\
|
||||
(*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<pod::Instantiator>;
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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<std::string>() == "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<size_t>() ? graph.metadata["mesh optimization"].as<size_t>() : 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() );
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,9 +2,6 @@
|
||||
#include <uf/utils/io/iostream.h>
|
||||
#include <iomanip>
|
||||
|
||||
//#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<void(ext::json::Value&)>& 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<void(size_t, ext::json::Value&)>& 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<void(const std::string&, ext::json::Value&)>& 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<void(ext::json::Value&, bool&)>& 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<void(ext::j
|
||||
}
|
||||
}
|
||||
void ext::json::forEach( ext::json::Value& json, const std::function<void(size_t, ext::json::Value&, bool&)>& 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<void(size_t
|
||||
}
|
||||
}
|
||||
void ext::json::forEach( ext::json::Value& json, const std::function<void(const std::string&, ext::json::Value&, bool&)>& 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<void(const
|
||||
}
|
||||
|
||||
void ext::json::forEach( const ext::json::Value& json, const std::function<void(size_t, const ext::json::Value&)>& 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<void(const std::string&, const ext::json::Value&)>& 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<void(size_t, const ext::json::Value&, bool&)>& 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<void(
|
||||
}
|
||||
}
|
||||
void ext::json::forEach( const ext::json::Value& json, const std::function<void(const std::string&, const ext::json::Value&, bool&)>& 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<void(
|
||||
}
|
||||
}
|
||||
void ext::json::forEach( const ext::json::Value& json, const std::function<void(const ext::json::Value&)>& 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<void(const ext::json::Value&, bool&)>& 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;
|
||||
|
||||
@ -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<uf::audio::Metadata>();
|
||||
#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<ALfloat>& parameters ) {
|
||||
|
||||
@ -668,7 +668,7 @@ void ext::opengl::CommandBuffer::drawIndexed( const ext::opengl::CommandBuffer::
|
||||
uf::Timer<long long> 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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -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<size_t>()];
|
||||
auto& rightOutputAttachment = renderMode.renderTarget.attachments[renderMode.metadata["outputs"][1].as<size_t>()];
|
||||
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;
|
||||
|
||||
@ -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<std::string>();
|
||||
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>();
|
||||
std::string imageType = shader.metadata.json["definitions"]["textures"][binding]["type"].as<std::string>();
|
||||
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<VkWriteDescriptorSet> 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>();
|
||||
std::string imageType = shader.metadata.json["definitions"]["textures"][binding]["type"].as<std::string>();
|
||||
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<VkDescriptorImageInfo*>(&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<std::string>();
|
||||
break;
|
||||
@ -715,42 +715,23 @@ void ext::vulkan::Pipeline::destroy() {
|
||||
}
|
||||
}
|
||||
std::vector<ext::vulkan::Shader*> ext::vulkan::Pipeline::getShaders( std::vector<ext::vulkan::Shader>& shaders ) {
|
||||
std::string pipelineName = metadata["name"].as<std::string>();
|
||||
std::unordered_map<std::string, ext::vulkan::Shader*> map;
|
||||
std::vector<ext::vulkan::Shader*> res;
|
||||
|
||||
/*
|
||||
std::string pipelineName = metadata["name"].as<std::string>();
|
||||
for ( auto& shader : shaders ) {
|
||||
std::string target = shader.metadata["pipeline"].as<std::string>();
|
||||
std::string type = shader.metadata["type"].as<std::string>();
|
||||
std::string target = shader.metadata.json["pipeline"].as<std::string>();
|
||||
std::string type = shader.metadata.json["type"].as<std::string>();
|
||||
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::string>();
|
||||
std::vector<ext::vulkan::Shader*> res;
|
||||
std::unordered_map<std::string, size_t> map;
|
||||
|
||||
// first push base pipeline
|
||||
for ( auto& shader : shaders ) {
|
||||
if ( shader.metadata["pipeline"].as<std::string>() != "" ) continue;
|
||||
map[shader.metadata["type"].as<std::string>()] = res.size();
|
||||
res.emplace_back(&shader);
|
||||
}
|
||||
// then add requested ones
|
||||
if ( pipelineName != "" ) for ( auto& shader : shaders ) {
|
||||
if ( shader.metadata["pipeline"].as<std::string>() != pipelineName ) continue;
|
||||
if ( map.count(shader.metadata["type"].as<std::string>()) == 0 ) {
|
||||
res.emplace_back(&shader);
|
||||
} else {
|
||||
size_t index = map.at(shader.metadata["type"].as<std::string>());
|
||||
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<std::pair<std::string, VkShaderStageFlagBits>>& layout, const std::string& pipeline ) {
|
||||
shaders.clear(); shaders.reserve( layout.size() );
|
||||
@ -809,14 +790,14 @@ void ext::vulkan::Material::initializeShaders( const std::vector<std::pair<std::
|
||||
}
|
||||
}
|
||||
bool ext::vulkan::Material::hasShader( const std::string& type, const std::string& pipeline ) {
|
||||
return !ext::json::isNull( metadata["shaders"][pipeline][type] );
|
||||
return !ext::json::isNull( metadata.json["shaders"][pipeline][type] );
|
||||
}
|
||||
ext::vulkan::Shader& ext::vulkan::Material::getShader( const std::string& type, const std::string& pipeline ) {
|
||||
if ( !hasShader(type, pipeline) ) {
|
||||
static ext::vulkan::Shader null;
|
||||
return null;
|
||||
}
|
||||
size_t index = metadata["shaders"][pipeline][type]["index"].as<size_t>();
|
||||
size_t index = metadata.json["shaders"][pipeline][type]["index"].as<size_t>();
|
||||
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<size_t>();
|
||||
storageIndex = shader.metadata.json["definitions"]["storage"][name]["index"].as<size_t>();
|
||||
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<float>();
|
||||
}
|
||||
}
|
||||
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<decltype(subpass)>{}(subpass);
|
||||
if ( settings::experimental::individualPipelines )
|
||||
hash += std::hash<decltype(renderMode)>{}(renderMode);
|
||||
|
||||
hash += std::hash<decltype(renderTarget)>{}(renderTarget);
|
||||
hash += std::hash<decltype(geometry.attributes.vertex.size)>{}(geometry.attributes.vertex.size);
|
||||
hash += std::hash<decltype(geometry.attributes.index.size)>{}(geometry.attributes.index.size);
|
||||
hash += std::hash<decltype(indices)>{}(indices);
|
||||
hash += std::hash<decltype(offsets.vertex)>{}(offsets.vertex);
|
||||
hash += std::hash<decltype(offsets.index)>{}(offsets.index);
|
||||
|
||||
for ( uint8_t i = 0; i < geometry.attributes.descriptor.size(); ++i ) {
|
||||
hash += std::hash<decltype(geometry.attributes.descriptor[i].format)>{}(geometry.attributes.descriptor[i].format);
|
||||
hash += std::hash<decltype(geometry.attributes.descriptor[i].offset)>{}(geometry.attributes.descriptor[i].offset);
|
||||
}
|
||||
|
||||
hash += std::hash<decltype(topology)>{}(topology);
|
||||
hash += std::hash<decltype(cullMode)>{}(cullMode);
|
||||
hash += std::hash<decltype(fill)>{}(fill);
|
||||
hash += std::hash<decltype(lineWidth)>{}(lineWidth);
|
||||
hash += std::hash<decltype(frontFace)>{}(frontFace);
|
||||
hash += std::hash<decltype(depth.test)>{}(depth.test);
|
||||
hash += std::hash<decltype(depth.write)>{}(depth.write);
|
||||
hash += std::hash<decltype(depth.operation)>{}(depth.operation);
|
||||
hash += std::hash<decltype(depth.bias.enable)>{}(depth.bias.enable);
|
||||
hash += std::hash<decltype(depth.bias.constant)>{}(depth.bias.constant);
|
||||
hash += std::hash<decltype(depth.bias.slope)>{}(depth.bias.slope);
|
||||
hash += std::hash<decltype(depth.bias.clamp)>{}(depth.bias.clamp);
|
||||
|
||||
return hash;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
@ -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<uf::Serializer*>(&this->metadata);
|
||||
return metadata["name"].as<std::string>();
|
||||
// auto& metadata = *const_cast<uf::Serializer*>(&this->metadata);
|
||||
// return metadata["name"].as<std::string>();
|
||||
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<size_t>() ).get<PushConstant>();
|
||||
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<ext::vulkan::Grap
|
||||
// if pipeline name is specified for the rendermode, check if we have shaders for it
|
||||
size_t shaders = 0;
|
||||
for ( auto& shader : graphic.material.shaders ) {
|
||||
if ( shader.metadata["pipeline"].as<std::string>() == descriptor.pipeline ) ++shaders;
|
||||
if ( shader.metadata.pipeline == descriptor.pipeline ) ++shaders;
|
||||
}
|
||||
if ( shaders == 0 ) continue;
|
||||
graphic.initializePipeline( descriptor );
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -28,8 +28,7 @@ std::vector<ext::vulkan::Graphic*> ext::vulkan::DeferredRenderMode::getBlitters(
|
||||
}
|
||||
|
||||
void ext::vulkan::DeferredRenderMode::initialize( Device& device ) {
|
||||
if ( !metadata["eyes"].is<size_t>() ) 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>();
|
||||
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<std::string>();
|
||||
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<size_t>();
|
||||
std::string name = t["name"].as<std::string>();
|
||||
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<std::string>();
|
||||
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<size_t>();
|
||||
std::string name = t["name"].as<std::string>();
|
||||
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<size_t>();
|
||||
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::vector<ex
|
||||
float width = this->width > 0 ? this->width : ext::vulkan::settings::width;
|
||||
float height = this->height > 0 ? this->height : ext::vulkan::settings::height;
|
||||
|
||||
if ( !metadata["eyes"].is<size_t>() ) metadata["eyes"] = 1;
|
||||
size_t eyes = metadata["eyes"].as<size_t>();
|
||||
|
||||
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<ex
|
||||
vkCmdSetViewport(commands[i], 0, 1, &viewport);
|
||||
vkCmdSetScissor(commands[i], 0, 1, &scissor);
|
||||
// render to geometry buffers
|
||||
for ( size_t eye = 0; eye < eyes; ++eye ) {
|
||||
for ( size_t eye = 0; eye < metadata.eyes; ++eye ) {
|
||||
size_t currentPass = 0;
|
||||
size_t currentDraw = 0;
|
||||
for ( auto graphic : graphics ) {
|
||||
@ -477,7 +472,7 @@ void ext::vulkan::DeferredRenderMode::createCommandBuffers( const std::vector<ex
|
||||
blitter.record(commands[i], descriptor, eye, currentDraw++);
|
||||
}
|
||||
}
|
||||
if ( eye + 1 < eyes ) vkCmdNextSubpass(commands[i], VK_SUBPASS_CONTENTS_INLINE); ++currentSubpass;
|
||||
if ( eye + 1 < metadata.eyes ) vkCmdNextSubpass(commands[i], VK_SUBPASS_CONTENTS_INLINE); ++currentSubpass;
|
||||
}
|
||||
vkCmdEndRenderPass(commands[i]);
|
||||
|
||||
@ -523,7 +518,7 @@ void ext::vulkan::DeferredRenderMode::createCommandBuffers( const std::vector<ex
|
||||
swapchainRender.height > 0 ? swapchainRender.height : ext::vulkan::settings::height,
|
||||
1
|
||||
};
|
||||
auto& outputAttachment = renderTarget.attachments[metadata["outputs"][0].as<size_t>()];
|
||||
auto& outputAttachment = renderTarget.attachments[metadata.outputs.front()];
|
||||
// Transition to KHR
|
||||
{
|
||||
imageMemoryBarrier.image = outputAttachment.image;
|
||||
|
||||
@ -9,11 +9,13 @@
|
||||
#include <uf/engine/graph/graph.h>
|
||||
|
||||
const std::string ext::vulkan::RenderTargetRenderMode::getTarget() const {
|
||||
auto& metadata = *const_cast<uf::Serializer*>(&this->metadata);
|
||||
return metadata["target"].as<std::string>();
|
||||
// auto& metadata = *const_cast<uf::Serializer*>(&this->metadata);
|
||||
// return metadata["target"].as<std::string>();
|
||||
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::Graphic*> 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>();
|
||||
std::string target = metadata["target"].as<std::string>();
|
||||
size_t subpasses = metadata["subpasses"].as<size_t>();
|
||||
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<std::string>();
|
||||
size_t subpasses = metadata["subpasses"].as<size_t>();
|
||||
size_t msaa = metadata["samples"].is<size_t>() ? ext::vulkan::sampleCount(metadata["samples"].as<size_t>()) : 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<std::string>() ) {
|
||||
@ -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<bool>() && !metadata["shaders"].as<bool>() ) {
|
||||
} else if ( metadata.json["shaders"].is<bool>() && !metadata.json["shaders"].as<bool>() ) {
|
||||
// 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<std::string>() == "vxgi" ) {
|
||||
if ( metadata.type == "vxgi" ) {
|
||||
auto& scene = uf::scene::getCurrentScene();
|
||||
|
||||
auto& sceneMetadataJson = scene.getComponent<uf::Serializer>();
|
||||
@ -389,26 +385,16 @@ void ext::vulkan::RenderTargetRenderMode::initialize( Device& device ) {
|
||||
size_t maxCascades = sceneMetadataJson["system"]["config"]["engine"]["scenes"]["vxgi"]["cascades"].as<size_t>(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<SpecializationConstant>();
|
||||
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<std::string>();
|
||||
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<size_t>();
|
||||
std::string name = t["name"].as<std::string>();
|
||||
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<std::string>() == "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<size_t>();
|
||||
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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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<std::string>() << " " << 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>();
|
||||
size_t uniformIndex = metadata.json["definitions"]["uniforms"][name]["index"].as<size_t>();
|
||||
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>();
|
||||
size_t uniformIndex = definition["index"].as<size_t>();
|
||||
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<size_t>(), bufferObject->allocationInfo.size);
|
||||
size_t size = std::max(metadata.json["definitions"]["uniforms"][name]["size"].as<size_t>(), 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>();
|
||||
size_t storageIndex = metadata.json["definitions"]["storage"][name]["index"].as<size_t>();
|
||||
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
|
||||
@ -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;
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user