migrated (most of) ./ext/ into the core engine (because in reality I don't think it'd be easy to make them optional)
This commit is contained in:
parent
acfadd5c2d
commit
87ed97408f
8
Makefile
8
Makefile
@ -319,13 +319,13 @@ cdi:
|
||||
cd ./bin/dreamcast/; ./elf2cdi.sh $(TARGET_NAME)
|
||||
|
||||
else
|
||||
$(PREFIX): $(EX_DLL) $(TARGET) $(TARGET_SHADERS)
|
||||
$(PREFIX): $(EX_DLL) $(EXT_EX_DLL) $(TARGET) $(TARGET_SHADERS)
|
||||
|
||||
%.$(PREFIX).o: %.cpp
|
||||
$(CXX) $(FLAGS) $(INCS) -c $< -o $@
|
||||
|
||||
$(EX_DLL): FLAGS += -DUF_EXPORTS -DEXT_EXPORTS
|
||||
#$(EX_DLL): FLAGS += -DUF_EXPORTS
|
||||
#$(EX_DLL): FLAGS += -DUF_EXPORTS -DEXT_EXPORTS
|
||||
$(EX_DLL): FLAGS += -DUF_EXPORTS
|
||||
$(EX_DLL): $(OBJS_DLL)
|
||||
$(CXX) $(FLAGS) -shared -o $(EX_DLL) -Wl,--out-implib=$(IM_DLL) $(OBJS_DLL) $(LIBS) $(INCS) $(LINKS)
|
||||
cp $(ENGINE_LIB_DIR)/$(PREFIX_PATH)/$(BASE_DLL).$(TARGET_LIB_EXTENSION).a $(ENGINE_LIB_DIR)/$(PREFIX_PATH)/$(BASE_DLL).a
|
||||
@ -341,7 +341,7 @@ $(EXT_EX_DLL): $(OBJS_EXT_DLL)
|
||||
cp $(ENGINE_LIB_DIR)/$(PREFIX_PATH)/$(BASE_EXT_DLL).$(TARGET_LIB_EXTENSION).a $(ENGINE_LIB_DIR)/$(PREFIX_PATH)/$(BASE_EXT_DLL).a
|
||||
|
||||
$(TARGET): $(OBJS)
|
||||
$(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
|
||||
|
||||
%.spv: %.glsl
|
||||
|
@ -19,9 +19,9 @@ uf::Serializer client::config;
|
||||
void client::initialize() {
|
||||
uf::renderer::device.window = &client::window;
|
||||
|
||||
ext::load();
|
||||
uf::load();
|
||||
|
||||
client::config = ext::config;
|
||||
client::config = uf::config;
|
||||
|
||||
/* Initialize window */ {
|
||||
// Window size
|
||||
@ -46,7 +46,7 @@ void client::initialize() {
|
||||
client::window.create( size, title );
|
||||
#if !UF_ENV_DREAMCAST
|
||||
// Set refresh rate
|
||||
ext::config["window"]["refresh rate"] = client::window.getRefreshRate();
|
||||
uf::config["window"]["refresh rate"] = client::window.getRefreshRate();
|
||||
// Miscellaneous
|
||||
client::window.setVisible(client::config["window"]["visible"].as<bool>());
|
||||
client::window.setCursorVisible(client::config["window"]["mouse"]["visible"].as<bool>());
|
||||
|
@ -29,10 +29,15 @@ namespace {
|
||||
|
||||
if ( client::terminated ) return;
|
||||
UF_MSG_INFO("Termination via std::atexit()!");
|
||||
ext::ready = false;
|
||||
|
||||
client::ready = false;
|
||||
//ext::ready = false;
|
||||
uf::ready = false;
|
||||
|
||||
client::terminated = true;
|
||||
ext::terminate();
|
||||
|
||||
//ext::terminate();
|
||||
uf::terminate();
|
||||
client::terminate();
|
||||
}
|
||||
|
||||
@ -72,7 +77,7 @@ int main(int argc, char** argv){
|
||||
for ( size_t i = 0; i < argc; ++i ) {
|
||||
char* c_str = argv[i];
|
||||
std::string string(argv[i]);
|
||||
ext::arguments.emplace_back(string);
|
||||
uf::arguments.emplace_back(string);
|
||||
}
|
||||
|
||||
std::atexit(::handlers::exit);
|
||||
@ -80,10 +85,11 @@ int main(int argc, char** argv){
|
||||
signal(SIGSEGV, ::handlers::segv);
|
||||
|
||||
client::initialize();
|
||||
ext::initialize();
|
||||
//ext::initialize();
|
||||
uf::initialize();
|
||||
|
||||
// For Multithreaded initialization
|
||||
while ( !client::ready || !ext::ready ) {
|
||||
while ( !client::ready || !uf::ready ) {
|
||||
static uf::Timer<long long> timer(false);
|
||||
static double next = 1;
|
||||
if ( !timer.running() ) timer.start();
|
||||
@ -95,7 +101,7 @@ int main(int argc, char** argv){
|
||||
}
|
||||
}
|
||||
|
||||
while ( client::ready && ext::ready ) {
|
||||
while ( client::ready && uf::ready ) {
|
||||
#if UF_EXCEPTIONS
|
||||
try {
|
||||
#endif
|
||||
@ -103,19 +109,23 @@ int main(int argc, char** argv){
|
||||
// auto& thread = uf::thread::fetchWorker();
|
||||
auto& thread = uf::thread::get("Render");
|
||||
uf::thread::queue(thread, [&]{
|
||||
ext::render();
|
||||
//ext::render();
|
||||
uf::render();
|
||||
client::render();
|
||||
});
|
||||
|
||||
client::tick();
|
||||
ext::tick();
|
||||
//ext::tick();
|
||||
uf::tick();
|
||||
|
||||
uf::thread::wait( thread );
|
||||
} else {
|
||||
client::tick();
|
||||
ext::tick();
|
||||
uf::tick();
|
||||
//ext::tick();
|
||||
|
||||
ext::render();
|
||||
//ext::render();
|
||||
uf::render();
|
||||
client::render();
|
||||
}
|
||||
#if UF_EXCEPTIONS
|
||||
@ -139,7 +149,8 @@ int main(int argc, char** argv){
|
||||
if ( !client::terminated ) {
|
||||
client::terminated = true;
|
||||
UF_MSG_INFO("Natural termination!");
|
||||
ext::terminate();
|
||||
//ext::terminate();
|
||||
uf::terminate();
|
||||
client::terminate();
|
||||
}
|
||||
return 0;
|
||||
|
@ -1,4 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <uf/engine/ext.h>
|
||||
#include <uf/ext/ext.h>
|
||||
|
||||
#include <uf/utils/window/window.h>
|
||||
|
18
engine/inc/uf/engine/ext.h
Normal file
18
engine/inc/uf/engine/ext.h
Normal file
@ -0,0 +1,18 @@
|
||||
#include <uf/config.h>
|
||||
#include <uf/utils/memory/vector.h>
|
||||
#include <uf/utils/memory/string.h>
|
||||
#include <uf/utils/serialize/serializer.h>
|
||||
|
||||
namespace uf {
|
||||
extern bool UF_API ready;
|
||||
extern uf::stl::vector<uf::stl::string> UF_API arguments;
|
||||
extern uf::Serializer UF_API config;
|
||||
|
||||
extern void UF_API load();
|
||||
extern void UF_API load( ext::json::Value& );
|
||||
extern void UF_API initialize();
|
||||
extern bool UF_API running();
|
||||
extern void UF_API tick();
|
||||
extern void UF_API render();
|
||||
extern void UF_API terminate();
|
||||
}
|
@ -36,17 +36,8 @@
|
||||
#define EXT_API EXT_API_IMPORT
|
||||
#endif
|
||||
|
||||
#include <uf/utils/memory/string.h>
|
||||
#include <uf/utils/serialize/serializer.h>
|
||||
namespace ext {
|
||||
extern bool EXT_API ready;
|
||||
extern uf::stl::vector<uf::stl::string> EXT_API arguments;
|
||||
extern uf::Serializer EXT_API config;
|
||||
|
||||
extern void EXT_API load();
|
||||
extern void EXT_API load( ext::json::Value& );
|
||||
extern void EXT_API initialize();
|
||||
extern bool EXT_API running();
|
||||
extern void EXT_API tick();
|
||||
extern void EXT_API render();
|
||||
extern void EXT_API terminate();
|
||||
|
@ -1,9 +1,10 @@
|
||||
#include "main.h"
|
||||
#include "ext.h"
|
||||
#include <uf/engine/ext.h>
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <regex>
|
||||
#include <cstdlib>
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <uf/utils/time/time.h>
|
||||
@ -45,9 +46,9 @@
|
||||
#include <uf/ext/imgui/imgui.h>
|
||||
#include <uf/ext/vall_e/vall_e.h>
|
||||
|
||||
bool ext::ready = false;
|
||||
uf::stl::vector<uf::stl::string> ext::arguments;
|
||||
uf::Serializer ext::config;
|
||||
bool uf::ready = false;
|
||||
uf::stl::vector<uf::stl::string> uf::arguments;
|
||||
uf::Serializer uf::config;
|
||||
|
||||
namespace {
|
||||
struct {
|
||||
@ -69,7 +70,7 @@ namespace {
|
||||
} total;
|
||||
} times;
|
||||
|
||||
auto& json = ext::config;
|
||||
auto& json = uf::config;
|
||||
|
||||
struct {
|
||||
struct {
|
||||
@ -107,10 +108,10 @@ namespace {
|
||||
} sceneTransition;
|
||||
}
|
||||
|
||||
void EXT_API ext::load() {
|
||||
ext::config.readFromFile(uf::io::root+"config.json");
|
||||
void UF_API uf::load() {
|
||||
uf::config.readFromFile(uf::io::root+"config.json");
|
||||
}
|
||||
void EXT_API ext::load( ext::json::Value& json ) {
|
||||
void UF_API uf::load( ext::json::Value& json ) {
|
||||
::config.engine.gc.enabled = json["engine"]["debug"]["garbage collection"]["enabled"].as(::config.engine.gc.enabled);
|
||||
::config.engine.gc.every = json["engine"]["debug"]["garbage collection"]["every"].as(::config.engine.gc.every);
|
||||
::config.engine.gc.mode = json["engine"]["debug"]["garbage collection"]["mode"].as(::config.engine.gc.mode);
|
||||
@ -306,7 +307,7 @@ void EXT_API ext::load( ext::json::Value& json ) {
|
||||
}
|
||||
}
|
||||
|
||||
void EXT_API ext::initialize() {
|
||||
void UF_API uf::initialize() {
|
||||
/* Setup deferred Main thread */ {
|
||||
uf::thread::get(uf::thread::mainThreadName);
|
||||
}
|
||||
@ -323,7 +324,7 @@ void EXT_API ext::initialize() {
|
||||
/* Arguments */ {
|
||||
bool modified = false;
|
||||
auto& arguments = ::json["arguments"];
|
||||
for ( auto& arg : ext::arguments ) {
|
||||
for ( auto& arg : uf::arguments ) {
|
||||
// store raw argument
|
||||
int i = arguments.size();
|
||||
arguments[i] = arg;
|
||||
@ -354,10 +355,10 @@ void EXT_API ext::initialize() {
|
||||
if ( modified ) UF_MSG_DEBUG("New config: {}", ::json.serialize());
|
||||
}
|
||||
/* Seed */ {
|
||||
srand(time(NULL));
|
||||
std::srand(std::time(NULL));
|
||||
}
|
||||
/* Open output file */ {
|
||||
io.output.open(io.filenames.output);
|
||||
::io.output.open(::io.filenames.output);
|
||||
}
|
||||
/* Initialize timers */ {
|
||||
times.sys.start();
|
||||
@ -428,7 +429,7 @@ void EXT_API ext::initialize() {
|
||||
// metadata["system"]["config"] = ::json;
|
||||
}
|
||||
|
||||
ext::load( ::json );
|
||||
uf::load( ::json );
|
||||
|
||||
// renderer settings
|
||||
{
|
||||
@ -724,7 +725,7 @@ void EXT_API ext::initialize() {
|
||||
if ( json["message"].is<uf::stl::string>() ) {
|
||||
UF_MSG_DEBUG( "{}", json["message"].as<uf::stl::string>() );
|
||||
}
|
||||
ext::ready = false;
|
||||
uf::ready = false;
|
||||
});
|
||||
}
|
||||
|
||||
@ -743,11 +744,11 @@ void EXT_API ext::initialize() {
|
||||
});
|
||||
*/
|
||||
|
||||
ext::ready = true;
|
||||
uf::ready = true;
|
||||
UF_MSG_INFO("EXT took {} seconds to initialize", times.sys.elapsed().asDouble());
|
||||
}
|
||||
|
||||
void EXT_API ext::tick() {
|
||||
void UF_API uf::tick() {
|
||||
#if 1
|
||||
if ( ::sceneTransition.phase >= 0 ) {
|
||||
auto target = ::sceneTransition.payload["scene"].as<uf::stl::string>();
|
||||
@ -925,7 +926,7 @@ void EXT_API ext::tick() {
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
void EXT_API ext::render() {
|
||||
void UF_API uf::render() {
|
||||
if ( uf::scene::scenes.empty() ) return;
|
||||
|
||||
if ( ::sceneTransition.phase >= 0 ) {
|
||||
@ -953,7 +954,7 @@ void EXT_API ext::render() {
|
||||
}
|
||||
#endif
|
||||
}
|
||||
void EXT_API ext::terminate() {
|
||||
void UF_API uf::terminate() {
|
||||
/* Kill threads */ {
|
||||
uf::thread::terminate();
|
||||
}
|
||||
@ -1025,9 +1026,9 @@ void EXT_API ext::terminate() {
|
||||
}
|
||||
|
||||
/* Flush input buffer */ {
|
||||
io.output << io.input << "\n";
|
||||
for ( const auto& str : uf::iostream.getHistory() ) io.output << str << "\n";
|
||||
io.output << "\nTerminated after " << times.sys.elapsed().asDouble() << " seconds" << "\n";
|
||||
io.output.close();
|
||||
::io.output << ::io.input << "\n";
|
||||
for ( const auto& str : uf::iostream.getHistory() ) ::io.output << str << "\n";
|
||||
::io.output << "\nTerminated after " << times.sys.elapsed().asDouble() << " seconds" << "\n";
|
||||
::io.output.close();
|
||||
}
|
||||
}
|
@ -32,7 +32,7 @@ void ext::GuiManagerBehavior::initialize( uf::Object& self ) {
|
||||
auto& metadata = this->getComponent<ext::GuiManagerBehavior::Metadata>();
|
||||
auto& metadataJson = this->getComponent<uf::Serializer>();
|
||||
|
||||
metadata.size = uf::vector::decode( ext::config["window"]["size"], pod::Vector2f{} );
|
||||
metadata.size = uf::vector::decode( uf::config["window"]["size"], pod::Vector2f{} );
|
||||
this->addHook( "window:Resized", [&](pod::payloads::windowResized& payload){
|
||||
metadata.size = payload.window.size;
|
||||
} );
|
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <uf/config.h>
|
||||
#include <uf/ext/ext.h>
|
||||
#include <uf/engine/ext.h>
|
||||
#include <uf/engine/entity/entity.h>
|
||||
#include <uf/engine/scene/scene.h>
|
||||
|
@ -64,7 +64,7 @@ void ext::PlayerBehavior::initialize( uf::Object& self ) {
|
||||
float raidou = (float) size.x / (float) size.y;
|
||||
|
||||
if ( size.x == 0 || size.y == 0 ) {
|
||||
size = uf::vector::decode( ext::config["window"]["size"], pod::Vector2ui{} );
|
||||
size = uf::vector::decode( uf::config["window"]["size"], pod::Vector2ui{} );
|
||||
raidou = (float) size.x / (float) size.y;
|
||||
#if 0
|
||||
this->addHook( "window:Resized", [&, fov, range](pod::payloads::windowResized& payload){
|
||||
@ -80,8 +80,8 @@ void ext::PlayerBehavior::initialize( uf::Object& self ) {
|
||||
}
|
||||
|
||||
// sloppy
|
||||
metadata.mouse.sensitivity = uf::vector::decode( ext::config["window"]["mouse"]["sensitivity"], metadata.mouse.sensitivity );
|
||||
metadata.mouse.smoothing = uf::vector::decode( ext::config["window"]["mouse"]["smoothing"], metadata.mouse.smoothing );
|
||||
metadata.mouse.sensitivity = uf::vector::decode( uf::config["window"]["mouse"]["sensitivity"], metadata.mouse.sensitivity );
|
||||
metadata.mouse.smoothing = uf::vector::decode( uf::config["window"]["mouse"]["smoothing"], metadata.mouse.smoothing );
|
||||
|
||||
this->addHook( "window:Mouse.CursorVisibility", [&](pod::payloads::windowMouseCursorVisibility& payload){
|
||||
metadata.system.control = !payload.mouse.visible;
|
@ -190,11 +190,11 @@ void ext::RayTraceSceneBehavior::tick( uf::Object& self ) {
|
||||
//
|
||||
auto& scene = uf::scene::getCurrentScene();
|
||||
auto& sceneMetadataJson = scene.getComponent<uf::Serializer>();
|
||||
size_t maxLights = ext::config["engine"]["scenes"]["lights"]["max"].as<size_t>(512);
|
||||
size_t maxTextures2D = ext::config["engine"]["scenes"]["textures"]["max"]["2D"].as<size_t>(512);
|
||||
size_t maxTexturesCube = ext::config["engine"]["scenes"]["textures"]["max"]["cube"].as<size_t>(128);
|
||||
size_t maxTextures3D = ext::config["engine"]["scenes"]["textures"]["max"]["3D"].as<size_t>(1);
|
||||
size_t maxCascades = ext::config["engine"]["scenes"]["vxgi"]["cascades"].as<size_t>(16);
|
||||
size_t maxLights = uf::config["engine"]["scenes"]["lights"]["max"].as<size_t>(512);
|
||||
size_t maxTextures2D = uf::config["engine"]["scenes"]["textures"]["max"]["2D"].as<size_t>(512);
|
||||
size_t maxTexturesCube = uf::config["engine"]["scenes"]["textures"]["max"]["cube"].as<size_t>(128);
|
||||
size_t maxTextures3D = uf::config["engine"]["scenes"]["textures"]["max"]["3D"].as<size_t>(1);
|
||||
size_t maxCascades = uf::config["engine"]["scenes"]["vxgi"]["cascades"].as<size_t>(16);
|
||||
|
||||
shader.buffers.emplace_back( storage.buffers.instance.alias() );
|
||||
shader.buffers.emplace_back( storage.buffers.instanceAddresses.alias() );
|
||||
@ -332,7 +332,7 @@ void ext::RayTraceSceneBehavior::Metadata::serialize( uf::Object& self, uf::Seri
|
||||
void ext::RayTraceSceneBehavior::Metadata::deserialize( uf::Object& self, uf::Serializer& serializer ) {
|
||||
// merge vxgi settings with global settings
|
||||
{
|
||||
const auto& globalSettings = ext::config["engine"]["scenes"]["rt"];
|
||||
const auto& globalSettings = uf::config["engine"]["scenes"]["rt"];
|
||||
ext::json::forEach( globalSettings, [&]( const uf::stl::string& key, const ext::json::Value& value ){
|
||||
if ( !ext::json::isNull( serializer["rt"][key] ) ) return;
|
||||
serializer["rt"][key] = value;
|
||||
@ -350,8 +350,8 @@ void ext::RayTraceSceneBehavior::Metadata::deserialize( uf::Object& self, uf::Se
|
||||
/*this->*/renderer.scale = serializer["rt"]["size"].as(/*this->*/renderer.scale);
|
||||
} else if ( ext::json::isArray( serializer["rt"]["size"] ) ) {
|
||||
/*this->*/renderer.size = uf::vector::decode( serializer["rt"]["size"], /*this->*/renderer.size );
|
||||
} else if ( ext::config["engine"]["ext"]["vulkan"]["framebuffer"]["size"].is<float>() ) {
|
||||
/*this->*/renderer.scale = ext::config["engine"]["ext"]["vulkan"]["framebuffer"]["size"].as(/*this->*/renderer.scale);
|
||||
} else if ( uf::config["engine"]["ext"]["vulkan"]["framebuffer"]["size"].is<float>() ) {
|
||||
/*this->*/renderer.scale = uf::config["engine"]["ext"]["vulkan"]["framebuffer"]["size"].as(/*this->*/renderer.scale);
|
||||
}
|
||||
|
||||
/*this->*/renderer.full = serializer["rt"]["full"].as(/*this->*/renderer.full);
|
@ -32,7 +32,10 @@
|
||||
#include "../light/behavior.h"
|
||||
#include "../voxelizer/behavior.h"
|
||||
#include "../raytrace/behavior.h"
|
||||
#include "../../ext.h"
|
||||
|
||||
#include <uf/engine/ext.h>
|
||||
|
||||
//#include "../../ext.h"
|
||||
// #include "../../gui/gui.h"
|
||||
|
||||
UF_BEHAVIOR_REGISTER_CPP(ext::ExtSceneBehavior)
|
||||
@ -50,7 +53,7 @@ void ext::ExtSceneBehavior::initialize( uf::Object& self ) {
|
||||
|
||||
this->addHook( "system:Quit.%UID%", [&](ext::json::Value& payload){
|
||||
uf::renderer::settings::experimental::dedicatedThread = false;
|
||||
ext::ready = false;
|
||||
uf::ready = false;
|
||||
});
|
||||
|
||||
this->addHook( "menu:Open", [&](ext::json::Value& payload){
|
||||
@ -790,7 +793,7 @@ void ext::ExtSceneBehavior::Metadata::serialize( uf::Object& self, uf::Serialize
|
||||
void ext::ExtSceneBehavior::Metadata::deserialize( uf::Object& self, uf::Serializer& serializer ) {
|
||||
// merge light settings with global settings
|
||||
{
|
||||
const auto& globalSettings = ext::config["engine"]["scenes"]["lights"];
|
||||
const auto& globalSettings = uf::config["engine"]["scenes"]["lights"];
|
||||
ext::json::forEach( globalSettings, [&]( const uf::stl::string& key, const ext::json::Value& value ){
|
||||
if ( !ext::json::isNull( serializer["light"][key] ) ) return;
|
||||
serializer["light"][key] = value;
|
||||
@ -798,7 +801,7 @@ void ext::ExtSceneBehavior::Metadata::deserialize( uf::Object& self, uf::Seriali
|
||||
}
|
||||
// merge bloom settings with global settings
|
||||
{
|
||||
const auto& globalSettings = ext::config["engine"]["scenes"]["lights"]["bloom"];
|
||||
const auto& globalSettings = uf::config["engine"]["scenes"]["lights"]["bloom"];
|
||||
ext::json::forEach( globalSettings, [&]( const uf::stl::string& key, const ext::json::Value& value ){
|
||||
if ( !ext::json::isNull( serializer["light"]["bloom"][key] ) ) return;
|
||||
serializer["light"]["bloom"][key] = value;
|
||||
@ -806,7 +809,7 @@ void ext::ExtSceneBehavior::Metadata::deserialize( uf::Object& self, uf::Seriali
|
||||
}
|
||||
// merge shadows settings with global settings
|
||||
{
|
||||
const auto& globalSettings = ext::config["engine"]["scenes"]["lights"]["shadows"];
|
||||
const auto& globalSettings = uf::config["engine"]["scenes"]["lights"]["shadows"];
|
||||
ext::json::forEach( globalSettings, [&]( const uf::stl::string& key, const ext::json::Value& value ){
|
||||
if ( !ext::json::isNull( serializer["light"]["shadows"][key] ) ) return;
|
||||
serializer["light"]["shadows"][key] = value;
|
||||
@ -814,16 +817,16 @@ void ext::ExtSceneBehavior::Metadata::deserialize( uf::Object& self, uf::Seriali
|
||||
}
|
||||
// merge fog settings with global settings
|
||||
{
|
||||
const auto& globalSettings = ext::config["engine"]["scenes"]["lights"]["fog"];
|
||||
const auto& globalSettings = uf::config["engine"]["scenes"]["lights"]["fog"];
|
||||
ext::json::forEach( globalSettings, [&]( const uf::stl::string& key, const ext::json::Value& value ){
|
||||
if ( !ext::json::isNull( serializer["light"]["fog"][key] ) ) return;
|
||||
serializer["light"]["fog"][key] = value;
|
||||
} );
|
||||
}
|
||||
|
||||
/*this->*/max.textures2D = ext::config["engine"]["scenes"]["textures"]["max"]["2D"].as(/*this->*/max.textures2D);
|
||||
/*this->*/max.texturesCube = ext::config["engine"]["scenes"]["textures"]["max"]["cube"].as(/*this->*/max.texturesCube);
|
||||
/*this->*/max.textures3D = ext::config["engine"]["scenes"]["textures"]["max"]["3D"].as(/*this->*/max.textures3D);
|
||||
/*this->*/max.textures2D = uf::config["engine"]["scenes"]["textures"]["max"]["2D"].as(/*this->*/max.textures2D);
|
||||
/*this->*/max.texturesCube = uf::config["engine"]["scenes"]["textures"]["max"]["cube"].as(/*this->*/max.texturesCube);
|
||||
/*this->*/max.textures3D = uf::config["engine"]["scenes"]["textures"]["max"]["3D"].as(/*this->*/max.textures3D);
|
||||
|
||||
/*this->*/shadow.enabled = serializer["light"]["shadows"]["enabled"].as(/*this->*/shadow.enabled);
|
||||
/*this->*/shadow.samples = serializer["light"]["shadows"]["samples"].as(/*this->*/shadow.samples);
|
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <uf/config.h>
|
||||
#include <uf/ext/ext.h>
|
||||
#include <uf/engine/ext.h>
|
||||
#include <uf/engine/entity/entity.h>
|
||||
#include <uf/engine/scene/scene.h>
|
||||
#include <uf/utils/math/vector.h>
|
@ -16,7 +16,7 @@
|
||||
|
||||
#include "../light/behavior.h"
|
||||
#include "../scene/behavior.h"
|
||||
#include <uf/ext/ext.h>
|
||||
#include <uf/engine/ext.h>
|
||||
|
||||
|
||||
UF_BEHAVIOR_REGISTER_CPP(ext::VoxelizerSceneBehavior)
|
||||
@ -112,9 +112,9 @@ void ext::VoxelizerSceneBehavior::initialize( uf::Object& self ) {
|
||||
renderMode.blitter.descriptor.bind.point = VK_PIPELINE_BIND_POINT_COMPUTE;
|
||||
renderMode.blitter.process = true;
|
||||
|
||||
size_t maxTextures2D = ext::config["engine"]["scenes"]["textures"]["max"]["2D"].as<size_t>(512);
|
||||
size_t maxTexturesCube = ext::config["engine"]["scenes"]["textures"]["max"]["cube"].as<size_t>(128);
|
||||
size_t maxTextures3D = ext::config["engine"]["scenes"]["textures"]["max"]["3D"].as<size_t>(1);
|
||||
size_t maxTextures2D = uf::config["engine"]["scenes"]["textures"]["max"]["2D"].as<size_t>(512);
|
||||
size_t maxTexturesCube = uf::config["engine"]["scenes"]["textures"]["max"]["cube"].as<size_t>(128);
|
||||
size_t maxTextures3D = uf::config["engine"]["scenes"]["textures"]["max"]["3D"].as<size_t>(1);
|
||||
|
||||
for ( size_t i = 0; i < maxTextures2D; ++i ) renderMode.blitter.material.textures.emplace_back().aliasTexture(uf::renderer::Texture2D::empty);
|
||||
for ( size_t i = 0; i < maxTexturesCube; ++i ) renderMode.blitter.material.textures.emplace_back().aliasTexture(uf::renderer::TextureCube::empty);
|
||||
@ -318,7 +318,7 @@ void ext::VoxelizerSceneBehavior::Metadata::serialize( uf::Object& self, uf::Ser
|
||||
void ext::VoxelizerSceneBehavior::Metadata::deserialize( uf::Object& self, uf::Serializer& serializer ) {
|
||||
// merge vxgi settings with global settings
|
||||
{
|
||||
const auto& globalSettings = ext::config["engine"]["scenes"]["vxgi"];
|
||||
const auto& globalSettings = uf::config["engine"]["scenes"]["vxgi"];
|
||||
ext::json::forEach( globalSettings, [&]( const uf::stl::string& key, const ext::json::Value& value ){
|
||||
if ( !ext::json::isNull( serializer["vxgi"][key] ) ) return;
|
||||
serializer["vxgi"][key] = value;
|
@ -10,7 +10,8 @@
|
||||
#include <uf/utils/memory/map.h>
|
||||
#include <uf/ext/xatlas/xatlas.h>
|
||||
#include <uf/ext/ffx/fsr.h>
|
||||
#include <uf/ext/ext.h>
|
||||
|
||||
#include <uf/engine/ext.h>
|
||||
|
||||
#if UF_ENV_DREAMCAST
|
||||
#define UF_DEBUG_TIMER_MULTITRACE_START(...) UF_TIMER_MULTITRACE_START(__VA_ARGS__)
|
||||
@ -440,9 +441,9 @@ void uf::graph::initializeGraphics( pod::Graph& graph, uf::Object& entity, uf::M
|
||||
}
|
||||
|
||||
{
|
||||
size_t maxTextures = ext::config["engine"]["scenes"]["textures"]["max"]["2D"].as<size_t>(512);
|
||||
size_t maxCubemaps = ext::config["engine"]["scenes"]["textures"]["max"]["cube"].as<size_t>(128);
|
||||
size_t maxTextures3D = ext::config["engine"]["scenes"]["textures"]["max"]["3D"].as<size_t>(128);
|
||||
size_t maxTextures = uf::config["engine"]["scenes"]["textures"]["max"]["2D"].as<size_t>(512);
|
||||
size_t maxCubemaps = uf::config["engine"]["scenes"]["textures"]["max"]["cube"].as<size_t>(128);
|
||||
size_t maxTextures3D = uf::config["engine"]["scenes"]["textures"]["max"]["3D"].as<size_t>(128);
|
||||
|
||||
auto& shader = graphic.material.getShader("fragment", "baking");
|
||||
shader.setSpecializationConstants({
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
#include <uf/ext/vulkan/graphic.h>
|
||||
#include <uf/engine/graph/graph.h>
|
||||
#include <uf/ext/ext.h>
|
||||
#include <uf/engine/ext.h>
|
||||
|
||||
#define BARYCENTRIC 1
|
||||
#if BARYCENTRIC
|
||||
@ -270,11 +270,11 @@ void ext::vulkan::DeferredRenderMode::initialize( Device& device ) {
|
||||
|
||||
auto& shader = blitter.material.getShader(DEFERRED_MODE, "deferred");
|
||||
|
||||
size_t maxLights = ext::config["engine"]["scenes"]["lights"]["max"].as<size_t>(512);
|
||||
size_t maxTextures2D = ext::config["engine"]["scenes"]["textures"]["max"]["2D"].as<size_t>(512);
|
||||
size_t maxTexturesCube = ext::config["engine"]["scenes"]["textures"]["max"]["cube"].as<size_t>(128);
|
||||
size_t maxTextures3D = ext::config["engine"]["scenes"]["textures"]["max"]["3D"].as<size_t>(128);
|
||||
size_t maxCascades = ext::config["engine"]["scenes"]["vxgi"]["cascades"].as<size_t>(16);
|
||||
size_t maxLights = uf::config["engine"]["scenes"]["lights"]["max"].as<size_t>(512);
|
||||
size_t maxTextures2D = uf::config["engine"]["scenes"]["textures"]["max"]["2D"].as<size_t>(512);
|
||||
size_t maxTexturesCube = uf::config["engine"]["scenes"]["textures"]["max"]["cube"].as<size_t>(128);
|
||||
size_t maxTextures3D = uf::config["engine"]["scenes"]["textures"]["max"]["3D"].as<size_t>(128);
|
||||
size_t maxCascades = uf::config["engine"]["scenes"]["vxgi"]["cascades"].as<size_t>(16);
|
||||
|
||||
shader.setSpecializationConstants({
|
||||
{ "TEXTURES", maxTextures2D },
|
||||
@ -687,7 +687,7 @@ void ext::vulkan::DeferredRenderMode::createCommandBuffers( const uf::stl::vecto
|
||||
}
|
||||
}
|
||||
}
|
||||
bool shouldRecord = true; // ( settings::pipelines::rt && !ext::config["engine"]["scenes"]["rt"]["full"].as<bool>() ) || !settings::pipelines::rt;
|
||||
bool shouldRecord = true; // ( settings::pipelines::rt && !uf::config["engine"]["scenes"]["rt"]["full"].as<bool>() ) || !settings::pipelines::rt;
|
||||
for (size_t i = 0; i < commands.size(); ++i) {
|
||||
auto commandBuffer = commands[i];
|
||||
VK_CHECK_RESULT( vkBeginCommandBuffer(commandBuffer, &cmdBufInfo) );
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include <uf/ext/vulkan/graphic.h>
|
||||
#include <uf/engine/graph/graph.h>
|
||||
#include <uf/utils/camera/camera.h>
|
||||
#include <uf/ext/ext.h>
|
||||
#include <uf/engine/ext.h>
|
||||
|
||||
const uf::stl::string ext::vulkan::RenderTargetRenderMode::getType() const {
|
||||
return "RenderTarget";
|
||||
@ -322,11 +322,11 @@ void ext::vulkan::RenderTargetRenderMode::initialize( Device& device ) {
|
||||
|
||||
auto& shader = blitter.material.getShader("compute");
|
||||
|
||||
size_t maxLights = ext::config["engine"]["scenes"]["lights"]["max"].as<size_t>(512);
|
||||
size_t maxTextures2D = ext::config["engine"]["scenes"]["textures"]["max"]["2D"].as<size_t>(512);
|
||||
size_t maxTexturesCube = ext::config["engine"]["scenes"]["textures"]["max"]["cube"].as<size_t>(128);
|
||||
size_t maxTextures3D = ext::config["engine"]["scenes"]["textures"]["max"]["3D"].as<size_t>(1);
|
||||
size_t maxCascades = ext::config["engine"]["scenes"]["vxgi"]["cascades"].as<size_t>(16);
|
||||
size_t maxLights = uf::config["engine"]["scenes"]["lights"]["max"].as<size_t>(512);
|
||||
size_t maxTextures2D = uf::config["engine"]["scenes"]["textures"]["max"]["2D"].as<size_t>(512);
|
||||
size_t maxTexturesCube = uf::config["engine"]["scenes"]["textures"]["max"]["cube"].as<size_t>(128);
|
||||
size_t maxTextures3D = uf::config["engine"]["scenes"]["textures"]["max"]["3D"].as<size_t>(1);
|
||||
size_t maxCascades = uf::config["engine"]["scenes"]["vxgi"]["cascades"].as<size_t>(16);
|
||||
|
||||
shader.setSpecializationConstants({
|
||||
{ "TEXTURES", maxTextures2D },
|
||||
|
@ -1,7 +1,8 @@
|
||||
#include <uf/utils/io/fmt.h>
|
||||
#include <uf/utils/io/console.h>
|
||||
#include <uf/utils/hook/hook.h>
|
||||
#include <uf/ext/ext.h>
|
||||
|
||||
#include <uf/engine/ext.h>
|
||||
|
||||
#include <uf/engine/entity/entity.h>
|
||||
#include <uf/engine/scene/scene.h>
|
||||
@ -68,7 +69,7 @@ void uf::console::initialize() {
|
||||
uf::console::registerCommand("json", "Modifies the gamestate by setting a JSON value", [&]( const uf::stl::string& arguments )->uf::stl::string{
|
||||
auto match = uf::string::match( arguments, "/^(.+?) *= *(.+?)$/" );
|
||||
if ( match.empty() ) {
|
||||
uf::Serializer target = ext::config;
|
||||
uf::Serializer target = uf::config;
|
||||
return ext::json::encode( arguments == "" ? target : target.path( arguments ), {
|
||||
.pretty = true
|
||||
} );
|
||||
@ -80,8 +81,8 @@ void uf::console::initialize() {
|
||||
uf::Serializer value;
|
||||
value.deserialize(valueString);
|
||||
|
||||
ext::config.path(keyString) = value;
|
||||
ext::load( ext::config );
|
||||
uf::config.path(keyString) = value;
|
||||
uf::load( uf::config );
|
||||
|
||||
return "Value `" + keyString + "` set to `" + ext::json::encode( value ) + "`";
|
||||
});
|
||||
|
@ -1,7 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <uf/ext/ext.h>
|
||||
|
||||
namespace ext {
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user