mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-10-04 13:27:14 +00:00
Fix some small performance bottlenecks:
- Vector interpolation. Also removed unused interpolation trigger events. - Game::collideCircleWithGrid() - GridRender::onRender() (removed Andrew's hack, use fixed map file!) - make use of glVertex3i() & memchr() in GridRender
This commit is contained in:
parent
99e32e0ee7
commit
2d7eeb4781
12 changed files with 183 additions and 345 deletions
|
@ -435,7 +435,6 @@ public:
|
|||
void realPercentageCalc();
|
||||
void removeNodes(int startInclusive, int endInclusive);
|
||||
float getSubSectionLength(int startIncl, int endIncl);
|
||||
void subdivide();
|
||||
protected:
|
||||
std::vector <VectorPathNode> pathNodes;
|
||||
};
|
||||
|
@ -446,52 +445,34 @@ struct InterpolatedVectorData
|
|||
{
|
||||
InterpolatedVectorData()
|
||||
{
|
||||
trigger = 0;
|
||||
triggerFlag = false;
|
||||
pendingInterpolation = false;
|
||||
interpolating = false;
|
||||
pingPong = false;
|
||||
loopType = 0;
|
||||
pathTimer = 0;
|
||||
pathTime = 0;
|
||||
pathSpeed = 1;
|
||||
currentPathNode = 0;
|
||||
pathTimeMultiplier = 1;
|
||||
timePassed = 0;
|
||||
timePeriod = 0;
|
||||
timeSpeedMultiplier = 1;
|
||||
timeSpeedEase = 0;
|
||||
//fakeTimePassed = 0;
|
||||
speedPath = false;
|
||||
ease = false;
|
||||
followingPath = false;
|
||||
}
|
||||
|
||||
InterpolatedVector *trigger;
|
||||
bool triggerFlag;
|
||||
bool pendingInterpolation;
|
||||
Vector from;
|
||||
Vector target;
|
||||
|
||||
VectorPath path;
|
||||
|
||||
int loopType;
|
||||
|
||||
float pathTimer, pathTime;
|
||||
float pathSpeed;
|
||||
float pathTimeMultiplier;
|
||||
float timePassed, timePeriod;
|
||||
|
||||
bool interpolating;
|
||||
bool pingPong;
|
||||
int loopType;
|
||||
|
||||
EventPtr endOfInterpolationEvent;
|
||||
EventPtr startOfInterpolationEvent;
|
||||
EventPtr endOfPathEvent;
|
||||
|
||||
VectorPath path;
|
||||
float pathTimer, pathTime;
|
||||
float pathSpeed;
|
||||
int currentPathNode;
|
||||
float pathTimeMultiplier;
|
||||
|
||||
float timePassed, timePeriod;
|
||||
Vector target;
|
||||
Vector from;
|
||||
|
||||
float timeSpeedMultiplier, timeSpeedEase;
|
||||
//float fakeTimePassed;
|
||||
bool speedPath;
|
||||
bool ease;
|
||||
bool followingPath;
|
||||
};
|
||||
|
@ -530,7 +511,6 @@ public:
|
|||
return *this;
|
||||
}
|
||||
|
||||
void setInterpolationTrigger(InterpolatedVector *trigger, bool triggerFlag);
|
||||
enum InterpolateToFlag { NONE=0, IS_LOOPING };
|
||||
float interpolateTo (Vector vec, float timePeriod, int loopType = 0, bool pingPong = false, bool ease = false, InterpolateToFlag flag = NONE);
|
||||
void inline update(float dt)
|
||||
|
@ -538,16 +518,6 @@ public:
|
|||
if (!data)
|
||||
return;
|
||||
|
||||
if (data->pendingInterpolation && data->trigger)
|
||||
{
|
||||
if (data->trigger->isInterpolating() == data->triggerFlag)
|
||||
{
|
||||
data->interpolating = true;
|
||||
data->pendingInterpolation = false;
|
||||
}
|
||||
else
|
||||
return;
|
||||
}
|
||||
if (isFollowingPath())
|
||||
{
|
||||
updatePath(dt);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue