mirror of
https://github.com/overte-org/overte.git
synced 2025-04-18 07:56:25 +02:00
Refactoring of the haze
This commit is contained in:
parent
c5c996f186
commit
66c31caf4b
18 changed files with 249 additions and 248 deletions
|
@ -346,15 +346,15 @@ void ZoneEntityRenderer::updateHazeFromEntity(const TypedEntityPointer& entity)
|
|||
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->setDirectionalLightColor(glm::vec3(hazeGlareColor.red / 255.0, hazeGlareColor.green / 255.0, hazeGlareColor.blue / 255.0));
|
||||
haze->setHazeGlareColor(glm::vec3(hazeGlareColor.red / 255.0, hazeGlareColor.green / 255.0, hazeGlareColor.blue / 255.0));
|
||||
haze->setHazeEnableGlare(_hazeProperties.getHazeEnableGlare());
|
||||
haze->setDirectionalLightBlend(model::convertDirectionalLightAngleToPower(_hazeProperties.getHazeGlareAngle()));
|
||||
haze->setHazeGlareBlend(model::convertGlareAngleToPower(_hazeProperties.getHazeGlareAngle()));
|
||||
|
||||
float hazeAltitude = _hazeProperties.getHazeCeiling() - _hazeProperties.getHazeBaseRef();
|
||||
haze->setHazeAltitudeFactor(model::convertHazeAltitudeToHazeAltitudeFactor(hazeAltitude));
|
||||
haze->setHazeBaseReference(_hazeProperties.getHazeBaseRef());
|
||||
|
||||
haze->setHazeBackgroundBlendValue(_hazeProperties.getHazeBackgroundBlend());
|
||||
haze->setHazeBackgroundBlend(_hazeProperties.getHazeBackgroundBlend());
|
||||
|
||||
haze->setHazeAttenuateKeyLight(_hazeProperties.getHazeAttenuateKeyLight());
|
||||
haze->setHazeKeyLightRangeFactor(model::convertHazeRangeToHazeRangeFactor(_hazeProperties.getHazeKeyLightRange()));
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
set(TARGET_NAME entities)
|
||||
setup_hifi_library(Network Script)
|
||||
include_directories(SYSTEM "${OPENSSL_INCLUDE_DIR}")
|
||||
link_hifi_libraries(shared networking octree avatars)
|
||||
link_hifi_libraries(shared networking octree avatars model)
|
||||
|
|
|
@ -15,19 +15,6 @@
|
|||
#include "EntityItemProperties.h"
|
||||
#include "EntityItemPropertiesMacros.h"
|
||||
|
||||
const float HazePropertyGroup::DEFAULT_HAZE_RANGE{ 1000.0f };
|
||||
const xColor HazePropertyGroup::DEFAULT_HAZE_COLOR{ 128, 154, 179 }; // Bluish
|
||||
const xColor HazePropertyGroup::DEFAULT_HAZE_GLARE_COLOR{ 255, 229, 179 }; // Yellowish
|
||||
const float HazePropertyGroup::DEFAULT_HAZE_GLARE_ANGLE{ 20.0 };
|
||||
|
||||
const float HazePropertyGroup::DEFAULT_HAZE_CEILING{ 200.0f };
|
||||
const float HazePropertyGroup::DEFAULT_HAZE_BASE_REF{ 0.0f };
|
||||
|
||||
const float HazePropertyGroup::DEFAULT_HAZE_BACKGROUND_BLEND{ 0.0f };
|
||||
|
||||
const float HazePropertyGroup::DEFAULT_HAZE_KEYLIGHT_RANGE{ 1000.0 };
|
||||
const float HazePropertyGroup::DEFAULT_HAZE_KEYLIGHT_ALTITUDE{ 200.0f };
|
||||
|
||||
void HazePropertyGroup::copyToScriptValue(const EntityPropertyFlags& desiredProperties, QScriptValue& properties, QScriptEngine* engine, bool skipDefaults, EntityItemProperties& defaultEntityProperties) const {
|
||||
COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_HAZE_RANGE, Haze, haze, HazeRange, hazeRange);
|
||||
COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_HAZE_COLOR, Haze, haze, HazeColor, hazeColor);
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
#include "PropertyGroup.h"
|
||||
#include "EntityItemPropertiesMacros.h"
|
||||
|
||||
#include <model/HazeInit.h>
|
||||
|
||||
class EntityItemProperties;
|
||||
class EncodeBitstreamParams;
|
||||
class OctreePacketData;
|
||||
|
@ -74,38 +76,25 @@ public:
|
|||
EntityPropertyFlags& propertyFlags, bool overwriteLocalData,
|
||||
bool& somethingChanged) override;
|
||||
|
||||
static const float DEFAULT_HAZE_RANGE;
|
||||
static const xColor DEFAULT_HAZE_COLOR;
|
||||
static const xColor DEFAULT_HAZE_GLARE_COLOR;
|
||||
static const float DEFAULT_HAZE_GLARE_ANGLE;
|
||||
|
||||
static const float DEFAULT_HAZE_CEILING;
|
||||
static const float DEFAULT_HAZE_BASE_REF;
|
||||
|
||||
static const float DEFAULT_HAZE_BACKGROUND_BLEND;
|
||||
|
||||
static const float DEFAULT_HAZE_KEYLIGHT_RANGE;
|
||||
static const float DEFAULT_HAZE_KEYLIGHT_ALTITUDE;
|
||||
|
||||
// Range only parameters
|
||||
DEFINE_PROPERTY(PROP_HAZE_RANGE, HazeRange, hazeRange, float, DEFAULT_HAZE_RANGE);
|
||||
DEFINE_PROPERTY_REF(PROP_HAZE_COLOR, HazeColor, hazeColor, xColor, DEFAULT_HAZE_COLOR);
|
||||
DEFINE_PROPERTY_REF(PROP_HAZE_GLARE_COLOR, HazeGlareColor, hazeGlareColor, xColor, DEFAULT_HAZE_GLARE_COLOR);
|
||||
DEFINE_PROPERTY(PROP_HAZE_RANGE, HazeRange, hazeRange, float, model::initialHazeRange_m);
|
||||
DEFINE_PROPERTY_REF(PROP_HAZE_COLOR, HazeColor, hazeColor, xColor, model::initialHazeColorXcolor);
|
||||
DEFINE_PROPERTY_REF(PROP_HAZE_GLARE_COLOR, HazeGlareColor, hazeGlareColor, xColor, model::initialHazeGlareColorXcolor);
|
||||
DEFINE_PROPERTY(PROP_HAZE_ENABLE_GLARE, HazeEnableGlare, hazeEnableGlare, bool, false);
|
||||
DEFINE_PROPERTY_REF(PROP_HAZE_GLARE_ANGLE, HazeGlareAngle, hazeGlareAngle, float, DEFAULT_HAZE_GLARE_ANGLE);
|
||||
DEFINE_PROPERTY_REF(PROP_HAZE_GLARE_ANGLE, HazeGlareAngle, hazeGlareAngle, float, model::initialGlareAngle_degs);
|
||||
|
||||
// Altitude parameters
|
||||
DEFINE_PROPERTY(PROP_HAZE_ALTITUDE_EFFECT, HazeAltitudeEffect, hazeAltitudeEffect, bool, false);
|
||||
DEFINE_PROPERTY_REF(PROP_HAZE_CEILING, HazeCeiling, hazeCeiling, float, DEFAULT_HAZE_CEILING);
|
||||
DEFINE_PROPERTY_REF(PROP_HAZE_BASE_REF, HazeBaseRef, hazeBaseRef, float, DEFAULT_HAZE_BASE_REF);
|
||||
DEFINE_PROPERTY_REF(PROP_HAZE_CEILING, HazeCeiling, hazeCeiling, float, model::initialHazeBaseReference_m + model::initialHazeHeight_m);
|
||||
DEFINE_PROPERTY_REF(PROP_HAZE_BASE_REF, HazeBaseRef, hazeBaseRef, float, model::initialHazeBaseReference_m);
|
||||
|
||||
// Background (skybox) blend value
|
||||
DEFINE_PROPERTY_REF(PROP_HAZE_BACKGROUND_BLEND, HazeBackgroundBlend, hazeBackgroundBlend, float, DEFAULT_HAZE_BACKGROUND_BLEND);
|
||||
DEFINE_PROPERTY_REF(PROP_HAZE_BACKGROUND_BLEND, HazeBackgroundBlend, hazeBackgroundBlend, float, model::initialHazeBackgroundBlend);
|
||||
|
||||
// hazeDirectional light attenuation
|
||||
DEFINE_PROPERTY(PROP_HAZE_ATTENUATE_KEYLIGHT, HazeAttenuateKeyLight, hazeAttenuateKeyLight, bool, false);
|
||||
DEFINE_PROPERTY_REF(PROP_HAZE_KEYLIGHT_RANGE, HazeKeyLightRange, hazeKeyLightRange, float, DEFAULT_HAZE_KEYLIGHT_RANGE);
|
||||
DEFINE_PROPERTY_REF(PROP_HAZE_KEYLIGHT_ALTITUDE, HazeKeyLightAltitude, hazeKeyLightAltitude, float, DEFAULT_HAZE_KEYLIGHT_ALTITUDE);
|
||||
DEFINE_PROPERTY_REF(PROP_HAZE_KEYLIGHT_RANGE, HazeKeyLightRange, hazeKeyLightRange, float, model::initialHazeKeyLightRange_m);
|
||||
DEFINE_PROPERTY_REF(PROP_HAZE_KEYLIGHT_ALTITUDE, HazeKeyLightAltitude, hazeKeyLightAltitude, float, model::initialHazeKeyLightAltitude_m);
|
||||
};
|
||||
|
||||
#endif // hifi_HazePropertyGroup_h
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "HazePropertyGroup.h"
|
||||
#include "StagePropertyGroup.h"
|
||||
#include <ComponentMode.h>
|
||||
#include <model/HazeInit.h>
|
||||
|
||||
class ZoneEntityItem : public EntityItem {
|
||||
public:
|
||||
|
@ -150,20 +151,20 @@ protected:
|
|||
|
||||
uint32_t _hazeMode{ DEFAULT_HAZE_MODE };
|
||||
|
||||
float _hazeRange{ HazePropertyGroup::DEFAULT_HAZE_RANGE };
|
||||
xColor _hazeColor{ HazePropertyGroup::DEFAULT_HAZE_COLOR };
|
||||
xColor _hazeGlareColor{ HazePropertyGroup::DEFAULT_HAZE_GLARE_COLOR };
|
||||
float _hazeRange{ model::initialHazeRange_m };
|
||||
xColor _hazeColor{ model::initialHazeColorXcolor };
|
||||
xColor _hazeGlareColor{ model::initialHazeGlareColorXcolor };
|
||||
bool _hazeEnableGlare{ false };
|
||||
float _hazeGlareAngle{ HazePropertyGroup::DEFAULT_HAZE_GLARE_ANGLE };
|
||||
float _hazeGlareAngle{ model::initialGlareAngle_degs };
|
||||
|
||||
float _hazeCeiling{ HazePropertyGroup::DEFAULT_HAZE_CEILING };
|
||||
float _hazeBaseRef{ HazePropertyGroup::DEFAULT_HAZE_BASE_REF };
|
||||
float _hazeCeiling{ model::initialHazeBaseReference_m + model::initialHazeHeight_m };
|
||||
float _hazeBaseRef{ model::initialHazeBaseReference_m };
|
||||
|
||||
float _hazeBackgroundBlend{ HazePropertyGroup::DEFAULT_HAZE_BACKGROUND_BLEND };
|
||||
float _hazeBackgroundBlend{ model::initialHazeBackgroundBlend };
|
||||
|
||||
bool _hazeAttenuateKeyLight{ false };
|
||||
float _hazeKeyLightRange{ HazePropertyGroup::DEFAULT_HAZE_KEYLIGHT_RANGE };
|
||||
float _hazeKeyLightAltitude{ HazePropertyGroup::DEFAULT_HAZE_KEYLIGHT_ALTITUDE };
|
||||
float _hazeKeyLightRange{ model::initialHazeKeyLightRange_m };
|
||||
float _hazeKeyLightAltitude{ model::initialHazeKeyLightAltitude_m };
|
||||
|
||||
SkyboxPropertyGroup _skyboxProperties;
|
||||
HazePropertyGroup _hazeProperties;
|
||||
|
|
|
@ -23,7 +23,7 @@ Haze::Haze() {
|
|||
enum HazeModes {
|
||||
HAZE_MODE_IS_ACTIVE = 1 << 0,
|
||||
HAZE_MODE_IS_ALTITUDE_BASED = 1 << 1,
|
||||
HAZE_MODE_IS_DIRECTIONAL_LIGHT_ATTENUATED = 1 << 2,
|
||||
HAZE_MODE_IS_KEYLIGHT_ATTENUATED = 1 << 2,
|
||||
HAZE_MODE_IS_MODULATE_COLOR = 1 << 3,
|
||||
HAZE_MODE_IS_ENABLE_LIGHT_BLEND = 1 << 4
|
||||
};
|
||||
|
@ -55,25 +55,25 @@ void Haze::setHazeEnableGlare(const bool isHazeEnableGlare) {
|
|||
}
|
||||
}
|
||||
|
||||
void Haze::setDirectionalLightBlend(const float hazeDirectionalLightBlend) {
|
||||
void Haze::setHazeGlareBlend(const float hazeGlareBlend) {
|
||||
auto& params = _hazeParametersBuffer.get<Parameters>();
|
||||
|
||||
if (params.directionalLightBlend != hazeDirectionalLightBlend) {
|
||||
_hazeParametersBuffer.edit<Parameters>().directionalLightBlend = hazeDirectionalLightBlend;
|
||||
if (params.hazeGlareBlend != hazeGlareBlend) {
|
||||
_hazeParametersBuffer.edit<Parameters>().hazeGlareBlend = hazeGlareBlend;
|
||||
}
|
||||
}
|
||||
|
||||
void Haze::setDirectionalLightColor(const glm::vec3 hazeDirectionalLightColor) {
|
||||
void Haze::setHazeGlareColor(const glm::vec3 hazeGlareColor) {
|
||||
auto& params = _hazeParametersBuffer.get<Parameters>();
|
||||
|
||||
if (params.directionalLightColor.r != hazeDirectionalLightColor.r) {
|
||||
_hazeParametersBuffer.edit<Parameters>().directionalLightColor.r = hazeDirectionalLightColor.r;
|
||||
if (params.hazeGlareColor.r != hazeGlareColor.r) {
|
||||
_hazeParametersBuffer.edit<Parameters>().hazeGlareColor.r = hazeGlareColor.r;
|
||||
}
|
||||
if (params.directionalLightColor.g != hazeDirectionalLightColor.g) {
|
||||
_hazeParametersBuffer.edit<Parameters>().directionalLightColor.g = hazeDirectionalLightColor.g;
|
||||
if (params.hazeGlareColor.g != hazeGlareColor.g) {
|
||||
_hazeParametersBuffer.edit<Parameters>().hazeGlareColor.g = hazeGlareColor.g;
|
||||
}
|
||||
if (params.directionalLightColor.b != hazeDirectionalLightColor.b) {
|
||||
_hazeParametersBuffer.edit<Parameters>().directionalLightColor.b = hazeDirectionalLightColor.b;
|
||||
if (params.hazeGlareColor.b != hazeGlareColor.b) {
|
||||
_hazeParametersBuffer.edit<Parameters>().hazeGlareColor.b = hazeGlareColor.b;
|
||||
}
|
||||
}
|
||||
void Haze::setHazeActive(const bool isHazeActive) {
|
||||
|
@ -99,10 +99,10 @@ void Haze::setAltitudeBased(const bool isAltitudeBased) {
|
|||
void Haze::setHazeAttenuateKeyLight(const bool isHazeAttenuateKeyLight) {
|
||||
auto& params = _hazeParametersBuffer.get<Parameters>();
|
||||
|
||||
if (((params.hazeMode & HAZE_MODE_IS_DIRECTIONAL_LIGHT_ATTENUATED) == HAZE_MODE_IS_DIRECTIONAL_LIGHT_ATTENUATED ) && !isHazeAttenuateKeyLight) {
|
||||
_hazeParametersBuffer.edit<Parameters>().hazeMode &= ~HAZE_MODE_IS_DIRECTIONAL_LIGHT_ATTENUATED;
|
||||
} else if (((params.hazeMode & HAZE_MODE_IS_DIRECTIONAL_LIGHT_ATTENUATED) != HAZE_MODE_IS_DIRECTIONAL_LIGHT_ATTENUATED) && isHazeAttenuateKeyLight) {
|
||||
_hazeParametersBuffer.edit<Parameters>().hazeMode |= HAZE_MODE_IS_DIRECTIONAL_LIGHT_ATTENUATED;
|
||||
if (((params.hazeMode & HAZE_MODE_IS_KEYLIGHT_ATTENUATED) == HAZE_MODE_IS_KEYLIGHT_ATTENUATED) && !isHazeAttenuateKeyLight) {
|
||||
_hazeParametersBuffer.edit<Parameters>().hazeMode &= ~HAZE_MODE_IS_KEYLIGHT_ATTENUATED;
|
||||
} else if (((params.hazeMode & HAZE_MODE_IS_KEYLIGHT_ATTENUATED) != HAZE_MODE_IS_KEYLIGHT_ATTENUATED) && isHazeAttenuateKeyLight) {
|
||||
_hazeParametersBuffer.edit<Parameters>().hazeMode |= HAZE_MODE_IS_KEYLIGHT_ATTENUATED;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -124,11 +124,11 @@ void Haze::setHazeRangeFactor(const float hazeRangeFactor) {
|
|||
}
|
||||
}
|
||||
|
||||
void Haze::setHazeAltitudeFactor(const float hazeAltitudeFactor) {
|
||||
void Haze::setHazeAltitudeFactor(const float hazeHeightFactor) {
|
||||
auto& params = _hazeParametersBuffer.get<Parameters>();
|
||||
|
||||
if (params.hazeAltitudeFactor != hazeAltitudeFactor) {
|
||||
_hazeParametersBuffer.edit<Parameters>().hazeAltitudeFactor = hazeAltitudeFactor;
|
||||
if (params.hazeHeightFactor != hazeHeightFactor) {
|
||||
_hazeParametersBuffer.edit<Parameters>().hazeHeightFactor = hazeHeightFactor;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -156,11 +156,11 @@ void Haze::setHazeBaseReference(const float hazeBaseReference) {
|
|||
}
|
||||
}
|
||||
|
||||
void Haze::setHazeBackgroundBlendValue(const float hazeBackgroundBlendValue) {
|
||||
void Haze::setHazeBackgroundBlend(const float hazeBackgroundBlend) {
|
||||
auto& params = _hazeParametersBuffer.get<Parameters>();
|
||||
|
||||
if (params.hazeBackgroundBlendValue != hazeBackgroundBlendValue) {
|
||||
_hazeParametersBuffer.edit<Parameters>().hazeBackgroundBlendValue = hazeBackgroundBlendValue;
|
||||
if (params.hazeBackgroundBlend != hazeBackgroundBlend) {
|
||||
_hazeParametersBuffer.edit<Parameters>().hazeBackgroundBlend = hazeBackgroundBlend;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,56 +15,11 @@
|
|||
#include "Transform.h"
|
||||
#include "NumericalConstants.h"
|
||||
|
||||
#include "HazeInit.h"
|
||||
|
||||
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_m) {
|
||||
return glm::vec3(
|
||||
-LOG_P_005 / hazeRange_m.x,
|
||||
-LOG_P_005 / hazeRange_m.y,
|
||||
-LOG_P_005 / hazeRange_m.z);
|
||||
}
|
||||
|
||||
// limit range and altitude to no less than 1.0 metres
|
||||
inline float convertHazeRangeToHazeRangeFactor(const float hazeRange_m) { return -LOG_P_005 / glm::max(hazeRange_m, 1.0f); }
|
||||
|
||||
inline float convertHazeAltitudeToHazeAltitudeFactor(const float hazeAltitude_m) { return -LOG_P_005 / glm::max(hazeAltitude_m, 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)
|
||||
inline float convertDirectionalLightAngleToPower(const float directionalLightAngle) {
|
||||
return LOG_P_05 / logf(cosf(RADIANS_PER_DEGREE * directionalLightAngle));
|
||||
}
|
||||
|
||||
const glm::vec3 initialHazeColor{ 0.5f, 0.6f, 0.7f };
|
||||
const float initialDirectionalLightAngle_degs{ 30.0f };
|
||||
|
||||
const glm::vec3 initialDirectionalLightColor{ 1.0f, 0.9f, 0.7f };
|
||||
const float initialHazeBaseReference{ 0.0f };
|
||||
|
||||
// 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%
|
||||
const float initialHazeRange_m{ 150.0f };
|
||||
const float initialHazeAltitude_m{ 150.0f };
|
||||
|
||||
const float initialHazeKeyLightRange_m{ 150.0f };
|
||||
const float initialHazeKeyLightAltitude_m{ 150.0f };
|
||||
|
||||
const float initialHazeBackgroundBlendValue{ 0.0f };
|
||||
|
||||
const glm::vec3 initialColorModulationFactor{
|
||||
convertHazeRangeToHazeRangeFactor(initialHazeRange_m),
|
||||
convertHazeRangeToHazeRangeFactor(initialHazeRange_m),
|
||||
convertHazeRangeToHazeRangeFactor(initialHazeRange_m)
|
||||
};
|
||||
|
||||
class Haze {
|
||||
public:
|
||||
|
@ -73,9 +28,9 @@ namespace model {
|
|||
Haze();
|
||||
|
||||
void setHazeColor(const glm::vec3 hazeColor);
|
||||
void setDirectionalLightBlend(const float directionalLightBlend);
|
||||
void setHazeGlareBlend(const float hazeGlareBlend);
|
||||
|
||||
void setDirectionalLightColor(const glm::vec3 directionalLightColor);
|
||||
void setHazeGlareColor(const glm::vec3 hazeGlareColor);
|
||||
void setHazeBaseReference(const float hazeBaseReference);
|
||||
|
||||
void setHazeActive(const bool isHazeActive);
|
||||
|
@ -90,7 +45,7 @@ namespace model {
|
|||
void setHazeKeyLightRangeFactor(const float hazeKeyLightRange);
|
||||
void setHazeKeyLightAltitudeFactor(const float hazeKeyLightAltitude);
|
||||
|
||||
void setHazeBackgroundBlendValue(const float hazeBackgroundBlendValue);
|
||||
void setHazeBackgroundBlend(const float hazeBackgroundBlend);
|
||||
|
||||
void setZoneTransform(const glm::mat4& zoneTransform);
|
||||
|
||||
|
@ -101,10 +56,10 @@ namespace model {
|
|||
public:
|
||||
// DO NOT CHANGE ORDER HERE WITHOUT UNDERSTANDING THE std140 LAYOUT
|
||||
glm::vec3 hazeColor{ initialHazeColor };
|
||||
float directionalLightBlend{ convertDirectionalLightAngleToPower(initialDirectionalLightAngle_degs) };
|
||||
float hazeGlareBlend{ convertGlareAngleToPower(initialGlareAngle_degs) };
|
||||
|
||||
glm::vec3 directionalLightColor{ initialDirectionalLightColor };
|
||||
float hazeBaseReference{ initialHazeBaseReference };
|
||||
glm::vec3 hazeGlareColor{ initialHazeGlareColor };
|
||||
float hazeBaseReference{ initialHazeBaseReference_m };
|
||||
|
||||
glm::vec3 colorModulationFactor{ initialColorModulationFactor };
|
||||
int hazeMode{ 0 }; // bit 0 - set to activate haze attenuation of fragment color
|
||||
|
@ -115,11 +70,11 @@ namespace model {
|
|||
glm::mat4 zoneTransform;
|
||||
|
||||
// Amount of background (skybox) to display, overriding the haze effect for the background
|
||||
float hazeBackgroundBlendValue{ initialHazeBackgroundBlendValue };
|
||||
float hazeBackgroundBlend{ initialHazeBackgroundBlend };
|
||||
|
||||
// The haze attenuation exponents used by both fragment and directional light attenuation
|
||||
float hazeRangeFactor{ convertHazeRangeToHazeRangeFactor(initialHazeRange_m) };
|
||||
float hazeAltitudeFactor{ convertHazeAltitudeToHazeAltitudeFactor(initialHazeAltitude_m) };
|
||||
float hazeHeightFactor{ convertHazeAltitudeToHazeAltitudeFactor(initialHazeHeight_m) };
|
||||
|
||||
float hazeKeyLightRangeFactor{ convertHazeRangeToHazeRangeFactor(initialHazeKeyLightRange_m) };
|
||||
float hazeKeyLightAltitudeFactor{ convertHazeAltitudeToHazeAltitudeFactor(initialHazeKeyLightAltitude_m) };
|
||||
|
|
69
libraries/model/src/model/HazeInit.h
Normal file
69
libraries/model/src/model/HazeInit.h
Normal file
|
@ -0,0 +1,69 @@
|
|||
//
|
||||
// MakeHaze.h
|
||||
// libraries/model/src/model
|
||||
//
|
||||
// Created by Nissim Hadar on 10/26/2017.
|
||||
// Copyright 2014 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
#ifndef hifi_model_HazeInit_h
|
||||
#define hifi_model_HazeInit_h
|
||||
|
||||
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_m) {
|
||||
return glm::vec3(
|
||||
-LOG_P_005 / hazeRange_m.x,
|
||||
-LOG_P_005 / hazeRange_m.y,
|
||||
-LOG_P_005 / hazeRange_m.z);
|
||||
}
|
||||
|
||||
// limit range and altitude to no less than 1.0 metres
|
||||
inline float convertHazeRangeToHazeRangeFactor(const float hazeRange_m) { return -LOG_P_005 / glm::max(hazeRange_m, 1.0f); }
|
||||
|
||||
inline float convertHazeAltitudeToHazeAltitudeFactor(const float hazeHeight_m) { return -LOG_P_005 / glm::max(hazeHeight_m, 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)));
|
||||
}
|
||||
|
||||
const float initialHazeRange_m{ 1000.0f };
|
||||
const float initialHazeHeight_m{ 200.0f };
|
||||
|
||||
const float initialHazeKeyLightRange_m{ 1000.0f };
|
||||
const float initialHazeKeyLightAltitude_m{ 200.0f };
|
||||
|
||||
const float initialHazeBackgroundBlend{ 0.0f };
|
||||
|
||||
const glm::vec3 initialColorModulationFactor{
|
||||
convertHazeRangeToHazeRangeFactor(initialHazeRange_m),
|
||||
convertHazeRangeToHazeRangeFactor(initialHazeRange_m),
|
||||
convertHazeRangeToHazeRangeFactor(initialHazeRange_m)
|
||||
};
|
||||
|
||||
const glm::vec3 initialHazeColor{ 0.5f, 0.6f, 0.7f }; // Bluish
|
||||
const xColor initialHazeColorXcolor{ 128, 154, 179 };
|
||||
|
||||
const float initialGlareAngle_degs{ 20.0f };
|
||||
|
||||
const glm::vec3 initialHazeGlareColor{ 1.0f, 0.9f, 0.7f };
|
||||
const xColor initialHazeGlareColorXcolor{ 255, 229, 179 };
|
||||
|
||||
const float initialHazeBaseReference_m{ 0.0f };
|
||||
}
|
||||
#endif // hifi_model_HazeInit_h
|
|
@ -134,7 +134,7 @@ vec3 evalSkyboxGlobalColor(mat4 invViewMat, float shadowAttenuation, float obscu
|
|||
color += directionalSpecular;
|
||||
|
||||
// Attenuate the light if haze effect selected
|
||||
if ((hazeParams.hazeMode & HAZE_MODE_IS_DIRECTIONAL_LIGHT_ATTENUATED) == HAZE_MODE_IS_DIRECTIONAL_LIGHT_ATTENUATED) {
|
||||
if ((hazeParams.hazeMode & HAZE_MODE_IS_KEYLIGHT_ATTENUATED) == HAZE_MODE_IS_KEYLIGHT_ATTENUATED) {
|
||||
// Directional light attenuation is simulated by assuming the light source is at a fixed height above the
|
||||
// fragment. This height is where the haze density is reduced by 95% from the haze at the fragment's height
|
||||
//
|
||||
|
@ -147,8 +147,8 @@ vec3 evalSkyboxGlobalColor(mat4 invViewMat, float shadowAttenuation, float obscu
|
|||
|
||||
// Height at which haze density is reduced by 95% (default set to 2000.0 for safety ,this should never happen)
|
||||
float height_95p = 2000.0;
|
||||
if (hazeParams.hazeAltitudeFactorKeyLight > 0.0f) {
|
||||
height_95p = -log(0.05) / hazeParams.hazeAltitudeFactorKeyLight;
|
||||
if (hazeParams.hazeKeyLightAltitudeFactor > 0.0f) {
|
||||
height_95p = -log(0.05) / hazeParams.hazeKeyLightAltitudeFactor;
|
||||
}
|
||||
|
||||
// Note that the sine will always be positive
|
||||
|
@ -168,8 +168,8 @@ vec3 evalSkyboxGlobalColor(mat4 invViewMat, float shadowAttenuation, float obscu
|
|||
// Integration is from the fragment towards the light source
|
||||
// Note that the haze base reference affects only the haze density as function of altitude
|
||||
float hazeDensityDistribution =
|
||||
hazeParams.hazeRangeFactorKeyLight *
|
||||
exp(-hazeParams.hazeAltitudeFactorKeyLight * (worldFragPos.y - hazeParams.hazeBaseReference));
|
||||
hazeParams.hazeKeyLightRangeFactor *
|
||||
exp(-hazeParams.hazeKeyLightAltitudeFactor * (worldFragPos.y - hazeParams.hazeBaseReference));
|
||||
|
||||
float hazeIntegral = hazeDensityDistribution * distance;
|
||||
|
||||
|
|
|
@ -498,7 +498,7 @@ void RenderDeferredSetup::run(const render::RenderContextPointer& renderContext,
|
|||
auto lightStage = renderContext->_scene->getStage<LightStage>();
|
||||
assert(lightStage);
|
||||
assert(lightStage->getNumLights() > 0);
|
||||
auto lightAndShadow = lightStage->getCurrentKeyLightAndShadow();
|
||||
auto lightAndShadow = lightStage->getLightAndShadow(0);
|
||||
const auto& globalShadow = lightAndShadow.second;
|
||||
|
||||
// Bind the shadow buffer
|
||||
|
@ -509,7 +509,7 @@ void RenderDeferredSetup::run(const render::RenderContextPointer& renderContext,
|
|||
auto& program = deferredLightingEffect->_directionalSkyboxLight;
|
||||
LightLocationsPtr locations = deferredLightingEffect->_directionalSkyboxLightLocations;
|
||||
|
||||
auto keyLight = lightAndShadow.first;
|
||||
auto keyLight = lightStage->getLight(0);
|
||||
|
||||
// Setup the global directional pass pipeline
|
||||
{
|
||||
|
|
|
@ -33,24 +33,24 @@ void HazeConfig::setHazeColorB(const float value) {
|
|||
hazeColorB = value;
|
||||
}
|
||||
|
||||
void HazeConfig::setDirectionalLightAngle_degs(const float value) {
|
||||
hazeDirectionalLightAngle_degs = value;
|
||||
void HazeConfig::setHazeGlareAngle_degs(const float value) {
|
||||
hazeGlareAngle_degs = value;
|
||||
}
|
||||
|
||||
void HazeConfig::setDirectionalLightColorR(const float value) {
|
||||
hazeDirectionalLightColorR = value;
|
||||
void HazeConfig::setHazeGlareColorR(const float value) {
|
||||
hazeGlareColorR = value;
|
||||
}
|
||||
|
||||
void HazeConfig::setDirectionalLightColorG(const float value) {
|
||||
hazeDirectionalLightColorG = value;
|
||||
void HazeConfig::setHazeGlareColorG(const float value) {
|
||||
hazeGlareColorG = value;
|
||||
}
|
||||
|
||||
void HazeConfig::setDirectionalLightColorB(const float value) {
|
||||
hazeDirectionalLightColorB = value;
|
||||
void HazeConfig::setHazeGlareColorB(const float value) {
|
||||
hazeGlareColorB = value;
|
||||
}
|
||||
|
||||
void HazeConfig::setHazeBaseReference(const float value) {
|
||||
hazeBaseReference = value;
|
||||
hazeBaseReference_m = value;
|
||||
}
|
||||
|
||||
void HazeConfig::setHazeActive(const bool active) {
|
||||
|
@ -78,7 +78,7 @@ void HazeConfig::setHazeRange_m(const float value) {
|
|||
}
|
||||
|
||||
void HazeConfig::setHazeAltitude_m(const float value) {
|
||||
hazeAltitude_m = value;
|
||||
hazeHeight_m = value;
|
||||
}
|
||||
|
||||
void HazeConfig::setHazeKeyLightRange_m(const float value) {
|
||||
|
@ -89,8 +89,8 @@ void HazeConfig::setHazeKeyLightAltitude_m(const float value) {
|
|||
hazeKeyLightAltitude_m = value;
|
||||
}
|
||||
|
||||
void HazeConfig::setHazeBackgroundBlendValue(const float value) {
|
||||
hazeBackgroundBlendValue = value;
|
||||
void HazeConfig::setHazeBackgroundBlend(const float value) {
|
||||
hazeBackgroundBlend = value;
|
||||
}
|
||||
|
||||
MakeHaze::MakeHaze() {
|
||||
|
@ -99,10 +99,10 @@ MakeHaze::MakeHaze() {
|
|||
|
||||
void MakeHaze::configure(const Config& config) {
|
||||
_haze->setHazeColor(glm::vec3(config.hazeColorR, config.hazeColorG, config.hazeColorB));
|
||||
_haze->setDirectionalLightBlend(model::convertDirectionalLightAngleToPower(config.hazeDirectionalLightAngle_degs));
|
||||
_haze->setHazeGlareBlend(model::convertGlareAngleToPower(config.hazeGlareAngle_degs));
|
||||
|
||||
_haze->setDirectionalLightColor(glm::vec3(config.hazeDirectionalLightColorR, config.hazeDirectionalLightColorG, config.hazeDirectionalLightColorB));
|
||||
_haze->setHazeBaseReference(config.hazeBaseReference);
|
||||
_haze->setHazeGlareColor(glm::vec3(config.hazeGlareColorR, config.hazeGlareColorG, config.hazeGlareColorB));
|
||||
_haze->setHazeBaseReference(config.hazeBaseReference_m);
|
||||
|
||||
_haze->setHazeActive(config.isHazeActive);
|
||||
_haze->setAltitudeBased(config.isAltitudeBased);
|
||||
|
@ -111,12 +111,12 @@ void MakeHaze::configure(const Config& config) {
|
|||
_haze->setHazeEnableGlare(config.isHazeEnableGlare);
|
||||
|
||||
_haze->setHazeRangeFactor(model::convertHazeRangeToHazeRangeFactor(config.hazeRange_m));
|
||||
_haze->setHazeAltitudeFactor(model::convertHazeAltitudeToHazeAltitudeFactor(config.hazeAltitude_m));
|
||||
_haze->setHazeAltitudeFactor(model::convertHazeAltitudeToHazeAltitudeFactor(config.hazeHeight_m));
|
||||
|
||||
_haze->setHazeKeyLightRangeFactor(model::convertHazeRangeToHazeRangeFactor(config.hazeKeyLightRange_m));
|
||||
_haze->setHazeKeyLightAltitudeFactor(model::convertHazeAltitudeToHazeAltitudeFactor(config.hazeKeyLightAltitude_m));
|
||||
|
||||
_haze->setHazeBackgroundBlendValue(config.hazeBackgroundBlendValue);
|
||||
_haze->setHazeBackgroundBlend(config.hazeBackgroundBlend);
|
||||
}
|
||||
|
||||
void MakeHaze::run(const render::RenderContextPointer& renderContext, model::HazePointer& haze) {
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include "SurfaceGeometryPass.h"
|
||||
|
||||
#include "model/Haze.h"
|
||||
#include <model/Haze.h>
|
||||
|
||||
using LinearDepthFramebufferPointer = std::shared_ptr<LinearDepthFramebuffer>;
|
||||
|
||||
|
@ -32,12 +32,12 @@ class MakeHazeConfig : public render::Job::Config {
|
|||
Q_PROPERTY(float hazeColorR MEMBER hazeColorR WRITE setHazeColorR NOTIFY dirty);
|
||||
Q_PROPERTY(float hazeColorG MEMBER hazeColorG WRITE setHazeColorG NOTIFY dirty);
|
||||
Q_PROPERTY(float hazeColorB MEMBER hazeColorB WRITE setHazeColorB NOTIFY dirty);
|
||||
Q_PROPERTY(float hazeDirectionalLightAngle_degs MEMBER hazeDirectionalLightAngle_degs WRITE setDirectionalLightAngle_degs NOTIFY dirty);
|
||||
Q_PROPERTY(float hazeGlareAngle_degs MEMBER hazeGlareAngle_degs WRITE setHazeGlareAngle_degs NOTIFY dirty);
|
||||
|
||||
Q_PROPERTY(float hazeDirectionalLightColorR MEMBER hazeDirectionalLightColorR WRITE setDirectionalLightColorR NOTIFY dirty);
|
||||
Q_PROPERTY(float hazeDirectionalLightColorG MEMBER hazeDirectionalLightColorG WRITE setDirectionalLightColorG NOTIFY dirty);
|
||||
Q_PROPERTY(float hazeDirectionalLightColorB MEMBER hazeDirectionalLightColorB WRITE setDirectionalLightColorB NOTIFY dirty);
|
||||
Q_PROPERTY(float hazeBaseReference MEMBER hazeBaseReference WRITE setHazeBaseReference NOTIFY dirty);
|
||||
Q_PROPERTY(float hazeGlareColorR MEMBER hazeGlareColorR WRITE setHazeGlareColorR NOTIFY dirty);
|
||||
Q_PROPERTY(float hazeGlareColorG MEMBER hazeGlareColorG WRITE setHazeGlareColorG NOTIFY dirty);
|
||||
Q_PROPERTY(float hazeGlareColorB MEMBER hazeGlareColorB WRITE setHazeGlareColorB NOTIFY dirty);
|
||||
Q_PROPERTY(float hazeBaseReference_m MEMBER hazeBaseReference_m WRITE setHazeBaseReference NOTIFY dirty);
|
||||
|
||||
Q_PROPERTY(bool isHazeActive MEMBER isHazeActive WRITE setHazeActive NOTIFY dirty);
|
||||
Q_PROPERTY(bool isAltitudeBased MEMBER isAltitudeBased WRITE setAltitudeBased NOTIFY dirty);
|
||||
|
@ -46,12 +46,12 @@ class MakeHazeConfig : public render::Job::Config {
|
|||
Q_PROPERTY(bool isHazeEnableGlare MEMBER isHazeEnableGlare WRITE setHazeEnableGlare NOTIFY dirty);
|
||||
|
||||
Q_PROPERTY(float hazeRange_m MEMBER hazeRange_m WRITE setHazeRange_m NOTIFY dirty);
|
||||
Q_PROPERTY(float hazeAltitude_m MEMBER hazeAltitude_m WRITE setHazeAltitude_m NOTIFY dirty);
|
||||
Q_PROPERTY(float hazeHeight_m MEMBER hazeHeight_m WRITE setHazeAltitude_m NOTIFY dirty);
|
||||
|
||||
Q_PROPERTY(float hazeKeyLightRange_m MEMBER hazeKeyLightRange_m WRITE setHazeKeyLightRange_m NOTIFY dirty);
|
||||
Q_PROPERTY(float hazeKeyLightAltitude_m MEMBER hazeKeyLightAltitude_m WRITE setHazeKeyLightAltitude_m NOTIFY dirty);
|
||||
|
||||
Q_PROPERTY(float hazeBackgroundBlendValue MEMBER hazeBackgroundBlendValue WRITE setHazeBackgroundBlendValue NOTIFY dirty);
|
||||
Q_PROPERTY(float hazeBackgroundBlend MEMBER hazeBackgroundBlend WRITE setHazeBackgroundBlend NOTIFY dirty);
|
||||
|
||||
public:
|
||||
MakeHazeConfig() : render::Job::Config() {}
|
||||
|
@ -59,12 +59,12 @@ public:
|
|||
float hazeColorR{ model::initialHazeColor.r };
|
||||
float hazeColorG{ model::initialHazeColor.g };
|
||||
float hazeColorB{ model::initialHazeColor.b };
|
||||
float hazeDirectionalLightAngle_degs{ model::initialDirectionalLightAngle_degs };
|
||||
float hazeGlareAngle_degs{ model::initialGlareAngle_degs };
|
||||
|
||||
float hazeDirectionalLightColorR{ model::initialDirectionalLightColor.r };
|
||||
float hazeDirectionalLightColorG{ model::initialDirectionalLightColor.g };
|
||||
float hazeDirectionalLightColorB{ model::initialDirectionalLightColor.b };
|
||||
float hazeBaseReference{ model::initialHazeBaseReference };
|
||||
float hazeGlareColorR{ model::initialHazeGlareColor.r };
|
||||
float hazeGlareColorG{ model::initialHazeGlareColor.g };
|
||||
float hazeGlareColorB{ model::initialHazeGlareColor.b };
|
||||
float hazeBaseReference_m{ model::initialHazeBaseReference_m };
|
||||
|
||||
bool isHazeActive{ false };
|
||||
bool isAltitudeBased{ false };
|
||||
|
@ -73,23 +73,23 @@ public:
|
|||
bool isHazeEnableGlare{ false };
|
||||
|
||||
float hazeRange_m{ model::initialHazeRange_m };
|
||||
float hazeAltitude_m{ model::initialHazeAltitude_m };
|
||||
float hazeHeight_m{ model::initialHazeHeight_m };
|
||||
|
||||
float hazeKeyLightRange_m{ model::initialHazeKeyLightRange_m };
|
||||
float hazeKeyLightAltitude_m{ model::initialHazeKeyLightAltitude_m };
|
||||
|
||||
float hazeBackgroundBlendValue{ model::initialHazeBackgroundBlendValue };
|
||||
float hazeBackgroundBlend{ model::initialHazeBackgroundBlend };
|
||||
|
||||
public slots:
|
||||
void setHazeColorR(const float value) { hazeColorR = value; emit dirty(); }
|
||||
void setHazeColorG(const float value) { hazeColorG = value; emit dirty(); }
|
||||
void setHazeColorB(const float value) { hazeColorB = value; emit dirty(); }
|
||||
void setDirectionalLightAngle_degs(const float value) { hazeDirectionalLightAngle_degs = value; emit dirty(); }
|
||||
void setHazeGlareAngle_degs(const float value) { hazeGlareAngle_degs = value; emit dirty(); }
|
||||
|
||||
void setDirectionalLightColorR(const float value) { hazeDirectionalLightColorR = value; emit dirty(); }
|
||||
void setDirectionalLightColorG(const float value) { hazeDirectionalLightColorG = value; emit dirty(); }
|
||||
void setDirectionalLightColorB(const float value) { hazeDirectionalLightColorB = value; emit dirty(); }
|
||||
void setHazeBaseReference(const float value) { hazeBaseReference = value; ; emit dirty(); }
|
||||
void setHazeGlareColorR(const float value) { hazeGlareColorR = value; emit dirty(); }
|
||||
void setHazeGlareColorG(const float value) { hazeGlareColorG = value; emit dirty(); }
|
||||
void setHazeGlareColorB(const float value) { hazeGlareColorB = value; emit dirty(); }
|
||||
void setHazeBaseReference(const float value) { hazeBaseReference_m = value; ; emit dirty(); }
|
||||
|
||||
void setHazeActive(const bool active) { isHazeActive = active; emit dirty(); }
|
||||
void setAltitudeBased(const bool active) { isAltitudeBased = active; emit dirty(); }
|
||||
|
@ -98,12 +98,12 @@ public slots:
|
|||
void setHazeEnableGlare(const bool active) { isHazeEnableGlare = active; emit dirty(); }
|
||||
|
||||
void setHazeRange_m(const float value) { hazeRange_m = value; emit dirty(); }
|
||||
void setHazeAltitude_m(const float value) { hazeAltitude_m = value; emit dirty(); }
|
||||
void setHazeAltitude_m(const float value) { hazeHeight_m = value; emit dirty(); }
|
||||
|
||||
void setHazeKeyLightRange_m(const float value) { hazeKeyLightRange_m = value; emit dirty(); }
|
||||
void setHazeKeyLightAltitude_m(const float value) { hazeKeyLightAltitude_m = value; emit dirty(); }
|
||||
|
||||
void setHazeBackgroundBlendValue(const float value) { hazeBackgroundBlendValue = value; ; emit dirty(); }
|
||||
void setHazeBackgroundBlend(const float value) { hazeBackgroundBlend = value; ; emit dirty(); }
|
||||
|
||||
signals:
|
||||
void dirty();
|
||||
|
@ -131,12 +131,12 @@ public:
|
|||
float hazeColorR{ model::initialHazeColor.r };
|
||||
float hazeColorG{ model::initialHazeColor.g };
|
||||
float hazeColorB{ model::initialHazeColor.b };
|
||||
float hazeDirectionalLightAngle_degs{ model::initialDirectionalLightAngle_degs };
|
||||
float hazeGlareAngle_degs{ model::initialGlareAngle_degs };
|
||||
|
||||
float hazeDirectionalLightColorR{ model::initialDirectionalLightColor.r };
|
||||
float hazeDirectionalLightColorG{ model::initialDirectionalLightColor.g };
|
||||
float hazeDirectionalLightColorB{ model::initialDirectionalLightColor.b };
|
||||
float hazeBaseReference{ model::initialHazeBaseReference };
|
||||
float hazeGlareColorR{ model::initialHazeGlareColor.r };
|
||||
float hazeGlareColorG{ model::initialHazeGlareColor.g };
|
||||
float hazeGlareColorB{ model::initialHazeGlareColor.b };
|
||||
float hazeBaseReference_m{ model::initialHazeBaseReference_m };
|
||||
|
||||
bool isHazeActive{ false }; // Setting this to true will set haze to on
|
||||
bool isAltitudeBased{ false };
|
||||
|
@ -145,22 +145,22 @@ public:
|
|||
bool isHazeEnableGlare{ false };
|
||||
|
||||
float hazeRange_m{ model::initialHazeRange_m };
|
||||
float hazeAltitude_m{ model::initialHazeAltitude_m };
|
||||
float hazeHeight_m{ model::initialHazeHeight_m };
|
||||
|
||||
float hazeKeyLightRange_m{ model::initialHazeKeyLightRange_m };
|
||||
float hazeKeyLightAltitude_m{ model::initialHazeKeyLightAltitude_m };
|
||||
|
||||
float hazeBackgroundBlendValue{ model::initialHazeBackgroundBlendValue };
|
||||
float hazeBackgroundBlend{ model::initialHazeBackgroundBlend };
|
||||
|
||||
// methods
|
||||
void setHazeColorR(const float value);
|
||||
void setHazeColorG(const float value);
|
||||
void setHazeColorB(const float value);
|
||||
void setDirectionalLightAngle_degs(const float value);
|
||||
void setHazeGlareAngle_degs(const float value);
|
||||
|
||||
void setDirectionalLightColorR(const float value);
|
||||
void setDirectionalLightColorG(const float value);
|
||||
void setDirectionalLightColorB(const float value);
|
||||
void setHazeGlareColorR(const float value);
|
||||
void setHazeGlareColorG(const float value);
|
||||
void setHazeGlareColorB(const float value);
|
||||
void setHazeBaseReference(const float value);
|
||||
|
||||
void setHazeActive(const bool active);
|
||||
|
@ -175,7 +175,7 @@ public:
|
|||
void setHazeKeyLightRange_m(const float value);
|
||||
void setHazeKeyLightAltitude_m(const float value);
|
||||
|
||||
void setHazeBackgroundBlendValue(const float value);
|
||||
void setHazeBackgroundBlend(const float value);
|
||||
};
|
||||
|
||||
class DrawHaze {
|
||||
|
|
|
@ -60,15 +60,15 @@ void main(void) {
|
|||
Light light = getLight();
|
||||
vec3 lightDirection = getLightDirection(light);
|
||||
|
||||
float directionalLightComponent = max(0.0, dot(eyeFragDir, -lightDirection));
|
||||
float power = min(1.0, pow(directionalLightComponent, hazeParams.directionalLightBlend));
|
||||
float glareComponent = max(0.0, dot(eyeFragDir, -lightDirection));
|
||||
float power = min(1.0, pow(glareComponent, hazeParams.hazeGlareBlend));
|
||||
|
||||
vec4 directionalLightColor = vec4(hazeParams.directionalLightColor, 1.0);
|
||||
vec4 glareColor = vec4(hazeParams.hazeGlareColor, 1.0);
|
||||
|
||||
// Use the haze colour for the belnd-out colour, if blend is not enabled
|
||||
// Use the haze colour for the glare colour, if blend is not enabled
|
||||
vec4 blendedHazeColor;
|
||||
if ((hazeParams.hazeMode & HAZE_MODE_IS_ENABLE_LIGHT_BLEND) == HAZE_MODE_IS_ENABLE_LIGHT_BLEND) {
|
||||
blendedHazeColor = mix(hazeColor, directionalLightColor, power);
|
||||
blendedHazeColor = mix(hazeColor, glareColor, power);
|
||||
} else {
|
||||
blendedHazeColor = hazeColor;
|
||||
}
|
||||
|
@ -86,14 +86,14 @@ void main(void) {
|
|||
// Note that the haze base reference affects only the haze density as function of altitude
|
||||
vec3 hazeDensityDistribution =
|
||||
hazeParams.colorModulationFactor *
|
||||
exp(-hazeParams.hazeAltitudeFactor * (worldEyePos.y - hazeParams.hazeBaseReference));
|
||||
exp(-hazeParams.hazeHeightFactor * (worldEyePos.y - hazeParams.hazeBaseReference));
|
||||
|
||||
vec3 hazeIntegral = hazeDensityDistribution * distance;
|
||||
|
||||
const float slopeThreshold = 0.01;
|
||||
float deltaHeight = worldFragPos.y - worldEyePos.y;
|
||||
if (abs(deltaHeight) > slopeThreshold) {
|
||||
float t = hazeParams.hazeAltitudeFactor * deltaHeight;
|
||||
float t = hazeParams.hazeHeightFactor * deltaHeight;
|
||||
hazeIntegral *= (1.0 - exp (-t)) / t;
|
||||
}
|
||||
|
||||
|
@ -117,14 +117,14 @@ void main(void) {
|
|||
// Note that the haze base reference affects only the haze density as function of altitude
|
||||
float hazeDensityDistribution =
|
||||
hazeParams.hazeRangeFactor *
|
||||
exp(-hazeParams.hazeAltitudeFactor * (worldEyePos.y - hazeParams.hazeBaseReference));
|
||||
exp(-hazeParams.hazeHeightFactor * (worldEyePos.y - hazeParams.hazeBaseReference));
|
||||
|
||||
float hazeIntegral = hazeDensityDistribution * distance;
|
||||
|
||||
const float slopeThreshold = 0.01;
|
||||
float deltaHeight = worldFragPos.y - worldEyePos.y;
|
||||
if (abs(deltaHeight) > slopeThreshold) {
|
||||
float t = hazeParams.hazeAltitudeFactor * deltaHeight;
|
||||
float t = hazeParams.hazeHeightFactor * deltaHeight;
|
||||
// Protect from wild values
|
||||
if (abs(t) > 0.0000001) {
|
||||
hazeIntegral *= (1.0 - exp (-t)) / t;
|
||||
|
@ -140,7 +140,7 @@ void main(void) {
|
|||
// Mix with background at far range
|
||||
const float BLEND_DISTANCE = 27000.0;
|
||||
if (distance > BLEND_DISTANCE) {
|
||||
outFragColor = mix(potentialFragColor, fragColor, hazeParams.backgroundBlendValue);
|
||||
outFragColor = mix(potentialFragColor, fragColor, hazeParams.backgroundBlend);
|
||||
} else {
|
||||
outFragColor = potentialFragColor;
|
||||
}
|
||||
|
|
|
@ -12,28 +12,28 @@
|
|||
|
||||
const int HAZE_MODE_IS_ACTIVE = 1 << 0;
|
||||
const int HAZE_MODE_IS_ALTITUDE_BASED = 1 << 1;
|
||||
const int HAZE_MODE_IS_DIRECTIONAL_LIGHT_ATTENUATED = 1 << 2;
|
||||
const int HAZE_MODE_IS_KEYLIGHT_ATTENUATED = 1 << 2;
|
||||
const int HAZE_MODE_IS_MODULATE_COLOR = 1 << 3;
|
||||
const int HAZE_MODE_IS_ENABLE_LIGHT_BLEND = 1 << 4;
|
||||
|
||||
struct HazeParams {
|
||||
vec3 hazeColor;
|
||||
float directionalLightBlend;
|
||||
float hazeGlareBlend;
|
||||
|
||||
vec3 directionalLightColor;
|
||||
vec3 hazeGlareColor;
|
||||
float hazeBaseReference;
|
||||
|
||||
vec3 colorModulationFactor;
|
||||
int hazeMode;
|
||||
|
||||
mat4 zoneTransform;
|
||||
float backgroundBlendValue;
|
||||
float backgroundBlend;
|
||||
|
||||
float hazeRangeFactor;
|
||||
float hazeAltitudeFactor;
|
||||
float hazeHeightFactor;
|
||||
|
||||
float hazeRangeFactorKeyLight;
|
||||
float hazeAltitudeFactorKeyLight;
|
||||
float hazeKeyLightRangeFactor;
|
||||
float hazeKeyLightAltitudeFactor;
|
||||
};
|
||||
|
||||
layout(std140) uniform hazeBuffer {
|
||||
|
|
|
@ -21,10 +21,10 @@ FetchHazeStage::FetchHazeStage() {
|
|||
|
||||
void FetchHazeStage::configure(const Config& config) {
|
||||
_haze->setHazeColor(glm::vec3(config.hazeColorR, config.hazeColorG, config.hazeColorB));
|
||||
_haze->setDirectionalLightBlend(model::convertDirectionalLightAngleToPower(config.hazeDirectionalLightAngle_degs));
|
||||
_haze->setHazeGlareBlend(model::convertGlareAngleToPower(config.hazeGlareAngle_degs));
|
||||
|
||||
_haze->setDirectionalLightColor(glm::vec3(config.hazeDirectionalLightColorR, config.hazeDirectionalLightColorG, config.hazeDirectionalLightColorB));
|
||||
_haze->setHazeBaseReference(config.hazeBaseReference);
|
||||
_haze->setHazeGlareColor(glm::vec3(config.hazeGlareColorR, config.hazeGlareColorG, config.hazeGlareColorB));
|
||||
_haze->setHazeBaseReference(config.hazeBaseReference_m);
|
||||
|
||||
_haze->setHazeActive(config.isHazeActive);
|
||||
_haze->setAltitudeBased(config.isAltitudeBased);
|
||||
|
@ -33,12 +33,12 @@ void FetchHazeStage::configure(const Config& config) {
|
|||
_haze->setHazeEnableGlare(config.isHazeEnableGlare);
|
||||
|
||||
_haze->setHazeRangeFactor(model::convertHazeRangeToHazeRangeFactor(config.hazeRange_m));
|
||||
_haze->setHazeAltitudeFactor(model::convertHazeAltitudeToHazeAltitudeFactor(config.hazeAltitude_m));
|
||||
_haze->setHazeAltitudeFactor(model::convertHazeAltitudeToHazeAltitudeFactor(config.hazeHeight_m));
|
||||
|
||||
_haze->setHazeKeyLightRangeFactor(model::convertHazeRangeToHazeRangeFactor(config.hazeKeyLightRange_m));
|
||||
_haze->setHazeKeyLightAltitudeFactor(model::convertHazeAltitudeToHazeAltitudeFactor(config.hazeKeyLightAltitude_m));
|
||||
|
||||
_haze->setHazeBackgroundBlendValue(config.hazeBackgroundBlendValue);
|
||||
_haze->setHazeBackgroundBlend(config.hazeBackgroundBlend);
|
||||
}
|
||||
|
||||
HazeStage::Index HazeStage::findHaze(const HazePointer& haze) const {
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
#include <render/Forward.h>
|
||||
#include <render/DrawTask.h>
|
||||
#include "model/Haze.h"
|
||||
#include <model/Haze.h>
|
||||
|
||||
// Haze stage to set up haze-related rendering tasks
|
||||
class HazeStage : public render::Stage {
|
||||
|
@ -86,12 +86,12 @@ class FetchHazeConfig : public render::Job::Config {
|
|||
Q_PROPERTY(float hazeColorR MEMBER hazeColorR WRITE setHazeColorR NOTIFY dirty);
|
||||
Q_PROPERTY(float hazeColorG MEMBER hazeColorG WRITE setHazeColorG NOTIFY dirty);
|
||||
Q_PROPERTY(float hazeColorB MEMBER hazeColorB WRITE setHazeColorB NOTIFY dirty);
|
||||
Q_PROPERTY(float hazeDirectionalLightAngle_degs MEMBER hazeDirectionalLightAngle_degs WRITE setDirectionalLightAngle_degs NOTIFY dirty);
|
||||
Q_PROPERTY(float hazeGlareAngle_degs MEMBER hazeGlareAngle_degs WRITE setHazeGlareAngle_degs NOTIFY dirty);
|
||||
|
||||
Q_PROPERTY(float hazeDirectionalLightColorR MEMBER hazeDirectionalLightColorR WRITE setDirectionalLightColorR NOTIFY dirty);
|
||||
Q_PROPERTY(float hazeDirectionalLightColorG MEMBER hazeDirectionalLightColorG WRITE setDirectionalLightColorG NOTIFY dirty);
|
||||
Q_PROPERTY(float hazeDirectionalLightColorB MEMBER hazeDirectionalLightColorB WRITE setDirectionalLightColorB NOTIFY dirty);
|
||||
Q_PROPERTY(float hazeBaseReference MEMBER hazeBaseReference WRITE setHazeBaseReference NOTIFY dirty);
|
||||
Q_PROPERTY(float hazeGlareColorR MEMBER hazeGlareColorR WRITE setHazeGlareColorR NOTIFY dirty);
|
||||
Q_PROPERTY(float hazeGlareColorG MEMBER hazeGlareColorG WRITE setHazeGlareColorG NOTIFY dirty);
|
||||
Q_PROPERTY(float hazeGlareColorB MEMBER hazeGlareColorB WRITE setHazeGlareColorB NOTIFY dirty);
|
||||
Q_PROPERTY(float hazeBaseReference_m MEMBER hazeBaseReference_m WRITE setHazeBaseReference NOTIFY dirty);
|
||||
|
||||
Q_PROPERTY(bool isHazeActive MEMBER isHazeActive WRITE setHazeActive NOTIFY dirty);
|
||||
Q_PROPERTY(bool isAltitudeBased MEMBER isAltitudeBased WRITE setAltitudeBased NOTIFY dirty);
|
||||
|
@ -100,12 +100,12 @@ class FetchHazeConfig : public render::Job::Config {
|
|||
Q_PROPERTY(bool isHazeEnableGlare MEMBER isHazeEnableGlare WRITE setHazeEnableGlare NOTIFY dirty);
|
||||
|
||||
Q_PROPERTY(float hazeRange_m MEMBER hazeRange_m WRITE setHazeRange_m NOTIFY dirty);
|
||||
Q_PROPERTY(float hazeAltitude_m MEMBER hazeAltitude_m WRITE setHazeAltitude_m NOTIFY dirty);
|
||||
Q_PROPERTY(float hazeHeight_m MEMBER hazeHeight_m WRITE setHazeAltitude_m NOTIFY dirty);
|
||||
|
||||
Q_PROPERTY(float hazeKeyLightRange_m MEMBER hazeKeyLightRange_m WRITE setHazeKeyLightRange_m NOTIFY dirty);
|
||||
Q_PROPERTY(float hazeKeyLightAltitude_m MEMBER hazeKeyLightAltitude_m WRITE setHazeKeyLightAltitude_m NOTIFY dirty);
|
||||
|
||||
Q_PROPERTY(float hazeBackgroundBlendValue MEMBER hazeBackgroundBlendValue WRITE setHazeBackgroundBlendValue NOTIFY dirty);
|
||||
Q_PROPERTY(float hazeBackgroundBlend MEMBER hazeBackgroundBlend WRITE setHazeBackgroundBlend NOTIFY dirty);
|
||||
|
||||
public:
|
||||
FetchHazeConfig() : render::Job::Config() {}
|
||||
|
@ -113,12 +113,12 @@ public:
|
|||
float hazeColorR{ model::initialHazeColor.r };
|
||||
float hazeColorG{ model::initialHazeColor.g };
|
||||
float hazeColorB{ model::initialHazeColor.b };
|
||||
float hazeDirectionalLightAngle_degs{ model::initialDirectionalLightAngle_degs };
|
||||
float hazeGlareAngle_degs{ model::initialGlareAngle_degs };
|
||||
|
||||
float hazeDirectionalLightColorR{ model::initialDirectionalLightColor.r };
|
||||
float hazeDirectionalLightColorG{ model::initialDirectionalLightColor.g };
|
||||
float hazeDirectionalLightColorB{ model::initialDirectionalLightColor.b };
|
||||
float hazeBaseReference{ model::initialHazeBaseReference };
|
||||
float hazeGlareColorR{ model::initialHazeGlareColor.r };
|
||||
float hazeGlareColorG{ model::initialHazeGlareColor.g };
|
||||
float hazeGlareColorB{ model::initialHazeGlareColor.b };
|
||||
float hazeBaseReference_m{ model::initialHazeBaseReference_m };
|
||||
|
||||
bool isHazeActive{ false };
|
||||
bool isAltitudeBased{ false };
|
||||
|
@ -127,23 +127,23 @@ public:
|
|||
bool isHazeEnableGlare{ false };
|
||||
|
||||
float hazeRange_m{ model::initialHazeRange_m };
|
||||
float hazeAltitude_m{ model::initialHazeAltitude_m };
|
||||
float hazeHeight_m{ model::initialHazeHeight_m };
|
||||
|
||||
float hazeKeyLightRange_m{ model::initialHazeKeyLightRange_m };
|
||||
float hazeKeyLightAltitude_m{ model::initialHazeKeyLightAltitude_m };
|
||||
|
||||
float hazeBackgroundBlendValue{ model::initialHazeBackgroundBlendValue };
|
||||
float hazeBackgroundBlend{ model::initialHazeBackgroundBlend };
|
||||
|
||||
public slots:
|
||||
void setHazeColorR(const float value) { hazeColorR = value; emit dirty(); }
|
||||
void setHazeColorG(const float value) { hazeColorG = value; emit dirty(); }
|
||||
void setHazeColorB(const float value) { hazeColorB = value; emit dirty(); }
|
||||
void setDirectionalLightAngle_degs(const float value) { hazeDirectionalLightAngle_degs = value; emit dirty(); }
|
||||
void setHazeGlareAngle_degs(const float value) { hazeGlareAngle_degs = value; emit dirty(); }
|
||||
|
||||
void setDirectionalLightColorR(const float value) { hazeDirectionalLightColorR = value; emit dirty(); }
|
||||
void setDirectionalLightColorG(const float value) { hazeDirectionalLightColorG = value; emit dirty(); }
|
||||
void setDirectionalLightColorB(const float value) { hazeDirectionalLightColorB = value; emit dirty(); }
|
||||
void setHazeBaseReference(const float value) { hazeBaseReference = value; ; emit dirty(); }
|
||||
void setHazeGlareColorR(const float value) { hazeGlareColorR = value; emit dirty(); }
|
||||
void setHazeGlareColorG(const float value) { hazeGlareColorG = value; emit dirty(); }
|
||||
void setHazeGlareColorB(const float value) { hazeGlareColorB = value; emit dirty(); }
|
||||
void setHazeBaseReference(const float value) { hazeBaseReference_m = value; ; emit dirty(); }
|
||||
|
||||
void setHazeActive(const bool active) { isHazeActive = active; emit dirty(); }
|
||||
void setAltitudeBased(const bool active) { isAltitudeBased = active; emit dirty(); }
|
||||
|
@ -152,12 +152,12 @@ public slots:
|
|||
void setHazeEnableGlare(const bool active) { isHazeEnableGlare = active; emit dirty(); }
|
||||
|
||||
void setHazeRange_m(const float value) { hazeRange_m = value; emit dirty(); }
|
||||
void setHazeAltitude_m(const float value) { hazeAltitude_m = value; emit dirty(); }
|
||||
void setHazeAltitude_m(const float value) { hazeHeight_m = value; emit dirty(); }
|
||||
|
||||
void setHazeKeyLightRange_m(const float value) { hazeKeyLightRange_m = value; emit dirty(); }
|
||||
void setHazeKeyLightAltitude_m(const float value) { hazeKeyLightAltitude_m = value; emit dirty(); }
|
||||
|
||||
void setHazeBackgroundBlendValue(const float value) { hazeBackgroundBlendValue = value; ; emit dirty(); }
|
||||
void setHazeBackgroundBlend(const float value) { hazeBackgroundBlend = value; ; emit dirty(); }
|
||||
|
||||
signals:
|
||||
void dirty();
|
||||
|
|
|
@ -570,14 +570,14 @@
|
|||
</fieldset>
|
||||
</fieldset>
|
||||
<fieldset class="zone-group zone-section haze-section property rgb fstuple">
|
||||
<div class="color-picker" id="property-zone-haze-blend-in-color"></div>
|
||||
<div class="color-picker" id="property-zone-haze-color"></div>
|
||||
<legend>Haze Color</legend>
|
||||
<div class="tuple">
|
||||
<div><input type="number" class="red" id="property-zone-haze-blend-in-color-red" min="0" max="255" step="1">
|
||||
<div><input type="number" class="red" id="property-zone-haze-color-red" min="0" max="255" step="1">
|
||||
<label for="property-zone-haze-blend-in-color-red">Red:</label></div>
|
||||
<div><input type="number" class="green" id="property-zone-haze-blend-in-color-green" min="0" max="255" step="1">
|
||||
<div><input type="number" class="green" id="property-zone-haze-color-green" min="0" max="255" step="1">
|
||||
<label for="property-zone-haze-blend-in-color-green">Green:</label></div>
|
||||
<div><input type="number" class="blue" id="property-zone-haze-blend-in-color-blue" min="0" max="255" step="1">
|
||||
<div><input type="number" class="blue" id="property-zone-haze-color-blue" min="0" max="255" step="1">
|
||||
<label for="property-zone-haze-blend-in-color-blue">Blue:</label></div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
@ -586,14 +586,14 @@
|
|||
<label for="property-zone-haze-enable-light-blend">Enable Glare</label>
|
||||
</div>
|
||||
<fieldset class="zone-group zone-section haze-section property rgb fstuple">
|
||||
<div class="color-picker" id="property-zone-haze-blend-out-color"></div>
|
||||
<div class="color-picker" id="property-zone-haze-glare-color"></div>
|
||||
<legend>Glare Color</legend>
|
||||
<div class="tuple">
|
||||
<div><input type="number" class="red" id="property-zone-haze-blend-out-color-red" min="0" max="255" step="1">
|
||||
<div><input type="number" class="red" id="property-zone-haze-glare-color-red" min="0" max="255" step="1">
|
||||
<label for="property-zone-haze-blend-out-color-red">Red:</label></div>
|
||||
<div><input type="number" class="green" id="property-zone-haze-blend-out-color-green" min="0" max="255" step="1">
|
||||
<div><input type="number" class="green" id="property-zone-haze-glare-color-green" min="0" max="255" step="1">
|
||||
<label for="property-zone-haze-blend-out-color-green">Green:</label></div>
|
||||
<div><input type="number" class="blue" id="property-zone-haze-blend-out-color-blue" min="0" max="255" step="1">
|
||||
<div><input type="number" class="blue" id="property-zone-haze-glare-color-blue" min="0" max="255" step="1">
|
||||
<label for="property-zone-haze-blend-out-color-blue">Blue:</label></div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
|
|
@ -678,14 +678,14 @@ function loaded() {
|
|||
var elZoneHazeModeEnabled = document.getElementById("property-zone-haze-mode-enabled");
|
||||
|
||||
var elZoneHazeRange = document.getElementById("property-zone-haze-range");
|
||||
var elZoneHazeColor = document.getElementById("property-zone-haze-blend-in-color");
|
||||
var elZoneHazeColorRed = document.getElementById("property-zone-haze-blend-in-color-red");
|
||||
var elZoneHazeColorGreen = document.getElementById("property-zone-haze-blend-in-color-green");
|
||||
var elZoneHazeColorBlue = document.getElementById("property-zone-haze-blend-in-color-blue");
|
||||
var elZoneHazeGlareColor = document.getElementById("property-zone-haze-blend-out-color");
|
||||
var elZoneHazeGlareColorRed = document.getElementById("property-zone-haze-blend-out-color-red");
|
||||
var elZoneHazeGlareColorGreen = document.getElementById("property-zone-haze-blend-out-color-green");
|
||||
var elZoneHazeGlareColorBlue = document.getElementById("property-zone-haze-blend-out-color-blue");
|
||||
var elZoneHazeColor = document.getElementById("property-zone-haze-color");
|
||||
var elZoneHazeColorRed = document.getElementById("property-zone-haze-color-red");
|
||||
var elZoneHazeColorGreen = document.getElementById("property-zone-haze-color-green");
|
||||
var elZoneHazeColorBlue = document.getElementById("property-zone-haze-color-blue");
|
||||
var elZoneHazeGlareColor = document.getElementById("property-zone-haze-glare-color");
|
||||
var elZoneHazeGlareColorRed = document.getElementById("property-zone-haze-glare-color-red");
|
||||
var elZoneHazeGlareColorGreen = document.getElementById("property-zone-haze-glare-color-green");
|
||||
var elZoneHazeGlareColorBlue = document.getElementById("property-zone-haze-glare-color-blue");
|
||||
var elZoneHazeEnableGlare = document.getElementById("property-zone-haze-enable-light-blend");
|
||||
var elZonehazeGlareAngle = document.getElementById("property-zone-haze-blend-angle");
|
||||
|
||||
|
@ -1474,15 +1474,15 @@ function loaded() {
|
|||
|
||||
elZoneHazeRange.addEventListener('change', createEmitGroupNumberPropertyUpdateFunction('haze', 'hazeRange'));
|
||||
|
||||
colorPickers.push($('#property-zone-haze-blend-in-color').colpick({
|
||||
colorPickers.push($('#property-zone-haze-color').colpick({
|
||||
colorScheme: 'dark',
|
||||
layout: 'hex',
|
||||
color: '000000',
|
||||
onShow: function(colpick) {
|
||||
$('#property-zone-haze-blend-in-color').attr('active', 'true');
|
||||
$('#property-zone-haze-color').attr('active', 'true');
|
||||
},
|
||||
onHide: function(colpick) {
|
||||
$('#property-zone-haze-blend-in-color').attr('active', 'false');
|
||||
$('#property-zone-haze-color').attr('active', 'false');
|
||||
},
|
||||
onSubmit: function(hsb, hex, rgb, el) {
|
||||
$(el).css('background-color', '#' + hex);
|
||||
|
@ -1499,15 +1499,15 @@ function loaded() {
|
|||
elZoneHazeColorGreen.addEventListener('change', zoneHazeColorChangeFunction);
|
||||
elZoneHazeColorBlue.addEventListener('change', zoneHazeColorChangeFunction);
|
||||
|
||||
colorPickers.push($('#property-zone-haze-blend-out-color').colpick({
|
||||
colorPickers.push($('#property-zone-haze-glare-color').colpick({
|
||||
colorScheme: 'dark',
|
||||
layout: 'hex',
|
||||
color: '000000',
|
||||
onShow: function(colpick) {
|
||||
$('#property-zone-haze-blend-out-color').attr('active', 'true');
|
||||
$('#property-zone-haze-glare-color').attr('active', 'true');
|
||||
},
|
||||
onHide: function(colpick) {
|
||||
$('#property-zone-haze-blend-out-color').attr('active', 'false');
|
||||
$('#property-zone-haze-glare-color').attr('active', 'false');
|
||||
},
|
||||
onSubmit: function(hsb, hex, rgb, el) {
|
||||
$(el).css('background-color', '#' + hex);
|
||||
|
|
Loading…
Reference in a new issue