mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 07:17:43 +02:00
Merge pull request #11634 from highfidelity/hazeZone
Fogbugz 8477: Crash on loading older domains that have zones without the haze component.
This commit is contained in:
commit
7754061505
4 changed files with 25 additions and 9 deletions
|
@ -228,11 +228,21 @@ const std::array<ComponentPair, COMPONENT_MODE_ITEM_COUNT> COMPONENT_MODES = { {
|
||||||
} };
|
} };
|
||||||
|
|
||||||
QString EntityItemProperties::getHazeModeAsString() const {
|
QString EntityItemProperties::getHazeModeAsString() const {
|
||||||
|
// return "inherit" if _hazeMode is not valid
|
||||||
|
if (_hazeMode < COMPONENT_MODE_ITEM_COUNT) {
|
||||||
return COMPONENT_MODES[_hazeMode].second;
|
return COMPONENT_MODES[_hazeMode].second;
|
||||||
|
} else {
|
||||||
|
return COMPONENT_MODES[COMPONENT_MODE_INHERIT].second;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString EntityItemProperties::getHazeModeString(uint32_t mode) {
|
QString EntityItemProperties::getHazeModeString(uint32_t mode) {
|
||||||
|
// return "inherit" if mode is not valid
|
||||||
|
if (mode < COMPONENT_MODE_ITEM_COUNT) {
|
||||||
return COMPONENT_MODES[mode].second;
|
return COMPONENT_MODES[mode].second;
|
||||||
|
} else {
|
||||||
|
return COMPONENT_MODES[COMPONENT_MODE_INHERIT].second;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityItemProperties::setHazeModeFromString(const QString& hazeMode) {
|
void EntityItemProperties::setHazeModeFromString(const QString& hazeMode) {
|
||||||
|
|
|
@ -321,8 +321,10 @@ void ZoneEntityItem::resetRenderingPropertiesChanged() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZoneEntityItem::setHazeMode(const uint32_t value) {
|
void ZoneEntityItem::setHazeMode(const uint32_t value) {
|
||||||
|
if (value < COMPONENT_MODE_ITEM_COUNT) {
|
||||||
_hazeMode = value;
|
_hazeMode = value;
|
||||||
_hazePropertiesChanged = true;
|
_hazePropertiesChanged = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t ZoneEntityItem::getHazeMode() const {
|
uint32_t ZoneEntityItem::getHazeMode() const {
|
||||||
|
|
|
@ -138,6 +138,8 @@ public:
|
||||||
static const bool DEFAULT_GHOSTING_ALLOWED;
|
static const bool DEFAULT_GHOSTING_ALLOWED;
|
||||||
static const QString DEFAULT_FILTER_URL;
|
static const QString DEFAULT_FILTER_URL;
|
||||||
|
|
||||||
|
static const uint32_t DEFAULT_HAZE_MODE{ (uint32_t)COMPONENT_MODE_INHERIT };
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
KeyLightPropertyGroup _keyLightProperties;
|
KeyLightPropertyGroup _keyLightProperties;
|
||||||
|
|
||||||
|
@ -146,7 +148,7 @@ protected:
|
||||||
|
|
||||||
BackgroundMode _backgroundMode = BACKGROUND_MODE_INHERIT;
|
BackgroundMode _backgroundMode = BACKGROUND_MODE_INHERIT;
|
||||||
|
|
||||||
uint8_t _hazeMode{ (uint8_t)COMPONENT_MODE_INHERIT };
|
uint32_t _hazeMode{ DEFAULT_HAZE_MODE };
|
||||||
|
|
||||||
float _hazeRange{ HazePropertyGroup::DEFAULT_HAZE_RANGE };
|
float _hazeRange{ HazePropertyGroup::DEFAULT_HAZE_RANGE };
|
||||||
xColor _hazeColor{ HazePropertyGroup::DEFAULT_HAZE_COLOR };
|
xColor _hazeColor{ HazePropertyGroup::DEFAULT_HAZE_COLOR };
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include <glm/gtx/transform.hpp>
|
#include <glm/gtx/transform.hpp>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <qcompilerdetection.h>
|
#include <qcompilerdetection.h>
|
||||||
|
#include <ComponentMode.h>
|
||||||
|
|
||||||
using namespace model;
|
using namespace model;
|
||||||
|
|
||||||
|
@ -256,8 +257,9 @@ void SunSkyStage::setSkybox(const SkyboxPointer& skybox) {
|
||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Haze
|
void SunSkyStage::setHazeMode(uint32_t hazeMode) {
|
||||||
void SunSkyStage::setHazeMode(uint32_t mode) {
|
if (hazeMode < COMPONENT_MODE_ITEM_COUNT) {
|
||||||
_hazeMode = mode;
|
_hazeMode = hazeMode;
|
||||||
invalidate();
|
invalidate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue