From 03d2ca19b9b161393f0c718a1550bd7235ba61f0 Mon Sep 17 00:00:00 2001 From: Nissim Hadar Date: Tue, 31 Oct 2017 13:46:58 -0700 Subject: [PATCH] Moving consts into mode::Haze namespace. --- .../src/RenderableZoneEntityItem.cpp | 10 +- libraries/entities/src/HazePropertyGroup.h | 28 ++--- libraries/model/src/model/Haze.cpp | 21 ++-- libraries/model/src/model/Haze.h | 116 +++++++++--------- .../networking/src/udt/PacketHeaders.cpp | 2 +- libraries/networking/src/udt/PacketHeaders.h | 3 +- libraries/render-utils/src/DrawHaze.cpp | 10 +- libraries/render-utils/src/DrawHaze.h | 36 +++--- libraries/render-utils/src/HazeStage.cpp | 10 +- libraries/render-utils/src/HazeStage.h | 18 +-- 10 files changed, 127 insertions(+), 127 deletions(-) diff --git a/libraries/entities-renderer/src/RenderableZoneEntityItem.cpp b/libraries/entities-renderer/src/RenderableZoneEntityItem.cpp index 877e245006..7c96f00ede 100644 --- a/libraries/entities-renderer/src/RenderableZoneEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableZoneEntityItem.cpp @@ -342,23 +342,23 @@ void ZoneEntityRenderer::updateHazeFromEntity(const TypedEntityPointer& entity) haze->setHazeActive(hazeMode == COMPONENT_MODE_ENABLED); haze->setAltitudeBased(_hazeProperties.getHazeAltitudeEffect()); - haze->setHazeRangeFactor(model::convertHazeRangeToHazeRangeFactor(_hazeProperties.getHazeRange())); + haze->setHazeRangeFactor(model::Haze::convertHazeRangeToHazeRangeFactor(_hazeProperties.getHazeRange())); xColor hazeColor = _hazeProperties.getHazeColor(); haze->setHazeColor(glm::vec3(hazeColor.red / 255.0, hazeColor.green / 255.0, hazeColor.blue / 255.0)); xColor hazeGlareColor = _hazeProperties.getHazeGlareColor(); haze->setHazeGlareColor(glm::vec3(hazeGlareColor.red / 255.0, hazeGlareColor.green / 255.0, hazeGlareColor.blue / 255.0)); haze->setHazeEnableGlare(_hazeProperties.getHazeEnableGlare()); - haze->setHazeGlareBlend(model::convertGlareAngleToPower(_hazeProperties.getHazeGlareAngle())); + haze->setHazeGlareBlend(model::Haze::convertGlareAngleToPower(_hazeProperties.getHazeGlareAngle())); float hazeAltitude = _hazeProperties.getHazeCeiling() - _hazeProperties.getHazeBaseRef(); - haze->setHazeAltitudeFactor(model::convertHazeAltitudeToHazeAltitudeFactor(hazeAltitude)); + haze->setHazeAltitudeFactor(model::Haze::convertHazeAltitudeToHazeAltitudeFactor(hazeAltitude)); haze->setHazeBaseReference(_hazeProperties.getHazeBaseRef()); haze->setHazeBackgroundBlend(_hazeProperties.getHazeBackgroundBlend()); haze->setHazeAttenuateKeyLight(_hazeProperties.getHazeAttenuateKeyLight()); - haze->setHazeKeyLightRangeFactor(model::convertHazeRangeToHazeRangeFactor(_hazeProperties.getHazeKeyLightRange())); - haze->setHazeKeyLightAltitudeFactor(model::convertHazeAltitudeToHazeAltitudeFactor(_hazeProperties.getHazeKeyLightAltitude())); + haze->setHazeKeyLightRangeFactor(model::Haze::convertHazeRangeToHazeRangeFactor(_hazeProperties.getHazeKeyLightRange())); + haze->setHazeKeyLightAltitudeFactor(model::Haze::convertHazeAltitudeToHazeAltitudeFactor(_hazeProperties.getHazeKeyLightAltitude())); haze->setZoneTransform(entity->getTransform().getMatrix()); } diff --git a/libraries/entities/src/HazePropertyGroup.h b/libraries/entities/src/HazePropertyGroup.h index 965f112af9..939391caf9 100644 --- a/libraries/entities/src/HazePropertyGroup.h +++ b/libraries/entities/src/HazePropertyGroup.h @@ -27,18 +27,18 @@ class OctreePacketData; class EntityTreeElementExtraEncodeData; class ReadBitstreamToTreeParams; -static const float initialHazeRange{ 1000.0f }; +static const float INITIAL_HAZE_RANGE{ 1000.0f }; static const xColor initialHazeGlareColorXcolor{ 255, 229, 179 }; static const xColor initialHazeColorXcolor{ 128, 154, 179 }; -static const float initialGlareAngle{ 20.0f }; +static const float INITIAL_HAZE_GLARE_ANGLE{ 20.0f }; -static const float initialHazeBaseReference{ 0.0f }; -static const float initialHazeHeight{ 200.0f }; +static const float INITIAL_HAZE_BASE_REFERENCE{ 0.0f }; +static const float INITIAL_HAZE_HEIGHT{ 200.0f }; -static const float initialHazeBackgroundBlend{ 0.0f }; +static const float INITIAL_HAZE_BACKGROUND_BLEND{ 0.0f }; -static const float initialHazeKeyLightRange{ 1000.0f }; -static const float initialHazeKeyLightAltitude{ 200.0f }; +static const float INITIAL_KEY_LIGHT_RANGE{ 1000.0f }; +static const float INITIAL_KEY_LIGHT_ALTITUDE{ 200.0f }; class HazePropertyGroup : public PropertyGroup { public: @@ -88,24 +88,24 @@ public: bool& somethingChanged) override; // Range only parameters - DEFINE_PROPERTY(PROP_HAZE_RANGE, HazeRange, hazeRange, float, initialHazeRange); + DEFINE_PROPERTY(PROP_HAZE_RANGE, HazeRange, hazeRange, float, INITIAL_HAZE_RANGE); DEFINE_PROPERTY_REF(PROP_HAZE_COLOR, HazeColor, hazeColor, xColor, initialHazeColorXcolor); DEFINE_PROPERTY_REF(PROP_HAZE_GLARE_COLOR, HazeGlareColor, hazeGlareColor, xColor, initialHazeGlareColorXcolor); DEFINE_PROPERTY(PROP_HAZE_ENABLE_GLARE, HazeEnableGlare, hazeEnableGlare, bool, false); - DEFINE_PROPERTY_REF(PROP_HAZE_GLARE_ANGLE, HazeGlareAngle, hazeGlareAngle, float, initialGlareAngle); + DEFINE_PROPERTY_REF(PROP_HAZE_GLARE_ANGLE, HazeGlareAngle, hazeGlareAngle, float, INITIAL_HAZE_GLARE_ANGLE); // Altitude parameters DEFINE_PROPERTY(PROP_HAZE_ALTITUDE_EFFECT, HazeAltitudeEffect, hazeAltitudeEffect, bool, false); - DEFINE_PROPERTY_REF(PROP_HAZE_CEILING, HazeCeiling, hazeCeiling, float, initialHazeBaseReference + initialHazeHeight); - DEFINE_PROPERTY_REF(PROP_HAZE_BASE_REF, HazeBaseRef, hazeBaseRef, float, initialHazeBaseReference); + DEFINE_PROPERTY_REF(PROP_HAZE_CEILING, HazeCeiling, hazeCeiling, float, INITIAL_HAZE_BASE_REFERENCE + INITIAL_HAZE_HEIGHT); + DEFINE_PROPERTY_REF(PROP_HAZE_BASE_REF, HazeBaseRef, hazeBaseRef, float, INITIAL_HAZE_BASE_REFERENCE); // Background (skybox) blend value - DEFINE_PROPERTY_REF(PROP_HAZE_BACKGROUND_BLEND, HazeBackgroundBlend, hazeBackgroundBlend, float, initialHazeBackgroundBlend); + DEFINE_PROPERTY_REF(PROP_HAZE_BACKGROUND_BLEND, HazeBackgroundBlend, hazeBackgroundBlend, float, INITIAL_HAZE_BACKGROUND_BLEND); // hazeDirectional light attenuation DEFINE_PROPERTY(PROP_HAZE_ATTENUATE_KEYLIGHT, HazeAttenuateKeyLight, hazeAttenuateKeyLight, bool, false); - DEFINE_PROPERTY_REF(PROP_HAZE_KEYLIGHT_RANGE, HazeKeyLightRange, hazeKeyLightRange, float, initialHazeKeyLightRange); - DEFINE_PROPERTY_REF(PROP_HAZE_KEYLIGHT_ALTITUDE, HazeKeyLightAltitude, hazeKeyLightAltitude, float, initialHazeKeyLightAltitude); + DEFINE_PROPERTY_REF(PROP_HAZE_KEYLIGHT_RANGE, HazeKeyLightRange, hazeKeyLightRange, float, INITIAL_KEY_LIGHT_RANGE); + DEFINE_PROPERTY_REF(PROP_HAZE_KEYLIGHT_ALTITUDE, HazeKeyLightAltitude, hazeKeyLightAltitude, float, INITIAL_KEY_LIGHT_ALTITUDE); }; #endif // hifi_HazePropertyGroup_h diff --git a/libraries/model/src/model/Haze.cpp b/libraries/model/src/model/Haze.cpp index 01cb32a98b..c9c73bcee9 100644 --- a/libraries/model/src/model/Haze.cpp +++ b/libraries/model/src/model/Haze.cpp @@ -14,21 +14,24 @@ using namespace model; -const float HazeInit::initialHazeRange{ 1000.0f }; -const float HazeInit::initialHazeHeight{ 200.0f }; +const float Haze::INITIAL_HAZE_RANGE{ 1000.0f }; +const float Haze::INITIAL_HAZE_HEIGHT{ 200.0f }; -const float HazeInit::initialHazeKeyLightRange{ 1000.0f }; -const float HazeInit::initialHazeKeyLightAltitude{ 200.0f }; +const float Haze::INITIAL_KEY_LIGHT_RANGE{ 1000.0f }; +const float Haze::INITIAL_KEY_LIGHT_ALTITUDE{ 200.0f }; -const float HazeInit::initialHazeBackgroundBlend{ 0.0f }; +const float Haze::INITIAL_HAZE_BACKGROUND_BLEND{ 0.0f }; -const glm::vec3 HazeInit::initialHazeColor{ 0.5f, 0.6f, 0.7f }; // Bluish +const glm::vec3 Haze::INITIAL_HAZE_COLOR{ 0.5f, 0.6f, 0.7f }; // Bluish -const float HazeInit::initialGlareAngle{ 20.0f }; +const float Haze::INITIAL_HAZE_GLARE_ANGLE{ 20.0f }; -const glm::vec3 HazeInit::initialHazeGlareColor{ 1.0f, 0.9f, 0.7f }; +const glm::vec3 Haze::INITIAL_HAZE_GLARE_COLOR{ 1.0f, 0.9f, 0.7f }; -const float HazeInit::initialHazeBaseReference{ 0.0f }; +const float Haze::INITIAL_HAZE_BASE_REFERENCE{ 0.0f }; + +const float Haze::LOG_P_005{ logf(0.05f)}; +const float Haze::LOG_P_05{ logf(0.5f) }; Haze::Haze() { Parameters parameters; diff --git a/libraries/model/src/model/Haze.h b/libraries/model/src/model/Haze.h index b02a044459..a0cc7c3bc7 100644 --- a/libraries/model/src/model/Haze.h +++ b/libraries/model/src/model/Haze.h @@ -17,63 +17,58 @@ #include "Transform.h" #include "NumericalConstants.h" -class HazeInit { -public: - // Initial values - static const float initialHazeRange; - static const float initialHazeHeight; - - static const float initialHazeKeyLightRange; - static const float initialHazeKeyLightAltitude; - - static const float initialHazeBackgroundBlend; - - static const glm::vec3 initialHazeColor; - - static const float initialGlareAngle; - - static const glm::vec3 initialHazeGlareColor; - - static const float initialHazeBaseReference; -}; - namespace model { - const float LOG_P_005 = logf(0.05f); - const float LOG_P_05 = logf(0.5f); - - // Derivation (d is distance, b is haze coefficient, f is attenuation, solve for f = 0.05 - // f = exp(-d * b) - // ln(f) = -d * b - // b = -ln(f)/d - inline glm::vec3 convertHazeRangeToHazeRangeFactor(const glm::vec3 hazeRange) { - return glm::vec3( - -LOG_P_005 / hazeRange.x, - -LOG_P_005 / hazeRange.y, - -LOG_P_005 / hazeRange.z); - } - - // limit range and altitude to no less than 1.0 metres - inline float convertHazeRangeToHazeRangeFactor(const float hazeRange) { return -LOG_P_005 / glm::max(hazeRange, 1.0f); } - - inline float convertHazeAltitudeToHazeAltitudeFactor(const float hazeHeight) { return -LOG_P_005 / glm::max(hazeHeight, 1.0f); } - - // Derivation (s is the proportion of sun blend, a is the angle at which the blend is 50%, solve for m = 0.5 - // s = dot(lookAngle, sunAngle) = cos(a) - // m = pow(s, p) - // log(m) = p * log(s) - // p = log(m) / log(s) - // limit to 0.1 degrees - inline float convertGlareAngleToPower(const float hazeGlareAngle) { - const float GLARE_ANGLE_LIMIT = 0.1f; - return LOG_P_05 / logf(cosf(RADIANS_PER_DEGREE * glm::max(GLARE_ANGLE_LIMIT, hazeGlareAngle))); - } - // Haze range is defined here as the range the visibility is reduced by 95% // Haze altitude is defined here as the altitude (above 0) that the haze is reduced by 95% class Haze { public: - using UniformBufferView = gpu::BufferView; + // Initial values + static const float INITIAL_HAZE_RANGE; + static const float INITIAL_HAZE_HEIGHT; + + static const float INITIAL_KEY_LIGHT_RANGE; + static const float INITIAL_KEY_LIGHT_ALTITUDE; + + static const float INITIAL_HAZE_BACKGROUND_BLEND; + + static const glm::vec3 INITIAL_HAZE_COLOR; + + static const float INITIAL_HAZE_GLARE_ANGLE; + + static const glm::vec3 INITIAL_HAZE_GLARE_COLOR; + + static const float INITIAL_HAZE_BASE_REFERENCE; + + static const float LOG_P_005; + static const float LOG_P_05; + + // Derivation (d is distance, b is haze coefficient, f is attenuation, solve for f = 0.05 + // f = exp(-d * b) + // ln(f) = -d * b + // b = -ln(f)/d + static inline glm::vec3 convertHazeRangeToHazeRangeFactor(const glm::vec3 hazeRange) { + return glm::vec3( + -LOG_P_005 / hazeRange.x, + -LOG_P_005 / hazeRange.y, + -LOG_P_005 / hazeRange.z); + } + + // limit range and altitude to no less than 1.0 metres + static inline float convertHazeRangeToHazeRangeFactor(const float hazeRange) { return -LOG_P_005 / glm::max(hazeRange, 1.0f); } + + static inline float convertHazeAltitudeToHazeAltitudeFactor(const float hazeHeight) { return -LOG_P_005 / glm::max(hazeHeight, 1.0f); } + + // Derivation (s is the proportion of sun blend, a is the angle at which the blend is 50%, solve for m = 0.5 + // s = dot(lookAngle, sunAngle) = cos(a) + // m = pow(s, p) + // log(m) = p * log(s) + // p = log(m) / log(s) + // limit to 0.1 degrees + static inline float convertGlareAngleToPower(const float hazeGlareAngle) { + const float GLARE_ANGLE_LIMIT = 0.1f; + return LOG_P_05 / logf(cosf(RADIANS_PER_DEGREE * glm::max(GLARE_ANGLE_LIMIT, hazeGlareAngle))); + } Haze(); @@ -99,17 +94,18 @@ namespace model { void setZoneTransform(const glm::mat4& zoneTransform); + using UniformBufferView = gpu::BufferView; UniformBufferView getHazeParametersBuffer() const { return _hazeParametersBuffer; } protected: class Parameters { public: // DO NOT CHANGE ORDER HERE WITHOUT UNDERSTANDING THE std140 LAYOUT - glm::vec3 hazeColor{ HazeInit::initialHazeColor }; - float hazeGlareBlend{ convertGlareAngleToPower(HazeInit::initialGlareAngle) }; + glm::vec3 hazeColor{ INITIAL_HAZE_COLOR }; + float hazeGlareBlend{ convertGlareAngleToPower(INITIAL_HAZE_GLARE_ANGLE) }; - glm::vec3 hazeGlareColor{ HazeInit::initialHazeGlareColor }; - float hazeBaseReference{ HazeInit::initialHazeBaseReference }; + glm::vec3 hazeGlareColor{ INITIAL_HAZE_GLARE_COLOR }; + float hazeBaseReference{ INITIAL_HAZE_BASE_REFERENCE }; glm::vec3 colorModulationFactor; int hazeMode{ 0 }; // bit 0 - set to activate haze attenuation of fragment color @@ -120,14 +116,14 @@ namespace model { glm::mat4 zoneTransform; // Amount of background (skybox) to display, overriding the haze effect for the background - float hazeBackgroundBlend{ HazeInit::initialHazeBackgroundBlend }; + float hazeBackgroundBlend{ INITIAL_HAZE_BACKGROUND_BLEND }; // The haze attenuation exponents used by both fragment and directional light attenuation - float hazeRangeFactor{ convertHazeRangeToHazeRangeFactor(HazeInit::initialHazeRange) }; - float hazeHeightFactor{ convertHazeAltitudeToHazeAltitudeFactor(HazeInit::initialHazeHeight) }; + float hazeRangeFactor{ convertHazeRangeToHazeRangeFactor(INITIAL_HAZE_RANGE) }; + float hazeHeightFactor{ convertHazeAltitudeToHazeAltitudeFactor(INITIAL_HAZE_HEIGHT) }; - float hazeKeyLightRangeFactor{ convertHazeRangeToHazeRangeFactor(HazeInit::initialHazeKeyLightRange) }; - float hazeKeyLightAltitudeFactor{ convertHazeAltitudeToHazeAltitudeFactor(HazeInit::initialHazeKeyLightAltitude) }; + float hazeKeyLightRangeFactor{ convertHazeRangeToHazeRangeFactor(INITIAL_KEY_LIGHT_RANGE) }; + float hazeKeyLightAltitudeFactor{ convertHazeAltitudeToHazeAltitudeFactor(INITIAL_KEY_LIGHT_ALTITUDE) }; Parameters() {} }; diff --git a/libraries/networking/src/udt/PacketHeaders.cpp b/libraries/networking/src/udt/PacketHeaders.cpp index 09ee41b31d..9a98393fa1 100644 --- a/libraries/networking/src/udt/PacketHeaders.cpp +++ b/libraries/networking/src/udt/PacketHeaders.cpp @@ -30,7 +30,7 @@ PacketVersion versionForPacketType(PacketType packetType) { case PacketType::EntityEdit: case PacketType::EntityData: case PacketType::EntityPhysics: - return static_cast(EntityVersion::HasDynamicOwnershipTests); + return static_cast(EntityVersion::HazeEffect); case PacketType::EntityQuery: return static_cast(EntityQueryPacketVersion::JSONFilterWithFamilyTree); diff --git a/libraries/networking/src/udt/PacketHeaders.h b/libraries/networking/src/udt/PacketHeaders.h index 049cb0f1a8..e00b4139c3 100644 --- a/libraries/networking/src/udt/PacketHeaders.h +++ b/libraries/networking/src/udt/PacketHeaders.h @@ -196,7 +196,8 @@ QDebug operator<<(QDebug debug, const PacketType& type); enum class EntityVersion : PacketVersion { StrokeColorProperty = 77, - HasDynamicOwnershipTests + HasDynamicOwnershipTests, + HazeEffect }; enum class EntityScriptCallMethodVersion : PacketVersion { diff --git a/libraries/render-utils/src/DrawHaze.cpp b/libraries/render-utils/src/DrawHaze.cpp index 3be74da26a..7cf07d8f33 100644 --- a/libraries/render-utils/src/DrawHaze.cpp +++ b/libraries/render-utils/src/DrawHaze.cpp @@ -83,7 +83,7 @@ MakeHaze::MakeHaze() { void MakeHaze::configure(const Config& config) { _haze->setHazeColor(config.hazeColor); - _haze->setHazeGlareBlend(model::convertGlareAngleToPower(config.hazeGlareAngle)); + _haze->setHazeGlareBlend(model::Haze::convertGlareAngleToPower(config.hazeGlareAngle)); _haze->setHazeGlareColor(config.hazeGlareColor); _haze->setHazeBaseReference(config.hazeBaseReference); @@ -94,11 +94,11 @@ void MakeHaze::configure(const Config& config) { _haze->setModulateColorActive(config.isModulateColorActive); _haze->setHazeEnableGlare(config.isHazeEnableGlare); - _haze->setHazeRangeFactor(model::convertHazeRangeToHazeRangeFactor(config.hazeRange)); - _haze->setHazeAltitudeFactor(model::convertHazeAltitudeToHazeAltitudeFactor(config.hazeHeight)); + _haze->setHazeRangeFactor(model::Haze::convertHazeRangeToHazeRangeFactor(config.hazeRange)); + _haze->setHazeAltitudeFactor(model::Haze::convertHazeAltitudeToHazeAltitudeFactor(config.hazeHeight)); - _haze->setHazeKeyLightRangeFactor(model::convertHazeRangeToHazeRangeFactor(config.hazeKeyLightRange)); - _haze->setHazeKeyLightAltitudeFactor(model::convertHazeAltitudeToHazeAltitudeFactor(config.hazeKeyLightAltitude)); + _haze->setHazeKeyLightRangeFactor(model::Haze::convertHazeRangeToHazeRangeFactor(config.hazeKeyLightRange)); + _haze->setHazeKeyLightAltitudeFactor(model::Haze::convertHazeAltitudeToHazeAltitudeFactor(config.hazeKeyLightAltitude)); _haze->setHazeBackgroundBlend(config.hazeBackgroundBlend); } diff --git a/libraries/render-utils/src/DrawHaze.h b/libraries/render-utils/src/DrawHaze.h index c460d38bf1..f158daa0c6 100644 --- a/libraries/render-utils/src/DrawHaze.h +++ b/libraries/render-utils/src/DrawHaze.h @@ -51,11 +51,11 @@ class MakeHazeConfig : public render::Job::Config { public: MakeHazeConfig() : render::Job::Config() {} - glm::vec3 hazeColor{ HazeInit::initialHazeColor }; - float hazeGlareAngle{ HazeInit::initialGlareAngle }; + glm::vec3 hazeColor{ model::Haze::INITIAL_HAZE_COLOR }; + float hazeGlareAngle{ model::Haze::INITIAL_HAZE_GLARE_ANGLE }; - glm::vec3 hazeGlareColor{ HazeInit::initialHazeGlareColor }; - float hazeBaseReference{ HazeInit::initialHazeBaseReference }; + glm::vec3 hazeGlareColor{ model::Haze::INITIAL_HAZE_GLARE_COLOR }; + float hazeBaseReference{ model::Haze::INITIAL_HAZE_BASE_REFERENCE }; bool isHazeActive{ false }; bool isAltitudeBased{ false }; @@ -63,13 +63,13 @@ public: bool isModulateColorActive{ false }; bool isHazeEnableGlare{ false }; - float hazeRange{ HazeInit::initialHazeRange }; - float hazeHeight{ HazeInit::initialHazeHeight }; + float hazeRange{ model::Haze::INITIAL_HAZE_RANGE }; + float hazeHeight{ model::Haze::INITIAL_HAZE_HEIGHT }; - float hazeKeyLightRange{ HazeInit::initialHazeKeyLightRange }; - float hazeKeyLightAltitude{ HazeInit::initialHazeKeyLightAltitude }; + float hazeKeyLightRange{ model::Haze::INITIAL_KEY_LIGHT_RANGE }; + float hazeKeyLightAltitude{ model::Haze::INITIAL_KEY_LIGHT_ALTITUDE }; - float hazeBackgroundBlend{ HazeInit::initialHazeBackgroundBlend }; + float hazeBackgroundBlend{ model::Haze::INITIAL_HAZE_BACKGROUND_BLEND }; public slots: void setHazeColor(const glm::vec3 value) { hazeColor = value; emit dirty(); } @@ -115,11 +115,11 @@ public: HazeConfig() : render::Job::Config(true) {} // attributes - glm::vec3 hazeColor{ HazeInit::initialHazeColor }; - float hazeGlareAngle{ HazeInit::initialGlareAngle }; + glm::vec3 hazeColor{ model::Haze::INITIAL_HAZE_COLOR }; + float hazeGlareAngle{ model::Haze::INITIAL_HAZE_GLARE_ANGLE }; - glm::vec3 hazeGlareColor{ HazeInit::initialHazeGlareColor }; - float hazeBaseReference{ HazeInit::initialHazeBaseReference }; + glm::vec3 hazeGlareColor{ model::Haze::INITIAL_HAZE_GLARE_COLOR }; + float hazeBaseReference{ model::Haze::INITIAL_HAZE_BASE_REFERENCE }; bool isHazeActive{ false }; // Setting this to true will set haze to on bool isAltitudeBased{ false }; @@ -127,13 +127,13 @@ public: bool isModulateColorActive{ false }; bool isHazeEnableGlare{ false }; - float hazeRange{ HazeInit::initialHazeRange }; - float hazeHeight{ HazeInit::initialHazeHeight }; + float hazeRange{ model::Haze::INITIAL_HAZE_RANGE }; + float hazeHeight{ model::Haze::INITIAL_HAZE_HEIGHT }; - float hazeKeyLightRange{ HazeInit::initialHazeKeyLightRange }; - float hazeKeyLightAltitude{ HazeInit::initialHazeKeyLightAltitude }; + float hazeKeyLightRange{ model::Haze::INITIAL_KEY_LIGHT_RANGE }; + float hazeKeyLightAltitude{ model::Haze::INITIAL_KEY_LIGHT_ALTITUDE }; - float hazeBackgroundBlend{ HazeInit::initialHazeBackgroundBlend }; + float hazeBackgroundBlend{ model::Haze::INITIAL_HAZE_BACKGROUND_BLEND }; // methods void setHazeColor(const glm::vec3 value); diff --git a/libraries/render-utils/src/HazeStage.cpp b/libraries/render-utils/src/HazeStage.cpp index c9e6ef90cb..7a12ee3c8a 100644 --- a/libraries/render-utils/src/HazeStage.cpp +++ b/libraries/render-utils/src/HazeStage.cpp @@ -21,7 +21,7 @@ FetchHazeStage::FetchHazeStage() { void FetchHazeStage::configure(const Config& config) { _haze->setHazeColor(config.hazeColor); - _haze->setHazeGlareBlend(model::convertGlareAngleToPower(config.hazeGlareAngle)); + _haze->setHazeGlareBlend(model::Haze::convertGlareAngleToPower(config.hazeGlareAngle)); _haze->setHazeGlareColor(config.hazeGlareColor); _haze->setHazeBaseReference(config.hazeBaseReference); @@ -32,11 +32,11 @@ void FetchHazeStage::configure(const Config& config) { _haze->setModulateColorActive(config.isModulateColorActive); _haze->setHazeEnableGlare(config.isHazeEnableGlare); - _haze->setHazeRangeFactor(model::convertHazeRangeToHazeRangeFactor(config.hazeRange)); - _haze->setHazeAltitudeFactor(model::convertHazeAltitudeToHazeAltitudeFactor(config.hazeHeight)); + _haze->setHazeRangeFactor(model::Haze::convertHazeRangeToHazeRangeFactor(config.hazeRange)); + _haze->setHazeAltitudeFactor(model::Haze::convertHazeAltitudeToHazeAltitudeFactor(config.hazeHeight)); - _haze->setHazeKeyLightRangeFactor(model::convertHazeRangeToHazeRangeFactor(config.hazeKeyLightRange)); - _haze->setHazeKeyLightAltitudeFactor(model::convertHazeAltitudeToHazeAltitudeFactor(config.hazeKeyLightAltitude)); + _haze->setHazeKeyLightRangeFactor(model::Haze::convertHazeRangeToHazeRangeFactor(config.hazeKeyLightRange)); + _haze->setHazeKeyLightAltitudeFactor(model::Haze::convertHazeAltitudeToHazeAltitudeFactor(config.hazeKeyLightAltitude)); _haze->setHazeBackgroundBlend(config.hazeBackgroundBlend); } diff --git a/libraries/render-utils/src/HazeStage.h b/libraries/render-utils/src/HazeStage.h index ac5a8dd6f5..102f299d8f 100644 --- a/libraries/render-utils/src/HazeStage.h +++ b/libraries/render-utils/src/HazeStage.h @@ -106,11 +106,11 @@ class FetchHazeConfig : public render::Job::Config { public: FetchHazeConfig() : render::Job::Config() {} - glm::vec3 hazeColor{ HazeInit::initialHazeColor }; - float hazeGlareAngle{ HazeInit::initialGlareAngle }; + glm::vec3 hazeColor{ model::Haze::INITIAL_HAZE_COLOR }; + float hazeGlareAngle{ model::Haze::INITIAL_HAZE_GLARE_ANGLE }; - glm::vec3 hazeGlareColor{ HazeInit::initialHazeGlareColor }; - float hazeBaseReference{ HazeInit::initialHazeBaseReference }; + glm::vec3 hazeGlareColor{ model::Haze::INITIAL_HAZE_GLARE_COLOR }; + float hazeBaseReference{ model::Haze::INITIAL_HAZE_BASE_REFERENCE }; bool isHazeActive{ false }; bool isAltitudeBased{ false }; @@ -118,13 +118,13 @@ public: bool isModulateColorActive{ false }; bool isHazeEnableGlare{ false }; - float hazeRange{ HazeInit::initialHazeRange }; - float hazeHeight{ HazeInit::initialHazeHeight }; + float hazeRange{ model::Haze::INITIAL_HAZE_RANGE }; + float hazeHeight{ model::Haze::INITIAL_HAZE_HEIGHT }; - float hazeKeyLightRange{ HazeInit::initialHazeKeyLightRange }; - float hazeKeyLightAltitude{ HazeInit::initialHazeKeyLightAltitude }; + float hazeKeyLightRange{ model::Haze::INITIAL_KEY_LIGHT_RANGE }; + float hazeKeyLightAltitude{ model::Haze::INITIAL_KEY_LIGHT_ALTITUDE }; - float hazeBackgroundBlend{ HazeInit::initialHazeBackgroundBlend }; + float hazeBackgroundBlend{ model::Haze::INITIAL_HAZE_BACKGROUND_BLEND }; public slots: void setHazeColor(const glm::vec3 value) { hazeColor = value; emit dirty(); }