Commit for 2022.11.27 13-25-40.7z

This commit is contained in:
mrq 2022-11-27 13:25:00 -06:00
parent 7668f1f9bf
commit e816814186
35 changed files with 126 additions and 188 deletions

View File

@ -45,6 +45,7 @@ EXT_LIB_NAME += ext
#VULKAN_SDK_PATH += /c/VulkanSDK/1.3.211.0/
#VULKAN_SDK_PATH += /c/VulkanSDK/1.3.216.0/
VULKAN_SDK_PATH += /c/VulkanSDK/1.3.224.1/
#VULKAN_SDK_PATH += /c/VulkanSDK/1.3.231.1/
GLSLC += $(VULKAN_SDK_PATH)/Bin/glslc
SPV_OPTIMIZER += $(VULKAN_SDK_PATH)/Bin/spirv-opt
@ -59,17 +60,15 @@ LINKS += $(UF_LIBS) $(EXT_LIBS) $(DEPS)
DEPS +=
ifneq (,$(findstring win64,$(ARCH)))
ifneq (,$(findstring zig,$(CC)))
REQ_DEPS += $(RENDERER) json:nlohmann toml png zlib luajit reactphysics meshoptimizer xatlas simd ctti gltf imgui fmt curl freetype openal ogg ffx:fsr # ncurses openvr draco discord bullet ultralight-ux
else
REQ_DEPS += $(RENDERER) json:nlohmann toml png zlib luajit reactphysics meshoptimizer xatlas simd ctti gltf imgui fmt curl freetype openal ogg ffx:fsr # ncurses openvr draco discord bullet ultralight-ux
endif
REQ_DEPS += $(RENDERER) json:nlohmann toml png zlib luajit reactphysics meshoptimizer xatlas simd ctti gltf imgui fmt curl freetype openal ogg # ffx:fsr ncurses openvr draco discord bullet ultralight-ux
FLAGS += -DUF_ENV_WINDOWS -DUF_ENV_WIN64 -DWIN32_LEAN_AND_MEAN
DEPS += -lgdi32 -ldwmapi
LINKS += #-Wl,-subsystem,windows
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
INCS := -I./dep/dreamcast/include $(INCS)
endif
ifneq (,$(findstring vulkan,$(REQ_DEPS)))
FLAGS += -DVK_USE_PLATFORM_WIN32_KHR -DUF_USE_VULKAN

View File

@ -1,11 +1,11 @@
{
"engine": {
"scenes": {
"start": "SourceEngine",
"start": "StartMenu",
"matrix": { "reverseInfinite": true },
"meshes": { "interleaved": false },
"lights": { "enabled": true,
"useLightmaps": true,
"useLightmaps": false,
"max": 16,
"shadows": {
"enabled": true,
@ -92,7 +92,7 @@
},
"framebuffer": {
"msaa": 1,
"size": 0.75 // 1
"size": 1
// "size": [ 640, 480, "NEAREST" ]
// "size": [ 1280, 720 ]
// "size": [ 960, 540 ]
@ -109,8 +109,8 @@
"deferred": true,
"vsync": false,
"hdr": false,
"vxgi": true,
"culling": true,
"vxgi": false,
"culling": false,
"bloom": false,
"rt": false,
"postProcess": false,

View File

@ -1,7 +1,7 @@
{
"type": "Object",
"name": "Burger",
"ignore": false,
"ignore": true,
"import": "/model.json",
"assets": [
// "/burger/burger.glb"
@ -12,6 +12,7 @@
"behaviors": [],
"transform": {
"position": [ -0.574743, 2.3547, -5.05161 ],
// "position": [ -4.66561, 0.0736207, -5.98057 ],
"rotation": {
"axis": [ 0, 1, 0 ],
"angle": 0

View File

@ -26,7 +26,7 @@
"bias": {
"constant": 1.25,
"slope": 1.75,
"shader": 0.000025 // 0.000005 //0.000000005
"shader": 0.00000005 // 0.000005 //0.000000005
},
"radius": [0.25, 0],
"resolution": 256,

View File

@ -38,7 +38,7 @@
},
"baking": {
"enabled": true,
"resolution": 4096,
"resolution": 2048,
"shadows": 1024,
"layers": 1,
"trigger": { "mode": "rendered", "quit": true },

View File

@ -1,7 +1,7 @@
{
"type": "Object",
"name": "Player: Model",
"ignore": false,
"ignore": true,
"import": "/model.json",
"assets": [
"/player/bear.glb"

View File

@ -1,37 +0,0 @@
{
"import": "/model.json",
"assets": [
// { "filename": "./models/cornell.glb" }
// { "filename": "./models/cornell/graph.json" }
// { "filename": "./models/sponza.glb" }
// { "filename": "./models/sponza/graph.json" }
// { "filename": "./models/sponza-cornell.glb" }
{ "filename": "./models/sponza-cornell/graph.json" }
],
"metadata": {
"graph": {
"baking": {
"enabled": false,
"resolution": 2048,
"settings": {
"useInputMeshUvs": false
}
},
"tags": {
"/^Mesh_/": {
"physics": { "type": "mesh", "static": true },
// "grid": { "size": [3,1,3], "epsilon": 0.0001, "cleanup": true, "print": true },
// "optimize mesh": { "simplify": 0 },
"unwrap mesh": true
},
"Camera": {
"action": "attach",
"filename": "./player.json",
"preserve orientation": true
}
}
}
}
}

View File

@ -1,32 +0,0 @@
{
"name": "Gui: Loading",
"type": "Object",
"behaviors": [
"GuiBehavior"
],
"assets": [
{ "filename": "./cornell.json", "delay": 0 }
],
"ignore": false,
"transform": {
"position": [ -0.830591, -0.699509, 0 ],
"rotation": {
"axis": [ 1, 0, 0 ],
"angle": 0
},
"scale": [ 0.258737, 0.115371, 1 ]
},
"metadata": {
"uv": [ 0, 0, 1, 1 ],
"color": [ 1, 1, 1, 0.1 ],
"location": "",
"scaling": "relative",
"text settings": {
"stroke": [ 1, 0.749, 0.368, 1 ],
"color": [ 1, 0.749, 0.368, 1 ],
"string": "Loading...",
"string1": "コマンド"
}
}
}

View File

@ -1,12 +0,0 @@
{
"import": "/player.json",
"assets": [
// { "filename": "/gui/hud/hud.json", "delay": 0 }
],
"metadata": {
"physics": {
"collider": false,
"gravity": [ 0, 0, 0 ]
}
}
}

View File

@ -1,13 +0,0 @@
{
"import": "/scene.json",
"assets": [
// "./loading.json"
"./cornell.json"
],
"metadata": {
"light": {
// "ambient": [ 0.0, 0.0, 0.0 ],
"ambient": [ 0.5, 0.5, 0.5 ]
}
}
}

View File

@ -1,8 +1,8 @@
{
"import": "/model.json",
"assets": [
// { "filename": "./models/sm64_bbb.glb" }
{ "filename": "./models/sm64_bbb/graph.json" }
{ "filename": "./models/sm64_bbb.glb" }
// { "filename": "./models/sm64_bbb/graph.json" }
],
"metadata": {
"graph": {
@ -14,7 +14,7 @@
"tags": {
"/^worldspawn/": {
"physics": { "type": "mesh", "static": true },
"grid": { "size": [9,1,9], "epsilon": 1.0, "cleanup": true, "print": true },
"grid": { "size": [3,1,3], "epsilon": 1.0, "cleanup": true, "print": true },
"optimize mesh": { "simplify": 0 },
"unwrap mesh": true
},
@ -23,7 +23,7 @@
"Material.071_574B138E_c.bmp": { "material": { "modeAlpha": "blend" } },
"Material.070_41A41EE3_c.bmp": { "material": { "modeAlpha": "blend" } },
"light_sun": { "light": { "power": 25000 } }
"light_sun": { "light": { "power": 25000000 } }
}
}
}

View File

@ -24,11 +24,12 @@
"bias": {
"constant": 1.25,
"slope": 1.75,
"shader": 0.0000025
"shader": 0.000000000005
},
"radius": [0.95, 0],
"resolution": 8196
"radius": [50, 0],
"resolution": 1024
} },
// "/^light_[^e]/": { "ignore": true },
// regexp matches
"/^worldspawn_/": { "physics": { "type": "mesh", "static": true } },

View File

@ -3,6 +3,7 @@
"assets": [
// { "filename": "./models/mds_mcdonalds.glb" }
{ "filename": "./models/mds_mcdonalds/graph.json" }
// { "filename": "/burger.json", "delay": 1 }
],
"metadata": {
"graph": {

View File

@ -2,13 +2,12 @@
"import": "./base_sourceengine.json",
"assets": [
// { "filename": "./models/sh2_mcdonalds.glb" }
{ "filename": "./models/sh2_mcdonalds/graph.json" },
{ "filename": "/burger.json", "delay": 1 }
{ "filename": "./models/sh2_mcdonalds/graph.json" }
],
"metadata": {
"graph": {
"lights": {
// "scale": 4.0
"scale": 1
},
"assets": [
"./audio/soundscape/sh2_ambience.ogg"
@ -32,19 +31,6 @@
"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] } } },
"light_environment": { "transform": { "orientation": [0,0,0,1] }, "light": {
"color": [0.05, 0.05, 0.05],
"power": 10,
"global": true,
"bias": {
"constant": 1.25,
"slope": 1.75,
"shader": 0.000005
},
"radius": [0.95, 0],
"resolution": 1536
} },
// regex matches
// "/^prop_physics_[^o]/": { "action": "load", "payload": { "import": "/prop.json" } },
// "/^prop_physics_override/": { "action": "load", "payload": {} },

View File

@ -1,7 +1,7 @@
{
// "import": "./rp_downtown_v2.json"
// "import": "./ss2_medsci1.json"
"import": "./sh2_mcdonalds.json"
// "import": "./mds_mcdonalds.json"
// "import": "./sh2_mcdonalds.json"
"import": "./mds_mcdonalds.json"
// "import": "./gm_construct.json"
}

View File

@ -7,8 +7,8 @@
// { "filename": "./models/tiny_msci.glb" }
// { "filename": "./models/tiny_msci/graph.json" }
{ "filename": "./models/micro_sci.glb" }
// { "filename": "./models/micro_sci/graph.json" }
// { "filename": "./models/micro_sci.glb" }
{ "filename": "./models/micro_sci/graph.json" }
// { "filename": "./models/msci.glb" }
// { "filename": "./models/msci/graph.json" }
@ -28,7 +28,7 @@
"tags": {
"/^worldspawn/": {
"physics": { "type": "mesh", "static": true },
// "grid": { "size": [3,1,3], "epsilon": 0.0001, "cleanup": true, "print": true },
"grid": { "size": [3,1,3], "epsilon": 0.0001, "cleanup": true, "print": true },
"optimize mesh": { "simplify": 0 },
"unwrap mesh": true
},

View File

@ -7,8 +7,8 @@
],
"metadata": {
"light": {
"ambient": [ 0.0, 0.0, 0.0 ],
// "ambient": [ 0.1, 0.1, 0.2 ],
// "ambient": [1.0,1.0,1.0 ],
"ambient": [ 0.1, 0.1, 0.2 ],
"fog": {
"color": [ 0.025, 0.025, 0.1 ],

View File

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

View File

@ -141,8 +141,8 @@ void main() {
{
surface.normal.eye = surface.normal.eye;
surface.position.eye = surface.position.eye;
pbr();
/*
// pbr();
const vec3 F0 = mix(vec3(0.04), surface.material.albedo.rgb, surface.material.metallic);
for ( uint i = 0; i < min(ubo.lights, lights.length()); ++i ) {
const Light light = lights[i];
@ -187,7 +187,6 @@ void main() {
surface.light.rgb += (diffuse + specular) * Lr * cosLi;
surface.light.a += light.power * La * Ls;
}
*/
}
#define EXPOSURE 0
#define GAMMA 0

View File

@ -18,7 +18,14 @@ namespace {\
});\
});\
}
/*
namespace sol {\
template <>\
struct is_automagical<type> : std::false_type {};\
}\
*/
#define UF_LUA_REGISTER_USERTYPE(type, ...) \
namespace {\
@ -31,6 +38,7 @@ namespace {\
#define UF_LUA_REGISTER_USERTYPE_DEFINE(k, v) #k, v
#define UF_LUA_REGISTER_USERTYPE_MEMBER(member) UF_NS_GET_LAST(member), &member
//#define UF_LUA_REGISTER_USERTYPE_MEMBER(member) UF_NS_GET_LAST(member), sol::as_function(&member)
#define UF_LUA_REGISTER_USERTYPE_MEMBER_FUN(member) UF_NS_GET_LAST(member), UF_LUA_C_FUN(member)
#define UF_LUA_C_FUN(x) sol::c_call<decltype(&x), &x>

View File

@ -3,11 +3,10 @@
#if UF_USE_FMT
#if UF_ENV_DREAMCAST
#define FMT_HEADER_ONLY
#include <fmt-7/format.h>
#else
// #include <fmt/core.h>
#endif
#include <fmt/core.h>
#include <fmt/format.h>
#include <fmt/chrono.h>
#endif
#include <uf/utils/memory/string.h>

View File

@ -236,7 +236,7 @@ namespace {
// remove extraneous buffers
uf::stl::vector<uf::stl::string> attributesKept = ext::json::vector<uf::stl::string>(graph.metadata["decode"]["attributes"]);
#if 1
#if 0
if ( !mesh.isInterleaved() ) {
uf::stl::vector<size_t> remove; remove.reserve(mesh.vertex.attributes.size());
@ -252,7 +252,7 @@ namespace {
mesh.vertex.attributes.erase(mesh.vertex.attributes.begin() + i);
}
} else {
UF_MSG_DEBUG("Attribute removal requested yet mesh is not interleaved, ignoring...");
UF_MSG_DEBUG("Attribute removal requested yet mesh is interleaved, ignoring...");
}
#endif

View File

@ -102,7 +102,8 @@ void uf::graph::initializeGraphics( pod::Graph& graph, uf::Object& entity, uf::M
if ( uf::matrix::reverseInfiniteProjection ) {
graphic.descriptor.frontFace = graph.metadata["renderer"]["invert"].as<bool>(true) ? uf::renderer::enums::Face::CW : uf::renderer::enums::Face::CCW;
} else {
graphic.descriptor.frontFace = graph.metadata["renderer"]["invert"].as<bool>(true) ? uf::renderer::enums::Face::CCW : uf::renderer::enums::Face::CW;
graphic.descriptor.frontFace = graph.metadata["renderer"]["invert"].as<bool>(true) ? uf::renderer::enums::Face::CW : uf::renderer::enums::Face::CCW;
// graphic.descriptor.frontFace = graph.metadata["renderer"]["invert"].as<bool>(true) ? uf::renderer::enums::Face::CCW : uf::renderer::enums::Face::CW;
}
}
else UF_MSG_WARNING("Invalid Face enum string specified: {}", mode);
@ -386,6 +387,8 @@ void uf::graph::initializeGraphics( pod::Graph& graph, uf::Object& entity, uf::M
{ "samplerCubemaps", maxCubemaps },
});
// shader.buffers.emplace_back( uf::graph::storage.buffers.camera.alias() );
shader.aliasBuffer( "camera", uf::graph::storage.buffers.camera );
shader.buffers.emplace_back( uf::graph::storage.buffers.drawCommands.alias() );
shader.buffers.emplace_back( uf::graph::storage.buffers.instance.alias() );
shader.buffers.emplace_back( uf::graph::storage.buffers.instanceAddresses.alias() );
@ -503,7 +506,7 @@ void uf::graph::process( pod::Graph& graph ) {
// process lightmap
UF_DEBUG_TIMER_MULTITRACE("Parsing lightmaps");
{
if ( true ) {
constexpr const char* UF_GRAPH_DEFAULT_LIGHTMAP = "./lightmap.%i.png";
uf::stl::unordered_map<size_t, uf::stl::string> filenames;
uf::stl::unordered_map<size_t, size_t> lightmapIDs;

View File

@ -1,7 +1,7 @@
#include <uf/ext/ffx/fsr.h>
#if UF_USE_FFX_FSR
#include <uf/ext/ffx/fsr.h>
#include <ffx_fsr2/ffx_fsr2.h>
#include <ffx_fsr2/vk/ffx_fsr2_vk.h>

View File

@ -1,5 +1,6 @@
#include <uf/ext/json/json.h>
#include <uf/utils/io/iostream.h>
#include <uf/utils/string/ext.h>
#include <iomanip>
uf::stl::string ext::json::PREFERRED_COMPRESSION = "";

View File

@ -115,6 +115,7 @@ namespace binds {
}
namespace io {
void print( sol::variadic_args va ) {
#if UF_USE_FMT
size_t count = va.size();
for ( auto value : va ) {
uf::stl::string str = ext::lua::state["tostring"]( value );
@ -123,6 +124,16 @@ namespace binds {
}
fmt::print("\n");
std::cout.flush();
#else
size_t count = va.size();
for ( auto value : va ) {
uf::stl::string str = ext::lua::state["tostring"]( value );
std::cout << str;
if ( --count != 0 ) std::cout << "\t";
}
std::cout <<"\n");
std::cout.flush();
#endif
};
}
namespace math {

View File

@ -27,10 +27,8 @@ UF_LUA_REGISTER_USERTYPE(pod::Physics,
UF_LUA_REGISTER_USERTYPE_DEFINE( rotationalVelocity, UF_LUA_C_FUN(::binds::rotationalVelocity) ),
UF_LUA_REGISTER_USERTYPE_DEFINE( setLinearVelocity, UF_LUA_C_FUN(::binds::setLinearVelocity) ),
UF_LUA_REGISTER_USERTYPE_DEFINE( setRotationalVelocity, UF_LUA_C_FUN(::binds::setRotationalVelocity) )
)
UF_LUA_REGISTER_USERTYPE_DEFINE( setRotationalVelocity, UF_LUA_C_FUN(::binds::setRotationalVelocity) ),
UF_LUA_REGISTER_USERTYPE(pod::PhysicsState,
UF_LUA_REGISTER_USERTYPE_DEFINE( setVelocity, UF_LUA_C_FUN(uf::physics::impl::setVelocity) ),
UF_LUA_REGISTER_USERTYPE_DEFINE( setImpulse, UF_LUA_C_FUN(uf::physics::impl::setImpulse) ),
UF_LUA_REGISTER_USERTYPE_DEFINE( applyImpulse, UF_LUA_C_FUN(uf::physics::impl::applyImpulse) ),

View File

@ -2,77 +2,81 @@
#if UF_USE_LUA
#include <uf/utils/math/quaternion.h>
namespace {
typedef pod::Quaternion<> Quaternion;
}
namespace binds {
float index( const pod::Quaternion<>& self, size_t index ) {
float index( const ::Quaternion& self, size_t index ) {
return self[index];
}
pod::Quaternion<> lookAt( const pod::Vector3f& at, const pod::Vector3f& up ) {
::Quaternion lookAt( const pod::Vector3f& at, const pod::Vector3f& up ) {
return uf::quaternion::lookAt( at, up );
}
pod::Quaternion<> normalize( const pod::Quaternion<>& self ) {
::Quaternion normalize( const ::Quaternion& self ) {
return uf::quaternion::normalize( self );
}
pod::Quaternion<> multiply( const pod::Quaternion<>& left, const pod::Quaternion<>& right ) {
::Quaternion multiply( const ::Quaternion& left, const ::Quaternion& right ) {
return uf::quaternion::multiply( left, right );
}
pod::Quaternion<> axisAngle( sol::object arg, float angle ){
::Quaternion axisAngle( sol::object arg, float angle ){
if ( arg.is<pod::Vector3f>() ) {
return uf::quaternion::axisAngle( arg.as<pod::Vector3f>(), angle );
} else if ( arg.is<sol::table>() ) {
sol::table table = arg.as<sol::table>();
return uf::quaternion::axisAngle( pod::Vector3f{ table[0], table[1], table[2] }, angle );
}
return pod::Quaternion<>{};
return ::Quaternion{};
}
pod::Vector3f rotate( const pod::Quaternion<>& left, const pod::Vector3f& right ) {
pod::Vector3f rotate( const ::Quaternion& left, const pod::Vector3f& right ) {
return uf::quaternion::rotate( left, right );
}
pod::Quaternion<> eulerAngles( const pod::Quaternion<>& quaternion ) {
::Quaternion eulerAngles( const ::Quaternion& quaternion ) {
return uf::quaternion::eulerAngles( quaternion );
}
pod::Quaternion<> conjugate( const pod::Quaternion<>& quaternion ) {
::Quaternion conjugate( const ::Quaternion& quaternion ) {
return uf::quaternion::conjugate( quaternion );
}
pod::Quaternion<> inverse( const pod::Quaternion<>& quaternion ) {
::Quaternion inverse( const ::Quaternion& quaternion ) {
return uf::quaternion::inverse( quaternion );
}
float pitch( const pod::Quaternion<>& quaternion ) {
float pitch( const ::Quaternion& quaternion ) {
return uf::quaternion::pitch( quaternion );
}
float yaw( const pod::Quaternion<>& quaternion ) {
float yaw( const ::Quaternion& quaternion ) {
return uf::quaternion::yaw( quaternion );
}
float roll( const pod::Quaternion<>& quaternion ) {
float roll( const ::Quaternion& quaternion ) {
return uf::quaternion::roll( quaternion );
}
pod::Quaternion<> slerp( const pod::Quaternion<>& left, const pod::Quaternion<>& right, float a ) {
::Quaternion slerp( const ::Quaternion& left, const ::Quaternion& right, float a ) {
return uf::quaternion::slerp( left, right, a );
}
pod::Matrix4f matrix( const pod::Quaternion<>& q ) {
pod::Matrix4f matrix( const ::Quaternion& q ) {
return uf::quaternion::matrix( q );
}
uf::stl::string __tostring( const pod::Quaternion<>& self ) {
uf::stl::string __tostring( const ::Quaternion& self ) {
return uf::string::toString( self );
}
}
UF_LUA_REGISTER_USERTYPE(pod::Quaternion<>,
UF_LUA_REGISTER_USERTYPE(::Quaternion,
sol::call_constructor, sol::initializers(
[]( pod::Quaternion<>& self ) {
[]( ::Quaternion& self ) {
return self = {0,0,0,1};
},
[]( pod::Quaternion<>& self, const pod::Quaternion<>& copy ) {
[]( ::Quaternion& self, const ::Quaternion& copy ) {
return self = copy;
},
[]( pod::Quaternion<>& self, float x, float y, float z, float w ) {
[]( ::Quaternion& self, float x, float y, float z, float w ) {
return self = uf::vector::create(x, y, z, w);
}
),
UF_LUA_REGISTER_USERTYPE_MEMBER(pod::Quaternion<>::x),
UF_LUA_REGISTER_USERTYPE_MEMBER(pod::Quaternion<>::y),
UF_LUA_REGISTER_USERTYPE_MEMBER(pod::Quaternion<>::z),
UF_LUA_REGISTER_USERTYPE_MEMBER(pod::Quaternion<>::w),
UF_LUA_REGISTER_USERTYPE_MEMBER(::Quaternion::x),
UF_LUA_REGISTER_USERTYPE_MEMBER(::Quaternion::y),
UF_LUA_REGISTER_USERTYPE_MEMBER(::Quaternion::z),
UF_LUA_REGISTER_USERTYPE_MEMBER(::Quaternion::w),
UF_LUA_REGISTER_USERTYPE_DEFINE( v, UF_LUA_C_FUN(::binds::index) ),
UF_LUA_REGISTER_USERTYPE_DEFINE( lookAt, UF_LUA_C_FUN(::binds::lookAt) ),

View File

@ -124,6 +124,7 @@ UF_LUA_REGISTER_USERTYPE(pod::Vector3f,
UF_LUA_REGISTER_USERTYPE_DEFINE( dot, UF_LUA_C_FUN(::binds::v3f::dot) ),
UF_LUA_REGISTER_USERTYPE_DEFINE( __tostring, UF_LUA_C_FUN(::binds::v3f::toString) )
)
/*
UF_LUA_REGISTER_USERTYPE(pod::Vector4f,
sol::call_constructor, sol::initializers(
[]( pod::Vector4f& self ) {
@ -156,4 +157,5 @@ UF_LUA_REGISTER_USERTYPE(pod::Vector4f,
UF_LUA_REGISTER_USERTYPE_DEFINE( dot, UF_LUA_C_FUN(::binds::v4f::dot) ),
UF_LUA_REGISTER_USERTYPE_DEFINE( __tostring, UF_LUA_C_FUN(::binds::v4f::toString) )
)
*/
#endif

View File

@ -300,6 +300,10 @@ void ext::opengl::CommandBuffer::drawIndexed( const ext::opengl::CommandBuffer::
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(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.textures.secondary.image && drawInfo.attributes.st.pointer) ) {
GL_ERROR_CHECK(glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE));
} else {
@ -314,6 +318,7 @@ void ext::opengl::CommandBuffer::drawIndexed( const ext::opengl::CommandBuffer::
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)));

View File

@ -464,7 +464,11 @@ void ext::reactphysics::syncTo() {
float mass = body->getMass();
switch ( ext::reactphysics::gravity::mode ) {
case ext::reactphysics::gravity::Mode::PER_OBJECT: if ( body->isGravityEnabled() ) {
#if UF_ENV_DREAMCAST
body->applyForceToCenterOfMass( ::convert(state.stats.gravity * mass) );
#else
body->applyLocalForceAtCenterOfMass( ::convert(state.stats.gravity * mass) );
#endif
} break;
case ext::reactphysics::gravity::Mode::UNIVERSAL: if ( mass > 0 ) {
auto transform = ::convert( body->getTransform() );
@ -492,8 +496,13 @@ void ext::reactphysics::syncTo() {
const float r2 = uf::vector::distanceSquared( b1.position, b2.position );
const float F = G * m1 * m2 / r2;
#if UF_ENV_DREAMCAST
if ( b1.body ) b1.body->applyForceToCenterOfMass(direction * F);
if ( b2.body ) b2.body->applyForceToCenterOfMass(direction * -F);
#else
if ( b1.body ) b1.body->applyLocalForceAtCenterOfMass(direction * F);
if ( b2.body ) b2.body->applyLocalForceAtCenterOfMass(direction * -F);
#endif
}
}
}
@ -555,9 +564,10 @@ void ext::reactphysics::syncFrom( float interp ) {
// apply impulse
void ext::reactphysics::setImpulse( pod::PhysicsState& state, const pod::Vector3f& v ) {
if ( !state.body ) return;
#if !UF_ENV_DREAMCAST
state.body->resetForce();
state.body->resetTorque();
#endif
state.body->setLinearVelocity( ::convert(pod::Vector3f{}) );
state.body->setAngularVelocity( ::convert(pod::Vector3f{}) );
// ext::reactphysics::applyImpulse( state, v );
@ -565,7 +575,11 @@ void ext::reactphysics::setImpulse( pod::PhysicsState& state, const pod::Vector3
void ext::reactphysics::applyImpulse( pod::PhysicsState& state, const pod::Vector3f& v ) {
if ( !state.body ) return;
#if UF_ENV_DREAMCAST
state.body->applyForceToCenterOfMass( ::convert(v) );
#else
state.body->applyLocalForceAtCenterOfMass( ::convert(v) );
#endif
}
// directly move a transform
void ext::reactphysics::applyMovement( pod::PhysicsState& state, const pod::Vector3f& v ) {

View File

@ -319,7 +319,7 @@ void ext::vulkan::DeferredRenderMode::initialize( Device& device ) {
shader.aliasAttachment("scratch", this, VK_IMAGE_LAYOUT_GENERAL);
}
if ( settings::pipelines::culling ) {
if ( false && settings::pipelines::culling ) {
uf::stl::string computeShaderFilename = uf::io::resolveURI(uf::io::root+"/shaders/display/depth-pyramid/comp.spv");
blitter.material.attachShader(computeShaderFilename, uf::renderer::enums::Shader::COMPUTE, "depth-pyramid");
@ -414,7 +414,7 @@ void ext::vulkan::DeferredRenderMode::initialize( Device& device ) {
}
}
if ( settings::pipelines::culling ) {
if ( false && settings::pipelines::culling ) {
descriptor.aux = uf::vector::mips( pod::Vector2ui{ width, height } );
descriptor.pipeline = "depth-pyramid";
descriptor.subpass = 0;
@ -440,7 +440,7 @@ void ext::vulkan::DeferredRenderMode::tick() {
rebuild = true;
renderTarget.initialize( *renderTarget.device );
if ( settings::pipelines::culling ) {
if ( false && settings::pipelines::culling ) {
auto& shader = blitter.material.getShader("compute", "depth-pyramid");
auto attachment = this->getAttachment("depth");
auto mips = uf::vector::mips( pod::Vector2ui{ width, height } );
@ -538,7 +538,7 @@ void ext::vulkan::DeferredRenderMode::tick() {
}
}
if ( settings::pipelines::culling ) {
if ( false && settings::pipelines::culling ) {
descriptor.aux = uf::vector::mips( pod::Vector2ui{ width, height } );
descriptor.pipeline = "depth-pyramid";
descriptor.subpass = 0;
@ -794,8 +794,8 @@ void ext::vulkan::DeferredRenderMode::createCommandBuffers( const uf::stl::vecto
::transitionAttachmentsFrom( this, shader, commandBuffer );
}
// construct depth-pyramid
if ( settings::pipelines::culling && blitter.material.hasShader("compute", "depth-pyramid") ) {
// construct depth-pyramid
if ( false && settings::pipelines::culling && blitter.material.hasShader("compute", "depth-pyramid") ) {
auto& shader = blitter.material.getShader("compute", "depth-pyramid");
// auto mips = attachment.descriptor.mips; // uf::vector::mips( pod::Vector2ui{ renderTarget.width, renderTarget.height } );
auto mips = uf::vector::mips( pod::Vector2ui{ width, height } );

View File

@ -33,8 +33,6 @@
#include "../../ext.h"
#include "../../gui/gui.h"
#include <fmt/chrono.h>
UF_BEHAVIOR_REGISTER_CPP(ext::ExtSceneBehavior)
UF_BEHAVIOR_TRAITS_CPP(ext::ExtSceneBehavior, ticks = true, renders = false, multithread = false) // hangs on initialization
#define this ((uf::Scene*) &self)

View File

@ -2,7 +2,7 @@ ARCH = win64
CDIR =
CC = clang
CXX = clang++
OPTIMIZATIONS = -O3 -fstrict-aliasing -DUF_NO_EXCEPTIONS -march=native -flto
OPTIMIZATIONS = -O3 -fstrict-aliasing -DUF_NO_EXCEPTIONS -flto # -march=native
WARNINGS = -g -Wall -Wno-pointer-arith -Wno-unused-function -Wno-unused-variable -Wno-switch -Wno-reorder-ctor -Wno-ignored-attributes -Wno-c++11-narrowing -Wno-unknown-pragmas -Wno-nullability-completeness -Wno-defaulted-function-deleted -Wno-mismatched-tags
SANITIZE = -fuse-ld=lld # -fsanitize=address -fno-omit-frame-pointer
FLAGS += -std=c++17 $(OPTIMIZATIONS) $(WARNINGS) $(SANITIZE) -fcolor-diagnostics -fansi-escape-codes

View File

@ -2,6 +2,6 @@ ARCH = win64
CDIR =
CC = gcc
CXX = g++
OPTIMIZATIONS = -O3 -g -fstrict-aliasing -DUF_NO_EXCEPTIONS -march=native # -flto
OPTIMIZATIONS = -O3 -g -fstrict-aliasing -DUF_NO_EXCEPTIONS # -march=native # -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++20 $(OPTIMIZATIONS) $(WARNINGS) -fdiagnostics-color=always