mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-16 22:30:42 +02:00
Merge pull request #12177 from NissimHadar/defaultAmbientFix
Set ambient mode to inherit if no URLs have been entered.
This commit is contained in:
commit
9a382ebb86
2 changed files with 23 additions and 15 deletions
|
@ -162,28 +162,31 @@ void ZoneEntityRenderer::doRender(RenderArgs* args) {
|
|||
}
|
||||
|
||||
if (_visible) {
|
||||
// Finally, push the light visible in the frame
|
||||
// Finally, push the lights visible in the frame
|
||||
//
|
||||
// If component is disabled then push component off state
|
||||
// else if component is enabled then push current state
|
||||
// (else mode is inherit, the value from the parent zone will be used
|
||||
//
|
||||
if (_keyLightMode == COMPONENT_MODE_DISABLED) {
|
||||
_stage->_currentFrame.pushSunLight(_stage->getSunOffLight());
|
||||
} else if (_keyLightMode == COMPONENT_MODE_ENABLED) {
|
||||
_stage->_currentFrame.pushSunLight(_sunIndex);
|
||||
}
|
||||
|
||||
// The background only if the mode is not inherit
|
||||
if (_skyboxMode == COMPONENT_MODE_DISABLED) {
|
||||
_backgroundStage->_currentFrame.pushBackground(INVALID_INDEX);
|
||||
} else if (_skyboxMode == COMPONENT_MODE_ENABLED) {
|
||||
_backgroundStage->_currentFrame.pushBackground(_backgroundIndex);
|
||||
}
|
||||
|
||||
// The ambient light only if it has a valid texture to render with
|
||||
if (_ambientLightMode == COMPONENT_MODE_DISABLED) {
|
||||
_stage->_currentFrame.pushAmbientLight(_stage->getAmbientOffLight());
|
||||
} else if (_ambientLightMode == COMPONENT_MODE_ENABLED) {
|
||||
_stage->_currentFrame.pushAmbientLight(_ambientIndex);
|
||||
}
|
||||
|
||||
// Haze only if the mode is not inherit
|
||||
// Haze only if the mode is not inherit, as the model deals with on/off
|
||||
if (_hazeMode != COMPONENT_MODE_INHERIT) {
|
||||
_hazeStage->_currentFrame.pushHaze(_hazeIndex);
|
||||
}
|
||||
|
|
|
@ -2283,30 +2283,35 @@ bool EntityTree::readFromMap(QVariantMap& map) {
|
|||
properties.setOwningAvatarID(myNodeID);
|
||||
}
|
||||
|
||||
// Fix for older content not containing these fields in the zones
|
||||
// Fix for older content not containing mode fields in the zones
|
||||
if (needsConversion && (properties.getType() == EntityTypes::EntityType::Zone)) {
|
||||
// The legacy version had no keylight mode - this is set to on
|
||||
properties.setKeyLightMode(COMPONENT_MODE_ENABLED);
|
||||
|
||||
// The ambient URL has been moved from "keyLight" to "ambientLight"
|
||||
if (entityMap.contains("keyLight")) {
|
||||
QVariantMap keyLightObject = entityMap["keyLight"].toMap();
|
||||
properties.getAmbientLight().setAmbientURL(keyLightObject["ambientURL"].toString());
|
||||
}
|
||||
|
||||
// Copy the skybox URL if the ambient URL is empty, as this is the legacy behaviour
|
||||
// Use skybox value only if it is not empty, else set ambientMode to inherit (to use default URL)
|
||||
properties.setAmbientLightMode(COMPONENT_MODE_ENABLED);
|
||||
if (properties.getAmbientLight().getAmbientURL() == "") {
|
||||
if (properties.getSkybox().getURL() != "") {
|
||||
properties.getAmbientLight().setAmbientURL(properties.getSkybox().getURL());
|
||||
} else {
|
||||
properties.setAmbientLightMode(COMPONENT_MODE_INHERIT);
|
||||
}
|
||||
}
|
||||
|
||||
// The background should be enabled if the mode is skybox
|
||||
// Note that if the values are default then they are not stored in the JSON file
|
||||
if (entityMap.contains("backgroundMode") && (entityMap["backgroundMode"].toString() == "skybox")) {
|
||||
properties.setSkyboxMode(COMPONENT_MODE_ENABLED);
|
||||
|
||||
// Copy the skybox URL if the ambient URL is empty, as this is the legacy behaviour
|
||||
if (properties.getAmbientLight().getAmbientURL() == "") {
|
||||
properties.getAmbientLight().setAmbientURL(properties.getSkybox().getURL());
|
||||
}
|
||||
} else {
|
||||
} else {
|
||||
properties.setSkyboxMode(COMPONENT_MODE_INHERIT);
|
||||
}
|
||||
|
||||
// The legacy version had no keylight/ambient modes - these are always on
|
||||
properties.setKeyLightMode(COMPONENT_MODE_ENABLED);
|
||||
properties.setAmbientLightMode(COMPONENT_MODE_ENABLED);
|
||||
}
|
||||
|
||||
EntityItemPointer entity = addEntity(entityItemID, properties);
|
||||
|
|
Loading…
Reference in a new issue