diff --git a/src/Core/Entities/OOWaypointEntity.h b/src/Core/Entities/OOWaypointEntity.h index 85714960..b13c0c86 100644 --- a/src/Core/Entities/OOWaypointEntity.h +++ b/src/Core/Entities/OOWaypointEntity.h @@ -37,6 +37,7 @@ MA 02110-1301, USA. OOWeakReference *_prevBeacon; OOWeakReference *_nextBeacon; id _beaconDrawable; + BOOL oriented; } + (instancetype) waypointWithDictionary:(NSDictionary *)info; diff --git a/src/Core/Entities/OOWaypointEntity.m b/src/Core/Entities/OOWaypointEntity.m index 28096b02..b76c3c2f 100644 --- a/src/Core/Entities/OOWaypointEntity.m +++ b/src/Core/Entities/OOWaypointEntity.m @@ -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,13 +162,16 @@ MA 02110-1301, USA. } } } - while (s1 > 20.0) + if (oriented) { - glVertex3f(-20.0,0,-s1-20.0); glVertex3f(0,0,-s1); - glVertex3f(20.0,0,-s1-20.0); glVertex3f(0,0,-s1); - glVertex3f(-20.0,0,s1-20.0); glVertex3f(0,0,s1); - glVertex3f(20.0,0,s1-20.0); glVertex3f(0,0,s1); - s1 *= 0.5; + while (s1 > 20.0) + { + glVertex3f(-20.0,0,-s1-20.0); glVertex3f(0,0,-s1); + glVertex3f(20.0,0,-s1-20.0); glVertex3f(0,0,-s1); + glVertex3f(-20.0,0,s1-20.0); glVertex3f(0,0,s1); + glVertex3f(20.0,0,s1-20.0); glVertex3f(0,0,s1); + s1 *= 0.5; + } } OOGLEND();