mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
parent
89afedf3d5
commit
3156488b68
@ -91,15 +91,21 @@ void LinearColorSmoothing::updateLeds()
|
|||||||
_writeToLedsEnable = true;
|
_writeToLedsEnable = true;
|
||||||
float k = 1.0f - 1.0f * deltaTime / (_targetTime - _previousTime);
|
float k = 1.0f - 1.0f * deltaTime / (_targetTime - _previousTime);
|
||||||
|
|
||||||
for (size_t i = 0; i < _previousValues.size(); ++i)
|
int reddif = 0, greendif = 0, bluedif = 0;
|
||||||
{
|
|
||||||
ColorRgb & prev = _previousValues[i];
|
|
||||||
ColorRgb & target = _targetValues[i];
|
|
||||||
|
|
||||||
prev.red += k * (target.red - prev.red);
|
for (size_t i = 0; i < _previousValues.size(); ++i)
|
||||||
prev.green += k * (target.green - prev.green);
|
{
|
||||||
prev.blue += k * (target.blue - prev.blue);
|
ColorRgb & prev = _previousValues[i];
|
||||||
}
|
ColorRgb & target = _targetValues[i];
|
||||||
|
|
||||||
|
reddif = target.red - prev.red;
|
||||||
|
greendif = target.green - prev.green;
|
||||||
|
bluedif = target.blue - prev.blue;
|
||||||
|
|
||||||
|
prev.red += (reddif < 0 ? -1:1) * ceil(k * abs(reddif));
|
||||||
|
prev.green += (greendif < 0 ? -1:1) * ceil(k * abs(greendif));
|
||||||
|
prev.blue += (bluedif < 0 ? -1:1) * ceil(k * abs(bluedif));
|
||||||
|
}
|
||||||
_previousTime = now;
|
_previousTime = now;
|
||||||
|
|
||||||
queueColors(_previousValues);
|
queueColors(_previousValues);
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
// STL includes
|
// STL includes
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
// Qt includes
|
// Qt includes
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
Loading…
Reference in New Issue
Block a user