Skip to content

Commit 8768b96

Browse files
authored
Merge pull request #226 from Silverlan/develop
2 parents a1fce10 + 5ff0d2b commit 8768b96

9 files changed

Lines changed: 41 additions & 6 deletions

File tree

Addons.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ function(pr_install_git_release IDENTIFIER BASE_URL BASE_DIR TAG_NAME)
124124
endfunction()
125125

126126
if(PRAGMA_WITH_PFM)
127-
pr_install_git_repository(pfm "https://github.com/Silverlan/pfm.git" "e3700e5f7fd9b15af3203a9d03c70dd77cbb1b2d" "addons/filmmaker")
127+
pr_install_git_repository(pfm "https://github.com/Silverlan/pfm.git" "a8124eb1a259e35742797cef7fc77d3ebb89fb14" "addons/filmmaker")
128128
pr_install_git_repository(model_editor "https://github.com/Silverlan/pragma_model_editor.git" "b22cb4a087e317d81413ee27cfe268377dc021b7" "addons/tool_model_editor")
129129

130130
pr_install_git_repository(pfm_demo_living_room "https://github.com/Silverlan/pfm_demo_living_room.git" "4cbecad4a2d6f502b6d9709178883678101f7e2c" "addons/pfm_demo_living_room")

cmake/external_libs.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ pr_fetch_external_lib("mathutil" "https://github.com/Silverlan/ma
3939
pr_fetch_external_lib("networkmanager" "https://github.com/Silverlan/networkmanager" "307e83426280669624ee25f8e3058af96e4e0db3")
4040
pr_fetch_external_lib("oskit" "https://github.com/Silverlan/oskit" "2c13e0963ef719d8c3a806f5c4ea0e151db58367")
4141
pr_fetch_external_lib("panima" "https://github.com/Silverlan/panima" "78d454726fdd3aca3512fb52844af11fe33f11cf")
42-
pr_fetch_external_lib("prosper" "https://github.com/Silverlan/prosper" "e25fb85ea8aab91096b5600ec9a8dd182e06c63d")
42+
pr_fetch_external_lib("prosper" "https://github.com/Silverlan/prosper" "6c37ff363a850d7ab8875057cd114f29c0a198a9")
4343
pr_fetch_external_lib("sharedutils" "https://github.com/Silverlan/sharedutils" "707777f783723c45ac9e29a1154999d9e968c6af")
4444
pr_fetch_external_lib("util_bsp" "https://github.com/Silverlan/util_bsp" "9eeb876a6fafe1b92966bb8f0fe6bd93ebb7b41f")
4545
pr_fetch_external_lib("util_formatted_text" "https://github.com/Silverlan/util_formatted_text" "50bd69695d55a61d9ecab8c3453a88fd8bc17a99")

core/client/src/implementation/engine/engine.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -681,6 +681,11 @@ bool pragma::CEngine::Initialize(int argc, char *argv[])
681681
Engine::Initialize(argc, argv);
682682
SetCLIOnly(g_cli);
683683

684+
if(IsDeveloperModeEnabled()) {
685+
spdlog::info("Developer mode is enabled. Disabling global shader file cache to allow hot-reloading of shader code.");
686+
prosper::glsl::set_global_include_file_cache_enabled(false);
687+
}
688+
684689
#ifdef __linux__
685690
auto xdgSessionType = util::get_env_variable("XDG_SESSION_TYPE");
686691
if(!xdgSessionType || *xdgSessionType != "x11") {

core/client/src/implementation/engine/launch_options.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,13 @@ static void LPARAM_wayland_libdecor_plugin(const std::vector<std::string> &argv)
122122
g_waylandLibdecorPlugin = argv.front();
123123
}
124124

125+
static void LPARAM_disable_global_shader_file_cache(const std::vector<std::string> &argv)
126+
{
127+
if(argv.empty())
128+
return;
129+
prosper::glsl::set_global_include_file_cache_enabled(pragma::util::to_boolean(argv.front()));
130+
}
131+
125132
void pragma::register_client_launch_parameters(LaunchParaMap &map)
126133
{
127134
map.RegisterParameterHelp("-windowed", &LPARAM_windowed, "-window -startwindowed -sw", "start in windowed mode");
@@ -140,6 +147,7 @@ void pragma::register_client_launch_parameters(LaunchParaMap &map)
140147

141148
map.RegisterParameterHelp("-fullbright", &LPARAM_fullbright, "", "start in fullbright mode");
142149

150+
map.RegisterParameterHelp("-enable_global_shader_file_cache", &LPARAM_disable_global_shader_file_cache, "<1/0>", "Enables or disables the global shader file cache. Disable this if you're working on shader files and need to reload them during runtime.");
143151
map.RegisterParameterHelp("-enable_gfx_api_dump", &LPARAM_enable_gfx_api_dump, "<1/0>", "Enables or disables graphics API dump.");
144152
map.RegisterParameterHelp("-enable_gfx_validation", &LPARAM_vk_enable_validation, "<1/0>", "Enables or disables graphics API validation.");
145153
map.RegisterParameterHelp("-enable_gfx_diagnostics", &LPARAM_vk_enable_gfx_diagnostics, "<1/0>", "Enables or disables GPU diagnostics mode.");

core/client/src/implementation/engine/sound.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ pragma::audio::ISoundSystem *pragma::CEngine::InitializeSoundEngine()
5454

5555
auto &baseAudioAPI = GetAudioAPI();
5656
std::vector<std::string> fallbackApis {};
57+
fallbackApis.push_back(baseAudioAPI);
5758
if(baseAudioAPI != "soloud")
5859
fallbackApis.push_back("soloud");
5960
if(baseAudioAPI != "dummy")

core/client/src/implementation/entities/components/environment/lights/light.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ void CLightComponent::SetFalloffExponent(float falloffExponent)
300300
if(falloffExponent == m_bufferData.falloffExponent)
301301
return;
302302
BaseEnvLightComponent::SetFalloffExponent(falloffExponent);
303-
m_bufferData.falloffExponent = falloffExponent;
303+
m_bufferData.SetFalloffExponent(falloffExponent);
304304
if(m_renderBuffer != nullptr)
305305
get_cengine()->GetRenderContext().ScheduleRecordUpdateBuffer(m_renderBuffer, offsetof(LightBufferData, falloffExponent), m_bufferData.falloffExponent);
306306
}

core/client/src/implementation/entities/components/environment/lights/light_spot.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ void CLightSpotComponent::SetFieldAngleComponent(BaseFieldAngleComponent &c)
4949
if(pLightComponent.expired())
5050
return;
5151
auto &bufferData = pLightComponent->GetBufferData();
52-
bufferData.outerConeHalfAngle = static_cast<math::Radian>(math::deg_to_rad(newAng.get() / 2.f));
52+
bufferData.SetOuterConeHalfAngle(newAng.get() / 2.f);
5353
auto &renderBuffer = pLightComponent->GetRenderBuffer();
5454
if(renderBuffer != nullptr)
5555
get_cengine()->GetRenderContext().ScheduleRecordUpdateBuffer(renderBuffer, offsetof(LightBufferData, outerConeHalfAngle), bufferData.outerConeHalfAngle);
@@ -68,7 +68,7 @@ void CLightSpotComponent::UpdateInnerConeAngle()
6868
if(pLightComponent.expired())
6969
return;
7070
auto &bufferData = pLightComponent->GetBufferData();
71-
bufferData.innerConeHalfAngle = math::deg_to_rad(CalcInnerConeAngle(GetOuterConeAngle(), GetBlendFraction()) / 2.f);
71+
bufferData.SetInnerConeHalfAngle(CalcInnerConeAngle(GetOuterConeAngle(), GetBlendFraction()) / 2.f);
7272
auto &renderBuffer = pLightComponent->GetRenderBuffer();
7373
if(renderBuffer != nullptr)
7474
get_cengine()->GetRenderContext().ScheduleRecordUpdateBuffer(renderBuffer, offsetof(LightBufferData, innerConeHalfAngle), bufferData.innerConeHalfAngle);

core/client/src/implementation/game/lua_bindings.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,6 @@ void pragma::CGame::RegisterLua()
472472

473473
{"KEY_SCRL_UP", GLFW_CUSTOM_KEY_SCRL_UP},
474474
{"KEY_SCRL_DOWN", GLFW_CUSTOM_KEY_SCRL_DOWN},
475-
{"KEY_SCRL_DOWN", GLFW_CUSTOM_KEY_SCRL_DOWN},
476475

477476
{"KEY_MOUSE_BUTTON_1", GLFW_KEY_SPECIAL_MOUSE_BUTTON_1},
478477
{"KEY_MOUSE_BUTTON_2", GLFW_KEY_SPECIAL_MOUSE_BUTTON_2},

core/client/src/interface/rendering/lighting/light_data.cppm

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ export import std.compat;
1313
export namespace pragma {
1414
#pragma pack(push, 1)
1515
struct LightBufferData {
16+
private:
17+
static constexpr float EPSILON = 0.00001f;
18+
public:
1619
enum class BufferFlags : uint32_t { None = 0, TurnedOn = 1, TypeSpot = TurnedOn << 1, TypePoint = TypeSpot << 1, TypeDirectional = TypePoint << 1, BakedLightSource = TypeDirectional << 1 };
1720
Vector4 position {}; // position.w = distance
1821
Vector3 color {1.f, 1.f, 1.f};
@@ -31,6 +34,25 @@ export namespace pragma {
3134

3235
float falloffExponent = 1.f;
3336
std::array<float, 3> padding = {}; // Padding to vec4
37+
38+
// These should be preferred over setting the values manually, as they ensure safe values.
39+
void SetInnerConeHalfAngle(math::Degree angle)
40+
{
41+
auto newAngle = math::deg_to_rad(angle);
42+
newAngle = math::clamp<float>(newAngle, EPSILON, math::pi_2 - (EPSILON * 2.0f));
43+
innerConeHalfAngle = newAngle;
44+
if(outerConeHalfAngle < innerConeHalfAngle + EPSILON)
45+
outerConeHalfAngle = innerConeHalfAngle + EPSILON;
46+
}
47+
void SetOuterConeHalfAngle(math::Degree angle)
48+
{
49+
auto newAngle = math::deg_to_rad(angle);
50+
newAngle = math::clamp<float>(newAngle, EPSILON * 2.0f, math::pi_2 - EPSILON);
51+
outerConeHalfAngle = newAngle;
52+
if(innerConeHalfAngle > outerConeHalfAngle - EPSILON)
53+
innerConeHalfAngle = outerConeHalfAngle - EPSILON;
54+
}
55+
void SetFalloffExponent(float newFalloffExponent) { falloffExponent = math::max(newFalloffExponent, EPSILON); }
3456
};
3557
struct ShadowBufferData {
3658
Mat4 depthVP = umat::identity();

0 commit comments

Comments
 (0)