mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 04:44:11 +02:00
Ambient light inheritance
This commit is contained in:
parent
9b9295aaec
commit
03cf7710d0
2 changed files with 20 additions and 10 deletions
|
@ -165,14 +165,14 @@ void ZoneEntityRenderer::doRender(RenderArgs* args) {
|
|||
|
||||
if (_visible) {
|
||||
// Finally, push the light visible in the frame
|
||||
if (_keyLightMode == COMPONENT_MODE_DISABLED && sunOnIndex == NO_STORED_VALUE) {
|
||||
if (_keyLightMode == COMPONENT_MODE_DISABLED && _sunOnIndex == NO_STORED_VALUE) {
|
||||
// Just turned off, store previous value before changing
|
||||
sunOnIndex = _sunIndex;
|
||||
_sunOnIndex = _sunIndex;
|
||||
_sunIndex = _stage->getSunOffLight();
|
||||
} else if (_keyLightMode == COMPONENT_MODE_ENABLED && sunOnIndex != NO_STORED_VALUE) {
|
||||
} else if (_keyLightMode == COMPONENT_MODE_ENABLED && _sunOnIndex != NO_STORED_VALUE) {
|
||||
// Just turned on, restore previous value before clearing stored value
|
||||
_sunIndex = sunOnIndex;
|
||||
sunOnIndex = NO_STORED_VALUE;
|
||||
_sunIndex = _sunOnIndex;
|
||||
_sunOnIndex = NO_STORED_VALUE;
|
||||
}
|
||||
|
||||
if (_keyLightMode != COMPONENT_MODE_INHERIT) {
|
||||
|
@ -180,10 +180,19 @@ void ZoneEntityRenderer::doRender(RenderArgs* args) {
|
|||
}
|
||||
|
||||
// The ambient light only if it has a valid texture to render with
|
||||
if (_validAmbientTexture || _validSkyboxTexture) {
|
||||
if (_ambientLightMode != COMPONENT_MODE_INHERIT) {
|
||||
_stage->_currentFrame.pushAmbientLight(_ambientIndex);
|
||||
}
|
||||
if (_ambientLightMode == COMPONENT_MODE_DISABLED && _ambientOnIndex == NO_STORED_VALUE) {
|
||||
// Just turned off, store previous value before changing
|
||||
_ambientOnIndex = _ambientIndex;
|
||||
_ambientIndex = _stage->getAmbientOffLight();
|
||||
}
|
||||
else if (_ambientLightMode == COMPONENT_MODE_ENABLED && _ambientOnIndex != NO_STORED_VALUE) {
|
||||
// Just turned on, restore previous value before clearing stored value
|
||||
_ambientIndex = _ambientOnIndex;
|
||||
_ambientOnIndex = NO_STORED_VALUE;
|
||||
}
|
||||
|
||||
if (_ambientLightMode != COMPONENT_MODE_INHERIT && (_validAmbientTexture || _validSkyboxTexture)) {
|
||||
_stage->_currentFrame.pushAmbientLight(_ambientIndex);
|
||||
}
|
||||
|
||||
// The background only if the mode is not inherit
|
||||
|
|
|
@ -96,7 +96,8 @@ private:
|
|||
indexed_container::Index _ambientIndex{ LightStage::INVALID_INDEX };
|
||||
|
||||
const int NO_STORED_VALUE { -1 };
|
||||
indexed_container::Index sunOnIndex { NO_STORED_VALUE };
|
||||
indexed_container::Index _sunOnIndex { NO_STORED_VALUE };
|
||||
indexed_container::Index _ambientOnIndex { NO_STORED_VALUE };
|
||||
|
||||
BackgroundStagePointer _backgroundStage;
|
||||
BackgroundStage::Index _backgroundIndex{ BackgroundStage::INVALID_INDEX };
|
||||
|
|
Loading…
Reference in a new issue