mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-01-30 01:48:15 +03:00
Add linear interpolation of rendered entities
I've added a function Graphics::lerp() which simply interpolates between two values given a certain alpha value. It's just like drawing a straight line between two points. Also, Graphics now has an `alpha` attribute, and it is set on every deltatime update to be used in linear interpolation.
This commit is contained in:
@@ -288,6 +288,12 @@ public:
|
||||
std::map<int, int> font_positions;
|
||||
|
||||
SDL_Surface* ghostbuffer;
|
||||
|
||||
float inline lerp(const float v0, const float v1)
|
||||
{
|
||||
return v0 + alpha * (v1 - v0);
|
||||
}
|
||||
float alpha;
|
||||
};
|
||||
|
||||
extern Graphics graphics;
|
||||
|
||||
Reference in New Issue
Block a user