mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-05-25 21:33:51 +00:00
Initial commit
This commit is contained in:
parent
def8cb4153
commit
b691c43c44
19437 changed files with 4363922 additions and 0 deletions
29
Minecraft.World/SmoothFloat.cpp
Normal file
29
Minecraft.World/SmoothFloat.cpp
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#include "stdafx.h"
|
||||
#include "SmoothFloat.h"
|
||||
|
||||
SmoothFloat::SmoothFloat()
|
||||
{
|
||||
targetValue = 0.0f;
|
||||
remainingValue = 0.0f;
|
||||
lastAmount = 0.0f;
|
||||
}
|
||||
|
||||
float SmoothFloat::getNewDeltaValue(float deltaValue, float accelerationAmount)
|
||||
{
|
||||
targetValue += deltaValue;
|
||||
|
||||
deltaValue = (targetValue - remainingValue) * accelerationAmount;
|
||||
lastAmount = lastAmount + (deltaValue - lastAmount) * 0.5f;
|
||||
if ((deltaValue > 0 && deltaValue > lastAmount) || (deltaValue < 0 && deltaValue < lastAmount))
|
||||
{
|
||||
deltaValue = lastAmount;
|
||||
}
|
||||
remainingValue += deltaValue;
|
||||
|
||||
return deltaValue;
|
||||
}
|
||||
|
||||
float SmoothFloat::getTargetValue()
|
||||
{
|
||||
return targetValue;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue