Renamed HazeMode to ComponentMode.

This commit is contained in:
Nissim Hadar 2017-10-13 11:24:56 -07:00
parent b1174ce40c
commit 5bfbaf4860
6 changed files with 28 additions and 28 deletions

View file

@ -172,7 +172,7 @@ void ZoneEntityRenderer::doRender(RenderArgs* args) {
} }
// Haze only if the mode is not inherit // Haze only if the mode is not inherit
if (_hazeMode != HAZE_MODE_INHERIT) { if (_hazeMode != COMPONENT_MODE_INHERIT) {
_hazeStage->_currentFrame.pushHaze(_hazeIndex); _hazeStage->_currentFrame.pushHaze(_hazeIndex);
} }
} }
@ -332,12 +332,12 @@ void ZoneEntityRenderer::updateKeyAmbientFromEntity() {
} }
void ZoneEntityRenderer::updateHazeFromEntity(const TypedEntityPointer& entity) { void ZoneEntityRenderer::updateHazeFromEntity(const TypedEntityPointer& entity) {
setHazeMode((HazeMode)entity->getHazeMode()); setHazeMode((ComponentMode)entity->getHazeMode());
const auto& haze = editHaze(); const auto& haze = editHaze();
const uint32_t hazeMode = entity->getHazeMode(); const uint32_t hazeMode = entity->getHazeMode();
haze->setHazeActive(hazeMode == HAZE_MODE_ENABLED); haze->setHazeActive(hazeMode == COMPONENT_MODE_ENABLED);
haze->setAltitudeBased(_hazeProperties.getHazeAltitudeEffect()); haze->setAltitudeBased(_hazeProperties.getHazeAltitudeEffect());
haze->setHazeRangeFactor(model::convertHazeRangeToHazeRangeFactor(_hazeProperties.getHazeRange())); haze->setHazeRangeFactor(model::convertHazeRangeToHazeRangeFactor(_hazeProperties.getHazeRange()));
@ -471,7 +471,7 @@ void ZoneEntityRenderer::setBackgroundMode(BackgroundMode mode) {
_backgroundMode = mode; _backgroundMode = mode;
} }
void ZoneEntityRenderer::setHazeMode(HazeMode mode) { void ZoneEntityRenderer::setHazeMode(ComponentMode mode) {
_hazeMode = mode; _hazeMode = mode;
} }

View file

@ -21,7 +21,7 @@
#include <HazeStage.h> #include <HazeStage.h>
#include <TextureCache.h> #include <TextureCache.h>
#include "RenderableEntityItem.h" #include "RenderableEntityItem.h"
#include <HazeMode.h> #include <ComponentMode.h>
#if 0 #if 0
#include <Model.h> #include <Model.h>
@ -55,7 +55,7 @@ private:
void setAmbientURL(const QString& ambientUrl); void setAmbientURL(const QString& ambientUrl);
void setSkyboxURL(const QString& skyboxUrl); void setSkyboxURL(const QString& skyboxUrl);
void setBackgroundMode(BackgroundMode mode); void setBackgroundMode(BackgroundMode mode);
void setHazeMode(HazeMode mode); void setHazeMode(ComponentMode mode);
void setSkyboxColor(const glm::vec3& color); void setSkyboxColor(const glm::vec3& color);
void setProceduralUserData(const QString& userData); void setProceduralUserData(const QString& userData);
@ -85,7 +85,7 @@ private:
const model::HazePointer _haze{ std::make_shared<model::Haze>() }; const model::HazePointer _haze{ std::make_shared<model::Haze>() };
BackgroundMode _backgroundMode{ BACKGROUND_MODE_INHERIT }; BackgroundMode _backgroundMode{ BACKGROUND_MODE_INHERIT };
HazeMode _hazeMode{ HAZE_MODE_INHERIT }; ComponentMode _hazeMode{ COMPONENT_MODE_INHERIT };
indexed_container::Index _sunIndex{ LightStage::INVALID_INDEX }; indexed_container::Index _sunIndex{ LightStage::INVALID_INDEX };
indexed_container::Index _ambientIndex{ LightStage::INVALID_INDEX }; indexed_container::Index _ambientIndex{ LightStage::INVALID_INDEX };

View file

@ -220,27 +220,27 @@ void EntityItemProperties::setBackgroundModeFromString(const QString& background
} }
} }
using HazePair = std::pair<const HazeMode, const QString>; using ComponentPair = std::pair<const ComponentMode, const QString>;
const std::array<HazePair, HAZE_MODE_ITEM_COUNT> HAZE_MODES = { { const std::array<ComponentPair, COMPONENT_MODE_ITEM_COUNT> COMPONENT_MODES = { {
HazePair{ HAZE_MODE_INHERIT,{ "inherit" } }, ComponentPair{ COMPONENT_MODE_INHERIT,{ "inherit" } },
HazePair{ HAZE_MODE_DISABLED,{ "disabled" } }, ComponentPair{ COMPONENT_MODE_DISABLED,{ "disabled" } },
HazePair{ HAZE_MODE_ENABLED,{ "enabled" } } ComponentPair{ COMPONENT_MODE_ENABLED,{ "enabled" } }
} }; } };
QString EntityItemProperties::getHazeModeAsString() const { QString EntityItemProperties::getHazeModeAsString() const {
return HAZE_MODES[_hazeMode].second; return COMPONENT_MODES[_hazeMode].second;
} }
QString EntityItemProperties::getHazeModeString(uint32_t mode) { QString EntityItemProperties::getHazeModeString(uint32_t mode) {
return HAZE_MODES[mode].second; return COMPONENT_MODES[mode].second;
} }
void EntityItemProperties::setHazeModeFromString(const QString& hazeMode) { void EntityItemProperties::setHazeModeFromString(const QString& hazeMode) {
auto result = std::find_if(HAZE_MODES.begin(), HAZE_MODES.end(), [&](const HazePair& pair) { auto result = std::find_if(COMPONENT_MODES.begin(), COMPONENT_MODES.end(), [&](const ComponentPair& pair) {
return (pair.second == hazeMode); return (pair.second == hazeMode);
}); });
if (result != HAZE_MODES.end()) { if (result != COMPONENT_MODES.end()) {
_hazeMode = result->first; _hazeMode = result->first;
_hazeModeChanged = true; _hazeModeChanged = true;
} }

View file

@ -179,7 +179,7 @@ public:
DEFINE_PROPERTY_REF_ENUM(PROP_BACKGROUND_MODE, BackgroundMode, backgroundMode, BackgroundMode, BACKGROUND_MODE_INHERIT); DEFINE_PROPERTY_REF_ENUM(PROP_BACKGROUND_MODE, BackgroundMode, backgroundMode, BackgroundMode, BACKGROUND_MODE_INHERIT);
DEFINE_PROPERTY_GROUP(Stage, stage, StagePropertyGroup); DEFINE_PROPERTY_GROUP(Stage, stage, StagePropertyGroup);
DEFINE_PROPERTY_REF_ENUM(PROP_HAZE_MODE, HazeMode, hazeMode, uint32_t, (uint32_t)HAZE_MODE_INHERIT); DEFINE_PROPERTY_REF_ENUM(PROP_HAZE_MODE, HazeMode, hazeMode, uint32_t, (uint32_t)COMPONENT_MODE_INHERIT);
DEFINE_PROPERTY_GROUP(Skybox, skybox, SkyboxPropertyGroup); DEFINE_PROPERTY_GROUP(Skybox, skybox, SkyboxPropertyGroup);
DEFINE_PROPERTY_GROUP(Haze, haze, HazePropertyGroup); DEFINE_PROPERTY_GROUP(Haze, haze, HazePropertyGroup);

View file

@ -18,7 +18,7 @@
#include "SkyboxPropertyGroup.h" #include "SkyboxPropertyGroup.h"
#include "HazePropertyGroup.h" #include "HazePropertyGroup.h"
#include "StagePropertyGroup.h" #include "StagePropertyGroup.h"
#include <HazeMode.h> #include <ComponentMode.h>
class ZoneEntityItem : public EntityItem { class ZoneEntityItem : public EntityItem {
public: public:
@ -146,7 +146,7 @@ protected:
BackgroundMode _backgroundMode = BACKGROUND_MODE_INHERIT; BackgroundMode _backgroundMode = BACKGROUND_MODE_INHERIT;
uint8_t _hazeMode{ (uint8_t)HAZE_MODE_INHERIT }; uint8_t _hazeMode{ (uint8_t)COMPONENT_MODE_INHERIT };
float _hazeRange{ HazePropertyGroup::DEFAULT_HAZE_RANGE }; float _hazeRange{ HazePropertyGroup::DEFAULT_HAZE_RANGE };
xColor _hazeBlendInColor{ HazePropertyGroup::DEFAULT_HAZE_BLEND_IN_COLOR }; xColor _hazeBlendInColor{ HazePropertyGroup::DEFAULT_HAZE_BLEND_IN_COLOR };

View file

@ -1,5 +1,5 @@
// //
// HazeMode.h // ComponentMode.h
// libraries/entities/src // libraries/entities/src
// //
// Created by Nissim Hadar on 9/21/17. // Created by Nissim Hadar on 9/21/17.
@ -9,16 +9,16 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
// //
#ifndef hifi_HazeMode_h #ifndef hifi_ComponentMode_h
#define hifi_HazeMode_h #define hifi_ComponentMode_h
enum HazeMode { enum ComponentMode {
HAZE_MODE_INHERIT, COMPONENT_MODE_INHERIT,
HAZE_MODE_DISABLED, COMPONENT_MODE_DISABLED,
HAZE_MODE_ENABLED, COMPONENT_MODE_ENABLED,
HAZE_MODE_ITEM_COUNT COMPONENT_MODE_ITEM_COUNT
}; };
#endif // hifi_HazeMode_h #endif // hifi_ComponentMode_h