diff --git a/libraries/entities-renderer/src/RenderableZoneEntityItem.cpp b/libraries/entities-renderer/src/RenderableZoneEntityItem.cpp index 9f8567aa54..fb0141ae4a 100644 --- a/libraries/entities-renderer/src/RenderableZoneEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableZoneEntityItem.cpp @@ -308,7 +308,7 @@ void ZoneEntityRenderer::updateKeyAmbientFromEntity() { void ZoneEntityRenderer::updateHazeFromEntity(const TypedEntityPointer& entity) { const auto& haze = editHaze(); - haze->setIsHazeActive(entity->getHazeMode() == HAZE_MODE_ON); + haze->setIsHazeActive(entity->getHazeMode() == HAZE_MODE_ENABLED); } void ZoneEntityRenderer::updateKeyBackgroundFromEntity(const TypedEntityPointer& entity) { diff --git a/libraries/entities/src/EntityItemProperties.cpp b/libraries/entities/src/EntityItemProperties.cpp index a2f344b3aa..23ebbc81bc 100644 --- a/libraries/entities/src/EntityItemProperties.cpp +++ b/libraries/entities/src/EntityItemProperties.cpp @@ -202,13 +202,6 @@ const std::array BACKGROUND_MODES = BackgroundPair { BACKGROUND_MODE_SKYBOX, { "skybox" } } } }; -using HazePair = std::pair; -const std::array HAZE_MODES = { { - HazePair{ HAZE_MODE_INHERIT,{ "inherit" } }, - HazePair{ HAZE_MODE_OFF,{ "off" } }, - HazePair{ HAZE_MODE_ON,{ "on" } } - } }; - QString EntityItemProperties::getBackgroundModeAsString() const { return BACKGROUND_MODES[_backgroundMode].second; } @@ -227,6 +220,13 @@ void EntityItemProperties::setBackgroundModeFromString(const QString& background } } +using HazePair = std::pair; +const std::array HAZE_MODES = { { + HazePair{ HAZE_MODE_INHERIT,{ "inherit" } }, + HazePair{ HAZE_MODE_DISABLED,{ "disabled" } }, + HazePair{ HAZE_MODE_ENABLED,{ "enabled" } } +} }; + QString EntityItemProperties::getHazeModeAsString() const { return HAZE_MODES[_hazeMode].second; } @@ -317,6 +317,7 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const { CHECK_PROPERTY_CHANGE(PROP_MARKETPLACE_ID, marketplaceID); CHECK_PROPERTY_CHANGE(PROP_NAME, name); CHECK_PROPERTY_CHANGE(PROP_BACKGROUND_MODE, backgroundMode); + CHECK_PROPERTY_CHANGE(PROP_HAZE_MODE, hazeMode); CHECK_PROPERTY_CHANGE(PROP_SOURCE_URL, sourceUrl); CHECK_PROPERTY_CHANGE(PROP_VOXEL_VOLUME_SIZE, voxelVolumeSize); CHECK_PROPERTY_CHANGE(PROP_VOXEL_DATA, voxelData); @@ -525,6 +526,7 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool _keyLight.copyToScriptValue(_desiredProperties, properties, engine, skipDefaults, defaultEntityProperties); COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_BACKGROUND_MODE, backgroundMode, getBackgroundModeAsString()); + COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_HAZE_MODE, hazeMode, getHazeModeAsString()); _skybox.copyToScriptValue(_desiredProperties, properties, engine, skipDefaults, defaultEntityProperties); _haze.copyToScriptValue(_desiredProperties, properties, engine, skipDefaults, defaultEntityProperties); @@ -704,6 +706,7 @@ void EntityItemProperties::copyFromScriptValue(const QScriptValue& object, bool COPY_PROPERTY_FROM_QSCRIPTVALUE(collisionSoundURL, QString, setCollisionSoundURL); COPY_PROPERTY_FROM_QSCRITPTVALUE_ENUM(backgroundMode, BackgroundMode); + COPY_PROPERTY_FROM_QSCRITPTVALUE_ENUM(hazeMode, HazeMode); COPY_PROPERTY_FROM_QSCRIPTVALUE(sourceUrl, QString, setSourceUrl); COPY_PROPERTY_FROM_QSCRIPTVALUE(voxelVolumeSize, glmVec3, setVoxelVolumeSize); COPY_PROPERTY_FROM_QSCRIPTVALUE(voxelData, QByteArray, setVoxelData); @@ -843,6 +846,7 @@ void EntityItemProperties::merge(const EntityItemProperties& other) { COPY_PROPERTY_IF_CHANGED(collisionSoundURL); COPY_PROPERTY_IF_CHANGED(backgroundMode); + COPY_PROPERTY_IF_CHANGED(hazeMode); COPY_PROPERTY_IF_CHANGED(sourceUrl); COPY_PROPERTY_IF_CHANGED(voxelVolumeSize); COPY_PROPERTY_IF_CHANGED(voxelData); @@ -1021,6 +1025,7 @@ void EntityItemProperties::entityPropertyFlagsFromScriptValue(const QScriptValue ADD_PROPERTY_TO_MAP(PROP_VOXEL_SURFACE_STYLE, VoxelSurfaceStyle, voxelSurfaceStyle, uint16_t); ADD_PROPERTY_TO_MAP(PROP_NAME, Name, name, QString); ADD_PROPERTY_TO_MAP(PROP_BACKGROUND_MODE, BackgroundMode, backgroundMode, BackgroundMode); + ADD_PROPERTY_TO_MAP(PROP_HAZE_MODE, HazeMode, hazeMode, HazeMode); ADD_PROPERTY_TO_MAP(PROP_SOURCE_URL, SourceUrl, sourceUrl, QString); ADD_PROPERTY_TO_MAP(PROP_LINE_WIDTH, LineWidth, lineWidth, float); ADD_PROPERTY_TO_MAP(PROP_LINE_POINTS, LinePoints, linePoints, QVector); @@ -1788,6 +1793,7 @@ void EntityItemProperties::markAllChanged() { _keyLight.markAllChanged(); _backgroundModeChanged = true; + _hazeModeChanged = true; _animation.markAllChanged(); _skybox.markAllChanged(); @@ -2097,6 +2103,9 @@ QList EntityItemProperties::listChangedProperties() { if (backgroundModeChanged()) { out += "backgroundMode"; } + if (hazeModeChanged()) { + out += "hazeMode"; + } if (voxelVolumeSizeChanged()) { out += "voxelVolumeSize"; } diff --git a/libraries/entities/src/ZoneEntityItem.cpp b/libraries/entities/src/ZoneEntityItem.cpp index 364fa01e58..c6a2f573f2 100644 --- a/libraries/entities/src/ZoneEntityItem.cpp +++ b/libraries/entities/src/ZoneEntityItem.cpp @@ -244,6 +244,7 @@ void ZoneEntityItem::debugDump() const { qCDebug(entities) << " dimensions:" << debugTreeVector(getDimensions()); qCDebug(entities) << " getLastEdited:" << debugTime(getLastEdited(), now); qCDebug(entities) << " _backgroundMode:" << EntityItemProperties::getBackgroundModeString(_backgroundMode); + qCDebug(entities) << " _hazeMode:" << EntityItemProperties::getHazeModeString(_hazeMode); _keyLightProperties.debugDump(); _skyboxProperties.debugDump(); diff --git a/libraries/shared/src/HazeMode.h b/libraries/shared/src/HazeMode.h index 201a459098..18f67bdf31 100644 --- a/libraries/shared/src/HazeMode.h +++ b/libraries/shared/src/HazeMode.h @@ -13,9 +13,9 @@ #define hifi_HazeMode_h enum HazeMode { - HAZE_MODE_OFF, - HAZE_MODE_ON, HAZE_MODE_INHERIT, + HAZE_MODE_DISABLED, + HAZE_MODE_ENABLED, HAZE_MODE_ITEM_COUNT }; diff --git a/scripts/system/html/entityProperties.html b/scripts/system/html/entityProperties.html index 6e3c5eeca6..c16f214213 100644 --- a/scripts/system/html/entityProperties.html +++ b/scripts/system/html/entityProperties.html @@ -547,9 +547,13 @@ Haze -
- - +
diff --git a/scripts/system/html/js/entityProperties.js b/scripts/system/html/js/entityProperties.js index 439576abdf..caaf56f7bb 100644 --- a/scripts/system/html/js/entityProperties.js +++ b/scripts/system/html/js/entityProperties.js @@ -657,7 +657,7 @@ function loaded() { var elZoneKeyLightDirectionZ = document.getElementById("property-zone-key-light-direction-z"); var elZoneKeyLightAmbientURL = document.getElementById("property-zone-key-ambient-url"); - var elZoneHazeActive = document.getElementById("property-zone-haze-haze-active"); + var elZoneHazeMode = document.getElementById("property-zone-haze-mode"); var elZoneStageLatitude = document.getElementById("property-zone-stage-latitude"); var elZoneStageLongitude = document.getElementById("property-zone-stage-longitude"); @@ -977,7 +977,8 @@ function loaded() { elZoneKeyLightDirectionY.value = properties.keyLight.direction.y.toFixed(2); elZoneKeyLightAmbientURL.value = properties.keyLight.ambientURL; - elZoneHazeActive.checked = properties.haze.hazeActive; + elZoneHazeMode.value = properties.hazeMode; + setDropdownText(elZoneHazeMode); elZoneStageLatitude.value = properties.stage.latitude.toFixed(2); elZoneStageLongitude.value = properties.stage.longitude.toFixed(2); @@ -1373,7 +1374,7 @@ function loaded() { elZoneKeyLightDirectionX.addEventListener('change', zoneKeyLightDirectionChangeFunction); elZoneKeyLightDirectionY.addEventListener('change', zoneKeyLightDirectionChangeFunction); - elZoneHazeActive.addEventListener('change', createEmitGroupCheckedPropertyUpdateFunction('haze', 'hazeActive')); + elZoneHazeMode.addEventListener('change', createEmitTextPropertyUpdateFunction('hazeMode')); elZoneStageLatitude.addEventListener('change', createEmitGroupNumberPropertyUpdateFunction('stage', 'latitude')); elZoneStageLongitude.addEventListener('change', createEmitGroupNumberPropertyUpdateFunction('stage', 'longitude')); @@ -1384,6 +1385,7 @@ function loaded() { elZoneBackgroundMode.addEventListener('change', createEmitTextPropertyUpdateFunction('backgroundMode')); + var zoneSkyboxColorChangeFunction = createEmitGroupColorPropertyUpdateFunction('skybox', 'color', elZoneSkyboxColorRed, elZoneSkyboxColorGreen, elZoneSkyboxColorBlue); elZoneSkyboxColorRed.addEventListener('change', zoneSkyboxColorChangeFunction);