From fa1e54c7f72fb5e55ccb34f4b30383c1a3689196 Mon Sep 17 00:00:00 2001 From: mrq Date: Fri, 27 Jan 2023 22:55:00 -0600 Subject: [PATCH] Commit for 2023.01.27 22-55-56.7z --- Makefile | 17 +- bin/data/config.json | 397 ------------------ bin/data/entities/burger.json | 55 --- bin/data/entities/cornell.json | 39 -- bin/data/entities/door.json | 14 - bin/data/entities/gui.json | 8 - bin/data/entities/gui/hud/hud.json | 20 - bin/data/entities/gui/hud/overlay.json | 35 -- bin/data/entities/gui/hud/scripts/hud.lua | 154 ------- bin/data/entities/gui/hud/sound.json | 38 -- bin/data/entities/gui/mainmenu/circle-in.json | 26 -- .../entities/gui/mainmenu/circle-out.json | 26 -- bin/data/entities/gui/mainmenu/main-text.json | 26 -- bin/data/entities/gui/mainmenu/menu.json | 28 -- bin/data/entities/gui/mainmenu/quit.json | 36 -- .../entities/gui/mainmenu/scripts/menu.lua | 159 ------- bin/data/entities/gui/mainmenu/sound.json | 0 bin/data/entities/gui/mainmenu/start.json | 34 -- bin/data/entities/gui/pause/circle-in.json | 23 - bin/data/entities/gui/pause/circle-out.json | 26 -- bin/data/entities/gui/pause/close.json | 31 -- bin/data/entities/gui/pause/command-text.json | 25 -- bin/data/entities/gui/pause/icon.json | 25 -- bin/data/entities/gui/pause/main-text.json | 23 - bin/data/entities/gui/pause/menu.json | 29 -- bin/data/entities/gui/pause/quit.json | 45 -- bin/data/entities/gui/pause/scripts/menu.lua | 180 -------- bin/data/entities/gui/pause/sound.json | 38 -- bin/data/entities/gui/pause/tenkousei.json | 25 -- .../gui/pause/transient-portrait.json | 23 - .../entities/gui/pause/transient-shadow.json | 21 - bin/data/entities/gui/pause/yellow-box.json | 25 -- bin/data/entities/gui/text/letter.json | 22 - bin/data/entities/gui/text/string.json | 43 -- bin/data/entities/hud.json | 29 -- bin/data/entities/light.json | 37 -- bin/data/entities/model.json | 79 ---- bin/data/entities/player.json | 111 ----- bin/data/entities/playerHands.json | 76 ---- bin/data/entities/playerLight.json | 32 -- bin/data/entities/playerModel.json | 62 --- bin/data/entities/prop.json | 17 - bin/data/entities/scene.json | 10 - bin/data/entities/scripts/door.lua | 117 ------ bin/data/entities/scripts/player.lua | 241 ----------- bin/data/entities/sound.json | 20 - bin/data/entities/test/html.json | 31 -- bin/data/entities/test/loading.json | 34 -- bin/data/openvr_bindings_default.json | 261 ------------ bin/data/openvr_bindings_knuckles.json | 275 ------------ bin/data/openvr_manifest.json | 165 -------- bin/data/scenes/scene.json | 60 --- bin/data/scenes/sm64/loading.json | 32 -- bin/data/scenes/sm64/player.json | 19 - bin/data/scenes/sm64/scene.json | 21 - bin/data/scenes/sm64/sm64.json | 30 -- .../sourceengine/base_sourceengine.json | 48 --- .../scenes/sourceengine/gm_construct.json | 27 -- bin/data/scenes/sourceengine/loading.json | 32 -- .../scenes/sourceengine/mds_mcdonalds.json | 37 -- bin/data/scenes/sourceengine/player.json | 10 - .../scenes/sourceengine/rp_downtown_v2.json | 24 -- bin/data/scenes/sourceengine/scene.json | 44 -- .../scenes/sourceengine/sh2_mcdonalds.json | 56 --- .../scenes/sourceengine/sourceengine.json | 7 - bin/data/scenes/sourceengine/ss2_medsci1.json | 18 - bin/data/scenes/ss2/ambience.json | 12 - bin/data/scenes/ss2/camera.json | 13 - bin/data/scenes/ss2/craeture.json | 16 - bin/data/scenes/ss2/lift.json | 13 - bin/data/scenes/ss2/loading.json | 32 -- bin/data/scenes/ss2/medsci.json | 59 --- bin/data/scenes/ss2/noise.json | 18 - bin/data/scenes/ss2/player.json | 23 - bin/data/scenes/ss2/scene.json | 27 -- bin/data/scenes/ss2/scripts/camera.lua | 194 --------- bin/data/scenes/ss2/scripts/lift.lua | 82 ---- bin/data/scenes/ss2/test.json | 26 -- bin/data/scenes/startmenu/player.json | 16 - bin/data/scenes/startmenu/scene.json | 19 - bin/data/scripts/json.lua | 389 ----------------- bin/data/scripts/main.lua | 2 - bin/data/shaders/common/functions.h | 2 +- bin/data/shaders/graph/baking/frag.h | 11 + bin/dreamcast/config.json | 92 ++-- client/main.cpp | 10 +- engine/inc/uf/ext/lua/lua.h | 10 +- engine/inc/uf/ext/opengl/commands.h | 18 +- engine/inc/uf/ext/opengl/ogl.h | 4 +- engine/inc/uf/ext/opengl/opengl.h | 9 +- engine/inc/uf/macros.h | 2 +- engine/src/engine/graph/decode.cpp | 8 +- engine/src/engine/graph/graph.cpp | 47 ++- engine/src/ext/opengl/commands.cpp | 103 +++-- engine/src/ext/opengl/graphic.cpp | 48 ++- engine/src/ext/opengl/opengl.cpp | 34 +- engine/src/ext/opengl/rendermodes/base.cpp | 10 +- .../ext/opengl/rendermodes/rendertarget.cpp | 4 + engine/src/ext/vorbis/vorbis.cpp | 5 +- engine/src/ext/vulkan/vulkan.cpp | 2 +- engine/src/spec/window/dreamcast.cpp | 2 + ext/behaviors/player/behavior.cpp | 11 +- ext/behaviors/scene/behavior.cpp | 6 +- ext/gui/behavior.cpp | 56 ++- ext/main.cpp | 13 +- 105 files changed, 368 insertions(+), 4858 deletions(-) delete mode 100644 bin/data/config.json delete mode 100644 bin/data/entities/burger.json delete mode 100644 bin/data/entities/cornell.json delete mode 100644 bin/data/entities/door.json delete mode 100644 bin/data/entities/gui.json delete mode 100644 bin/data/entities/gui/hud/hud.json delete mode 100644 bin/data/entities/gui/hud/overlay.json delete mode 100644 bin/data/entities/gui/hud/scripts/hud.lua delete mode 100644 bin/data/entities/gui/hud/sound.json delete mode 100644 bin/data/entities/gui/mainmenu/circle-in.json delete mode 100644 bin/data/entities/gui/mainmenu/circle-out.json delete mode 100644 bin/data/entities/gui/mainmenu/main-text.json delete mode 100644 bin/data/entities/gui/mainmenu/menu.json delete mode 100644 bin/data/entities/gui/mainmenu/quit.json delete mode 100644 bin/data/entities/gui/mainmenu/scripts/menu.lua delete mode 100644 bin/data/entities/gui/mainmenu/sound.json delete mode 100644 bin/data/entities/gui/mainmenu/start.json delete mode 100644 bin/data/entities/gui/pause/circle-in.json delete mode 100644 bin/data/entities/gui/pause/circle-out.json delete mode 100644 bin/data/entities/gui/pause/close.json delete mode 100644 bin/data/entities/gui/pause/command-text.json delete mode 100644 bin/data/entities/gui/pause/icon.json delete mode 100644 bin/data/entities/gui/pause/main-text.json delete mode 100644 bin/data/entities/gui/pause/menu.json delete mode 100644 bin/data/entities/gui/pause/quit.json delete mode 100644 bin/data/entities/gui/pause/scripts/menu.lua delete mode 100644 bin/data/entities/gui/pause/sound.json delete mode 100644 bin/data/entities/gui/pause/tenkousei.json delete mode 100644 bin/data/entities/gui/pause/transient-portrait.json delete mode 100644 bin/data/entities/gui/pause/transient-shadow.json delete mode 100644 bin/data/entities/gui/pause/yellow-box.json delete mode 100644 bin/data/entities/gui/text/letter.json delete mode 100644 bin/data/entities/gui/text/string.json delete mode 100644 bin/data/entities/hud.json delete mode 100644 bin/data/entities/light.json delete mode 100644 bin/data/entities/model.json delete mode 100644 bin/data/entities/player.json delete mode 100644 bin/data/entities/playerHands.json delete mode 100644 bin/data/entities/playerLight.json delete mode 100644 bin/data/entities/playerModel.json delete mode 100644 bin/data/entities/prop.json delete mode 100644 bin/data/entities/scene.json delete mode 100644 bin/data/entities/scripts/door.lua delete mode 100644 bin/data/entities/scripts/player.lua delete mode 100644 bin/data/entities/sound.json delete mode 100644 bin/data/entities/test/html.json delete mode 100644 bin/data/entities/test/loading.json delete mode 100644 bin/data/openvr_bindings_default.json delete mode 100644 bin/data/openvr_bindings_knuckles.json delete mode 100644 bin/data/openvr_manifest.json delete mode 100644 bin/data/scenes/scene.json delete mode 100644 bin/data/scenes/sm64/loading.json delete mode 100644 bin/data/scenes/sm64/player.json delete mode 100644 bin/data/scenes/sm64/scene.json delete mode 100644 bin/data/scenes/sm64/sm64.json delete mode 100644 bin/data/scenes/sourceengine/base_sourceengine.json delete mode 100644 bin/data/scenes/sourceengine/gm_construct.json delete mode 100644 bin/data/scenes/sourceengine/loading.json delete mode 100644 bin/data/scenes/sourceengine/mds_mcdonalds.json delete mode 100644 bin/data/scenes/sourceengine/player.json delete mode 100644 bin/data/scenes/sourceengine/rp_downtown_v2.json delete mode 100644 bin/data/scenes/sourceengine/scene.json delete mode 100644 bin/data/scenes/sourceengine/sh2_mcdonalds.json delete mode 100644 bin/data/scenes/sourceengine/sourceengine.json delete mode 100644 bin/data/scenes/sourceengine/ss2_medsci1.json delete mode 100644 bin/data/scenes/ss2/ambience.json delete mode 100644 bin/data/scenes/ss2/camera.json delete mode 100644 bin/data/scenes/ss2/craeture.json delete mode 100644 bin/data/scenes/ss2/lift.json delete mode 100644 bin/data/scenes/ss2/loading.json delete mode 100644 bin/data/scenes/ss2/medsci.json delete mode 100644 bin/data/scenes/ss2/noise.json delete mode 100644 bin/data/scenes/ss2/player.json delete mode 100644 bin/data/scenes/ss2/scene.json delete mode 100644 bin/data/scenes/ss2/scripts/camera.lua delete mode 100644 bin/data/scenes/ss2/scripts/lift.lua delete mode 100644 bin/data/scenes/ss2/test.json delete mode 100644 bin/data/scenes/startmenu/player.json delete mode 100644 bin/data/scenes/startmenu/scene.json delete mode 100644 bin/data/scripts/json.lua delete mode 100644 bin/data/scripts/main.lua diff --git a/Makefile b/Makefile index 6085c9d1..a9b3f728 100644 --- a/Makefile +++ b/Makefile @@ -68,7 +68,7 @@ ifneq (,$(findstring win64,$(ARCH))) INCS := -I./dep/master/include $(INCS) else ifneq (,$(findstring dreamcast,$(ARCH))) FLAGS += -DUF_ENV_DREAMCAST - REQ_DEPS += simd opengl gldc json:nlohmann reactphysics png zlib ctti lua fmt # ogg openal aldc gltf freetype bullet meshoptimizer draco luajit ultralight-ux ncurses curl openvr discord + REQ_DEPS += simd opengl gldc json:nlohmann reactphysics png zlib ctti lua fmt imgui freetype openal aldc ogg # gltf bullet meshoptimizer draco luajit ultralight-ux ncurses curl openvr discord INCS := -I./dep/dreamcast/include $(INCS) endif ifneq (,$(findstring vulkan,$(REQ_DEPS))) @@ -144,7 +144,7 @@ ifneq (,$(findstring openal,$(REQ_DEPS))) ifneq (,$(findstring dreamcast,$(ARCH))) ifneq (,$(findstring aldc,$(REQ_DEPS))) DEPS += -lALdc - FLAGS += -DUF_USE_OPENAL_ALDC + FLAGS += -DUF_USE_OPENAL_ALDC -DUF_USE_ALUT else DEPS += -lAL endif @@ -279,7 +279,7 @@ ifneq (,$(findstring dreamcast,$(ARCH))) $(PREFIX): $(TARGET) ./bin/dreamcast/$(TARGET_NAME).cdi #SRCS_DLL = $(wildcard $(ENGINE_SRC_DIR)/*.cpp) $(wildcard $(ENGINE_SRC_DIR)/*/*.cpp) $(wildcard $(ENGINE_SRC_DIR)/*/*/*.cpp) $(wildcard $(ENGINE_SRC_DIR)/*/*/*/*.cpp) $(wildcard $(ENGINE_SRC_DIR)/*/*/*/*/*.cpp) -SRCS_DLL = $(shell find $(ENGINE_SRC_DIR) -name "*.cpp") +SRCS_DLL = $(shell find $(ENGINE_SRC_DIR) -name "*.cpp") $(shell find $(DEP_SRC_DIR) -name "*.cpp") OBJS_DLL = $(patsubst %.cpp,%.$(PREFIX).o,$(SRCS_DLL)) OBJS = $(patsubst %.cpp,%.$(PREFIX).o,$(SRCS_DLL)) $(patsubst %.cpp,%.$(PREFIX).o,$(SRCS_EXT_DLL)) $(patsubst %.cpp,%.$(PREFIX).o,$(SRCS)) @@ -377,6 +377,17 @@ else ./program.sh endif +run-debug: +ifneq (,$(findstring dreamcast,$(ARCH))) + $(KOS_EMU_DEBUG) ./bin/dreamcast/$(TARGET_NAME).cdi +else + @echo -n $(ARCH) > "./bin/exe/default/arch" + @echo -n $(CC) > "./bin/exe/default/cc" + @echo -n $(RENDERER) > "./bin/exe/default/renderer" + @echo "Setting defaults: $(ARCH).$(CC).$(RENDERER)" + ./debug.sh +endif + clean-zips: @-find ./bin/data/ -name "*.gz" -type f -delete diff --git a/bin/data/config.json b/bin/data/config.json deleted file mode 100644 index a6de524c..00000000 --- a/bin/data/config.json +++ /dev/null @@ -1,397 +0,0 @@ -{ - "engine": { - "scenes": { - "start": "StartMenu", - "matrix": { "reverseInfinite": true }, - "meshes": { "interleaved": false }, - "lights": { "enabled": true, - "useLightmaps": false, - "max": 32, - "shadows": { - "enabled": true, - "update": 4, - "max": 8, - "samples": 4 - }, - "bloom": { - "scale": 1.0, - "strength": 0.125, - "sigma": 0.8, - "samples": 5, - "threshold": 1.0 - } - }, - "textures": { - "max": { - "2D": 1024, - "cube": 1024, - "3D": 128 - } - }, - "vxgi": { - "limiter": 0.125, - // "limiter": 0.125, - "size": 192, - "dispatch": 8, - "cascades": 3, - "cascadePower": 1.5, - "granularity": 12, - "voxelizeScale": 1, - "occlusionFalloff": 2, - "traceStartOffsetFactor": 1, - "shadows": 0, - "extents": { - "min": [ -4, -4, -4 ], - "max": [ 4, 4, 4 ] - } - }, - "rt": { - // "size": [ 1280, 720 ], - "full": false, - "filter": "nearest", - "defaultRayBounds": [ 0.75, 256.0 ], - "alphaTestOffset": 0.05, - "samples": 1, - "paths": 2, - "frameAccumulationMinimum": 0, - "readyTimer": 3 - } - }, - "graph": { - "initial buffer elements": 1024 - }, - "ext": { - "vulkan": { - "version": 1.3, - "validation": { - "enabled": false, - "messages": false, - "checkpoints": false, - "filters": [ - "0x71500fba" // VUID-vkDestroyDevice-device-00378 (don't care about a clean cleanup) - ,"0xe5d1743c" // VUID-vkCmdDispatch-None-02699 (problem when using VXGI) - - // ,"0x141cb623" // UNASSIGNED-Threading-MultipleThreads ("false-positive" multithreading) - - /* - "0x609a13b" // UNASSIGNED-CoreValidation-Shader-OutputNotConsumed (from depth-only calls) - ,"0x35d7ea98" // VUID-vkUpdateDescriptorSets-None-03047 (bitches without VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT or VK_DESCRIPTOR_BINDING_UPDATE_UNUSED_WHILE_PENDING_BIT) - ,"0x8e1000ad" // VUID-vkCmdDrawIndexedIndirect-None-04008 (bitches without nullDescriptor) - ,"0x9dd97212" // VUID-vkCmdDrawIndexedIndirect-None-02721 (bitches without nullDescriptor) - ,"0x36481fcb" // VUID-vkCmdBindVertexBuffers-pBuffers-04001 (bitches without nullDescriptor) - */ - // ,"0x4dae5635" // UNASSIGNED-CoreValidation-DrawState-InvalidImageLayout - ] - }, - "framebuffer": { - "msaa": 1, - "size": 1 - // "size": [ 640, 480, "NEAREST" ] - // "size": [ 1280, 720 ] - // "size": [ 960, 540 ] - // "size": [ 640, 480 ] - }, - "gpu": 7817, // 2060 - // "gpu": 29631, // 6800XT - "experimental": { - "rebuild on tick begin": false, - "batch queue submissions": true, - "dedicated thread": false, - "memory budget": false - }, - "invariant": { - "default stage buffers": true, - "default defer buffer destroy": true, - "default command buffer immediate": true, - "multithreaded recording": true - }, - "pipelines": { - "deferred": true, - "vsync": true, - "hdr": true, - "vxgi": true, - "culling": true, - "bloom": true, - "rt": true, - "fsr": false, - "postProcess": false // "postProcess.chromab" // false - }, - "formats": { - "depth": "D32_SFLOAT", - "color": "R16G16B16A16_SFLOAT", // "R32G32B32A32_SFLOAT", - "normal": "R16G16B16A16_SFLOAT", - "position": "R16G16B16A16_SFLOAT" - }, - "versions": { - "1.0": { - "extensions": { - "instance": [], - "device": [ - "VK_KHR_swapchain" - ] - }, - "features": [ - "shaderDrawParameters", - "multiDrawIndirect", - "fillModeNonSolid", - "wideLines", - "independentBlend", - "deviceCoherentMemory", - "robustBufferAccess", - "samplerAnisotropy", - "sampleRateShading" - ], - "featureChain": [] - }, - "1.1": { - "extensions": { - "instance": [ - "VK_KHR_get_physical_device_properties2" - ,"VK_KHR_get_surface_capabilities2" - ], - "device": [ - "VK_EXT_memory_budget" - ,"VK_EXT_descriptor_indexing" - ,"VK_KHR_buffer_device_address" - ,"VK_NV_device_diagnostic_checkpoints" - ] - }, - "features": [ - "nullDescriptor" - ,"fragmentStoresAndAtomics" - ,"geometryShader" - ,"multiViewport" - ,"shaderInt16" - ,"shaderFloat16" - ,"shaderInt64" - ,"shaderFloat64" - ,"shaderSubgroupClock" - ,"shaderSampledImageArrayDynamicIndexing" - ,"shaderStorageImageArrayDynamicIndexing" - ,"shaderStorageImageMultisample" - - ,"shaderSampledImageArrayNonUniformIndexing" - ,"shaderStorageImageArrayNonUniformIndexing" - - ,"descriptorIndexing" - ,"bufferDeviceAddress" - ], - "featureChain": [ - "physicalDevice2" - ,"shaderDrawParameters" - ,"robustness" - ,"shaderClock" - - ,"descriptorIndexing" - ,"bufferDeviceAddress" - ] - }, - "1.2": { - "extensions": { - "instance": [ - "VK_KHR_get_physical_device_properties2", - "VK_KHR_get_surface_capabilities2" - ], - "device": [ - "VK_KHR_deferred_host_operations" - ,"VK_EXT_shader_viewport_index_layer" - ,"VK_KHR_spirv_1_4" - ,"VK_KHR_shader_float_controls" - ,"VK_KHR_shader_clock" - ,"VK_EXT_subgroup_size_control" - ,"VK_KHR_acceleration_structure" - ,"VK_KHR_ray_tracing_pipeline" - ,"VK_KHR_ray_query" - - // ,"VK_AMD_shader_explicit_vertex_parameter" - // ,"VK_KHR_fragment_shader_barycentric" - ] - }, - "features": [ - "hostQueryReset", - - "runtimeDescriptorArray", - "descriptorBindingVariableDescriptorCount", - - "shaderOutputViewportIndex", - "shaderOutputLayer" - ], - "featureChain": [ - "physicalDeviceVulkan12" - // for advanced gbuffer - ,"fragmentShaderBarycentric" - // for ray-tracing - ,"rayTracingPipeline" - ,"rayQuery" - ,"accelerationStructure" - // for FSR2 - ,"subgroupSizeControl" - ] - }, - "1.3": { - "extensions": { - "instance": [], - "device": [] - }, - "features": [], - "featureChain": [] - } - } - }, - "opengl": { - "validation": { "enabled": false }, - "framebuffer": { "size": 1, "msaa": 1 }, - "experimental": { - "rebuild on tick begin": true - }, - "pipelines": { - "culling": true - }, - "experimental": { - "rebuild on tick begin": true - }, - "invariant": { - "multithreaded recording": false - }, - "formats": { - "depth": "D32_SFLOAT", - "color": "R8G8B8A8_UNORM", // "R32G32B32A32_SFLOAT", - "normal": "R16G16B16A16_SFLOAT", - "position": "R16G16B16A16_SFLOAT" - }, - "features": [], - "extensions": { "instance": [], "device": [] } - }, - "lua": { - "enabled": true, - "main": "/main.lua", - "modules": { - "json": "/json.lua" - } - }, - "json": { - "encoding": "msgpack", - "compression": "gz" - }, - "imgui": { - "enabled": true - }, - "fsr": { - "enabled": true, - "sharpness": 1, - "jitter scale": 0.0625, - "preset": "native" // native (1x), quality (1.5x), balanced (1.7x), performance (2.0x), ultra (3.0x) - }, - "reactphysics": { - "timescale": 0.01666666666, - "interpolate": false, - "gravity": { - "mode": "universal", - "constant": 6.67408e-11 - }, - "debug draw": { - "enabled": false, - "line width": 8, - // "layer": "Gui", - "rate": 0.0125 - } - }, - "vr" : { - "enable" : false, - "manifest": "./data/openvr_manifest.json", - "swap eyes": false, - "dominant eye": 0, - "scale": 1.0 - }, - "ultralight": { "enabled": true, "scale": 1.5 }, - "discord": { "enabled": false } - }, - "audio": { - "mute": false, - "buffers": { - "size": 32768, - "count": 4 - }, - "volumes": { - "sfx": 0.35, - "bgm": 0.15, - "voice": 1.0 - }, - "streams by default": true - }, - "memory pool": { - "enabled": true, - "subPools": true, - "alignment": 64, - "override": false, - "size": "512 MiB", - "pools": { - "entity": "128 MiB", - "userdata": "128 MiB", - "component": "128 MiB" - } - }, - "render modes": { "gui": true, "deferred": true }, - "limiters": { - "deltaTime": 5, - "framerate": "auto" - }, - "threads": { - "workers" : "auto", - "frame limiter": 0 // "auto" - }, - "debug": { - "framerate": { - "print": true, - "every": 2 - }, - "garbage collection": { - "enabled": true, - "mode": 1, - "rate": 4, - "announce": true - }, - "entity": { - "delete children on destroy": false, - "delete components on destroy": false - }, - "userdata": { - "auto destruct": true, - "auto validate": false - }, - "loader": { - "assert": true - }, - "hooks": { - "defer lazy calls": true - }, - "scene": { - "print task calls": false - } - } - }, - "window" : { - "terminal" : { - "ncurses" : false, - "visible" : true - }, - "keyboard" : { - "repeat" : false - }, - "mouse" : { - "visible" : true, - "center" : false, - "sensitivity": [ 2, 2 ], - "smoothing": [ 4, 4 ] - }, - "mode" : "windowed", // fullscreen, borderless, windowed - "icon" : "./data/textures/icon.png", - // "size" : [ 1920, 1080 ], - "size" : [ 1280, 720 ], - // "size" : [ 960, 540 ], - // "size" : [ 640, 480 ], - // "size" : [ 256, 224 ], - "title" : "Grimgram", - "visible" : true - } -} \ No newline at end of file diff --git a/bin/data/entities/burger.json b/bin/data/entities/burger.json deleted file mode 100644 index 5fe475e9..00000000 --- a/bin/data/entities/burger.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "type": "Object", - "name": "Burger", - "ignore": false, - "import": "/model.json", - "assets": [ - // "/burger/burger.glb" - // "/burger/burger_simpler.glb" - // "/burger/burger/graph.json" - "/burger/burger_simpler/graph.json" - ], - "behaviors": [], - "transform": { - "position": [ -0.574743, 2.3547, -5.05161 ], - // "position": [ -4.66561, 0.0736207, -5.98057 ], - "rotation": { - "axis": [ 0, 1, 0 ], - "angle": 0 - }, - "scale": [ 1, 1, 1 ] - }, - "system": { - "hot reload": { - "enabled": true - } - }, - "metadata": { - "holdable": true, - - "physics": { - "gravity": [ 0, -9.81, 0 ], - "inertia": [ 0, 0, 0 ], - - "mass": 10, - "type": "bounding box", - "recenter": false - }, - "graph": { - "exporter": { - "enabled": true, - "unwrap": false, - "optimize": false - }, - "baking": { - "enabled": false - }, - "renderer": { - "flip textures": false - }, - "lighting": { - "lightmap": false - } - } - } -} \ No newline at end of file diff --git a/bin/data/entities/cornell.json b/bin/data/entities/cornell.json deleted file mode 100644 index 8033b870..00000000 --- a/bin/data/entities/cornell.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "type": "Object", - "name": "Cornell Box", - "ignore": false, - "import": "/model.json", - "assets": [ - // "/cornell/cornell.glb" - { "filename": "/cornell/cornell/graph.json" } - ], - "behaviors": [], - "transform": { - "position": [ -0.23807, -0.984829, -30.4967 ], - "rotation": { - "axis": [ 0, 1, 0 ], - "angle": 0 - }, - "scale": [ 1, 1, 1 ] - }, - "system": { - "hot reload": { - "enabled": true - } - }, - "metadata": { - "track": true, - "hide": true, - "graph": { - "lightmap": false, - "exporter": { - "enabled": false, - "unwrap": false, - "optimize": false - }, - "baking": { - "enabled": false - } - } - } -} \ No newline at end of file diff --git a/bin/data/entities/door.json b/bin/data/entities/door.json deleted file mode 100644 index 66d00173..00000000 --- a/bin/data/entities/door.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "assets": ["./scripts/door.lua"], - "behaviors": [ - "SoundEmitterBehavior" - ], - "metadata": { - "physics": { - "mass": 0, - "inertia": [0, 0, 0], - "type": "bounding box", - "recenter": true - } - } -} \ No newline at end of file diff --git a/bin/data/entities/gui.json b/bin/data/entities/gui.json deleted file mode 100644 index c0a9d77e..00000000 --- a/bin/data/entities/gui.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "Gui Manager", - "type": "Object", - "behaviors": [ - "GuiManagerBehavior" - ], - "ignore": false -} \ No newline at end of file diff --git a/bin/data/entities/gui/hud/hud.json b/bin/data/entities/gui/hud/hud.json deleted file mode 100644 index a9a3af99..00000000 --- a/bin/data/entities/gui/hud/hud.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "HUD", - "type": "Gui", - "ignore": false, - "assets": [ - "./scripts/hud.lua" - ], - "transform": { - "position": [ 0, 0, 0 ], - "rotation": { - "axis": [ 0, 0, 1 ], - "angle": 0 - }, - "scale": [ 16, 16, 16 ] - }, - "metadata": { - "clickable": false, - "hoverable": false, - } -} \ No newline at end of file diff --git a/bin/data/entities/gui/hud/overlay.json b/bin/data/entities/gui/hud/overlay.json deleted file mode 100644 index 2f75c02b..00000000 --- a/bin/data/entities/gui/hud/overlay.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "HUD Overlay", - "type": "Gui", - "ignore": false, - "assets": [ - { "filename": "./textures/mp.png", "hash": "68e7c459f9aecd6815ff7df1e2eefa82db60a23713b0134f0bfc15d82f55453d" } - // { "filename": "./textures/ss2.png" } - ], - "transform": { - "position": [ 0, 0, 0 ], - "rotation": { - "axis": [ 0, 0, 1 ], - "angle": 0 - }, - // "scale": [ 1.7776, -1, -1 ] - "scale": [ 1, 1, 1 ] - }, - "metadata": { - "clickable": false, - "hoverable": false, - - "uv": [ 0, 0, 1, 1 ], - // "color": [ 0.8, 0.8, 1, 1 ], - // "color": [ 0.416, 0.573, 0.667, 1 ], - "color": [ 1, 1, 1, 1 ], - "location": "", - "scaling": "relative", - // "depth": 0.1, - // "alpha": 0.5, - "alpha": 0.75, - "mode": 1, - "gui layer": true, - "only model": true - } -} \ No newline at end of file diff --git a/bin/data/entities/gui/hud/scripts/hud.lua b/bin/data/entities/gui/hud/scripts/hud.lua deleted file mode 100644 index b04077af..00000000 --- a/bin/data/entities/gui/hud/scripts/hud.lua +++ /dev/null @@ -1,154 +0,0 @@ -local scene = entities.currentScene() -local controller = entities.controller() -local metadata = ent:getComponent("Metadata") -local masterdata = scene:getComponent("Metadata") - -local visorLayers = 5 -local children = {} -for i=1, visorLayers do - children[i] = ent:loadChild("./overlay.json",true) -end - -local soundEmitter = ent:loadChild("./sound.json",true) - -local timer = Timer.new() -if not timer:running() then timer:start() end - -Static = { - values = {}, - get = function( obj ) - if obj == nil then - obj = scene - end - if Static.values[""..obj:uid()] == nil then - Static.values[""..obj:uid()] = {} - end - return Static.values[""..obj:uid()] - end -} - -local lerper = { - to = Quaternion(0,0,0,1), - from = Quaternion(0,0,0,1), - a = 0 -} - -local rotate = function( delta ) - delta.x = delta.x * 0.1 - delta.y = delta.y * 0.1 - - local transform = ent:getComponent("Transform") - local rotation = { - x = Quaternion.axisAngle( Vector3f(0, 1, 0), delta.x ), - y = Quaternion.axisAngle( Vector3f(1, 0, 0), delta.y ) - } - - lerper.a = 0 - lerper.from = Quaternion.multiply( transform.orientation, rotation.x:multiply(rotation.y) ) - transform.orientation = lerper.from - for k, obj in pairs(children) do - obj:getComponent("Transform").orientation = transform.orientation - end -end - -local windowSize = masterdata["system"]["config"]["window"]["size"]; -local entTransform = ent:getComponent("Transform") -entTransform.scale.x = entTransform.scale.x * windowSize.x / windowSize.y; - -for k, obj in pairs(children) do - local transform = obj:getComponent("Transform") - transform.scale = entTransform.scale; - transform.position.z = -0.5 + ((k-1) * 0.005) -end - -ent:addHook( "window:Resized", function( payload ) - if entTransform.scale.y == entTransform.scale.z then - entTransform.scale.x = entTransform.scale.y * payload["window"]["size"][1] / payload["window"]["size"][2]; - end - - for k, obj in pairs(children) do - local transform = obj:getComponent("Transform") - transform.scale = entTransform.scale; - end -end ) - -ent:addHook( "controller:Camera.Rotated", function( payload ) - rotate( { - x = -payload.angle.yaw, - y = -payload.angle.pitch - }) ---[[ - local transform = ent:getComponent("Transform") - lerper.a = 0 - local counterOrientation = Quaternion( payload.delta[1], payload.delta[2], payload.delta[3], payload.delta[4] ):inverse() - lerper.from = Quaternion.multiply( transform.orientation, counterOrientation ) - transform.orientation = lerper.from - for k, obj in pairs(children) do - obj:getComponent("Transform").orientation = transform.orientation - end -]] -end ) ---[[ -ent:addHook( "window:Mouse.Moved", function( payload ) - if payload.invoker ~= "client" then return end - - local delta = payload.mouse.delta - local size = payload.mouse.size - - if delta == nil or size == nil then return end - if delta.x == 0 or delta.y == 0 then return end - - delta.x = -delta.x / size.x - delta.y = -delta.y / size.y - - rotate( delta ) -end ) -]] - -ent:bind( "tick", function(self) - for k, obj in pairs(children) do - local metadata = obj:getComponent("Metadata") - local glow = math.sin(time.current()) * 0.5 + 0.5 -- constrained to [0,1] - glow = glow * 0.2 + 0.65 -- constrained to [0.65, 0.85] - metadata["alpha"] = glow - obj:setComponent("Metadata", metadata) - end - - local controllerTransform = controller:getComponent("Transform") - local controllerCamera = controller:getComponent("Camera") - local controllerCameraTransform = controllerCamera:getTransform() - local transform = ent:getComponent("Transform") - - local speed = 2.5 - if lerper.a == 1 then return end - lerper.a = lerper.a + time.delta() * speed - if lerper.a > 1 then lerper.a = 1 end - - transform.orientation = lerper.from:slerp( lerper.to, lerper.a ) - local orientation = transform.orientation - for k, obj in pairs(children) do - local transform = obj:getComponent("Transform") - transform.orientation = orientation - transform.model = controllerCamera:getProjection() * Matrix4f.translate( transform.position ) * transform.orientation:matrix() * Matrix4f.scale( transform.scale ) --Matrix4f.scale( Vector3f( 1.7776 * 2, 2, 2 ) ) - end -end ) - ---[[ - controller:callHook( "object:UpdateMetadata.%UID%", { - path = "overlay.position", - value = { - [1] = position.x, - [2] = position.y, - [3] = position.z - } - } ) - controller:callHook( "object:UpdateMetadata.%UID%", { - path = "overlay.orientation", - value = { - [1] = orientation.x, - [2] = orientation.y, - [3] = orientation.z, - [4] = orientation.w - } - } ) -]] \ No newline at end of file diff --git a/bin/data/entities/gui/hud/sound.json b/bin/data/entities/gui/hud/sound.json deleted file mode 100644 index 521052cd..00000000 --- a/bin/data/entities/gui/hud/sound.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "type": "Object", - "name": "Sound Emitter", - "ignore": false, - "assets": [ - ], - "behaviors": [ - "SoundEmitterBehavior" - ], - "transform": { - "position": [ 0, 0, 0 ], - "rotation": { - "axis": [ 0, 1, 0 ], - "angle": 0 - }, - "scale": [ 1, 1, 1 ] - }, - "system": { - "hot reload": { - "enabled": true - }, - "defaults": { - "render": true, - "asset load": true - }, - "load": { - "ignore": true - } - }, - "metadata": { - "audio": { - "spatial": false, - "loop": false, - "volume": "sfx", - "rolloffFactor": 2 - } - } -} \ No newline at end of file diff --git a/bin/data/entities/gui/mainmenu/circle-in.json b/bin/data/entities/gui/mainmenu/circle-in.json deleted file mode 100644 index e1fce4e2..00000000 --- a/bin/data/entities/gui/mainmenu/circle-in.json +++ /dev/null @@ -1,26 +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": [ 1, 1, 1 ] - }, - "metadata": { - "clickable": false, - "hoverable": false, - - "uv": [ 0, 0, 1, 1 ], - "color": [ 1, 1, 1, 0.8 ], - "location": "", - "scaling": [ 0.64, 1 ], - "mode": "flat" - }, - "assets": [ - "textures/circle-in.png" - ] -} \ No newline at end of file diff --git a/bin/data/entities/gui/mainmenu/circle-out.json b/bin/data/entities/gui/mainmenu/circle-out.json deleted file mode 100644 index fc92eb84..00000000 --- a/bin/data/entities/gui/mainmenu/circle-out.json +++ /dev/null @@ -1,26 +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": [ 1, 1, 1 ] - }, - "metadata": { - "clickable": false, - "hoverable": true, - - "uv": [ 0, 0, 1, 1 ], - "color": [ 1, 1, 1, 0.8 ], - "location": "", - "scaling": [ 0.64, 1 ], - "mode": "flat" - }, - "assets": [ - "textures/circle-out.png" - ] -} \ No newline at end of file diff --git a/bin/data/entities/gui/mainmenu/main-text.json b/bin/data/entities/gui/mainmenu/main-text.json deleted file mode 100644 index a1897789..00000000 --- a/bin/data/entities/gui/mainmenu/main-text.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "Menu: Main Text", - "type": "Gui", - "ignore": false, - "transform": { - "position": [ -0.922623, -0.854923, 0 ], - "rotation": { - "axis": [ 0, 0, 1 ], - "angle": 0 - }, - "scale": [ 1, 1, 1 ] - }, - "metadata": { - "uv": [ 0, 0, 1, 1 ], - "location": "", - "scaling": "relative", - "debug": { - "moveable": false - }, - "text settings": { - "scale": 2, - "font": "Coolvetica.ttf", - "string": "Grimgram" - } - } -} \ No newline at end of file diff --git a/bin/data/entities/gui/mainmenu/menu.json b/bin/data/entities/gui/mainmenu/menu.json deleted file mode 100644 index 40450ab2..00000000 --- a/bin/data/entities/gui/mainmenu/menu.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "Gui: Menu", - "type": "Gui", - "ignore": false, - "assets": [ - "./textures/menu.png", - "./scripts/menu.lua" - ], - "transform": { - "position": [ 0, 0, 0 ], - "rotation": { - "axis": [ 0, 0, 1 ], - "angle": 0 - }, - "scale": [ 1, 1, 1 ] - }, - "metadata": { - "clickable": true, - "hoverable": true, - - "uv": [ 0, 0, 1, 1 ], - "color": [ 1, 1, 1, 1 ], - "location": "", - "scaling": "relative", - "depth": 0.2, - "mode": "flat" - } -} \ No newline at end of file diff --git a/bin/data/entities/gui/mainmenu/quit.json b/bin/data/entities/gui/mainmenu/quit.json deleted file mode 100644 index a8e02a8f..00000000 --- a/bin/data/entities/gui/mainmenu/quit.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "name": "Menu: Close Option", - "type": "Gui", - "ignore": false, - "transform": { - "position": [ -0.75622, 0.638136, 0 ], - "rotation": { - "axis": [ 0, 0, 1 ], - "angle": 0 - }, - "scale": [ 1, 1, 1 ] - }, - "metadata": { - "clickable": true, - "hoverable": true, - - "uv": [ 0, 0, 1, 1 ], - "location": "", - "scaling": "relative", - "debug": { - "moveable": false - }, - "events": { - "click": { - "name": "system:Quit", - "payload": { - "scene": "StartMenu" - } - } - }, - "text settings": { - "legacy": false, - "string": "Quit" - } - } -} \ No newline at end of file diff --git a/bin/data/entities/gui/mainmenu/scripts/menu.lua b/bin/data/entities/gui/mainmenu/scripts/menu.lua deleted file mode 100644 index 23c11482..00000000 --- a/bin/data/entities/gui/mainmenu/scripts/menu.lua +++ /dev/null @@ -1,159 +0,0 @@ -Static = { - values = {}, - get = function( obj ) - if Static.values[""..obj:uid()] == nil then - Static.values[""..obj:uid()] = {} - end - return Static.values[""..obj:uid()] - end -} - -local ent = ent -local scene = entities.currentScene() -local controller = entities.controller() -local camera = controller:getComponent("Camera") -local metadata = ent:getComponent("Metadata") -local masterdata = scene:getComponent("Metadata") - -local children = { - mainText = ent:loadChild("./main-text.json",true), - circleOut = ent:loadChild("./circle-out.json",true), - circleIn = ent:loadChild("./circle-in.json",true), - start = ent:loadChild("./start.json",true), - quit = ent:loadChild("./quit.json",true), -} - -local timer = Timer.new() -if not timer:running() then timer:start() end - -local playSound = function( key ) - local url = "/ui/" .. key .. ".ogg" --- local assetLoader = scene:getComponent("Asset") --- assetLoader:cache(ent:formatHookName("asset:Load.%UID%"), string.resolveURI(url)) -end -local destination = function( obj, x, y, z ) - local static = Static.get(obj) - local transform = obj:getComponent("Transform") - static.from = Vector3f(x or transform.position.x, y or transform.position.y, z or transform.position.z) -end - ---[[ -pcall( function() - local metadata = controller:getComponent("Metadata") - local json = json.readFromFile("./data/entities/player.json"); - controller:callHook("object:UpdateMetadata.%UID%", { - overlay = json["metadata"]["overlay"] - }) - camera:update(true); -end ) -]] - -destination(children.mainText, nil, -2, 0) -destination(children.circleOut, nil, -2, 0) -destination(children.circleIn, nil, 2, 0) -destination(children.start, -1.5, nil, 0) -destination(children.quit, -1.5, nil, 0) - -ent:addHook("asset:Load.%UID%", function( json ) - local filename = json["filename"] - if filename == "" or string.extension( filename ) ~= "ogg" then return false end - - local sfx = ent:getComponent("Audio") - if not sfx:playing() then sfx:stop() end - sfx:load( filename ) - sfx:setVolume( masterdata["volumes"]["sfx"] ) - sfx:play() - - return true -end ) -if os.arch() == "Dreamcast" then - ent:bind( "tick", function(self) - -- circle in - if children.circleIn:uid() > 0 then - local transform = children.circleIn:getComponent("Transform") - transform.orientation = Quaternion.axisAngle( Vector3f(0, 0, 1), time.current() * -0.0125 ) - end - -- circle out - if children.circleIn:uid() > 0 then - local transform = children.circleIn:getComponent("Transform") - transform.orientation = Quaternion.axisAngle( Vector3f(0, 0, 1), time.current() * 0.0125 ) - end - end ) -else - ent:bind( "tick", function(self) - local static = Static.get(self) - if not static.alpha then - static.alpha = 0 - end - - metadata["initialized"] = true; - if static.alpha >= 1.0 then - static.alpha = 1.0 - else - static.alpha = static.alpha + time.delta() * 1.5 - end - - -- make background glow - local glow = 1 + math.sin(1.25 * time.current()) * 0.125 - metadata["color"][1] = glow - metadata["color"][2] = glow - metadata["color"][3] = glow - metadata["alpha"] = static.alpha; - self:setComponent("Metadata", metadata) - - camera:update(true); - - -- iterate children in batch - for k, v in pairs(children) do - if v:uid() <= 0 then goto continue end - - -- set alpha - local metadata = v:getComponent("Metadata") - metadata["alpha"] = static.alpha - v:setComponent("Metadata", metadata) - - local transform = v:getComponent("Transform") - local static = Static.get(v) - -- translation - if not static.from then goto continue end - if not static.to then static.to = Vector3f(transform.position) end - if not static.delta then static.delta = 0 end - - if static.delta >= 1 then - static.delta = 1 - else - static.delta = static.delta + time.delta() * 1.5 - transform.position = Vector3f.lerp( static.from, static.to, static.delta ) - end - - ::continue:: - end - - -- circle in - child = children.circleIn - if child:uid() > 0 then - local static = Static.get( child ) - - local transform = child:getComponent("Transform") - local metadata = child:getComponent("Metadata") - - -- rotation - local speed = metadata["hovered"] and 0.25 or 0.0125 - static.time = (static.time or 0) + time.delta() * -speed - transform.orientation = Quaternion.axisAngle( Vector3f(0, 0, 1), static.time ) - end - -- circle out - child = children.circleOut - if child:uid() > 0 then - local static = Static.get( child ) - - local transform = child:getComponent("Transform") - local metadata = child:getComponent("Metadata") - - -- rotation - local speed = metadata["hovered"] and 0.25 or 0.0125 - static.time = (static.time or 0) + time.delta() * speed - transform.orientation = Quaternion.axisAngle( Vector3f(0, 0, 1), static.time ) - end - end ) -end \ No newline at end of file diff --git a/bin/data/entities/gui/mainmenu/sound.json b/bin/data/entities/gui/mainmenu/sound.json deleted file mode 100644 index e69de29b..00000000 diff --git a/bin/data/entities/gui/mainmenu/start.json b/bin/data/entities/gui/mainmenu/start.json deleted file mode 100644 index 23fc52ca..00000000 --- a/bin/data/entities/gui/mainmenu/start.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "Menu: Start Option", - "type": "Gui", - "ignore": false, - "transform": { - "position": [ -0.75622, 0.446468, 0 ], - "rotation": { - "axis": [ 0, 0, 1 ], - "angle": 0 - }, - "scale": [ 1, 1, 1 ] - }, - "metadata": { - "clickable": true, - "hoverable": true, - - "uv": [ 0, 0, 1, 1 ], - "location": "", - "scaling": "relative", - "debug": { - "moveable": false - }, - "events": { - "click": { - "name": "game:Scene.Load", - "payload": { "scene": "SourceEngine" } - } - }, - "text settings": { - "string": "Start", - "string1": "スタート" - } - } -} \ No newline at end of file diff --git a/bin/data/entities/gui/pause/circle-in.json b/bin/data/entities/gui/pause/circle-in.json deleted file mode 100644 index b015536d..00000000 --- a/bin/data/entities/gui/pause/circle-in.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "Menu: Circle Inner", - "type": "Gui", - "ignore": false, - "transform": { - "position": [ -0.86, 0.86, 0 ], - "rotation": { - "axis": [ 1, 0, 0 ], - "angle": 0 - }, - "scale": [ 1, 1, 1 ] - }, - "metadata": { - "uv": [ 0, 0, 1, 1 ], - "color": [ 1, 1, 1, 0.8 ], - "location": "", - "scaling": [ 0.64, 1 ], - "mode": "flat" - }, - "assets": [ - "./textures/circle-in.png" - ] -} \ No newline at end of file diff --git a/bin/data/entities/gui/pause/circle-out.json b/bin/data/entities/gui/pause/circle-out.json deleted file mode 100644 index 58fb28c5..00000000 --- a/bin/data/entities/gui/pause/circle-out.json +++ /dev/null @@ -1,26 +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": [ 1, 1, 1 ] - }, - "metadata": { - "clickable": false, - "hoverable": true, - - "uv": [ 0, 0, 1, 1 ], - "color": [ 1, 1, 1, 0.8 ], - "location": "", - "scaling": [ 0.64, 1 ], - "mode": "flat" - }, - "assets": [ - "textures/circle-out.png" - ] -} \ No newline at end of file diff --git a/bin/data/entities/gui/pause/close.json b/bin/data/entities/gui/pause/close.json deleted file mode 100644 index 69f3f9f8..00000000 --- a/bin/data/entities/gui/pause/close.json +++ /dev/null @@ -1,31 +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 ] - }, - "metadata": { - "clickable": true, - "hoverable": true, - - "uv": [ 0, 0, 1, 1 ], - "location": "", - "scaling": "relative", - "events": { - "click": { - "name": "menu:Close.%P-UID%", - "payload": {} - } - }, - "text settings": { - "string": "Close", - "string1": "クローズ" - } - } -} \ No newline at end of file diff --git a/bin/data/entities/gui/pause/command-text.json b/bin/data/entities/gui/pause/command-text.json deleted file mode 100644 index 303cd2b1..00000000 --- a/bin/data/entities/gui/pause/command-text.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name": "Menu: Command Text", - "type": "Gui", - "ignore": false, - "transform": { - "position": [ -0.830591, -0.699509, 0 ], - "rotation": { - "axis": [ 1, 0, 0 ], - "angle": 0 - }, - "scale": [ 0.258737, 0.115371, 1 ] - }, - "metadata": { - "uv": [ 0, 0, 1, 1 ], - "location": "", - "scaling": "relative", - "text settings": { - "stroke": [ 1, 0.749, 0.368, 1 ], - "color": [ 1, 0.749, 0.368, 1 ], - - "string": "Menu", - "string1": "コマンド" - } - } -} \ No newline at end of file diff --git a/bin/data/entities/gui/pause/icon.json b/bin/data/entities/gui/pause/icon.json deleted file mode 100644 index 3176abf4..00000000 --- a/bin/data/entities/gui/pause/icon.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name": "Gui: Icon", - "type": "Gui", - "ignore": false, - "transform": { - "position": [ 0, 0, 0 ], - "rotation": { - "axis": [ 0, 0, 1 ], - "angle": 0 - }, - "scale": [ 1, 1, 1 ] - }, - "metadata": { - "gui": { - "position": [ -0.875, -0.775, 0 ], - "uv": [ 0, 0, 1, 1 ], - "color": [ 1, 1, 1, 1 ], - "location": "", - "scaling": "fixed" - } - }, - "assets": [ - "https://cdn..xyz//unity/Android/icon/icon_agyou01_skin1.png" - ] -} \ No newline at end of file diff --git a/bin/data/entities/gui/pause/main-text.json b/bin/data/entities/gui/pause/main-text.json deleted file mode 100644 index 244c0a0f..00000000 --- a/bin/data/entities/gui/pause/main-text.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "Menu: Main Scroller", - "type": "Gui", - "ignore": true, - "transform": { - "position": [ 0.98, -2, 0 ], - "rotation": { - "axis": [ 0, 0, 1 ], - "angle": 1.5707963 - }, - "scale": [ 0.16, 1, 1 ] - }, - "hoverable": true, - "metadata": { - "uv": [ 0, 0, 1, 1 ], - "color": [ 0.113, 0.756, 0.988, 0.4 ], - "location": "", - "scaling": "relative" - }, - "assets": [ - "./textures/main.png" - ] -} \ No newline at end of file diff --git a/bin/data/entities/gui/pause/menu.json b/bin/data/entities/gui/pause/menu.json deleted file mode 100644 index 4c981bf9..00000000 --- a/bin/data/entities/gui/pause/menu.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "Gui: Menu", - "type": "Gui", - "behaviors": [ - "GuiBehavior" - ], - "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, 0.5 ], - "location": "", - "scaling": "relative", - // "depth": 0.2, - "alpha": 1, - "mode": 1 - }, - "assets": [ - // "./textures/menu.png", - "./scripts/menu.lua" - ] -} \ No newline at end of file diff --git a/bin/data/entities/gui/pause/quit.json b/bin/data/entities/gui/pause/quit.json deleted file mode 100644 index a127fb1b..00000000 --- a/bin/data/entities/gui/pause/quit.json +++ /dev/null @@ -1,45 +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 ] - }, - "metadata": { - "clickable": true, - "hoverable": true, - - "uv": [ 0, 0, 1, 1 ], - "location": "", - "scaling": "relative", - "debug": { - "moveable": true - }, - "events": { - "click": [ - { - "name": "menu:Close.%P-UID%", - "payload": { - "callback": { - "name": "game:Scene.Load", - "payload": { - "scene": "StartMenu" - }, - "scope": "scene", - "delay": 0 - } - } - } - ] - }, - "text settings": { - "string": "Quit", - "string1": "終了する" - } - } -} \ No newline at end of file diff --git a/bin/data/entities/gui/pause/scripts/menu.lua b/bin/data/entities/gui/pause/scripts/menu.lua deleted file mode 100644 index 23599258..00000000 --- a/bin/data/entities/gui/pause/scripts/menu.lua +++ /dev/null @@ -1,180 +0,0 @@ -local ent = ent -local scene = entities.currentScene() -local metadata = ent:getComponent("Metadata") -local masterdata = scene:getComponent("Metadata") - -local children = { - mainText = ent:loadChild("./main-text.json",true), - circleOut = ent:loadChild("./circle-out.json",true), - circleIn = ent:loadChild("./circle-in.json",true), - coverBar = ent:loadChild("./yellow-box.json",true), - commandText = ent:loadChild("./command-text.json",true), - tenkouseiOption = ent:loadChild("./tenkousei.json",true), - closeOption = ent:loadChild("./close.json",true), - quit = ent:loadChild("./quit.json",true), -} - -local soundEmitter = ent:loadChild("./sound.json",true) - -local timer = Timer.new() -if not timer:running() then timer:start() end - -Static = { - values = {}, - get = function( obj ) - if obj == nil then - obj = scene - end - if Static.values[""..obj:uid()] == nil then - Static.values[""..obj:uid()] = {} - end - return Static.values[""..obj:uid()] - end -} - -local destination = function( obj, x, y, z ) - local static = Static.get(obj) - local transform = obj:getComponent("Transform") - static.from = Vector3f(x or transform.position.x, y or transform.position.y, z or transform.position.z) -end --- circleOut -destination(children.circleOut, nil, -2, 0) -destination(children.circleIn, nil, 2, 0) -destination(children.coverBar, -1.5, nil, 0) -destination(children.commandText, -1.5, nil, 0) -destination(children.tenkouseiOption, -1.5, nil, 0) -destination(children.closeOption, -1.5, nil, 0) -destination(children.quit, -1.5, nil, 0) - -local playSound = function( key ) - local url = "/ui/" .. key .. ".ogg" --- local assetLoader = scene:getComponent("Asset") --- assetLoader:cache(soundEmitter:formatHookName("asset:Load.%UID%"), string.resolveURI(url), "") -end - -ent:addHook("menu:Close.%UID%", function( json ) - playSound("menu close") - if metadata["system"]["hooks"] == nil then metadata["system"]["hooks"] = {} end - metadata["system"]["hooks"]["onClose"] = json["callback"]; - metadata["system"]["closing"] = true; - ent:setComponent("Metadata", metadata) -end ) - -playSound("menu open") - -ent:bind( "tick", function(self) - local static = Static.get(self) - if not static.alpha then - static.alpha = 0 - end - - -- handle closing - if metadata["system"]["closing"] then - if static.alpha <= 0 then - static.alpha = 0 - metadata["system"]["closing"] = false - metadata["system"]["closed"] = true - else - static.alpha = static.alpha - time.delta() - end - elseif metadata["system"]["closed"] then - timer:stop() - local callback = metadata["system"]["hooks"]["onClose"] - if callback then - local payload = callback["payload"] - local target = self - if callback["scope"] == "parent" then - target = ent:getParent() - elseif callback["scope"] == "scene" then - target = scene - end - - if type(callback["delay"]) == "number" and target:uid() ~= self:uid() then - target:queueHook( callback["name"], payload, callback["delay"] ); - else - target:callHook( callback["name"], payload ); - end - end - entities.destroy(self) - -- scene:queueHook("system:Destroy", { uid = self:uid() }, 0) - return - else - if not metadata["initialized"] then - static.alpha = 0 - end - metadata["initialized"] = true; - if static.alpha >= 1.0 then - static.alpha = 1.0 - else - static.alpha = static.alpha + time.delta() * 1.5 - end - end - - metadata["alpha"] = static.alpha; - -- set alphas - for k, v in pairs(children) do - if v:uid() <= 0 then goto continue end - - -- set alpha - local metadata = v:getComponent("Metadata") - metadata["alpha"] = static.alpha - - local transform = v:getComponent("Transform") - local static = Static.get(v) - -- translation - if not static.from then goto continue end - if not static.to then static.to = Vector3f(transform.position) end - if not static.delta then static.delta = 0 end - - if static.delta >= 1 then - static.delta = 1 - else - static.delta = static.delta + time.delta() * 1.5 - transform.position = Vector3f.lerp( static.from, static.to, static.delta ) - v:setComponent("Metadata", metadata) - end - - ::continue:: - end - - -- main text - local child = children.mainText - if child:uid() > 0 then - local transform = child:getComponent("Transform") - local metadata = child:getComponent("Metadata") - local speed = metadata["gui"]["hovered"] and 0.75 or 0.5 - transform.position.y = transform.position.y + time.delta() * speed - if transform.position.y > 2 then - transform.position.y = -2 - end - end - -- circle in - if children.circleIn:uid() > 0 then - local static = Static.get( children.circleIn ) - - local transform = children.circleIn:getComponent("Transform") - local metadata = children.circleIn:getComponent("Metadata") - - -- rotation - local speed = metadata["gui"]["hovered"] and 0.25 or 0.0125 - static.time = (static.time or 0) + time.delta() * -speed - transform.orientation = Quaternion.axisAngle( Vector3f(0, 0, 1), static.time ) - end - -- circle out - if children.circleOut:uid() > 0 then - local static = Static.get( children.circleOut ) - - local transform = children.circleOut:getComponent("Transform") - local metadata = children.circleOut:getComponent("Metadata") - - -- rotation - local speed = metadata["gui"]["hovered"] and 0.25 or 0.0125 - static.time = (static.time or 0) + time.delta() * speed - transform.orientation = Quaternion.axisAngle( Vector3f(0, 0, 1), static.time ) - end - - if window.keyPressed("Escape") and timer:elapsed() >= 1 then - timer:reset() - self:callHook("menu:Close.%UID%", {}) - end -end ) \ No newline at end of file diff --git a/bin/data/entities/gui/pause/sound.json b/bin/data/entities/gui/pause/sound.json deleted file mode 100644 index 521052cd..00000000 --- a/bin/data/entities/gui/pause/sound.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "type": "Object", - "name": "Sound Emitter", - "ignore": false, - "assets": [ - ], - "behaviors": [ - "SoundEmitterBehavior" - ], - "transform": { - "position": [ 0, 0, 0 ], - "rotation": { - "axis": [ 0, 1, 0 ], - "angle": 0 - }, - "scale": [ 1, 1, 1 ] - }, - "system": { - "hot reload": { - "enabled": true - }, - "defaults": { - "render": true, - "asset load": true - }, - "load": { - "ignore": true - } - }, - "metadata": { - "audio": { - "spatial": false, - "loop": false, - "volume": "sfx", - "rolloffFactor": 2 - } - } -} \ No newline at end of file diff --git a/bin/data/entities/gui/pause/tenkousei.json b/bin/data/entities/gui/pause/tenkousei.json deleted file mode 100644 index de0f3362..00000000 --- a/bin/data/entities/gui/pause/tenkousei.json +++ /dev/null @@ -1,25 +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 ] - }, - "metadata": { - "clickable": true, - "hoverable": true, - - "uv": [ 0, 0, 1, 1 ], - "location": "", - "scaling": "relative", - "text settings": { - "string": "", - "string1": "「転光生」" - } - } -} \ No newline at end of file diff --git a/bin/data/entities/gui/pause/transient-portrait.json b/bin/data/entities/gui/pause/transient-portrait.json deleted file mode 100644 index 1a8843af..00000000 --- a/bin/data/entities/gui/pause/transient-portrait.json +++ /dev/null @@ -1,23 +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 ] - }, - "metadata": { - "clickable": true, - "hoverable": false, - - "uv": [ 0, 0, 1, 1 ], - "color": [ 1, 1, 1, 0 ], - "location": "", - "scaling": "relative", - "depth": 0.1 - } -} \ No newline at end of file diff --git a/bin/data/entities/gui/pause/transient-shadow.json b/bin/data/entities/gui/pause/transient-shadow.json deleted file mode 100644 index 908f7c47..00000000 --- a/bin/data/entities/gui/pause/transient-shadow.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "Menu: Transient Shadow", - "type": "Gui", - "ignore": true, - "transform": { - "position": [ 0.46, 0, 0 ], - "rotation": { - "axis": [ 1, 0, 0 ], - "angle": 0 - }, - "scale": [ 0.43, 1, 1 ] - }, - "metadata": { - "uv": [ 0, 0, 1, 1 ], - "color": [ 1, 1, 1, 0 ], - "location": "", - "scaling": "relative", - "shader": 1, - "depth": 0.1 - } -} \ No newline at end of file diff --git a/bin/data/entities/gui/pause/yellow-box.json b/bin/data/entities/gui/pause/yellow-box.json deleted file mode 100644 index 49d36850..00000000 --- a/bin/data/entities/gui/pause/yellow-box.json +++ /dev/null @@ -1,25 +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, 1 ], - "location": "", - "scaling": "relative", - "shader": 1, - "mode": "flat" - }, - "assets": [ - "./textures/square.png" - ] -} \ No newline at end of file diff --git a/bin/data/entities/gui/text/letter.json b/bin/data/entities/gui/text/letter.json deleted file mode 100644 index c4e85168..00000000 --- a/bin/data/entities/gui/text/letter.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "Gui: Text", - "type": "Object", - "behaviors": [ - "GuiBehavior" - ], - "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" - } -} \ No newline at end of file diff --git a/bin/data/entities/gui/text/string.json b/bin/data/entities/gui/text/string.json deleted file mode 100644 index 0eecab28..00000000 --- a/bin/data/entities/gui/text/string.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "name": "Gui: Text", - "type": "Gui", - "ignore": true, - "transform": { - "position": [ 0, 0, 0 ], - "rotation": { - "axis": [ 0, 0, 1 ], - "angle": 0 - }, - "scale": [ 1, 1, 1 ] - }, - "metadata": { - "text settings": { - "legacy": false, - "padding": [ 1, 1 ], - "spread": 4, - "weight": 0.48, - // "size": 36, "scale": 3, - // "size": 45, "scale": 2, - "size": 60, "scale": 1.5, - // "size": 72, "scale": 1.25, - // "size": 90, "scale": 1, - "sdf": false, - "font": "TAZUGANEGOTHICSTDN-BOLD.otf", - "kerning": 24, - // "font": "Coolvetica.ttf", - - "stroke": [ 0, 0, 0, 0 ], - "color": [ 1, 1, 1, 1 ], - - "direction": "down", - "align": "left", - "origin": [ 0, 0 ], - - "string": "", - - "world": false, - // "depth": 0, - "wrap": true - } - } -} \ No newline at end of file diff --git a/bin/data/entities/hud.json b/bin/data/entities/hud.json deleted file mode 100644 index 1d99139b..00000000 --- a/bin/data/entities/hud.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "HUD Text", - "type": "Gui", - "ignore": false, - "transform": { - "position": [ -0.830591, -0.899509, 0 ], - "rotation": { - "axis": [ 1, 0, 0 ], - "angle": 0 - }, - "scale": [ 0.258737, 0.115371, 1 ] - }, - "system": { - "hot reload": { - "enabled": true - } - }, - "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 ], - "depth": 0.5, - "string": "." - } - } -} \ No newline at end of file diff --git a/bin/data/entities/light.json b/bin/data/entities/light.json deleted file mode 100644 index cac15456..00000000 --- a/bin/data/entities/light.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "type": "Object", - "name": "Light", - "behaviors": [ "LightBehavior" ], - "ignore": false, - "transform": { - "reference": true - }, - "system": { - "renderer": { - // "limiter": 128 - // "mode": "round robin" - // "mode": "once" - "mode": "in-range" - }, - "hot reload": { - "enabled": true - } - }, - "metadata": { - "light": { - "type": "point", - "color": [1, 1, 1], - "power": 100, - "fov": 90, - "bias": { - "constant": 1.25, - "slope": 1.75, - "shader": 0.000005 // 0.000005 //0.000000005 - }, - "radius": [0.5, 0], - "resolution": 512, - "shadows": true, - "dynamic": true - } - } -} \ No newline at end of file diff --git a/bin/data/entities/model.json b/bin/data/entities/model.json deleted file mode 100644 index a245e19b..00000000 --- a/bin/data/entities/model.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "name": "Graph", - "type": "Object", - "ignore": false, -// "behaviors": [ "LoadingBehavior" ], - "transform": { - "position": [ 0, 0, 0 ], - "rotation": { "axis": [ 0, 1, 0 ], "angle": 0 }, - "scale": [ 1, 1, 1 ] - }, - "metadata": { - "graph": { - "debug": { - "no cleanup": false, - "print": { - "tree": false, - "stats": false, - "lights": false, - "meshes": false, - "materials": false, - "textures": false - } - }, - "sanitizer": { - "winding order": true - }, - "exporter": { - "enabled": true, - "pretty": false, - "encoding": "auto", - "compression": "auto", - "quantize": false, - "precision": 4, - "combined": false, - "encode buffers": true, - "unwrap": "tagged", - "quit": true - }, - "baking": { - "enabled": true, - "resolution": 2048, - "shadows": 1024, - "layers": 1, - "trigger": { "mode": "rendered", "quit": true }, - // "trigger": { "mode": "key", "value": "B" }, - "output": "./lightmap.%i.png", - "settings": { - "useInputMeshUvs": true, - "maxIterations": 4, - // "maxChartSize": 0, - "padding": 2, - // "texelsPerUnit": 0, - "bilinear": true, - "blockAlign": true, - "bruteForce": false, - - "rotateChartsToAxis": false, - "rotateCharts": true - } - }, - "renderer": { - "front face": "auto", - "cull mode": "back", - "filter": "linear", - - "atlas": false, - "invert": true, - "skinned": false, - "render": true, - "separate": false - }, - "lights": { - "lightmap": "auto", - // "disable if lightmapped": false, - "shadows": true - } - } - } -} \ No newline at end of file diff --git a/bin/data/entities/player.json b/bin/data/entities/player.json deleted file mode 100644 index d03fdc72..00000000 --- a/bin/data/entities/player.json +++ /dev/null @@ -1,111 +0,0 @@ -{ - "name": "Player", - "type": "Object", - "behaviors": [ - "PlayerBehavior", - "SoundEmitterBehavior" - ], - "ignore": false, -/* - "transform": { - "position": [ 0, 0, 0 ], - "rotation": { - "axis": [ 0, 1, 0 ], - "angle": 0 - }, - "scale": [ 1, 1, 1 ] - }, -*/ - "assets": [ - // { "filename": "./playerModel.json", "delay": 0 }, - "./playerModel.json", - "./playerLight.json", - "./playerHands.json", - "./scripts/player.lua" - ], - "system": { - "hot reload": { - "enabled": true - } - }, - "metadata": { - "overlay": { - "transform": { - "position": [ 0, 0, -3 ], - "scale": [ 1.77778, -1, 1 ], - "orientation": [ 0, 0, 0, 1 ] - }, - "floating": false, - "enabled": true, - "alpha": 1.0, - "cursor": { - "type": "mouse", - "radius": 0.05, - "color": [ 0.2, 0.2, 1.0, 1.0 ], - "enabled": false - } - }, - "audio": { - "footstep": { - "volume": 0.5, - "list": [ - "/footstep/1.ogg", - "/footstep/2.ogg" - ] - } - }, - "movement": { - "walk": 1, - "move": 4, - "run": 16, - "rotate": 1.5, - "air": 0.1, - - "crouch": 1, - "jump": [ 0, 3, 0 ], - "look": 1, - "floored": { - "feet": [ 0, -1.5, 0 ], - // "floor": [ 0, -0.5, 0 ], - "floor": [ 0, -1.0, 0 ], - "print": false - } - }, - "physics": { - "gravity": [ 0, -9.81, 0 ], - "inertia": [ 0, 0, 0 ], - - "type": "capsule", - "radius": 1, - "height": 2, - - "mass": 100, - "friction": 0.95, - "restitution": 0.0, - - "shared": false - }, - "camera": { - "offset": [ 0, 0, 0 ], - "position" : [ 0, 1.8, 0 ], - "scale": [ 1, 1, 1 ], - "invert": [ false, false, false ], - "limit": { - // "minima": [ null, -1.57079633, null ], - // "maxima": [ null, 1.57079633, null ], - - "minima": [ null, -1.0, null ], - "maxima": [ null, 1.0, null ], - "current":[ null, 0, null ] - }, - "settings": { - "fov" : 90.0, - "clip" : [ 0.1, 64.0 ], - "size" : [ 0, 0 ] - } - }, - "use": { - "length": 5 - } - } -} \ No newline at end of file diff --git a/bin/data/entities/playerHands.json b/bin/data/entities/playerHands.json deleted file mode 100644 index 45774fbd..00000000 --- a/bin/data/entities/playerHands.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "name": "Hands", - "type": "Object", - "ignore": true, - "transform": { - "position": [ 0, 0, 0 ], - "rotation": { - "axis": [ 0, 1, 0 ], - "angle": 0.0 - }, - "scale": [ 1, 1, 1 ] - }, - "assets": [ - ], - "behaviors": [ - "PlayerHandBehavior" - ], - "metadata": { - "hands": { - "left": { - "controller": { - "model": "{indexcontroller}valve_controller_knu_1_0_left", - "color": [ 1, 1, 1, 1 ] - }, - "light": { - "should": false, - "type": 3, - "color": [1, 1, 1], - "power": 50, - "fov": 80, - "shadows": true, - "bias": 0.000005, - "resolution": 512, - "static": false - }, - "pointer": { - "color": [ 1, 0, 1, 1 ], - "length": 0, //128, - "width": 8, - "offset": [ 0, 0, 0 ], - "orientation": { - "axis": [ 1, 0, 0 ], - "angle": 0 - } - } - }, - "right": { - "controller": { - "model": "{indexcontroller}valve_controller_knu_1_0_right", - "color": [ 1, 1, 1, 1 ] - }, - "light": { - "should": false, - "type": 3, - "color": [1, 1, 1], - "power": 50, - "fov": 80, - "shadows": true, - "bias": 0.000005, - "resolution": 512, - "static": false - }, - "pointer": { - "color": [ 1, 0, 1, 1 ], - "length": 0, //128, - "width": 8, - "offset": [ 0, 0, 0 ], - "orientation": { - "axis": [ 1, 0, 0 ], - "angle": 0 - } - } - } - } - } -} \ No newline at end of file diff --git a/bin/data/entities/playerLight.json b/bin/data/entities/playerLight.json deleted file mode 100644 index 6f83eba5..00000000 --- a/bin/data/entities/playerLight.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "import": "/light.json", - "ignore": false, - "assets": [ - ], - "transform": { - // "track": "parent", - "position": [ 0, 1.7, 0 ] - }, - "system": { - "hot reload": { - "enabled": true - } - }, - "metadata": { - "light": { - "type": "spot", - "color": [1, 1, 1], - "power": 30, - "fov": 90, - "bias": { - "constant": 1.25, - "slope": 1.75, - "shader": 0.000005 //0.000000005 - }, - "radius": [0.001, 0], - "resolution": 512, - "shadows": false, - "dynamic": true - } - } -} \ No newline at end of file diff --git a/bin/data/entities/playerModel.json b/bin/data/entities/playerModel.json deleted file mode 100644 index 4a340d63..00000000 --- a/bin/data/entities/playerModel.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "type": "Object", - "name": "Player: Model", - "ignore": false, - "import": "/model.json", - "assets": [ - "/player/bear.glb" - // { "filename": "/player/bear/graph.json" } - ], - "behaviors": [ - "PlayerModelBehavior" - ], - "transform": { - "position": [ 0, -2.0, 0 ], - // "position": [ 12.5715, 3.53811, 7.6238 ], - // "position": [ 1.635, -0.384, -20.409 ], // -0.384 - "rotation": { - "axis": [ 0, 1, 0 ], - "angle": 0 - }, - "scale": [ 0.16, 0.16, 0.16 ] - }, - "system": { - "hot reload": { - "enabled": true - } - }, - "metadata": { - "track": true, - "hide": true, - "graph": { - "debug": { - "print": { - "animations": true - } - }, - "exporter": { - "enabled": false, - "unwrap": false, - "optimize": false - }, - "baking": { - "enabled": false - }, - "renderer": { - "cull mode": "back", - "filter": "linear" - }, - "lights": { - "lightmap": false - }, - "renderer": { - "flip textures": false, - "invert": false, - "skinned": true - }, - "animations": { - "animation": "wank" - } - } - } -} \ No newline at end of file diff --git a/bin/data/entities/prop.json b/bin/data/entities/prop.json deleted file mode 100644 index a44b9326..00000000 --- a/bin/data/entities/prop.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "assets": [], - "behaviors": [ - "SoundEmitterBehavior" - ], - "metadata": { - "holdable": true, - "physics": { - // "gravity": [ 0, -9.81, 0 ], - // "inertia": [10, 10, 10], - // "mass": 10, - - "type": "bounding box", - "recenter": false - } - } -} \ No newline at end of file diff --git a/bin/data/entities/scene.json b/bin/data/entities/scene.json deleted file mode 100644 index 9ce19331..00000000 --- a/bin/data/entities/scene.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "Scene", - "assets": [ - "/gui.json" - ], - "behaviors": [ - "SceneBehavior", - "ExtSceneBehavior" - ] -} \ No newline at end of file diff --git a/bin/data/entities/scripts/door.lua b/bin/data/entities/scripts/door.lua deleted file mode 100644 index b32db393..00000000 --- a/bin/data/entities/scripts/door.lua +++ /dev/null @@ -1,117 +0,0 @@ -local ent = ent -local scene = entities.currentScene() -local controller = entities.controller() - -local timer = Timer.new() -if not timer:running() then - timer:start(); -end - -local polarity = 1 -local state = 0 -local targetAlpha = 1 -local alpha = 0 -local target = Vector3f(0,0,0) -local transform = ent:getComponent("Transform") -local metadata = ent:getComponent("Metadata") -local speed = metadata["speed"] or 1.0 -local normal = Vector3f(0,0,-1) -if metadata["normal"] ~= nil then - local sign = -1 - if metadata["angle"] < 0 then sign = 1 end - normal = Vector3f( metadata["normal"][1] * sign, metadata["normal"][2] * sign, metadata["normal"][3] * sign ):normalize() -end -local starting = Quaternion(transform.orientation) -local ending = transform.orientation:multiply(Quaternion.axisAngle( Vector3f(0,1,0), metadata["angle"] )) - --- local soundEmitter = ent:loadChild("/sound.json",true) -local soundEmitter = ent - -local playSound = function( key, loop ) - if not loop then loop = false end - local url = "/door/" .. key .. ".ogg" - soundEmitter:queueHook("sound:Emit.%UID%", { - filename = string.resolveURI(url, metadata["system"]["root"]), - spatial = true, - streamed = true, - volume = "sfx", - loop = loop - }, 0) -end -local stopSound = function( key ) - local url = "/door/" .. key .. ".ogg" - soundEmitter:queueHook("sound:Stop.%UID%", { - filename = string.resolveURI(url, metadata["system"]["root"]) - }, 0) -end -local playSoundscape = function( key ) - local url = "/soundscape/" .. key .. ".ogg" - soundEmitter:queueHook("sound:Emit.%UID%", { - filename = string.resolveURI(url, metadata["system"]["root"]), - spatial = false, - volume = "sfx", - loop = true, - streamed = true - }, 0) -end -local stopSoundscape = function( key ) - local url = "/soundscape/" .. key .. ".ogg" - soundEmitter:queueHook("sound:Stop.%UID%", { - filename = string.resolveURI(url, metadata["system"]["root"]) - }, 0) -end --- on tick -ent:bind( "tick", function(self) --- transform.orientation = starting:slerp( ending, math.cos(time.current() * speed) * 0.5 + 0.5 ) - if state == 1 then - alpha = alpha + time.delta() * speed - - if alpha > targetAlpha then - state = 2 - alpha = targetAlpha - playSound("default_stop") - end - - end - if state == 3 then - alpha = alpha - time.delta() * speed - - if alpha < 0 then - state = 0 - alpha = 0 - playSound("default_stop") - end - end - - if state > 0 then - transform.orientation = starting:slerp( ending, alpha * polarity ) - end -end ) --- on use -ent:addHook( "entity:Use.%UID%", function( payload ) - if payload.user == ent:uid() then return end - --- if timer:elapsed() <= 0.125 then return end --- timer:reset() - - print("Processing use: " .. ent:name() .. " | " .. payload["depth"] ) - - if state == 0 or state == 3 then - state = 1 - playSound("default_move") - if payload.uid ~= nil then - local user = entities.get( payload.user ) - local userTransform = user:getComponent("Transform") - local delta = transform.position - userTransform.position - local side = normal:dot(delta) - if side > 0 then - polarity = 1 - elseif side < 0 then - polarity = -1 - end - end - elseif state == 2 --[[or state == 1]] then - state = 3 - playSound("default_move") - end -end ) \ No newline at end of file diff --git a/bin/data/entities/scripts/player.lua b/bin/data/entities/scripts/player.lua deleted file mode 100644 index 62f78e5e..00000000 --- a/bin/data/entities/scripts/player.lua +++ /dev/null @@ -1,241 +0,0 @@ -local ent = ent -local scene = entities.currentScene() -local metadata = ent:getComponent("Metadata") -local transform = ent:getComponent("Transform") -local physicsState = ent:getComponent("PhysicsState") -local camera = ent:getComponent("Camera") -local cameraTransform = camera:getTransform() - --- setup all timers -local timers = { - use = Timer.new(), - holp = Timer.new(), - flashlight = Timer.new(), - physcannon = Timer.new() -} -if not timers.use:running() then timers.use:start(); end -if not timers.holp:running() then timers.holp:start(); end -if not timers.flashlight:running() then timers.flashlight:start(); end -if not timers.physcannon:running() then timers.physcannon:start(); end - --- setup held object locals -local heldObject = { - uid = 0, - distance = 0, - smoothSpeed = 4, - scrollSpeed = 16, - momentum = Vector3f(0,0,0), - rotate = false, -} --- setup light locals -local light = { - entity = nil -} -for k, v in pairs(ent:getChildren()) do - if v:name() == "Light" then - light.entity = v - end -end - -if light.entity == nil then - light.entity = ent:loadChild("./playerLight.json",true) -end -light.metadata = light.entity:getComponent("Metadata") -light.transform = light.entity:getComponent("Transform") -light.power = light.metadata["light"]["power"] -light.origin = Vector3f(light.transform.position) -light.entity:setComponent("Metadata", { light = { power = 0 } }) - --- sound emitter -local playSound = function( key, loop ) - if not loop then loop = false end - local url = "/ui/" .. key .. ".ogg" - ent:callHook("sound:Emit.%UID%", { - filename = string.resolveURI(url, metadata["system"]["root"]), - spatial = true, - streamed = true, - volume = "sfx", - loop = loop - }, 0) -end -local stopSound = function( key ) - local url = "/ui/" .. key .. ".ogg" - ent:callHook("sound:Stop.%UID%", { - filename = string.resolveURI(url, metadata["system"]["root"]) - }, 0) -end - -local useDistance = 6 -local pullDistance = useDistance * 4 - --- on tick -ent:bind( "tick", function(self) - -- eye transform - local flattenedTransform = cameraTransform:flatten() - flattenedTransform.forward = ( transform.forward + Vector3f( 0, cameraTransform.forward.y, 0 ) ):normalize(); - - -- toggle flashlight - if light.enabled then - local center = flattenedTransform.position - local direction = flattenedTransform.forward * 8 - - local offset = 0.25 - local _, depth = physicsState:rayCast( center, direction ) - if depth >= 0.5 then - depth = 0.5 - elseif depth < 0 then - depth = 0.5 - end - light.transform.position = center + direction * (depth - offset) - end - - if timers.flashlight:elapsed() > 0.5 and inputs.key("F") then - timers.flashlight:reset() - - local metadata = { light = { power = light.power } } - if light.entity:getComponent("Metadata")["light"]["power"] ~= light.power then - metadata["light"]["power"] = light.power - light.enabled = true - else - metadata["light"]["power"] = 0 - light.enabled = false - end - light.entity:setComponent("Metadata", metadata) - - playSound("flashlight") - end - - -- fire use ray - if timers.use:elapsed() > 0.5 and inputs.key("E") then - timers.use:reset() - - local center = flattenedTransform.position - local direction = flattenedTransform.forward * useDistance - - local prop, depth = physicsState:rayCast( center, direction ) - local payload = { - user = ent:uid(), - uid = prop and prop:uid() or 0, - depth = depth, - } - if prop then - prop:lazyCallHook("entity:Use.%UID%", payload) - end - ent:lazyCallHook("entity:Use.%UID%", payload) - end - - -- update HOLP - if heldObject.uid == 0 then - local mouse2 = inputs.key("Mouse2"); - if mouse2 then - --[[ - local center = transform.position + cameraTransform.position - local direction = transform.forward + Vector3f( 0, cameraTransform.forward.y, 0 ) - direction = direction:normalize() * 4 - ]] - local center = flattenedTransform.position - local direction = flattenedTransform.forward * pullDistance - local prop, depth = physicsState:rayCast( center, direction ) - if depth >= 0 and prop and not string.matched( prop:name(), "/^worldspawn/" ) then - local heldObjectTransform = prop:getComponent("Transform") - local heldObjectPhysicsState = prop:getComponent("PhysicsState") - - local strength = 500 - local distanceSquared = (heldObjectTransform.position - flattenedTransform.position):magnitude() - - heldObjectPhysicsState:applyImpulse( flattenedTransform.forward * -heldObjectPhysicsState:getMass() * strength / distanceSquared ) - if timers.physcannon:elapsed() > 1.0 then - timers.physcannon:reset() - - playSound("phys_tooHeavy") - end - end - end - else - local mouse1 = inputs.key("Mouse1"); - local mouse3 = inputs.key("Mouse3"); - local wheel = inputs.analog("MouseWheel") - - if wheel ~= 0 then - heldObject.distance = heldObject.distance + (wheel / 120 * heldObject.scrollSpeed) * time.delta() - end - if mouse3 then - heldObject.rotate = not heldObject.rotate - end - - local prop = entities.get( heldObject.uid ) - local heldObjectTransform = prop:getComponent("Transform") - local heldObjectPhysicsState = prop:getComponent("PhysicsState") - - if mouse1 and timers.physcannon:elapsed() > 0.5 then - timers.physcannon:reset() - - heldObject.uid = 0 - heldObjectPhysicsState:enableGravity(true) - heldObjectPhysicsState:applyImpulse( flattenedTransform.forward * heldObjectPhysicsState:getMass() * 1000 ) - - playSound("phys_launch"..math.random(1,4)) - else - if heldObject.rotate then - heldObjectTransform.orientation = Quaternion.lookAt( (heldObjectTransform.position - flattenedTransform.position):normalize(), transform.up ) - end - - local forward = flattenedTransform.forward * heldObject.distance --flattenedTransform.orientation:rotate( Vector3f(0,0,1) ) - if heldObject.smoothSpeed ~= 0 then - local target = flattenedTransform.position + forward - local offset = target - heldObjectTransform.position - local delta = offset * time.delta() * heldObject.smoothSpeed - - local distance = delta:norm() - if distance > 0.001 then - if timers.holp:elapsed() > 0.125 then - timers.holp:reset() - heldObjectPhysicsState:setVelocity( delta * 20 ) - end - else - heldObjectPhysicsState:setVelocity( Vector3f(0,0,0) ) - end - else - heldObjectTransform.position = flattenedTransform.position + forward - end - end - end -end ) --- on use -ent:addHook( "entity:Use.%UID%", function( payload ) - if payload.user ~= ent:uid() then return end - - local validUse = false - - if heldObject.uid == 0 and payload.depth > 0 then - local prop = entities.get( payload.uid ) - local propMetadata = prop:getComponent("Metadata") - if propMetadata["holdable"] then - validUse = true - local offset = transform.position - prop:getComponent("Transform").position - - heldObject.uid = payload.uid - heldObject.distance = offset:norm() - - prop:getComponent("PhysicsState"):enableGravity(false) - else - validUse = not string.matched( prop:name(), "/^worldspawn/" ) - end - elseif heldObject.uid ~= 0 then - validUse = true - local prop = entities.get( heldObject.uid ) - local heldObjectPhysicsState = prop:getComponent("PhysicsState") - heldObjectPhysicsState:enableGravity(true) - heldObjectPhysicsState:applyImpulse( heldObject.momentum ) - - heldObject.uid = 0 - heldObject.distance = 0 - heldObject.momentum = Vector3f(0,0,0) - end - - if validUse then - playSound("select") - else - playSound("deny") - end -end ) \ No newline at end of file diff --git a/bin/data/entities/sound.json b/bin/data/entities/sound.json deleted file mode 100644 index 7160ee15..00000000 --- a/bin/data/entities/sound.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "type": "Object", - "name": "Sound Emitter", - "ignore": false, - "assets": [], - "behaviors": [ "SoundEmitterBehavior" ], - "transform": { "reference": true }, - "system": { - "hot reload": { "enabled": true } - }, - "metadata": { - "audio": { - "spatial": true, - "loop": false, - "volume": 1, - "rolloffFactor": 0.5, - "epsilon": 0.5 - } - } -} \ No newline at end of file diff --git a/bin/data/entities/test/html.json b/bin/data/entities/test/html.json deleted file mode 100644 index 5a5a0a76..00000000 --- a/bin/data/entities/test/html.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "Gui: HTML", - "type": "Gui", - "ignore": true, - "assets": [], - "behaviors": [ - "GuiHtmlBehavior" - ], - "transform": { - "position": [ 0, 4, 0 ], - "rotation": { - "axis": [ 1, 0, 0 ], - "angle": 3.14159 - }, - "scale": [ 2, 2, 2 ] - }, - "metadata": { - "clickable": true, - "hoverable": true, - - "uv": [ 0, 0, 1, 1 ], - "color": [ 1, 1, 1, 1 ], - "location": "", - "scaling": "relative", - "depth": 0.2, - "world": true, - "size": [ 1600, 1600 ], - "html": "https://youtube.com/", - "ignore inputs": false - } -} \ No newline at end of file diff --git a/bin/data/entities/test/loading.json b/bin/data/entities/test/loading.json deleted file mode 100644 index 0dfa50a5..00000000 --- a/bin/data/entities/test/loading.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "Gui: Loading", - "type": "Object", - "behaviors": [ - // "GuiBehavior" - ], - "assets": [ - { "filename": "./mcdonalds.json", "delay": 0 } - // { "filename": "./sh.json", "delay": 0 } - // { "filename": "./medsci.json", "delay": 0 } - ], - "ignore": false, - "transform": { - "position": [ -0.830591, -0.699509, 0 ], - "rotation": { - "axis": [ 1, 0, 0 ], - "angle": 0 - }, - "scale": [ 0.258737, 0.115371, 1 ] - }, - "metadata": { - "uv": [ 0, 0, 1, 1 ], - "color": [ 1, 1, 1, 0.1 ], - "location": "", - "scaling": "relative", - "text settings": { - "stroke": [ 1, 0.749, 0.368, 1 ], - "color": [ 1, 0.749, 0.368, 1 ], - - "string": "Loading", - "string1": "コマンド" - } - } -} \ No newline at end of file diff --git a/bin/data/openvr_bindings_default.json b/bin/data/openvr_bindings_default.json deleted file mode 100644 index 767330f3..00000000 --- a/bin/data/openvr_bindings_default.json +++ /dev/null @@ -1,261 +0,0 @@ -{ - "controller_type" : "generic", - "description" : "Default bindings", - "name" : "Generic Bindings", - "bindings": { - "/actions/global": { - "sources": [ - { - "path": "/user/hand/right/input/a", - "mode": "button", - "inputs": { - "click": { - "output": "/actions/global/in/leftA" - } - } - }, - { - "path": "/user/hand/left/input/a", - "mode": "button", - "inputs": { - "click": { - "output": "/actions/global/in/rightA" - } - } - }, - { - "path": "/user/hand/left/input/b", - "mode": "button", - "inputs": { - "click": { - "output": "/actions/global/in/leftB" - } - } - }, - { - "path": "/user/hand/right/input/b", - "mode": "button", - "inputs": { - "click": { - "output": "/actions/global/in/rightB" - } - } - }, - { - "path": "/user/hand/left/input/trackpad", - "mode": "trackpad", - "inputs": { - "position": { - "output": "/actions/global/in/leftTrackpad" - }, - "touch": { - "output": "/actions/global/in/leftTouchpad" - } - } - }, - { - "path": "/user/hand/right/input/trackpad", - "mode": "trackpad", - "inputs": { - "position": { - "output": "/actions/global/in/rightTrackpad" - }, - "touch": { - "output": "/actions/global/in/rightTouchpad" - } - } - }, - { - "path": "/user/hand/left/input/trackpad", - "mode": "button", - "inputs": { - "click": { - "output": "/actions/global/in/leftClickpad" - } - } - }, - { - "path": "/user/hand/right/input/trackpad", - "mode": "button", - "inputs": { - "click": { - "output": "/actions/global/in/right_Clickpad" - } - } - }, - { - "path": "/user/hand/left/input/grip", - "mode": "force_sensor", - "inputs": { - "force": { - "output": "/actions/global/in/leftGrip" - } - } - }, - { - "path": "/user/hand/right/input/grip", - "mode": "force_sensor", - "inputs": { - "force": { - "output": "/actions/global/in/rightGrip" - } - } - }, - { - "path": "/user/hand/left/input/grip", - "mode": "grab", - "inputs": { - "grab": { - "output": "/actions/global/in/leftGrab" - } - } - }, - { - "path": "/user/hand/right/input/grip", - "mode": "grab", - "inputs": { - "grab": { - "output": "/actions/global/in/rightGrab" - } - } - }, - { - "path": "/user/hand/left/input/trigger", - "mode": "button", - "parameters": { - "haptic_amplitude": "0" - }, - "inputs": { - "click": { - "output": "/actions/global/in/leftClick" - } - } - }, - { - "path": "/user/hand/right/input/trigger", - "mode": "button", - "parameters": { - "haptic_amplitude": "0" - }, - "inputs": { - "click": { - "output": "/actions/global/in/rightClick" - } - } - }, - { - "path": "/user/hand/left/input/trigger", - "mode": "button", - "inputs": { - "click": { - "output": "/actions/global/in/leftTrigger" - } - } - }, - { - "path": "/user/hand/right/input/trigger", - "mode": "button", - "inputs": { - "click": { - "output": "/actions/global/in/rightTrigger" - } - } - }, - { - "path": "/user/hand/left/input/thumbstick", - "mode": "dpad_touch", - "parameters": { - "deadzone_pct": "85", - "overlap_pct": "0", - "sticky": "true" - }, - "inputs": { - "north": { - "output": "/actions/global/in/leftDPadUp" - }, - "south": { - "output": "/actions/global/in/leftDPadDown" - }, - "east": { - "output": "/actions/global/in/leftDPadRight" - }, - "west": { - "output": "/actions/global/in/leftDPadLeft" - } - } - }, - { - "path": "/user/hand/right/input/thumbstick", - "mode": "dpad_touch", - "parameters": { - "deadzone_pct": "85", - "overlap_pct": "0", - "sticky": "true" - }, - "inputs": { - "north": { - "output": "/actions/global/in/rightDPadUp" - }, - "south": { - "output": "/actions/global/in/rightDPadDown" - }, - "east": { - "output": "/actions/global/in/rightDPadRight" - }, - "west": { - "output": "/actions/global/in/rightDPadLeft" - } - } - }, - { - "path": "/user/hand/left/input/thumbstick", - "mode": "joystick", - "inputs": { - "position": { - "output": "/actions/global/in/leftThumbstick" - } - } - }, - { - "path": "/user/hand/right/input/thumbstick", - "mode": "joystick", - "inputs": { - "position": { - "output": "/actions/global/in/rightThumbstick" - } - } - } - ], - "poses": [ - { - "output": "/actions/global/in/leftHandPose", - "path": "/user/hand/left/pose/raw" - }, - { - "output": "/actions/global/in/rightHandPose", - "path": "/user/hand/right/pose/raw" - } - ], - "haptics": [ - { - "output": "/actions/global/out/leftHapticVibration", - "path": "/user/hand/left/output/haptic" - }, - { - "output": "/actions/global/out/rightHapticVibration", - "path": "/user/hand/right/output/haptic" - } - ], - "skeleton": [ - { - "output": "/actions/global/in/leftHandSkeleton", - "path": "/user/hand/left/input/skeleton/left" - }, - { - "output": "/actions/global/in/rightHandSkeleton", - "path": "/user/hand/right/input/skeleton/right" - } - ] - } - } -} \ No newline at end of file diff --git a/bin/data/openvr_bindings_knuckles.json b/bin/data/openvr_bindings_knuckles.json deleted file mode 100644 index 8abec4a3..00000000 --- a/bin/data/openvr_bindings_knuckles.json +++ /dev/null @@ -1,275 +0,0 @@ -{ - "controller_type" : "knuckles", - "description" : "Default Index Knuckles bindings", - "name" : "Knuckles Bindings", - "bindings": { - "/actions/global": { - "sources": [ - { - "path": "/user/hand/left/input/a", - "mode": "button", - "inputs": { - "click": { - "output": "/actions/global/in/a.left" - } - } - }, - { - "path": "/user/hand/right/input/a", - "mode": "button", - "inputs": { - "click": { - "output": "/actions/global/in/a.right" - } - } - }, - { - "path": "/user/hand/left/input/b", - "mode": "button", - "inputs": { - "click": { - "output": "/actions/global/in/b.left" - } - } - }, - { - "path": "/user/hand/right/input/b", - "mode": "button", - "inputs": { - "click": { - "output": "/actions/global/in/b.right" - } - } - }, - { - "path": "/user/hand/left/input/trackpad", - "mode": "trackpad", - "inputs": { - "position": { - "output": "/actions/global/in/trackpad.left" - }, - "touch": { - "output": "/actions/global/in/touchpad.left" - } - } - }, - { - "path": "/user/hand/right/input/trackpad", - "mode": "trackpad", - "inputs": { - "position": { - "output": "/actions/global/in/trackpad.right" - }, - "touch": { - "output": "/actions/global/in/touchpad.right" - } - } - }, - { - "path": "/user/hand/left/input/trackpad", - "mode": "button", - "inputs": { - "click": { - "output": "/actions/global/in/clickpad.left" - } - } - }, - { - "path": "/user/hand/right/input/trackpad", - "mode": "button", - "inputs": { - "click": { - "output": "/actions/global/in/clickpad.right" - } - } - }, - { - "path": "/user/hand/left/input/grip", - "mode": "force_sensor", - "inputs": { - "force": { - "output": "/actions/global/in/grip.left" - } - } - }, - { - "path": "/user/hand/right/input/grip", - "mode": "force_sensor", - "inputs": { - "force": { - "output": "/actions/global/in/grip.right" - } - } - }, - { - "path": "/user/hand/left/input/grip", - "mode": "grab", - "inputs": { - "grab": { - "output": "/actions/global/in/grab.left" - } - } - }, - { - "path": "/user/hand/right/input/grip", - "mode": "grab", - "inputs": { - "grab": { - "output": "/actions/global/in/grab.right" - } - } - }, - { - "path": "/user/hand/left/input/trigger", - "mode": "button", - "parameters": { - "haptic_amplitude": "0" - }, - "inputs": { - "click": { - "output": "/actions/global/in/click.left" - } - } - }, - { - "path": "/user/hand/right/input/trigger", - "mode": "button", - "parameters": { - "haptic_amplitude": "0" - }, - "inputs": { - "click": { - "output": "/actions/global/in/click.right" - } - } - }, - { - "path": "/user/hand/left/input/trigger", - "mode": "trigger", - "inputs": { - "click": { - "output": "/actions/global/in/trigger.left" - } - } - }, - { - "path": "/user/hand/right/input/trigger", - "mode": "trigger", - "inputs": { - "click": { - "output": "/actions/global/in/trigger.right" - } - } - }, - { - "path": "/user/hand/left/input/thumbstick", - "mode": "dpad_touch", - "parameters": { - "deadzone_pct": "85", - "overlap_pct": "0", - "sticky": "true" - }, - "inputs": { - "north": { - "output": "/actions/global/in/dpadUp.left" - }, - "south": { - "output": "/actions/global/in/dpadDown.left" - }, - "east": { - "output": "/actions/global/in/dpadRight.left" - }, - "west": { - "output": "/actions/global/in/dpadLeft.left" - } - } - }, - { - "path": "/user/hand/right/input/thumbstick", - "mode": "dpad_touch", - "parameters": { - "deadzone_pct": "85", - "overlap_pct": "0", - "sticky": "true" - }, - "inputs": { - "north": { - "output": "/actions/global/in/dpadUp.right" - }, - "south": { - "output": "/actions/global/in/dpadDown.right" - }, - "east": { - "output": "/actions/global/in/dpadRight.right" - }, - "west": { - "output": "/actions/global/in/dpadLeft.right" - } - } - }, - { - "path": "/user/hand/left/input/thumbstick", - "mode": "joystick", - "inputs": { - "position": { - "output": "/actions/global/in/thumbstick.left" - }, - "click": { - "output": "/actions/global/in/thumbclick.left" - } - } - }, - { - "path": "/user/hand/right/input/thumbstick", - "mode": "joystick", - "inputs": { - "position": { - "output": "/actions/global/in/thumbstick.right" - }, - "click": { - "output": "/actions/global/in/thumbclick.right" - } - } - } - ], - "poses": [ - { - "output": "/actions/global/in/handPose.left", - "path": "/user/hand/left/pose/raw" - }, - { - "output": "/actions/global/in/handPose.right", - "path": "/user/hand/right/pose/raw" - }, - { - "output": "/actions/global/in/handTip.left", - "path": "/user/hand/left/pose/tip" - }, - { - "output": "/actions/global/in/handTip.right", - "path": "/user/hand/right/pose/tip" - } - ], - "haptics": [ - { - "output": "/actions/global/out/hapticVibration.left", - "path": "/user/hand/left/output/haptic" - }, - { - "output": "/actions/global/out/hapticVibration.right", - "path": "/user/hand/right/output/haptic" - } - ], - "skeleton": [ - { - "output": "/actions/global/in/handSkeleton.left", - "path": "/user/hand/left/input/skeleton/left" - }, - { - "output": "/actions/global/in/handSkeleton.right", - "path": "/user/hand/right/input/skeleton/right" - } - ] - } - } -} \ No newline at end of file diff --git a/bin/data/openvr_manifest.json b/bin/data/openvr_manifest.json deleted file mode 100644 index 6e2ded5d..00000000 --- a/bin/data/openvr_manifest.json +++ /dev/null @@ -1,165 +0,0 @@ -{ - "default_bindings": [ - { - "controller_type": "knuckles", - "binding_url": "./openvr_bindings_knuckles.json" - } - ], - "actions": [ - { - "name": "/actions/global/in/a.left", - "type": "boolean" - }, - { - "name": "/actions/global/in/a.right", - "type": "boolean" - }, - { - "name": "/actions/global/in/b.left", - "type": "boolean" - }, - { - "name": "/actions/global/in/b.right", - "type": "boolean" - }, - { - "name": "/actions/global/in/trackpad.left", - "type": "vector2" - }, - { - "name": "/actions/global/in/touchpad.left", - "type": "vector2" - }, - { - "name": "/actions/global/in/trackpad.right", - "type": "vector2" - }, - { - "name": "/actions/global/in/touchpad.right", - "type": "vector2" - }, - { - "name": "/actions/global/in/clickpad.left", - "type": "boolean" - }, - { - "name": "/actions/global/in/clickpad.right", - "type": "boolean" - }, - { - "name": "/actions/global/in/grip.left", - "type": "vector1" - }, - { - "name": "/actions/global/in/grip.right", - "type": "vector1" - }, - { - "name": "/actions/global/in/grab.left", - "type": "boolean" - }, - { - "name": "/actions/global/in/grab.right", - "type": "boolean" - }, - { - "name": "/actions/global/in/click.left", - "type": "boolean" - }, - { - "name": "/actions/global/in/click.right", - "type": "boolean" - }, - { - "name": "/actions/global/in/trigger.left", - "type": "vector1" - }, - { - "name": "/actions/global/in/trigger.right", - "type": "vector1" - }, - { - "name": "/actions/global/in/dpadUp.left", - "type": "boolean" - }, - { - "name": "/actions/global/in/dpadDown.left", - "type": "boolean" - }, - { - "name": "/actions/global/in/dpadRight.left", - "type": "boolean" - }, - { - "name": "/actions/global/in/dpadLeft.left", - "type": "boolean" - }, - { - "name": "/actions/global/in/dpadUp.right", - "type": "boolean" - }, - { - "name": "/actions/global/in/dpadDown.right", - "type": "boolean" - }, - { - "name": "/actions/global/in/dpadRight.right", - "type": "boolean" - }, - { - "name": "/actions/global/in/dpadLeft.right", - "type": "boolean" - }, - { - "name": "/actions/global/in/thumbclick.left", - "type": "boolean" - }, - { - "name": "/actions/global/in/thumbclick.right", - "type": "boolean" - }, - { - "name": "/actions/global/in/thumbstick.left", - "type": "vector2" - }, - { - "name": "/actions/global/in/thumbstick.right", - "type": "vector2" - }, - { - "name": "/actions/global/in/handPose.left", - "type": "pose" - }, - { - "name": "/actions/global/in/handPose.right", - "type": "pose" - }, - { - "name": "/actions/global/in/handTip.left", - "type": "pose" - }, - { - "name": "/actions/global/in/handTip.right", - "type": "pose" - }, - { - "name": "/actions/global/out/hapticVibration.left", - "type": "vibration" - }, - { - "name": "/actions/global/out/hapticVibration.right", - "type": "vibration" - } - ], - "action_sets": [ - { - "name": "/actions/global", - "usage": "leftright" - } - ], - "localization" : [ - { - "language_tag": "en_us" - } - ] -} \ No newline at end of file diff --git a/bin/data/scenes/scene.json b/bin/data/scenes/scene.json deleted file mode 100644 index 5a3c92cd..00000000 --- a/bin/data/scenes/scene.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "name": "Scene", - "assets": [ - "/gui.json" - ], - "behaviors": [ - "SceneBehavior", - "ExtSceneBehavior" - ], - "system": { - "hot reload": { - "enabled": true - }, - "renderer": { - "clear values": [ - [ 0, 0, 0, 0 ] - ], - "shader": { - "mode": 0, - "scalar": 16, - "parameters": [ 0, 0, 0, "time" ] - } - } - }, - "metadata": { - // sky, and not skybox, so i can supply parameters for global lighting - "sky": { - // sky.box.filename, so i can add in additional parameters, for example, using it as a render target - "box": { - "filename": "/skybox/%d.png" - } - }, - "menus": { - "pause": "/gui/pause/menu.json" - }, - "light": { - "enabled": true, - - "ambient": [ 0.0, 0.0, 0.0 ], - // "ambient": [ 0.1, 0.1, 0.2 ], - - "exposure": 0.125, - "gamma": 2.2, - - "bloom": { - "threshold": 1.0, - "scale": 1.0, - "strength": 0.25, - "sigma": 1.0, - "samples": 4 - }, - "shadows": { - "enabled": true - } - }, - "noise": { - "size": [ 32, 32, 32 ] - } - } -} \ No newline at end of file diff --git a/bin/data/scenes/sm64/loading.json b/bin/data/scenes/sm64/loading.json deleted file mode 100644 index 2a86c7c5..00000000 --- a/bin/data/scenes/sm64/loading.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "Gui: Loading", - "type": "Object", - "behaviors": [ - // "GuiBehavior" - ], - "assets": [ - { "filename": "./sm64.json", "delay": 0 } - ], - "ignore": false, - "transform": { - "position": [ -0.830591, -0.699509, 0 ], - "rotation": { - "axis": [ 1, 0, 0 ], - "angle": 0 - }, - "scale": [ 0.258737, 0.115371, 1 ] - }, - "metadata": { - "uv": [ 0, 0, 1, 1 ], - "color": [ 1, 1, 1, 0.1 ], - "location": "", - "scaling": "relative", - "text settings": { - "stroke": [ 1, 0.749, 0.368, 1 ], - "color": [ 1, 0.749, 0.368, 1 ], - - "string": "Loading...", - "string1": "コマンド" - } - } -} \ No newline at end of file diff --git a/bin/data/scenes/sm64/player.json b/bin/data/scenes/sm64/player.json deleted file mode 100644 index f56e6fd8..00000000 --- a/bin/data/scenes/sm64/player.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "import": "/player.json", - "assets": [ - // { "filename": "/gui/hud/hud.json", "delay": 0 } - ], - "metadata": { - "movement": { - "jump": [0, 1, 0], - "floored": { - "feet": [ 0, 0, 0 ], - "floor": [ 0, -0.8, 0 ] - } - }, - "physics": { - "radius": 0.25, - "height": 0.25 - } - } -} \ No newline at end of file diff --git a/bin/data/scenes/sm64/scene.json b/bin/data/scenes/sm64/scene.json deleted file mode 100644 index 30226890..00000000 --- a/bin/data/scenes/sm64/scene.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "import": "/scene.json", - "assets": [ - // "./loading.json", - "./sm64.json" - ], - "metadata": { - "light": { - // "ambient": [ 0, 0, 0 ], - // "ambient": [ 0.025, 0.025, 0.025 ], - // "ambient": [ 0.075, 0.075, 0.075 ], - "ambient": [ 0.1, 0.1, 0.1 ], - // "ambient": [ 0.4, 0.4, 0.4 ], - // "ambient": [ 0.8, 0.8, 0.8 ], - - "fog-": { - - } - } - } -} \ No newline at end of file diff --git a/bin/data/scenes/sm64/sm64.json b/bin/data/scenes/sm64/sm64.json deleted file mode 100644 index 6ccfe8c8..00000000 --- a/bin/data/scenes/sm64/sm64.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "import": "/model.json", - "assets": [ - { "filename": "./models/sm64_bbb.glb" } - // { "filename": "./models/sm64_bbb/graph.json" } - ], - "metadata": { - "graph": { - "baking": { "enabled": true }, - "renderer": { - "cull mode": "none", - "filter": "nearest" - }, - "tags": { - "/^worldspawn/": { - "physics": { "type": "mesh", "static": true }, - "grid": { "size": [3,1,3], "epsilon": 1.0, "cleanup": true, "print": true }, - "optimize mesh": { "simplify": 0 }, - "unwrap mesh": true - }, - "info_player_spawn": { "action": "attach", "filename": "./player.json" }, - - "Material.071_574B138E_c.bmp": { "material": { "modeAlpha": "blend" } }, - "Material.070_41A41EE3_c.bmp": { "material": { "modeAlpha": "blend" } }, - - "light_sun": { "light": { "power": 25000000 } } - } - } - } -} \ No newline at end of file diff --git a/bin/data/scenes/sourceengine/base_sourceengine.json b/bin/data/scenes/sourceengine/base_sourceengine.json deleted file mode 100644 index 50e7d229..00000000 --- a/bin/data/scenes/sourceengine/base_sourceengine.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "import": "/model.json", - "metadata": { - "graph": { - // "renderer": { "separate": true }, - "baking": { "enabled": true }, - "tags": { - // exact matches - "worldspawn": { - "physics": { "type": "mesh", "static": true }, - "grid": { "size": [9,1,9], "epsilon": 1.0, "cleanup": true, "print": true }, - "unwrap mesh": true, - "optimize mesh": { "simplify": 0 } - }, - "worldspawn_skybox": { - "grid": { "size": [9,1,9], "epsilon": 1.0, "cleanup": true, "print": true }, - "unwrap mesh": true, - "optimize mesh": { "simplify": 0 } - }, - "info_player_spawn": { "action": "attach", "filename": "./player.json", "transform": { "orientation": [ 0, 1, 0, 0 ] } }, - "light_environment": { "transform": { "orientation": [0,0,0,1] }, "light": { - // "color": [0.1, 0.1, 0.1], - "power": 10000, - "global": true, - "bias": { - "constant": 1.25, - "slope": 1.75, - "shader": 0.000000000005 - }, - "radius": [8, 0], - "resolution": 1024 - } }, - // "/^light_[^e]/": { "ignore": true }, - - // regexp matches - "/^worldspawn_/": { "physics": { "type": "mesh", "static": true } }, - "/^func_door_/": { "action": "load", "payload": { "import": "/door.json", "metadata": { "angle":-1.570795, "normal": [-1,0,0] } } }, - "/^prop_door_/": { "action": "load", "payload": { "import": "/door.json", "metadata": { "angle":-1.570795, "normal": [-1,0,0] } } }, - "/^prop_static/": { /*"action": "load", "payload": { "import": "/prop.json", "metadata": { "physics": { "gravity": [ 0, 0, 0 ] } } }*/ }, - "/^prop_dynamic/": { /*"action": "load", "payload": { "import": "/prop.json", "metadata": { "physics": { "gravity": [ 0, 0, 0 ] } } }*/ }, - "/^func_physbox/": { "action": "load", "payload": { "import": "/prop.json" } }, - "/^prop_physics/": { "action": "load", "payload": { "import": "/prop.json" } }, - - "/^tools\\/toolsnodraw/": { "material": { "base": [ 1.0, 1.0, 1.0, 0.0 ] } } - } - } - } -} \ No newline at end of file diff --git a/bin/data/scenes/sourceengine/gm_construct.json b/bin/data/scenes/sourceengine/gm_construct.json deleted file mode 100644 index 2be4952e..00000000 --- a/bin/data/scenes/sourceengine/gm_construct.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "import": "./base_sourceengine.json", - "assets": [ - // { "filename": "./models/gm_construct.glb" } - { "filename": "./models/gm_construct/graph.json" } - ], - "metadata": { - "graph": { - "assets": [ - "./audio/soundscape/ambience.ogg" - ], - "tags": { - // exact matches - // "worldspawn_skybox": { "ignore": true }, - "worldspawn_water": {}, - - // regex matches - "/^gm_construct\\/water/": { "material": { - "base": [ 0.027, 0.227, 0.259, 0.5 ], - "fRoughness": 0.3, - "fAlphaCutoff": 0.5, - "modeAlpha": "blend" - } } - } - } - } -} \ No newline at end of file diff --git a/bin/data/scenes/sourceengine/loading.json b/bin/data/scenes/sourceengine/loading.json deleted file mode 100644 index 61eab28b..00000000 --- a/bin/data/scenes/sourceengine/loading.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "Gui: Loading", - "type": "Object", - "behaviors": [ - "GuiBehavior" - ], - "assets": [ - { "filename": "./sourceengine.json", "delay": 0 } - ], - "ignore": false, - "transform": { - "position": [ -0.830591, -0.699509, 0 ], - "rotation": { - "axis": [ 1, 0, 0 ], - "angle": 0 - }, - "scale": [ 0.258737, 0.115371, 1 ] - }, - "metadata": { - "uv": [ 0, 0, 1, 1 ], - "color": [ 1, 1, 1, 0.1 ], - "location": "", - "scaling": "relative", - "text settings": { - "stroke": [ 1, 0.749, 0.368, 1 ], - "color": [ 1, 0.749, 0.368, 1 ], - - "string": "Loading...", - "string1": "コマンド" - } - } -} \ No newline at end of file diff --git a/bin/data/scenes/sourceengine/mds_mcdonalds.json b/bin/data/scenes/sourceengine/mds_mcdonalds.json deleted file mode 100644 index 525f3a4d..00000000 --- a/bin/data/scenes/sourceengine/mds_mcdonalds.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "import": "./base_sourceengine.json", - "assets": [ - // { "filename": "./models/mds_mcdonalds.glb" } - { "filename": "./models/mds_mcdonalds/graph.json" }, - { "filename": "/burger.json", "delay": 1 } - ], - "metadata": { - "graph": { - "assets": [ - "./audio/soundscape/sh2_ambience.ogg" - ], - "tags": { - // exact matches - "func_door_rotating_5473": { "action": "load", "payload": { "import": "/door.json", "metadata": { "angle":-1.570795, "normal": [1,0,0] } } }, - "func_door_rotating_5509": { "action": "load", "payload": { "import": "/door.json", "metadata": { "angle":-1.570795, "normal": [1,0,0] } } }, - "func_door_rotating_5568": { "action": "load", "payload": { "import": "/door.json", "metadata": { "angle":-1.570795, "normal": [1,0,0] } } }, - "func_door_rotating_5584": { "action": "load", "payload": { "import": "/door.json", "metadata": { "angle":-1.570795, "normal": [1,0,0] } } }, - - // regex matches - // "/^prop_physics_override/": { "action": "load", "payload": { "import": "/prop.json", "metadata": { "physics": { "gravity": [ 0, 0, 0 ] } } } }, - // "/^prop_physics_[^o]/": { "action": "load", "payload": { "import": "/prop.json" } }, - - "/^tools\\/toolsnodraw/": { "material": { - "base": [ 1.0, 1.0, 1.0, 1.0 ], - "emissive": [ 0.0, 0.0, 0.0, 0.0 ], - "fMetallic": 0.0, - "fRoughness": 0.10000000149011612, - "fOcclusion": 1.0, - "fAlphaCutoff": 0.5, - "iAlbedo": 27, - "modeAlpha": 1 - } } - } - } - } -} \ No newline at end of file diff --git a/bin/data/scenes/sourceengine/player.json b/bin/data/scenes/sourceengine/player.json deleted file mode 100644 index b41da045..00000000 --- a/bin/data/scenes/sourceengine/player.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "import": "/player.json", - "assets": [ -// { "filename": "/gui/hud/hud.json", "delay": 0 } - ], - "transform": { - "orientation": [ 0, 1, 0, 0 ] - } -// "metadata": { "physics": { "gravity": [ 0, 0, 0 ] } } -} \ No newline at end of file diff --git a/bin/data/scenes/sourceengine/rp_downtown_v2.json b/bin/data/scenes/sourceengine/rp_downtown_v2.json deleted file mode 100644 index 8da0ecc6..00000000 --- a/bin/data/scenes/sourceengine/rp_downtown_v2.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "import": "./base_sourceengine.json", - "assets": [ - // { "filename": "./models/rp_downtown_v2.glb" } - { "filename": "./models/rp_downtown_v2/graph.json" } - ], - "metadata": { - "graph": { - "assets": [ - "./audio/soundscape/ambience.ogg" - ], - "renderer": { "separate": true }, - "tags": { - // exact matches - "worldspawn_skybox": { "ignore": true }, - - // regex matches - "/^light_/": { "ignore": true }, - "/^func/": { "ignore": true }, - "/^prop/": { "ignore": true } - } - } - } -} \ No newline at end of file diff --git a/bin/data/scenes/sourceengine/scene.json b/bin/data/scenes/sourceengine/scene.json deleted file mode 100644 index d8328c78..00000000 --- a/bin/data/scenes/sourceengine/scene.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "import": "/scene.json", - "assets": [ - "./sourceengine.json" - // { "filename": "./loading.json", "delay": 0.5 } - ], - "metadata": { - "light": { - "ambient": [ 0, 0, 0 ], - // "ambient": [ 0.05, 0.05, 0.05 ], - // "ambient": [ 0.15, 0.15, 0.15 ], - // "ambient": [ 0.5, 0.5, 0.5 ], - // "ambient": [ 0.8, 0.8, 0.8 ], - // "ambient": [ 0.1, 0.1, 0.2 ], - - "exposure": 0.125, - "gamma": 2.2, // 2.2, - - "bloom": { - "threshold": 1.2, - "scale": 1.0, - "strength": 1, - "sigma": 2.0, - "samples": 4 - }, - - "fog-": { - // "color": [ 0.1, 0.1, 0.1 ], - // "color": [ 0.2, 0.2, 0.2 ], - "color": [ 0.3, 0.3, 0.3 ], - "range": [ 64, 256 ], - "step scale": 4, - "absorbtion": 0.0125, - "density": { - "threshold": 0.35, - "multiplier": 2.0, - "scale": 25.0, - "offset": [0.2, 0, 1], - "timescale": 32 - } - } - } - } -} \ No newline at end of file diff --git a/bin/data/scenes/sourceengine/sh2_mcdonalds.json b/bin/data/scenes/sourceengine/sh2_mcdonalds.json deleted file mode 100644 index fd55500e..00000000 --- a/bin/data/scenes/sourceengine/sh2_mcdonalds.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "import": "./base_sourceengine.json", - "assets": [ - // { "filename": "./models/sh2_mcdonalds.glb" } - { "filename": "./models/sh2_mcdonalds/graph.json" } - ], - "metadata": { - "graph": { - "lights": { - "scale": 2 - }, - "assets": [ - "./audio/soundscape/sh2_ambience.ogg" - ], - "tags": { - // exact matches - /* - "worldspawn_sh2": { - "physics": { "type": "mesh", "static": true }, - "grid": { "size": [9,1,9], "epsilon": 1.0, "cleanup": true, "print": true }, - "unwrap mesh": true, - "optimize mesh": { "simplify": 0 } - }, - */ - "/^worldspawn_barrier$/": { "ignore": true }, - // "/^worldspawn_skybox/": { "ignore": true }, - - "func_door_rotating_5473": { "action": "load", "payload": { "import": "/door.json", "metadata": { "angle":-1.570795, "normal": [1,0,0] } } }, - "func_door_rotating_5509": { "action": "load", "payload": { "import": "/door.json", "metadata": { "angle":-1.570795, "normal": [1,0,0] } } }, - "func_door_rotating_5568": { "action": "load", "payload": { "import": "/door.json", "metadata": { "angle":-1.570795, "normal": [1,0,0] } } }, - "func_door_rotating_5584": { "action": "load", "payload": { "import": "/door.json", "metadata": { "angle":-1.570795, "normal": [1,0,0] } } }, - "func_door_rotating_9120": { "action": "load", "payload": { "import": "/door.json", "metadata": { "angle":-1.570795, "normal": [0,0,1] } } }, - - // regex matches - // "/^prop_physics_[^o]/": { "action": "load", "payload": { "import": "/prop.json" } }, - // "/^prop_physics_override/": { "action": "load", "payload": {} }, - // "/^prop_physics_/": { "action": "load", "payload": {} }, - // "/^func_physbox/": { "action": "load", "payload": {} }, - "/^.+?_phys.+?[^o]/": { "action": "load", "payload": { "import": "/prop.json" } }, - - "materials/models/props_wasteland/prison_lamp001a": { "material": { "emissive": [0, 0, 0, 0] } }, - "/^tools\\/toolsnodraw/": { "material": { - "base": [ 1.0, 1.0, 1.0, 1.0 ], - "emissive": [ 0.0, 0.0, 0.0, 0.0 ], - "fMetallic": 0.0, - "fRoughness": 0.10000000149011612, - "fOcclusion": 1.0, - "fAlphaCutoff": 0.5, - "iAlbedo": 27, - "modeAlpha": 1 - } }, - "/alpha_mtl/": { "material": { "modeAlpha": "blend" } } - } - } - } -} \ No newline at end of file diff --git a/bin/data/scenes/sourceengine/sourceengine.json b/bin/data/scenes/sourceengine/sourceengine.json deleted file mode 100644 index 74277413..00000000 --- a/bin/data/scenes/sourceengine/sourceengine.json +++ /dev/null @@ -1,7 +0,0 @@ -{ -// "import": "./rp_downtown_v2.json" - "import": "./ss2_medsci1.json" -// "import": "./sh2_mcdonalds.json" -// "import": "./mds_mcdonalds.json" -// "import": "./gm_construct.json" -} \ No newline at end of file diff --git a/bin/data/scenes/sourceengine/ss2_medsci1.json b/bin/data/scenes/sourceengine/ss2_medsci1.json deleted file mode 100644 index ad3c42a8..00000000 --- a/bin/data/scenes/sourceengine/ss2_medsci1.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "import": "./base_sourceengine.json", - "assets": [ - // { "filename": "./models/ss2_medsci1.glb" } - { "filename": "./models/ss2_medsci1/graph.json" } - ], - "metadata": { - "graph": { - "assets": [ - "./audio/music/medsci1.ogg" - ], - "tags": { - "/^prop_/": { "action": "load", "payload": { "import": "/prop.json", "metadata": { "physics": { "gravity": [ 0, 0, 0 ] } } } }, - "/^func_/": { "action": "load", "payload": { "import": "/prop.json", "metadata": { "physics": { "gravity": [ 0, 0, 0 ] } } } } - } - } - } -} \ No newline at end of file diff --git a/bin/data/scenes/ss2/ambience.json b/bin/data/scenes/ss2/ambience.json deleted file mode 100644 index 9724fb9e..00000000 --- a/bin/data/scenes/ss2/ambience.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "behaviors": [ "SoundEmitterBehavior" ], - "metadata": { - "audio": { - "spatial": true, - "loop": true, - "volume": 1, - "rolloffFactor": 1, - "streamed": true - } - } -} \ No newline at end of file diff --git a/bin/data/scenes/ss2/camera.json b/bin/data/scenes/ss2/camera.json deleted file mode 100644 index 20a35341..00000000 --- a/bin/data/scenes/ss2/camera.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "assets": [ - "./scripts/camera.lua", - "./audio/soundscape/camera.ogg" - ], - "metadata": { - "audio": { - "rolloffFactor": 4, - "volume": 1.0 - }, - "sensitivity": 10 - } -} \ No newline at end of file diff --git a/bin/data/scenes/ss2/craeture.json b/bin/data/scenes/ss2/craeture.json deleted file mode 100644 index 7c419973..00000000 --- a/bin/data/scenes/ss2/craeture.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "Craeture", - "behaviors": [ "CraetureBehavior" ], - "assets": [ - "./textures/craeture.png" - ], - "transform": { - "position": [18.3785, 2.41477, 0.859857], - "scale": [8, 8, 8] - }, - "metadata": { - "graph": { - "cull mode": "none" - } - } -} \ No newline at end of file diff --git a/bin/data/scenes/ss2/lift.json b/bin/data/scenes/ss2/lift.json deleted file mode 100644 index d94f0d54..00000000 --- a/bin/data/scenes/ss2/lift.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "assets": [ "./scripts/lift.lua" ], - "metadata": { - "physics": { - "type": "bounding box", - "recenter": true, - - "mass": 100, - "restitution": 0, - "friction": 1 - } - } -} \ No newline at end of file diff --git a/bin/data/scenes/ss2/loading.json b/bin/data/scenes/ss2/loading.json deleted file mode 100644 index 84c3288a..00000000 --- a/bin/data/scenes/ss2/loading.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "Gui: Loading", - "type": "Object", - "behaviors": [ - "GuiBehavior" - ], - "assets": [ - { "filename": "./medsci.json", "delay": 0 } - ], - "ignore": false, - "transform": { - "position": [ -0.830591, -0.699509, 0 ], - "rotation": { - "axis": [ 1, 0, 0 ], - "angle": 0 - }, - "scale": [ 0.258737, 0.115371, 1 ] - }, - "metadata": { - "uv": [ 0, 0, 1, 1 ], - "color": [ 1, 1, 1, 0.1 ], - "location": "", - "scaling": "relative", - "text settings": { - "stroke": [ 1, 0.749, 0.368, 1 ], - "color": [ 1, 0.749, 0.368, 1 ], - - "string": "Loading...", - "string1": "コマンド" - } - } -} \ No newline at end of file diff --git a/bin/data/scenes/ss2/medsci.json b/bin/data/scenes/ss2/medsci.json deleted file mode 100644 index 6c038f5f..00000000 --- a/bin/data/scenes/ss2/medsci.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "import": "/model.json", - "assets": [ - // { "filename": "./craeture.json", "delay": 1 }, - // { "filename": "./test.json", "delay": 1 }, - - // { "filename": "./models/tiny_msci.glb" } - // { "filename": "./models/tiny_msci/graph.json" } - - // { "filename": "./models/micro_sci.glb" } - // { "filename": "./models/micro_sci/graph.json" } - - // { "filename": "./models/msci.glb" } - { "filename": "./models/msci/graph.json" } - - // { "filename": "./models/medsci.glb" } - // { "filename": "./models/medsci/graph.json" } - ], - "metadata": { - "graph": { - "baking": { - "enabled": true, - "resolution": 2048 - }, - "renderer": { - "filter": "linear" - }, - "tags": { - "/^worldspawn/": { - "physics": { "type": "mesh", "static": true }, - "grid": { "size": [3,1,3], "epsilon": 0.0001, "cleanup": true, "print": true }, - "optimize mesh": { "simplify": 0 }, - "unwrap mesh": true - }, - "info_player_spawn": { - "action": "attach", - "filename": "./player.json" - }, - "ambience_xerxes": { "action": "load", "payload": { "import": "./ambience.json", "assets": [ "./audio/soundscape/xerxes.ogg" ], "metadata": { "audio": { "rolloffFactor": 0.5, "volume": 1.0 } } } }, - - "light_30145": { "light": { "power": 120 } }, - - "/^prop_camera_\\d+_light/": { /*"bake": false,*/ "light": { "shadows": false, "static": false, "dynamic": true, "power": 30 } }, - "/^prop_camera_\\d+$/": { /*"bake": false,*/ "action": "load", "payload": { "import": "./camera.json" } }, - - "func_movelinear_57637": { /*"bake": false,*/ "action": "load", "payload": { "import": "./lift.json", "metadata": { "delta": [ 0,8.6,0 ] } } }, - "func_movelinear_82820": { /*"bake": false,*/ "action": "load", "payload": { "import": "./lift.json", "metadata": { "delta": [ 0,9.2,0 ] } } }, - "func_movelinear_103114": { /*"bake": false,*/ "action": "load", "payload": { "import": "./lift.json", "metadata": { "delta": [ 0,-3.0,0 ] } } }, - - "/^func_door_/": { "action": "load", "payload": { "import": "/door.json", "metadata": { "angle":-1.570795, "normal": [-1,0,0] } } }, - "/^prop_door_/": { "action": "load", "payload": { "import": "/door.json", "metadata": { "angle":-1.570795, "normal": [-1,0,0] } } }, - - "/^prop_static/": { "action": "load", "payload": { "import": "/prop.json", "metadata": { "physics": { "gravity": [ 0, 0, 0 ] } } } }, - "/^func_physbox/": { "action": "load", "payload": { "import": "/prop.json" } }, - "/^prop_/": { "action": "load", "payload": { "import": "/prop.json" } } - } - } - } -} \ No newline at end of file diff --git a/bin/data/scenes/ss2/noise.json b/bin/data/scenes/ss2/noise.json deleted file mode 100644 index 446321ad..00000000 --- a/bin/data/scenes/ss2/noise.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "Test", - "assets": [], - "behaviors": [ - "RenderBehavior", - "NoiseBehavior" - ], - "transform": { - "position": [ 10, 4, 4 ], - "orientation": [0, 0, 0, 1] - }, - "metadata": { - "size": [ 256, 256, 256 ], - "coefficients": [ 3, 3, 3 ], - "amplitude": 1.5, - "speed": 0.125 - } -} \ No newline at end of file diff --git a/bin/data/scenes/ss2/player.json b/bin/data/scenes/ss2/player.json deleted file mode 100644 index 1c608815..00000000 --- a/bin/data/scenes/ss2/player.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "import": "/player.json", - "assets": [ -// { "filename": "/gui/hud/hud.json", "delay": 0 } - ], - "transform": { - "position": [ 0, 0, 0 ], - "rotation": { - "axis": [ 0, 1, 0 ], - "angle": 3.1415926 - }, - "scale": [ 1, 1, 1 ] - }, - "metadata": { - "movement": { - "floored": { - "feet": [ 0, -1.5, 0 ], - "floor": [ 0, -0.5, 0 ], - "print": false - } - } - } -} \ No newline at end of file diff --git a/bin/data/scenes/ss2/scene.json b/bin/data/scenes/ss2/scene.json deleted file mode 100644 index 0ff5dafe..00000000 --- a/bin/data/scenes/ss2/scene.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "import": "/scene.json", - "assets": [ - { "filename": "./audio/music/medsci1.ogg", "category": "audio-stream", "override": true, "streamed": true }, - // "./loading.json" - "./medsci.json" - ], - "metadata": { - "light": { - // "ambient": [1.0,1.0,1.0 ], - "ambient": [ 0.1, 0.1, 0.2 ], - - "fog": { - "color": [ 0.025, 0.025, 0.1 ], - "step scale": 0.0, - "range": [ 1, 1 ], - "absorbtion": 0.85, - "density": { - "threshold": 0.5, - "multiplier": 5.0, - "scale": 50.0, - "offset": "time" - } - } - } - } -} \ No newline at end of file diff --git a/bin/data/scenes/ss2/scripts/camera.lua b/bin/data/scenes/ss2/scripts/camera.lua deleted file mode 100644 index 92808e7c..00000000 --- a/bin/data/scenes/ss2/scripts/camera.lua +++ /dev/null @@ -1,194 +0,0 @@ -local ent = ent -local scene = entities.currentScene() -local controller = entities.controller() -local controllerTransform = controller:getComponent("Transform") -local timer = Timer.new() -if not timer:running() then timer:start() end - -local metadata = ent:getComponent("Metadata") -local transform = ent:getComponent("Transform") -local physicsState = ent:getComponent("PhysicsState") - -local soundEmitter = ent --ent:loadChild("/sound.json",true) -local playSound = function( key ) - if not loop then loop = false end - local url = "./audio/sfx/" .. key .. ".ogg" - soundEmitter:queueHook("sound:Emit.%UID%", { - filename = string.resolveURI(url, metadata["system"]["root"]), - spatial = true, - loop = loop, - volume = "sfx", - streamed = true - }, 0) -end -local playSoundscape = function( key ) - local url = "./audio/soundscape/" .. key .. ".ogg" - soundEmitter:queueHook("sound:Emit.%UID%", { - filename = string.resolveURI(url, metadata["system"]["root"]), - spatial = false, - volume = "sfx", - loop = true, - streamed = true - }, 0) -end -local stopSoundscape = function( key ) - local url = "./audio/soundscape/" .. key .. ".ogg" - soundEmitter:queueHook("sound:Stop.%UID%", { - filename = string.resolveURI(url, metadata["system"]["root"]) - }, 0) -end - -local target = Vector3f(0,0,0) -local speed = metadata["speed"] or 1.0 / 3.0 -local angle = metadata["angle"] or 1.5 -transform.orientation = Quaternion.axisAngle( Vector3f(0,1,0), 1.5 ) -local starting = transform.orientation:multiply(Quaternion.axisAngle( Vector3f(0,1,0), -angle )) -local ending = transform.orientation:multiply(Quaternion.axisAngle( Vector3f(0,1,0), angle )) --- on tick -local delta = 0 -local watch = 0 -local alerted = false -local light = nil -local lightOffset = nil - -for k, v in pairs(ent:getChildren()) do - if v:uid() ~= soundEmitter:uid() then - light = v - local transform = v:getComponent("Transform") - lightOffset = Vector3f(transform.position) --:magnitude() - end -end - -ent:bind( "tick", function(self) - soundEmitter:getComponent("Transform").position = transform.position - - local angleThreshold = metadata["sensitivity"] or 20 - - local lightTransform = light and light:getComponent("Transform") or nil - local lightMetadata = light and light:getComponent("Metadata") or {} - if lightTransform ~= nil then - lightTransform.position = transform.orientation:rotate( lightOffset ); - if lightMetadata and lightMetadata["light"] and lightMetadata["light"]["static"] then - lightTransform.position = lightTransform.position + transform.position - end - end - - local controllerPosition = Vector3f(controllerTransform.position.x, 0, controllerTransform.position.z) - local cameraPosition = Vector3f(transform.position.x, 0, transform.position.z) - local distance = cameraPosition:distance(controllerPosition) - local direction = cameraPosition - controllerPosition - local angle = math.acos(transform.orientation:rotate( Vector3f(0,0,1):normalize() ):dot( direction:normalize() )) * 180.0 / 3.1415926 - if angle < angleThreshold and distance < 16 then - if watch == 0 then - watch = 6 - playSound("camera_see") - if light then - light:callHook( "object:UpdateMetadata.%UID%", { - path = "light.color", - value = { - [1] = 1, - [2] = 1, - [3] = 0 - } - } ) - end - end - watch = watch + time.delta() - if watch > 12 and not alerted then - playSound("camera_alert") - playSound("xerxes_alert") - playSoundscape("alarm") - alerted = true - timer:reset() - if light then - light:callHook( "object:UpdateMetadata.%UID%", { - path = "light.color", - value = { - [1] = 1, - [2] = 0, - [3] = 0 - } - } ) - light:callHook( "object:UpdateMetadata.%UID%", { - path = "light.fade", - value = { - rate = 1, - power = 0.01, - timeout= 0.5 - } - } ) - end - end - else - if watch > 0 and not alerted then - watch = watch - time.delta() - if watch < 0 then - io.print("CAMERA LOST") - watch = 0 - speed = metadata["speed"] or 1.0 / 3.0 - if light then - light:callHook( "object:UpdateMetadata.%UID%", { - path = "light.color", - value = { - [1] = 0, - [2] = 1, - [3] = 0 - } - } ) - light:callHook( "object:UpdateMetadata.%UID%", { - path = "light.fade", - value = nil - } ) - end - end - end - end - if not alerted and watch > 0 and light then - light:callHook( "object:UpdateMetadata.%UID%", { - path = "light.fade.rate", - value = math.floor(watch / 2), - } ) - light:callHook( "object:UpdateMetadata.%UID%", { - path = "light.fade.power", - value = 0.01, - } ) - light:callHook( "object:UpdateMetadata.%UID%", { - path = "light.fade.timeout", - value = 0.5, - } ) - end - if alerted and timer:elapsed() >= 60 then - timer:reset() - alerted = false - watch = 0 - io.print("ALERT OVER") - playSound("camera_lost") - stopSoundscape("alarm"); - if light then - light:callHook( "object:UpdateMetadata.%UID%", { - path = "light.color", - value = { - [1] = 0, - [2] = 1, - [3] = 0 - } - } ) - light:callHook( "object:UpdateMetadata.%UID%", { - path = "light.fade", - value = nil - } ) - end - end - - delta = delta + time.delta() * speed - local nextRotation = starting:slerp( ending, math.cos(delta) * 0.5 + 0.5 ) ---[[ - -- stop if we are going to look away from player - local angleNext = math.acos(nextRotation:rotate( Vector3f(0,0,1):normalize() ):dot( direction:normalize() )) * 180.0 / 3.1415926 - if watch > 0 and angleNext > angle then - delta = delta - time.delta() * speed * 3 - nextRotation = starting:slerp( ending, math.cos(delta) * 0.5 + 0.5 ) - end -]] - transform.orientation = nextRotation -end ) \ No newline at end of file diff --git a/bin/data/scenes/ss2/scripts/lift.lua b/bin/data/scenes/ss2/scripts/lift.lua deleted file mode 100644 index 437833ed..00000000 --- a/bin/data/scenes/ss2/scripts/lift.lua +++ /dev/null @@ -1,82 +0,0 @@ -local ent = ent -local scene = entities.currentScene() -local controller = entities.controller() - -local timer = Timer.new() -if not timer:running() then - timer:start(); -end - -local target = Vector3f(0,0,0) -local transform = ent:getComponent("Transform") -local metadata = ent:getComponent("Metadata") -local physics = ent:getComponent("Physics") --- local velocty = physics:linearVelocity() -local speed = metadata["speed"] or 1.0 -local starting = transform.position + Vector3f(0,0,0) -local ending = transform.position + Vector3f( metadata["delta"][1], metadata["delta"][2], metadata["delta"][3] ) -local wait = 0 -local direction = 1.0 / math.abs(starting:distance(ending)) -local alpha = 0 -local startingSound = true - -local soundEmitter = ent:loadChild("/sound.json",true) -local playSound = function( key, loop ) - if not loop then loop = false end - local url = "./audio/sfx/" .. key .. ".ogg" - soundEmitter:queueHook("sound:Emit.%UID%", { - filename = string.resolveURI(url, metadata["system"]["root"]), - spatial = true, - streamed = true, - volume = "sfx", - loop = loop - }, 0) -end -local stopSound = function( key ) - local url = "./audio/sfx/" .. key .. ".ogg" - soundEmitter:queueHook("sound:Stop.%UID%", { - filename = string.resolveURI(url, metadata["system"]["root"]) - }, 0) -end -local playSoundscape = function( key ) - local url = "./audio/soundscape/" .. key .. ".ogg" - soundEmitter:queueHook("sound:Emit.%UID%", { - filename = string.resolveURI(url, metadata["system"]["root"]), - spatial = false, - volume = "sfx", - loop = true, - streamed = true - }, 0) -end -local stopSoundscape = function( key ) - local url = "./audio/soundscape/" .. key .. ".ogg" - soundEmitter:queueHook("sound:Stop.%UID%", { - filename = string.resolveURI(url, metadata["system"]["root"]) - }, 0) -end -soundEmitter:getComponent("Transform"):setReference( transform ) --- on tick -ent:bind( "tick", function(self) - - if wait > 0 then - wait = wait - time.delta() - else - if startingSound then - playSound("lift_start", true) - startingSound = false - end - alpha = alpha + time.delta() * speed * direction - if alpha <= 0 or alpha >= 1 then - alpha = math.clamp( alpha, 0.0, 1.0 ) - direction = -direction - wait = 6 - stopSound("lift_start") - playSound("lift_stop") - startingSound = true - -- physics:setLinearVelocity( Vector3f(0,0,0) ) - else - -- physics:setLinearVelocity( Vector3f(0,direction / math.abs(direction),0) ) - end - end - transform.position = Vector3f.lerp( starting, ending, alpha ) -end ) \ No newline at end of file diff --git a/bin/data/scenes/ss2/test.json b/bin/data/scenes/ss2/test.json deleted file mode 100644 index 4d6bc3a7..00000000 --- a/bin/data/scenes/ss2/test.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "Gui: Text Test", - "type": "Gui", - "ignore": false, - "transform": { - "position": [18.3785, 2.41477, 0.859857], - "rotation": { - "axis": [ 0, 0, 1 ], - "angle": 3.141 - }, - "scale": [ 1, 1, 1 ] - }, - "metadata": { - "uv": [ 0, 0, 1, 1 ], - "location": "", - "scaling": "relative", - "world": true, - "cull mode": "none", - "color": [ 1, 0, 1, 1 ], - "text settings": { - "scale": 8, - "font": "Coolvetica.ttf", - "string": "Grimgram" - } - } -} \ No newline at end of file diff --git a/bin/data/scenes/startmenu/player.json b/bin/data/scenes/startmenu/player.json deleted file mode 100644 index 255c5ff8..00000000 --- a/bin/data/scenes/startmenu/player.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "import": "/player.json", - "assets": [ - { "filename": "/hands.json", "delay": 0 } - ], - "system": { - "physics": { - "gravity": [ 0, 0, 0 ], - "clamp": { - "x": [0, 0], - "y": [0, 0], - "z": [0, 0] - } - } - } -} \ No newline at end of file diff --git a/bin/data/scenes/startmenu/scene.json b/bin/data/scenes/startmenu/scene.json deleted file mode 100644 index ec98cb20..00000000 --- a/bin/data/scenes/startmenu/scene.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "type": "Main Menu", - "behaviors": [ - "SceneBehavior", - "ExtSceneBehavior" - ], - "assets": [ - "/gui.json", - "/ui/main menu.ogg", - "/gui/mainmenu/menu.json" - ], - "metadata": { - "volumes": { - "sfx": 0.25, - "bgm": 0.15, - "voice": 1.0 - } - } -} \ No newline at end of file diff --git a/bin/data/scripts/json.lua b/bin/data/scripts/json.lua deleted file mode 100644 index a9f78820..00000000 --- a/bin/data/scripts/json.lua +++ /dev/null @@ -1,389 +0,0 @@ --- --- json.lua --- --- Copyright (c) 2020 rxi --- --- Permission is hereby granted, free of charge, to any person obtaining a copy of --- this software and associated documentation files (the "Software"), to deal in --- the Software without restriction, including without limitation the rights to --- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies --- of the Software, and to permit persons to whom the Software is furnished to do --- so, subject to the following conditions: --- --- The above copyright notice and this permission notice shall be included in all --- copies or substantial portions of the Software. --- --- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR --- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, --- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE --- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER --- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, --- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE --- SOFTWARE. --- - -local json = { _version = "0.1.2" } - -------------------------------------------------------------------------------- --- Encode -------------------------------------------------------------------------------- - -local encode - -local escape_char_map = { - [ "\\" ] = "\\", - [ "\"" ] = "\"", - [ "\b" ] = "b", - [ "\f" ] = "f", - [ "\n" ] = "n", - [ "\r" ] = "r", - [ "\t" ] = "t", -} - -local escape_char_map_inv = { [ "/" ] = "/" } -for k, v in pairs(escape_char_map) do - escape_char_map_inv[v] = k -end - - -local function escape_char(c) - return "\\" .. (escape_char_map[c] or string.format("u%04x", c:byte())) -end - - -local function encode_nil(val) - return "null" -end - - -local function encode_table(val, stack) - local res = {} - stack = stack or {} - - -- Circular reference? - if stack[val] then error("circular reference") end - - stack[val] = true - - if rawget(val, 1) ~= nil or next(val) == nil then - -- Treat as array -- check keys are valid and it is not sparse - local n = 0 - for k in pairs(val) do - if type(k) ~= "number" then - error("invalid table: mixed or invalid key types") - end - n = n + 1 - end - if n ~= #val then - error("invalid table: sparse array") - end - -- Encode - for i, v in ipairs(val) do - table.insert(res, encode(v, stack)) - end - stack[val] = nil - return #res == 0 and "{}" or "[" .. table.concat(res, ",") .. "]" --- return "[" .. table.concat(res, ",") .. "]" - - else - -- Treat as an object - for k, v in pairs(val) do - if type(k) ~= "string" then - error("invalid table: mixed or invalid key types") - end - table.insert(res, encode(k, stack) .. ":" .. encode(v, stack)) - end - stack[val] = nil - return "{" .. table.concat(res, ",") .. "}" - end -end - - -local function encode_string(val) - return '"' .. val:gsub('[%z\1-\31\\"]', escape_char) .. '"' -end - - -local function encode_number(val) - -- Check for NaN, -inf and inf - if val ~= val or val <= -math.huge or val >= math.huge then - error("unexpected number value '" .. tostring(val) .. "'") - end - return string.format("%.14g", val) -end - - -local type_func_map = { - [ "nil" ] = encode_nil, - [ "table" ] = encode_table, - [ "string" ] = encode_string, - [ "number" ] = encode_number, - [ "boolean" ] = tostring, -} - - -encode = function(val, stack) - local t = type(val) - local f = type_func_map[t] - if f then - return f(val, stack) - end - error("unexpected type '" .. t .. "'") -end - - -function json.encode(val) - return ( encode(val) ) -end - - -------------------------------------------------------------------------------- --- Decode -------------------------------------------------------------------------------- - -local parse - -local function create_set(...) - local res = {} - for i = 1, select("#", ...) do - res[ select(i, ...) ] = true - end - return res -end - -local space_chars = create_set(" ", "\t", "\r", "\n") -local delim_chars = create_set(" ", "\t", "\r", "\n", "]", "}", ",") -local escape_chars = create_set("\\", "/", '"', "b", "f", "n", "r", "t", "u") -local literals = create_set("true", "false", "null") - -local literal_map = { - [ "true" ] = true, - [ "false" ] = false, - [ "null" ] = nil, -} - - -local function next_char(str, idx, set, negate) - for i = idx, #str do - if set[str:sub(i, i)] ~= negate then - return i - end - end - return #str + 1 -end - - -local function decode_error(str, idx, msg) - local line_count = 1 - local col_count = 1 - for i = 1, idx - 1 do - col_count = col_count + 1 - if str:sub(i, i) == "\n" then - line_count = line_count + 1 - col_count = 1 - end - end - error( string.format("%s at line %d col %d", msg, line_count, col_count) ) -end - - -local function codepoint_to_utf8(n) - -- http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=iws-appendixa - local f = math.floor - if n <= 0x7f then - return string.char(n) - elseif n <= 0x7ff then - return string.char(f(n / 64) + 192, n % 64 + 128) - elseif n <= 0xffff then - return string.char(f(n / 4096) + 224, f(n % 4096 / 64) + 128, n % 64 + 128) - elseif n <= 0x10ffff then - return string.char(f(n / 262144) + 240, f(n % 262144 / 4096) + 128, - f(n % 4096 / 64) + 128, n % 64 + 128) - end - error( string.format("invalid unicode codepoint '%x'", n) ) -end - - -local function parse_unicode_escape(s) - local n1 = tonumber( s:sub(1, 4), 16 ) - local n2 = tonumber( s:sub(7, 10), 16 ) - -- Surrogate pair? - if n2 then - return codepoint_to_utf8((n1 - 0xd800) * 0x400 + (n2 - 0xdc00) + 0x10000) - else - return codepoint_to_utf8(n1) - end -end - - -local function parse_string(str, i) - local res = "" - local j = i + 1 - local k = j - - while j <= #str do - local x = str:byte(j) - - if x < 32 then - decode_error(str, j, "control character in string") - - elseif x == 92 then -- `\`: Escape - res = res .. str:sub(k, j - 1) - j = j + 1 - local c = str:sub(j, j) - if c == "u" then - local hex = str:match("^[dD][89aAbB]%x%x\\u%x%x%x%x", j + 1) - or str:match("^%x%x%x%x", j + 1) - or decode_error(str, j - 1, "invalid unicode escape in string") - res = res .. parse_unicode_escape(hex) - j = j + #hex - else - if not escape_chars[c] then - decode_error(str, j - 1, "invalid escape char '" .. c .. "' in string") - end - res = res .. escape_char_map_inv[c] - end - k = j + 1 - - elseif x == 34 then -- `"`: End of string - res = res .. str:sub(k, j - 1) - return res, j + 1 - end - - j = j + 1 - end - - decode_error(str, i, "expected closing quote for string") -end - - -local function parse_number(str, i) - local x = next_char(str, i, delim_chars) - local s = str:sub(i, x - 1) - local n = tonumber(s) - if not n then - decode_error(str, i, "invalid number '" .. s .. "'") - end - return n, x -end - - -local function parse_literal(str, i) - local x = next_char(str, i, delim_chars) - local word = str:sub(i, x - 1) - if not literals[word] then - decode_error(str, i, "invalid literal '" .. word .. "'") - end - return literal_map[word], x -end - - -local function parse_array(str, i) - local res = {} - local n = 1 - i = i + 1 - while 1 do - local x - i = next_char(str, i, space_chars, true) - -- Empty / end of array? - if str:sub(i, i) == "]" then - i = i + 1 - break - end - -- Read token - x, i = parse(str, i) - res[n] = x - n = n + 1 - -- Next token - i = next_char(str, i, space_chars, true) - local chr = str:sub(i, i) - i = i + 1 - if chr == "]" then break end - if chr ~= "," then decode_error(str, i, "expected ']' or ','") end - end - return res, i -end - - -local function parse_object(str, i) - local res = {} - i = i + 1 - while 1 do - local key, val - i = next_char(str, i, space_chars, true) - -- Empty / end of object? - if str:sub(i, i) == "}" then - i = i + 1 - break - end - -- Read key - if str:sub(i, i) ~= '"' then - decode_error(str, i, "expected string for key") - end - key, i = parse(str, i) - -- Read ':' delimiter - i = next_char(str, i, space_chars, true) - if str:sub(i, i) ~= ":" then - decode_error(str, i, "expected ':' after key") - end - i = next_char(str, i + 1, space_chars, true) - -- Read value - val, i = parse(str, i) - -- Set - res[key] = val - -- Next token - i = next_char(str, i, space_chars, true) - local chr = str:sub(i, i) - i = i + 1 - if chr == "}" then break end - if chr ~= "," then decode_error(str, i, "expected '}' or ','") end - end - return res, i -end - - -local char_func_map = { - [ '"' ] = parse_string, - [ "0" ] = parse_number, - [ "1" ] = parse_number, - [ "2" ] = parse_number, - [ "3" ] = parse_number, - [ "4" ] = parse_number, - [ "5" ] = parse_number, - [ "6" ] = parse_number, - [ "7" ] = parse_number, - [ "8" ] = parse_number, - [ "9" ] = parse_number, - [ "-" ] = parse_number, - [ "t" ] = parse_literal, - [ "f" ] = parse_literal, - [ "n" ] = parse_literal, - [ "[" ] = parse_array, - [ "{" ] = parse_object, -} - - -parse = function(str, idx) - local chr = str:sub(idx, idx) - local f = char_func_map[chr] - if f then - return f(str, idx) - end - decode_error(str, idx, "unexpected character '" .. chr .. "'") -end - - -function json.decode(str) - if type(str) ~= "string" then - error("expected argument of type string, got " .. type(str)) - end - local res, idx = parse(str, next_char(str, 1, space_chars, true)) - idx = next_char(str, idx, space_chars, true) - if idx <= #str then - decode_error(str, idx, "trailing garbage") - end - return res -end - - -return json \ No newline at end of file diff --git a/bin/data/scripts/main.lua b/bin/data/scripts/main.lua deleted file mode 100644 index b5ce3b8f..00000000 --- a/bin/data/scripts/main.lua +++ /dev/null @@ -1,2 +0,0 @@ -local orientation = Quaternion() -print( orientation, orientation.x ) \ No newline at end of file diff --git a/bin/data/shaders/common/functions.h b/bin/data/shaders/common/functions.h index b26313eb..2885b7ff 100644 --- a/bin/data/shaders/common/functions.h +++ b/bin/data/shaders/common/functions.h @@ -251,7 +251,7 @@ void populateSurfaceMaterial() { } // Lightmap if ( (/*surface.subID++ > 0 ||*/ bool(ubo.settings.lighting.useLightmaps)) && validTextureIndex( surface.instance.lightmapID ) ) { - vec4 light = sampleTexture( surface.instance.lightmapID, surface.st ); + vec4 light = sampleTexture( surface.instance.lightmapID, surface.st.xy, 0 ); /*surface.material.lightmapped = light.a > 0.000000001; if ( surface.material.lightmapped )*/ surface.light += surface.material.albedo * light; } else { diff --git a/bin/data/shaders/graph/baking/frag.h b/bin/data/shaders/graph/baking/frag.h index 0abc2c25..9fa63061 100644 --- a/bin/data/shaders/graph/baking/frag.h +++ b/bin/data/shaders/graph/baking/frag.h @@ -103,6 +103,17 @@ void main() { const uint drawID = uint(inId.y); const uint instanceID = uint(inId.z); +/* + surface.pass = 0; // PushConstant.pass; + surface.fragment = vec4(0); + surface.light = vec4(0); + surface.motion = vec2(0); + surface.material.indirect = vec4(0); + surface.material.metallic = 1; + surface.material.roughness = 0; + surface.material.occlusion = 0; +*/ + if ( instanceID != ubo.currentID ) discard; surface.uv.xy = wrap(inUv.xy); diff --git a/bin/dreamcast/config.json b/bin/dreamcast/config.json index c674c0b2..7d9b86bc 100644 --- a/bin/dreamcast/config.json +++ b/bin/dreamcast/config.json @@ -1,18 +1,25 @@ { "engine": { "scenes": { - "start": "SS2", + "start": "StartMenu", + "matrix": { "reverseInfinite": true }, "meshes": { "interleaved": false }, - "matrix": { "reverseInfinite": false }, - "lights": { "enabled": false, + "lights": { "enabled": true, "useLightmaps": true, - "max": 1 - }, - "shadows": { - "enabled": false, - "update": 2, - "max": 8, - "samples": 1 + "max": 1, + "shadows": { + "enabled": false, + "update": 4, + "max": 8, + "samples": 4 + }, + "bloom": { + "scale": 1.0, + "strength": 0.125, + "sigma": 0.8, + "samples": 5, + "threshold": 1.0 + } }, "textures": { "max": { @@ -22,6 +29,9 @@ } } }, + "graph": { + "initial buffer elements": 128 + }, "ext": { "opengl": { "validation": { "enabled": false }, @@ -52,26 +62,49 @@ "encoding": "msgpack", "compression": "gz" }, + "imgui": { + "enabled": false + }, + "fsr": { + "enabled": true, + "sharpness": 1, + "jitter scale": 0.0625, + "preset": "native" // native (1x), quality (1.5x), balanced (1.7x), performance (2.0x), ultra (3.0x) + }, "reactphysics": { "timescale": 0.01666666666, "interpolate": false, + "gravity": { + "mode": "per-object", // "universal", + "constant": 6.67408e-11 + }, "debug draw": { "enabled": false, + "line width": 8, // "layer": "Gui", "rate": 0.0125 } - } + }, + "vr" : { + "enable" : false, + "manifest": "./data/openvr_manifest.json", + "swap eyes": false, + "dominant eye": 0, + "scale": 1.0 + }, + "ultralight": { "enabled": true, "scale": 1.5 }, + "discord": { "enabled": false } }, "audio": { - "mute": true, + "mute": false, "buffers": { - "size": 16384, - "count": 3 + "size": 24576, + "count": 6 }, "volumes": { - "sfx": 1.0, - "bgm": 1.0, - "voice": 1.0 + "sfx": 2.0, + "bgm": 2.0, + "voice": 2.0 }, "streams by default": true }, @@ -93,13 +126,13 @@ "framerate": 60 }, "threads": { - "workers" : 1, // "auto", - "frame limiter": "auto" + "workers" : 1, + "frame limiter": 0 // "auto" }, "debug": { "framerate": { "print": true, - "every": 1 + "every": 2 }, "garbage collection": { "enabled": true, @@ -111,8 +144,18 @@ "delete children on destroy": false, "delete components on destroy": false }, + "userdata": { + "auto destruct": true, + "auto validate": false + }, "loader": { "assert": true + }, + "hooks": { + "defer lazy calls": true + }, + "scene": { + "print task calls": false } } }, @@ -124,16 +167,15 @@ "keyboard" : { "repeat" : false }, - "cursor" : { + "mouse" : { "visible" : true, "center" : false, - "sensitivity": [ 1.25, 1.25 ], - "smoothing": [ 10, 10 ] + "sensitivity": [ 2, 2 ], + "smoothing": [ 4, 4 ] }, - "mode" : "windowed", + "mode" : "windowed", // fullscreen, borderless, windowed "icon" : "./data/textures/icon.png", "size" : [ 640, 480 ], - // "size" : [ 320, 240 ], "title" : "Grimgram", "visible" : true } diff --git a/client/main.cpp b/client/main.cpp index 344711c2..ec074d4c 100644 --- a/client/main.cpp +++ b/client/main.cpp @@ -40,28 +40,30 @@ namespace { UF_MSG_ERROR("Abort detected"); #if UF_ENV_DREAMCAST arch_stk_trace(1); - #endif - + exit(); + #else if ( ::killing ) { std::_Exit(0); } else if ( !client::terminated ) { ::killing = true; exit(); } + #endif } void segv( int sig ) { UF_MSG_ERROR("Segfault detected"); #if UF_ENV_DREAMCAST arch_stk_trace(1); - #endif - + exit(); + #else if ( ::killing ) { std::_Exit(0); } else if ( !client::terminated ) { ::killing = true; exit(); } + #endif } } } diff --git a/engine/inc/uf/ext/lua/lua.h b/engine/inc/uf/ext/lua/lua.h index fee682c9..04a2d3d0 100644 --- a/engine/inc/uf/ext/lua/lua.h +++ b/engine/inc/uf/ext/lua/lua.h @@ -2,12 +2,10 @@ #include #if UF_USE_LUA - #if UF_USE_LUAJIT - #define SOL_LUAJIT 1 -// #define SOL_USING_CXX_LUA_JIT 1 - #else -// #define SOL_USING_CXX_LUA 1 - #endif + +#if UF_USE_LUAJIT + #define SOL_LUAJIT 1 +#endif #define SOL_NO_EXCEPTIONS 1 #if UF_ENV_DREAMCAST #define SOL_NO_THREAD_LOCAL 1 diff --git a/engine/inc/uf/ext/opengl/commands.h b/engine/inc/uf/ext/opengl/commands.h index b6dcf051..fb36ca31 100644 --- a/engine/inc/uf/ext/opengl/commands.h +++ b/engine/inc/uf/ext/opengl/commands.h @@ -71,23 +71,11 @@ namespace ext { uint8_t modeAlpha{}; float alphaCutoff = 0.001f; } blend; - /* - GraphicDescriptor descriptor = {}; - ext::opengl::Buffer::Descriptor vertexBuffer = {}; - ext::opengl::Buffer::Descriptor indexBuffer = {}; - ext::opengl::Buffer::Descriptor indirectBuffer = {}; - ext::opengl::Buffer::Descriptor uniformBuffer = {}; - ext::opengl::Texture::Descriptor texture = {}; - ext::opengl::Texture::Descriptor auxTexture = {}; struct { - uint8_t position = 0; - uint8_t uv = 0; - uint8_t st = 0; - uint8_t normal = 0; - uint8_t color = 0; - } attributes; - */ + bool enabled = false; + pod::Vector4f value = { 1, 1, 1, 1 }; + } color; }; /* struct UF_API InfoBuffer : public Info { diff --git a/engine/inc/uf/ext/opengl/ogl.h b/engine/inc/uf/ext/opengl/ogl.h index dcc25857..b59df5d5 100644 --- a/engine/inc/uf/ext/opengl/ogl.h +++ b/engine/inc/uf/ext/opengl/ogl.h @@ -58,7 +58,7 @@ #define UF_USE_OPENGL_IMMEDIATE_MODE 0 #define GL_DEBUG_MESSAGE(...) UF_MSG_ERROR(__VA_ARGS__); -#define GL_VALIDATION_MESSAGE(...) if ( ext::opengl::settings::validation ) GL_DEBUG_MESSAGE(__VA_ARGS__); +#define GL_VALIDATION_MESSAGE(...) if ( ext::opengl::settings::validation::enabled ) GL_DEBUG_MESSAGE(__VA_ARGS__); #if UF_ENV_DREAMCAST #define GL_VALIDATION_ENABLED 0 @@ -69,7 +69,7 @@ #if GL_VALIDATION_ENABLED #define GL_ERROR_CHECK(f) { \ {f;} \ - if ( ext::opengl::settings::validation ) { \ + if ( ext::opengl::settings::validation::enabled ) { \ GLenum res = glGetError(); \ if (res != GL_NO_ERROR) GL_DEBUG_MESSAGE("[Validation Error] {}: {}", #f, ext::opengl::errorString( res )); \ } \ diff --git a/engine/inc/uf/ext/opengl/opengl.h b/engine/inc/uf/ext/opengl/opengl.h index d1a80378..9b113d07 100644 --- a/engine/inc/uf/ext/opengl/opengl.h +++ b/engine/inc/uf/ext/opengl/opengl.h @@ -14,7 +14,6 @@ namespace ext { extern UF_API uint32_t width; extern UF_API uint32_t height; extern UF_API uint8_t msaa; - extern UF_API bool validation; extern UF_API bool defaultStageBuffers; extern UF_API bool defaultDeferBufferDestroy; extern UF_API bool defaultCommandBufferWait; @@ -25,7 +24,6 @@ namespace ext { constexpr size_t maxViews = 6; - extern UF_API uf::stl::vector validationFilters; extern UF_API uf::stl::vector requestedDeviceFeatures; extern UF_API uf::stl::vector requestedDeviceExtensions; extern UF_API uf::stl::vector requestedInstanceExtensions; @@ -38,6 +36,13 @@ namespace ext { extern UF_API bool batchQueueSubmissions; } + namespace validation { + extern UF_API bool enabled; + extern UF_API bool messages; + extern UF_API bool checkpoints; + extern UF_API uf::stl::vector filters; + } + namespace invariant { extern UF_API bool waitOnRenderEnd; extern UF_API bool individualPipelines; diff --git a/engine/inc/uf/macros.h b/engine/inc/uf/macros.h index 72692613..19b77db1 100644 --- a/engine/inc/uf/macros.h +++ b/engine/inc/uf/macros.h @@ -100,7 +100,7 @@ #define ALIGNED_SIZE(V, A) ((V + A - 1) & ~(A - 1)) -#define UF_MSG_PEEK(X) #X"="+std::to_string(X) +#define UF_MSG_PEEK(X) #X": {}", X #if UF_ENV_DREAMCAST #define DC_STATS() {\ diff --git a/engine/src/engine/graph/decode.cpp b/engine/src/engine/graph/decode.cpp index a07054d3..1a5fdd01 100644 --- a/engine/src/engine/graph/decode.cpp +++ b/engine/src/engine/graph/decode.cpp @@ -9,13 +9,13 @@ #include #include -#if UF_ENV_DREAMCAST +#if UF_USE_OPENGL #define UF_GRAPH_LOAD_MULTITHREAD 0 #else - #define UF_GRAPH_LOAD_MULTITHREAD 0 + #define UF_GRAPH_LOAD_MULTITHREAD 1 #endif -#if UF_ENV_DREAMCAST +#if 0 && UF_ENV_DREAMCAST #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__) @@ -244,7 +244,7 @@ namespace { auto& attribute = mesh.vertex.attributes[i]; if ( std::find( attributesKept.begin(), attributesKept.end(), attribute.descriptor.name ) != attributesKept.end() ) continue; remove.insert(remove.begin(), i); - // UF_MSG_DEBUG("Removing mesh attribute: {}", attribute.descriptor.name); + UF_MSG_DEBUG("Removing mesh attribute: {}", attribute.descriptor.name); } for ( auto& i : remove ) { mesh.buffers[mesh.vertex.attributes[i].buffer].clear(); diff --git a/engine/src/engine/graph/graph.cpp b/engine/src/engine/graph/graph.cpp index ce714939..0e389e18 100644 --- a/engine/src/engine/graph/graph.cpp +++ b/engine/src/engine/graph/graph.cpp @@ -1002,10 +1002,49 @@ void uf::graph::process( pod::Graph& graph ) { } #endif - if ( graph.metadata["debug"]["print"]["lights"].as() ) for ( auto& pair : graph.lights ) UF_MSG_DEBUG("Light: {}", pair.first); - if ( graph.metadata["debug"]["print"]["meshes"].as() ) for ( auto& name : graph.meshes ) UF_MSG_DEBUG("Mesh: {}", name); - if ( graph.metadata["debug"]["print"]["materials"].as() ) for ( auto& name : graph.materials ) UF_MSG_DEBUG("Material: {}", name); - if ( graph.metadata["debug"]["print"]["textures"].as() ) for ( auto& name : graph.textures ) UF_MSG_DEBUG("Texture: {}", name); + if ( graph.metadata["debug"]["print"]["lights"].as() ) { + UF_MSG_DEBUG("Lights: {}", graph.lights.size()); + for ( auto& pair : graph.lights ) { + UF_MSG_DEBUG("\tLight: {}", pair.first); + } + } + if ( graph.metadata["debug"]["print"]["meshes"].as() ) { + UF_MSG_DEBUG("Meshs: {}", graph.meshes.size()); + for ( auto& name : graph.meshes ) { + UF_MSG_DEBUG("\tMesh: {}", name); + } + } + + if ( graph.metadata["debug"]["print"]["instances"].as() ) { + UF_MSG_DEBUG("Instances: {}", graph.instances.size()); + for ( auto& name : graph.instances ) { + auto& instance = uf::graph::storage.instances[name]; + UF_MSG_DEBUG("\tInstance: {} | {} | {}", name, + instance.materialID, + instance.lightmapID + ); + } + } + if ( graph.metadata["debug"]["print"]["materials"].as() ) { + UF_MSG_DEBUG("Materials: {}", graph.materials.size()); + for ( auto& name : graph.materials ) { + auto& material = uf::graph::storage.materials[name]; + UF_MSG_DEBUG("\tMaterial: {} | {}", name, material.indexAlbedo); + } + } + if ( graph.metadata["debug"]["print"]["textures"].as() ) { + UF_MSG_DEBUG("Textures: {}", graph.textures.size()); + for ( auto& name : graph.textures ) { + auto& texture = uf::graph::storage.textures[name]; + UF_MSG_DEBUG("\tTexture: {} | {}", name, texture.index); + } + } + if ( graph.metadata["debug"]["print"]["images"].as() ) { + UF_MSG_DEBUG("Images: {}", graph.images.size()); + for ( auto& name : graph.images ) { + UF_MSG_DEBUG("\tImage: {}", name); + } + } UF_DEBUG_TIMER_MULTITRACE("Updating master graph"); uf::graph::reload(); diff --git a/engine/src/ext/opengl/commands.cpp b/engine/src/ext/opengl/commands.cpp index 4afa1427..33a62980 100644 --- a/engine/src/ext/opengl/commands.cpp +++ b/engine/src/ext/opengl/commands.cpp @@ -272,7 +272,21 @@ void ext::opengl::CommandBuffer::drawIndexed( const ext::opengl::CommandBuffer:: if ( drawCommand.instances == 0 ) return; } + GL_ERROR_CHECK(glMatrixMode(GL_MODELVIEW)); + GL_ERROR_CHECK(glLoadMatrixf( &modelView[0] )); + GL_ERROR_CHECK(glMatrixMode(GL_PROJECTION)); + GL_ERROR_CHECK(glLoadMatrixf( &projection[0] )); + +#if UF_ENV_DREAMCAST + // washingtondc has a regression where non-alpha-tested polys do not render + // more convenient to just work around the regression since later builds have working opengl backends + GL_ERROR_CHECK(glEnable(GL_ALPHA_TEST)); + GL_ERROR_CHECK(glAlphaFunc(GL_GREATER, drawInfo.blend.alphaCutoff)); + + GL_ERROR_CHECK(glEnable(GL_BLEND)); + GL_ERROR_CHECK(glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)); +#else if ( drawInfo.blend.modeAlpha > 0 ) { GL_ERROR_CHECK(glEnable(GL_ALPHA_TEST)); GL_ERROR_CHECK(glAlphaFunc(GL_GREATER, drawInfo.blend.alphaCutoff)); @@ -283,12 +297,7 @@ void ext::opengl::CommandBuffer::drawIndexed( const ext::opengl::CommandBuffer:: GL_ERROR_CHECK(glDisable(GL_ALPHA_TEST)); GL_ERROR_CHECK(glDisable(GL_BLEND)); } - - GL_ERROR_CHECK(glMatrixMode(GL_MODELVIEW)); - GL_ERROR_CHECK(glLoadMatrixf( &modelView[0] )); - - GL_ERROR_CHECK(glMatrixMode(GL_PROJECTION)); - GL_ERROR_CHECK(glLoadMatrixf( &projection[0] )); +#endif if ( drawInfo.descriptor.cullMode == GL_NONE ) { GL_ERROR_CHECK(glDisable(GL_CULL_FACE)); @@ -303,12 +312,14 @@ void ext::opengl::CommandBuffer::drawIndexed( const ext::opengl::CommandBuffer:: GL_ERROR_CHECK(glDisable(GL_DEPTH_TEST)); } GL_ERROR_CHECK(glDepthMask(drawInfo.descriptor.depth.write ? GL_TRUE : GL_FALSE)); + + uf::stl::vector colors; // CPU-buffer based command dispatching if ( drawInfo.attributes.normal.pointer ) GL_ERROR_CHECK(glEnableClientState(GL_NORMAL_ARRAY)); - if ( drawInfo.attributes.color.pointer ) GL_ERROR_CHECK(glEnableClientState(GL_COLOR_ARRAY)); + if ( drawInfo.attributes.color.pointer || drawInfo.color.enabled ) GL_ERROR_CHECK(glEnableClientState(GL_COLOR_ARRAY)); GL_ERROR_CHECK(glEnableClientState(GL_VERTEX_ARRAY)); - + GLenum indicesType = GL_UNSIGNED_INT; switch ( drawInfo.attributes.index.stride ) { case sizeof(uint32_t): indicesType = GL_UNSIGNED_INT; break; @@ -316,33 +327,9 @@ void ext::opengl::CommandBuffer::drawIndexed( const ext::opengl::CommandBuffer:: case sizeof(uint8_t): indicesType = GL_UNSIGNED_BYTE; break; } - if ( drawInfo.textures.primary.image && drawInfo.attributes.uv.pointer ) { - GL_ERROR_CHECK(glEnableClientState(GL_TEXTURE_COORD_ARRAY)); - - GL_ERROR_CHECK(glClientActiveTexture(GL_TEXTURE0)); - GL_ERROR_CHECK(glActiveTexture(GL_TEXTURE0)); - GL_ERROR_CHECK(glEnable(drawInfo.textures.primary.viewType)); - GL_ERROR_CHECK(glEnableClientState(GL_TEXTURE_COORD_ARRAY)); - GL_ERROR_CHECK(glBindTexture(drawInfo.textures.primary.viewType, drawInfo.textures.primary.image)); - GL_ERROR_CHECK(glTexCoordPointer(2, GL_FLOAT, drawInfo.attributes.uv.stride, (static_cast(drawInfo.attributes.uv.pointer) + drawInfo.attributes.uv.stride * drawInfo.descriptor.inputs.vertex.first))); - - if ( !(drawInfo.textures.secondary.image && drawInfo.attributes.st.pointer) ) { - GL_ERROR_CHECK(glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE)); - } else { - GL_ERROR_CHECK(glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE)); - - GL_ERROR_CHECK(glClientActiveTexture(GL_TEXTURE1)); - GL_ERROR_CHECK(glActiveTexture(GL_TEXTURE1)); - GL_ERROR_CHECK(glEnable(drawInfo.textures.secondary.viewType)); - GL_ERROR_CHECK(glEnableClientState(GL_TEXTURE_COORD_ARRAY)); - GL_ERROR_CHECK(glBindTexture(drawInfo.textures.secondary.viewType, drawInfo.textures.secondary.image)); - GL_ERROR_CHECK(glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE)); - - GL_ERROR_CHECK(glTexCoordPointer(2, GL_FLOAT, drawInfo.attributes.st.stride, (static_cast(drawInfo.attributes.st.pointer) + drawInfo.attributes.st.stride * drawInfo.descriptor.inputs.vertex.first))); - } - } - if ( drawInfo.attributes.normal.pointer ) GL_ERROR_CHECK(glNormalPointer(GL_FLOAT, drawInfo.attributes.normal.stride, (static_cast(drawInfo.attributes.normal.pointer) + drawInfo.attributes.normal.stride * drawInfo.descriptor.inputs.vertex.first))); + + if ( drawInfo.attributes.color.pointer ) { GLenum format = GL_UNSIGNED_BYTE; switch ( drawInfo.attributes.color.descriptor.size / drawInfo.attributes.color.descriptor.components ) { @@ -350,13 +337,57 @@ void ext::opengl::CommandBuffer::drawIndexed( const ext::opengl::CommandBuffer:: case sizeof(float): format = GL_FLOAT; break; } GL_ERROR_CHECK(glColorPointer(drawInfo.attributes.color.descriptor.components, format, drawInfo.attributes.color.stride, (static_cast(drawInfo.attributes.color.pointer) + drawInfo.attributes.color.stride * drawInfo.descriptor.inputs.vertex.first))); + } else if ( drawInfo.color.enabled ) { + colors = uf::stl::vector( drawInfo.descriptor.inputs.vertex.count, drawInfo.color.value ); + GL_ERROR_CHECK(glColorPointer(4, GL_FLOAT, sizeof(pod::Vector4f), &(colors[0][0]))); + + // GL_ERROR_CHECK(glColor4f( drawInfo.color.value[0], drawInfo.color.value[1], drawInfo.color.value[2], drawInfo.color.value[3] )); } + + if ( drawInfo.textures.primary.image && drawInfo.attributes.uv.pointer ) { + GL_ERROR_CHECK(glClientActiveTexture(GL_TEXTURE0)); + GL_ERROR_CHECK(glActiveTexture(GL_TEXTURE0)); + GL_ERROR_CHECK(glEnable(drawInfo.textures.primary.viewType)); + GL_ERROR_CHECK(glEnableClientState(GL_TEXTURE_COORD_ARRAY)); + GL_ERROR_CHECK(glBindTexture(drawInfo.textures.primary.viewType, drawInfo.textures.primary.image)); + GL_ERROR_CHECK(glTexCoordPointer(2, GL_FLOAT, drawInfo.attributes.uv.stride, (static_cast(drawInfo.attributes.uv.pointer) + drawInfo.attributes.uv.stride * drawInfo.descriptor.inputs.vertex.first))); + + #if 0 && UF_ENV_DREAMCAST + if ( drawInfo.attributes.color.pointer || drawInfo.color.enabled ) { + GL_ERROR_CHECK(glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE)); + } else { + GL_ERROR_CHECK(glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE)); + } + #else + // modern drivers for fixed function OpenGL does not implement GL_MODULATE properly for vertex colored + texture sampling + GL_ERROR_CHECK(glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE)); + #endif + + if ( drawInfo.textures.secondary.image && drawInfo.attributes.st.pointer ) { + GL_ERROR_CHECK(glClientActiveTexture(GL_TEXTURE1)); + GL_ERROR_CHECK(glActiveTexture(GL_TEXTURE1)); + GL_ERROR_CHECK(glEnable(drawInfo.textures.secondary.viewType)); + GL_ERROR_CHECK(glEnableClientState(GL_TEXTURE_COORD_ARRAY)); + GL_ERROR_CHECK(glBindTexture(drawInfo.textures.secondary.viewType, drawInfo.textures.secondary.image)); + GL_ERROR_CHECK(glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE)); + GL_ERROR_CHECK(glTexCoordPointer(2, GL_FLOAT, drawInfo.attributes.st.stride, (static_cast(drawInfo.attributes.st.pointer) + drawInfo.attributes.st.stride * drawInfo.descriptor.inputs.vertex.first))); + } + } + GL_ERROR_CHECK(glVertexPointer(3, GL_FLOAT, drawInfo.attributes.position.stride, (static_cast(drawInfo.attributes.position.pointer) + drawInfo.attributes.position.stride * drawInfo.descriptor.inputs.vertex.first))); - + if ( drawInfo.descriptor.inputs.index.count ) { GL_ERROR_CHECK(glDrawElements(GL_TRIANGLES, drawInfo.descriptor.inputs.index.count, indicesType, (static_cast(drawInfo.attributes.index.pointer) + drawInfo.attributes.index.stride * drawInfo.descriptor.inputs.index.first))); } else { + #if UF_ENV_DREAMCAST + // GLdc has a "regression" where glDrawArrays does not work + // everything should be using indices anyways so this path shouldn't really ever be taken + uf::stl::vector indices(drawInfo.descriptor.inputs.vertex.count); + for ( auto i = 0; i < drawInfo.descriptor.inputs.vertex.count; ++i ) indices[i] = i; + GL_ERROR_CHECK(glDrawElements(GL_TRIANGLES, indices.size(), GL_UNSIGNED_SHORT, indices.data())); + #else GL_ERROR_CHECK(glDrawArrays(GL_TRIANGLES, drawInfo.descriptor.inputs.vertex.first, drawInfo.descriptor.inputs.vertex.count)); + #endif } if ( drawInfo.textures.secondary.image ) { @@ -373,7 +404,7 @@ void ext::opengl::CommandBuffer::drawIndexed( const ext::opengl::CommandBuffer:: } if ( drawInfo.attributes.normal.pointer ) GL_ERROR_CHECK(glDisableClientState(GL_NORMAL_ARRAY)); - if ( drawInfo.attributes.color.pointer ) GL_ERROR_CHECK(glDisableClientState(GL_COLOR_ARRAY)); + if ( drawInfo.attributes.color.pointer || drawInfo.color.enabled ) GL_ERROR_CHECK(glDisableClientState(GL_COLOR_ARRAY)); if ( drawInfo.attributes.uv.pointer ) GL_ERROR_CHECK(glDisableClientState(GL_TEXTURE_COORD_ARRAY)); GL_ERROR_CHECK(glDisableClientState(GL_VERTEX_ARRAY)); } diff --git a/engine/src/ext/opengl/graphic.cpp b/engine/src/ext/opengl/graphic.cpp index 6524b0d4..ea718eec 100644 --- a/engine/src/ext/opengl/graphic.cpp +++ b/engine/src/ext/opengl/graphic.cpp @@ -372,8 +372,8 @@ void ext::opengl::Graphic::record( CommandBuffer& commandBuffer, const GraphicDe if ( attribute.descriptor.name == "position" ) drawCommandInfoBase.attributes.position = attribute; else if ( attribute.descriptor.name == "uv" ) drawCommandInfoBase.attributes.uv = attribute; else if ( attribute.descriptor.name == "st" ) drawCommandInfoBase.attributes.st = attribute; - else if ( attribute.descriptor.name == "normal" ) drawCommandInfoBase.attributes.normal = attribute; - else if ( attribute.descriptor.name == "color" ) drawCommandInfoBase.attributes.color = attribute; + // else if ( attribute.descriptor.name == "normal" ) drawCommandInfoBase.attributes.normal = attribute; + // else if ( attribute.descriptor.name == "color" ) drawCommandInfoBase.attributes.color = attribute; } if ( uniformBufferSize == sizeof(pod::Camera::Viewports) ) { @@ -413,10 +413,14 @@ void ext::opengl::Graphic::record( CommandBuffer& commandBuffer, const GraphicDe for ( auto i = 0; i < descriptor.inputs.indirect.count; ++i ) { auto& drawCommand = drawCommands[i]; auto instanceID = drawCommand.instanceID; + auto& instance = instances[instanceID]; auto materialID = instance.materialID; + auto lightmapID = instance.lightmapID; + auto& material = materials[materialID]; auto textureID = material.indexAlbedo; + auto& infos = pool[textureID]; CommandBuffer::InfoDraw& drawCommandInfo = infos.emplace_back( drawCommandInfoBase ); // CommandBuffer::InfoDraw drawCommandInfo = drawCommandInfoBase; @@ -437,14 +441,17 @@ void ext::opengl::Graphic::record( CommandBuffer& commandBuffer, const GraphicDe drawCommandInfo.blend.modeAlpha = material.modeAlpha; drawCommandInfo.blend.alphaCutoff = material.factorAlphaCutoff; - - if ( 0 <= material.indexAlbedo ) { - auto texture2DID = textures[material.indexAlbedo].index; + + drawCommandInfo.color.value = instance.color * material.colorBase; + drawCommandInfo.color.enabled = drawCommandInfo.color.value != pod::Vector4f{1.0f, 1.0f, 1.0f, 1.0f}; + + if ( 0 <= textureID ) { + auto texture2DID = textures[textureID].index; drawCommandInfo.textures.primary = this->material.textures.at(texture2DID).descriptor; } - if ( 0 <= instance.lightmapID ) { - auto textureID = instance.lightmapID; - auto texture2DID = textures[instance.lightmapID].index; + if ( 0 <= lightmapID ) { + auto textureID = lightmapID; + auto texture2DID = textures[lightmapID].index; drawCommandInfo.textures.secondary = this->material.textures.at(texture2DID).descriptor; } switch ( drawCommandInfo.blend.modeAlpha ) { @@ -470,7 +477,7 @@ void ext::opengl::Graphic::record( CommandBuffer& commandBuffer, const GraphicDe case enums::Format::R8G8B8A8_UNORM: case enums::Format::R8G8B8A8_SRGB: drawCommandInfo.blend.modeAlpha = 1; - // drawCommandInfo.blend.alphaCutoff = 0.001f; // material.factorAlphaCutoff; + drawCommandInfo.blend.alphaCutoff = 0.0001f; // material.factorAlphaCutoff; break; } } @@ -480,8 +487,21 @@ void ext::opengl::Graphic::record( CommandBuffer& commandBuffer, const GraphicDe default: drawCommandInfos.translucents.emplace_back(drawCommandInfo); break; } } - for ( auto& drawCommandInfo : drawCommandInfos.opaques ) commandBuffer.record(drawCommandInfo); - for ( auto& drawCommandInfo : drawCommandInfos.translucents ) commandBuffer.record(drawCommandInfo); + + if ( uf::matrix::reverseInfiniteProjection ) { + for ( auto it = drawCommandInfos.opaques.rbegin(); it != drawCommandInfos.opaques.rend(); ++it ) { + auto& drawCommandInfo = (*it); + commandBuffer.record(drawCommandInfo); + } + for ( auto it = drawCommandInfos.translucents.rbegin(); it != drawCommandInfos.translucents.rend(); ++it ) { + auto& drawCommandInfo = (*it); + commandBuffer.record(drawCommandInfo); + } + } else { + for ( auto& drawCommandInfo : drawCommandInfos.opaques ) commandBuffer.record(drawCommandInfo); + for ( auto& drawCommandInfo : drawCommandInfos.translucents ) commandBuffer.record(drawCommandInfo); + } +// UF_MSG_DEBUG("END") } void ext::opengl::Graphic::destroy() { for ( auto& pair : pipelines ) pair.second.destroy(); @@ -513,6 +533,9 @@ void ext::opengl::GraphicDescriptor::parse( ext::json::Value& metadata ) { depth.bias.slope = metadata["depth bias"]["slope"].as(); depth.bias.clamp = metadata["depth bias"]["clamp"].as(); } + + depth.test = metadata["depth test"].as( depth.test ); + depth.write = metadata["depth write"].as( depth.write ); } ext::opengl::GraphicDescriptor::hash_t ext::opengl::GraphicDescriptor::hash() const { size_t hash{}; @@ -542,7 +565,7 @@ ext::opengl::GraphicDescriptor::hash_t ext::opengl::GraphicDescriptor::hash() co hash += std::hash{}(inputs.indirect.attributes[i].descriptor.offset); } */ - +/* hash += std::hash{}(topology); hash += std::hash{}(cullMode); hash += std::hash{}(fill); @@ -555,6 +578,7 @@ ext::opengl::GraphicDescriptor::hash_t ext::opengl::GraphicDescriptor::hash() co hash += std::hash{}(depth.bias.constant); hash += std::hash{}(depth.bias.slope); hash += std::hash{}(depth.bias.clamp); +*/ return hash; } diff --git a/engine/src/ext/opengl/opengl.cpp b/engine/src/ext/opengl/opengl.cpp index b29de224..210a7f0a 100644 --- a/engine/src/ext/opengl/opengl.cpp +++ b/engine/src/ext/opengl/opengl.cpp @@ -20,7 +20,7 @@ uint32_t ext::opengl::settings::width = 640; uint32_t ext::opengl::settings::height = 480; uint8_t ext::opengl::settings::msaa = 1; -bool ext::opengl::settings::validation = false; + bool ext::opengl::settings::defaultStageBuffers = true; bool ext::opengl::settings::defaultDeferBufferDestroy = true; bool ext::opengl::settings::defaultCommandBufferWait = true; @@ -31,13 +31,17 @@ size_t ext::opengl::settings::scratchBufferAlignment = 0; size_t ext::opengl::settings::scratchBufferInitialSize = 256; size_t ext::opengl::settings::defaultTimeout = 100000000000; -uf::stl::vector ext::opengl::settings::validationFilters; uf::stl::vector ext::opengl::settings::requestedDeviceFeatures; uf::stl::vector ext::opengl::settings::requestedDeviceExtensions; uf::stl::vector ext::opengl::settings::requestedInstanceExtensions; ext::opengl::enums::Filter::type_t ext::opengl::settings::swapchainUpscaleFilter = ext::opengl::enums::Filter::LINEAR; +bool ext::opengl::settings::validation::enabled = false; +bool ext::opengl::settings::validation::messages = false; +bool ext::opengl::settings::validation::checkpoints = false; +uf::stl::vector ext::opengl::settings::validation::filters; + // these go hand in hand for the above #if UF_ENV_DREAMCAST bool ext::opengl::settings::experimental::dedicatedThread = false; @@ -110,13 +114,8 @@ bool ext::opengl::hasRenderMode( const uf::stl::string& name, bool isName ) { ext::opengl::RenderMode& ext::opengl::addRenderMode( ext::opengl::RenderMode* mode, const uf::stl::string& name ) { mode->metadata.name = name; renderModes.push_back(mode); - if ( ext::opengl::settings::validation ) UF_MSG_DEBUG("Adding RenderMode: {}: {}", name, mode->getType()); + if ( ext::opengl::settings::validation::enabled ) UF_MSG_DEBUG("Adding RenderMode: {}: {}", name, mode->getType()); // reorder - if ( hasRenderMode("Gui", true) ) { - RenderMode& primary = getRenderMode("Gui", true); - auto it = std::find( renderModes.begin(), renderModes.end(), &primary ); - if ( it + 1 != renderModes.end() ) std::rotate( it, it + 1, renderModes.end() ); - } if ( hasRenderMode("", true) ) { RenderMode& primary = getRenderMode("", true); auto it = std::find( renderModes.begin(), renderModes.end(), &primary ); @@ -126,6 +125,11 @@ ext::opengl::RenderMode& ext::opengl::addRenderMode( ext::opengl::RenderMode* mo auto it = std::find( renderModes.begin(), renderModes.end(), &primary ); if ( it + 1 != renderModes.end() ) std::rotate( it, it + 1, renderModes.end() ); } + if ( hasRenderMode("Gui", true) ) { + RenderMode& primary = getRenderMode("Gui", true); + auto it = std::find( renderModes.begin(), renderModes.end(), &primary ); + if ( it + 1 != renderModes.end() ) std::rotate( it, it + 1, renderModes.end() ); + } ext::opengl::states::rebuild = true; return *mode; @@ -149,7 +153,7 @@ ext::opengl::RenderMode& ext::opengl::getRenderMode( const uf::stl::string& name return *target; } uf::stl::vector ext::opengl::getRenderModes( const uf::stl::string& name, bool isName ) { - return ext::opengl::getRenderModes({name}, isName); + return ext::opengl::getRenderModes(uf::stl::vector{name}, isName); } uf::stl::vector ext::opengl::getRenderModes( const uf::stl::vector& names, bool isName ) { uf::stl::vector targets; @@ -435,16 +439,16 @@ void ext::opengl::render(){ if ( !renderMode || !renderMode->execute ) continue; ext::opengl::setCurrentRenderMode( renderMode ); - #if UF_USE_IMGUI - if ( renderMode->getName() == "Gui" ) { - ext::imgui::render(); - } - #endif - uf::graph::render(); uf::scene::render(); renderMode->render(); + if ( renderMode->getName() == "Gui" ) { + #if UF_USE_IMGUI + ext::imgui::render(); + #endif + } + ext::opengl::setCurrentRenderMode(NULL); } diff --git a/engine/src/ext/opengl/rendermodes/base.cpp b/engine/src/ext/opengl/rendermodes/base.cpp index 5dd731ce..af3bec1b 100644 --- a/engine/src/ext/opengl/rendermodes/base.cpp +++ b/engine/src/ext/opengl/rendermodes/base.cpp @@ -63,16 +63,17 @@ void ext::opengl::BaseRenderMode::initialize( Device& device ) { this->width = windowSize.x; this->height = windowSize.y; + glDepthRange(0, 1); if ( uf::matrix::reverseInfiniteProjection ) { GL_ERROR_CHECK(glDepthFunc(GL_GEQUAL)); - #if !UF_ENV_DREAMCAST || UF_USE_OPENGL_GLDC - glDepthRange(0, 1); - #endif } else { GL_ERROR_CHECK(glDepthFunc(GL_LESS)); } GL_ERROR_CHECK(glEnable(GL_DEPTH_TEST)); GL_ERROR_CHECK(glEnable(GL_TEXTURE_2D)); + + GL_ERROR_CHECK(glDisable(GL_LIGHTING)); + GL_ERROR_CHECK(glDisable(GL_COLOR_MATERIAL)); #if 0 GL_ERROR_CHECK(glEnable(GL_ALPHA_TEST)); @@ -90,7 +91,8 @@ void ext::opengl::BaseRenderMode::initialize( Device& device ) { // GL_ERROR_CHECK(glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SEPARATE_SPECULAR_COLOR)); #if UF_USE_DREAMCAST //profiler_enable(); - GL_ERROR_CHECK(glEnable(GL_NEARZ_CLIPPING_KOS)); +// GL_ERROR_CHECK(glEnable(GL_NEARZ_CLIPPING_KOS)); + // GL_ERROR_CHECK(glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, 0)); // GL_ERROR_CHECK(glShadeModel(GL_SMOOTH)); #else diff --git a/engine/src/ext/opengl/rendermodes/rendertarget.cpp b/engine/src/ext/opengl/rendermodes/rendertarget.cpp index 318a5596..bedfbb01 100644 --- a/engine/src/ext/opengl/rendermodes/rendertarget.cpp +++ b/engine/src/ext/opengl/rendermodes/rendertarget.cpp @@ -18,6 +18,10 @@ ext::opengl::GraphicDescriptor ext::opengl::RenderTargetRenderMode::bindGraphicD if ( metadata.type == "depth" ) { // descriptor.cullMode = GL_CULL_MODE_NONE; } + +// descriptor.depth.write = true; +// descriptor.depth.test = false; + // invalidate if ( metadata.target != "" && descriptor.renderMode != this->getName() && descriptor.renderMode != metadata.target ) { descriptor.invalidated = true; diff --git a/engine/src/ext/vorbis/vorbis.cpp b/engine/src/ext/vorbis/vorbis.cpp index 466f5f6d..9c56cde7 100644 --- a/engine/src/ext/vorbis/vorbis.cpp +++ b/engine/src/ext/vorbis/vorbis.cpp @@ -203,7 +203,7 @@ void ext::vorbis::stream( uf::Audio::Metadata& metadata ) { } // UF_MSG_DEBUG( "filename\tchannels\tbitDepth\tfrequency\tduration\tchannels" ); -// UF_MSG_DEBUG( metadata.filename << "\t" << (int)metadata.info.channels << "\t" << (int)metadata.info.bitDepth << "\t" << (int)metadata.info.frequency << "\t" << metadata.info.duration << "\t" << (int) metadata.info.channels ); +// UF_MSG_DEBUG( "{}\t{}\t{}\t{}\t{}\t{}", metadata.filename, (int) metadata.info.channels, (int) metadata.info.bitDepth, (int) metadata.info.frequency, metadata.info.duration, (int) metadata.info.channels ); // fill and queue initial buffers char buffer[uf::audio::bufferSize]; @@ -212,7 +212,6 @@ void ext::vorbis::stream( uf::Audio::Metadata& metadata ) { int32_t read = 0; while ( read < uf::audio::bufferSize ) { int32_t result = ov_read( &vorbisFile, &buffer[read], uf::audio::bufferSize - read, endian, 2, 1, &metadata.stream.bitStream ); - if ( result == OV_HOLE ) { UF_MSG_ERROR("Vorbis: OV_HOLE found in buffer read: {} {}", (int) queuedBuffers, metadata.filename); break; @@ -239,7 +238,7 @@ void ext::vorbis::stream( uf::Audio::Metadata& metadata ) { } if ( read == 0 ) { - // UF_MSG_WARNING("Vorbis: consumed file stream before buffers are filled: " << (int) queuedBuffers << " " << metadata.filename); + // UF_MSG_WARNING("Vorbis: consumed file stream before buffers are filled: {} {}", (int) queuedBuffers, metadata.filename); // if ( metadata.settings.loopMode == 0 ) metadata.settings.loopMode = 1; // if ( metadata.settings.loop ) metadata.al.source.set( AL_LOOPING, AL_TRUE ); break; diff --git a/engine/src/ext/vulkan/vulkan.cpp b/engine/src/ext/vulkan/vulkan.cpp index a144067c..48dc2328 100644 --- a/engine/src/ext/vulkan/vulkan.cpp +++ b/engine/src/ext/vulkan/vulkan.cpp @@ -256,7 +256,7 @@ ext::vulkan::RenderMode& ext::vulkan::getRenderMode( const uf::stl::string& name } uf::stl::vector ext::vulkan::getRenderModes( const uf::stl::string& name, bool isName ) { if ( isName && renderModesMap.count(name) > 0 ) return { renderModesMap[name] }; - return ext::vulkan::getRenderModes({name}, isName); + return ext::vulkan::getRenderModes(uf::stl::vector{name}, isName); } uf::stl::vector ext::vulkan::getRenderModes( const uf::stl::vector& names, bool isName ) { uf::stl::vector targets; diff --git a/engine/src/spec/window/dreamcast.cpp b/engine/src/spec/window/dreamcast.cpp index 20b16f53..586c338d 100644 --- a/engine/src/spec/window/dreamcast.cpp +++ b/engine/src/spec/window/dreamcast.cpp @@ -323,6 +323,8 @@ void spec::dreamcast::Window::create( const spec::dreamcast::Window::vector_t& _ this->setSize(_size); + UF_MSG_DEBUG("DBL_MEM: {}", DBL_MEM); + #if UF_USE_OPENGL && UF_OPENGL_CONTEXT_IN_WINDOW this->m_context = (void*) spec::uni::Context::create( settings, *this ); #endif diff --git a/ext/behaviors/player/behavior.cpp b/ext/behaviors/player/behavior.cpp index 87706dad..c4ac15d8 100644 --- a/ext/behaviors/player/behavior.cpp +++ b/ext/behaviors/player/behavior.cpp @@ -81,6 +81,9 @@ void ext::PlayerBehavior::initialize( uf::Object& self ) { this->addHook( "window:Mouse.CursorVisibility", [&](pod::payloads::windowMouseCursorVisibility& payload){ metadata.system.control = !payload.mouse.visible; }); + this->addHook( "system:Control.%UID%", [&]( ext::json::Value& value ){ + metadata.system.control = value["control"].as(!metadata.system.control); + }); // Rotate Camera #if !UF_INPUT_USE_ENUM_MOUSE @@ -179,7 +182,8 @@ void ext::PlayerBehavior::tick( uf::Object& self ) { if ( uf::inputs::controller::states::A ) keys.jump = true; if ( uf::inputs::controller::states::B ) keys.running = true; if ( uf::inputs::controller::states::X ) keys.crouch = true, keys.walk = true; - if ( uf::inputs::controller::states::Y ) keys.vee = true; + // if ( uf::inputs::controller::states::Y ) keys.vee = true; + if ( uf::inputs::controller::states::Y ) keys.use = true; if ( uf::inputs::controller::states::L_TRIGGER ) keys.left = true; if ( uf::inputs::controller::states::R_TRIGGER ) keys.right = true; if ( uf::inputs::controller::states::START ) keys.paused = true; @@ -501,7 +505,7 @@ void ext::PlayerBehavior::tick( uf::Object& self ) { } } #endif -#if UF_USE_LUA && !UF_ENV_DREAMCAST +#if 0 && UF_USE_LUA && !UF_ENV_DREAMCAST #define TRACK_ORIENTATION(ORIENTATION) {\ static pod::Quaternion<> storedCameraOrientation = ORIENTATION;\ const pod::Quaternion<> prevCameraOrientation = storedCameraOrientation;\ @@ -512,7 +516,8 @@ void ext::PlayerBehavior::tick( uf::Object& self ) { combinedDeltaOrientation = uf::quaternion::multiply( deltaOrientation, combinedDeltaOrientation );\ storedCameraOrientation = ORIENTATION;\ } - if ( false ) { + // this causes bigly memory leaks + { pod::Quaternion<> combinedDeltaOrientation = {0,0,0,1}; pod::Vector3f combinedDeltaAngles = {}; TRACK_ORIENTATION(transform.orientation); diff --git a/ext/behaviors/scene/behavior.cpp b/ext/behaviors/scene/behavior.cpp index c5a3d741..59a6beda 100644 --- a/ext/behaviors/scene/behavior.cpp +++ b/ext/behaviors/scene/behavior.cpp @@ -72,7 +72,7 @@ void ext::ExtSceneBehavior::initialize( uf::Object& self ) { if ( !manager ) return; uf::stl::string key = payload.name; - uf::Object& gui = manager->loadChild(metadataJson["menus"][key].as("/entites/gui/"+key+"/menu.json"), false); + uf::Object& gui = manager->loadChild(metadataJson["menus"][key].as("/gui/"+key+"/menu.json"), false); uf::Serializer& metadataJson = gui.getComponent(); gui.initialize(); }; @@ -387,7 +387,7 @@ void ext::ExtSceneBehavior::tick( uf::Object& self ) { } #endif #if UF_USE_OPENGL - if ( metadata.light.enabled ) { + if ( false && metadata.light.enabled ) { auto/*&*/ graph = this->getGraph(); auto& controller = this->getController(); // auto& camera = controller.getComponent(); @@ -807,11 +807,13 @@ void ext::ExtSceneBehavior::Metadata::deserialize( uf::Object& self, uf::Seriali } #if UF_USE_OPENGL_FIXED_FUNCTION uf::renderer::states::rebuild = true; +/* if ( light.enabled ) { GL_ERROR_CHECK(glEnable(GL_LIGHTING)); } else { GL_ERROR_CHECK(glDisable(GL_LIGHTING)); } +*/ #endif #if UF_USE_VULKAN if ( uf::renderer::settings::pipelines::bloom ) { diff --git a/ext/gui/behavior.cpp b/ext/gui/behavior.cpp index 954fc684..83eb0bb1 100644 --- a/ext/gui/behavior.cpp +++ b/ext/gui/behavior.cpp @@ -371,7 +371,7 @@ void ext::Gui::load( const uf::Image& image ) { { pod::Vector3f{ 1.0f, 1.0f, 0.0f}, pod::Vector2f{1.0f, 1.0f}, color }, { pod::Vector3f{ 1.0f, -1.0f, 0.0f}, pod::Vector2f{1.0f, 0.0f}, color }, }; - uf::stl::vector indices = { + uf::stl::vector indices = { 0, 1, 2, 3, 4, 5 }; @@ -393,9 +393,9 @@ void ext::Gui::load( const uf::Image& image ) { } else { #if UF_USE_OPENGL if ( ext::json::isNull(metadataJson["cull mode"]) ) metadataJson["cull mode"] = "front"; - transform.position.z = metadata.depth; + if ( uf::matrix::reverseInfiniteProjection ) metadata.depth = 1 - metadata.depth; + // transform.position.z = metadata.depth; #else - // if ( uf::matrix::reverseInfiniteProjection ) metadata.depth = -metadata.depth; if ( metadataJson["flip uv"].as() ) for ( auto& v : vertices ) v.uv.y = 1 - v.uv.y; #endif for ( auto& v : vertices ) v.position.z = metadata.depth; @@ -443,9 +443,9 @@ void ext::Gui::load( const uf::Image& image ) { // graphic.initialize(); auto& mesh = this->getComponent(); - mesh.bind<::GuiMesh>(); + mesh.bind<::GuiMesh, uint16_t>(); mesh.insertVertices( vertices ); -// mesh.insertIndices( indices ); + mesh.insertIndices( indices ); graphic.initializeMesh( mesh ); struct { @@ -514,6 +514,9 @@ void ext::GuiBehavior::initialize( uf::Object& self ) { click.x = (click.x * 2.0f) - 1.0f; click.y = (click.y * 2.0f) - 1.0f; + #if UF_USE_OPENGL + click.y = -click.y; + #endif float x = click.x; float y = click.y; @@ -546,6 +549,10 @@ void ext::GuiBehavior::initialize( uf::Object& self ) { } ); + this->addHook( "gui:Clicked.%UID%", [&]( ext::json::Value& json ){ + pod::payloads::windowMouseClick payload; + this->callHook("gui:Clicked.%UID%", payload); + }); this->addHook( "gui:Clicked.%UID%", [&](pod::payloads::windowMouseClick& payload){ if ( ext::json::isObject( metadataJson["events"]["click"] ) ) { ext::json::Value event = metadataJson["events"]["click"]; @@ -581,6 +588,9 @@ void ext::GuiBehavior::initialize( uf::Object& self ) { click.x = (click.x * 2.0f) - 1.0f; click.y = (click.y * 2.0f) - 1.0f; + #if UF_USE_OPENGL + click.y = -click.y; + #endif float x = click.x; float y = click.y; @@ -694,12 +704,25 @@ void ext::GuiBehavior::initialize( uf::Object& self ) { const uint8_t* buffer = glyph.getBuffer(); uf::Image::container_t pixels; std::size_t len = glyph.getSize().x * glyph.getSize().y; + #if 1 || UF_ENV_DREAMCAST + pixels.reserve( len * 4 ); + for ( size_t i = 0; i < len; ++i ) { + pixels.emplace_back( buffer[i] ); + pixels.emplace_back( buffer[i] ); + pixels.emplace_back( buffer[i] ); + pixels.emplace_back( buffer[i] ); + // pixels.emplace_back( buffer[i] > 127 ? 255 : 0 ); + } + glyphHashMap[glyphKey] = atlas.addImage( &pixels[0], glyph.getSize(), 8, 4, true ); + #else pixels.reserve( len * 2 ); for ( size_t i = 0; i < len; ++i ) { pixels.emplace_back( buffer[i] ); pixels.emplace_back( buffer[i] ); + // pixels.emplace_back( buffer[i] > 127 ? 255 : 0 ); } glyphHashMap[glyphKey] = atlas.addImage( &pixels[0], glyph.getSize(), 8, 2, true ); + #endif #else glyphHashMap[glyphKey] = atlas.addImage( glyph.getBuffer(), glyph.getSize(), 8, 1, true ); #endif @@ -717,7 +740,7 @@ void ext::GuiBehavior::initialize( uf::Object& self ) { #else auto& vertices = this->getComponent>(); #endif - uf::stl::vector indices; + uf::stl::vector indices; vertices.reserve( glyphs.size() * 6 ); indices.reserve( glyphs.size() * 6 ); @@ -738,17 +761,32 @@ void ext::GuiBehavior::initialize( uf::Object& self ) { vertices.emplace_back(::GuiMesh{pod::Vector3f{ g.box.x + g.box.w, g.box.y , 0 }, atlas.mapUv( pod::Vector2f{ 1.0f, 1.0f }, hash ), color}); indices.emplace_back( indices.size() ); vertices.emplace_back(::GuiMesh{pod::Vector3f{ g.box.x + g.box.w, g.box.y + g.box.h, 0 }, atlas.mapUv( pod::Vector2f{ 1.0f, 0.0f }, hash ), color}); indices.emplace_back( indices.size() ); } + + if ( !metadataJson["world"].as() ) { + #if UF_USE_OPENGL + if ( uf::matrix::reverseInfiniteProjection ) metadata.depth = 1 - metadata.depth; + #endif + } + for ( size_t i = 0; i < vertices.size(); i += 6 ) { for ( size_t j = 0; j < 6; ++j ) { auto& vertex = vertices[i+j]; vertex.position.x /= ext::gui::size.reference.x; vertex.position.y /= ext::gui::size.reference.y; vertex.position.z = metadata.depth; + + #if UF_USE_OPENGL + vertex.position.y = -vertex.position.y; + #endif } } - mesh.bind<::GuiMesh>(); + + + graphic.descriptor.parse( metadataJson ); + + mesh.bind<::GuiMesh, uint16_t>(); mesh.insertVertices( vertices ); - // mesh.insertIndices( indices ); + mesh.insertIndices( indices ); auto& texture = graphic.material.textures.emplace_back(); texture.loadFromImage( atlas.getAtlas() ); @@ -1079,6 +1117,8 @@ void ext::GuiBehavior::GlyphMetadata::deserialize( uf::Object& self, uf::Seriali /*this->*/weight = serializer["gui"]["weight"].as(/*this->*/weight); #if UF_USE_OPENGL /*this->*/sdf = false; + /*this->*/scale *= 4.0f; + /*this->*/size /= 4.0f; #else /*this->*/sdf = serializer["gui"]["sdf"].as(/*this->*/sdf); #endif diff --git a/ext/main.cpp b/ext/main.cpp index 63d2ef61..e5884c31 100644 --- a/ext/main.cpp +++ b/ext/main.cpp @@ -121,11 +121,7 @@ void EXT_API ext::load( ext::json::Value& json ) { uf::Mesh::defaultInterleaved = json["engine"]["scenes"]["meshes"]["interleaved"].as( uf::Mesh::defaultInterleaved ); -#if UF_USE_OPENGL - uf::matrix::reverseInfiniteProjection = false; -#else uf::matrix::reverseInfiniteProjection = json["engine"]["scenes"]["matrix"]["reverseInfinite"].as( uf::matrix::reverseInfiniteProjection ); -#endif uf::graph::initialBufferElements = json["engine"]["graph"]["initial buffer elements"].as(uf::graph::initialBufferElements); @@ -250,6 +246,7 @@ void EXT_API ext::load( ext::json::Value& json ) { uf::renderer::settings::experimental::batchQueueSubmissions = configRenderExperimentalJson["batch queue submissions"].as( uf::renderer::settings::experimental::batchQueueSubmissions ); +#if UF_USE_VULKAN uf::renderer::settings::defaultStageBuffers = configRenderInvariantJson["default stage buffers"].as( uf::renderer::settings::defaultStageBuffers ); uf::renderer::settings::defaultDeferBufferDestroy = configRenderInvariantJson["default defer buffer destroy"].as( uf::renderer::settings::defaultDeferBufferDestroy ); #if 1 @@ -258,6 +255,7 @@ void EXT_API ext::load( ext::json::Value& json ) { #else uf::renderer::settings::defaultCommandBufferImmediate = configRenderInvariantJson["default command buffer immediate"].as( uf::renderer::settings::defaultCommandBufferImmediate ); #endif +#endif #if 1 uf::renderer::settings::experimental::dedicatedThread = false; ::requestDedicatedRenderThread = configRenderExperimentalJson["dedicated thread"].as( uf::renderer::settings::experimental::dedicatedThread ); @@ -795,14 +793,17 @@ void EXT_API ext::tick() { ::requestDedicatedRenderThread = true; uf::renderer::settings::experimental::dedicatedThread = false; } + #if UF_USE_VULKAN if ( ::requestDeferredCommandBufferSubmit ) { ::requestDeferredCommandBufferSubmit = true; uf::renderer::settings::defaultCommandBufferImmediate = true; } + #endif uf::renderer::synchronize(); + #if UF_USE_VULKAN uf::renderer::flushCommandBuffers(); - + #endif uf::scene::unloadScene(); /* @@ -981,12 +982,14 @@ void EXT_API ext::tick() { uf::renderer::settings::experimental::dedicatedThread = true; UF_MSG_DEBUG("Dedicated render requested"); } +#if UF_USE_VULKAN if ( ::requestDeferredCommandBufferSubmit && uf::scene::getCurrentScene().getController().getName() == "Player" ) { ::requestDeferredCommandBufferSubmit = false; uf::renderer::settings::defaultCommandBufferImmediate = false; UF_MSG_DEBUG("Defer command buffer submit requested"); } #endif +#endif } void EXT_API ext::render() { if ( uf::scene::scenes.empty() ) return;