mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 01:03:57 +02:00
WIP - skybox inheritance
This commit is contained in:
parent
64644fc980
commit
85a81d6b5b
2 changed files with 24 additions and 5 deletions
|
@ -179,6 +179,22 @@ void ZoneEntityRenderer::doRender(RenderArgs* args) {
|
|||
_stage->_currentFrame.pushSunLight(_sunIndex);
|
||||
}
|
||||
|
||||
// The background only if the mode is not inherit
|
||||
if (_skyboxMode == COMPONENT_MODE_DISABLED && _skyboxOnIndex == NO_STORED_VALUE) {
|
||||
// Just turned off, store previous value before changing
|
||||
_skyboxOnIndex = _backgroundIndex;
|
||||
_backgroundIndex = _stage->getSunOffLight();
|
||||
}
|
||||
else if (_skyboxMode == COMPONENT_MODE_ENABLED && _skyboxOnIndex != NO_STORED_VALUE) {
|
||||
// Just turned on, restore previous value before clearing stored value
|
||||
_backgroundIndex = _skyboxOnIndex;
|
||||
_skyboxOnIndex = NO_STORED_VALUE;
|
||||
}
|
||||
|
||||
if (_skyboxMode != COMPONENT_MODE_INHERIT) {
|
||||
_backgroundStage->_currentFrame.pushBackground(_backgroundIndex);
|
||||
}
|
||||
|
||||
// The ambient light only if it has a valid texture to render with
|
||||
if (_ambientLightMode == COMPONENT_MODE_DISABLED && _ambientOnIndex == NO_STORED_VALUE) {
|
||||
// Just turned off, store previous value before changing
|
||||
|
@ -195,11 +211,6 @@ void ZoneEntityRenderer::doRender(RenderArgs* args) {
|
|||
_stage->_currentFrame.pushAmbientLight(_ambientIndex);
|
||||
}
|
||||
|
||||
// The background only if the mode is not inherit
|
||||
if (_backgroundMode != BACKGROUND_MODE_INHERIT) {
|
||||
_backgroundStage->_currentFrame.pushBackground(_backgroundIndex);
|
||||
}
|
||||
|
||||
// Haze only if the mode is not inherit
|
||||
if (_hazeMode != COMPONENT_MODE_INHERIT) {
|
||||
_hazeStage->_currentFrame.pushHaze(_hazeIndex);
|
||||
|
@ -214,6 +225,11 @@ void ZoneEntityRenderer::removeFromScene(const ScenePointer& scene, Transaction&
|
|||
}
|
||||
#endif
|
||||
Parent::removeFromScene(scene, transaction);
|
||||
|
||||
// clear flags
|
||||
_sunOnIndex = NO_STORED_VALUE;
|
||||
_ambientOnIndex = NO_STORED_VALUE;
|
||||
_skyboxOnIndex = NO_STORED_VALUE;
|
||||
}
|
||||
|
||||
void ZoneEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& scene, Transaction& transaction, const TypedEntityPointer& entity) {
|
||||
|
@ -399,6 +415,8 @@ void ZoneEntityRenderer::updateHazeFromEntity(const TypedEntityPointer& entity)
|
|||
}
|
||||
|
||||
void ZoneEntityRenderer::updateKeyBackgroundFromEntity(const TypedEntityPointer& entity) {
|
||||
setSkyboxMode((ComponentMode)entity->getSkyboxMode());
|
||||
|
||||
editBackground();
|
||||
setBackgroundMode(entity->getBackgroundMode());
|
||||
setSkyboxColor(_skyboxProperties.getColorVec3());
|
||||
|
|
|
@ -103,6 +103,7 @@ private:
|
|||
const int NO_STORED_VALUE { -1 };
|
||||
indexed_container::Index _sunOnIndex { NO_STORED_VALUE };
|
||||
indexed_container::Index _ambientOnIndex { NO_STORED_VALUE };
|
||||
indexed_container::Index _skyboxOnIndex { NO_STORED_VALUE };
|
||||
|
||||
BackgroundStagePointer _backgroundStage;
|
||||
BackgroundStage::Index _backgroundIndex{ BackgroundStage::INVALID_INDEX };
|
||||
|
|
Loading…
Reference in a new issue