Commit for 2023.01.27 22-55-56.7z

This commit is contained in:
mrq 2023-01-27 22:55:00 -06:00
parent f3800abb21
commit fa1e54c7f7
105 changed files with 368 additions and 4858 deletions

View File

@ -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

View File

@ -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
}
}

View File

@ -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
}
}
}
}

View File

@ -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
}
}
}
}

View File

@ -1,14 +0,0 @@
{
"assets": ["./scripts/door.lua"],
"behaviors": [
"SoundEmitterBehavior"
],
"metadata": {
"physics": {
"mass": 0,
"inertia": [0, 0, 0],
"type": "bounding box",
"recenter": true
}
}
}

View File

@ -1,8 +0,0 @@
{
"name": "Gui Manager",
"type": "Object",
"behaviors": [
"GuiManagerBehavior"
],
"ignore": false
}

View File

@ -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,
}
}

View File

@ -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
}
}

View File

@ -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
}
} )
]]

View File

@ -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
}
}
}

View File

@ -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"
]
}

View File

@ -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"
]
}

View File

@ -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"
}
}
}

View File

@ -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"
}
}

View File

@ -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"
}
}
}

View File

@ -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

View File

@ -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": "スタート"
}
}
}

View File

@ -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"
]
}

View File

@ -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"
]
}

View File

@ -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": "クローズ"
}
}
}

View File

@ -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": "コマンド"
}
}
}

View File

@ -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"
]
}

View File

@ -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"
]
}

View File

@ -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"
]
}

View File

@ -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": "終了する"
}
}
}

View File

@ -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 )

View File

@ -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
}
}
}

View File

@ -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": "「転光生」"
}
}
}

View File

@ -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
}
}

View File

@ -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
}
}

View File

@ -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"
]
}

View File

@ -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"
}
}

View File

@ -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
}
}
}

View File

@ -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": "."
}
}
}

View File

@ -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
}
}
}

View File

@ -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
}
}
}
}

View File

@ -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
}
}
}

View File

@ -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
}
}
}
}
}
}

View File

@ -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
}
}
}

View File

@ -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"
}
}
}
}

View File

@ -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
}
}
}

View File

@ -1,10 +0,0 @@
{
"name": "Scene",
"assets": [
"/gui.json"
],
"behaviors": [
"SceneBehavior",
"ExtSceneBehavior"
]
}

View File

@ -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 )

View File

@ -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 )

View File

@ -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
}
}
}

View File

@ -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
}
}

View File

@ -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": "コマンド"
}
}
}

View File

@ -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"
}
]
}
}
}

View File

@ -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"
}
]
}
}
}

View File

@ -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"
}
]
}

View File

@ -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 ]
}
}
}

View File

@ -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": "コマンド"
}
}
}

View File

@ -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
}
}
}

View File

@ -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-": {
}
}
}
}

View File

@ -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 } }
}
}
}
}

View File

@ -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 ] } }
}
}
}
}

View File

@ -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"
} }
}
}
}
}

View File

@ -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": "コマンド"
}
}
}

View File

@ -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
} }
}
}
}
}

View File

@ -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 ] } }
}

View File

@ -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 }
}
}
}
}

View File

@ -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
}
}
}
}
}

View File

@ -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" } }
}
}
}
}

View File

@ -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"
}

View File

@ -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 ] } } } }
}
}
}
}

View File

@ -1,12 +0,0 @@
{
"behaviors": [ "SoundEmitterBehavior" ],
"metadata": {
"audio": {
"spatial": true,
"loop": true,
"volume": 1,
"rolloffFactor": 1,
"streamed": true
}
}
}

View File

@ -1,13 +0,0 @@
{
"assets": [
"./scripts/camera.lua",
"./audio/soundscape/camera.ogg"
],
"metadata": {
"audio": {
"rolloffFactor": 4,
"volume": 1.0
},
"sensitivity": 10
}
}

View File

@ -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"
}
}
}

View File

@ -1,13 +0,0 @@
{
"assets": [ "./scripts/lift.lua" ],
"metadata": {
"physics": {
"type": "bounding box",
"recenter": true,
"mass": 100,
"restitution": 0,
"friction": 1
}
}
}

View File

@ -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": "コマンド"
}
}
}

View File

@ -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" } }
}
}
}
}

View File

@ -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
}
}

View File

@ -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
}
}
}
}

View File

@ -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"
}
}
}
}
}

View File

@ -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 )

View File

@ -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 )

View File

@ -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"
}
}
}

View File

@ -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]
}
}
}
}

View File

@ -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
}
}
}

View File

@ -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

View File

@ -1,2 +0,0 @@
local orientation = Quaternion()
print( orientation, orientation.x )

View File

@ -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 {

View File

@ -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);

View File

@ -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
}

View File

@ -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
}
}
}

View File

@ -2,12 +2,10 @@
#include <uf/config.h>
#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

View File

@ -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 {

View File

@ -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 )); \
} \

View File

@ -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<uf::stl::string> validationFilters;
extern UF_API uf::stl::vector<uf::stl::string> requestedDeviceFeatures;
extern UF_API uf::stl::vector<uf::stl::string> requestedDeviceExtensions;
extern UF_API uf::stl::vector<uf::stl::string> 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<uf::stl::string> filters;
}
namespace invariant {
extern UF_API bool waitOnRenderEnd;
extern UF_API bool individualPipelines;

View File

@ -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() {\

View File

@ -9,13 +9,13 @@
#include <uf/utils/camera/camera.h>
#include <uf/ext/xatlas/xatlas.h>
#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();

View File

@ -1002,10 +1002,49 @@ void uf::graph::process( pod::Graph& graph ) {
}
#endif
if ( graph.metadata["debug"]["print"]["lights"].as<bool>() ) for ( auto& pair : graph.lights ) UF_MSG_DEBUG("Light: {}", pair.first);
if ( graph.metadata["debug"]["print"]["meshes"].as<bool>() ) for ( auto& name : graph.meshes ) UF_MSG_DEBUG("Mesh: {}", name);
if ( graph.metadata["debug"]["print"]["materials"].as<bool>() ) for ( auto& name : graph.materials ) UF_MSG_DEBUG("Material: {}", name);
if ( graph.metadata["debug"]["print"]["textures"].as<bool>() ) for ( auto& name : graph.textures ) UF_MSG_DEBUG("Texture: {}", name);
if ( graph.metadata["debug"]["print"]["lights"].as<bool>() ) {
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<bool>() ) {
UF_MSG_DEBUG("Meshs: {}", graph.meshes.size());
for ( auto& name : graph.meshes ) {
UF_MSG_DEBUG("\tMesh: {}", name);
}
}
if ( graph.metadata["debug"]["print"]["instances"].as<bool>() ) {
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<bool>() ) {
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<bool>() ) {
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<bool>() ) {
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();

View File

@ -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<pod::Vector4f> 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<uint8_t*>(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<uint8_t*>(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<uint8_t*>(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<uint8_t*>(drawInfo.attributes.color.pointer) + drawInfo.attributes.color.stride * drawInfo.descriptor.inputs.vertex.first)));
} else if ( drawInfo.color.enabled ) {
colors = uf::stl::vector<pod::Vector4f>( 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<uint8_t*>(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<uint8_t*>(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<uint8_t*>(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<uint8_t*>(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<uint16_t> 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));
}

View File

@ -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<float>();
depth.bias.clamp = metadata["depth bias"]["clamp"].as<float>();
}
depth.test = metadata["depth test"].as<bool>( depth.test );
depth.write = metadata["depth write"].as<bool>( 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<decltype(inputs.indirect.attributes[i].descriptor.offset)>{}(inputs.indirect.attributes[i].descriptor.offset);
}
*/
/*
hash += std::hash<decltype(topology)>{}(topology);
hash += std::hash<decltype(cullMode)>{}(cullMode);
hash += std::hash<decltype(fill)>{}(fill);
@ -555,6 +578,7 @@ ext::opengl::GraphicDescriptor::hash_t ext::opengl::GraphicDescriptor::hash() co
hash += std::hash<decltype(depth.bias.constant)>{}(depth.bias.constant);
hash += std::hash<decltype(depth.bias.slope)>{}(depth.bias.slope);
hash += std::hash<decltype(depth.bias.clamp)>{}(depth.bias.clamp);
*/
return hash;
}

View File

@ -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<uf::stl::string> ext::opengl::settings::validationFilters;
uf::stl::vector<uf::stl::string> ext::opengl::settings::requestedDeviceFeatures;
uf::stl::vector<uf::stl::string> ext::opengl::settings::requestedDeviceExtensions;
uf::stl::vector<uf::stl::string> 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<uf::stl::string> 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::RenderMode*> ext::opengl::getRenderModes( const uf::stl::string& name, bool isName ) {
return ext::opengl::getRenderModes({name}, isName);
return ext::opengl::getRenderModes(uf::stl::vector<uf::stl::string>{name}, isName);
}
uf::stl::vector<ext::opengl::RenderMode*> ext::opengl::getRenderModes( const uf::stl::vector<uf::stl::string>& names, bool isName ) {
uf::stl::vector<RenderMode*> 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);
}

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -256,7 +256,7 @@ ext::vulkan::RenderMode& ext::vulkan::getRenderMode( const uf::stl::string& name
}
uf::stl::vector<ext::vulkan::RenderMode*> 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<uf::stl::string>{name}, isName);
}
uf::stl::vector<ext::vulkan::RenderMode*> ext::vulkan::getRenderModes( const uf::stl::vector<uf::stl::string>& names, bool isName ) {
uf::stl::vector<RenderMode*> targets;

Some files were not shown because too many files have changed in this diff Show More