Removed relativePosition cache value - it was probably a pessimization, and I'm pretty certain it was the cause of the lollipop glitch.

git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@4309 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
Jens Ayton 2011-02-11 19:12:01 +00:00
parent cdc44bf283
commit c859266f0a
5 changed files with 9 additions and 22 deletions

View File

@ -120,8 +120,6 @@ enum OOScanClass
OOUniversalID shadingEntityID;
Vector relativePosition;
Entity *collider;
CollisionRegion *collisionRegion; // initially nil - then maintained
@ -198,7 +196,6 @@ enum OOScanClass
- (Vector) absolutePositionForSubentityOffset:(Vector) offset;
- (double) zeroDistance;
- (Vector) relativePosition;
- (NSComparisonResult) compareZeroDistance:(Entity *)otherEntity;
- (BoundingBox) boundingBox;

View File

@ -618,12 +618,6 @@ static NSString * const kOOLogEntityUpdateError = @"entity.linkedList.update.
}
- (Vector) relativePosition
{
return relativePosition;
}
- (NSComparisonResult) compareZeroDistance:(Entity *)otherEntity
{
if ((otherEntity)&&(zero_distance > otherEntity->zero_distance))
@ -853,19 +847,16 @@ static NSString * const kOOLogEntityUpdateError = @"entity.linkedList.update.
- (void) update:(OOTimeDelta)delta_t
{
PlayerEntity *player = PLAYER;
if (player)
if (_status != STATUS_COCKPIT_DISPLAY)
{
if ([self status] != STATUS_COCKPIT_DISPLAY)
relativePosition = vector_between(player->position, position);
else
relativePosition = position;
//
zero_distance = magnitude2(relativePosition);
zero_distance = distance2(PLAYER->position, position);
}
else
zero_distance = -1;
{
zero_distance = magnitude2(position);
}
hasMoved = !vector_equal(position, lastPosition);
hasRotated = !quaternion_equal(orientation, lastOrientation);
lastPosition = position;

View File

@ -174,7 +174,7 @@ OOINLINE void DrawQuadForView(GLfloat x, GLfloat y, GLfloat z, GLfloat sz)
{
float distanceThreshold = collision_radius * 2.0f; // Distance between player and middle of effect where we start to transition to "non-fast rendering."
float thresholdSq = distanceThreshold * distanceThreshold;
float distanceSq = magnitude2(relativePosition);
float distanceSq = zero_distance;
if (distanceSq > thresholdSq)
{

View File

@ -764,7 +764,7 @@ static BOOL hostiles;
}
ms_blip -= floor(ms_blip);
relativePosition = drawthing->relativePosition;
relativePosition = vector_subtract([drawthing position], [PLAYER position]);
Vector rp = relativePosition;
if (act_dist > max_zoomed_range)

View File

@ -3733,10 +3733,9 @@ static BOOL MaintainLinkedLists(Universe *uni)
// maintain sorted list (and for the scanner relative position)
Vector entity_pos = entity->position;
Vector delta = vector_between(entity_pos, ((PlayerEntity *)PLAYER)->position);
Vector delta = vector_between(entity_pos, PLAYER->position);
double z_distance = magnitude2(delta);
entity->zero_distance = z_distance;
entity->relativePosition = delta;
unsigned index = n_entities;
sortedEntities[index] = entity;
entity->zero_index = index;