mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 18:16:45 +02:00
Stay closer to the old code (Use early exit)
This commit is contained in:
parent
911375b7a1
commit
47586e97a6
1 changed files with 43 additions and 37 deletions
|
@ -260,37 +260,55 @@ void EntityTreeRenderer::applyZonePropertiesToScene(std::shared_ptr<ZoneEntityIt
|
||||||
auto sceneKeyLight = sceneStage->getKeyLight();
|
auto sceneKeyLight = sceneStage->getKeyLight();
|
||||||
auto sceneLocation = sceneStage->getLocation();
|
auto sceneLocation = sceneStage->getLocation();
|
||||||
auto sceneTime = sceneStage->getTime();
|
auto sceneTime = sceneStage->getTime();
|
||||||
auto backgroundMode = BACKGROUND_MODE_INHERIT; // Default
|
|
||||||
|
|
||||||
if (zone) {
|
if (!zone) {
|
||||||
backgroundMode = zone->getBackgroundMode();
|
_pendingSkyboxTexture = false;
|
||||||
|
_skyboxTexture.clear();
|
||||||
|
|
||||||
if (!_hasPreviousZone) {
|
if (_hasPreviousZone) {
|
||||||
_previousKeyLightColor = sceneKeyLight->getColor();
|
sceneKeyLight->setColor(_previousKeyLightColor);
|
||||||
_previousKeyLightIntensity = sceneKeyLight->getIntensity();
|
sceneKeyLight->setIntensity(_previousKeyLightIntensity);
|
||||||
_previousKeyLightAmbientIntensity = sceneKeyLight->getAmbientIntensity();
|
sceneKeyLight->setAmbientIntensity(_previousKeyLightAmbientIntensity);
|
||||||
_previousKeyLightDirection = sceneKeyLight->getDirection();
|
sceneKeyLight->setDirection(_previousKeyLightDirection);
|
||||||
_previousStageSunModelEnabled = sceneStage->isSunModelEnabled();
|
sceneStage->setSunModelEnable(_previousStageSunModelEnabled);
|
||||||
_previousStageLongitude = sceneLocation->getLongitude();
|
sceneStage->setLocation(_previousStageLongitude, _previousStageLatitude,
|
||||||
_previousStageLatitude = sceneLocation->getLatitude();
|
_previousStageAltitude);
|
||||||
_previousStageAltitude = sceneLocation->getAltitude();
|
sceneTime->setHour(_previousStageHour);
|
||||||
_previousStageHour = sceneTime->getHour();
|
sceneTime->setDay(_previousStageDay);
|
||||||
_previousStageDay = sceneTime->getDay();
|
_hasPreviousZone = false;
|
||||||
_hasPreviousZone = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sceneKeyLight->setColor(ColorUtils::toVec3(zone->getKeyLightProperties().getColor()));
|
_viewState->endOverrideEnvironmentData();
|
||||||
sceneKeyLight->setIntensity(zone->getKeyLightProperties().getIntensity());
|
skyStage->setBackgroundMode(model::SunSkyStage::SKY_DOME); // let the application atmosphere through
|
||||||
sceneKeyLight->setAmbientIntensity(zone->getKeyLightProperties().getAmbientIntensity());
|
|
||||||
sceneKeyLight->setDirection(zone->getKeyLightProperties().getDirection());
|
return; // Early exit
|
||||||
sceneStage->setSunModelEnable(zone->getStageProperties().getSunModelEnabled());
|
|
||||||
sceneStage->setLocation(zone->getStageProperties().getLongitude(), zone->getStageProperties().getLatitude(),
|
|
||||||
zone->getStageProperties().getAltitude());
|
|
||||||
sceneTime->setHour(zone->getStageProperties().calculateHour());
|
|
||||||
sceneTime->setDay(zone->getStageProperties().calculateDay());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (backgroundMode) {
|
if (!_hasPreviousZone) {
|
||||||
|
_previousKeyLightColor = sceneKeyLight->getColor();
|
||||||
|
_previousKeyLightIntensity = sceneKeyLight->getIntensity();
|
||||||
|
_previousKeyLightAmbientIntensity = sceneKeyLight->getAmbientIntensity();
|
||||||
|
_previousKeyLightDirection = sceneKeyLight->getDirection();
|
||||||
|
_previousStageSunModelEnabled = sceneStage->isSunModelEnabled();
|
||||||
|
_previousStageLongitude = sceneLocation->getLongitude();
|
||||||
|
_previousStageLatitude = sceneLocation->getLatitude();
|
||||||
|
_previousStageAltitude = sceneLocation->getAltitude();
|
||||||
|
_previousStageHour = sceneTime->getHour();
|
||||||
|
_previousStageDay = sceneTime->getDay();
|
||||||
|
_hasPreviousZone = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
sceneKeyLight->setColor(ColorUtils::toVec3(zone->getKeyLightProperties().getColor()));
|
||||||
|
sceneKeyLight->setIntensity(zone->getKeyLightProperties().getIntensity());
|
||||||
|
sceneKeyLight->setAmbientIntensity(zone->getKeyLightProperties().getAmbientIntensity());
|
||||||
|
sceneKeyLight->setDirection(zone->getKeyLightProperties().getDirection());
|
||||||
|
sceneStage->setSunModelEnable(zone->getStageProperties().getSunModelEnabled());
|
||||||
|
sceneStage->setLocation(zone->getStageProperties().getLongitude(), zone->getStageProperties().getLatitude(),
|
||||||
|
zone->getStageProperties().getAltitude());
|
||||||
|
sceneTime->setHour(zone->getStageProperties().calculateHour());
|
||||||
|
sceneTime->setDay(zone->getStageProperties().calculateDay());
|
||||||
|
|
||||||
|
switch (zone->getBackgroundMode()) {
|
||||||
case BACKGROUND_MODE_ATMOSPHERE: {
|
case BACKGROUND_MODE_ATMOSPHERE: {
|
||||||
EnvironmentData data = zone->getEnvironmentData();
|
EnvironmentData data = zone->getEnvironmentData();
|
||||||
glm::vec3 keyLightDirection = sceneKeyLight->getDirection();
|
glm::vec3 keyLightDirection = sceneKeyLight->getDirection();
|
||||||
|
@ -348,18 +366,6 @@ void EntityTreeRenderer::applyZonePropertiesToScene(std::shared_ptr<ZoneEntityIt
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case BACKGROUND_MODE_INHERIT:
|
case BACKGROUND_MODE_INHERIT:
|
||||||
if (_hasPreviousZone) {
|
|
||||||
sceneKeyLight->setColor(_previousKeyLightColor);
|
|
||||||
sceneKeyLight->setIntensity(_previousKeyLightIntensity);
|
|
||||||
sceneKeyLight->setAmbientIntensity(_previousKeyLightAmbientIntensity);
|
|
||||||
sceneKeyLight->setDirection(_previousKeyLightDirection);
|
|
||||||
sceneStage->setSunModelEnable(_previousStageSunModelEnabled);
|
|
||||||
sceneStage->setLocation(_previousStageLongitude, _previousStageLatitude,
|
|
||||||
_previousStageAltitude);
|
|
||||||
sceneTime->setHour(_previousStageHour);
|
|
||||||
sceneTime->setDay(_previousStageDay);
|
|
||||||
_hasPreviousZone = false;
|
|
||||||
}
|
|
||||||
_viewState->endOverrideEnvironmentData();
|
_viewState->endOverrideEnvironmentData();
|
||||||
skyStage->setBackgroundMode(model::SunSkyStage::SKY_DOME); // let the application atmosphere through
|
skyStage->setBackgroundMode(model::SunSkyStage::SKY_DOME); // let the application atmosphere through
|
||||||
_pendingSkyboxTexture = false;
|
_pendingSkyboxTexture = false;
|
||||||
|
|
Loading…
Reference in a new issue