Commit for 2022.05.05 01-14-35.7z

This commit is contained in:
mrq 2022-05-05 01:14:00 -05:00
parent ccf743d344
commit c8853dc1b8
51 changed files with 287 additions and 270 deletions

View File

@ -4,10 +4,13 @@ TARGET_NAME = program
TARGET_EXTENSION = exe
TARGET_LIB_EXTENSION = dll
RENDERER = vulkan
PREFIX = $(ARCH).$(CC)
include makefiles/$(ARCH).$(CC).make
include makefiles/$(PREFIX).make
.PHONY: $(ARCH)-$(CC)
.PHONY: $(ARCH)-$(CC)
.FORCE:
CXX := $(CDIR)$(CXX)
BIN_DIR += ./bin
@ -48,11 +51,11 @@ LINKS += $(UF_LIBS) $(EXT_LIBS) $(DEPS)
DEPS +=
ifneq (,$(findstring win64,$(ARCH)))
REQ_DEPS += $(RENDERER) json:nlohmann png zlib openal ogg freetype ncurses curl luajit reactphysics meshoptimizer xatlas simd ctti # openvr draco discord bullet ultralight-ux
REQ_DEPS += $(RENDERER) json:nlohmann png zlib openal ogg freetype curl luajit reactphysics meshoptimizer xatlas simd ctti # ncurses openvr draco discord bullet ultralight-ux
FLAGS +=
DEPS += -lgdi32
else ifneq (,$(findstring dreamcast,$(ARCH)))
REQ_DEPS += simd opengl gldc json:nlohmann lua reactphysics freetype png zlib ctti ogg openal aldc # bullet meshoptimizer draco luajit ultralight-ux ncurses curl openvr discord
REQ_DEPS += simd opengl gldc json:nlohmann lua reactphysics png zlib ctti ogg openal aldc # freetype bullet meshoptimizer draco luajit ultralight-ux ncurses curl openvr discord
endif
ifneq (,$(findstring vulkan,$(REQ_DEPS)))
FLAGS += -DVK_USE_PLATFORM_WIN32_KHR -DUF_USE_VULKAN
@ -116,9 +119,6 @@ endif
ifneq (,$(findstring freetype,$(REQ_DEPS)))
FLAGS += -DUF_USE_FREETYPE
DEPS += -lfreetype -lbz2
ifneq (,$(findstring dreamcast,$(ARCH)))
DEPS += -lbrotlicommon-static -lbrotlidec-static
endif
endif
ifneq (,$(findstring ncurses,$(REQ_DEPS)))
FLAGS += -DUF_USE_NCURSES
@ -192,7 +192,7 @@ endif
# 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 += $(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) $(wildcard $(EXT_SRC_DIR)/*.cpp) $(wildcard $(EXT_SRC_DIR)/*/*.cpp) $(wildcard $(EXT_SRC_DIR)/*/*/*.cpp) $(wildcard $(EXT_SRC_DIR)/*/*/*/*.cpp) $(wildcard $(EXT_SRC_DIR)/*/*/*/*/*.cpp)
OBJS_DLL += $(patsubst %.cpp,%.$(ARCH).$(CC).o,$(SRCS_DLL))
OBJS_DLL += $(patsubst %.cpp,%.$(PREFIX).o,$(SRCS_DLL))
BASE_DLL += lib$(LIB_NAME)
IM_DLL += $(ENGINE_LIB_DIR)/$(ARCH)/$(CC)/$(BASE_DLL).$(TARGET_LIB_EXTENSION).a
EX_DLL += $(BIN_DIR)/exe/lib/$(ARCH)/$(CC)/$(BASE_DLL).$(TARGET_LIB_EXTENSION)
@ -208,13 +208,13 @@ EXT_INCS += -I$(ENGINE_INC_DIR) -I$(EXT_INC_DIR) -I$(VULKAN_SDK_PATH)/includ
EXT_LIBS += -L$(ENGINE_LIB_DIR) -L$(EXT_LIB_DIR) -L$(EXT_LIB_DIR)/$(CC) -L$(VULKAN_SDK_PATH)/Lib -L/mingw64/lib
SRCS_EXT_DLL += $(wildcard $(EXT_SRC_DIR)/*.cpp) $(wildcard $(EXT_SRC_DIR)/*/*.cpp) $(wildcard $(EXT_SRC_DIR)/*/*/*.cpp) $(wildcard $(EXT_SRC_DIR)/*/*/*/*.cpp) $(wildcard $(EXT_SRC_DIR)/*/*/*/*/*.cpp)
OBJS_EXT_DLL += $(patsubst %.cpp,%.$(ARCH).$(CC).o,$(SRCS_EXT_DLL))
OBJS_EXT_DLL += $(patsubst %.cpp,%.$(PREFIX).o,$(SRCS_EXT_DLL))
BASE_EXT_DLL += lib$(EXT_LIB_NAME)
EXT_IM_DLL += $(ENGINE_LIB_DIR)/$(ARCH)/$(CC)/$(BASE_EXT_DLL).$(TARGET_LIB_EXTENSION).a
EXT_EX_DLL += $(BIN_DIR)/exe/lib/$(ARCH)/$(CC)/$(BASE_EXT_DLL).$(TARGET_LIB_EXTENSION)
# Client EXE
SRCS += $(wildcard $(CLIENT_SRC_DIR)/*.cpp) $(wildcard $(CLIENT_SRC_DIR)/*/*.cpp)
OBJS += $(patsubst %.cpp,%.$(ARCH).$(CC).o,$(SRCS))
OBJS += $(patsubst %.cpp,%.$(PREFIX).o,$(SRCS))
TARGET += $(BIN_DIR)/exe/$(TARGET_NAME).$(CC).$(TARGET_EXTENSION)
# Shaders
SRCS_SHADERS += $(wildcard bin/data/shaders/*.glsl) $(wildcard bin/data/shaders/*/*.glsl) $(wildcard bin/data/shaders/*/*/*.glsl)
@ -225,12 +225,12 @@ ifneq (,$(findstring dreamcast,$(ARCH)))
$(ARCH): $(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)
OBJS_DLL = $(patsubst %.cpp,%.$(ARCH).$(CC).o,$(SRCS_DLL))
OBJS = $(patsubst %.cpp,%.$(ARCH).$(CC).o,$(SRCS_DLL)) $(patsubst %.cpp,%.$(ARCH).$(CC).o,$(SRCS_EXT_DLL)) $(patsubst %.cpp,%.$(ARCH).$(CC).o,$(SRCS))
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))
DEPS += -lkallisti -lc -lm -lgcc -lstdc++ # -l$(LIB_NAME) -l$(EXT_LIB_NAME)
%.$(ARCH).$(CC).o: %.cpp
%.$(PREFIX).o: %.cpp
$(CXX) $(FLAGS) $(INCS) -c $< -o $@
$(EX_DLL): FLAGS += -DUF_EXPORTS -DJSON_DLL_BUILD
@ -253,15 +253,19 @@ $(EXT_EX_DLL): $(OBJS_EXT_DLL)
$(TARGET): $(OBJS) #./bin/dreamcast/romdisk.o
# $(CXX) -O2 -fomit-frame-pointer -ml -m4-single-only -ffunction-sections -fdata-sections $(KOS_INC_PATHS) $(INCS) -D_arch_dreamcast -D_arch_sub_pristine -Wall -fno-builtin -ml -m4-single-only -Wl,-Ttext=0x8c010000 -Wl,--gc-sections -T/opt/dreamcast/kos/utils/ldscripts/shlelf.xc -nodefaultlibs $(KOS_LIB_PATHS) $(LIBS) -o $(TARGET) $(OBJS) ./bin/dreamcast/romdisk.o -Wl,--start-group $(DEPS) -Wl,--end-group
$(CXX) -O2 -fomit-frame-pointer -ml -m4-single-only -ffunction-sections -fdata-sections $(KOS_INC_PATHS) $(INCS) -D_arch_dreamcast -D_arch_sub_pristine -Wall -fno-builtin -ml -m4-single-only -Wl,-Ttext=0x8c010000 -Wl,--gc-sections -T/opt/dreamcast/kos/utils/ldscripts/shlelf.xc -nodefaultlibs $(KOS_LIB_PATHS) $(LIBS) -o $(TARGET) $(OBJS) -Wl,--start-group $(DEPS) -Wl,--end-group
# $(CXX) -O2 -fomit-frame-pointer -ml -m4-single-only -ffunction-sections -fdata-sections $(KOS_INC_PATHS) $(INCS) -D_arch_dreamcast -D_arch_sub_pristine -Wall -fno-builtin -ml -m4-single-only -Wl,-Ttext=0x8c010000 -Wl,--gc-sections -T/opt/dreamcast/kos/utils/ldscripts/shlelf.xc -nodefaultlibs $(KOS_LIB_PATHS) $(LIBS) -o $(TARGET) $(OBJS) -Wl,--start-group $(DEPS) -Wl,--end-group
$(CXX) -ffunction-sections -fdata-sections $(KOS_INC_PATHS) $(INCS) -D_arch_dreamcast -D_arch_sub_pristine -Wall -fno-builtin -ml -m4-single-only -Wl,-Ttext=0x8c010000 -Wl,--gc-sections -T/opt/dreamcast/kos/utils/ldscripts/shlelf.xc -nodefaultlibs $(KOS_LIB_PATHS) $(LIBS) -o $(TARGET) $(OBJS) -Wl,--start-group $(DEPS) -Wl,--end-group
./bin/dreamcast/$(TARGET_NAME).cdi: $(TARGET)
cd ./bin/dreamcast/; ./elf2cdi.sh $(TARGET_NAME)
cdi:
cd ./bin/dreamcast/; ./elf2cdi.sh $(TARGET_NAME)
else
$(ARCH): $(EX_DLL) $(TARGET) $(TARGET_SHADERS)
%.$(ARCH).$(CC).o: %.cpp
%.$(PREFIX).o: %.cpp
$(CXX) $(FLAGS) $(INCS) -c $< -o $@
$(EX_DLL): FLAGS += -DUF_EXPORTS -DEXT_EXPORTS -DJSON_DLL_BUILD
@ -278,6 +282,7 @@ $(EXT_EX_DLL): $(OBJS_EXT_DLL)
$(TARGET): $(OBJS)
$(CXX) $(FLAGS) $(OBJS) $(LIBS) $(INCS) $(LINKS) -l$(LIB_NAME) -o $(TARGET)
# $(CXX) $(FLAGS) $(OBJS) $(LIBS) $(INCS) $(LINKS) -l$(LIB_NAME) -o $(TARGET)
# $(CXX) $(FLAGS) $(OBJS) $(LIBS) $(INCS) $(LINKS) -l$(LIB_NAME) -l$(EXT_LIB_NAME) -o $(TARGET)
endif

