mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 19:59:28 +02:00
Corrected pushing of default lights.
This commit is contained in:
parent
8042b4b3fb
commit
b53e411184
3 changed files with 10 additions and 11 deletions
|
@ -360,8 +360,7 @@ LightStage::LightPointer LightStage::removeLight(Index index) {
|
||||||
|
|
||||||
LightStage::LightPointer LightStage::getCurrentKeyLight() const {
|
LightStage::LightPointer LightStage::getCurrentKeyLight() const {
|
||||||
Index keyLightId{ _defaultLightId };
|
Index keyLightId{ _defaultLightId };
|
||||||
// There is always at least 1 light (the off light)
|
if (!_currentFrame._sunLights.empty()) {
|
||||||
if (_currentFrame._sunLights.size() > 1) {
|
|
||||||
keyLightId = _currentFrame._sunLights.front();
|
keyLightId = _currentFrame._sunLights.front();
|
||||||
}
|
}
|
||||||
return _lights.get(keyLightId);
|
return _lights.get(keyLightId);
|
||||||
|
@ -369,8 +368,7 @@ LightStage::LightPointer LightStage::getCurrentKeyLight() const {
|
||||||
|
|
||||||
LightStage::LightPointer LightStage::getCurrentAmbientLight() const {
|
LightStage::LightPointer LightStage::getCurrentAmbientLight() const {
|
||||||
Index keyLightId { _defaultLightId };
|
Index keyLightId { _defaultLightId };
|
||||||
// There is always at least 1 light (the off light)
|
if (!_currentFrame._ambientLights.empty()) {
|
||||||
if (_currentFrame._ambientLights.size() > 1) {
|
|
||||||
keyLightId = _currentFrame._ambientLights.front();
|
keyLightId = _currentFrame._ambientLights.front();
|
||||||
}
|
}
|
||||||
return _lights.get(keyLightId);
|
return _lights.get(keyLightId);
|
||||||
|
@ -378,8 +376,7 @@ LightStage::LightPointer LightStage::getCurrentAmbientLight() const {
|
||||||
|
|
||||||
LightStage::ShadowPointer LightStage::getCurrentKeyShadow() const {
|
LightStage::ShadowPointer LightStage::getCurrentKeyShadow() const {
|
||||||
Index keyLightId { _defaultLightId };
|
Index keyLightId { _defaultLightId };
|
||||||
// There is always at least 1 light (the off light)
|
if (!_currentFrame._sunLights.empty()) {
|
||||||
if (_currentFrame._sunLights.size() > 1) {
|
|
||||||
keyLightId = _currentFrame._sunLights.front();
|
keyLightId = _currentFrame._sunLights.front();
|
||||||
}
|
}
|
||||||
auto shadow = getShadow(keyLightId);
|
auto shadow = getShadow(keyLightId);
|
||||||
|
@ -389,8 +386,7 @@ LightStage::ShadowPointer LightStage::getCurrentKeyShadow() const {
|
||||||
|
|
||||||
LightStage::LightAndShadow LightStage::getCurrentKeyLightAndShadow() const {
|
LightStage::LightAndShadow LightStage::getCurrentKeyLightAndShadow() const {
|
||||||
Index keyLightId { _defaultLightId };
|
Index keyLightId { _defaultLightId };
|
||||||
// There is always at least 1 light (the off light)
|
if (!_currentFrame._sunLights.empty()) {
|
||||||
if (_currentFrame._sunLights.size() > 1) {
|
|
||||||
keyLightId = _currentFrame._sunLights.front();
|
keyLightId = _currentFrame._sunLights.front();
|
||||||
}
|
}
|
||||||
auto shadow = getShadow(keyLightId);
|
auto shadow = getShadow(keyLightId);
|
||||||
|
|
|
@ -119,6 +119,8 @@ public:
|
||||||
|
|
||||||
Index findLight(const LightPointer& light) const;
|
Index findLight(const LightPointer& light) const;
|
||||||
Index addLight(const LightPointer& light, const bool shouldSetAsDefault = false);
|
Index addLight(const LightPointer& light, const bool shouldSetAsDefault = false);
|
||||||
|
|
||||||
|
const Index getDefaultLight() const { return _defaultLightId; }
|
||||||
|
|
||||||
Index addShadow(Index lightIndex, float maxDistance = 20.0f, unsigned int cascadeCount = 1U);
|
Index addShadow(Index lightIndex, float maxDistance = 20.0f, unsigned int cascadeCount = 1U);
|
||||||
|
|
||||||
|
|
|
@ -68,10 +68,11 @@ void SetupZones::run(const RenderContextPointer& context, const Inputs& inputs)
|
||||||
auto lightStage = context->_scene->getStage<LightStage>();
|
auto lightStage = context->_scene->getStage<LightStage>();
|
||||||
assert(lightStage);
|
assert(lightStage);
|
||||||
|
|
||||||
lightStage->_currentFrame.pushSunLight(0);
|
lightStage->_currentFrame.pushSunLight(lightStage->getDefaultLight());
|
||||||
lightStage->_currentFrame.pushAmbientLight(0);
|
lightStage->_currentFrame.pushAmbientLight(lightStage->getDefaultLight());
|
||||||
hazeStage->_currentFrame.pushHaze(0);
|
|
||||||
backgroundStage->_currentFrame.pushBackground(0);
|
backgroundStage->_currentFrame.pushBackground(0);
|
||||||
|
hazeStage->_currentFrame.pushHaze(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
const gpu::PipelinePointer& DebugZoneLighting::getKeyLightPipeline() {
|
const gpu::PipelinePointer& DebugZoneLighting::getKeyLightPipeline() {
|
||||||
|
|
Loading…
Reference in a new issue