Fade only lights that have fading flag set
This commit is contained in:
parent
357388914c
commit
d5d6b87107
3 changed files with 4 additions and 2 deletions
|
@ -527,6 +527,7 @@ shared_ptr<ModelNode::Light> MdlReader::readLight() {
|
|||
light->affectDynamic = static_cast<bool>(affectDynamic);
|
||||
light->shadow = static_cast<bool>(shadow);
|
||||
light->flareRadius = flareRadius;
|
||||
light->fading = static_cast<bool>(fading);
|
||||
|
||||
int numFlares = static_cast<int>(flareTexturesArrayDef.count);
|
||||
if (numFlares > 0) {
|
||||
|
|
|
@ -121,6 +121,7 @@ public:
|
|||
bool ambientOnly { false };
|
||||
bool affectDynamic { false };
|
||||
bool shadow { false };
|
||||
bool fading { false };
|
||||
float flareRadius { 0.0f };
|
||||
std::vector<LensFlare> flares;
|
||||
};
|
||||
|
|
|
@ -53,10 +53,10 @@ void LightSceneNode::update(float dt) {
|
|||
|
||||
if (_active) {
|
||||
// Fade out
|
||||
_fadeFactor = glm::max(0.0f, _fadeFactor - kFadeSpeed * dt);
|
||||
_fadeFactor = _modelNode->light()->fading ? glm::max(0.0f, _fadeFactor - kFadeSpeed * dt) : 0.0f;
|
||||
} else {
|
||||
// Fade in
|
||||
_fadeFactor = glm::min(1.0f, _fadeFactor + kFadeSpeed * dt);
|
||||
_fadeFactor = _modelNode->light()->fading ? glm::min(1.0f, _fadeFactor + kFadeSpeed * dt) : 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue