Allow waypoints to be set with orientation [0,0,0,0] to hide direction.

(Waypoint cube will be aligned to [1,0,0,0])
This commit is contained in:
cim 2015-01-12 18:36:25 +00:00
parent 78faa542c6
commit 6b6502c3b1
2 changed files with 17 additions and 7 deletions

View File

@ -37,6 +37,7 @@ MA 02110-1301, USA.
OOWeakReference *_prevBeacon;
OOWeakReference *_nextBeacon;
id <OOHUDBeaconIcon> _beaconDrawable;
BOOL oriented;
}
+ (instancetype) waypointWithDictionary:(NSDictionary *)info;

View File

@ -50,8 +50,14 @@ MA 02110-1301, USA.
self = [super init];
if (EXPECT_NOT(self == nil)) return nil;
oriented = YES;
position = [info oo_hpvectorForKey:OOWAYPOINT_KEY_POSITION];
[self setOrientation:[info oo_quaternionForKey:OOWAYPOINT_KEY_ORIENTATION]];
Quaternion q = [info oo_quaternionForKey:OOWAYPOINT_KEY_ORIENTATION];
if (quaternion_equal(q,kZeroQuaternion)) {
q = kIdentityQuaternion;
oriented = NO;
}
[self setOrientation:q];
[self setSize:[info oo_nonNegativeFloatForKey:OOWAYPOINT_KEY_SIZE defaultValue:1000.0]];
[self setBeaconCode:[info oo_stringForKey:OOWAYPOINT_KEY_CODE defaultValue:@"W"]];
[self setBeaconLabel:[info oo_stringForKey:OOWAYPOINT_KEY_LABEL defaultValue:@"Waypoint"]];
@ -156,6 +162,8 @@ MA 02110-1301, USA.
}
}
}
if (oriented)
{
while (s1 > 20.0)
{
glVertex3f(-20.0,0,-s1-20.0); glVertex3f(0,0,-s1);
@ -164,6 +172,7 @@ MA 02110-1301, USA.
glVertex3f(20.0,0,s1-20.0); glVertex3f(0,0,s1);
s1 *= 0.5;
}
}
OOGLEND();
OOGL(glDisable(GL_BLEND));