mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 15:49:24 +02:00
working on enabling bloom
This commit is contained in:
parent
079b276c2b
commit
2959a406d7
23 changed files with 917 additions and 221 deletions
|
@ -64,6 +64,13 @@ void ZoneEntityRenderer::onRemoveFromSceneTyped(const TypedEntityPointer& entity
|
||||||
_hazeIndex = INVALID_INDEX;
|
_hazeIndex = INVALID_INDEX;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_bloomStage) {
|
||||||
|
if (!BloomStage::isIndexInvalid(_bloomIndex)) {
|
||||||
|
_bloomStage->removeBloom(_bloomIndex);
|
||||||
|
_bloomIndex = INVALID_INDEX;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZoneEntityRenderer::doRender(RenderArgs* args) {
|
void ZoneEntityRenderer::doRender(RenderArgs* args) {
|
||||||
|
@ -112,6 +119,11 @@ void ZoneEntityRenderer::doRender(RenderArgs* args) {
|
||||||
assert(_hazeStage);
|
assert(_hazeStage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_bloomStage) {
|
||||||
|
_bloomStage = args->_scene->getStage<BloomStage>();
|
||||||
|
assert(_bloomStage);
|
||||||
|
}
|
||||||
|
|
||||||
{ // Sun
|
{ // Sun
|
||||||
// Need an update ?
|
// Need an update ?
|
||||||
if (_needSunUpdate) {
|
if (_needSunUpdate) {
|
||||||
|
@ -161,6 +173,15 @@ void ZoneEntityRenderer::doRender(RenderArgs* args) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
if (_needBloomUpdate) {
|
||||||
|
if (BloomStage::isIndexInvalid(_bloomIndex)) {
|
||||||
|
_bloomIndex = _bloomStage->addBloom(_bloom);
|
||||||
|
}
|
||||||
|
_needBloomUpdate = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (_visible) {
|
if (_visible) {
|
||||||
// Finally, push the lights visible in the frame
|
// Finally, push the lights visible in the frame
|
||||||
//
|
//
|
||||||
|
@ -190,6 +211,11 @@ void ZoneEntityRenderer::doRender(RenderArgs* args) {
|
||||||
if (_hazeMode != COMPONENT_MODE_INHERIT) {
|
if (_hazeMode != COMPONENT_MODE_INHERIT) {
|
||||||
_hazeStage->_currentFrame.pushHaze(_hazeIndex);
|
_hazeStage->_currentFrame.pushHaze(_hazeIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Bloom only if the mode is not inherit, as the model deals with on/off
|
||||||
|
if (_bloomMode != COMPONENT_MODE_INHERIT) {
|
||||||
|
_bloomStage->_currentFrame.pushBloom(_bloomIndex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,6 +237,7 @@ void ZoneEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& scen
|
||||||
bool ambientLightChanged = entity->ambientLightPropertiesChanged();
|
bool ambientLightChanged = entity->ambientLightPropertiesChanged();
|
||||||
bool skyboxChanged = entity->skyboxPropertiesChanged();
|
bool skyboxChanged = entity->skyboxPropertiesChanged();
|
||||||
bool hazeChanged = entity->hazePropertiesChanged();
|
bool hazeChanged = entity->hazePropertiesChanged();
|
||||||
|
bool bloomChanged = entity->bloomPropertiesChanged();
|
||||||
|
|
||||||
entity->resetRenderingPropertiesChanged();
|
entity->resetRenderingPropertiesChanged();
|
||||||
_lastPosition = entity->getWorldPosition();
|
_lastPosition = entity->getWorldPosition();
|
||||||
|
@ -221,6 +248,7 @@ void ZoneEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& scen
|
||||||
_ambientLightProperties = entity->getAmbientLightProperties();
|
_ambientLightProperties = entity->getAmbientLightProperties();
|
||||||
_skyboxProperties = entity->getSkyboxProperties();
|
_skyboxProperties = entity->getSkyboxProperties();
|
||||||
_hazeProperties = entity->getHazeProperties();
|
_hazeProperties = entity->getHazeProperties();
|
||||||
|
_bloomProperties = entity->getBloomProperties();
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if (_lastShapeURL != _typedEntity->getCompoundShapeURL()) {
|
if (_lastShapeURL != _typedEntity->getCompoundShapeURL()) {
|
||||||
|
@ -258,6 +286,10 @@ void ZoneEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& scen
|
||||||
if (hazeChanged) {
|
if (hazeChanged) {
|
||||||
updateHazeFromEntity(entity);
|
updateHazeFromEntity(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (bloomChanged) {
|
||||||
|
updateBloomFromEntity(entity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZoneEntityRenderer::doRenderUpdateAsynchronousTyped(const TypedEntityPointer& entity) {
|
void ZoneEntityRenderer::doRenderUpdateAsynchronousTyped(const TypedEntityPointer& entity) {
|
||||||
|
@ -276,6 +308,7 @@ bool ZoneEntityRenderer::needsRenderUpdateFromTypedEntity(const TypedEntityPoint
|
||||||
if (entity->keyLightPropertiesChanged() ||
|
if (entity->keyLightPropertiesChanged() ||
|
||||||
entity->ambientLightPropertiesChanged() ||
|
entity->ambientLightPropertiesChanged() ||
|
||||||
entity->hazePropertiesChanged() ||
|
entity->hazePropertiesChanged() ||
|
||||||
|
entity->bloomPropertiesChanged() ||
|
||||||
entity->skyboxPropertiesChanged()) {
|
entity->skyboxPropertiesChanged()) {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -388,6 +421,18 @@ void ZoneEntityRenderer::updateHazeFromEntity(const TypedEntityPointer& entity)
|
||||||
haze->setTransform(entity->getTransform().getMatrix());
|
haze->setTransform(entity->getTransform().getMatrix());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ZoneEntityRenderer::updateBloomFromEntity(const TypedEntityPointer& entity) {
|
||||||
|
setBloomMode((ComponentMode)entity->getBloomMode());
|
||||||
|
|
||||||
|
const auto& bloom = editBloom();
|
||||||
|
|
||||||
|
const uint32_t bloomMode = entity->getBloomMode();
|
||||||
|
bloom->setBloomActive(bloomMode == COMPONENT_MODE_ENABLED);
|
||||||
|
bloom->setBloomIntensity(_bloomProperties.getBloomIntensity());
|
||||||
|
bloom->setBloomThreshold(_bloomProperties.getBloomThreshold());
|
||||||
|
bloom->setBloomSize(_bloomProperties.getBloomSize());
|
||||||
|
}
|
||||||
|
|
||||||
void ZoneEntityRenderer::updateKeyBackgroundFromEntity(const TypedEntityPointer& entity) {
|
void ZoneEntityRenderer::updateKeyBackgroundFromEntity(const TypedEntityPointer& entity) {
|
||||||
setSkyboxMode((ComponentMode)entity->getSkyboxMode());
|
setSkyboxMode((ComponentMode)entity->getSkyboxMode());
|
||||||
|
|
||||||
|
@ -510,6 +555,10 @@ void ZoneEntityRenderer::setSkyboxMode(ComponentMode mode) {
|
||||||
_skyboxMode = mode;
|
_skyboxMode = mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ZoneEntityRenderer::setBloomMode(ComponentMode mode) {
|
||||||
|
_bloomMode = mode;
|
||||||
|
}
|
||||||
|
|
||||||
void ZoneEntityRenderer::setSkyboxColor(const glm::vec3& color) {
|
void ZoneEntityRenderer::setSkyboxColor(const glm::vec3& color) {
|
||||||
editSkybox()->setColor(color);
|
editSkybox()->setColor(color);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
//
|
//
|
||||||
// RenderableZoneEntityItem.h
|
// RenderableZoneEntityItem.h
|
||||||
//
|
//
|
||||||
//
|
|
||||||
// Created by Clement on 4/22/15.
|
// Created by Clement on 4/22/15.
|
||||||
// Copyright 2015 High Fidelity, Inc.
|
// Copyright 2015 High Fidelity, Inc.
|
||||||
//
|
//
|
||||||
|
@ -15,10 +14,12 @@
|
||||||
#include <ZoneEntityItem.h>
|
#include <ZoneEntityItem.h>
|
||||||
#include <graphics/Skybox.h>
|
#include <graphics/Skybox.h>
|
||||||
#include <graphics/Haze.h>
|
#include <graphics/Haze.h>
|
||||||
|
#include <graphics/Bloom.h>
|
||||||
#include <graphics/Stage.h>
|
#include <graphics/Stage.h>
|
||||||
#include <LightStage.h>
|
#include <LightStage.h>
|
||||||
#include <BackgroundStage.h>
|
#include <BackgroundStage.h>
|
||||||
#include <HazeStage.h>
|
#include <HazeStage.h>
|
||||||
|
#include <BloomStage.h>
|
||||||
#include <TextureCache.h>
|
#include <TextureCache.h>
|
||||||
#include "RenderableEntityItem.h"
|
#include "RenderableEntityItem.h"
|
||||||
#include <ComponentMode.h>
|
#include <ComponentMode.h>
|
||||||
|
@ -50,6 +51,7 @@ private:
|
||||||
void updateAmbientLightFromEntity(const TypedEntityPointer& entity);
|
void updateAmbientLightFromEntity(const TypedEntityPointer& entity);
|
||||||
void updateHazeFromEntity(const TypedEntityPointer& entity);
|
void updateHazeFromEntity(const TypedEntityPointer& entity);
|
||||||
void updateKeyBackgroundFromEntity(const TypedEntityPointer& entity);
|
void updateKeyBackgroundFromEntity(const TypedEntityPointer& entity);
|
||||||
|
void updateBloomFromEntity(const TypedEntityPointer& entity);
|
||||||
void updateAmbientMap();
|
void updateAmbientMap();
|
||||||
void updateSkyboxMap();
|
void updateSkyboxMap();
|
||||||
void setAmbientURL(const QString& ambientUrl);
|
void setAmbientURL(const QString& ambientUrl);
|
||||||
|
@ -59,6 +61,7 @@ private:
|
||||||
void setKeyLightMode(ComponentMode mode);
|
void setKeyLightMode(ComponentMode mode);
|
||||||
void setAmbientLightMode(ComponentMode mode);
|
void setAmbientLightMode(ComponentMode mode);
|
||||||
void setSkyboxMode(ComponentMode mode);
|
void setSkyboxMode(ComponentMode mode);
|
||||||
|
void setBloomMode(ComponentMode mode);
|
||||||
|
|
||||||
void setSkyboxColor(const glm::vec3& color);
|
void setSkyboxColor(const glm::vec3& color);
|
||||||
void setProceduralUserData(const QString& userData);
|
void setProceduralUserData(const QString& userData);
|
||||||
|
@ -68,6 +71,7 @@ private:
|
||||||
graphics::SunSkyStagePointer editBackground() { _needBackgroundUpdate = true; return _background; }
|
graphics::SunSkyStagePointer editBackground() { _needBackgroundUpdate = true; return _background; }
|
||||||
graphics::SkyboxPointer editSkybox() { return editBackground()->getSkybox(); }
|
graphics::SkyboxPointer editSkybox() { return editBackground()->getSkybox(); }
|
||||||
graphics::HazePointer editHaze() { _needHazeUpdate = true; return _haze; }
|
graphics::HazePointer editHaze() { _needHazeUpdate = true; return _haze; }
|
||||||
|
graphics::BloomPointer editBloom() { _needBloomUpdate = true; return _bloom; }
|
||||||
|
|
||||||
glm::vec3 _lastPosition;
|
glm::vec3 _lastPosition;
|
||||||
glm::vec3 _lastDimensions;
|
glm::vec3 _lastDimensions;
|
||||||
|
@ -82,36 +86,43 @@ private:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
LightStagePointer _stage;
|
LightStagePointer _stage;
|
||||||
const graphics::LightPointer _sunLight{ std::make_shared<graphics::Light>() };
|
const graphics::LightPointer _sunLight { std::make_shared<graphics::Light>() };
|
||||||
const graphics::LightPointer _ambientLight{ std::make_shared<graphics::Light>() };
|
const graphics::LightPointer _ambientLight { std::make_shared<graphics::Light>() };
|
||||||
const graphics::SunSkyStagePointer _background{ std::make_shared<graphics::SunSkyStage>() };
|
const graphics::SunSkyStagePointer _background { std::make_shared<graphics::SunSkyStage>() };
|
||||||
const graphics::HazePointer _haze{ std::make_shared<graphics::Haze>() };
|
const graphics::HazePointer _haze { std::make_shared<graphics::Haze>() };
|
||||||
|
const graphics::BloomPointer _bloom { std::make_shared<graphics::Bloom>() };
|
||||||
|
|
||||||
ComponentMode _keyLightMode { COMPONENT_MODE_INHERIT };
|
ComponentMode _keyLightMode { COMPONENT_MODE_INHERIT };
|
||||||
ComponentMode _ambientLightMode { COMPONENT_MODE_INHERIT };
|
ComponentMode _ambientLightMode { COMPONENT_MODE_INHERIT };
|
||||||
ComponentMode _skyboxMode { COMPONENT_MODE_INHERIT };
|
ComponentMode _skyboxMode { COMPONENT_MODE_INHERIT };
|
||||||
ComponentMode _hazeMode { COMPONENT_MODE_INHERIT };
|
ComponentMode _hazeMode { COMPONENT_MODE_INHERIT };
|
||||||
|
ComponentMode _bloomMode { COMPONENT_MODE_INHERIT };
|
||||||
|
|
||||||
indexed_container::Index _sunIndex{ LightStage::INVALID_INDEX };
|
indexed_container::Index _sunIndex { LightStage::INVALID_INDEX };
|
||||||
indexed_container::Index _shadowIndex{ LightStage::INVALID_INDEX };
|
indexed_container::Index _shadowIndex { LightStage::INVALID_INDEX };
|
||||||
indexed_container::Index _ambientIndex{ LightStage::INVALID_INDEX };
|
indexed_container::Index _ambientIndex { LightStage::INVALID_INDEX };
|
||||||
|
|
||||||
BackgroundStagePointer _backgroundStage;
|
BackgroundStagePointer _backgroundStage;
|
||||||
BackgroundStage::Index _backgroundIndex{ BackgroundStage::INVALID_INDEX };
|
BackgroundStage::Index _backgroundIndex { BackgroundStage::INVALID_INDEX };
|
||||||
|
|
||||||
HazeStagePointer _hazeStage;
|
HazeStagePointer _hazeStage;
|
||||||
HazeStage::Index _hazeIndex{ HazeStage::INVALID_INDEX };
|
HazeStage::Index _hazeIndex { HazeStage::INVALID_INDEX };
|
||||||
|
|
||||||
|
BloomStagePointer _bloomStage;
|
||||||
|
BloomStage::Index _bloomIndex { BloomStage::INVALID_INDEX };
|
||||||
|
|
||||||
bool _needUpdate{ true };
|
bool _needUpdate{ true };
|
||||||
bool _needSunUpdate{ true };
|
bool _needSunUpdate{ true };
|
||||||
bool _needAmbientUpdate{ true };
|
bool _needAmbientUpdate{ true };
|
||||||
bool _needBackgroundUpdate{ true };
|
bool _needBackgroundUpdate{ true };
|
||||||
bool _needHazeUpdate{ true };
|
bool _needHazeUpdate{ true };
|
||||||
|
bool _needBloomUpdate { true };
|
||||||
|
|
||||||
KeyLightPropertyGroup _keyLightProperties;
|
KeyLightPropertyGroup _keyLightProperties;
|
||||||
AmbientLightPropertyGroup _ambientLightProperties;
|
AmbientLightPropertyGroup _ambientLightProperties;
|
||||||
HazePropertyGroup _hazeProperties;
|
HazePropertyGroup _hazeProperties;
|
||||||
SkyboxPropertyGroup _skyboxProperties;
|
SkyboxPropertyGroup _skyboxProperties;
|
||||||
|
BloomPropertyGroup _bloomProperties;
|
||||||
|
|
||||||
// More attributes used for rendering:
|
// More attributes used for rendering:
|
||||||
QString _ambientTextureURL;
|
QString _ambientTextureURL;
|
||||||
|
|
159
libraries/entities/src/BloomPropertyGroup.cpp
Normal file
159
libraries/entities/src/BloomPropertyGroup.cpp
Normal file
|
@ -0,0 +1,159 @@
|
||||||
|
//
|
||||||
|
// BloomPropertyGroup.cpp
|
||||||
|
// libraries/entities/src
|
||||||
|
//
|
||||||
|
// Created by Sam Gondelman on 8/7/2018
|
||||||
|
// Copyright 2018 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "BloomPropertyGroup.h"
|
||||||
|
|
||||||
|
#include <OctreePacketData.h>
|
||||||
|
|
||||||
|
#include "EntityItemProperties.h"
|
||||||
|
#include "EntityItemPropertiesMacros.h"
|
||||||
|
|
||||||
|
void BloomPropertyGroup::copyToScriptValue(const EntityPropertyFlags& desiredProperties, QScriptValue& properties, QScriptEngine* engine, bool skipDefaults, EntityItemProperties& defaultEntityProperties) const {
|
||||||
|
COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_BLOOM_INTENSITY, Bloom, bloom, BloomIntensity, bloomIntensity);
|
||||||
|
COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_BLOOM_THRESHOLD, Bloom, bloom, BloomThreshold, bloomThreshold);
|
||||||
|
COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_BLOOM_SIZE, Bloom, bloom, BloomSize, bloomSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BloomPropertyGroup::copyFromScriptValue(const QScriptValue& object, bool& _defaultSettings) {
|
||||||
|
COPY_GROUP_PROPERTY_FROM_QSCRIPTVALUE(bloom, bloomIntensity, float, setBloomIntensity);
|
||||||
|
COPY_GROUP_PROPERTY_FROM_QSCRIPTVALUE(bloom, bloomThreshold, float, setBloomThreshold);
|
||||||
|
COPY_GROUP_PROPERTY_FROM_QSCRIPTVALUE(bloom, bloomSize, float, setBloomSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BloomPropertyGroup::merge(const BloomPropertyGroup& other) {
|
||||||
|
COPY_PROPERTY_IF_CHANGED(bloomIntensity);
|
||||||
|
COPY_PROPERTY_IF_CHANGED(bloomThreshold);
|
||||||
|
COPY_PROPERTY_IF_CHANGED(bloomSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BloomPropertyGroup::debugDump() const {
|
||||||
|
qCDebug(entities) << " BloomPropertyGroup: ---------------------------------------------";
|
||||||
|
qCDebug(entities) << " _bloomIntensity:" << _bloomIntensity;
|
||||||
|
qCDebug(entities) << " _bloomThreshold:" << _bloomThreshold;
|
||||||
|
qCDebug(entities) << " _bloomSize:" << _bloomSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BloomPropertyGroup::listChangedProperties(QList<QString>& out) {
|
||||||
|
if (bloomIntensityChanged()) {
|
||||||
|
out << "bloom-bloomIntensity";
|
||||||
|
}
|
||||||
|
if (bloomThresholdChanged()) {
|
||||||
|
out << "bloom-bloomThreshold";
|
||||||
|
}
|
||||||
|
if (bloomSizeChanged()) {
|
||||||
|
out << "bloom-bloomSize";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool BloomPropertyGroup::appendToEditPacket(OctreePacketData* packetData,
|
||||||
|
EntityPropertyFlags& requestedProperties,
|
||||||
|
EntityPropertyFlags& propertyFlags,
|
||||||
|
EntityPropertyFlags& propertiesDidntFit,
|
||||||
|
int& propertyCount,
|
||||||
|
OctreeElement::AppendState& appendState) const {
|
||||||
|
bool successPropertyFits = true;
|
||||||
|
|
||||||
|
APPEND_ENTITY_PROPERTY(PROP_BLOOM_INTENSITY, getBloomIntensity());
|
||||||
|
APPEND_ENTITY_PROPERTY(PROP_BLOOM_THRESHOLD, getBloomThreshold());
|
||||||
|
APPEND_ENTITY_PROPERTY(PROP_BLOOM_SIZE, getBloomSize());
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool BloomPropertyGroup::decodeFromEditPacket(EntityPropertyFlags& propertyFlags, const unsigned char*& dataAt , int& processedBytes) {
|
||||||
|
int bytesRead = 0;
|
||||||
|
bool overwriteLocalData = true;
|
||||||
|
bool somethingChanged = false;
|
||||||
|
|
||||||
|
READ_ENTITY_PROPERTY(PROP_BLOOM_INTENSITY, float, setBloomIntensity);
|
||||||
|
READ_ENTITY_PROPERTY(PROP_BLOOM_THRESHOLD, float, setBloomThreshold);
|
||||||
|
READ_ENTITY_PROPERTY(PROP_BLOOM_SIZE, float, setBloomSize);
|
||||||
|
|
||||||
|
DECODE_GROUP_PROPERTY_HAS_CHANGED(PROP_BLOOM_INTENSITY, BloomIntensity);
|
||||||
|
DECODE_GROUP_PROPERTY_HAS_CHANGED(PROP_BLOOM_THRESHOLD, BloomThreshold);
|
||||||
|
DECODE_GROUP_PROPERTY_HAS_CHANGED(PROP_BLOOM_SIZE, BloomSize);
|
||||||
|
|
||||||
|
processedBytes += bytesRead;
|
||||||
|
|
||||||
|
Q_UNUSED(somethingChanged);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BloomPropertyGroup::markAllChanged() {
|
||||||
|
_bloomIntensityChanged = true;
|
||||||
|
_bloomThresholdChanged = true;
|
||||||
|
_bloomSizeChanged = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
EntityPropertyFlags BloomPropertyGroup::getChangedProperties() const {
|
||||||
|
EntityPropertyFlags changedProperties;
|
||||||
|
|
||||||
|
CHECK_PROPERTY_CHANGE(PROP_BLOOM_INTENSITY, bloomIntensity);
|
||||||
|
CHECK_PROPERTY_CHANGE(PROP_BLOOM_THRESHOLD, bloomThreshold);
|
||||||
|
CHECK_PROPERTY_CHANGE(PROP_BLOOM_SIZE, bloomSize);
|
||||||
|
|
||||||
|
return changedProperties;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BloomPropertyGroup::getProperties(EntityItemProperties& properties) const {
|
||||||
|
COPY_ENTITY_GROUP_PROPERTY_TO_PROPERTIES(Bloom, BloomIntensity, getBloomIntensity);
|
||||||
|
COPY_ENTITY_GROUP_PROPERTY_TO_PROPERTIES(Bloom, BloomThreshold, getBloomThreshold);
|
||||||
|
COPY_ENTITY_GROUP_PROPERTY_TO_PROPERTIES(Bloom, BloomSize, getBloomSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool BloomPropertyGroup::setProperties(const EntityItemProperties& properties) {
|
||||||
|
bool somethingChanged = false;
|
||||||
|
|
||||||
|
SET_ENTITY_GROUP_PROPERTY_FROM_PROPERTIES(Bloom, BloomIntensity, bloomIntensity, setBloomIntensity);
|
||||||
|
SET_ENTITY_GROUP_PROPERTY_FROM_PROPERTIES(Bloom, BloomThreshold, bloomThreshold, setBloomThreshold);
|
||||||
|
SET_ENTITY_GROUP_PROPERTY_FROM_PROPERTIES(Bloom, BloomSize, bloomSize, setBloomSize);
|
||||||
|
|
||||||
|
return somethingChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
EntityPropertyFlags BloomPropertyGroup::getEntityProperties(EncodeBitstreamParams& params) const {
|
||||||
|
EntityPropertyFlags requestedProperties;
|
||||||
|
|
||||||
|
requestedProperties += PROP_BLOOM_INTENSITY;
|
||||||
|
requestedProperties += PROP_BLOOM_THRESHOLD;
|
||||||
|
requestedProperties += PROP_BLOOM_SIZE;
|
||||||
|
|
||||||
|
return requestedProperties;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BloomPropertyGroup::appendSubclassData(OctreePacketData* packetData, EncodeBitstreamParams& params,
|
||||||
|
EntityTreeElementExtraEncodeDataPointer entityTreeElementExtraEncodeData,
|
||||||
|
EntityPropertyFlags& requestedProperties,
|
||||||
|
EntityPropertyFlags& propertyFlags,
|
||||||
|
EntityPropertyFlags& propertiesDidntFit,
|
||||||
|
int& propertyCount,
|
||||||
|
OctreeElement::AppendState& appendState) const {
|
||||||
|
bool successPropertyFits = true;
|
||||||
|
|
||||||
|
APPEND_ENTITY_PROPERTY(PROP_BLOOM_INTENSITY, getBloomIntensity());
|
||||||
|
APPEND_ENTITY_PROPERTY(PROP_BLOOM_THRESHOLD, getBloomThreshold());
|
||||||
|
APPEND_ENTITY_PROPERTY(PROP_BLOOM_SIZE, getBloomSize());
|
||||||
|
}
|
||||||
|
|
||||||
|
int BloomPropertyGroup::readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
|
||||||
|
ReadBitstreamToTreeParams& args,
|
||||||
|
EntityPropertyFlags& propertyFlags, bool overwriteLocalData,
|
||||||
|
bool& somethingChanged) {
|
||||||
|
int bytesRead = 0;
|
||||||
|
const unsigned char* dataAt = data;
|
||||||
|
|
||||||
|
READ_ENTITY_PROPERTY(PROP_BLOOM_INTENSITY, float, setBloomIntensity);
|
||||||
|
READ_ENTITY_PROPERTY(PROP_BLOOM_THRESHOLD, float, setBloomThreshold);
|
||||||
|
READ_ENTITY_PROPERTY(PROP_BLOOM_SIZE, float, setBloomSize);
|
||||||
|
|
||||||
|
return bytesRead;
|
||||||
|
}
|
94
libraries/entities/src/BloomPropertyGroup.h
Normal file
94
libraries/entities/src/BloomPropertyGroup.h
Normal file
|
@ -0,0 +1,94 @@
|
||||||
|
//
|
||||||
|
// BloomPropertyGroup.h
|
||||||
|
// libraries/entities/src
|
||||||
|
//
|
||||||
|
// Created by Sam Gondelman on 8/7/2018
|
||||||
|
// Copyright 2018 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef hifi_BloomPropertyGroup_h
|
||||||
|
#define hifi_BloomPropertyGroup_h
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <glm/glm.hpp>
|
||||||
|
|
||||||
|
#include <QtScript/QScriptEngine>
|
||||||
|
|
||||||
|
#include "PropertyGroup.h"
|
||||||
|
#include "EntityItemPropertiesMacros.h"
|
||||||
|
|
||||||
|
class EntityItemProperties;
|
||||||
|
class EncodeBitstreamParams;
|
||||||
|
class OctreePacketData;
|
||||||
|
class EntityTreeElementExtraEncodeData;
|
||||||
|
class ReadBitstreamToTreeParams;
|
||||||
|
|
||||||
|
static const float INITIAL_BLOOM_INTENSITY { 0.25f };
|
||||||
|
static const float INITIAL_BLOOM_THRESHOLD { 0.7f };
|
||||||
|
static const float INITIAL_BLOOM_SIZE { 0.9f };
|
||||||
|
|
||||||
|
/**jsdoc
|
||||||
|
* Bloom is defined by the following properties.
|
||||||
|
* @typedef {object} Entities.Bloom
|
||||||
|
*
|
||||||
|
* @property {number} bloomIntensity=0.25 - The intensity of the bloom effect.
|
||||||
|
* @property {number} bloomThreshold=0.7 - The threshold for the bloom effect.
|
||||||
|
* @property {number} bloomSize=0.9 - The size of the bloom effect.
|
||||||
|
*/
|
||||||
|
class BloomPropertyGroup : public PropertyGroup {
|
||||||
|
public:
|
||||||
|
// EntityItemProperty related helpers
|
||||||
|
virtual void copyToScriptValue(const EntityPropertyFlags& desiredProperties, QScriptValue& properties,
|
||||||
|
QScriptEngine* engine, bool skipDefaults,
|
||||||
|
EntityItemProperties& defaultEntityProperties) const override;
|
||||||
|
virtual void copyFromScriptValue(const QScriptValue& object, bool& _defaultSettings) override;
|
||||||
|
|
||||||
|
void merge(const BloomPropertyGroup& other);
|
||||||
|
|
||||||
|
virtual void debugDump() const override;
|
||||||
|
virtual void listChangedProperties(QList<QString>& out) override;
|
||||||
|
|
||||||
|
virtual bool appendToEditPacket(OctreePacketData* packetData,
|
||||||
|
EntityPropertyFlags& requestedProperties,
|
||||||
|
EntityPropertyFlags& propertyFlags,
|
||||||
|
EntityPropertyFlags& propertiesDidntFit,
|
||||||
|
int& propertyCount,
|
||||||
|
OctreeElement::AppendState& appendState) const override;
|
||||||
|
|
||||||
|
virtual bool decodeFromEditPacket(EntityPropertyFlags& propertyFlags,
|
||||||
|
const unsigned char*& dataAt, int& processedBytes) override;
|
||||||
|
virtual void markAllChanged() override;
|
||||||
|
virtual EntityPropertyFlags getChangedProperties() const override;
|
||||||
|
|
||||||
|
// EntityItem related helpers
|
||||||
|
// methods for getting/setting all properties of an entity
|
||||||
|
virtual void getProperties(EntityItemProperties& propertiesOut) const override;
|
||||||
|
|
||||||
|
/// returns true if something changed
|
||||||
|
virtual bool setProperties(const EntityItemProperties& properties) override;
|
||||||
|
|
||||||
|
virtual EntityPropertyFlags getEntityProperties(EncodeBitstreamParams& params) const override;
|
||||||
|
|
||||||
|
virtual void appendSubclassData(OctreePacketData* packetData, EncodeBitstreamParams& params,
|
||||||
|
EntityTreeElementExtraEncodeDataPointer entityTreeElementExtraEncodeData,
|
||||||
|
EntityPropertyFlags& requestedProperties,
|
||||||
|
EntityPropertyFlags& propertyFlags,
|
||||||
|
EntityPropertyFlags& propertiesDidntFit,
|
||||||
|
int& propertyCount,
|
||||||
|
OctreeElement::AppendState& appendState) const override;
|
||||||
|
|
||||||
|
virtual int readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
|
||||||
|
ReadBitstreamToTreeParams& args,
|
||||||
|
EntityPropertyFlags& propertyFlags, bool overwriteLocalData,
|
||||||
|
bool& somethingChanged) override;
|
||||||
|
|
||||||
|
DEFINE_PROPERTY(PROP_BLOOM_INTENSITY, BloomIntensity, bloomIntensity, float, INITIAL_BLOOM_INTENSITY);
|
||||||
|
DEFINE_PROPERTY(PROP_BLOOM_THRESHOLD, BloomThreshold, bloomThreshold, float, INITIAL_BLOOM_THRESHOLD);
|
||||||
|
DEFINE_PROPERTY(PROP_BLOOM_SIZE, BloomSize, bloomSize, float, INITIAL_BLOOM_SIZE);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // hifi_BloomPropertyGroup_h
|
|
@ -37,6 +37,7 @@
|
||||||
AnimationPropertyGroup EntityItemProperties::_staticAnimation;
|
AnimationPropertyGroup EntityItemProperties::_staticAnimation;
|
||||||
SkyboxPropertyGroup EntityItemProperties::_staticSkybox;
|
SkyboxPropertyGroup EntityItemProperties::_staticSkybox;
|
||||||
HazePropertyGroup EntityItemProperties::_staticHaze;
|
HazePropertyGroup EntityItemProperties::_staticHaze;
|
||||||
|
BloomPropertyGroup EntityItemProperties::_staticBloom;
|
||||||
KeyLightPropertyGroup EntityItemProperties::_staticKeyLight;
|
KeyLightPropertyGroup EntityItemProperties::_staticKeyLight;
|
||||||
AmbientLightPropertyGroup EntityItemProperties::_staticAmbientLight;
|
AmbientLightPropertyGroup EntityItemProperties::_staticAmbientLight;
|
||||||
|
|
||||||
|
@ -84,6 +85,7 @@ void EntityItemProperties::debugDump() const {
|
||||||
getHaze().debugDump();
|
getHaze().debugDump();
|
||||||
getKeyLight().debugDump();
|
getKeyLight().debugDump();
|
||||||
getAmbientLight().debugDump();
|
getAmbientLight().debugDump();
|
||||||
|
getBloom().debugDump();
|
||||||
|
|
||||||
qCDebug(entities) << " changed properties...";
|
qCDebug(entities) << " changed properties...";
|
||||||
EntityPropertyFlags props = getChangedProperties();
|
EntityPropertyFlags props = getChangedProperties();
|
||||||
|
@ -211,6 +213,10 @@ QString EntityItemProperties::getHazeModeAsString() const {
|
||||||
return getComponentModeAsString(_hazeMode);
|
return getComponentModeAsString(_hazeMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString EntityItemProperties::getBloomModeAsString() const {
|
||||||
|
return getComponentModeAsString(_bloomMode);
|
||||||
|
}
|
||||||
|
|
||||||
QString EntityItemProperties::getComponentModeString(uint32_t mode) {
|
QString EntityItemProperties::getComponentModeString(uint32_t mode) {
|
||||||
// return "inherit" if mode is not valid
|
// return "inherit" if mode is not valid
|
||||||
if (mode < COMPONENT_MODE_ITEM_COUNT) {
|
if (mode < COMPONENT_MODE_ITEM_COUNT) {
|
||||||
|
@ -235,6 +241,15 @@ void EntityItemProperties::setHazeModeFromString(const QString& hazeMode) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EntityItemProperties::setBloomModeFromString(const QString& bloomMode) {
|
||||||
|
auto result = findComponent(bloomMode);
|
||||||
|
|
||||||
|
if (result != COMPONENT_MODES.end()) {
|
||||||
|
_bloomMode = result->first;
|
||||||
|
_bloomModeChanged = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QString EntityItemProperties::getKeyLightModeAsString() const {
|
QString EntityItemProperties::getKeyLightModeAsString() const {
|
||||||
return getComponentModeAsString(_keyLightMode);
|
return getComponentModeAsString(_keyLightMode);
|
||||||
}
|
}
|
||||||
|
@ -394,6 +409,7 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const {
|
||||||
CHECK_PROPERTY_CHANGE(PROP_KEY_LIGHT_MODE, keyLightMode);
|
CHECK_PROPERTY_CHANGE(PROP_KEY_LIGHT_MODE, keyLightMode);
|
||||||
CHECK_PROPERTY_CHANGE(PROP_AMBIENT_LIGHT_MODE, ambientLightMode);
|
CHECK_PROPERTY_CHANGE(PROP_AMBIENT_LIGHT_MODE, ambientLightMode);
|
||||||
CHECK_PROPERTY_CHANGE(PROP_SKYBOX_MODE, skyboxMode);
|
CHECK_PROPERTY_CHANGE(PROP_SKYBOX_MODE, skyboxMode);
|
||||||
|
CHECK_PROPERTY_CHANGE(PROP_BLOOM_MODE, bloomMode);
|
||||||
|
|
||||||
CHECK_PROPERTY_CHANGE(PROP_SOURCE_URL, sourceUrl);
|
CHECK_PROPERTY_CHANGE(PROP_SOURCE_URL, sourceUrl);
|
||||||
CHECK_PROPERTY_CHANGE(PROP_VOXEL_VOLUME_SIZE, voxelVolumeSize);
|
CHECK_PROPERTY_CHANGE(PROP_VOXEL_VOLUME_SIZE, voxelVolumeSize);
|
||||||
|
@ -454,6 +470,7 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const {
|
||||||
changedProperties += _ambientLight.getChangedProperties();
|
changedProperties += _ambientLight.getChangedProperties();
|
||||||
changedProperties += _skybox.getChangedProperties();
|
changedProperties += _skybox.getChangedProperties();
|
||||||
changedProperties += _haze.getChangedProperties();
|
changedProperties += _haze.getChangedProperties();
|
||||||
|
changedProperties += _bloom.getChangedProperties();
|
||||||
|
|
||||||
return changedProperties;
|
return changedProperties;
|
||||||
}
|
}
|
||||||
|
@ -1164,6 +1181,12 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const {
|
||||||
* <code>"enabled"</code>: The haze properties of this zone are enabled, overriding the haze from any enclosing zone.
|
* <code>"enabled"</code>: The haze properties of this zone are enabled, overriding the haze from any enclosing zone.
|
||||||
* @property {Entities.Haze} haze - The haze properties of the zone.
|
* @property {Entities.Haze} haze - The haze properties of the zone.
|
||||||
*
|
*
|
||||||
|
* @property {string} bloomMode="inherit" - Configures the bloom in the zone. Possible values:<br />
|
||||||
|
* <code>"inherit"</code>: The bloom from any enclosing zone continues into this zone.<br />
|
||||||
|
* <code>"disabled"</code>: The bloom from any enclosing zone and the bloom of this zone are disabled in this zone.<br />
|
||||||
|
* <code>"enabled"</code>: The bloom properties of this zone are enabled, overriding the bloom from any enclosing zone.
|
||||||
|
* @property {Entities.Bloom} bloom - The bloom properties of the zone.
|
||||||
|
*
|
||||||
* @property {boolean} flyingAllowed=true - If <code>true</code> then visitors can fly in the zone; otherwise they cannot.
|
* @property {boolean} flyingAllowed=true - If <code>true</code> then visitors can fly in the zone; otherwise they cannot.
|
||||||
* @property {boolean} ghostingAllowed=true - If <code>true</code> then visitors with avatar collisions turned off will not
|
* @property {boolean} ghostingAllowed=true - If <code>true</code> then visitors with avatar collisions turned off will not
|
||||||
* collide with content in the zone; otherwise visitors will always collide with content in the zone.
|
* collide with content in the zone; otherwise visitors will always collide with content in the zone.
|
||||||
|
@ -1382,6 +1405,9 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool
|
||||||
COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_HAZE_MODE, hazeMode, getHazeModeAsString());
|
COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_HAZE_MODE, hazeMode, getHazeModeAsString());
|
||||||
_haze.copyToScriptValue(_desiredProperties, properties, engine, skipDefaults, defaultEntityProperties);
|
_haze.copyToScriptValue(_desiredProperties, properties, engine, skipDefaults, defaultEntityProperties);
|
||||||
|
|
||||||
|
COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_BLOOM_MODE, bloomMode, getBloomModeAsString());
|
||||||
|
_bloom.copyToScriptValue(_desiredProperties, properties, engine, skipDefaults, defaultEntityProperties);
|
||||||
|
|
||||||
COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_KEY_LIGHT_MODE, keyLightMode, getKeyLightModeAsString());
|
COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_KEY_LIGHT_MODE, keyLightMode, getKeyLightModeAsString());
|
||||||
COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_AMBIENT_LIGHT_MODE, ambientLightMode, getAmbientLightModeAsString());
|
COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_AMBIENT_LIGHT_MODE, ambientLightMode, getAmbientLightModeAsString());
|
||||||
COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_SKYBOX_MODE, skyboxMode, getSkyboxModeAsString());
|
COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_SKYBOX_MODE, skyboxMode, getSkyboxModeAsString());
|
||||||
|
@ -1630,6 +1656,7 @@ void EntityItemProperties::copyFromScriptValue(const QScriptValue& object, bool
|
||||||
COPY_PROPERTY_FROM_QSCRIPTVALUE_ENUM(keyLightMode, KeyLightMode);
|
COPY_PROPERTY_FROM_QSCRIPTVALUE_ENUM(keyLightMode, KeyLightMode);
|
||||||
COPY_PROPERTY_FROM_QSCRIPTVALUE_ENUM(ambientLightMode, AmbientLightMode);
|
COPY_PROPERTY_FROM_QSCRIPTVALUE_ENUM(ambientLightMode, AmbientLightMode);
|
||||||
COPY_PROPERTY_FROM_QSCRIPTVALUE_ENUM(skyboxMode, SkyboxMode);
|
COPY_PROPERTY_FROM_QSCRIPTVALUE_ENUM(skyboxMode, SkyboxMode);
|
||||||
|
COPY_PROPERTY_FROM_QSCRIPTVALUE_ENUM(bloomMode, BloomMode);
|
||||||
|
|
||||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(sourceUrl, QString, setSourceUrl);
|
COPY_PROPERTY_FROM_QSCRIPTVALUE(sourceUrl, QString, setSourceUrl);
|
||||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(voxelVolumeSize, vec3, setVoxelVolumeSize);
|
COPY_PROPERTY_FROM_QSCRIPTVALUE(voxelVolumeSize, vec3, setVoxelVolumeSize);
|
||||||
|
@ -1662,6 +1689,7 @@ void EntityItemProperties::copyFromScriptValue(const QScriptValue& object, bool
|
||||||
_ambientLight.copyFromScriptValue(object, _defaultSettings);
|
_ambientLight.copyFromScriptValue(object, _defaultSettings);
|
||||||
_skybox.copyFromScriptValue(object, _defaultSettings);
|
_skybox.copyFromScriptValue(object, _defaultSettings);
|
||||||
_haze.copyFromScriptValue(object, _defaultSettings);
|
_haze.copyFromScriptValue(object, _defaultSettings);
|
||||||
|
_bloom.copyFromScriptValue(object, _defaultSettings);
|
||||||
|
|
||||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(xTextureURL, QString, setXTextureURL);
|
COPY_PROPERTY_FROM_QSCRIPTVALUE(xTextureURL, QString, setXTextureURL);
|
||||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(yTextureURL, QString, setYTextureURL);
|
COPY_PROPERTY_FROM_QSCRIPTVALUE(yTextureURL, QString, setYTextureURL);
|
||||||
|
@ -1803,6 +1831,7 @@ void EntityItemProperties::merge(const EntityItemProperties& other) {
|
||||||
COPY_PROPERTY_IF_CHANGED(keyLightMode);
|
COPY_PROPERTY_IF_CHANGED(keyLightMode);
|
||||||
COPY_PROPERTY_IF_CHANGED(ambientLightMode);
|
COPY_PROPERTY_IF_CHANGED(ambientLightMode);
|
||||||
COPY_PROPERTY_IF_CHANGED(skyboxMode);
|
COPY_PROPERTY_IF_CHANGED(skyboxMode);
|
||||||
|
COPY_PROPERTY_IF_CHANGED(bloomMode);
|
||||||
|
|
||||||
COPY_PROPERTY_IF_CHANGED(sourceUrl);
|
COPY_PROPERTY_IF_CHANGED(sourceUrl);
|
||||||
COPY_PROPERTY_IF_CHANGED(voxelVolumeSize);
|
COPY_PROPERTY_IF_CHANGED(voxelVolumeSize);
|
||||||
|
@ -1825,6 +1854,7 @@ void EntityItemProperties::merge(const EntityItemProperties& other) {
|
||||||
_ambientLight.merge(other._ambientLight);
|
_ambientLight.merge(other._ambientLight);
|
||||||
_skybox.merge(other._skybox);
|
_skybox.merge(other._skybox);
|
||||||
_haze.merge(other._haze);
|
_haze.merge(other._haze);
|
||||||
|
_bloom.merge(other._bloom);
|
||||||
|
|
||||||
COPY_PROPERTY_IF_CHANGED(xTextureURL);
|
COPY_PROPERTY_IF_CHANGED(xTextureURL);
|
||||||
COPY_PROPERTY_IF_CHANGED(yTextureURL);
|
COPY_PROPERTY_IF_CHANGED(yTextureURL);
|
||||||
|
@ -2096,6 +2126,11 @@ void EntityItemProperties::entityPropertyFlagsFromScriptValue(const QScriptValue
|
||||||
ADD_GROUP_PROPERTY_TO_MAP(PROP_HAZE_KEYLIGHT_RANGE, Haze, haze, HazeKeyLightRange, hazeKeyLightRange);
|
ADD_GROUP_PROPERTY_TO_MAP(PROP_HAZE_KEYLIGHT_RANGE, Haze, haze, HazeKeyLightRange, hazeKeyLightRange);
|
||||||
ADD_GROUP_PROPERTY_TO_MAP(PROP_HAZE_KEYLIGHT_ALTITUDE, Haze, haze, HazeKeyLightAltitude, hazeKeyLightAltitude);
|
ADD_GROUP_PROPERTY_TO_MAP(PROP_HAZE_KEYLIGHT_ALTITUDE, Haze, haze, HazeKeyLightAltitude, hazeKeyLightAltitude);
|
||||||
|
|
||||||
|
ADD_PROPERTY_TO_MAP(PROP_BLOOM_MODE, BloomMode, bloomMode, uint32_t);
|
||||||
|
ADD_GROUP_PROPERTY_TO_MAP(PROP_BLOOM_INTENSITY, Bloom, bloom, BloomIntensity, bloomIntensity);
|
||||||
|
ADD_GROUP_PROPERTY_TO_MAP(PROP_BLOOM_THRESHOLD, Bloom, bloom, BloomThreshold, bloomThreshold);
|
||||||
|
ADD_GROUP_PROPERTY_TO_MAP(PROP_BLOOM_SIZE, Bloom, bloom, BloomSize, bloomSize);
|
||||||
|
|
||||||
ADD_PROPERTY_TO_MAP(PROP_KEY_LIGHT_MODE, KeyLightMode, keyLightMode, uint32_t);
|
ADD_PROPERTY_TO_MAP(PROP_KEY_LIGHT_MODE, KeyLightMode, keyLightMode, uint32_t);
|
||||||
ADD_PROPERTY_TO_MAP(PROP_AMBIENT_LIGHT_MODE, AmbientLightMode, ambientLightMode, uint32_t);
|
ADD_PROPERTY_TO_MAP(PROP_AMBIENT_LIGHT_MODE, AmbientLightMode, ambientLightMode, uint32_t);
|
||||||
ADD_PROPERTY_TO_MAP(PROP_SKYBOX_MODE, SkyboxMode, skyboxMode, uint32_t);
|
ADD_PROPERTY_TO_MAP(PROP_SKYBOX_MODE, SkyboxMode, skyboxMode, uint32_t);
|
||||||
|
@ -2357,6 +2392,10 @@ OctreeElement::AppendState EntityItemProperties::encodeEntityEditPacket(PacketTy
|
||||||
_staticHaze.setProperties(properties);
|
_staticHaze.setProperties(properties);
|
||||||
_staticHaze.appendToEditPacket(packetData, requestedProperties, propertyFlags, propertiesDidntFit, propertyCount, appendState);
|
_staticHaze.appendToEditPacket(packetData, requestedProperties, propertyFlags, propertiesDidntFit, propertyCount, appendState);
|
||||||
|
|
||||||
|
APPEND_ENTITY_PROPERTY(PROP_BLOOM_MODE, (uint32_t)properties.getBloomMode());
|
||||||
|
_staticBloom.setProperties(properties);
|
||||||
|
_staticBloom.appendToEditPacket(packetData, requestedProperties, propertyFlags, propertiesDidntFit, propertyCount, appendState);
|
||||||
|
|
||||||
APPEND_ENTITY_PROPERTY(PROP_KEY_LIGHT_MODE, (uint32_t)properties.getKeyLightMode());
|
APPEND_ENTITY_PROPERTY(PROP_KEY_LIGHT_MODE, (uint32_t)properties.getKeyLightMode());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_AMBIENT_LIGHT_MODE, (uint32_t)properties.getAmbientLightMode());
|
APPEND_ENTITY_PROPERTY(PROP_AMBIENT_LIGHT_MODE, (uint32_t)properties.getAmbientLightMode());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_SKYBOX_MODE, (uint32_t)properties.getSkyboxMode());
|
APPEND_ENTITY_PROPERTY(PROP_SKYBOX_MODE, (uint32_t)properties.getSkyboxMode());
|
||||||
|
@ -2731,6 +2770,9 @@ bool EntityItemProperties::decodeEntityEditPacket(const unsigned char* data, int
|
||||||
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_HAZE_MODE, uint32_t, setHazeMode);
|
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_HAZE_MODE, uint32_t, setHazeMode);
|
||||||
properties.getHaze().decodeFromEditPacket(propertyFlags, dataAt, processedBytes);
|
properties.getHaze().decodeFromEditPacket(propertyFlags, dataAt, processedBytes);
|
||||||
|
|
||||||
|
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_BLOOM_MODE, uint32_t, setBloomMode);
|
||||||
|
properties.getBloom().decodeFromEditPacket(propertyFlags, dataAt, processedBytes);
|
||||||
|
|
||||||
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_KEY_LIGHT_MODE, uint32_t, setKeyLightMode);
|
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_KEY_LIGHT_MODE, uint32_t, setKeyLightMode);
|
||||||
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_AMBIENT_LIGHT_MODE, uint32_t, setAmbientLightMode);
|
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_AMBIENT_LIGHT_MODE, uint32_t, setAmbientLightMode);
|
||||||
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_SKYBOX_MODE, uint32_t, setSkyboxMode);
|
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_SKYBOX_MODE, uint32_t, setSkyboxMode);
|
||||||
|
@ -3044,10 +3086,12 @@ void EntityItemProperties::markAllChanged() {
|
||||||
_skyboxModeChanged = true;
|
_skyboxModeChanged = true;
|
||||||
_ambientLightModeChanged = true;
|
_ambientLightModeChanged = true;
|
||||||
_hazeModeChanged = true;
|
_hazeModeChanged = true;
|
||||||
|
_bloomModeChanged = true;
|
||||||
|
|
||||||
_animation.markAllChanged();
|
_animation.markAllChanged();
|
||||||
_skybox.markAllChanged();
|
_skybox.markAllChanged();
|
||||||
_haze.markAllChanged();
|
_haze.markAllChanged();
|
||||||
|
_bloom.markAllChanged();
|
||||||
|
|
||||||
_sourceUrlChanged = true;
|
_sourceUrlChanged = true;
|
||||||
_voxelVolumeSizeChanged = true;
|
_voxelVolumeSizeChanged = true;
|
||||||
|
@ -3442,15 +3486,15 @@ QList<QString> EntityItemProperties::listChangedProperties() {
|
||||||
if (hazeModeChanged()) {
|
if (hazeModeChanged()) {
|
||||||
out += "hazeMode";
|
out += "hazeMode";
|
||||||
}
|
}
|
||||||
|
if (bloomModeChanged()) {
|
||||||
|
out += "bloomMode";
|
||||||
|
}
|
||||||
if (keyLightModeChanged()) {
|
if (keyLightModeChanged()) {
|
||||||
out += "keyLightMode";
|
out += "keyLightMode";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ambientLightModeChanged()) {
|
if (ambientLightModeChanged()) {
|
||||||
out += "ambientLightMode";
|
out += "ambientLightMode";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (skyboxModeChanged()) {
|
if (skyboxModeChanged()) {
|
||||||
out += "skyboxMode";
|
out += "skyboxMode";
|
||||||
}
|
}
|
||||||
|
@ -3581,6 +3625,7 @@ QList<QString> EntityItemProperties::listChangedProperties() {
|
||||||
getAmbientLight().listChangedProperties(out);
|
getAmbientLight().listChangedProperties(out);
|
||||||
getSkybox().listChangedProperties(out);
|
getSkybox().listChangedProperties(out);
|
||||||
getHaze().listChangedProperties(out);
|
getHaze().listChangedProperties(out);
|
||||||
|
getBloom().listChangedProperties(out);
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
#include "SimulationOwner.h"
|
#include "SimulationOwner.h"
|
||||||
#include "SkyboxPropertyGroup.h"
|
#include "SkyboxPropertyGroup.h"
|
||||||
#include "HazePropertyGroup.h"
|
#include "HazePropertyGroup.h"
|
||||||
|
#include "BloomPropertyGroup.h"
|
||||||
#include "TextEntityItem.h"
|
#include "TextEntityItem.h"
|
||||||
#include "ZoneEntityItem.h"
|
#include "ZoneEntityItem.h"
|
||||||
|
|
||||||
|
@ -195,9 +196,11 @@ public:
|
||||||
DEFINE_PROPERTY_REF_ENUM(PROP_SKYBOX_MODE, SkyboxMode, skyboxMode, uint32_t, (uint32_t)COMPONENT_MODE_INHERIT);
|
DEFINE_PROPERTY_REF_ENUM(PROP_SKYBOX_MODE, SkyboxMode, skyboxMode, uint32_t, (uint32_t)COMPONENT_MODE_INHERIT);
|
||||||
DEFINE_PROPERTY_REF_ENUM(PROP_AMBIENT_LIGHT_MODE, AmbientLightMode, ambientLightMode, uint32_t, (uint32_t)COMPONENT_MODE_INHERIT);
|
DEFINE_PROPERTY_REF_ENUM(PROP_AMBIENT_LIGHT_MODE, AmbientLightMode, ambientLightMode, uint32_t, (uint32_t)COMPONENT_MODE_INHERIT);
|
||||||
DEFINE_PROPERTY_REF_ENUM(PROP_HAZE_MODE, HazeMode, hazeMode, uint32_t, (uint32_t)COMPONENT_MODE_INHERIT);
|
DEFINE_PROPERTY_REF_ENUM(PROP_HAZE_MODE, HazeMode, hazeMode, uint32_t, (uint32_t)COMPONENT_MODE_INHERIT);
|
||||||
|
DEFINE_PROPERTY_REF_ENUM(PROP_BLOOM_MODE, BloomMode, bloomMode, 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);
|
||||||
|
DEFINE_PROPERTY_GROUP(Bloom, bloom, BloomPropertyGroup);
|
||||||
DEFINE_PROPERTY_GROUP(Animation, animation, AnimationPropertyGroup);
|
DEFINE_PROPERTY_GROUP(Animation, animation, AnimationPropertyGroup);
|
||||||
DEFINE_PROPERTY_REF(PROP_SOURCE_URL, SourceUrl, sourceUrl, QString, "");
|
DEFINE_PROPERTY_REF(PROP_SOURCE_URL, SourceUrl, sourceUrl, QString, "");
|
||||||
DEFINE_PROPERTY(PROP_LINE_WIDTH, LineWidth, lineWidth, float, LineEntityItem::DEFAULT_LINE_WIDTH);
|
DEFINE_PROPERTY(PROP_LINE_WIDTH, LineWidth, lineWidth, float, LineEntityItem::DEFAULT_LINE_WIDTH);
|
||||||
|
@ -533,6 +536,7 @@ inline QDebug operator<<(QDebug debug, const EntityItemProperties& properties) {
|
||||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, KeyLightMode, keyLightMode, "");
|
DEBUG_PROPERTY_IF_CHANGED(debug, properties, KeyLightMode, keyLightMode, "");
|
||||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, AmbientLightMode, ambientLightMode, "");
|
DEBUG_PROPERTY_IF_CHANGED(debug, properties, AmbientLightMode, ambientLightMode, "");
|
||||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, SkyboxMode, skyboxMode, "");
|
DEBUG_PROPERTY_IF_CHANGED(debug, properties, SkyboxMode, skyboxMode, "");
|
||||||
|
DEBUG_PROPERTY_IF_CHANGED(debug, properties, BloomMode, bloomMode, "");
|
||||||
|
|
||||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, Cloneable, cloneable, "");
|
DEBUG_PROPERTY_IF_CHANGED(debug, properties, Cloneable, cloneable, "");
|
||||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, CloneLifetime, cloneLifetime, "");
|
DEBUG_PROPERTY_IF_CHANGED(debug, properties, CloneLifetime, cloneLifetime, "");
|
||||||
|
|
|
@ -257,6 +257,11 @@ enum EntityPropertyList {
|
||||||
PROP_SPIN_SPREAD,
|
PROP_SPIN_SPREAD,
|
||||||
PROP_PARTICLE_ROTATE_WITH_ENTITY,
|
PROP_PARTICLE_ROTATE_WITH_ENTITY,
|
||||||
|
|
||||||
|
PROP_BLOOM_MODE,
|
||||||
|
PROP_BLOOM_INTENSITY,
|
||||||
|
PROP_BLOOM_THRESHOLD,
|
||||||
|
PROP_BLOOM_SIZE,
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// ATTENTION: add new properties to end of list just ABOVE this line
|
// ATTENTION: add new properties to end of list just ABOVE this line
|
||||||
PROP_AFTER_LAST_ITEM,
|
PROP_AFTER_LAST_ITEM,
|
||||||
|
|
|
@ -47,33 +47,27 @@ ZoneEntityItem::ZoneEntityItem(const EntityItemID& entityItemID) : EntityItem(en
|
||||||
EntityItemProperties ZoneEntityItem::getProperties(EntityPropertyFlags desiredProperties) const {
|
EntityItemProperties ZoneEntityItem::getProperties(EntityPropertyFlags desiredProperties) const {
|
||||||
EntityItemProperties properties = EntityItem::getProperties(desiredProperties); // get the properties from our base class
|
EntityItemProperties properties = EntityItem::getProperties(desiredProperties); // get the properties from our base class
|
||||||
|
|
||||||
// Contains a QString property, must be synchronized
|
// Contain QString properties, must be synchronized
|
||||||
withReadLock([&] {
|
withReadLock([&] {
|
||||||
_keyLightProperties.getProperties(properties);
|
_keyLightProperties.getProperties(properties);
|
||||||
});
|
|
||||||
|
|
||||||
withReadLock([&] {
|
|
||||||
_ambientLightProperties.getProperties(properties);
|
_ambientLightProperties.getProperties(properties);
|
||||||
|
_skyboxProperties.getProperties(properties);
|
||||||
});
|
});
|
||||||
|
_hazeProperties.getProperties(properties);
|
||||||
|
_bloomProperties.getProperties(properties);
|
||||||
|
|
||||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(shapeType, getShapeType);
|
COPY_ENTITY_PROPERTY_TO_PROPERTIES(shapeType, getShapeType);
|
||||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(compoundShapeURL, getCompoundShapeURL);
|
COPY_ENTITY_PROPERTY_TO_PROPERTIES(compoundShapeURL, getCompoundShapeURL);
|
||||||
|
|
||||||
// Contains a QString property, must be synchronized
|
|
||||||
withReadLock([&] {
|
|
||||||
_skyboxProperties.getProperties(properties);
|
|
||||||
});
|
|
||||||
|
|
||||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(flyingAllowed, getFlyingAllowed);
|
COPY_ENTITY_PROPERTY_TO_PROPERTIES(flyingAllowed, getFlyingAllowed);
|
||||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(ghostingAllowed, getGhostingAllowed);
|
COPY_ENTITY_PROPERTY_TO_PROPERTIES(ghostingAllowed, getGhostingAllowed);
|
||||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(filterURL, getFilterURL);
|
COPY_ENTITY_PROPERTY_TO_PROPERTIES(filterURL, getFilterURL);
|
||||||
|
|
||||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(hazeMode, getHazeMode);
|
COPY_ENTITY_PROPERTY_TO_PROPERTIES(hazeMode, getHazeMode);
|
||||||
_hazeProperties.getProperties(properties);
|
|
||||||
|
|
||||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(keyLightMode, getKeyLightMode);
|
COPY_ENTITY_PROPERTY_TO_PROPERTIES(keyLightMode, getKeyLightMode);
|
||||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(ambientLightMode, getAmbientLightMode);
|
COPY_ENTITY_PROPERTY_TO_PROPERTIES(ambientLightMode, getAmbientLightMode);
|
||||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(skyboxMode, getSkyboxMode);
|
COPY_ENTITY_PROPERTY_TO_PROPERTIES(skyboxMode, getSkyboxMode);
|
||||||
|
COPY_ENTITY_PROPERTY_TO_PROPERTIES(bloomMode, getBloomMode);
|
||||||
|
|
||||||
return properties;
|
return properties;
|
||||||
}
|
}
|
||||||
|
@ -102,32 +96,27 @@ bool ZoneEntityItem::setSubClassProperties(const EntityItemProperties& propertie
|
||||||
// Contains a QString property, must be synchronized
|
// Contains a QString property, must be synchronized
|
||||||
withWriteLock([&] {
|
withWriteLock([&] {
|
||||||
_keyLightPropertiesChanged = _keyLightProperties.setProperties(properties);
|
_keyLightPropertiesChanged = _keyLightProperties.setProperties(properties);
|
||||||
});
|
|
||||||
withWriteLock([&] {
|
|
||||||
_ambientLightPropertiesChanged = _ambientLightProperties.setProperties(properties);
|
_ambientLightPropertiesChanged = _ambientLightProperties.setProperties(properties);
|
||||||
|
_skyboxPropertiesChanged = _skyboxProperties.setProperties(properties);
|
||||||
});
|
});
|
||||||
|
_hazePropertiesChanged = _hazeProperties.setProperties(properties);
|
||||||
|
_bloomPropertiesChanged = _bloomProperties.setProperties(properties);
|
||||||
|
|
||||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(shapeType, setShapeType);
|
SET_ENTITY_PROPERTY_FROM_PROPERTIES(shapeType, setShapeType);
|
||||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(compoundShapeURL, setCompoundShapeURL);
|
SET_ENTITY_PROPERTY_FROM_PROPERTIES(compoundShapeURL, setCompoundShapeURL);
|
||||||
|
|
||||||
// Contains a QString property, must be synchronized
|
|
||||||
withWriteLock([&] {
|
|
||||||
_skyboxPropertiesChanged = _skyboxProperties.setProperties(properties);
|
|
||||||
});
|
|
||||||
|
|
||||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(flyingAllowed, setFlyingAllowed);
|
SET_ENTITY_PROPERTY_FROM_PROPERTIES(flyingAllowed, setFlyingAllowed);
|
||||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(ghostingAllowed, setGhostingAllowed);
|
SET_ENTITY_PROPERTY_FROM_PROPERTIES(ghostingAllowed, setGhostingAllowed);
|
||||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(filterURL, setFilterURL);
|
SET_ENTITY_PROPERTY_FROM_PROPERTIES(filterURL, setFilterURL);
|
||||||
|
|
||||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(hazeMode, setHazeMode);
|
SET_ENTITY_PROPERTY_FROM_PROPERTIES(hazeMode, setHazeMode);
|
||||||
_hazePropertiesChanged = _hazeProperties.setProperties(properties);
|
|
||||||
|
|
||||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(keyLightMode, setKeyLightMode);
|
SET_ENTITY_PROPERTY_FROM_PROPERTIES(keyLightMode, setKeyLightMode);
|
||||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(ambientLightMode, setAmbientLightMode);
|
SET_ENTITY_PROPERTY_FROM_PROPERTIES(ambientLightMode, setAmbientLightMode);
|
||||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(skyboxMode, setSkyboxMode);
|
SET_ENTITY_PROPERTY_FROM_PROPERTIES(skyboxMode, setSkyboxMode);
|
||||||
|
SET_ENTITY_PROPERTY_FROM_PROPERTIES(bloomMode, setBloomMode);
|
||||||
|
|
||||||
somethingChanged = somethingChanged || _keyLightPropertiesChanged || _ambientLightPropertiesChanged ||
|
somethingChanged = somethingChanged || _keyLightPropertiesChanged || _ambientLightPropertiesChanged ||
|
||||||
_stagePropertiesChanged || _skyboxPropertiesChanged || _hazePropertiesChanged;
|
_stagePropertiesChanged || _skyboxPropertiesChanged || _hazePropertiesChanged || _bloomPropertiesChanged;
|
||||||
|
|
||||||
return somethingChanged;
|
return somethingChanged;
|
||||||
}
|
}
|
||||||
|
@ -139,54 +128,67 @@ int ZoneEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data,
|
||||||
int bytesRead = 0;
|
int bytesRead = 0;
|
||||||
const unsigned char* dataAt = data;
|
const unsigned char* dataAt = data;
|
||||||
|
|
||||||
int bytesFromKeylight;
|
{
|
||||||
withWriteLock([&] {
|
int bytesFromKeylight;
|
||||||
bytesFromKeylight = _keyLightProperties.readEntitySubclassDataFromBuffer(dataAt, (bytesLeftToRead - bytesRead), args,
|
withWriteLock([&] {
|
||||||
propertyFlags, overwriteLocalData, _keyLightPropertiesChanged);
|
bytesFromKeylight = _keyLightProperties.readEntitySubclassDataFromBuffer(dataAt, (bytesLeftToRead - bytesRead), args,
|
||||||
});
|
propertyFlags, overwriteLocalData, _keyLightPropertiesChanged);
|
||||||
|
});
|
||||||
|
somethingChanged = somethingChanged || _keyLightPropertiesChanged;
|
||||||
|
bytesRead += bytesFromKeylight;
|
||||||
|
dataAt += bytesFromKeylight;
|
||||||
|
}
|
||||||
|
|
||||||
somethingChanged = somethingChanged || _keyLightPropertiesChanged;
|
{
|
||||||
bytesRead += bytesFromKeylight;
|
int bytesFromAmbientlight;
|
||||||
dataAt += bytesFromKeylight;
|
withWriteLock([&] {
|
||||||
|
bytesFromAmbientlight = _ambientLightProperties.readEntitySubclassDataFromBuffer(dataAt, (bytesLeftToRead - bytesRead), args,
|
||||||
|
propertyFlags, overwriteLocalData, _ambientLightPropertiesChanged);
|
||||||
|
});
|
||||||
|
somethingChanged = somethingChanged || _ambientLightPropertiesChanged;
|
||||||
|
bytesRead += bytesFromAmbientlight;
|
||||||
|
dataAt += bytesFromAmbientlight;
|
||||||
|
}
|
||||||
|
|
||||||
int bytesFromAmbientlight;
|
{
|
||||||
withWriteLock([&] {
|
int bytesFromSkybox;
|
||||||
bytesFromAmbientlight = _ambientLightProperties.readEntitySubclassDataFromBuffer(dataAt, (bytesLeftToRead - bytesRead), args,
|
withWriteLock([&] {
|
||||||
propertyFlags, overwriteLocalData, _ambientLightPropertiesChanged);
|
bytesFromSkybox = _skyboxProperties.readEntitySubclassDataFromBuffer(dataAt, (bytesLeftToRead - bytesRead), args,
|
||||||
});
|
propertyFlags, overwriteLocalData, _skyboxPropertiesChanged);
|
||||||
|
});
|
||||||
|
somethingChanged = somethingChanged || _skyboxPropertiesChanged;
|
||||||
|
bytesRead += bytesFromSkybox;
|
||||||
|
dataAt += bytesFromSkybox;
|
||||||
|
}
|
||||||
|
|
||||||
somethingChanged = somethingChanged || _ambientLightPropertiesChanged;
|
{
|
||||||
bytesRead += bytesFromAmbientlight;
|
int bytesFromHaze = _hazeProperties.readEntitySubclassDataFromBuffer(dataAt, (bytesLeftToRead - bytesRead), args,
|
||||||
dataAt += bytesFromAmbientlight;
|
propertyFlags, overwriteLocalData, _hazePropertiesChanged);
|
||||||
|
somethingChanged = somethingChanged || _hazePropertiesChanged;
|
||||||
|
bytesRead += bytesFromHaze;
|
||||||
|
dataAt += bytesFromHaze;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
int bytesFromBloom = _bloomProperties.readEntitySubclassDataFromBuffer(dataAt, (bytesLeftToRead - bytesRead), args,
|
||||||
|
propertyFlags, overwriteLocalData, _bloomPropertiesChanged);
|
||||||
|
somethingChanged = somethingChanged || _bloomPropertiesChanged;
|
||||||
|
bytesRead += bytesFromBloom;
|
||||||
|
dataAt += bytesFromBloom;
|
||||||
|
}
|
||||||
|
|
||||||
READ_ENTITY_PROPERTY(PROP_SHAPE_TYPE, ShapeType, setShapeType);
|
READ_ENTITY_PROPERTY(PROP_SHAPE_TYPE, ShapeType, setShapeType);
|
||||||
READ_ENTITY_PROPERTY(PROP_COMPOUND_SHAPE_URL, QString, setCompoundShapeURL);
|
READ_ENTITY_PROPERTY(PROP_COMPOUND_SHAPE_URL, QString, setCompoundShapeURL);
|
||||||
|
|
||||||
int bytesFromSkybox;
|
|
||||||
withWriteLock([&] {
|
|
||||||
bytesFromSkybox = _skyboxProperties.readEntitySubclassDataFromBuffer(dataAt, (bytesLeftToRead - bytesRead), args,
|
|
||||||
propertyFlags, overwriteLocalData, _skyboxPropertiesChanged);
|
|
||||||
});
|
|
||||||
somethingChanged = somethingChanged || _skyboxPropertiesChanged;
|
|
||||||
bytesRead += bytesFromSkybox;
|
|
||||||
dataAt += bytesFromSkybox;
|
|
||||||
|
|
||||||
READ_ENTITY_PROPERTY(PROP_FLYING_ALLOWED, bool, setFlyingAllowed);
|
READ_ENTITY_PROPERTY(PROP_FLYING_ALLOWED, bool, setFlyingAllowed);
|
||||||
READ_ENTITY_PROPERTY(PROP_GHOSTING_ALLOWED, bool, setGhostingAllowed);
|
READ_ENTITY_PROPERTY(PROP_GHOSTING_ALLOWED, bool, setGhostingAllowed);
|
||||||
READ_ENTITY_PROPERTY(PROP_FILTER_URL, QString, setFilterURL);
|
READ_ENTITY_PROPERTY(PROP_FILTER_URL, QString, setFilterURL);
|
||||||
|
|
||||||
READ_ENTITY_PROPERTY(PROP_HAZE_MODE, uint32_t, setHazeMode);
|
READ_ENTITY_PROPERTY(PROP_HAZE_MODE, uint32_t, setHazeMode);
|
||||||
|
|
||||||
int bytesFromHaze = _hazeProperties.readEntitySubclassDataFromBuffer(dataAt, (bytesLeftToRead - bytesRead), args,
|
|
||||||
propertyFlags, overwriteLocalData, _hazePropertiesChanged);
|
|
||||||
|
|
||||||
somethingChanged = somethingChanged || _hazePropertiesChanged;
|
|
||||||
bytesRead += bytesFromHaze;
|
|
||||||
dataAt += bytesFromHaze;
|
|
||||||
|
|
||||||
READ_ENTITY_PROPERTY(PROP_KEY_LIGHT_MODE, uint32_t, setKeyLightMode);
|
READ_ENTITY_PROPERTY(PROP_KEY_LIGHT_MODE, uint32_t, setKeyLightMode);
|
||||||
READ_ENTITY_PROPERTY(PROP_AMBIENT_LIGHT_MODE, uint32_t, setAmbientLightMode);
|
READ_ENTITY_PROPERTY(PROP_AMBIENT_LIGHT_MODE, uint32_t, setAmbientLightMode);
|
||||||
READ_ENTITY_PROPERTY(PROP_SKYBOX_MODE, uint32_t, setSkyboxMode);
|
READ_ENTITY_PROPERTY(PROP_SKYBOX_MODE, uint32_t, setSkyboxMode);
|
||||||
|
READ_ENTITY_PROPERTY(PROP_BLOOM_MODE, uint32_t, setBloomMode);
|
||||||
|
|
||||||
return bytesRead;
|
return bytesRead;
|
||||||
}
|
}
|
||||||
|
@ -196,29 +198,24 @@ EntityPropertyFlags ZoneEntityItem::getEntityProperties(EncodeBitstreamParams& p
|
||||||
|
|
||||||
withReadLock([&] {
|
withReadLock([&] {
|
||||||
requestedProperties += _keyLightProperties.getEntityProperties(params);
|
requestedProperties += _keyLightProperties.getEntityProperties(params);
|
||||||
});
|
|
||||||
|
|
||||||
withReadLock([&] {
|
|
||||||
requestedProperties += _ambientLightProperties.getEntityProperties(params);
|
requestedProperties += _ambientLightProperties.getEntityProperties(params);
|
||||||
|
requestedProperties += _skyboxProperties.getEntityProperties(params);
|
||||||
});
|
});
|
||||||
|
requestedProperties += _hazeProperties.getEntityProperties(params);
|
||||||
|
requestedProperties += _bloomProperties.getEntityProperties(params);
|
||||||
|
|
||||||
requestedProperties += PROP_SHAPE_TYPE;
|
requestedProperties += PROP_SHAPE_TYPE;
|
||||||
requestedProperties += PROP_COMPOUND_SHAPE_URL;
|
requestedProperties += PROP_COMPOUND_SHAPE_URL;
|
||||||
|
|
||||||
withReadLock([&] {
|
|
||||||
requestedProperties += _skyboxProperties.getEntityProperties(params);
|
|
||||||
});
|
|
||||||
|
|
||||||
requestedProperties += PROP_FLYING_ALLOWED;
|
requestedProperties += PROP_FLYING_ALLOWED;
|
||||||
requestedProperties += PROP_GHOSTING_ALLOWED;
|
requestedProperties += PROP_GHOSTING_ALLOWED;
|
||||||
requestedProperties += PROP_FILTER_URL;
|
requestedProperties += PROP_FILTER_URL;
|
||||||
|
|
||||||
requestedProperties += PROP_HAZE_MODE;
|
requestedProperties += PROP_HAZE_MODE;
|
||||||
requestedProperties += _hazeProperties.getEntityProperties(params);
|
|
||||||
|
|
||||||
requestedProperties += PROP_KEY_LIGHT_MODE;
|
requestedProperties += PROP_KEY_LIGHT_MODE;
|
||||||
requestedProperties += PROP_AMBIENT_LIGHT_MODE;
|
requestedProperties += PROP_AMBIENT_LIGHT_MODE;
|
||||||
requestedProperties += PROP_SKYBOX_MODE;
|
requestedProperties += PROP_SKYBOX_MODE;
|
||||||
|
requestedProperties += PROP_BLOOM_MODE;
|
||||||
|
|
||||||
return requestedProperties;
|
return requestedProperties;
|
||||||
}
|
}
|
||||||
|
@ -235,44 +232,46 @@ void ZoneEntityItem::appendSubclassData(OctreePacketData* packetData, EncodeBits
|
||||||
|
|
||||||
_keyLightProperties.appendSubclassData(packetData, params, modelTreeElementExtraEncodeData, requestedProperties,
|
_keyLightProperties.appendSubclassData(packetData, params, modelTreeElementExtraEncodeData, requestedProperties,
|
||||||
propertyFlags, propertiesDidntFit, propertyCount, appendState);
|
propertyFlags, propertiesDidntFit, propertyCount, appendState);
|
||||||
|
|
||||||
_ambientLightProperties.appendSubclassData(packetData, params, modelTreeElementExtraEncodeData, requestedProperties,
|
_ambientLightProperties.appendSubclassData(packetData, params, modelTreeElementExtraEncodeData, requestedProperties,
|
||||||
propertyFlags, propertiesDidntFit, propertyCount, appendState);
|
propertyFlags, propertiesDidntFit, propertyCount, appendState);
|
||||||
|
_skyboxProperties.appendSubclassData(packetData, params, modelTreeElementExtraEncodeData, requestedProperties,
|
||||||
|
propertyFlags, propertiesDidntFit, propertyCount, appendState);
|
||||||
|
_hazeProperties.appendSubclassData(packetData, params, modelTreeElementExtraEncodeData, requestedProperties,
|
||||||
|
propertyFlags, propertiesDidntFit, propertyCount, appendState);
|
||||||
|
_bloomProperties.appendSubclassData(packetData, params, modelTreeElementExtraEncodeData, requestedProperties,
|
||||||
|
propertyFlags, propertiesDidntFit, propertyCount, appendState);
|
||||||
|
|
||||||
APPEND_ENTITY_PROPERTY(PROP_SHAPE_TYPE, (uint32_t)getShapeType());
|
APPEND_ENTITY_PROPERTY(PROP_SHAPE_TYPE, (uint32_t)getShapeType());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_COMPOUND_SHAPE_URL, getCompoundShapeURL());
|
APPEND_ENTITY_PROPERTY(PROP_COMPOUND_SHAPE_URL, getCompoundShapeURL());
|
||||||
|
|
||||||
_skyboxProperties.appendSubclassData(packetData, params, modelTreeElementExtraEncodeData, requestedProperties,
|
|
||||||
propertyFlags, propertiesDidntFit, propertyCount, appendState);
|
|
||||||
|
|
||||||
APPEND_ENTITY_PROPERTY(PROP_FLYING_ALLOWED, getFlyingAllowed());
|
APPEND_ENTITY_PROPERTY(PROP_FLYING_ALLOWED, getFlyingAllowed());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_GHOSTING_ALLOWED, getGhostingAllowed());
|
APPEND_ENTITY_PROPERTY(PROP_GHOSTING_ALLOWED, getGhostingAllowed());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_FILTER_URL, getFilterURL());
|
APPEND_ENTITY_PROPERTY(PROP_FILTER_URL, getFilterURL());
|
||||||
|
|
||||||
APPEND_ENTITY_PROPERTY(PROP_HAZE_MODE, (uint32_t)getHazeMode());
|
APPEND_ENTITY_PROPERTY(PROP_HAZE_MODE, (uint32_t)getHazeMode());
|
||||||
_hazeProperties.appendSubclassData(packetData, params, modelTreeElementExtraEncodeData, requestedProperties,
|
|
||||||
propertyFlags, propertiesDidntFit, propertyCount, appendState);
|
|
||||||
|
|
||||||
APPEND_ENTITY_PROPERTY(PROP_KEY_LIGHT_MODE, (uint32_t)getKeyLightMode());
|
APPEND_ENTITY_PROPERTY(PROP_KEY_LIGHT_MODE, (uint32_t)getKeyLightMode());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_AMBIENT_LIGHT_MODE, (uint32_t)getAmbientLightMode());
|
APPEND_ENTITY_PROPERTY(PROP_AMBIENT_LIGHT_MODE, (uint32_t)getAmbientLightMode());
|
||||||
APPEND_ENTITY_PROPERTY(PROP_SKYBOX_MODE, (uint32_t)getSkyboxMode());
|
APPEND_ENTITY_PROPERTY(PROP_SKYBOX_MODE, (uint32_t)getSkyboxMode());
|
||||||
|
APPEND_ENTITY_PROPERTY(PROP_BLOOM_MODE, (uint32_t)getBloomMode());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZoneEntityItem::debugDump() const {
|
void ZoneEntityItem::debugDump() const {
|
||||||
quint64 now = usecTimestampNow();
|
quint64 now = usecTimestampNow();
|
||||||
qCDebug(entities) << " ZoneEntityItem id:" << getEntityItemID() << "---------------------------------------------";
|
qCDebug(entities) << " ZoneEntityItem id:" << getEntityItemID() << "---------------------------------------------";
|
||||||
qCDebug(entities) << " position:" << debugTreeVector(getWorldPosition());
|
qCDebug(entities) << " position:" << debugTreeVector(getWorldPosition());
|
||||||
qCDebug(entities) << " dimensions:" << debugTreeVector(getScaledDimensions());
|
qCDebug(entities) << " dimensions:" << debugTreeVector(getScaledDimensions());
|
||||||
qCDebug(entities) << " getLastEdited:" << debugTime(getLastEdited(), now);
|
qCDebug(entities) << " getLastEdited:" << debugTime(getLastEdited(), now);
|
||||||
qCDebug(entities) << " _hazeMode:" << EntityItemProperties::getComponentModeString(_hazeMode);
|
qCDebug(entities) << " _hazeMode:" << EntityItemProperties::getComponentModeString(_hazeMode);
|
||||||
qCDebug(entities) << " _keyLightMode:" << EntityItemProperties::getComponentModeString(_keyLightMode);
|
qCDebug(entities) << " _keyLightMode:" << EntityItemProperties::getComponentModeString(_keyLightMode);
|
||||||
qCDebug(entities) << " _ambientLightMode:" << EntityItemProperties::getComponentModeString(_ambientLightMode);
|
qCDebug(entities) << " _ambientLightMode:" << EntityItemProperties::getComponentModeString(_ambientLightMode);
|
||||||
qCDebug(entities) << " _skyboxMode:" << EntityItemProperties::getComponentModeString(_skyboxMode);
|
qCDebug(entities) << " _skyboxMode:" << EntityItemProperties::getComponentModeString(_skyboxMode);
|
||||||
|
qCDebug(entities) << " _bloomMode:" << EntityItemProperties::getComponentModeString(_bloomMode);
|
||||||
|
|
||||||
_keyLightProperties.debugDump();
|
_keyLightProperties.debugDump();
|
||||||
_ambientLightProperties.debugDump();
|
_ambientLightProperties.debugDump();
|
||||||
_skyboxProperties.debugDump();
|
_skyboxProperties.debugDump();
|
||||||
_hazeProperties.debugDump();
|
_hazeProperties.debugDump();
|
||||||
|
_bloomProperties.debugDump();
|
||||||
}
|
}
|
||||||
|
|
||||||
ShapeType ZoneEntityItem::getShapeType() const {
|
ShapeType ZoneEntityItem::getShapeType() const {
|
||||||
|
@ -344,6 +343,7 @@ void ZoneEntityItem::resetRenderingPropertiesChanged() {
|
||||||
_ambientLightPropertiesChanged = false;
|
_ambientLightPropertiesChanged = false;
|
||||||
_skyboxPropertiesChanged = false;
|
_skyboxPropertiesChanged = false;
|
||||||
_hazePropertiesChanged = false;
|
_hazePropertiesChanged = false;
|
||||||
|
_bloomPropertiesChanged = false;
|
||||||
_stagePropertiesChanged = false;
|
_stagePropertiesChanged = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -359,6 +359,17 @@ uint32_t ZoneEntityItem::getHazeMode() const {
|
||||||
return _hazeMode;
|
return _hazeMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ZoneEntityItem::setBloomMode(const uint32_t value) {
|
||||||
|
if (value < COMPONENT_MODE_ITEM_COUNT && value != _bloomMode) {
|
||||||
|
_bloomMode = value;
|
||||||
|
_bloomPropertiesChanged = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t ZoneEntityItem::getBloomMode() const {
|
||||||
|
return _bloomMode;
|
||||||
|
}
|
||||||
|
|
||||||
void ZoneEntityItem::setKeyLightMode(const uint32_t value) {
|
void ZoneEntityItem::setKeyLightMode(const uint32_t value) {
|
||||||
if (value < COMPONENT_MODE_ITEM_COUNT && value != _keyLightMode) {
|
if (value < COMPONENT_MODE_ITEM_COUNT && value != _keyLightMode) {
|
||||||
_keyLightMode = value;
|
_keyLightMode = value;
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include "EntityTree.h"
|
#include "EntityTree.h"
|
||||||
#include "SkyboxPropertyGroup.h"
|
#include "SkyboxPropertyGroup.h"
|
||||||
#include "HazePropertyGroup.h"
|
#include "HazePropertyGroup.h"
|
||||||
|
#include "BloomPropertyGroup.h"
|
||||||
#include <ComponentMode.h>
|
#include <ComponentMode.h>
|
||||||
|
|
||||||
class ZoneEntityItem : public EntityItem {
|
class ZoneEntityItem : public EntityItem {
|
||||||
|
@ -79,9 +80,13 @@ public:
|
||||||
void setSkyboxMode(uint32_t value);
|
void setSkyboxMode(uint32_t value);
|
||||||
uint32_t getSkyboxMode() const;
|
uint32_t getSkyboxMode() const;
|
||||||
|
|
||||||
|
void setBloomMode(const uint32_t value);
|
||||||
|
uint32_t getBloomMode() const;
|
||||||
|
|
||||||
SkyboxPropertyGroup getSkyboxProperties() const { return resultWithReadLock<SkyboxPropertyGroup>([&] { return _skyboxProperties; }); }
|
SkyboxPropertyGroup getSkyboxProperties() const { return resultWithReadLock<SkyboxPropertyGroup>([&] { return _skyboxProperties; }); }
|
||||||
|
|
||||||
const HazePropertyGroup& getHazeProperties() const { return _hazeProperties; }
|
const HazePropertyGroup& getHazeProperties() const { return _hazeProperties; }
|
||||||
|
const BloomPropertyGroup& getBloomProperties() const { return _bloomProperties; }
|
||||||
|
|
||||||
bool getFlyingAllowed() const { return _flyingAllowed; }
|
bool getFlyingAllowed() const { return _flyingAllowed; }
|
||||||
void setFlyingAllowed(bool value) { _flyingAllowed = value; }
|
void setFlyingAllowed(bool value) { _flyingAllowed = value; }
|
||||||
|
@ -93,10 +98,8 @@ public:
|
||||||
bool keyLightPropertiesChanged() const { return _keyLightPropertiesChanged; }
|
bool keyLightPropertiesChanged() const { return _keyLightPropertiesChanged; }
|
||||||
bool ambientLightPropertiesChanged() const { return _ambientLightPropertiesChanged; }
|
bool ambientLightPropertiesChanged() const { return _ambientLightPropertiesChanged; }
|
||||||
bool skyboxPropertiesChanged() const { return _skyboxPropertiesChanged; }
|
bool skyboxPropertiesChanged() const { return _skyboxPropertiesChanged; }
|
||||||
|
bool hazePropertiesChanged() const { return _hazePropertiesChanged; }
|
||||||
bool hazePropertiesChanged() const {
|
bool bloomPropertiesChanged() const { return _bloomPropertiesChanged; }
|
||||||
return _hazePropertiesChanged;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool stagePropertiesChanged() const { return _stagePropertiesChanged; }
|
bool stagePropertiesChanged() const { return _stagePropertiesChanged; }
|
||||||
|
|
||||||
|
@ -133,9 +136,11 @@ protected:
|
||||||
uint32_t _ambientLightMode { COMPONENT_MODE_INHERIT };
|
uint32_t _ambientLightMode { COMPONENT_MODE_INHERIT };
|
||||||
|
|
||||||
uint32_t _hazeMode { COMPONENT_MODE_INHERIT };
|
uint32_t _hazeMode { COMPONENT_MODE_INHERIT };
|
||||||
|
uint32_t _bloomMode { COMPONENT_MODE_INHERIT };
|
||||||
|
|
||||||
SkyboxPropertyGroup _skyboxProperties;
|
SkyboxPropertyGroup _skyboxProperties;
|
||||||
HazePropertyGroup _hazeProperties;
|
HazePropertyGroup _hazeProperties;
|
||||||
|
BloomPropertyGroup _bloomProperties;
|
||||||
|
|
||||||
bool _flyingAllowed { DEFAULT_FLYING_ALLOWED };
|
bool _flyingAllowed { DEFAULT_FLYING_ALLOWED };
|
||||||
bool _ghostingAllowed { DEFAULT_GHOSTING_ALLOWED };
|
bool _ghostingAllowed { DEFAULT_GHOSTING_ALLOWED };
|
||||||
|
@ -146,6 +151,7 @@ protected:
|
||||||
bool _ambientLightPropertiesChanged { false };
|
bool _ambientLightPropertiesChanged { false };
|
||||||
bool _skyboxPropertiesChanged { false };
|
bool _skyboxPropertiesChanged { false };
|
||||||
bool _hazePropertiesChanged{ false };
|
bool _hazePropertiesChanged{ false };
|
||||||
|
bool _bloomPropertiesChanged { false };
|
||||||
bool _stagePropertiesChanged { false };
|
bool _stagePropertiesChanged { false };
|
||||||
|
|
||||||
static bool _drawZoneBoundaries;
|
static bool _drawZoneBoundaries;
|
||||||
|
|
18
libraries/graphics/src/graphics/Bloom.cpp
Normal file
18
libraries/graphics/src/graphics/Bloom.cpp
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
//
|
||||||
|
// Bloom.cpp
|
||||||
|
// libraries/graphics/src/graphics
|
||||||
|
//
|
||||||
|
// Created by Sam Gondelman on 8/7/2018
|
||||||
|
// Copyright 2018 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "Bloom.h"
|
||||||
|
|
||||||
|
using namespace graphics;
|
||||||
|
|
||||||
|
const float Bloom::INITIAL_BLOOM_INTENSITY { 0.25f };
|
||||||
|
const float Bloom::INITIAL_BLOOM_THRESHOLD { 0.7f };
|
||||||
|
const float Bloom::INITIAL_BLOOM_SIZE { 0.9f };
|
44
libraries/graphics/src/graphics/Bloom.h
Normal file
44
libraries/graphics/src/graphics/Bloom.h
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
//
|
||||||
|
// Bloom.h
|
||||||
|
// libraries/graphics/src/graphics
|
||||||
|
//
|
||||||
|
// Created by Sam Gondelman on 8/7/2018
|
||||||
|
// Copyright 2018 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
#ifndef hifi_model_Bloom_h
|
||||||
|
#define hifi_model_Bloom_h
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
namespace graphics {
|
||||||
|
class Bloom {
|
||||||
|
public:
|
||||||
|
// Initial values
|
||||||
|
static const float INITIAL_BLOOM_INTENSITY;
|
||||||
|
static const float INITIAL_BLOOM_THRESHOLD;
|
||||||
|
static const float INITIAL_BLOOM_SIZE;
|
||||||
|
|
||||||
|
Bloom() {}
|
||||||
|
|
||||||
|
void setBloomIntensity(const float bloomIntensity) { _bloomIntensity = bloomIntensity; }
|
||||||
|
void setBloomThreshold(const float bloomThreshold) { _bloomThreshold = bloomThreshold; }
|
||||||
|
void setBloomSize(const float bloomSize) { _bloomSize = bloomSize; }
|
||||||
|
void setBloomActive(const bool isBloomActive) { _isBloomActive = isBloomActive; }
|
||||||
|
|
||||||
|
float getBloomIntensity() { return _bloomIntensity; }
|
||||||
|
float getBloomThreshold() { return _bloomThreshold; }
|
||||||
|
float getBloomSize() { return _bloomSize; }
|
||||||
|
bool getBloomActive() { return _isBloomActive; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool _isBloomActive { false };
|
||||||
|
float _bloomIntensity { INITIAL_BLOOM_INTENSITY };
|
||||||
|
float _bloomThreshold {INITIAL_BLOOM_THRESHOLD };
|
||||||
|
float _bloomSize { INITIAL_BLOOM_SIZE };
|
||||||
|
};
|
||||||
|
using BloomPointer = std::shared_ptr<Bloom>;
|
||||||
|
}
|
||||||
|
#endif // hifi_model_Bloom_h
|
|
@ -33,7 +33,7 @@ PacketVersion versionForPacketType(PacketType packetType) {
|
||||||
case PacketType::EntityEdit:
|
case PacketType::EntityEdit:
|
||||||
case PacketType::EntityData:
|
case PacketType::EntityData:
|
||||||
case PacketType::EntityPhysics:
|
case PacketType::EntityPhysics:
|
||||||
return static_cast<PacketVersion>(EntityVersion::ParticleSpin);
|
return static_cast<PacketVersion>(EntityVersion::BloomEffect);
|
||||||
case PacketType::EntityQuery:
|
case PacketType::EntityQuery:
|
||||||
return static_cast<PacketVersion>(EntityQueryPacketVersion::ConicalFrustums);
|
return static_cast<PacketVersion>(EntityQueryPacketVersion::ConicalFrustums);
|
||||||
case PacketType::AvatarIdentity:
|
case PacketType::AvatarIdentity:
|
||||||
|
|
|
@ -240,7 +240,8 @@ enum class EntityVersion : PacketVersion {
|
||||||
CollisionMask16Bytes,
|
CollisionMask16Bytes,
|
||||||
YieldSimulationOwnership,
|
YieldSimulationOwnership,
|
||||||
ParticleEntityFix,
|
ParticleEntityFix,
|
||||||
ParticleSpin
|
ParticleSpin,
|
||||||
|
BloomEffect
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class EntityScriptCallMethodVersion : PacketVersion {
|
enum class EntityScriptCallMethodVersion : PacketVersion {
|
||||||
|
|
|
@ -25,11 +25,7 @@ BloomThreshold::BloomThreshold(unsigned int downsamplingFactor) {
|
||||||
_parameters.edit()._sampleCount = downsamplingFactor;
|
_parameters.edit()._sampleCount = downsamplingFactor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BloomThreshold::configure(const Config& config) {
|
void BloomThreshold::configure(const Config& config) {}
|
||||||
if (_parameters.get()._threshold != config.threshold) {
|
|
||||||
_parameters.edit()._threshold = config.threshold;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void BloomThreshold::run(const render::RenderContextPointer& renderContext, const Inputs& inputs, Outputs& outputs) {
|
void BloomThreshold::run(const render::RenderContextPointer& renderContext, const Inputs& inputs, Outputs& outputs) {
|
||||||
assert(renderContext->args);
|
assert(renderContext->args);
|
||||||
|
@ -39,6 +35,7 @@ void BloomThreshold::run(const render::RenderContextPointer& renderContext, cons
|
||||||
|
|
||||||
const auto frameTransform = inputs.get0();
|
const auto frameTransform = inputs.get0();
|
||||||
const auto inputFrameBuffer = inputs.get1();
|
const auto inputFrameBuffer = inputs.get1();
|
||||||
|
const auto bloom = inputs.get2();
|
||||||
|
|
||||||
assert(inputFrameBuffer->hasColor());
|
assert(inputFrameBuffer->hasColor());
|
||||||
|
|
||||||
|
@ -68,6 +65,28 @@ void BloomThreshold::run(const render::RenderContextPointer& renderContext, cons
|
||||||
|
|
||||||
glm::ivec4 viewport{ 0, 0, bufferSize.x, bufferSize.y };
|
glm::ivec4 viewport{ 0, 0, bufferSize.x, bufferSize.y };
|
||||||
|
|
||||||
|
if (!bloom || !bloom->getBloomActive()) {
|
||||||
|
outputs = _outputBuffer;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_parameters.edit()._threshold = bloom->getBloomThreshold();
|
||||||
|
|
||||||
|
//{
|
||||||
|
// std::string blurName { "BloomBlurN" };
|
||||||
|
// auto sigma = 0.5f + bloom->getBloomSize() * 3.5f;
|
||||||
|
// auto task = static_cast<render::Task::TaskConcept*>(this);
|
||||||
|
|
||||||
|
// for (auto i = 0; i < BLOOM_BLUR_LEVEL_COUNT; i++) {
|
||||||
|
// blurName.back() = '0' + i;
|
||||||
|
// auto blurJobIt = task->editJob(blurName);
|
||||||
|
// assert(blurJobIt != task->_jobs.end());
|
||||||
|
// auto& gaussianBlur = blurJobIt->edit<render::BlurGaussian>();
|
||||||
|
// auto gaussianBlurParams = gaussianBlur.getParameters();
|
||||||
|
// gaussianBlurParams->setFilterGaussianTaps(9, sigma);
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
gpu::doInBatch("BloomThreshold::run", args->_context, [&](gpu::Batch& batch) {
|
gpu::doInBatch("BloomThreshold::run", args->_context, [&](gpu::Batch& batch) {
|
||||||
batch.enableStereo(false);
|
batch.enableStereo(false);
|
||||||
|
|
||||||
|
@ -90,16 +109,7 @@ BloomApply::BloomApply() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BloomApply::configure(const Config& config) {
|
void BloomApply::configure(const Config& config) {}
|
||||||
const auto newIntensity = config.intensity / 3.0f;
|
|
||||||
|
|
||||||
if (_parameters.get()._intensities.x != newIntensity) {
|
|
||||||
auto& parameters = _parameters.edit();
|
|
||||||
parameters._intensities.x = newIntensity;
|
|
||||||
parameters._intensities.y = newIntensity;
|
|
||||||
parameters._intensities.z = newIntensity;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void BloomApply::run(const render::RenderContextPointer& renderContext, const Inputs& inputs) {
|
void BloomApply::run(const render::RenderContextPointer& renderContext, const Inputs& inputs) {
|
||||||
assert(renderContext->args);
|
assert(renderContext->args);
|
||||||
|
@ -123,8 +133,19 @@ void BloomApply::run(const render::RenderContextPointer& renderContext, const In
|
||||||
const auto blur0FB = inputs.get1();
|
const auto blur0FB = inputs.get1();
|
||||||
const auto blur1FB = inputs.get2();
|
const auto blur1FB = inputs.get2();
|
||||||
const auto blur2FB = inputs.get3();
|
const auto blur2FB = inputs.get3();
|
||||||
|
const auto bloom = inputs.get4();
|
||||||
const glm::ivec4 viewport{ 0, 0, framebufferSize.x, framebufferSize.y };
|
const glm::ivec4 viewport{ 0, 0, framebufferSize.x, framebufferSize.y };
|
||||||
|
|
||||||
|
if (!bloom || !bloom->getBloomActive()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto newIntensity = bloom->getBloomIntensity() / 3.0f;
|
||||||
|
auto& parameters = _parameters.edit();
|
||||||
|
parameters._intensities.x = newIntensity;
|
||||||
|
parameters._intensities.y = newIntensity;
|
||||||
|
parameters._intensities.z = newIntensity;
|
||||||
|
|
||||||
gpu::doInBatch("BloomApply::run", args->_context, [&](gpu::Batch& batch) {
|
gpu::doInBatch("BloomApply::run", args->_context, [&](gpu::Batch& batch) {
|
||||||
batch.enableStereo(false);
|
batch.enableStereo(false);
|
||||||
|
|
||||||
|
@ -266,43 +287,9 @@ void DebugBloom::run(const render::RenderContextPointer& renderContext, const In
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void BloomConfig::setIntensity(float value) {
|
BloomEffect::BloomEffect() {}
|
||||||
auto task = static_cast<render::Task::TaskConcept*>(_task);
|
|
||||||
auto blurJobIt = task->editJob("BloomApply");
|
|
||||||
assert(blurJobIt != task->_jobs.end());
|
|
||||||
blurJobIt->getConfiguration()->setProperty("intensity", value);
|
|
||||||
}
|
|
||||||
|
|
||||||
float BloomConfig::getIntensity() const {
|
void BloomEffect::configure(const Config& config) {
|
||||||
auto task = static_cast<render::Task::TaskConcept*>(_task);
|
|
||||||
auto blurJobIt = task->getJob("BloomApply");
|
|
||||||
assert(blurJobIt != task->_jobs.end());
|
|
||||||
return blurJobIt->getConfiguration()->property("intensity").toFloat();
|
|
||||||
}
|
|
||||||
|
|
||||||
void BloomConfig::setSize(float value) {
|
|
||||||
std::string blurName{ "BloomBlurN" };
|
|
||||||
auto sigma = 0.5f+value*3.5f;
|
|
||||||
auto task = static_cast<render::Task::TaskConcept*>(_task);
|
|
||||||
|
|
||||||
for (auto i = 0; i < BLOOM_BLUR_LEVEL_COUNT; i++) {
|
|
||||||
blurName.back() = '0' + i;
|
|
||||||
auto blurJobIt = task->editJob(blurName);
|
|
||||||
assert(blurJobIt != task->_jobs.end());
|
|
||||||
auto& gaussianBlur = blurJobIt->edit<render::BlurGaussian>();
|
|
||||||
auto gaussianBlurParams = gaussianBlur.getParameters();
|
|
||||||
gaussianBlurParams->setFilterGaussianTaps(9, sigma);
|
|
||||||
}
|
|
||||||
auto blurJobIt = task->getJob("BloomApply");
|
|
||||||
assert(blurJobIt != task->_jobs.end());
|
|
||||||
blurJobIt->getConfiguration()->setProperty("sigma", sigma);
|
|
||||||
}
|
|
||||||
|
|
||||||
Bloom::Bloom() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void Bloom::configure(const Config& config) {
|
|
||||||
std::string blurName{ "BloomBlurN" };
|
std::string blurName{ "BloomBlurN" };
|
||||||
|
|
||||||
for (auto i = 0; i < BLOOM_BLUR_LEVEL_COUNT; i++) {
|
for (auto i = 0; i < BLOOM_BLUR_LEVEL_COUNT; i++) {
|
||||||
|
@ -312,7 +299,7 @@ void Bloom::configure(const Config& config) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Bloom::build(JobModel& task, const render::Varying& inputs, render::Varying& outputs) {
|
void BloomEffect::build(JobModel& task, const render::Varying& inputs, render::Varying& outputs) {
|
||||||
// Start by computing threshold of color buffer input at quarter resolution
|
// Start by computing threshold of color buffer input at quarter resolution
|
||||||
const auto bloomInputBuffer = task.addJob<BloomThreshold>("BloomThreshold", inputs, 4U);
|
const auto bloomInputBuffer = task.addJob<BloomThreshold>("BloomThreshold", inputs, 4U);
|
||||||
|
|
||||||
|
@ -325,7 +312,7 @@ void Bloom::build(JobModel& task, const render::Varying& inputs, render::Varying
|
||||||
const auto& frameBuffer = input[1];
|
const auto& frameBuffer = input[1];
|
||||||
|
|
||||||
// Mix all blur levels at quarter resolution
|
// Mix all blur levels at quarter resolution
|
||||||
const auto applyInput = BloomApply::Inputs(bloomInputBuffer, blurFB0, blurFB1, blurFB2).asVarying();
|
const auto applyInput = BloomApply::Inputs(bloomInputBuffer, blurFB0, blurFB1, blurFB2, input.get2()).asVarying();
|
||||||
task.addJob<BloomApply>("BloomApply", applyInput);
|
task.addJob<BloomApply>("BloomApply", applyInput);
|
||||||
// And then blend result in additive manner on top of final color buffer
|
// And then blend result in additive manner on top of final color buffer
|
||||||
const auto drawInput = BloomDraw::Inputs(frameBuffer, bloomInputBuffer).asVarying();
|
const auto drawInput = BloomDraw::Inputs(frameBuffer, bloomInputBuffer).asVarying();
|
||||||
|
|
|
@ -14,42 +14,21 @@
|
||||||
|
|
||||||
#include <render/Engine.h>
|
#include <render/Engine.h>
|
||||||
|
|
||||||
|
#include "graphics/Bloom.h"
|
||||||
|
|
||||||
#include "DeferredFrameTransform.h"
|
#include "DeferredFrameTransform.h"
|
||||||
|
|
||||||
class BloomConfig : public render::Task::Config {
|
class BloomConfig : public render::Task::Config {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(float intensity READ getIntensity WRITE setIntensity NOTIFY dirty)
|
|
||||||
Q_PROPERTY(float size MEMBER size WRITE setSize NOTIFY dirty)
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
BloomConfig() : render::Task::Config(false) {}
|
|
||||||
|
|
||||||
float size{ 0.7f };
|
|
||||||
|
|
||||||
void setIntensity(float value);
|
|
||||||
float getIntensity() const;
|
|
||||||
void setSize(float value);
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void dirty();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class BloomThresholdConfig : public render::Job::Config {
|
class BloomThresholdConfig : public render::Job::Config {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(float threshold MEMBER threshold NOTIFY dirty)
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
float threshold{ 0.9f };
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void dirty();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class BloomThreshold {
|
class BloomThreshold {
|
||||||
public:
|
public:
|
||||||
using Inputs = render::VaryingSet2<DeferredFrameTransformPointer, gpu::FramebufferPointer>;
|
using Inputs = render::VaryingSet3<DeferredFrameTransformPointer, gpu::FramebufferPointer, graphics::BloomPointer>;
|
||||||
using Outputs = gpu::FramebufferPointer;
|
using Outputs = gpu::FramebufferPointer;
|
||||||
using Config = BloomThresholdConfig;
|
using Config = BloomThresholdConfig;
|
||||||
using JobModel = render::Job::ModelIO<BloomThreshold, Inputs, Outputs, Config>;
|
using JobModel = render::Job::ModelIO<BloomThreshold, Inputs, Outputs, Config>;
|
||||||
|
@ -71,21 +50,11 @@ private:
|
||||||
|
|
||||||
class BloomApplyConfig : public render::Job::Config {
|
class BloomApplyConfig : public render::Job::Config {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(float intensity MEMBER intensity NOTIFY dirty)
|
|
||||||
Q_PROPERTY(float sigma MEMBER sigma NOTIFY dirty)
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
float intensity{ 0.25f };
|
|
||||||
float sigma{ 1.0f };
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void dirty();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class BloomApply {
|
class BloomApply {
|
||||||
public:
|
public:
|
||||||
using Inputs = render::VaryingSet4<gpu::FramebufferPointer, gpu::FramebufferPointer, gpu::FramebufferPointer, gpu::FramebufferPointer>;
|
using Inputs = render::VaryingSet5<gpu::FramebufferPointer, gpu::FramebufferPointer, gpu::FramebufferPointer, gpu::FramebufferPointer, graphics::BloomPointer>;
|
||||||
using Config = BloomApplyConfig;
|
using Config = BloomApplyConfig;
|
||||||
using JobModel = render::Job::ModelI<BloomApply, Inputs, Config>;
|
using JobModel = render::Job::ModelI<BloomApply, Inputs, Config>;
|
||||||
|
|
||||||
|
@ -118,7 +87,7 @@ private:
|
||||||
|
|
||||||
class DebugBloomConfig : public render::Job::Config {
|
class DebugBloomConfig : public render::Job::Config {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(int mode MEMBER mode NOTIFY dirty)
|
Q_PROPERTY(int mode MEMBER mode NOTIFY dirty)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -155,13 +124,13 @@ private:
|
||||||
DebugBloomConfig::Mode _mode;
|
DebugBloomConfig::Mode _mode;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Bloom {
|
class BloomEffect {
|
||||||
public:
|
public:
|
||||||
using Inputs = render::VaryingSet2<DeferredFrameTransformPointer, gpu::FramebufferPointer>;
|
using Inputs = render::VaryingSet3<DeferredFrameTransformPointer, gpu::FramebufferPointer, graphics::BloomPointer>;
|
||||||
using Config = BloomConfig;
|
using Config = BloomConfig;
|
||||||
using JobModel = render::Task::ModelI<Bloom, Inputs, Config>;
|
using JobModel = render::Task::ModelI<BloomEffect, Inputs, Config>;
|
||||||
|
|
||||||
Bloom();
|
BloomEffect();
|
||||||
|
|
||||||
void configure(const Config& config);
|
void configure(const Config& config);
|
||||||
void build(JobModel& task, const render::Varying& inputs, render::Varying& outputs);
|
void build(JobModel& task, const render::Varying& inputs, render::Varying& outputs);
|
||||||
|
|
80
libraries/render-utils/src/BloomStage.cpp
Normal file
80
libraries/render-utils/src/BloomStage.cpp
Normal file
|
@ -0,0 +1,80 @@
|
||||||
|
//
|
||||||
|
// BloomStage.cpp
|
||||||
|
//
|
||||||
|
// Created by Sam Gondelman on 8/7/2018
|
||||||
|
// Copyright 2018 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
#include "BloomStage.h"
|
||||||
|
|
||||||
|
#include "DeferredLightingEffect.h"
|
||||||
|
|
||||||
|
#include <gpu/Context.h>
|
||||||
|
|
||||||
|
std::string BloomStage::_stageName { "BLOOM_STAGE"};
|
||||||
|
const BloomStage::Index BloomStage::INVALID_INDEX { render::indexed_container::INVALID_INDEX };
|
||||||
|
|
||||||
|
FetchBloomStage::FetchBloomStage() {
|
||||||
|
_bloom = std::make_shared<graphics::Bloom>();
|
||||||
|
}
|
||||||
|
|
||||||
|
void FetchBloomStage::configure(const Config& config) {
|
||||||
|
_bloom->setBloomIntensity(config.bloomIntensity);
|
||||||
|
_bloom->setBloomThreshold(config.bloomThreshold);
|
||||||
|
_bloom->setBloomSize(config.bloomSize);
|
||||||
|
_bloom->setBloomActive(config.isBloomActive);
|
||||||
|
}
|
||||||
|
|
||||||
|
BloomStage::Index BloomStage::findBloom(const BloomPointer& bloom) const {
|
||||||
|
auto found = _bloomMap.find(bloom);
|
||||||
|
if (found != _bloomMap.end()) {
|
||||||
|
return INVALID_INDEX;
|
||||||
|
} else {
|
||||||
|
return (*found).second;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BloomStage::Index BloomStage::addBloom(const BloomPointer& bloom) {
|
||||||
|
auto found = _bloomMap.find(bloom);
|
||||||
|
if (found == _bloomMap.end()) {
|
||||||
|
auto bloomId = _blooms.newElement(bloom);
|
||||||
|
// Avoid failing to allocate a bloom, just pass
|
||||||
|
if (bloomId != INVALID_INDEX) {
|
||||||
|
// Insert the bloom and its index in the reverse map
|
||||||
|
_bloomMap.insert(BloomMap::value_type(bloom, bloomId));
|
||||||
|
}
|
||||||
|
return bloomId;
|
||||||
|
} else {
|
||||||
|
return (*found).second;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BloomStage::BloomPointer BloomStage::removeBloom(Index index) {
|
||||||
|
BloomPointer removed = _blooms.freeElement(index);
|
||||||
|
if (removed) {
|
||||||
|
_bloomMap.erase(removed);
|
||||||
|
}
|
||||||
|
return removed;
|
||||||
|
}
|
||||||
|
|
||||||
|
BloomStageSetup::BloomStageSetup() {}
|
||||||
|
|
||||||
|
void BloomStageSetup::run(const render::RenderContextPointer& renderContext) {
|
||||||
|
auto stage = renderContext->_scene->getStage(BloomStage::getName());
|
||||||
|
if (!stage) {
|
||||||
|
renderContext->_scene->resetStage(BloomStage::getName(), std::make_shared<BloomStage>());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void FetchBloomStage::run(const render::RenderContextPointer& renderContext, graphics::BloomPointer& bloom) {
|
||||||
|
auto bloomStage = renderContext->_scene->getStage<BloomStage>();
|
||||||
|
assert(bloomStage);
|
||||||
|
|
||||||
|
bloom = nullptr;
|
||||||
|
if (bloomStage->_currentFrame._blooms.size() != 0) {
|
||||||
|
auto bloomId = bloomStage->_currentFrame._blooms.front();
|
||||||
|
bloom = bloomStage->getBloom(bloomId);
|
||||||
|
}
|
||||||
|
}
|
122
libraries/render-utils/src/BloomStage.h
Normal file
122
libraries/render-utils/src/BloomStage.h
Normal file
|
@ -0,0 +1,122 @@
|
||||||
|
//
|
||||||
|
// BloomStage.h
|
||||||
|
|
||||||
|
// Created by Sam Gondelman on 8/7/2018
|
||||||
|
// Copyright 2018 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef hifi_render_utils_BloomStage_h
|
||||||
|
#define hifi_render_utils_BloomStage_h
|
||||||
|
|
||||||
|
#include <graphics/Stage.h>
|
||||||
|
#include <set>
|
||||||
|
#include <unordered_map>
|
||||||
|
#include <render/IndexedContainer.h>
|
||||||
|
#include <render/Stage.h>
|
||||||
|
|
||||||
|
#include <render/Forward.h>
|
||||||
|
#include <render/DrawTask.h>
|
||||||
|
#include <graphics/Bloom.h>
|
||||||
|
|
||||||
|
// Bloom stage to set up bloom-related rendering tasks
|
||||||
|
class BloomStage : public render::Stage {
|
||||||
|
public:
|
||||||
|
static std::string _stageName;
|
||||||
|
static const std::string& getName() { return _stageName; }
|
||||||
|
|
||||||
|
using Index = render::indexed_container::Index;
|
||||||
|
static const Index INVALID_INDEX;
|
||||||
|
static bool isIndexInvalid(Index index) { return index == INVALID_INDEX; }
|
||||||
|
|
||||||
|
using BloomPointer = graphics::BloomPointer;
|
||||||
|
using Blooms = render::indexed_container::IndexedPointerVector<graphics::Bloom>;
|
||||||
|
using BloomMap = std::unordered_map<BloomPointer, Index>;
|
||||||
|
|
||||||
|
using BloomIndices = std::vector<Index>;
|
||||||
|
|
||||||
|
Index findBloom(const BloomPointer& bloom) const;
|
||||||
|
Index addBloom(const BloomPointer& bloom);
|
||||||
|
|
||||||
|
BloomPointer removeBloom(Index index);
|
||||||
|
|
||||||
|
bool checkBloomId(Index index) const { return _blooms.checkIndex(index); }
|
||||||
|
|
||||||
|
Index getNumBlooms() const { return _blooms.getNumElements(); }
|
||||||
|
Index getNumFreeBlooms() const { return _blooms.getNumFreeIndices(); }
|
||||||
|
Index getNumAllocatedBlooms() const { return _blooms.getNumAllocatedIndices(); }
|
||||||
|
|
||||||
|
BloomPointer getBloom(Index bloomId) const {
|
||||||
|
return _blooms.get(bloomId);
|
||||||
|
}
|
||||||
|
|
||||||
|
Blooms _blooms;
|
||||||
|
BloomMap _bloomMap;
|
||||||
|
|
||||||
|
class Frame {
|
||||||
|
public:
|
||||||
|
Frame() {}
|
||||||
|
|
||||||
|
void clear() { _blooms.clear(); }
|
||||||
|
|
||||||
|
void pushBloom(BloomStage::Index index) { _blooms.emplace_back(index); }
|
||||||
|
|
||||||
|
BloomStage::BloomIndices _blooms;
|
||||||
|
};
|
||||||
|
|
||||||
|
Frame _currentFrame;
|
||||||
|
};
|
||||||
|
using BloomStagePointer = std::shared_ptr<BloomStage>;
|
||||||
|
|
||||||
|
class BloomStageSetup {
|
||||||
|
public:
|
||||||
|
using JobModel = render::Job::Model<BloomStageSetup>;
|
||||||
|
|
||||||
|
BloomStageSetup();
|
||||||
|
void run(const render::RenderContextPointer& renderContext);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
};
|
||||||
|
|
||||||
|
class FetchBloomConfig : public render::Job::Config {
|
||||||
|
Q_OBJECT
|
||||||
|
Q_PROPERTY(float bloomIntensity MEMBER bloomIntensity WRITE setBloomIntensity NOTIFY dirty);
|
||||||
|
Q_PROPERTY(float bloomThreshold MEMBER bloomThreshold WRITE setBloomThreshold NOTIFY dirty);
|
||||||
|
Q_PROPERTY(float bloomSize MEMBER bloomSize WRITE setBloomSize NOTIFY dirty);
|
||||||
|
Q_PROPERTY(bool isBloomActive MEMBER isBloomActive WRITE setBloomActive NOTIFY dirty);
|
||||||
|
|
||||||
|
public:
|
||||||
|
FetchBloomConfig() : render::Job::Config() {}
|
||||||
|
|
||||||
|
float bloomIntensity { graphics::Bloom::INITIAL_BLOOM_INTENSITY };
|
||||||
|
float bloomThreshold { graphics::Bloom::INITIAL_BLOOM_THRESHOLD };
|
||||||
|
float bloomSize { graphics::Bloom::INITIAL_BLOOM_SIZE };
|
||||||
|
|
||||||
|
bool isBloomActive { false };
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void setBloomIntensity(const float value) { bloomIntensity = value; emit dirty(); }
|
||||||
|
void setBloomThreshold(const float value) { bloomThreshold = value; emit dirty(); }
|
||||||
|
void setBloomSize(const float value) { bloomSize = value; emit dirty(); }
|
||||||
|
void setBloomActive(const bool active) { isBloomActive = active; emit dirty(); }
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void dirty();
|
||||||
|
};
|
||||||
|
|
||||||
|
class FetchBloomStage {
|
||||||
|
public:
|
||||||
|
using Config = FetchBloomConfig;
|
||||||
|
using JobModel = render::Job::ModelO<FetchBloomStage, graphics::BloomPointer, Config>;
|
||||||
|
|
||||||
|
FetchBloomStage();
|
||||||
|
|
||||||
|
void configure(const Config& config);
|
||||||
|
void run(const render::RenderContextPointer& renderContext, graphics::BloomPointer& bloom);
|
||||||
|
|
||||||
|
private:
|
||||||
|
graphics::BloomPointer _bloom;
|
||||||
|
};
|
||||||
|
#endif
|
|
@ -163,6 +163,5 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
graphics::HazePointer _haze;
|
graphics::HazePointer _haze;
|
||||||
gpu::PipelinePointer _hazePipeline;
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -45,6 +45,7 @@
|
||||||
#include "TextureCache.h"
|
#include "TextureCache.h"
|
||||||
#include "ZoneRenderer.h"
|
#include "ZoneRenderer.h"
|
||||||
#include "FadeEffect.h"
|
#include "FadeEffect.h"
|
||||||
|
#include "BloomStage.h"
|
||||||
#include "RenderUtilsLogging.h"
|
#include "RenderUtilsLogging.h"
|
||||||
|
|
||||||
#include "AmbientOcclusionEffect.h"
|
#include "AmbientOcclusionEffect.h"
|
||||||
|
@ -171,7 +172,7 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren
|
||||||
const auto velocityBufferOutputs = task.addJob<VelocityBufferPass>("VelocityBuffer", velocityBufferInputs);
|
const auto velocityBufferOutputs = task.addJob<VelocityBufferPass>("VelocityBuffer", velocityBufferInputs);
|
||||||
const auto velocityBuffer = velocityBufferOutputs.getN<VelocityBufferPass::Outputs>(0);
|
const auto velocityBuffer = velocityBufferOutputs.getN<VelocityBufferPass::Outputs>(0);
|
||||||
|
|
||||||
// Clear Light, Haze and Skybox Stages and render zones from the general metas bucket
|
// Clear Light, Haze, Bloom, and Skybox Stages and render zones from the general metas bucket
|
||||||
const auto zones = task.addJob<ZoneRendererTask>("ZoneRenderer", metas);
|
const auto zones = task.addJob<ZoneRendererTask>("ZoneRenderer", metas);
|
||||||
|
|
||||||
// Draw Lights just add the lights to the current list of lights to deal with. NOt really gpu job for now.
|
// Draw Lights just add the lights to the current list of lights to deal with. NOt really gpu job for now.
|
||||||
|
@ -240,8 +241,9 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren
|
||||||
task.addJob<Antialiasing>("Antialiasing", antialiasingInputs);
|
task.addJob<Antialiasing>("Antialiasing", antialiasingInputs);
|
||||||
|
|
||||||
// Add bloom
|
// Add bloom
|
||||||
const auto bloomInputs = Bloom::Inputs(deferredFrameTransform, lightingFramebuffer).asVarying();
|
const auto bloomModel = task.addJob<FetchBloomStage>("BloomModel");
|
||||||
task.addJob<Bloom>("Bloom", bloomInputs);
|
const auto bloomInputs = BloomEffect::Inputs(deferredFrameTransform, lightingFramebuffer, bloomModel).asVarying();
|
||||||
|
task.addJob<BloomEffect>("Bloom", bloomInputs);
|
||||||
|
|
||||||
// Lighting Buffer ready for tone mapping
|
// Lighting Buffer ready for tone mapping
|
||||||
const auto toneMappingInputs = ToneMappingDeferred::Inputs(lightingFramebuffer, scaledPrimaryFramebuffer).asVarying();
|
const auto toneMappingInputs = ToneMappingDeferred::Inputs(lightingFramebuffer, scaledPrimaryFramebuffer).asVarying();
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#include "LightStage.h"
|
#include "LightStage.h"
|
||||||
#include "BackgroundStage.h"
|
#include "BackgroundStage.h"
|
||||||
#include "HazeStage.h"
|
#include "HazeStage.h"
|
||||||
|
#include "BloomStage.h"
|
||||||
#include <render/TransitionStage.h>
|
#include <render/TransitionStage.h>
|
||||||
#include <render/HighlightStage.h>
|
#include <render/HighlightStage.h>
|
||||||
#include "DeferredLightingEffect.h"
|
#include "DeferredLightingEffect.h"
|
||||||
|
@ -22,6 +23,7 @@ void UpdateSceneTask::build(JobModel& task, const render::Varying& input, render
|
||||||
task.addJob<LightStageSetup>("LightStageSetup");
|
task.addJob<LightStageSetup>("LightStageSetup");
|
||||||
task.addJob<BackgroundStageSetup>("BackgroundStageSetup");
|
task.addJob<BackgroundStageSetup>("BackgroundStageSetup");
|
||||||
task.addJob<HazeStageSetup>("HazeStageSetup");
|
task.addJob<HazeStageSetup>("HazeStageSetup");
|
||||||
|
task.addJob<BloomStageSetup>("BloomStageSetup");
|
||||||
task.addJob<render::TransitionStageSetup>("TransitionStageSetup");
|
task.addJob<render::TransitionStageSetup>("TransitionStageSetup");
|
||||||
task.addJob<render::HighlightStageSetup>("HighlightStageSetup");
|
task.addJob<render::HighlightStageSetup>("HighlightStageSetup");
|
||||||
|
|
||||||
|
|
|
@ -21,11 +21,12 @@
|
||||||
#include "StencilMaskPass.h"
|
#include "StencilMaskPass.h"
|
||||||
#include "DeferredLightingEffect.h"
|
#include "DeferredLightingEffect.h"
|
||||||
|
|
||||||
|
|
||||||
#include "render-utils/ShaderConstants.h"
|
#include "render-utils/ShaderConstants.h"
|
||||||
#include "StencilMaskPass.h"
|
#include "StencilMaskPass.h"
|
||||||
#include "DeferredLightingEffect.h"
|
#include "DeferredLightingEffect.h"
|
||||||
|
|
||||||
|
#include "BloomStage.h"
|
||||||
|
|
||||||
namespace ru {
|
namespace ru {
|
||||||
using render_utils::slot::texture::Texture;
|
using render_utils::slot::texture::Texture;
|
||||||
using render_utils::slot::buffer::Buffer;
|
using render_utils::slot::buffer::Buffer;
|
||||||
|
@ -63,7 +64,7 @@ void ZoneRendererTask::build(JobModel& task, const Varying& input, Varying& oupu
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetupZones::run(const RenderContextPointer& context, const Inputs& inputs) {
|
void SetupZones::run(const RenderContextPointer& context, const Inputs& inputs) {
|
||||||
// Grab light, background and haze stages and clear them
|
// Grab light, background, haze, and bloom stages and clear them
|
||||||
auto lightStage = context->_scene->getStage<LightStage>();
|
auto lightStage = context->_scene->getStage<LightStage>();
|
||||||
assert(lightStage);
|
assert(lightStage);
|
||||||
lightStage->_currentFrame.clear();
|
lightStage->_currentFrame.clear();
|
||||||
|
@ -76,6 +77,10 @@ void SetupZones::run(const RenderContextPointer& context, const Inputs& inputs)
|
||||||
assert(hazeStage);
|
assert(hazeStage);
|
||||||
hazeStage->_currentFrame.clear();
|
hazeStage->_currentFrame.clear();
|
||||||
|
|
||||||
|
auto bloomStage = context->_scene->getStage<BloomStage>();
|
||||||
|
assert(bloomStage);
|
||||||
|
bloomStage->_currentFrame.clear();
|
||||||
|
|
||||||
// call render over the zones to grab their components in the correct order first...
|
// call render over the zones to grab their components in the correct order first...
|
||||||
render::renderItems(context, inputs);
|
render::renderItems(context, inputs);
|
||||||
|
|
||||||
|
@ -84,6 +89,7 @@ void SetupZones::run(const RenderContextPointer& context, const Inputs& inputs)
|
||||||
lightStage->_currentFrame.pushAmbientLight(lightStage->getDefaultLight());
|
lightStage->_currentFrame.pushAmbientLight(lightStage->getDefaultLight());
|
||||||
backgroundStage->_currentFrame.pushBackground(0);
|
backgroundStage->_currentFrame.pushBackground(0);
|
||||||
hazeStage->_currentFrame.pushHaze(0);
|
hazeStage->_currentFrame.pushHaze(0);
|
||||||
|
bloomStage->_currentFrame.pushBloom(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
const gpu::PipelinePointer& DebugZoneLighting::getKeyLightPipeline() {
|
const gpu::PipelinePointer& DebugZoneLighting::getKeyLightPipeline() {
|
||||||
|
|
|
@ -678,6 +678,52 @@
|
||||||
</div>
|
</div>
|
||||||
</fieldset-->
|
</fieldset-->
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
<fieldset class="minor">
|
||||||
|
<legend class="sub-section-header zone-group zone-section">
|
||||||
|
Bloom
|
||||||
|
</legend>
|
||||||
|
<form>
|
||||||
|
<input type="radio" name="bloomMode" value="inherit" id="property-zone-bloom-mode-inherit" checked> Inherit
|
||||||
|
<input type="radio" name="bloomMode" value="disabled" id="property-zone-bloom-mode-disabled"> Off
|
||||||
|
<input type="radio" name="bloomMode" value="enabled" id="property-zone-bloom-mode-enabled"> On
|
||||||
|
</form>
|
||||||
|
<fieldset class="zone-group zone-section bloom-section property gen fstuple">
|
||||||
|
<div class="tuple">
|
||||||
|
<div>
|
||||||
|
<br>
|
||||||
|
<table>
|
||||||
|
<td><label>Bloom Intensity 0</label></td>
|
||||||
|
<td><input type="range" class="slider" id="property-zone-bloom-intensity" min="0" max="1" step="0.01"></td>
|
||||||
|
<td><label>1</label>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
<fieldset class="zone-group zone-section bloom-section property gen fstuple">
|
||||||
|
<div class="tuple">
|
||||||
|
<div>
|
||||||
|
<br>
|
||||||
|
<table>
|
||||||
|
<td><label>Bloom Threshold 0</label></td>
|
||||||
|
<td><input type="range" class="slider" id="property-zone-bloom-threshold" min="0" max="1" step="0.01"></td>
|
||||||
|
<td><label>1</label>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
<fieldset class="zone-group zone-section bloom-section property gen fstuple">
|
||||||
|
<div class="tuple">
|
||||||
|
<div>
|
||||||
|
<br>
|
||||||
|
<table>
|
||||||
|
<td><label>Bloom Size 0</label></td>
|
||||||
|
<td><input type="range" class="slider" id="property-zone-bloom-size" min="0" max="2" step="0.01"></td>
|
||||||
|
<td><label>2</label>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
</fieldset>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<fieldset id="text" class="major">
|
<fieldset id="text" class="major">
|
||||||
<legend class="section-header text-group text-section">
|
<legend class="section-header text-group text-section">
|
||||||
|
|
|
@ -839,7 +839,7 @@ function loaded() {
|
||||||
var elZoneHazeModeInherit = document.getElementById("property-zone-haze-mode-inherit");
|
var elZoneHazeModeInherit = document.getElementById("property-zone-haze-mode-inherit");
|
||||||
var elZoneHazeModeDisabled = document.getElementById("property-zone-haze-mode-disabled");
|
var elZoneHazeModeDisabled = document.getElementById("property-zone-haze-mode-disabled");
|
||||||
var elZoneHazeModeEnabled = document.getElementById("property-zone-haze-mode-enabled");
|
var elZoneHazeModeEnabled = document.getElementById("property-zone-haze-mode-enabled");
|
||||||
|
|
||||||
var elZoneHazeRange = document.getElementById("property-zone-haze-range");
|
var elZoneHazeRange = document.getElementById("property-zone-haze-range");
|
||||||
var elZoneHazeColor = document.getElementById("property-zone-haze-color");
|
var elZoneHazeColor = document.getElementById("property-zone-haze-color");
|
||||||
var elZoneHazeColorRed = document.getElementById("property-zone-haze-color-red");
|
var elZoneHazeColorRed = document.getElementById("property-zone-haze-color-red");
|
||||||
|
@ -858,6 +858,15 @@ function loaded() {
|
||||||
|
|
||||||
var elZoneHazeBackgroundBlend = document.getElementById("property-zone-haze-background-blend");
|
var elZoneHazeBackgroundBlend = document.getElementById("property-zone-haze-background-blend");
|
||||||
|
|
||||||
|
// Bloom
|
||||||
|
var elZoneBloomModeInherit = document.getElementById("property-zone-bloom-mode-inherit");
|
||||||
|
var elZoneBloomModeDisabled = document.getElementById("property-zone-bloom-mode-disabled");
|
||||||
|
var elZoneBloomModeEnabled = document.getElementById("property-zone-bloom-mode-enabled");
|
||||||
|
|
||||||
|
var elZoneBloomIntensity = document.getElementById("property-zone-bloom-intensity");
|
||||||
|
var elZoneBloomThreshold = document.getElementById("property-zone-bloom-threshold");
|
||||||
|
var elZoneBloomSize = document.getElementById("property-zone-bloom-size");
|
||||||
|
|
||||||
var elZoneSkyboxColor = document.getElementById("property-zone-skybox-color");
|
var elZoneSkyboxColor = document.getElementById("property-zone-skybox-color");
|
||||||
var elZoneSkyboxColorRed = document.getElementById("property-zone-skybox-color-red");
|
var elZoneSkyboxColorRed = document.getElementById("property-zone-skybox-color-red");
|
||||||
var elZoneSkyboxColorGreen = document.getElementById("property-zone-skybox-color-green");
|
var elZoneSkyboxColorGreen = document.getElementById("property-zone-skybox-color-green");
|
||||||
|
@ -914,19 +923,19 @@ function loaded() {
|
||||||
deleteJSONMaterialEditor();
|
deleteJSONMaterialEditor();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
elTypeIcon.style.display = "none";
|
elTypeIcon.style.display = "none";
|
||||||
elType.innerHTML = "<i>No selection</i>";
|
elType.innerHTML = "<i>No selection</i>";
|
||||||
elPropertiesList.className = '';
|
elPropertiesList.className = '';
|
||||||
|
|
||||||
elID.value = "";
|
elID.value = "";
|
||||||
elName.value = "";
|
elName.value = "";
|
||||||
elLocked.checked = false;
|
elLocked.checked = false;
|
||||||
elVisible.checked = false;
|
elVisible.checked = false;
|
||||||
|
|
||||||
elParentID.value = "";
|
elParentID.value = "";
|
||||||
elParentJointIndex.value = "";
|
elParentJointIndex.value = "";
|
||||||
|
|
||||||
elColorRed.value = "";
|
elColorRed.value = "";
|
||||||
elColorGreen.value = "";
|
elColorGreen.value = "";
|
||||||
elColorBlue.value = "";
|
elColorBlue.value = "";
|
||||||
|
@ -935,15 +944,15 @@ function loaded() {
|
||||||
elPositionX.value = "";
|
elPositionX.value = "";
|
||||||
elPositionY.value = "";
|
elPositionY.value = "";
|
||||||
elPositionZ.value = "";
|
elPositionZ.value = "";
|
||||||
|
|
||||||
elRotationX.value = "";
|
elRotationX.value = "";
|
||||||
elRotationY.value = "";
|
elRotationY.value = "";
|
||||||
elRotationZ.value = "";
|
elRotationZ.value = "";
|
||||||
|
|
||||||
elDimensionsX.value = "";
|
elDimensionsX.value = "";
|
||||||
elDimensionsY.value = "";
|
elDimensionsY.value = "";
|
||||||
elDimensionsZ.value = "";
|
elDimensionsZ.value = "";
|
||||||
|
|
||||||
elRegistrationX.value = "";
|
elRegistrationX.value = "";
|
||||||
elRegistrationY.value = "";
|
elRegistrationY.value = "";
|
||||||
elRegistrationZ.value = "";
|
elRegistrationZ.value = "";
|
||||||
|
@ -965,14 +974,14 @@ function loaded() {
|
||||||
elAccelerationX.value = "";
|
elAccelerationX.value = "";
|
||||||
elAccelerationY.value = "";
|
elAccelerationY.value = "";
|
||||||
elAccelerationZ.value = "";
|
elAccelerationZ.value = "";
|
||||||
|
|
||||||
elRestitution.value = "";
|
elRestitution.value = "";
|
||||||
elFriction.value = "";
|
elFriction.value = "";
|
||||||
elDensity.value = "";
|
elDensity.value = "";
|
||||||
|
|
||||||
elCollisionless.checked = false;
|
elCollisionless.checked = false;
|
||||||
elDynamic.checked = false;
|
elDynamic.checked = false;
|
||||||
|
|
||||||
elCollideStatic.checked = false;
|
elCollideStatic.checked = false;
|
||||||
elCollideKinematic.checked = false;
|
elCollideKinematic.checked = false;
|
||||||
elCollideDynamic.checked = false;
|
elCollideDynamic.checked = false;
|
||||||
|
@ -989,27 +998,27 @@ function loaded() {
|
||||||
elCloneableGroup.style.display = "none";
|
elCloneableGroup.style.display = "none";
|
||||||
elCloneableLimit.value = "";
|
elCloneableLimit.value = "";
|
||||||
elCloneableLifetime.value = "";
|
elCloneableLifetime.value = "";
|
||||||
|
|
||||||
showElements(document.getElementsByClassName('can-cast-shadow-section'), true);
|
showElements(document.getElementsByClassName('can-cast-shadow-section'), true);
|
||||||
elCanCastShadow.checked = false;
|
elCanCastShadow.checked = false;
|
||||||
|
|
||||||
elCollisionSoundURL.value = "";
|
elCollisionSoundURL.value = "";
|
||||||
elLifetime.value = "";
|
elLifetime.value = "";
|
||||||
elScriptURL.value = "";
|
elScriptURL.value = "";
|
||||||
elServerScripts.value = "";
|
elServerScripts.value = "";
|
||||||
elHyperlinkHref.value = "";
|
elHyperlinkHref.value = "";
|
||||||
elDescription.value = "";
|
elDescription.value = "";
|
||||||
|
|
||||||
deleteJSONEditor();
|
deleteJSONEditor();
|
||||||
elUserData.value = "";
|
elUserData.value = "";
|
||||||
showUserDataTextArea();
|
showUserDataTextArea();
|
||||||
showSaveUserDataButton();
|
showSaveUserDataButton();
|
||||||
showNewJSONEditorButton();
|
showNewJSONEditorButton();
|
||||||
|
|
||||||
// Shape Properties
|
// Shape Properties
|
||||||
elShape.value = "Cube";
|
elShape.value = "Cube";
|
||||||
setDropdownText(elShape);
|
setDropdownText(elShape);
|
||||||
|
|
||||||
// Light Properties
|
// Light Properties
|
||||||
elLightSpotLight.checked = false;
|
elLightSpotLight.checked = false;
|
||||||
elLightColor.style.backgroundColor = "rgb(" + 0 + "," + 0 + "," + 0 + ")";
|
elLightColor.style.backgroundColor = "rgb(" + 0 + "," + 0 + "," + 0 + ")";
|
||||||
|
@ -1020,7 +1029,7 @@ function loaded() {
|
||||||
elLightFalloffRadius.value = "";
|
elLightFalloffRadius.value = "";
|
||||||
elLightExponent.value = "";
|
elLightExponent.value = "";
|
||||||
elLightCutoff.value = "";
|
elLightCutoff.value = "";
|
||||||
|
|
||||||
// Model Properties
|
// Model Properties
|
||||||
elModelURL.value = "";
|
elModelURL.value = "";
|
||||||
elCompoundShapeURL.value = "";
|
elCompoundShapeURL.value = "";
|
||||||
|
@ -1037,7 +1046,7 @@ function loaded() {
|
||||||
elModelAnimationAllowTranslation.checked = false;
|
elModelAnimationAllowTranslation.checked = false;
|
||||||
elModelTextures.value = "";
|
elModelTextures.value = "";
|
||||||
elModelOriginalTextures.value = "";
|
elModelOriginalTextures.value = "";
|
||||||
|
|
||||||
// Zone Properties
|
// Zone Properties
|
||||||
elZoneFlyingAllowed.checked = false;
|
elZoneFlyingAllowed.checked = false;
|
||||||
elZoneGhostingAllowed.checked = false;
|
elZoneGhostingAllowed.checked = false;
|
||||||
|
@ -1067,6 +1076,9 @@ function loaded() {
|
||||||
elZoneHazeAltitudeEffect.checked = false;
|
elZoneHazeAltitudeEffect.checked = false;
|
||||||
elZoneHazeBaseRef.value = "";
|
elZoneHazeBaseRef.value = "";
|
||||||
elZoneHazeCeiling.value = "";
|
elZoneHazeCeiling.value = "";
|
||||||
|
elZoneBloomIntensity.value = "";
|
||||||
|
elZoneBloomThreshold.value = "";
|
||||||
|
elZoneBloomSize.value = "";
|
||||||
elZoneSkyboxColor.style.backgroundColor = "rgb(" + 0 + "," + 0 + "," + 0 + ")";
|
elZoneSkyboxColor.style.backgroundColor = "rgb(" + 0 + "," + 0 + "," + 0 + ")";
|
||||||
elZoneSkyboxColorRed.value = "";
|
elZoneSkyboxColorRed.value = "";
|
||||||
elZoneSkyboxColorGreen.value = "";
|
elZoneSkyboxColorGreen.value = "";
|
||||||
|
@ -1076,7 +1088,8 @@ function loaded() {
|
||||||
showElements(document.getElementsByClassName('skybox-section'), true);
|
showElements(document.getElementsByClassName('skybox-section'), true);
|
||||||
showElements(document.getElementsByClassName('ambient-section'), true);
|
showElements(document.getElementsByClassName('ambient-section'), true);
|
||||||
showElements(document.getElementsByClassName('haze-section'), true);
|
showElements(document.getElementsByClassName('haze-section'), true);
|
||||||
|
showElements(document.getElementsByClassName('bloom-section'), true);
|
||||||
|
|
||||||
// Text Properties
|
// Text Properties
|
||||||
elTextText.value = "";
|
elTextText.value = "";
|
||||||
elTextLineHeight.value = "";
|
elTextLineHeight.value = "";
|
||||||
|
@ -1089,14 +1102,14 @@ function loaded() {
|
||||||
elTextBackgroundColorRed.value = "";
|
elTextBackgroundColorRed.value = "";
|
||||||
elTextBackgroundColorGreen.value = "";
|
elTextBackgroundColorGreen.value = "";
|
||||||
elTextBackgroundColorBlue.value = "";
|
elTextBackgroundColorBlue.value = "";
|
||||||
|
|
||||||
// Image Properties
|
// Image Properties
|
||||||
elImageURL.value = "";
|
elImageURL.value = "";
|
||||||
|
|
||||||
// Web Properties
|
// Web Properties
|
||||||
elWebSourceURL.value = "";
|
elWebSourceURL.value = "";
|
||||||
elWebDPI.value = "";
|
elWebDPI.value = "";
|
||||||
|
|
||||||
// Material Properties
|
// Material Properties
|
||||||
elMaterialURL.value = "";
|
elMaterialURL.value = "";
|
||||||
elParentMaterialNameNumber.value = "";
|
elParentMaterialNameNumber.value = "";
|
||||||
|
@ -1107,13 +1120,13 @@ function loaded() {
|
||||||
elMaterialMappingScaleX.value = "";
|
elMaterialMappingScaleX.value = "";
|
||||||
elMaterialMappingScaleY.value = "";
|
elMaterialMappingScaleY.value = "";
|
||||||
elMaterialMappingRot.value = "";
|
elMaterialMappingRot.value = "";
|
||||||
|
|
||||||
deleteJSONMaterialEditor();
|
deleteJSONMaterialEditor();
|
||||||
elMaterialData.value = "";
|
elMaterialData.value = "";
|
||||||
showMaterialDataTextArea();
|
showMaterialDataTextArea();
|
||||||
showSaveMaterialDataButton();
|
showSaveMaterialDataButton();
|
||||||
showNewJSONMaterialEditorButton();
|
showNewJSONMaterialEditorButton();
|
||||||
|
|
||||||
disableProperties();
|
disableProperties();
|
||||||
} else if (data.selections.length > 1) {
|
} else if (data.selections.length > 1) {
|
||||||
deleteJSONEditor();
|
deleteJSONEditor();
|
||||||
|
@ -1250,7 +1263,7 @@ function loaded() {
|
||||||
elCloneableGroup.style.display = elCloneable.checked ? "block": "none";
|
elCloneableGroup.style.display = elCloneable.checked ? "block": "none";
|
||||||
elCloneableLimit.value = properties.cloneLimit;
|
elCloneableLimit.value = properties.cloneLimit;
|
||||||
elCloneableLifetime.value = properties.cloneLifetime;
|
elCloneableLifetime.value = properties.cloneLifetime;
|
||||||
|
|
||||||
var grabbablesSet = false;
|
var grabbablesSet = false;
|
||||||
var parsedUserData = {};
|
var parsedUserData = {};
|
||||||
try {
|
try {
|
||||||
|
@ -1476,6 +1489,14 @@ function loaded() {
|
||||||
elZoneHazeBaseRef.value = properties.haze.hazeBaseRef.toFixed(0);
|
elZoneHazeBaseRef.value = properties.haze.hazeBaseRef.toFixed(0);
|
||||||
elZoneHazeCeiling.value = properties.haze.hazeCeiling.toFixed(0);
|
elZoneHazeCeiling.value = properties.haze.hazeCeiling.toFixed(0);
|
||||||
|
|
||||||
|
elZoneBloomModeInherit.checked = (properties.bloomMode === 'inherit');
|
||||||
|
elZoneBloomModeDisabled.checked = (properties.bloomMode === 'disabled');
|
||||||
|
elZoneBloomModeEnabled.checked = (properties.bloomMode === 'enabled');
|
||||||
|
|
||||||
|
elZoneBloomIntensity.value = properties.bloom.bloomIntensity.toFixed(2);
|
||||||
|
elZoneBloomThreshold.value = properties.bloom.bloomThreshold.toFixed(2);
|
||||||
|
elZoneBloomSize.value = properties.bloom.bloomSize.toFixed(2);
|
||||||
|
|
||||||
elShapeType.value = properties.shapeType;
|
elShapeType.value = properties.shapeType;
|
||||||
elCompoundShapeURL.value = properties.compoundShapeURL;
|
elCompoundShapeURL.value = properties.compoundShapeURL;
|
||||||
|
|
||||||
|
@ -1502,6 +1523,9 @@ function loaded() {
|
||||||
|
|
||||||
showElements(document.getElementsByClassName('haze-section'),
|
showElements(document.getElementsByClassName('haze-section'),
|
||||||
elZoneHazeModeEnabled.checked);
|
elZoneHazeModeEnabled.checked);
|
||||||
|
|
||||||
|
showElements(document.getElementsByClassName('bloom-section'),
|
||||||
|
elZoneBloomModeEnabled.checked);
|
||||||
} else if (properties.type === "PolyVox") {
|
} else if (properties.type === "PolyVox") {
|
||||||
elVoxelVolumeSizeX.value = properties.voxelVolumeSize.x.toFixed(2);
|
elVoxelVolumeSizeX.value = properties.voxelVolumeSize.x.toFixed(2);
|
||||||
elVoxelVolumeSizeY.value = properties.voxelVolumeSize.y.toFixed(2);
|
elVoxelVolumeSizeY.value = properties.voxelVolumeSize.y.toFixed(2);
|
||||||
|
@ -2067,6 +2091,18 @@ function loaded() {
|
||||||
elZoneHazeBackgroundBlend.addEventListener('change',
|
elZoneHazeBackgroundBlend.addEventListener('change',
|
||||||
createEmitGroupNumberPropertyUpdateFunction('haze', 'hazeBackgroundBlend'));
|
createEmitGroupNumberPropertyUpdateFunction('haze', 'hazeBackgroundBlend'));
|
||||||
|
|
||||||
|
// Bloom
|
||||||
|
var bloomModeChanged = createZoneComponentModeChangedFunction('bloomMode',
|
||||||
|
elZoneBloomModeInherit, elZoneBloomModeDisabled, elZoneBloomModeEnabled);
|
||||||
|
|
||||||
|
elZoneBloomModeInherit.addEventListener('change', bloomModeChanged);
|
||||||
|
elZoneBloomModeDisabled.addEventListener('change', bloomModeChanged);
|
||||||
|
elZoneBloomModeEnabled.addEventListener('change', bloomModeChanged);
|
||||||
|
|
||||||
|
elZoneBloomIntensity.addEventListener('change', createEmitGroupNumberPropertyUpdateFunction('bloom', 'bloomIntensity'));
|
||||||
|
elZoneBloomThreshold.addEventListener('change', createEmitGroupNumberPropertyUpdateFunction('bloom', 'bloomThreshold'));
|
||||||
|
elZoneBloomSize.addEventListener('change', createEmitGroupNumberPropertyUpdateFunction('bloom', 'bloomSize'));
|
||||||
|
|
||||||
var zoneSkyboxColorChangeFunction = createEmitGroupColorPropertyUpdateFunction('skybox', 'color',
|
var zoneSkyboxColorChangeFunction = createEmitGroupColorPropertyUpdateFunction('skybox', 'color',
|
||||||
elZoneSkyboxColorRed, elZoneSkyboxColorGreen, elZoneSkyboxColorBlue);
|
elZoneSkyboxColorRed, elZoneSkyboxColorGreen, elZoneSkyboxColorBlue);
|
||||||
elZoneSkyboxColorRed.addEventListener('change', zoneSkyboxColorChangeFunction);
|
elZoneSkyboxColorRed.addEventListener('change', zoneSkyboxColorChangeFunction);
|
||||||
|
|
Loading…
Reference in a new issue