11 #ifndef hifi_RenderableZoneEntityItem_h
12 #define hifi_RenderableZoneEntityItem_h
14 #include <ZoneEntityItem.h>
15 #include <graphics/Skybox.h>
16 #include <graphics/Haze.h>
17 #include <graphics/Bloom.h>
18 #include <graphics/Stage.h>
19 #include <LightStage.h>
20 #include <BackgroundStage.h>
21 #include <HazeStage.h>
22 #include <BloomStage.h>
23 #include <TextureCache.h>
24 #include "RenderableEntityItem.h"
25 #include <ComponentMode.h>
27 namespace render {
namespace entities {
29 class ZoneEntityRenderer :
public TypedEntityRenderer<ZoneEntityItem> {
30 using Parent = TypedEntityRenderer<ZoneEntityItem>;
31 friend class EntityRenderer;
34 ZoneEntityRenderer(
const EntityItemPointer& entity);
37 virtual void onRemoveFromSceneTyped(
const TypedEntityPointer& entity)
override;
38 virtual ItemKey getKey()
override;
39 virtual void doRender(RenderArgs* args)
override;
40 virtual bool needsRenderUpdateFromTypedEntity(
const TypedEntityPointer& entity)
const override;
41 virtual void doRenderUpdateAsynchronousTyped(
const TypedEntityPointer& entity)
override;
44 void updateKeyZoneItemFromEntity(
const TypedEntityPointer& entity);
45 void updateKeySunFromEntity(
const TypedEntityPointer& entity);
46 void updateAmbientLightFromEntity(
const TypedEntityPointer& entity);
47 void updateHazeFromEntity(
const TypedEntityPointer& entity);
48 void updateKeyBackgroundFromEntity(
const TypedEntityPointer& entity);
49 void updateBloomFromEntity(
const TypedEntityPointer& entity);
50 void updateAmbientMap();
51 void updateSkyboxMap();
52 void setAmbientURL(
const QString& ambientUrl);
53 void setSkyboxURL(
const QString& skyboxUrl);
55 void setSkyboxColor(
const glm::vec3& color);
56 void setProceduralUserData(
const QString& userData);
58 graphics::LightPointer editSunLight() { _needSunUpdate =
true;
return _sunLight; }
59 graphics::LightPointer editAmbientLight() { _needAmbientUpdate =
true;
return _ambientLight; }
60 graphics::SunSkyStagePointer editBackground() { _needBackgroundUpdate =
true;
return _background; }
61 graphics::SkyboxPointer editSkybox() {
return editBackground()->getSkybox(); }
62 graphics::HazePointer editHaze() { _needHazeUpdate =
true;
return _haze; }
63 graphics::BloomPointer editBloom() { _needBloomUpdate =
true;
return _bloom; }
65 glm::vec3 _lastPosition;
66 glm::vec3 _lastDimensions;
67 glm::quat _lastRotation;
70 LightStagePointer _stage;
71 const graphics::LightPointer _sunLight { std::make_shared<graphics::Light>() };
72 const graphics::LightPointer _ambientLight { std::make_shared<graphics::Light>() };
73 const graphics::SunSkyStagePointer _background { std::make_shared<graphics::SunSkyStage>() };
74 const graphics::HazePointer _haze { std::make_shared<graphics::Haze>() };
75 const graphics::BloomPointer _bloom { std::make_shared<graphics::Bloom>() };
77 ComponentMode _keyLightMode { COMPONENT_MODE_INHERIT };
78 ComponentMode _ambientLightMode { COMPONENT_MODE_INHERIT };
79 ComponentMode _skyboxMode { COMPONENT_MODE_INHERIT };
80 ComponentMode _hazeMode { COMPONENT_MODE_INHERIT };
81 ComponentMode _bloomMode { COMPONENT_MODE_INHERIT };
83 indexed_container::Index _sunIndex { LightStage::INVALID_INDEX };
84 indexed_container::Index _ambientIndex { LightStage::INVALID_INDEX };
86 BackgroundStagePointer _backgroundStage;
87 BackgroundStage::Index _backgroundIndex { BackgroundStage::INVALID_INDEX };
89 HazeStagePointer _hazeStage;
90 HazeStage::Index _hazeIndex { HazeStage::INVALID_INDEX };
92 BloomStagePointer _bloomStage;
93 BloomStage::Index _bloomIndex { BloomStage::INVALID_INDEX };
95 bool _needUpdate{
true };
96 bool _needSunUpdate{
true };
97 bool _needAmbientUpdate{
true };
98 bool _needBackgroundUpdate{
true };
99 bool _needHazeUpdate{
true };
100 bool _needBloomUpdate {
true };
102 KeyLightPropertyGroup _keyLightProperties;
103 AmbientLightPropertyGroup _ambientLightProperties;
104 HazePropertyGroup _hazeProperties;
105 SkyboxPropertyGroup _skyboxProperties;
106 BloomPropertyGroup _bloomProperties;
109 QString _ambientTextureURL;
110 NetworkTexturePointer _ambientTexture;
111 bool _pendingAmbientTexture{
false };
113 QString _skyboxTextureURL;
114 NetworkTexturePointer _skyboxTexture;
115 bool _pendingSkyboxTexture{
false };
117 QString _proceduralUserData;