First version with combo for Haze Mode.

This commit is contained in:
Nissim Hadar 2017-09-24 15:08:22 -07:00
parent 678b4e35b1
commit 6cbf087708
6 changed files with 32 additions and 16 deletions

View file

@ -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) {

View file

@ -202,13 +202,6 @@ const std::array<BackgroundPair, BACKGROUND_MODE_ITEM_COUNT> BACKGROUND_MODES =
BackgroundPair { BACKGROUND_MODE_SKYBOX, { "skybox" } }
} };
using HazePair = std::pair<const HazeMode, const QString>;
const std::array<HazePair, HAZE_MODE_ITEM_COUNT> 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 HazeMode, const QString>;
const std::array<HazePair, HAZE_MODE_ITEM_COUNT> 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<glm::vec3>);
@ -1788,6 +1793,7 @@ void EntityItemProperties::markAllChanged() {
_keyLight.markAllChanged();
_backgroundModeChanged = true;
_hazeModeChanged = true;
_animation.markAllChanged();
_skybox.markAllChanged();
@ -2097,6 +2103,9 @@ QList<QString> EntityItemProperties::listChangedProperties() {
if (backgroundModeChanged()) {
out += "backgroundMode";
}
if (hazeModeChanged()) {
out += "hazeMode";
}
if (voxelVolumeSizeChanged()) {
out += "voxelVolumeSize";
}

View file

@ -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();

View file

@ -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
};

View file

@ -547,9 +547,13 @@
<legend class="sub-section-header zone-group zone-section haze-section">
Haze
</legend>
<div class="zone-group zone-section haze-section property checkbox">
<input type="checkbox" id="property-zone-haze-haze-active">
<label for="property-zone-haze-haze-active">Haze Active</label>
<div class="zone-group zone-section haze-section property dropdown">
<label>Haze Mode</label>
<select name="SelectHazeMode" id="property-zone-haze-mode">
<option value="inherit">Inherit</option>
<option value="disabled">Disabled</option>
<option value="enabled">Enabled</option>
</select>
</div>
</fieldset>
<fieldset class="minor">

View file

@ -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);