diff --git a/.github/workflows/build-nightly.yml b/.github/workflows/build-nightly.yml index 2bddea4e9..b9338f239 100644 --- a/.github/workflows/build-nightly.yml +++ b/.github/workflows/build-nightly.yml @@ -37,8 +37,9 @@ jobs: Content/ README.md LICENSE.md - other_licenses.txt + third_party_software.txt features.txt + credits.txt Editor/images/ Editor/terrain/ Editor/sound/ @@ -55,8 +56,9 @@ jobs: Content/ README.md LICENSE.md - other_licenses.txt + third_party_software.txt features.txt + credits.txt Tests/images/ Tests/sound/ Tests/*.ini @@ -107,8 +109,9 @@ jobs: Content/ README.md LICENSE.md - other_licenses.txt + third_party_software.txt features.txt + credits.txt Editor/images/ Editor/terrain/ Editor/sound/ @@ -125,8 +128,9 @@ jobs: Content/ README.md LICENSE.md - other_licenses.txt + third_party_software.txt features.txt + credits.txt Tests/images/ Tests/sound/ Tests/*.ini @@ -176,8 +180,9 @@ jobs: Content/ README.md LICENSE.md - other_licenses.txt + third_party_software.txt features.txt + credits.txt Editor/images/ Editor/terrain/ Editor/sound/ @@ -194,8 +199,9 @@ jobs: Content/ README.md LICENSE.md - other_licenses.txt + third_party_software.txt features.txt + credits.txt Tests/images/ Tests/sound/ Tests/*.ini diff --git a/.github/workflows/build-pr.yml b/.github/workflows/build-pr.yml index 546c109a7..6dfd34768 100644 --- a/.github/workflows/build-pr.yml +++ b/.github/workflows/build-pr.yml @@ -36,8 +36,9 @@ jobs: Content/ README.md LICENSE.md - other_licenses.txt + third_party_software.txt features.txt + credits.txt Editor/images/ Editor/terrain/ Editor/sound/ @@ -54,8 +55,9 @@ jobs: Content/ README.md LICENSE.md - other_licenses.txt + third_party_software.txt features.txt + credits.txt Tests/images/ Tests/sound/ Tests/*.ini @@ -107,8 +109,9 @@ jobs: Content/ README.md LICENSE.md - other_licenses.txt + third_party_software.txt features.txt + credits.txt Editor/images/ Editor/terrain/ Editor/sound/ @@ -125,8 +128,9 @@ jobs: Content/ README.md LICENSE.md - other_licenses.txt + third_party_software.txt features.txt + credits.txt Tests/images/ Tests/sound/ Tests/*.ini @@ -176,8 +180,9 @@ jobs: Content/ README.md LICENSE.md - other_licenses.txt + third_party_software.txt features.txt + credits.txt Editor/images/ Editor/terrain/ Editor/sound/ @@ -194,8 +199,9 @@ jobs: Content/ README.md LICENSE.md - other_licenses.txt + third_party_software.txt features.txt + credits.txt Tests/images/ Tests/sound/ Tests/*.ini diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2e746da2f..1387eabcf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -37,8 +37,9 @@ jobs: Content/ README.md LICENSE.md - other_licenses.txt + third_party_software.txt features.txt + credits.txt Editor/images/ Editor/terrain/ Editor/sound/ @@ -55,8 +56,9 @@ jobs: Content/ README.md LICENSE.md - other_licenses.txt + third_party_software.txt features.txt + credits.txt Tests/images/ Tests/sound/ Tests/*.ini @@ -108,8 +110,9 @@ jobs: Content/ README.md LICENSE.md - other_licenses.txt + third_party_software.txt features.txt + credits.txt Editor/images/ Editor/terrain/ Editor/sound/ @@ -126,8 +129,9 @@ jobs: Content/ README.md LICENSE.md - other_licenses.txt + third_party_software.txt features.txt + credits.txt Tests/images/ Tests/sound/ Tests/*.ini @@ -177,8 +181,9 @@ jobs: Content/ README.md LICENSE.md - other_licenses.txt + third_party_software.txt features.txt + credits.txt Editor/images/ Editor/terrain/ Editor/sound/ @@ -195,8 +200,9 @@ jobs: Content/ README.md LICENSE.md - other_licenses.txt + third_party_software.txt features.txt + credits.txt Tests/images/ Tests/sound/ Tests/*.ini diff --git a/Content/Content.vcxitems b/Content/Content.vcxitems index f4d7b7407..0bc4db635 100644 --- a/Content/Content.vcxitems +++ b/Content/Content.vcxitems @@ -314,6 +314,10 @@ true true + + true + true + true true diff --git a/Content/Content.vcxitems.filters b/Content/Content.vcxitems.filters index a7b233078..aaf422097 100644 --- a/Content/Content.vcxitems.filters +++ b/Content/Content.vcxitems.filters @@ -204,6 +204,9 @@ scripts + + models + diff --git a/Content/Documentation/ScriptingAPI-Documentation.md b/Content/Documentation/ScriptingAPI-Documentation.md index 5e7363f77..c34a38fae 100644 --- a/Content/Documentation/ScriptingAPI-Documentation.md +++ b/Content/Documentation/ScriptingAPI-Documentation.md @@ -582,13 +582,17 @@ Describes an orientation in 3D space. - [outer]POINT : int - [outer]SPOT : int - SetRange(float value) -- SetEnergy(float value) +- SetIntensity(float value) -- Brightness of light in. The units that this is defined in depend on the type of light. Point and spot lights use luminous intensity in candela (lm/sr) while directional lights use illuminance in lux (lm/m2). https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_lights_punctual - SetColor(Vector value) - SetCastShadow(bool value) - SetVolumetricsEnabled(bool value) -- SetFOV(float value) +- SetOuterConeAngle(float value) -- outer cone angle for spotlight in radians +- SetInnerConeAngle(float value) -- inner cone angle for spotlight in radians (0 <= innerConeAngle <= outerConeAngle). Value of 0 disables inner cone angle - GetType() : int result +- SetEnergy(float value) -- kept for backwards compatibility with non physical light units (before v0.70.0) +- SetFOV(float value) -- kept for backwards compatibility with FOV angle (before v0.70.0) + #### ObjectComponent - GetMeshID() : Entity - GetColor() : Vector diff --git a/Content/models/Sponza/sponza.wiscene b/Content/models/Sponza/sponza.wiscene index dfabe8d8f..dd6fdaf2e 100644 Binary files a/Content/models/Sponza/sponza.wiscene and b/Content/models/Sponza/sponza.wiscene differ diff --git a/Content/models/cloth_test.wiscene b/Content/models/cloth_test.wiscene index c56bcf969..ea4bd2b38 100644 Binary files a/Content/models/cloth_test.wiscene and b/Content/models/cloth_test.wiscene differ diff --git a/Content/models/gltf_KHR_lights_punctual_test.glb b/Content/models/gltf_KHR_lights_punctual_test.glb new file mode 100644 index 000000000..47f70c870 Binary files /dev/null and b/Content/models/gltf_KHR_lights_punctual_test.glb differ diff --git a/Content/models/shadows_test.wiscene b/Content/models/shadows_test.wiscene index a10dffa40..82cf2edff 100644 Binary files a/Content/models/shadows_test.wiscene and b/Content/models/shadows_test.wiscene differ diff --git a/Content/models/shadowspriority_spot_test.wiscene b/Content/models/shadowspriority_spot_test.wiscene index e0ecec12e..b61f5d330 100644 Binary files a/Content/models/shadowspriority_spot_test.wiscene and b/Content/models/shadowspriority_spot_test.wiscene differ diff --git a/Content/models/teapot.wiscene b/Content/models/teapot.wiscene index 8a8bc522f..36aac23eb 100644 Binary files a/Content/models/teapot.wiscene and b/Content/models/teapot.wiscene differ diff --git a/Content/models/volumetric_test.wiscene b/Content/models/volumetric_test.wiscene index d7b8e7524..505f61035 100644 Binary files a/Content/models/volumetric_test.wiscene and b/Content/models/volumetric_test.wiscene differ diff --git a/Content/models/water_test.wiscene b/Content/models/water_test.wiscene index d49996d90..5085dc29a 100644 Binary files a/Content/models/water_test.wiscene and b/Content/models/water_test.wiscene differ diff --git a/Content/scripts/fighting_game.lua b/Content/scripts/fighting_game.lua index c0ca67e46..bdce2d5d8 100644 --- a/Content/scripts/fighting_game.lua +++ b/Content/scripts/fighting_game.lua @@ -109,7 +109,7 @@ local function Character(face, skin_color, shirt_color, hair_color, shoe_color) local light_component = scene.Component_CreateLight(entity) light_component.SetType(POINT) light_component.SetRange(8) - light_component.SetEnergy(4) + light_component.SetIntensity(20) if(self:require_hitconfirm_guard()) then light_component.SetColor(Vector(0,0.5,1)) -- guarded attack emits blueish light else diff --git a/Content/scripts/spawn_many_lights.lua b/Content/scripts/spawn_many_lights.lua index 41c991ab1..2c9a23e7b 100644 --- a/Content/scripts/spawn_many_lights.lua +++ b/Content/scripts/spawn_many_lights.lua @@ -22,7 +22,7 @@ for i=1,200 do local light_component = scene.Component_CreateLight(entity) light_component.SetType(POINT) light_component.SetRange(12) - light_component.SetEnergy(6) + light_component.SetIntensity(40) light_component.SetColor(Vector(1,0.5,0)) -- orange color --light_component.SetColor(Vector(math.random(),math.random(),math.random())) -- random color --light_component.SetVolumetricsEnabled(true) diff --git a/Editor/LightWindow.cpp b/Editor/LightWindow.cpp index 34a640ea1..ddd4f1e4b 100644 --- a/Editor/LightWindow.cpp +++ b/Editor/LightWindow.cpp @@ -19,19 +19,19 @@ void LightWindow::Create(EditorComponent* editor) float hei = 18; float step = hei + 2; - energySlider.Create(0.1f, 64, 0, 100000, "Energy: "); - energySlider.SetSize(XMFLOAT2(100, hei)); - energySlider.SetPos(XMFLOAT2(x, y)); - energySlider.OnSlide([&](wi::gui::EventArgs args) { + intensitySlider.Create(0, 1000, 0, 100000, "Intensity: "); + intensitySlider.SetSize(XMFLOAT2(100, hei)); + intensitySlider.SetPos(XMFLOAT2(x, y)); + intensitySlider.OnSlide([&](wi::gui::EventArgs args) { LightComponent* light = wi::scene::GetScene().lights.GetComponent(entity); if (light != nullptr) { - light->energy = args.fValue; + light->intensity = args.fValue; } }); - energySlider.SetEnabled(false); - energySlider.SetTooltip("Adjust the light radiation amount inside the maximum range"); - AddWidget(&energySlider); + intensitySlider.SetEnabled(false); + intensitySlider.SetTooltip("Brightness of light in. The units that this is defined in depend on the type of light. \nPoint and spot lights use luminous intensity in candela (lm/sr) while directional lights use illuminance in lux (lm/m2)."); + AddWidget(&intensitySlider); rangeSlider.Create(1, 1000, 0, 100000, "Range: "); rangeSlider.SetSize(XMFLOAT2(100, hei)); @@ -47,75 +47,33 @@ void LightWindow::Create(EditorComponent* editor) rangeSlider.SetTooltip("Adjust the maximum range the light can affect."); AddWidget(&rangeSlider); - //radiusSlider.Create(0.01f, 10, 0, 100000, "Radius: "); - //radiusSlider.SetSize(XMFLOAT2(100, hei)); - //radiusSlider.SetPos(XMFLOAT2(x, y += step)); - //radiusSlider.OnSlide([&](wi::gui::EventArgs args) { - // LightComponent* light = wi::scene::GetScene().lights.GetComponent(entity); - // if (light != nullptr) - // { - // light->radius = args.fValue; - // } - //}); - //radiusSlider.SetEnabled(false); - //radiusSlider.SetTooltip("Adjust the radius of an area light."); - //AddWidget(&radiusSlider); - - //widthSlider.Create(1, 10, 0, 100000, "Width: "); - //widthSlider.SetSize(XMFLOAT2(100, hei)); - //widthSlider.SetPos(XMFLOAT2(x, y += step)); - //widthSlider.OnSlide([&](wi::gui::EventArgs args) { - // LightComponent* light = wi::scene::GetScene().lights.GetComponent(entity); - // if (light != nullptr) - // { - // light->width = args.fValue; - // } - //}); - //widthSlider.SetEnabled(false); - //widthSlider.SetTooltip("Adjust the width of an area light."); - //AddWidget(&widthSlider); - - //heightSlider.Create(1, 10, 0, 100000, "Height: "); - //heightSlider.SetSize(XMFLOAT2(100, hei)); - //heightSlider.SetPos(XMFLOAT2(x, y += step)); - //heightSlider.OnSlide([&](wi::gui::EventArgs args) { - // LightComponent* light = wi::scene::GetScene().lights.GetComponent(entity); - // if (light != nullptr) - // { - // light->height = args.fValue; - // } - //}); - //heightSlider.SetEnabled(false); - //heightSlider.SetTooltip("Adjust the height of an area light."); - //AddWidget(&heightSlider); - - fovSlider.Create(0.1f, XM_PI - 0.01f, 0, 100000, "FOV: "); - fovSlider.SetSize(XMFLOAT2(100, hei)); - fovSlider.SetPos(XMFLOAT2(x, y += step)); - fovSlider.OnSlide([&](wi::gui::EventArgs args) { + outerConeAngleSlider.Create(0.1f, XM_PIDIV2 - 0.01f, 0, 100000, "Outer Cone Angle: "); + outerConeAngleSlider.SetSize(XMFLOAT2(100, hei)); + outerConeAngleSlider.SetPos(XMFLOAT2(x, y += step)); + outerConeAngleSlider.OnSlide([&](wi::gui::EventArgs args) { LightComponent* light = wi::scene::GetScene().lights.GetComponent(entity); if (light != nullptr) { - light->fov = args.fValue; + light->outerConeAngle = args.fValue; } }); - fovSlider.SetEnabled(false); - fovSlider.SetTooltip("Adjust the cone aperture for spotlight."); - AddWidget(&fovSlider); + outerConeAngleSlider.SetEnabled(false); + outerConeAngleSlider.SetTooltip("Adjust the main cone aperture for spotlight."); + AddWidget(&outerConeAngleSlider); - fovInnerSlider.Create(0, XM_PI - 0.01f, 0, 100000, "FOV (inner): "); - fovInnerSlider.SetSize(XMFLOAT2(100, hei)); - fovInnerSlider.SetPos(XMFLOAT2(x, y += step)); - fovInnerSlider.OnSlide([&](wi::gui::EventArgs args) { + innerConeAngleSlider.Create(0, XM_PI - 0.01f, 0, 100000, "Inner Cone Angle: "); + innerConeAngleSlider.SetSize(XMFLOAT2(100, hei)); + innerConeAngleSlider.SetPos(XMFLOAT2(x, y += step)); + innerConeAngleSlider.OnSlide([&](wi::gui::EventArgs args) { LightComponent* light = wi::scene::GetScene().lights.GetComponent(entity); if (light != nullptr) { - light->fov_inner = args.fValue; + light->innerConeAngle = args.fValue; } }); - fovInnerSlider.SetEnabled(false); - fovInnerSlider.SetTooltip("Adjust the inner cone aperture for spotlight.\n(The inner cone will always be inside the outer/main cone)"); - AddWidget(&fovInnerSlider); + innerConeAngleSlider.SetEnabled(false); + innerConeAngleSlider.SetTooltip("Adjust the inner cone aperture for spotlight.\n(The inner cone will always be inside the outer cone)"); + AddWidget(&innerConeAngleSlider); shadowCheckBox.Create("Shadow: "); shadowCheckBox.SetSize(XMFLOAT2(hei, hei)); @@ -183,6 +141,21 @@ void LightWindow::Create(EditorComponent* editor) { light->type = (LightComponent::LightType)typeSelectorComboBox.GetSelected(); + switch (light->type) + { + case LightComponent::LightType::DIRECTIONAL: + light->intensity = 10; + break; + case LightComponent::LightType::SPOT: + light->intensity = 100; + break; + case LightComponent::LightType::POINT: + light->intensity = 20; + break; + default: + break; + } + wi::Archive& archive = editor->AdvanceHistory(); archive << EditorComponent::HISTORYOP_ADD; editor->RecordSelection(archive); @@ -326,14 +299,11 @@ void LightWindow::SetEntity(Entity entity) if (light != nullptr) { - energySlider.SetEnabled(true); - energySlider.SetValue(light->energy); + intensitySlider.SetEnabled(true); + intensitySlider.SetValue(light->intensity); rangeSlider.SetValue(light->range); - //radiusSlider.SetValue(light->radius); - //widthSlider.SetValue(light->width); - //heightSlider.SetValue(light->height); - fovSlider.SetValue(light->fov); - fovInnerSlider.SetValue(light->fov_inner); + outerConeAngleSlider.SetValue(light->outerConeAngle); + innerConeAngleSlider.SetValue(light->innerConeAngle); shadowCheckBox.SetEnabled(true); shadowCheckBox.SetCheck(light->IsCastingShadow()); haloCheckBox.SetEnabled(true); @@ -369,13 +339,13 @@ void LightWindow::SetEntity(Entity entity) radiusSlider.SetEnabled(false); widthSlider.SetEnabled(false); heightSlider.SetEnabled(false); - fovSlider.SetEnabled(false); - fovInnerSlider.SetEnabled(false); + outerConeAngleSlider.SetEnabled(false); + innerConeAngleSlider.SetEnabled(false); shadowCheckBox.SetEnabled(false); haloCheckBox.SetEnabled(false); volumetricsCheckBox.SetEnabled(false); staticCheckBox.SetEnabled(false); - energySlider.SetEnabled(false); + intensitySlider.SetEnabled(false); colorPicker.SetEnabled(false); shadowResolutionComboBox.SetEnabled(false); @@ -390,35 +360,24 @@ void LightWindow::SetLightType(LightComponent::LightType type) if (type == LightComponent::DIRECTIONAL) { rangeSlider.SetEnabled(false); - fovSlider.SetEnabled(false); - fovInnerSlider.SetEnabled(false); + outerConeAngleSlider.SetEnabled(false); + innerConeAngleSlider.SetEnabled(false); } else { - //if (type == LightComponent::SPHERE || type == LightComponent::DISC || type == LightComponent::RECTANGLE || type == LightComponent::TUBE) - //{ - // rangeSlider.SetEnabled(false); - // radiusSlider.SetEnabled(true); - // widthSlider.SetEnabled(true); - // heightSlider.SetEnabled(true); - // fovSlider.SetEnabled(false); - //} - //else + rangeSlider.SetEnabled(true); + radiusSlider.SetEnabled(false); + widthSlider.SetEnabled(false); + heightSlider.SetEnabled(false); + if (type == LightComponent::SPOT) { - rangeSlider.SetEnabled(true); - radiusSlider.SetEnabled(false); - widthSlider.SetEnabled(false); - heightSlider.SetEnabled(false); - if (type == LightComponent::SPOT) - { - fovSlider.SetEnabled(true); - fovInnerSlider.SetEnabled(true); - } - else - { - fovSlider.SetEnabled(false); - fovInnerSlider.SetEnabled(false); - } + outerConeAngleSlider.SetEnabled(true); + innerConeAngleSlider.SetEnabled(true); + } + else + { + outerConeAngleSlider.SetEnabled(false); + innerConeAngleSlider.SetEnabled(false); } } diff --git a/Editor/LightWindow.h b/Editor/LightWindow.h index 6507427bb..972524b8a 100644 --- a/Editor/LightWindow.h +++ b/Editor/LightWindow.h @@ -13,13 +13,13 @@ public: void SetLightType(wi::scene::LightComponent::LightType type); - wi::gui::Slider energySlider; + wi::gui::Slider intensitySlider; wi::gui::Slider rangeSlider; wi::gui::Slider radiusSlider; wi::gui::Slider widthSlider; wi::gui::Slider heightSlider; - wi::gui::Slider fovSlider; - wi::gui::Slider fovInnerSlider; + wi::gui::Slider outerConeAngleSlider; + wi::gui::Slider innerConeAngleSlider; wi::gui::CheckBox shadowCheckBox; wi::gui::CheckBox haloCheckBox; wi::gui::CheckBox volumetricsCheckBox; diff --git a/Editor/ModelImporter_GLTF.cpp b/Editor/ModelImporter_GLTF.cpp index 9131c30a4..14a4df57e 100644 --- a/Editor/ModelImporter_GLTF.cpp +++ b/Editor/ModelImporter_GLTF.cpp @@ -1386,10 +1386,11 @@ void ImportModel_GLTF(const std::string& fileName, Scene& scene) light.color = XMFLOAT3(float(x.color[0]), float(x.color[1]), float(x.color[2])); } - light.energy = float(x.intensity); + light.intensity = float(x.intensity); light.range = x.range > 0 ? float(x.range) : std::numeric_limits::max(); - light.fov = float(x.spot.outerConeAngle) * 2; // *2: in engine, fov is a value directly used for shadow camera, in gltf, it's cone angle - light.fov_inner = float(x.spot.innerConeAngle) * 2; // *2: in engine, fov is a value directly used for shadow camera, in gltf, it's cone angle + light.outerConeAngle = float(x.spot.outerConeAngle); + light.innerConeAngle = float(x.spot.innerConeAngle); + light.SetCastShadow(true); // In gltf, default light direction is forward, in engine, it's downwards, so apply a rotation: TransformComponent& transform = *scene.transforms.GetComponent(entity); diff --git a/Editor/TerrainGenerator.cpp b/Editor/TerrainGenerator.cpp index f7415f366..971c602ca 100644 --- a/Editor/TerrainGenerator.cpp +++ b/Editor/TerrainGenerator.cpp @@ -578,7 +578,7 @@ void TerrainGenerator::Generation_Restart() scene->Component_Attach(sunEntity, terrainEntity); LightComponent& light = *scene->lights.GetComponent(sunEntity); light.SetType(LightComponent::LightType::DIRECTIONAL); - light.energy = 16; + light.intensity = 16; light.SetCastShadow(true); //light.SetVolumetricsEnabled(true); TransformComponent& transform = *scene->transforms.GetComponent(sunEntity); diff --git a/Editor/terrain/bush.wiscene b/Editor/terrain/bush.wiscene index 00a232e48..97b337498 100644 Binary files a/Editor/terrain/bush.wiscene and b/Editor/terrain/bush.wiscene differ diff --git a/WickedEngine/ArchiveVersionHistory.txt b/WickedEngine/ArchiveVersionHistory.txt index 863f0e7de..2fa2df4b9 100644 --- a/WickedEngine/ArchiveVersionHistory.txt +++ b/WickedEngine/ArchiveVersionHistory.txt @@ -1,5 +1,6 @@ This file contains changelog of wi::Archive versions +83: physical light units 82: serialized LightComponent::fov_inner 81: serialized LightComponent::forced_shadow_resolution 80: object draw distance diff --git a/WickedEngine/shaders/ShaderInterop_Renderer.h b/WickedEngine/shaders/ShaderInterop_Renderer.h index 8df2f86c4..be5a09579 100644 --- a/WickedEngine/shaders/ShaderInterop_Renderer.h +++ b/WickedEngine/shaders/ShaderInterop_Renderer.h @@ -501,7 +501,7 @@ struct ShaderEntity } inline float GetGravity() { - return GetAngleOffset(); + return GetConeAngleCos(); } #else @@ -558,7 +558,7 @@ struct ShaderEntity } inline void SetGravity(float value) { - SetAngleOffset(value); + SetConeAngleCos(value); } #endif // __cplusplus diff --git a/WickedEngine/shaders/ShaderInterop_Weather.h b/WickedEngine/shaders/ShaderInterop_Weather.h index 66f9cc12c..7d0f064dc 100644 --- a/WickedEngine/shaders/ShaderInterop_Weather.h +++ b/WickedEngine/shaders/ShaderInterop_Weather.h @@ -284,7 +284,7 @@ struct ShaderOcean struct ShaderWeather { float3 sun_color; - float sun_energy; + float stars; // number of stars (0: disable stars, >0: increase number of stars) float3 sun_direction; uint most_important_light_index; @@ -303,9 +303,6 @@ struct ShaderWeather float cloud_shadow_scale; float cloud_shadow_speed; - float3 padding; - float stars; // number of stars (0: disable stars, >0: increase number of stars) - float4x4 stars_rotation; ShaderFog fog; diff --git a/WickedEngine/shaders/globals.hlsli b/WickedEngine/shaders/globals.hlsli index dabbfee84..342c0f5b2 100644 --- a/WickedEngine/shaders/globals.hlsli +++ b/WickedEngine/shaders/globals.hlsli @@ -257,9 +257,8 @@ inline float3 clipspace_to_uv(in float3 clipspace) #define DEGAMMA(x) (RemoveSRGBCurve_Fast(x)) #define GAMMA(x) (ApplySRGBCurve_Fast(x)) -inline float3 GetSunColor() { return GetWeather().sun_color; } +inline float3 GetSunColor() { return GetWeather().sun_color; } // sun color with intensity applied inline float3 GetSunDirection() { return GetWeather().sun_direction; } -inline float GetSunEnergy() { return GetWeather().sun_energy; } inline float3 GetHorizonColor() { return GetWeather().horizon.rgb; } inline float3 GetZenithColor() { return GetWeather().zenith.rgb; } inline float3 GetAmbientColor() { return GetWeather().ambient.rgb; } diff --git a/WickedEngine/shaders/lightingHF.hlsli b/WickedEngine/shaders/lightingHF.hlsli index ef63e9497..2146b3cde 100644 --- a/WickedEngine/shaders/lightingHF.hlsli +++ b/WickedEngine/shaders/lightingHF.hlsli @@ -219,13 +219,13 @@ inline void light_directional(in ShaderEntity light, in Surface surface, inout L inline float attenuation_pointlight(in float dist, in float dist2, in float range, in float range2) { -#if 0 // GLTF recommendation: https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_lights_punctual#range-property - return saturate(1 - pow(dist / range, 4)) / dist2; -#else - // Old attenuation: - return sqr(saturate(1 - (dist2 / range2))); -#endif + //return saturate(1 - pow(dist / range, 4)) / dist2; + + // Removed pow(x, 4), and avoid zero divisions: + float dist_per_range = dist2 / max(0.0001, range2); // pow2 + dist_per_range *= dist_per_range; // pow4 + return saturate(1 - dist_per_range) / max(0.0001, dist2); } inline void light_point(in ShaderEntity light, in Surface surface, inout Lighting lighting, in float shadow_mask = 1) { diff --git a/WickedEngine/shaders/skyAtmosphere_skyLuminanceLutCS.hlsl b/WickedEngine/shaders/skyAtmosphere_skyLuminanceLutCS.hlsl index 98d377fde..6681d8e87 100644 --- a/WickedEngine/shaders/skyAtmosphere_skyLuminanceLutCS.hlsl +++ b/WickedEngine/shaders/skyAtmosphere_skyLuminanceLutCS.hlsl @@ -24,7 +24,7 @@ void main(uint3 DTid : SV_DispatchThreadID) float3 worldPosition = float3(0.0, viewHeight, 0.0); float3 worldDirection = float3(0.0, 0.0, 1.0); - float3 sunIlluminance = GetSunEnergy() * GetSunColor(); + float3 sunIlluminance = GetSunColor(); float3 sunDirection = GetSunDirection(); SamplingParameters sampling; diff --git a/WickedEngine/shaders/skyAtmosphere_skyViewLutCS.hlsl b/WickedEngine/shaders/skyAtmosphere_skyViewLutCS.hlsl index dd4521020..63c2152fa 100644 --- a/WickedEngine/shaders/skyAtmosphere_skyViewLutCS.hlsl +++ b/WickedEngine/shaders/skyAtmosphere_skyViewLutCS.hlsl @@ -49,7 +49,7 @@ void main(uint3 DTid : SV_DispatchThreadID) return; } - float3 sunIlluminance = GetSunEnergy() * GetSunColor(); + float3 sunIlluminance = GetSunColor(); SamplingParameters sampling; { diff --git a/WickedEngine/shaders/skyAtmosphere_transmittanceLutCS.hlsl b/WickedEngine/shaders/skyAtmosphere_transmittanceLutCS.hlsl index 4bd710865..1b26ca597 100644 --- a/WickedEngine/shaders/skyAtmosphere_transmittanceLutCS.hlsl +++ b/WickedEngine/shaders/skyAtmosphere_transmittanceLutCS.hlsl @@ -22,7 +22,7 @@ void main(uint3 DTid : SV_DispatchThreadID) float3 worldPosition = float3(0.0, 0.0, viewHeight); float3 worldDirection = float3(0.0f, sqrt(1.0 - viewZenithCosAngle * viewZenithCosAngle), viewZenithCosAngle); float3 sunDirection = GetSunDirection(); - float3 sunIlluminance = GetSunEnergy() * GetSunColor(); + float3 sunIlluminance = GetSunColor(); SamplingParameters sampling; { diff --git a/WickedEngine/shaders/skyHF.hlsli b/WickedEngine/shaders/skyHF.hlsli index 862a0fd31..c8f191622 100644 --- a/WickedEngine/shaders/skyHF.hlsli +++ b/WickedEngine/shaders/skyHF.hlsli @@ -6,7 +6,7 @@ // Custom Atmosphere based on: https://www.shadertoy.com/view/Ml2cWG // Cloud noise based on: https://www.shadertoy.com/view/4tdSWr -float3 AccurateAtmosphericScattering(Texture2D skyViewLutTexture, Texture2D transmittanceLUT, Texture2D multiScatteringLUT, float3 rayOrigin, float3 rayDirection, float3 sunDirection, float sunEnergy, float3 sunColor, bool enableSun, bool darkMode, bool stationary) +float3 AccurateAtmosphericScattering(Texture2D skyViewLutTexture, Texture2D transmittanceLUT, Texture2D multiScatteringLUT, float3 rayOrigin, float3 rayDirection, float3 sunDirection, float3 sunColor, bool enableSun, bool darkMode, bool stationary) { AtmosphereParameters atmosphere = GetWeather().atmosphere; @@ -48,7 +48,7 @@ float3 AccurateAtmosphericScattering(Texture2D skyViewLutTexture, Textur const float startOffsetKm = 0.1; // 100m seems enough for long distances worldPosition += worldDirection * startOffsetKm; - float3 sunIlluminance = sunEnergy * sunColor; + float3 sunIlluminance = sunColor; SamplingParameters sampling; { @@ -75,7 +75,7 @@ float3 AccurateAtmosphericScattering(Texture2D skyViewLutTexture, Textur if (enableSun) { - float3 sunIlluminance = sunEnergy * sunColor; + float3 sunIlluminance = sunColor; totalColor = luminance + GetSunLuminance(worldPosition, worldDirection, sunDirection, sunIlluminance, atmosphere, transmittanceLUT); } else @@ -249,7 +249,6 @@ float3 GetDynamicSkyColor(in float3 V, bool sun_enabled = true, bool clouds_enab const float3 sunDirection = GetSunDirection(); const float3 sunColor = GetSunColor(); - const float sunEnergy = GetSunEnergy(); float3 sky = float3(0, 0, 0); @@ -263,7 +262,6 @@ float3 GetDynamicSkyColor(in float3 V, bool sun_enabled = true, bool clouds_enab GetCamera().position, // Ray origin V, // Ray direction sunDirection, // Position of the sun - sunEnergy, // Sun energy sunColor, // Sun Color sun_enabled, // Use sun and total dark_enabled, // Enable dark mode for light shafts etc. diff --git a/WickedEngine/shaders/volumetricCloud_renderCS.hlsl b/WickedEngine/shaders/volumetricCloud_renderCS.hlsl index 8c32dc407..0a14422a9 100644 --- a/WickedEngine/shaders/volumetricCloud_renderCS.hlsl +++ b/WickedEngine/shaders/volumetricCloud_renderCS.hlsl @@ -477,7 +477,7 @@ void RenderClouds(float3 rayOrigin, float3 rayDirection, float t, float steps, f AtmosphereParameters atmosphere = GetWeather().atmosphere; - float3 sunIlluminance = GetSunColor() * GetSunEnergy(); + float3 sunIlluminance = GetSunColor(); float3 sunDirection = GetSunDirection(); float cosTheta = dot(rayDirection, sunDirection); diff --git a/WickedEngine/shaders/volumetricLight_DirectionalPS.hlsl b/WickedEngine/shaders/volumetricLight_DirectionalPS.hlsl index 58a769ce3..c5648fd21 100644 --- a/WickedEngine/shaders/volumetricLight_DirectionalPS.hlsl +++ b/WickedEngine/shaders/volumetricLight_DirectionalPS.hlsl @@ -50,7 +50,8 @@ float4 main(VertexToPixel input) : SV_TARGET float3 attenuation = shadow_2D(light, shadow_pos, shadow_uv.xy, cascade); // Evaluate sample height for height fog calculation, given 0 for V: - attenuation *= GetFogAmount(cameraDistance - marchedDistance, P, float3(0.0, 0.0, 0.0)) * scattering; + attenuation *= GetFogAmount(cameraDistance - marchedDistance, P, float3(0.0, 0.0, 0.0)); + attenuation *= scattering; accumulation += attenuation; diff --git a/WickedEngine/shaders/volumetricLight_PointPS.hlsl b/WickedEngine/shaders/volumetricLight_PointPS.hlsl index b85b58d9b..71a015602 100644 --- a/WickedEngine/shaders/volumetricLight_PointPS.hlsl +++ b/WickedEngine/shaders/volumetricLight_PointPS.hlsl @@ -52,6 +52,7 @@ float4 main(VertexToPixel input) : SV_TARGET // Evaluate sample height for height fog calculation, given 0 for V: attenuation *= GetFogAmount(cameraDistance - marchedDistance, P, float3(0.0, 0.0, 0.0)); + attenuation *= ComputeScattering(saturate(dot(L, -V))); accumulation += attenuation; diff --git a/WickedEngine/shaders/volumetricLight_SpotPS.hlsl b/WickedEngine/shaders/volumetricLight_SpotPS.hlsl index 6faf95af5..18cd36181 100644 --- a/WickedEngine/shaders/volumetricLight_SpotPS.hlsl +++ b/WickedEngine/shaders/volumetricLight_SpotPS.hlsl @@ -59,6 +59,7 @@ float4 main(VertexToPixel input) : SV_TARGET // Evaluate sample height for exponential fog calculation, given 0 for V: attenuation *= GetFogAmount(cameraDistance - marchedDistance, P, float3(0.0, 0.0, 0.0)); + attenuation *= ComputeScattering(saturate(dot(L, -V))); accumulation += attenuation; } diff --git a/WickedEngine/wiArchive.cpp b/WickedEngine/wiArchive.cpp index 9e2a7c683..850233550 100644 --- a/WickedEngine/wiArchive.cpp +++ b/WickedEngine/wiArchive.cpp @@ -5,7 +5,7 @@ namespace wi { // this should always be only INCREMENTED and only if a new serialization is implemeted somewhere! - static constexpr uint64_t __archiveVersion = 82; + static constexpr uint64_t __archiveVersion = 83; // this is the version number of which below the archive is not compatible with the current version static constexpr uint64_t __archiveVersionBarrier = 22; diff --git a/WickedEngine/wiRenderer.cpp b/WickedEngine/wiRenderer.cpp index 1f201897b..e41b52cdf 100644 --- a/WickedEngine/wiRenderer.cpp +++ b/WickedEngine/wiRenderer.cpp @@ -2224,7 +2224,7 @@ struct SHCAM }; inline void CreateSpotLightShadowCam(const LightComponent& light, SHCAM& shcam) { - shcam = SHCAM(light.position, light.rotation, 0.1f, light.GetRange(), light.fov); + shcam = SHCAM(light.position, light.rotation, 0.1f, light.GetRange(), light.outerConeAngle * 2); } inline void CreateDirLightShadowCams(const LightComponent& light, CameraComponent camera, std::array& shcams) { @@ -3530,11 +3530,8 @@ void UpdateRenderData( shaderentity.SetType(light.GetType()); shaderentity.position = light.position; - float range = light.GetRange(); - range = std::max(0.001f, range); - range = std::min(range, 65504.0f); // clamp to 16-bit float max value - shaderentity.SetRange(range); - shaderentity.SetColor(float4(light.color.x* light.energy, light.color.y * light.energy, light.color.z * light.energy, 1)); + shaderentity.SetRange(light.GetRange()); + shaderentity.SetColor(float4(light.color.x * light.intensity, light.color.y * light.intensity, light.color.z * light.intensity, 1)); // mark as no shadow by default: shaderentity.indices = ~0; @@ -3590,8 +3587,8 @@ void UpdateRenderData( break; case LightComponent::SPOT: { - const float outerConeAngle = light.fov * 0.5f; - const float innerConeAngle = std::min(light.fov_inner * 0.5f, outerConeAngle); + const float outerConeAngle = light.outerConeAngle; + const float innerConeAngle = std::min(light.innerConeAngle, outerConeAngle); const float outerConeAngleCos = std::cos(outerConeAngle); const float innerConeAngleCos = std::cos(innerConeAngle); @@ -4417,7 +4414,7 @@ void DrawLightVisualizers( VolumeLightCB lcb; lcb.xLightColor = XMFLOAT4(light.color.x, light.color.y, light.color.z, 1); - lcb.xLightEnerdis = XMFLOAT4(light.energy, light.GetRange(), light.fov, light.energy); + lcb.xLightEnerdis = XMFLOAT4(light.intensity, light.GetRange(), light.outerConeAngle, light.intensity); if (type == LightComponent::POINT) { @@ -4434,10 +4431,10 @@ void DrawLightVisualizers( } else if (type == LightComponent::SPOT) { - if (light.fov_inner > 0) + if (light.innerConeAngle > 0) { - float coneS = (float)(std::min(light.fov_inner, light.fov) / 0.7853981852531433); - lcb.xLightEnerdis.w = std::min(light.GetRange(), 65504.0f) * 0.1f; // scale + float coneS = (float)(std::min(light.innerConeAngle, light.outerConeAngle) * 2 / XM_PIDIV4); + lcb.xLightEnerdis.w = light.GetRange() * 0.1f; // scale XMStoreFloat4x4(&lcb.xLightWorld, XMMatrixScaling(coneS * lcb.xLightEnerdis.w, lcb.xLightEnerdis.w, coneS * lcb.xLightEnerdis.w) * XMMatrixRotationQuaternion(XMLoadFloat4(&light.rotation)) * @@ -4449,8 +4446,8 @@ void DrawLightVisualizers( device->Draw(192, 0, cmd); // cone } - float coneS = (float)(light.fov / 0.7853981852531433); - lcb.xLightEnerdis.w = std::min(light.GetRange(), 65504.0f) * 0.1f; // scale + float coneS = (float)(light.outerConeAngle * 2 / XM_PIDIV4); + lcb.xLightEnerdis.w = light.GetRange() * 0.1f; // scale XMStoreFloat4x4(&lcb.xLightWorld, XMMatrixScaling(coneS*lcb.xLightEnerdis.w, lcb.xLightEnerdis.w, coneS*lcb.xLightEnerdis.w)* XMMatrixRotationQuaternion(XMLoadFloat4(&light.rotation))* @@ -4528,7 +4525,7 @@ void DrawVolumeLights( { MiscCB miscCb; miscCb.g_xColor.x = float(i); - const float coneS = (const float)(light.fov / XM_PIDIV4); + const float coneS = (const float)(light.outerConeAngle * 2 / XM_PIDIV4); XMStoreFloat4x4(&miscCb.g_xTransform, XMMatrixScaling(coneS*light.GetRange(), light.GetRange(), coneS*light.GetRange())* XMMatrixRotationQuaternion(XMLoadFloat4(&light.rotation))* diff --git a/WickedEngine/wiScene.cpp b/WickedEngine/wiScene.cpp index 004cbf969..a9f432067 100644 --- a/WickedEngine/wiScene.cpp +++ b/WickedEngine/wiScene.cpp @@ -1969,7 +1969,6 @@ namespace wi::scene shaderscene.weather.sun_color = weather.sunColor; shaderscene.weather.sun_direction = weather.sunDirection; - shaderscene.weather.sun_energy = weather.sunEnergy; shaderscene.weather.most_important_light_index = weather.most_important_light_index; shaderscene.weather.ambient = weather.ambient; shaderscene.weather.cloudiness = weather.cloudiness; @@ -2223,11 +2222,11 @@ namespace wi::scene const std::string& name, const XMFLOAT3& position, const XMFLOAT3& color, - float energy, + float intensity, float range, LightComponent::LightType type, - float fov, - float fov_inner) + float outerConeAngle, + float innerConeAngle) { Entity entity = CreateEntity(); @@ -2242,13 +2241,12 @@ namespace wi::scene aabb_lights.Create(entity).createFromHalfWidth(position, XMFLOAT3(range, range, range)); LightComponent& light = lights.Create(entity); - light.energy = energy; + light.intensity = intensity; light.range = range; - light.fov = XM_PIDIV4; light.color = color; light.SetType(type); - light.fov = fov; - light.fov_inner = fov_inner; + light.outerConeAngle = outerConeAngle; + light.innerConeAngle = innerConeAngle; return entity; } @@ -3984,8 +3982,10 @@ namespace wi::scene { weather.most_important_light_index = args.jobIndex; weather.sunColor = light.color; + weather.sunColor.x *= light.intensity; + weather.sunColor.y *= light.intensity; + weather.sunColor.z *= light.intensity; weather.sunDirection = light.direction; - weather.sunEnergy = light.energy; weather.stars_rotation_quaternion = light.rotation; } locker.unlock(); diff --git a/WickedEngine/wiScene.h b/WickedEngine/wiScene.h index 7e0f2e3a3..463d2e14d 100644 --- a/WickedEngine/wiScene.h +++ b/WickedEngine/wiScene.h @@ -854,10 +854,10 @@ namespace wi::scene ENUM_FORCE_UINT32 = 0xFFFFFFFF, }; LightType type = POINT; - float energy = 1.0f; + float intensity = 1.0f; // Brightness of light in. The units that this is defined in depend on the type of light. Point and spot lights use luminous intensity in candela (lm/sr) while directional lights use illuminance in lux (lm/m2). https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_lights_punctual float range = 10.0f; - float fov = XM_PIDIV4; - float fov_inner = 0; + float outerConeAngle = XM_PIDIV4; + float innerConeAngle = 0; // default value is 0, means only outer cone angle is used wi::vector lensFlareNames; @@ -885,11 +885,33 @@ namespace wi::scene inline bool IsVisualizerEnabled() const { return _flags & VISUALIZER; } inline bool IsStatic() const { return _flags & LIGHTMAPONLY_STATIC; } - inline float GetRange() const { return range; } + inline float GetRange() const + { + float retval = range; + retval = std::max(0.001f, retval); + retval = std::min(retval, 65504.0f); // clamp to 16-bit float max value + return retval; + } inline void SetType(LightType val) { type = val; } inline LightType GetType() const { return type; } + // Set energy amount with non physical light units (from before version 0.70.0): + inline void BackCompatSetEnergy(float energy) + { + switch (type) + { + case wi::scene::LightComponent::POINT: + intensity = energy * 20; + break; + case wi::scene::LightComponent::SPOT: + intensity = energy * 200; + break; + default: + break; + } + } + void Serialize(wi::Archive& archive, wi::ecs::EntitySerializer& seri); }; @@ -1155,7 +1177,6 @@ namespace wi::scene XMFLOAT3 sunColor = XMFLOAT3(0, 0, 0); XMFLOAT3 sunDirection = XMFLOAT3(0, 1, 0); - float sunEnergy = 0; float skyExposure = 1; XMFLOAT3 horizon = XMFLOAT3(0.0f, 0.0f, 0.0f); XMFLOAT3 zenith = XMFLOAT3(0.0f, 0.0f, 0.0f); @@ -1475,11 +1496,11 @@ namespace wi::scene const std::string& name, const XMFLOAT3& position = XMFLOAT3(0, 0, 0), const XMFLOAT3& color = XMFLOAT3(1, 1, 1), - float energy = 1, + float intensity = 1, float range = 10, LightComponent::LightType type = LightComponent::POINT, - float fov = XM_PIDIV4, - float fov_inner = 0 + float outerConeAngle = XM_PIDIV4, + float innerConeAngle = 0 ); wi::ecs::Entity Entity_CreateForce( const std::string& name, diff --git a/WickedEngine/wiScene_BindLua.cpp b/WickedEngine/wiScene_BindLua.cpp index 2c4cfc808..d74a3cc4d 100644 --- a/WickedEngine/wiScene_BindLua.cpp +++ b/WickedEngine/wiScene_BindLua.cpp @@ -2157,11 +2157,15 @@ const char LightComponent_BindLua::className[] = "LightComponent"; Luna::FunctionType LightComponent_BindLua::methods[] = { lunamethod(LightComponent_BindLua, SetType), lunamethod(LightComponent_BindLua, SetRange), - lunamethod(LightComponent_BindLua, SetEnergy), + lunamethod(LightComponent_BindLua, SetIntensity), lunamethod(LightComponent_BindLua, SetColor), lunamethod(LightComponent_BindLua, SetCastShadow), lunamethod(LightComponent_BindLua, SetVolumetricsEnabled), + lunamethod(LightComponent_BindLua, SetOuterConeAngle), + lunamethod(LightComponent_BindLua, SetInnerConeAngle), lunamethod(LightComponent_BindLua, GetType), + + lunamethod(LightComponent_BindLua, SetEnergy), lunamethod(LightComponent_BindLua, SetFOV), { NULL, NULL } }; @@ -2218,7 +2222,7 @@ int LightComponent_BindLua::SetEnergy(lua_State* L) if (argc > 0) { float value = wi::lua::SGetFloat(L, 1); - component->energy = value; + component->BackCompatSetEnergy(value); } else { @@ -2227,6 +2231,21 @@ int LightComponent_BindLua::SetEnergy(lua_State* L) return 0; } +int LightComponent_BindLua::SetIntensity(lua_State* L) +{ + int argc = wi::lua::SGetArgCount(L); + if (argc > 0) + { + float value = wi::lua::SGetFloat(L, 1); + component->intensity = value; + } + else + { + wi::lua::SError(L, "SetIntensity(float value) not enough arguments!"); + } + + return 0; +} int LightComponent_BindLua::SetColor(lua_State* L) { int argc = wi::lua::SGetArgCount(L); @@ -2283,7 +2302,7 @@ int LightComponent_BindLua::SetFOV(lua_State* L) if (argc > 0) { float value = wi::lua::SGetFloat(L, 1); - component->fov = value; + component->outerConeAngle = value * 0.5f; } else { @@ -2292,6 +2311,36 @@ int LightComponent_BindLua::SetFOV(lua_State* L) return 0; } +int LightComponent_BindLua::SetOuterConeAngle(lua_State* L) +{ + int argc = wi::lua::SGetArgCount(L); + if (argc > 0) + { + float value = wi::lua::SGetFloat(L, 1); + component->outerConeAngle = value; + } + else + { + wi::lua::SError(L, "SetOuterConeAngle(float value) not enough arguments!"); + } + + return 0; +} +int LightComponent_BindLua::SetInnerConeAngle(lua_State* L) +{ + int argc = wi::lua::SGetArgCount(L); + if (argc > 0) + { + float value = wi::lua::SGetFloat(L, 1); + component->innerConeAngle = value; + } + else + { + wi::lua::SError(L, "SetInnerConeAngle(float value) not enough arguments!"); + } + + return 0; +} int LightComponent_BindLua::GetType(lua_State* L) { diff --git a/WickedEngine/wiScene_BindLua.h b/WickedEngine/wiScene_BindLua.h index 037ea2919..28d8e45ae 100644 --- a/WickedEngine/wiScene_BindLua.h +++ b/WickedEngine/wiScene_BindLua.h @@ -277,10 +277,15 @@ namespace wi::lua::scene int SetType(lua_State* L); int SetRange(lua_State* L); - int SetEnergy(lua_State* L); + int SetIntensity(lua_State* L); int SetColor(lua_State* L); int SetCastShadow(lua_State* L); int SetVolumetricsEnabled(lua_State* L); + int SetOuterConeAngle(lua_State* L); + int SetInnerConeAngle(lua_State* L); + + // back-compat: + int SetEnergy(lua_State* L); int SetFOV(lua_State* L); int GetType(lua_State* L); diff --git a/WickedEngine/wiScene_Serializers.cpp b/WickedEngine/wiScene_Serializers.cpp index 764ab46cf..8336dc843 100644 --- a/WickedEngine/wiScene_Serializers.cpp +++ b/WickedEngine/wiScene_Serializers.cpp @@ -734,9 +734,9 @@ namespace wi::scene { type = POINT; // fallback from old area light } - archive >> energy; + archive >> intensity; archive >> range; - archive >> fov; + archive >> outerConeAngle; if (archive.GetVersion() < 55) { float shadowBias; @@ -758,7 +758,19 @@ namespace wi::scene if (archive.GetVersion() >= 82) { - archive >> fov_inner; + archive >> innerConeAngle; + } + + if (archive.GetVersion() < 83) + { + // Conversion from old light units to physical light units: + if (type != DIRECTIONAL) + { + BackCompatSetEnergy(intensity); + } + // Conversion from FOV to cone angle: + outerConeAngle *= 0.5f; + innerConeAngle *= 0.5f; } wi::jobsystem::Execute(seri.ctx, [&](wi::jobsystem::JobArgs args) { @@ -778,9 +790,9 @@ namespace wi::scene archive << _flags; archive << color; archive << (uint32_t)type; - archive << energy; + archive << intensity; archive << range; - archive << fov; + archive << outerConeAngle; if (archive.GetVersion() < 55) { float shadowBias = 0; @@ -810,7 +822,7 @@ namespace wi::scene if (archive.GetVersion() >= 82) { - archive << fov_inner; + archive << innerConeAngle; } } } diff --git a/WickedEngine/wiVersion.cpp b/WickedEngine/wiVersion.cpp index c6606f04c..d4f0d32fb 100644 --- a/WickedEngine/wiVersion.cpp +++ b/WickedEngine/wiVersion.cpp @@ -7,9 +7,9 @@ namespace wi::version // main engine core const int major = 0; // minor features, major updates, breaking compatibility changes - const int minor = 60; + const int minor = 70; // minor bug fixes, alterations, refactors, updates - const int revision = 105; + const int revision = 0; const std::string version_string = std::to_string(major) + "." + std::to_string(minor) + "." + std::to_string(revision); diff --git a/appveyor.yml b/appveyor.yml index 5e7a09671..985c80ff6 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -23,11 +23,11 @@ after_build: #Editor: - cmd: move %APPVEYOR_BUILD_FOLDER%\BUILD\%PLATFORM%\Release\Editor_Windows\Editor_Windows.exe %APPVEYOR_BUILD_FOLDER%\Editor - cmd: xcopy C:\projects\wickedengine\WickedEngine\*.dll %APPVEYOR_BUILD_FOLDER%\Editor - - cmd: 7z a WickedEngineEditor.zip Content\ features.txt other_licenses.txt *.md Editor\*.exe Editor\images\ Editor\terrain\ Editor\sound\ Editor\*.ini Editor\*.ico Editor\*.lua + - cmd: 7z a WickedEngineEditor.zip Content\ features.txt credits.txt third_party_software.txt *.md Editor\*.exe Editor\images\ Editor\terrain\ Editor\sound\ Editor\*.ini Editor\*.ico Editor\*.lua #Tests: - cmd: move %APPVEYOR_BUILD_FOLDER%\BUILD\%PLATFORM%\Release\Tests\Tests.exe %APPVEYOR_BUILD_FOLDER%\Tests - cmd: xcopy C:\projects\wickedengine\WickedEngine\*.dll %APPVEYOR_BUILD_FOLDER%\Tests - - cmd: 7z a WickedEngineTests.zip Content\ features.txt other_licenses.txt *.md Tests\*.exe Tests\images\ Tests\sound\ Tests\*.ini Tests\*.txt Tests\*.ico Tests\*.lua Tests\*.ttf + - cmd: 7z a WickedEngineTests.zip Content\ features.txt credits.txt third_party_software.txt *.md Tests\*.exe Tests\images\ Tests\sound\ Tests\*.ini Tests\*.txt Tests\*.ico Tests\*.lua Tests\*.ttf artifacts: - path: WickedEngineEditor.zip