Navigation Menu

Skip to content

Commit

Permalink
Client|Shadow Bias|IllumInfo: Retain InterpolateInfo when merging an …
Browse files Browse the repository at this point in the history
…in-progress bias interpolation

Avoid unnecessarily free'ing and then immediately re-allocating this
data when merging an in-progress interpolation.
  • Loading branch information
danij-deng committed Aug 4, 2013
1 parent f1e76ae commit 305bd5d
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions doomsday/client/src/render/biasillum.cpp
Expand Up @@ -130,7 +130,7 @@ DENG2_PIMPL_NOREF(BiasIllum)
if(!lerpInfo.isNull())
{
// Must not lose the half-way interpolation.
Vector3f mid; lerp(mid, biasTime);
Vector3f mid; lerp(mid, biasTime, true /*retain InterpolateInfo*/);

// This is current color at this very moment.
color = mid;
Expand Down Expand Up @@ -207,10 +207,11 @@ DENG2_PIMPL_NOREF(BiasIllum)
/**
* Interpolate color from current to destination.
*
* @param result Interpolated color will be written here.
* @param currentTime Time in milliseconds of the last bias frame update.
* @param result Interpolated color will be written here.
* @param currentTime Time in milliseconds of the last bias frame update.
* @param retainlerpInfo @c true= do not free the interpolation info if completed.
*/
void lerp(Vector3f &result, uint currentTime)
void lerp(Vector3f &result, uint currentTime, bool retainLerpInfo = false)
{
if(lerpInfo.isNull())
{
Expand All @@ -224,9 +225,10 @@ DENG2_PIMPL_NOREF(BiasIllum)
if(inter > 1)
{
color = lerpInfo->dest;
lerpInfo.reset();

result = color;

if(!retainLerpInfo)
lerpInfo.reset();
}
else
{
Expand Down

0 comments on commit 305bd5d

Please sign in to comment.