View File

@ -1,17 +1,17 @@
{
"engine": {
"scenes": {
"start": "SH2_McDonalds",
"start": "SS2",
"meshes": { "interleave": false },
"matrix": { "reverseInfinite": true },
"lights": {
"max": 24,
"max": 12,
"enabled": true
},
"shadows": {
"enabled": true,
"update": 4,
"max": 12,
"max": 6,
"samples": 2,
"experimental mode": 1
},
@ -26,8 +26,8 @@
"limiter": 2,
"size": 96,
"dispatch": 8,
"cascades": 4,
"cascadePower": 2,
"cascades": 2,
"cascadePower": 4,
"shadows": 0,
"granularity": 4,
"extents": {
@ -64,7 +64,7 @@
// "size": [ 1280, 720 ],
// "size": [ 960, 540 ],
// "size": [ 640, 480 ],
"msaa": 0
"msaa": 1
},
"experimental": {
"rebuild on tick begin": false,
@ -75,10 +75,10 @@
"deferred mode": "",
"deferred reconstruct position": true,
"deferred alias output to swapchain": false,
"vsync": true,
"hdr": true,
"vsync": false,
"hdr": false,
"vxgi": true,
"deferred sampling": true, // broken for some scenes
"deferred sampling": true,
"culling": true,
"bloom": false
},
@ -244,12 +244,12 @@
"cursor" : {
"visible" : true,
"center" : false,
"sensitivity": [ 1, 1 ]
"sensitivity": [ 0.5, 0.5 ]
},
"mode" : "windowed", // fullscreen, borderless, windowed
"icon" : "./data/textures/icon.png",
// "size" : [ 1920, 1080 ],
"size" : [ 1280, 720 ],
"size" : [ 1920, 1080 ],
// "size" : [ 1280, 720 ],
// "size" : [ 960, 540 ],
// "size" : [ 640, 480 ],
// "size" : [ 256, 224 ],

View File

@ -34,7 +34,7 @@
},
"grid": {
"/^worldspawn/": {
"size": [3,3,3],
"size": [6,6,6],
// "epsilon": 0.01,
"cleanup": true,
"print": true

View File

@ -1,7 +1,7 @@
{
"type": "Object",
"name": "Player: Model",
"ignore": false,
"ignore": true,
"assets": [
"/player/bear.glb"
// { "filename": "/player/bear/graph.json", "delay": 0, "single threaded": false, "category": "models" }

View File

@ -26,9 +26,9 @@
},
"bloom": {
"scale": 1.0,
"strength": 0.125,
"sigma": 0.75,
"samples": 8
"strength": 1.0,
"sigma": 2.0,
"samples": 2
},
"light": {
"exposure": 1.0,

View File

@ -3,14 +3,28 @@
"assets": [
// { "filename": "./static.json", "delay": 8 },
// { "filename": "./models/sh_mcd.glb", "delay": 0, "single threaded": false }
{ "filename": "./models/sh_mcd.glb", "delay": 0, "single threaded": false }
// { "filename": "./models/sh_mcd/graph.json", "delay": 0, "single threaded": false, "category": "models" }
{ "filename": "./models/sh_mcd/graph.json.gz", "delay": 0, "single threaded": false, "category": "models" }
// { "filename": "./models/sh_mcd/graph.json.gz", "delay": 0, "single threaded": false, "category": "models" }
],
"metadata": {
"model": {
"cull mode": "none",
"alpha mode": "BLEND",
"grid": {
"/^worldspawn/": {
"size": [4,4,4],
// "epsilon": 0.01,
"cleanup": true,
"print": true
},
"/^worldspawn_sh2/": {
"size": [32,32,32],
// "epsilon": 0.01,
"cleanup": true,
"print": true
}
},
"tags": {
"worldspawn": { "physics": { "type": "mesh", "static": true } },
// "worldspawn_sh2": { "physics": { "type": "mesh", "static": true } },

View File

@ -3,7 +3,7 @@
"assets": [
// { "filename": "./models/tiny_msci.glb", "delay": 0, "single threaded": false, "category": "models" }
// { "filename": "./models/tiny_msci/graph.json", "delay": 0, "single threaded": false, "category": "models" }
// { "filename": "./models/tiny_msci/graph.json.gz", "delay": 0, "single threaded": false, "category": "models" }
{ "filename": "./models/tiny_msci/graph.json.gz", "delay": 0, "single threaded": false, "category": "models" }
// { "filename": "./models/micro_sci.glb", "delay": 0, "single threaded": false, "category": "models" }
// { "filename": "./models/micro_sci/graph.json", "delay": 0, "single threaded": false, "category": "models" }
@ -14,7 +14,7 @@
// { "filename": "./models/msci/graph.json", "delay": 0, "single threaded": false, "category": "models" }
// { "filename": "./models/msci/graph.json.gz", "delay": 0, "single threaded": false, "category": "models" }
{ "filename": "./models/medsci.glb", "delay": 0, "single threaded": false }
// { "filename": "./models/medsci.glb", "delay": 0, "single threaded": false }
// { "filename": "./models/medsci/graph.json", "delay": 0, "single threaded": false, "category": "models" }
// { "filename": "./models/medsci/graph.json.gz", "delay": 0, "single threaded": false, "category": "models" }
],
@ -30,6 +30,7 @@
"trigger": { "mode": "rendered" },
"output": "./lightmap.png"
},
// "lightmap": "./lightmap.min.png",
"filter": "NEAREST",
"tags": {
"worldspawn": { "physics": { "type": "mesh", "static": true } },

View File

@ -41,7 +41,7 @@ layout (constant_id = 1) const uint CUBEMAPS = 128;
#include "../common/structs.h"
layout (binding = 4) uniform UBO {
layout (binding = 5) uniform UBO {
EyeMatrices eyes[2];
Mode mode;
@ -67,30 +67,30 @@ layout (binding = 4) uniform UBO {
uint padding3;
} ubo;
/*
layout (std140, binding = 5) readonly buffer DrawCommands {
layout (std140, binding = 6) readonly buffer DrawCommands {
DrawCommand drawCommands[];
};
*/
layout (std140, binding = 5) readonly buffer Instances {
layout (std140, binding = 6) readonly buffer Instances {
Instance instances[];
};
layout (std140, binding = 6) readonly buffer Materials {
layout (std140, binding = 7) readonly buffer Materials {
Material materials[];
};
layout (std140, binding = 7) readonly buffer Textures {
layout (std140, binding = 8) readonly buffer Textures {
Texture textures[];
};
layout (std140, binding = 8) readonly buffer Lights {
layout (std140, binding = 9) readonly buffer Lights {
Light lights[];
};
layout (binding = 9) uniform sampler2D samplerTextures[TEXTURES];
layout (binding = 10) uniform samplerCube samplerCubemaps[CUBEMAPS];
layout (binding = 11) uniform sampler3D samplerNoise;
layout (binding = 10) uniform sampler2D samplerTextures[TEXTURES];
layout (binding = 11) uniform samplerCube samplerCubemaps[CUBEMAPS];
layout (binding = 12) uniform sampler3D samplerNoise;
#if VXGI
layout (binding = 12) uniform usampler3D voxelId[CASCADES];
layout (binding = 13) uniform sampler3D voxelNormal[CASCADES];
layout (binding = 14) uniform sampler3D voxelRadiance[CASCADES];
layout (binding = 13) uniform usampler3D voxelId[CASCADES];
layout (binding = 14) uniform sampler3D voxelNormal[CASCADES];
layout (binding = 15) uniform sampler3D voxelRadiance[CASCADES];
#endif
layout (location = 0) in vec2 inUv;
@ -210,10 +210,10 @@ void populateSurface() {
{
#if !MULTISAMPLING
const vec4 uv = subpassLoad(samplerUv);
const vec2 mips = vec2(0); // subpassLoad(samplerMips).xy;
const vec2 mips = subpassLoad(samplerMips).xy;
#else
const vec4 uv = subpassLoad(samplerUv, msaa.currentID); // resolve(samplerUv, ubo.msaa);
const vec2 mips = vec2(0); // subpassLoad(samplerMips, msaa.currentID).xy; // resolve(samplerUv, ubo.msaa);
const vec2 mips = subpassLoad(samplerMips, msaa.currentID).xy; // resolve(samplerUv, ubo.msaa);
#endif
surface.uv.xy = uv.xy;
surface.uv.z = mips.x;

View File

@ -1,4 +1,4 @@
#include <uf/utils/type/type.h>
// #include <uf/utils/type/type.h>
template<typename C>
typename pod::NamedTypes<C>::type_t pod::NamedTypes<C>::getType( const uf::stl::string& name ) {

View File

@ -1,5 +1,9 @@
#pragma once
#include <uf/config.h>
#if UF_USE_GLTF
#include <uf/engine/graph/graph.h>
#include <uf/engine/object/object.h>
@ -8,4 +12,5 @@ namespace ext {
pod::Graph UF_API load( const uf::stl::string&, const uf::Serializer& = {} );
void UF_API save( const uf::stl::string&, const pod::Graph& );
}
}
}
#endif

View File

@ -1,7 +1,7 @@
#pragma once
#include <uf/config.h>
#if !UF_USE_NCURSES
#include <uf/utils/memory/string.h>
namespace ext {
@ -51,4 +51,5 @@ namespace ext {
inline void UF_API_CALL attribute(int att, bool on = true) { on ? this->attrOn(att) : this->attrOff(att); }
};
extern UF_API ext::Ncurses ncurses;
}
}
#endif

View File

@ -2,9 +2,11 @@
#include <uf/engine/graph/graph.h>
#if UF_USE_XATLAS
namespace ext {
namespace xatlas {
pod::Vector2ui UF_API unwrap( uf::stl::vector<uf::graph::mesh::Skinned>& vertices, uf::stl::vector<uint32_t>& indices );
pod::Vector2ui UF_API unwrap( pod::Graph& );
}
}
}
#endif

View File

@ -8,27 +8,10 @@
namespace spec {
namespace dreamcast {
class UF_API Window : public spec::uni::Window {
public:
typedef size_t handle_t;
protected:
spec::dreamcast::Window::handle_t m_handle;
// size_t m_cursor;
// size_t m_icon;
spec::dreamcast::Window::vector_t m_lastSize;
bool m_keyRepeatEnabled;
bool m_resizing;
bool m_mouseInside;
bool m_mouseGrabbed;
uint16_t m_surrogate;
bool m_syncParse;
bool m_asyncParse;
public:
// C-tors
UF_API Window();
UF_API Window( spec::dreamcast::Window::handle_t );
UF_API Window( const spec::dreamcast::Window::vector_t& size, const spec::dreamcast::Window::title_t& title = L"Window" );
/*virtual*/ void UF_API create( const spec::dreamcast::Window::vector_t& size, const spec::dreamcast::Window::title_t& title = L"Window" );
/*virtual*/ void UF_API create( const spec::dreamcast::Window::vector_t& size, const spec::dreamcast::Window::title_t& title = "" );
// D-tors
/*virtual*/ ~Window();
void UF_API terminate();

View File

@ -1,7 +1,7 @@
#pragma once
#include <uf/config.h>
#if UF_USE_UNUSED
#include "./collision/gjk.h"
#include "./collision/boundingbox.h"
#include "./collision/sphere.h"
@ -27,4 +27,5 @@ namespace uf {
uf::stl::vector<pod::Collider::Manifold> intersects( const uf::Collider&, bool = false ) const;
uf::stl::vector<pod::Collider::Manifold> intersects( const pod::Collider&, bool = false ) const;
};
}
}
#endif

View File

@ -1,5 +1,6 @@
#pragma once
#if UF_USE_UNUSED
#include "gjk.h"
namespace uf {
@ -24,4 +25,5 @@ namespace uf {
virtual pod::Vector3 support( const pod::Vector3& ) const;
pod::Collider::Manifold intersects( const uf::BoundingBox& ) const;
};
}
}
#endif

View File

@ -2,6 +2,7 @@
#include <uf/config.h>
#if UF_USE_UNUSED
#include <uf/utils/math/vector.h>
#include <uf/utils/math/transform.h>
@ -85,4 +86,5 @@ namespace pod {
const pod::Transform<>& getTransform() const;
void setTransform( const pod::Transform<>& );
};
}
}
#endif

View File

@ -1,5 +1,6 @@
#pragma once
#if UF_USE_UNUSED
#include "gjk.h"
#include <uf/utils/mesh/mesh.h>
@ -32,4 +33,5 @@ namespace uf {
virtual pod::Vector3* expand() const;
virtual pod::Vector3 support( const pod::Vector3& ) const;
};
}
}
#endif

View File

@ -1,5 +1,6 @@
#pragma once
#if UF_USE_UNUSED
#include "gjk.h"
#include <functional>
@ -31,4 +32,5 @@ namespace uf {
virtual pod::Vector3* expand() const;
virtual pod::Vector3 support( const pod::Vector3& ) const;
};
}
}
#endif

View File

@ -1,5 +1,6 @@
#pragma once
#if UF_USE_UNUSED
#include "gjk.h"
namespace uf {
@ -21,4 +22,5 @@ namespace uf {
virtual pod::Vector3 support( const pod::Vector3& ) const;
pod::Collider::Manifold intersects( const uf::SphereCollider& ) const;
};
}
}
#endif

View File

@ -1 +0,0 @@
#pragma once

View File

@ -9,6 +9,8 @@
#include <uf/utils/memory/vector.h>
#include <uf/utils/memory/string.h>
#include <uf/utils/memory/map.h>
#include <uf/utils/memory/unordered_map.h>
#include <uf/utils/memory/queue.h>
#include <functional>

View File

@ -1 +0,0 @@
#pragma once

View File

@ -15,6 +15,7 @@
#include <uf/utils/thread/thread.h>
#include <uf/ext/lua/lua.h>
#include <uf/ext/gltf/gltf.h>
#include <uf/engine/graph/graph.h>
#include <mutex>
@ -284,10 +285,12 @@ uf::stl::string uf::Asset::load(const uf::Asset::Payload& payload ) {
UF_ASSET_REGISTER(uf::Serializer)
asset.readFromFile(filename);
} break;
#if UF_USE_LUA
case uf::Asset::Type::LUA: {
UF_ASSET_REGISTER(pod::LuaScript)
asset = ext::lua::script( filename );
} break;
#endif
case uf::Asset::Type::GRAPH: {
UF_ASSET_REGISTER(pod::Graph)
auto& metadata = this->getComponent<uf::Serializer>();

View File

@ -271,7 +271,9 @@ pod::Graph uf::graph::load( const uf::stl::string& filename, const uf::Serialize
#define UF_DEBUG_TIMER_MULTITRACE_END(...)
#endif
const uf::stl::string extension = uf::io::extension( filename );
#if UF_USE_GLTF
if ( extension == "glb" || extension == "gltf" ) return ext::gltf::load( filename, metadata );
#endif
const uf::stl::string directory = uf::io::directory( filename ) + "/";
pod::Graph graph;
uf::Serializer serializer;

View File

@ -236,11 +236,13 @@ void uf::graph::save( const pod::Graph& graph, const uf::stl::string& filename )
/*.filename = */directory + "/graph.json",
};
if ( !settings.combined ) uf::io::mkdir(directory);
#if UF_USE_XATLAS
if ( settings.unwrap ) {
pod::Graph& g = const_cast<pod::Graph&>(graph);
auto size = ext::xatlas::unwrap( g );
serializer["wrapped"] = uf::vector::encode( size );
}
#endif
pod::Thread::container_t jobs;
jobs.emplace_back([&]{

View File

@ -205,6 +205,12 @@ bool uf::Object::load( const uf::Serializer& _json ) {
{
if ( ext::json::isObject( json["physics"] ) && !this->hasComponent<pod::Physics>() ) {
auto& physics = this->getComponent<pod::Physics>();
physics.linear.velocity = uf::vector::decode( json["physics"]["linear"]["velocity"], physics.linear.velocity );
physics.linear.acceleration = uf::vector::decode( json["physics"]["linear"]["acceleration"], physics.linear.acceleration );
physics.rotational.velocity = uf::vector::decode( json["physics"]["rotational"]["velocity"], physics.rotational.velocity );
physics.rotational.acceleration = uf::vector::decode( json["physics"]["rotational"]["acceleration"], physics.rotational.acceleration );
/*
if ( ext::json::isArray( json["physics"]["linear"]["velocity"] ) )
for ( size_t j = 0; j < 3; ++j )
physics.linear.velocity[j] = json["physics"]["linear"]["velocity"][j].as<float>();
@ -218,9 +224,58 @@ bool uf::Object::load( const uf::Serializer& _json ) {
if ( ext::json::isArray( json["physics"]["rotational"]["acceleration"] ) )
for ( size_t j = 0; j < 4; ++j )
physics.rotational.acceleration[j] = json["physics"]["rotational"]["acceleration"][j].as<float>();
*/
}
}
#define ASSET_ENTRY(type) { uf::string::lowercase(#type), uf::Asset::Type::type }
const uf::stl::unordered_map<uf::stl::string, uf::Asset::Type> assets = {
ASSET_ENTRY(AUDIO),
ASSET_ENTRY(IMAGE),
ASSET_ENTRY(GRAPH),
ASSET_ENTRY(LUA),
};
for ( auto& pair : assets ) {
auto& assetType = pair.second;
auto& assetTypeString = pair.first;
uf::Serializer target;
bool override = false;
if ( ext::json::isObject( metadataJson["system"]["assets"] ) ) {
target = metadataJson["system"]["assets"];
} else if ( ext::json::isArray( json["assets"] ) ) {
target = json["assets"];
} else if ( ext::json::isObject( json["assets"] ) && !ext::json::isNull( json["assets"][assetTypeString] ) ) {
target = json["assets"][assetTypeString];
}
for ( size_t i = 0; i < target.size(); ++i ) {
bool isObject = ext::json::isObject( target[i] );
uf::stl::string f = isObject ? target[i]["filename"].as<uf::stl::string>() : target[i].as<uf::stl::string>();
uf::stl::string filename = uf::io::resolveURI( f, metadata.system.root );
uf::stl::string mime = isObject ? target[i]["mime"].as<uf::stl::string>("") : "";
uf::Asset::Payload payload = uf::Asset::resolveToPayload( filename, mime );
if ( !uf::Asset::isExpected( payload, assetType ) ) continue;
payload.hash = isObject ? target[i]["hash"].as<uf::stl::string>("") : "";
payload.monoThreaded = isObject ? target[i]["single threaded"].as<bool>() : false;
this->queueHook( "asset:QueueLoad.%UID%", payload, isObject ? target[i]["delay"].as<float>() : 0 );
bool bind = isObject && target[i]["bind"].is<bool>() ? target[i]["bind"].as<bool>() : true;
switch ( assetType ) {
case uf::Asset::Type::LUA: {
if ( bind ) uf::instantiator::bind("LuaBehavior", *this);
} break;
case uf::Asset::Type::GRAPH: {
auto& aMetadata = assetLoader.getComponent<uf::Serializer>();
aMetadata[filename] = json["metadata"]["model"];
aMetadata[filename]["root"] = json["root"];
if ( bind ) uf::instantiator::bind("GraphBehavior", *this);
} break;
}
}
}
/*
#define UF_OBJECT_LOAD_ASSET_HEADER(type)\
uf::Asset::Type assetType = uf::Asset::Type::type;\
uf::stl::string assetTypeString = uf::string::lowercase( #type );\
@ -276,6 +331,7 @@ bool uf::Object::load( const uf::Serializer& _json ) {
if ( bind ) uf::instantiator::bind("LuaBehavior", *this);
}
}
*/
// Bind behaviors
{
@ -307,7 +363,15 @@ bool uf::Object::load( const uf::Serializer& _json ) {
// check for children
{
UF_OBJECT_LOAD_ASSET_HEADER(JSON)
uf::Serializer target;
bool override = false;
if ( ext::json::isObject( metadataJson["system"]["assets"] ) ) {
target = metadataJson["system"]["assets"];
} else if ( ext::json::isArray( json["assets"] ) ) {
target = json["assets"];
} else if ( ext::json::isObject( json["assets"] ) && !ext::json::isNull( json["assets"]["json"] ) ) {
target = json["assets"]["json"];
}
for ( size_t i = 0; i < target.size(); ++i ) {
uf::stl::string f = ext::json::isObject( target[i] ) ? target[i]["filename"].as<uf::stl::string>() : target[i].as<uf::stl::string>();
uf::stl::string filename = uf::io::resolveURI( f, metadata.system.root );
@ -339,6 +403,7 @@ bool uf::Object::load( const uf::Serializer& _json ) {
}
}
// Add lights
#if UF_USE_UNUSED
if ( ext::json::isArray( metadataJson["system"]["lights"] ) ) {
uf::Serializer target = metadataJson["system"]["lights"];
auto& pTransform = this->getComponent<pod::Transform<>>();
@ -357,7 +422,7 @@ bool uf::Object::load( const uf::Serializer& _json ) {
light->initialize();
}
}
#endif
return true;
}
uf::Object& uf::Object::loadChild( const uf::stl::string& f, bool initialize ) {

View File

@ -1,5 +1,5 @@
#include <uf/config.h>
#if UF_USE_GLTF
#define TINYGLTF_IMPLEMENTATION
#if UF_JSON_USE_NLOHMANN
@ -503,4 +503,5 @@ pod::Graph ext::gltf::load( const uf::stl::string& filename, const uf::Serialize
if ( graph.metadata["exporter"]["enabled"].as<bool>() ) uf::graph::save( graph, filename );
return graph;
}
}
#endif

View File

@ -1,4 +1,5 @@
#include <uf/ext/lua/lua.h>
#if 0
#if UF_USE_LUA
#include <uf/utils/audio/audio.h>
UF_LUA_REGISTER_USERTYPE(uf::Audio,
@ -30,4 +31,5 @@ UF_LUA_REGISTER_USERTYPE(uf::Audio,
UF_LUA_REGISTER_USERTYPE_MEMBER_FUN( uf::Audio::getVolume ),
UF_LUA_REGISTER_USERTYPE_MEMBER_FUN( uf::Audio::getFilename )
)
#endif
#endif

View File

@ -2,7 +2,7 @@
ext::Ncurses ext::ncurses;
#if defined(UF_USE_NCURSES)
#if UF_USE_NCURSES
#include <ncursesw/ncurses.h>
#include <uf/spec/terminal/terminal.h>
#include <locale.h>

View File

@ -356,15 +356,32 @@ void ext::opengl::Graphic::record( CommandBuffer& commandBuffer, const GraphicDe
}
}
auto uniformBufferIt = uniformBuffers.begin();
auto uniformBuffer = (*uniformBufferIt++).buffer;
pod::Camera::Viewports* viewports = (pod::Camera::Viewports*) device->getBuffer( uniformBuffer );
CommandBuffer::InfoDraw drawCommandInfoBase = {};
drawCommandInfoBase.type = ext::opengl::enums::Command::DRAW;
drawCommandInfoBase.descriptor = descriptor;
drawCommandInfoBase.attributes.index = descriptor.inputs.index.attributes.front();
for ( uf::Mesh::Attribute attribute : descriptor.inputs.vertex.attributes ) {
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;
}
drawCommandInfoBase.attributes.index = descriptor.inputs.index.attributes.front();
drawCommandInfoBase.matrices.view = &viewports->matrices[0].view;
drawCommandInfoBase.matrices.projection = &viewports->matrices[0].projection;
#if 1
if ( descriptor.inputs.indirect.count ) {
auto& indirectAttribute = descriptor.inputs.indirect.attributes.front();
auto uniformBufferIt = uniformBuffers.begin();
auto storageBufferIt = storageBuffers.begin();
auto uniformBuffer = (*uniformBufferIt++).buffer;
storageBufferIt++;
storageBufferIt++;
@ -372,7 +389,6 @@ void ext::opengl::Graphic::record( CommandBuffer& commandBuffer, const GraphicDe
auto materialBuffer = (*storageBufferIt++).buffer;
auto textureBuffer = (*storageBufferIt++).buffer;
pod::Camera::Viewports* viewports = (pod::Camera::Viewports*) device->getBuffer( uniformBuffer );
pod::DrawCommand* drawCommands = (pod::DrawCommand*) indirectAttribute.pointer;
pod::Instance* instances = (pod::Instance*) device->getBuffer( instanceBuffer );
pod::Material* materials = (pod::Material*) device->getBuffer( materialBuffer );
@ -389,10 +405,23 @@ void ext::opengl::Graphic::record( CommandBuffer& commandBuffer, const GraphicDe
auto textureID = material.indexAlbedo;
auto& infos = pool[textureID];
CommandBuffer::InfoDraw& drawCommandInfo = infos.emplace_back();
CommandBuffer::InfoDraw& drawCommandInfo = infos.emplace_back( drawCommandInfoBase );
/*
drawCommandInfo.type = ext::opengl::enums::Command::DRAW;
drawCommandInfo.descriptor = descriptor;
drawCommandInfo.attributes.index = descriptor.inputs.index.attributes.front();
for ( uf::Mesh::Attribute attribute : descriptor.inputs.vertex.attributes ) {
if ( attribute.descriptor.name == "position" ) drawCommandInfo.attributes.position = attribute;
else if ( attribute.descriptor.name == "uv" ) drawCommandInfo.attributes.uv = attribute;
else if ( attribute.descriptor.name == "st" ) drawCommandInfo.attributes.st = attribute;
else if ( attribute.descriptor.name == "normal" ) drawCommandInfo.attributes.normal = attribute;
else if ( attribute.descriptor.name == "color" ) drawCommandInfo.attributes.color = attribute;
}
drawCommandInfo.attributes.index = descriptor.inputs.index.attributes.front();
drawCommandInfo.matrices.view = &viewports->matrices[0].view;
drawCommandInfo.matrices.projection = &viewports->matrices[0].projection;
*/
drawCommandInfo.descriptor.inputs.index.first = drawCommand.indexID;
drawCommandInfo.descriptor.inputs.index.count = drawCommand.indices;
@ -400,17 +429,6 @@ void ext::opengl::Graphic::record( CommandBuffer& commandBuffer, const GraphicDe
drawCommandInfo.descriptor.inputs.vertex.first = drawCommand.vertexID;
drawCommandInfo.descriptor.inputs.vertex.count = drawCommand.vertices;
// drawCommandInfo.attributes.index.pointer + drawCommandInfo.attributes.index.stride * drawCommandInfo.descriptor.inputs.index.first;
for ( uf::Mesh::Attribute attribute : descriptor.inputs.vertex.attributes ) {
// attribute.pointer = attribute.pointer + attribute.stride * drawCommandInfo.descriptor.inputs.vertex.first;
if ( attribute.descriptor.name == "position" ) drawCommandInfo.attributes.position = attribute;
else if ( attribute.descriptor.name == "uv" ) drawCommandInfo.attributes.uv = attribute;
else if ( attribute.descriptor.name == "st" ) drawCommandInfo.attributes.st = attribute;
else if ( attribute.descriptor.name == "normal" ) drawCommandInfo.attributes.normal = attribute;
else if ( attribute.descriptor.name == "color" ) drawCommandInfo.attributes.color = attribute;
}
drawCommandInfo.attributes.instance.pointer = &instance;
drawCommandInfo.attributes.instance.length = sizeof(instance);
@ -419,8 +437,6 @@ void ext::opengl::Graphic::record( CommandBuffer& commandBuffer, const GraphicDe
drawCommandInfo.attributes.indirect.length = sizeof(drawCommand);
drawCommandInfo.matrices.model = &instance.model;
drawCommandInfo.matrices.view = &viewports->matrices[0].view;
drawCommandInfo.matrices.projection = &viewports->matrices[0].projection;
if ( 0 <= material.indexAlbedo ) {
auto texture2DID = textures[material.indexAlbedo].index;
@ -431,10 +447,12 @@ void ext::opengl::Graphic::record( CommandBuffer& commandBuffer, const GraphicDe
auto texture2DID = textures[instance.lightmapID].index;
drawCommandInfo.textures.secondary = this->material.textures.at(texture2DID).descriptor;
}
if ( !optimize ) commandBuffer.record(drawCommandInfo);
// if ( !optimize )
commandBuffer.record(drawCommandInfo);
}
if ( optimize ) for ( auto pair : pool ) for ( auto& info : pair.second ) commandBuffer.record(info);
// if ( optimize ) for ( auto pair : pool ) for ( auto& info : pair.second ) commandBuffer.record(info);
} else {
/*
auto uniformBufferIt = uniformBuffers.begin();
auto uniformBuffer = (*uniformBufferIt++).buffer;
auto uniformOffset = (size_t) 0;
@ -460,8 +478,8 @@ void ext::opengl::Graphic::record( CommandBuffer& commandBuffer, const GraphicDe
drawCommandInfo.matrices.view = &uniforms->modelView;
drawCommandInfo.matrices.projection = &uniforms->projection;
}
commandBuffer.record(drawCommandInfo);
*/
commandBuffer.record(drawCommandInfoBase);
}
#endif
}

View File

@ -288,7 +288,7 @@ void ext::opengl::Texture::update( void* data, size_t bufferSize, uint32_t layer
format = GL_RGB;
break;
case enums::Format::R4G4B4A4_UNORM_PACK16:
case enums::Format::R4G4B4A4_UNORM_PSRGB:
// case enums::Format::R4G4B4A4_UNORM_PSRGB:
format = GL_RGBA;
type = GL_UNSIGNED_SHORT_4_4_4_4;
break;

View File

@ -1,9 +1,8 @@
#include <uf/ext/xatlas/xatlas.h>
#if UF_USE_XATLAS
#include <xatlas/xatlas.h>
#endif
#include <xatlas/xatlas.h>
pod::Vector2ui UF_API ext::xatlas::unwrap( pod::Graph& graph ) {
#if UF_USE_XATLAS
struct Pair {
size_t index = 0;
size_t command = 0;
@ -261,96 +260,9 @@ pod::Vector2ui UF_API ext::xatlas::unwrap( pod::Graph& graph ) {
mesh.updateDescriptor();
}
#if 0
for ( auto i = 0; i < atlas->meshCount; i++ ) {
auto& xmesh = atlas->meshes[i];
auto& entry = entries[i];
auto& name = graph.meshes[entry.index];
auto& mesh = /*graph.storage*/uf::graph::storage.meshes[name];
auto& source = sources[entry.index];
uf::Mesh::Input vertexInput = mesh.vertex;
uf::Mesh::Attribute positionAttribute;
uf::Mesh::Attribute uvAttribute;
uf::Mesh::Attribute stAttribute;
for ( auto& attribute : mesh.vertex.attributes ) {
if ( attribute.descriptor.name == "position" ) positionAttribute = attribute;
else if ( attribute.descriptor.name == "uv" ) uvAttribute = attribute;
else if ( attribute.descriptor.name == "st" ) stAttribute = attribute;
}
UF_ASSERT( positionAttribute.descriptor.name == "position" && uvAttribute.descriptor.name == "uv" && stAttribute.descriptor.name == "st" );
if ( mesh.index.count ) {
uf::Mesh::Input indexInput = mesh.index;
uf::Mesh::Attribute indexAttribute = mesh.index.attributes.front();
::xatlas::IndexFormat indexType = ::xatlas::IndexFormat::UInt32;
switch ( mesh.index.size ) {
case sizeof(uint16_t): indexType = ::xatlas::IndexFormat::UInt16; break;
case sizeof(uint32_t): indexType = ::xatlas::IndexFormat::UInt32; break;
default: UF_EXCEPTION("unsupported index type"); break;
}
if ( mesh.indirect.count ) {
for ( auto v = 0; v < xmesh.vertexCount; ++v ) {
auto& vertex = xmesh.vertexArray[v];
auto ref = vertex.xref;
vertexInput = mesh.remapVertexInput( entry.command );
for ( size_t _ = 0; _ < vertexInput.attributes.size(); ++_ ) {
auto& srcAttribute = source.vertex.attributes[_];
auto& dstAttribute = mesh.vertex.attributes[_];
memcpy( static_cast<uint8_t*>(dstAttribute.pointer) + dstAttribute.stride * (vertexInput.first + v), static_cast<uint8_t*>(srcAttribute.pointer) + srcAttribute.stride * (vertexInput.first + ref), srcAttribute.stride );
}
pod::Vector2f& st = *(pod::Vector2f*) (static_cast<uint8_t*>(stAttribute.pointer) + stAttribute.stride * (vertexInput.first + v));
st = { vertex.uv[0] / atlas->width, vertex.uv[1] / atlas->height };
}
// indices
indexInput = mesh.remapIndexInput( entry.command );
for ( auto index = 0; index < xmesh.indexCount; ++index ) {
switch ( mesh.index.size ) {
case 1: (( uint8_t*) static_cast<uint8_t*>(indexAttribute.pointer) + indexAttribute.stride * indexInput.first)[index] = xmesh.indexArray[index]; break;
case 2: ((uint16_t*) static_cast<uint8_t*>(indexAttribute.pointer) + indexAttribute.stride * indexInput.first)[index] = xmesh.indexArray[index]; break;
case 4: ((uint32_t*) static_cast<uint8_t*>(indexAttribute.pointer) + indexAttribute.stride * indexInput.first)[index] = xmesh.indexArray[index]; break;
}
}
} else {
for ( auto v = 0; v < xmesh.vertexCount; ++v ) {
auto& vertex = xmesh.vertexArray[v];
auto ref = vertex.xref;
for ( size_t _ = 0; _ < vertexInput.attributes.size(); ++_ ) {
auto& srcAttribute = source.vertex.attributes[_];
auto& dstAttribute = mesh.vertex.attributes[_];
memcpy( static_cast<uint8_t*>(dstAttribute.pointer) + dstAttribute.stride * (vertexInput.first + v), static_cast<uint8_t*>(srcAttribute.pointer) + srcAttribute.stride * (vertexInput.first + ref), srcAttribute.stride );
}
pod::Vector2f& st = *(pod::Vector2f*) (static_cast<uint8_t*>(stAttribute.pointer) + stAttribute.stride * (vertexInput.first + v));
st = { vertex.uv[0] / atlas->width, vertex.uv[1] / atlas->height };
}
for ( auto index = 0; index < xmesh.indexCount; ++index ) {
switch ( mesh.index.size ) {
case 1: (( uint8_t*) static_cast<uint8_t*>(indexAttribute.pointer) + indexAttribute.stride * indexInput.first)[index] = xmesh.indexArray[index]; break;
case 2: ((uint16_t*) static_cast<uint8_t*>(indexAttribute.pointer) + indexAttribute.stride * indexInput.first)[index] = xmesh.indexArray[index]; break;
case 4: ((uint32_t*) static_cast<uint8_t*>(indexAttribute.pointer) + indexAttribute.stride * indexInput.first)[index] = xmesh.indexArray[index]; break;
}
}
}
} else UF_EXCEPTION("to-do: not require indices for meshes");
}
#endif
pod::Vector2ui size = pod::Vector2ui{ atlas->width, atlas->height };
::xatlas::Destroy(atlas);
return size;
#endif
}
}
#endif

View File

@ -30,6 +30,8 @@ KOS_INIT_FLAGS(INIT_DEFAULT | INIT_MALLOCSTATS);
#endif
namespace {
bool asyncParse = true;
struct {
maple_device_t* device = NULL;
kbd_state_t* state = NULL;
@ -267,49 +269,7 @@ namespace {
}
}
UF_API_CALL spec::dreamcast::Window::Window() :
m_handle (NULL),
// m_callback (0),
// m_cursor (NULL),
// m_icon (NULL),
m_lastSize ({}),
m_keyRepeatEnabled (true),
m_resizing (false),
m_mouseInside (false),
m_mouseGrabbed (false),
m_syncParse (true),
m_asyncParse (false)
{
}
UF_API_CALL spec::dreamcast::Window::Window( spec::dreamcast::Window::handle_t handle ) :
m_handle (handle),
// m_callback (0),
// m_cursor (NULL),
// m_icon (NULL),
m_lastSize ({}),
m_keyRepeatEnabled (true),
m_resizing (false),
m_mouseInside (false),
m_mouseGrabbed (false),
m_syncParse (true),
m_asyncParse (false)
{
}
UF_API_CALL spec::dreamcast::Window::Window( const spec::dreamcast::Window::vector_t& size, const spec::dreamcast::Window::title_t& title ) :
m_handle (NULL),
// m_callback (0),
// m_cursor (NULL),
// m_icon (NULL),
m_keyRepeatEnabled (true),
m_resizing (false),
m_mouseInside (false),
m_mouseGrabbed (false),
m_syncParse (true),
m_asyncParse (false)
{
this->create(size, title);
}
UF_API_CALL spec::dreamcast::Window::Window() {}
void UF_API_CALL spec::dreamcast::Window::create( const spec::dreamcast::Window::vector_t& _size, const spec::dreamcast::Window::title_t& title ) {
::keyboard.device = maple_enum_type(1, MAPLE_FUNC_KEYBOARD);
@ -322,7 +282,7 @@ void UF_API_CALL spec::dreamcast::Window::terminate() {
}
spec::dreamcast::Window::handle_t UF_API_CALL spec::dreamcast::Window::getHandle() const {
return this->m_handle;
return NULL; // this->m_handle;
}
spec::dreamcast::Window::vector_t UF_API_CALL spec::dreamcast::Window::getPosition() const {
return { 0, 0 };
@ -373,7 +333,7 @@ void UF_API_CALL spec::dreamcast::Window::setVisible( bool visibility ) {
void UF_API_CALL spec::dreamcast::Window::setCursorVisible( bool visibility ) {
}
void UF_API_CALL spec::dreamcast::Window::setKeyRepeatEnabled( bool state ) {
this->m_keyRepeatEnabled = state;
// this->m_keyRepeatEnabled = state;
}
void UF_API_CALL spec::dreamcast::Window::requestFocus() {
@ -506,7 +466,7 @@ void UF_API_CALL spec::dreamcast::Window::processEvents() {
if ( !::mouse.device ) ::mouse.device = maple_enum_type(0, MAPLE_FUNC_MOUSE);
if ( ::mouse.device ) ::mouse.state = (mouse_state_t*) maple_dev_status(::mouse.device);
/* Key inputs */ if ( this->m_asyncParse ) {
/* Key inputs */ if ( ::asyncParse ) {
uf::stl::vector<uint8_t> keys = GetKeys();
pod::payloads::windowKey event{
"window:Key",
@ -594,7 +554,7 @@ void UF_API_CALL spec::dreamcast::Window::processEvent(/*UINT message, WPARAM wP
void UF_API_CALL spec::dreamcast::Window::setTracking(bool state) {
}
void UF_API_CALL spec::dreamcast::Window::setMouseGrabbed(bool state) {
this->m_mouseGrabbed = state;
// this->m_mouseGrabbed = state;
this->grabMouse(state);
}
void UF_API_CALL spec::dreamcast::Window::grabMouse(bool state) {
@ -602,7 +562,8 @@ void UF_API_CALL spec::dreamcast::Window::grabMouse(bool state) {
pod::Vector2ui UF_API_CALL spec::dreamcast::Window::getResolution() {
return ::resolution;
}
void UF_API_CALL spec::dreamcast::Window::switchToFullscreen( bool borderless ) {
void UF_API_CALL spec::dreamcast::Window::toggleFullscreen( bool borderless ) {
}
bool UF_API_CALL spec::dreamcast::Window::isKeyPressed(const uf::stl::string& key) {

View File

@ -4,6 +4,7 @@
#include <uf/utils/serialize/serializer.h>
#include <uf/utils/window/payloads.h>
#include <uf/utils/io/inputs.h>
#include <uf/utils/string/ext.h>
#define UF_HOOK_USE_USERDATA 1
#define UF_HOOK_USE_JSON 0

View File

@ -1,3 +1,4 @@
#if UF_USE_UNUSED
#include <uf/utils/math/collision.h>
#include <uf/utils/math/collision/gjk.h>
#include <uf/utils/math/collision/boundingbox.h>
@ -59,4 +60,5 @@ uf::stl::vector<pod::Collider::Manifold> UF_API uf::Collider::intersects( const
} else manifold = pointer->intersects( body );
}
return manifolds;
}
}
#endif

View File

@ -1,3 +1,4 @@
#if UF_USE_UNUSED
#include <uf/utils/math/collision/boundingbox.h>
UF_API uf::BoundingBox::BoundingBox( const pod::Vector3& origin, const pod::Vector3& corner ) {
@ -154,4 +155,5 @@ pod::Collider::Manifold UF_API uf::BoundingBox::intersects( const uf::BoundingBo
manifold.colliding = true;
*/
return manifold;
}
}
#endif

View File

@ -1,3 +1,4 @@
#if UF_USE_UNUSED
#include <uf/utils/math/collision/gjk.h>
/*
@ -244,4 +245,5 @@ const pod::Transform<>& pod::Collider::getTransform() const {
}
void pod::Collider::setTransform( const pod::Transform<>& transform ) {
this->m_transform = transform;
}
}
#endif

View File

@ -1,3 +1,4 @@
#if UF_USE_UNUSED
#include <uf/utils/math/collision/mesh.h>
uf::MeshCollider::MeshCollider( const pod::Transform<>& transform, const uf::stl::vector<pod::Vector3>& positions ) : m_positions(positions) {
@ -39,4 +40,5 @@ pod::Vector3 uf::MeshCollider::support( const pod::Vector3& direction ) const {
}
}
return points[best.i];
}
}
#endif

View File

@ -1,3 +1,4 @@
#if UF_USE_UNUSED
#include <uf/utils/math/collision/modular.h>
UF_API uf::ModularCollider::ModularCollider( uint len, pod::Vector3* container, bool should_free, const uf::ModularCollider::function_expand_t& expand, const uf::ModularCollider::function_support_t& support ) {
@ -52,4 +53,5 @@ pod::Vector3 UF_API uf::ModularCollider::support( const pod::Vector3& direction
}
}
return points[best.i];
}
}
#endif

View File

@ -1,3 +1,4 @@
#if UF_USE_UNUSED
#include <uf/utils/math/collision/sphere.h>
UF_API uf::SphereCollider::SphereCollider( float r, const pod::Vector3& origin ) {
@ -46,4 +47,5 @@ pod::Collider::Manifold uf::SphereCollider::intersects( const uf::SphereCollider
manifold.normal = position_b - position_a;
manifold.colliding = true;
return manifold;
}
}
#endif

View File

@ -1,2 +0,0 @@
#include <uf/utils/octree/octree.h>

View File

@ -1,3 +1,5 @@
#include <uf/config.h>
#if !UF_ENV_DREAMCAST
#include "behavior.h"
#include <uf/utils/renderer/renderer.h>
@ -44,6 +46,7 @@ void ext::BakingBehavior::initialize( uf::Object& self ) {
metadata.size = { metadataJson["baking"]["resolution"].as<size_t>(), metadataJson["baking"]["resolution"].as<size_t>() };
metadata.max.shadows = metadataJson["baking"]["shadows"].as<size_t>(metadata.max.shadows);
metadata.max.layers = metadataJson["baking"]["layers"].as<size_t>(metadata.max.layers);
metadata.cull = metadataJson["baking"]["cull"].as<bool>();
@ -54,6 +57,7 @@ void ext::BakingBehavior::initialize( uf::Object& self ) {
renderMode.metadata.type = "single";
renderMode.metadata.pipeline = "baking";
renderMode.metadata.samples = 1;
// renderMode.metadata.layers = metadata.max.layers;
renderMode.metadata.json["descriptor"]["cull mode"] = "none";
renderMode.width = metadata.size.x;
@ -153,4 +157,5 @@ void ext::BakingBehavior::destroy( uf::Object& self ){
}
void ext::BakingBehavior::Metadata::serialize( uf::Object& self, uf::Serializer& serializer ) {}
void ext::BakingBehavior::Metadata::deserialize( uf::Object& self, uf::Serializer& serializer ) {}
#undef this
#undef this
#endif

View File

@ -29,6 +29,7 @@ namespace ext {
size_t textures3D = 1;
size_t lights = 1024;
size_t shadows = 1024;
size_t layers = 1;
} max;
struct {
size_t lights = 0;

View File

@ -1,3 +1,4 @@
#include <uf/config.h>
#if UF_USE_OPENVR
#include "behavior.h"

View File

@ -1,3 +1,6 @@
#include <uf/config.h>
#if !UF_ENV_DREAMCAST
#include "behavior.h"
#include <uf/utils/renderer/renderer.h>
@ -266,4 +269,5 @@ void ext::VoxelizerBehavior::destroy( uf::Object& self ){
}
void ext::VoxelizerBehavior::Metadata::serialize( uf::Object& self, uf::Serializer& serializer ){}
void ext::VoxelizerBehavior::Metadata::deserialize( uf::Object& self, uf::Serializer& serializer ){}
#undef this
#undef this
#endif

View File

@ -1,3 +1,4 @@
#include <uf/config.h>
#if UF_USE_ULTRALIGHT
#include "behavior.h"
#include "../gui.h"

View File

@ -201,11 +201,7 @@ void EXT_API ext::initialize() {
}
{
uf::Mesh::defaultInterleaved = ::json["engine"]["scenes"]["meshes"]["interleaved"].as( uf::Mesh::defaultInterleaved );
#if 0 && UF_USE_OPENGL
uf::matrix::reverseInfiniteProjection = false;
#else
uf::matrix::reverseInfiniteProjection = ::json["engine"]["scenes"]["matrix"]["reverseInfinite"].as( uf::matrix::reverseInfiniteProjection );
#endif
}
/* Create initial scene (kludge) */ {
@ -357,7 +353,8 @@ void EXT_API ext::initialize() {
if ( filter == "nearest" ) uf::renderer::settings::swapchainUpscaleFilter = uf::renderer::enums::Filter::NEAREST;
else if ( filter == "linear" ) uf::renderer::settings::swapchainUpscaleFilter = uf::renderer::enums::Filter::LINEAR;
}
#if UF_USE_VULKAN
for ( int i = 0; i < configRenderJson["validation"]["filters"].size(); ++i ) {
uf::renderer::settings::validationFilters.emplace_back( configRenderJson["validation"]["filters"][i].as<uf::stl::string>() );
}
@ -385,7 +382,7 @@ void EXT_API ext::initialize() {
uf::renderer::settings::experimental::deferredSampling = configRenderExperimentalJson["deferred sampling"].as( uf::renderer::settings::experimental::deferredSampling );
uf::renderer::settings::experimental::culling = configRenderExperimentalJson["culling"].as( uf::renderer::settings::experimental::culling );
uf::renderer::settings::experimental::bloom = configRenderExperimentalJson["bloom"].as( uf::renderer::settings::experimental::bloom );
#define JSON_TO_VKFORMAT( key ) if ( configRenderJson["formats"][#key].is<uf::stl::string>() ) {\
uf::stl::string format = configRenderJson["formats"][#key].as<uf::stl::string>();\
format = uf::string::replace( uf::string::uppercase(format), " ", "_" );\
@ -396,6 +393,7 @@ void EXT_API ext::initialize() {
JSON_TO_VKFORMAT(depth);
JSON_TO_VKFORMAT(normal);
JSON_TO_VKFORMAT(position);
#endif
}
/* Init controllers */ {
@ -418,6 +416,7 @@ void EXT_API ext::initialize() {
/* Physics */ {
uf::physics::initialize();
}
#if UF_USE_OPENVR
{
auto& configVrJson = ::json["engine"]["ext"]["vr"];

View File

@ -3,8 +3,7 @@ CDIR =
CC = gcc
CXX = $(KOS_CCPLUS)
TARGET_EXTENSION = elf
# no flto because it throws an error "undefined reference to `typeinfo for btPolyhedralConvexShape'"
OPTIMIZATIONS = -O3 -fstrict-aliasing -ffast-math -DUF_NO_EXCEPTIONS # -flto
OPTIMIZATIONS = -Os -fstrict-aliasing -ffast-math -flto -DUF_NO_EXCEPTIONS -fno-unroll-all-loops -fno-optimize-sibling-calls -fschedule-insns2 -fomit-frame-pointer
WARNINGS = -Wno-attributes -Wno-conversion-null
FLAGS += $(KOS_CPPFLAGS) -std=c++17 $(OPTIMIZATIONS) $(WARNINGS) -fdiagnostics-color=always
INCS += $(KOS_INC_PATHS) -I/opt/dreamcast/sh-elf/sh-elf/include

View File

@ -2,6 +2,6 @@ ARCH = win64
CDIR =
CC = gcc
CXX = g++
OPTIMIZATIONS = -O3 -fstrict-aliasing # -flto
WARNINGS = -g -Wall -Wno-pointer-arith -Wno-unknown-pragmas -Wno-unused-function -Wno-unused-variable -Wno-switch -Wno-reorder -Wno-sign-compare -Wno-unused-but-set-variable -Wno-ignored-attributes -Wno-narrowing -Wno-misleading-indentation
OPTIMIZATIONS = -O3 -fstrict-aliasing -flto
WARNINGS = -Wall -Wno-unknown-pragmas -Wno-unused-function -Wno-unused-variable -Wno-switch -Wno-reorder -Wno-sign-compare -Wno-unused-but-set-variable -Wno-ignored-attributes -Wno-narrowing -Wno-misleading-indentation
FLAGS += -std=c++17 $(OPTIMIZATIONS) $(WARNINGS) -fdiagnostics-color=always

View File

@ -0,0 +1,8 @@
ARCH = win64
CDIR = /tdm-gcc/bin/
CC = gcc
CXX = g++
OPTIMIZATIONS = -O3 -fstrict-aliasing # -flto
WARNINGS = -Wall -Wno-pointer-arith -Wno-unknown-pragmas -Wno-unused-function -Wno-unused-variable -Wno-switch -Wno-reorder -Wno-sign-compare -Wno-unused-but-set-variable -Wno-ignored-attributes -Wno-narrowing -Wno-misleading-indentation
FLAGS = -std=c++17 $(OPTIMIZATIONS) $(WARNINGS) -fdiagnostics-color=always
PREFIX = $(ARCH).tdm-gcc