Oolite
Loading...
Searching...
No Matches
SkyEntity Class Reference

#include <SkyEntity.h>

Inheritance diagram for SkyEntity:
Collaboration diagram for SkyEntity:

Instance Methods

(id) - initWithColors:col2:andSystemInfo:
(BOOL) - changeProperty:withDictionary:
(OOColor *) - skyColor
(void) - dealloc [implementation]
(void) - update: [implementation]
(BOOL) - isSky [implementation]
(BOOL) - isVisible [implementation]
(BOOL) - canCollide [implementation]
(GLfloat) - cameraRangeFront [implementation]
(GLfloat) - cameraRangeBack [implementation]
(void) - drawImmediate:translucent: [implementation]
(BOOL) - readColor1:andColor2:andColor3:andColor4:fromDictionary: [implementation]
Instance Methods inherited from OOEntityWithDrawable
(OODrawable *) - drawable
(void) - setDrawable:
(double) - findCollisionRadius [implementation]
Instance Methods inherited from Entity
(NSUInteger) - sessionID
(BOOL) - isShip
(BOOL) - isDock
(BOOL) - isStation
(BOOL) - isSubEntity
(BOOL) - isPlayer
(BOOL) - isPlanet
(BOOL) - isSun
(BOOL) - isSunlit
(BOOL) - isStellarObject
(BOOL) - isWormhole
(BOOL) - isEffect
(BOOL) - isVisualEffect
(BOOL) - isWaypoint
(BOOL) - validForAddToUniverse
(void) - addToLinkedLists
(void) - removeFromLinkedLists
(void) - updateLinkedLists
(void) - wasAddedToUniverse
(void) - wasRemovedFromUniverse
(void) - warnAboutHostiles
(CollisionRegion *) - collisionRegion
(void) - setCollisionRegion:
(void) - setUniversalID:
(OOUniversalID) - universalID
(BOOL) - throwingSparks
(void) - setThrowSparks:
(void) - throwSparks
(void) - setOwner:
(id) - owner
(ShipEntity *) - parentEntity
(ShipEntity *) - rootShipEntity
(void) - setPosition:
(void) - setPositionX:y:z:
(HPVector) - position
(Vector) - cameraRelativePosition
(void) - updateCameraRelativePosition
(Vector) - vectorTo:
(HPVector) - absolutePositionForSubentity
(HPVector) - absolutePositionForSubentityOffset:
(double) - zeroDistance
(double) - camZeroDistance
(NSComparisonResult) - compareZeroDistance:
(BoundingBox) - boundingBox
(GLfloat) - mass
(Quaternion) - orientation
(void) - setOrientation:
(Quaternion) - normalOrientation
(void) - setNormalOrientation:
(void) - orientationChanged
(void) - setVelocity:
(Vector) - velocity
(double) - speed
(GLfloat) - distanceTravelled
(void) - setDistanceTravelled:
(void) - setStatus:
(OOEntityStatus) - status
(void) - setScanClass:
(OOScanClass) - scanClass
(void) - setEnergy:
(GLfloat) - energy
(void) - setMaxEnergy:
(GLfloat) - maxEnergy
(void) - applyRoll:andClimb:
(void) - applyRoll:climb:andYaw:
(void) - moveForward:
(OOMatrix) - rotationMatrix
(OOMatrix) - drawRotationMatrix
(OOMatrix) - transformationMatrix
(OOMatrix) - drawTransformationMatrix
(GLfloat) - collisionRadius
(GLfloat) - frustumRadius
(void) - setCollisionRadius:
(NSMutableArray *) - collisionArray
(void) - applyVelocity:
(BOOL) - checkCloseCollisionWith:
(void) - takeEnergyDamage:from:becauseOf:weaponIdentifier:
(void) - dumpState
(void) - dumpSelfState
(NSUInteger) - lastDrawCounter
(void) - setLastDrawCounter:
(BOOL) - isInSpace
(BOOL) - isImmuneToBreakPatternHide
(GLfloat) - universalTime
(GLfloat) - spawnTime
(GLfloat) - timeElapsedSinceSpawn
(void) - setAtmosphereFogging:
(OOColor *) - fogUniform
(id) - init [implementation]
(NSString *) - descriptionComponents [implementation]
(BOOL) - checkLinkedLists [implementation]
(id< OOWeakReferenceSupport >) - superShaderBindingTarget [implementation]
(Vector) - relativePosition [implementation]
(void) - subEntityReallyDied: [implementation]
(BOOL) - isBreakPattern
(BOOL) - isECMBlast
(BOOL) - isExhaust
(BOOL) - isFlasher
(BOOL) - isVisibleToScripts
(BOOL) - isVisibleToScripts
(NSString *) - oo_jsClassName
(NSString *) - oo_jsClassName
(void) - getJSClass:andPrototype:
(void) - deleteJSSelf
(void) - deleteJSSelf
(JSClassID) - oo_jsClassID
(jsval) - oo_jsValueInContext: [implementation]
(BOOL) - isCascadeWeapon
(BOOL) - isPlayerLikeShip
(GLfloat) - clock [implementation]
(unsigned) - pseudoFixedD100 [implementation]
(unsigned) - pseudoFixedD256 [implementation]
(unsigned) - systemGovernment [implementation]
(unsigned) - systemEconomy [implementation]
(unsigned) - systemTechLevel [implementation]
(unsigned) - systemPopulation [implementation]
(unsigned) - systemProductivity [implementation]
(BOOL) - isShipWithSubEntityShip:
(void) - drawSubEntityImmediate:translucent: [implementation]
Instance Methods inherited from OOWeakRefObject
(id) - weakSelf
(id) - weakRetain [implementation]
(void) - weakRefDied: [implementation]
Instance Methods inherited from <OOWeakReferenceSupport>
(id) - OO_RETURNS_RETAINED

Protected Attributes

OOColor * skyColor
Protected Attributes inherited from Entity
HPVector lastPosition
Quaternion lastOrientation
GLfloat distanceTravelled
OOMatrix rotMatrix
Vector velocity
GLfloat energy
GLfloat maxEnergy
BoundingBox boundingBox
GLfloat mass
NSMutableArray * collidingEntities
OOTimeAbsolute spawnTime
struct JSObject * _jsSelf
NSUInteger lastDrawCounter
Protected Attributes inherited from OOWeakRefObject
OOWeakReference * weakSelf

Additional Inherited Members

Public Attributes inherited from Entity
OOUniversalID universalID
unsigned isShip: 1
unsigned isStation: 1
unsigned isPlayer: 1
unsigned isWormhole: 1
unsigned isSubEntity: 1
unsigned hasMoved: 1
unsigned hasRotated: 1
unsigned hasCollided: 1
unsigned isSunlit: 1
unsigned collisionTestFilter: 2
unsigned throw_sparks: 1
unsigned isImmuneToBreakPatternHide: 1
unsigned isExplicitlyNotMainStation: 1
unsigned isVisualEffect: 1
OOScanClass scanClass
GLfloat zero_distance
GLfloat cam_zero_distance
GLfloat no_draw_distance
GLfloat collision_radius
HPVector position
Vector cameraRelativePosition
Quaternion orientation
OOColor * atmosphereFogging
int zero_index
Entity * x_previous
Entity * x_next
Entity * y_previous
Entity * y_next
Entity * z_previous
Entity * z_next
Entity * collision_chain
OOUniversalID shadingEntityID
Entity * collider
CollisionRegion * collisionRegion

Detailed Description

Definition at line 31 of file SkyEntity.h.

Method Documentation

◆ cameraRangeBack

- (GLfloat) cameraRangeBack
implementation

Reimplemented from Entity.

Definition at line 202 of file SkyEntity.m.

203{
204 return MAX_CLEAR_DEPTH;
205}
#define MAX_CLEAR_DEPTH

References cameraRangeBack, and MAX_CLEAR_DEPTH.

Referenced by cameraRangeBack.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cameraRangeFront

- (GLfloat) cameraRangeFront
implementation

Reimplemented from Entity.

Definition at line 197 of file SkyEntity.m.

198{
199 return MAX_CLEAR_DEPTH;
200}

References cameraRangeFront, and MAX_CLEAR_DEPTH.

Referenced by cameraRangeFront.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ canCollide

- (BOOL) canCollide
implementation

Reimplemented from Entity.

Definition at line 192 of file SkyEntity.m.

193{
194 return NO;
195}

References canCollide.

Referenced by canCollide.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ changeProperty:withDictionary:

- (BOOL) changeProperty: (NSString*) key
withDictionary: (NSDictionary*) dict 

Definition at line 150 of file SkyEntity.m.

150 :(NSString*)key withDictionary:(NSDictionary*)dict
151{
152 id object = [dict objectForKey:key];
153
154 // TODO: properties requiring reInit?
155 if ([key isEqualToString:@"sun_color"]) {
156 OOColor* col = [[OOColor colorWithDescription:object] retain];
157 if (col != nil) {
158 [skyColor release];
159 skyColor = [col copy];
160 [col release];
161 [UNIVERSE setLighting];
162 }
163 } else {
164 OOLogWARN(@"script.warning", @"Change to property '%@' not applied, will apply only on leaving and re-entering this system.", key);
165 return NO;
166 }
167 return YES;
168}
#define OOLogWARN(class, format,...)
Definition OOLogging.h:126
return nil
OOColor * colorWithDescription:(id description)
Definition OOColor.m:135
OOColor * skyColor
Definition SkyEntity.m:145

References OOColor::colorWithDescription:, nil, OOLogWARN, and skyColor.

Referenced by Universe::setSystemDataForGalaxy:planet:key:value:fromManifest:forLayer:.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dealloc

- (void) dealloc
implementation

Reimplemented from OOEntityWithDrawable.

Definition at line 138 of file SkyEntity.m.

139{
140 [skyColor release];
141
142 [super dealloc];
143}

References OOEntityWithDrawable::dealloc, and dealloc.

Referenced by dealloc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ drawImmediate:translucent:

- (void) drawImmediate: (bool) immediate
translucent: (bool) translucent 
implementation

Reimplemented from OOEntityWithDrawable.

Definition at line 207 of file SkyEntity.m.

207 :(bool)immediate translucent:(bool)translucent
208{
209 if ([UNIVERSE breakPatternHide])
210 return;
211
212 [super drawImmediate:immediate translucent:translucent];
213
214 OOCheckOpenGLErrors(@"SkyEntity after drawing %@", self);
215}
BOOL OOCheckOpenGLErrors(NSString *format,...)
Definition OOOpenGL.m:38
#define UNIVERSE
Definition Universe.h:827

References OOEntityWithDrawable::drawImmediate:translucent:, OOCheckOpenGLErrors(), and UNIVERSE.

Here is the call graph for this function:

◆ initWithColors:col2:andSystemInfo:

- (id) initWithColors: (OOColor*) col1
col2: (OOColor*) col2
andSystemInfo: (NSDictionary*) systemInfo 

Definition at line 51 of file SkyEntity.m.

51 :(OOColor*)col1 col2:(OOColor*)col2 andSystemInfo:(NSDictionary*)systemInfo
52{
53 OOSkyDrawable* skyDrawable;
54 float clusterChance,
55 alpha,
56 scale,
57 starCountMultiplier,
58 nebulaCountMultiplier;
59 signed starCount, // Need to be able to hold -1...
60 nebulaCount;
61
62 self = [super init];
63 if (self == nil)
64 return nil;
65
66 OOColor* col3 = [OOColor colorWithDescription:col1];
67 OOColor* col4 = [OOColor colorWithDescription:col2];
68
69 // Load colours
70 BOOL nebulaColorSet = [self readColor1:&col1 andColor2:&col2 andColor3:&col3 andColor4:&col4 fromDictionary:systemInfo];
71
72 skyColor = [[OOColor colorWithDescription:[systemInfo objectForKey:@"sun_color"]] retain];
73 if (skyColor == nil) {
74 skyColor = [[col2 blendedColorWithFraction:0.5 ofColor:col1] retain];
75 }
76
77 // Load distribution values
78 clusterChance = [systemInfo oo_floatForKey:@"sky_blur_cluster_chance" defaultValue:SKY_clusterChance];
79 alpha = [systemInfo oo_floatForKey:@"sky_blur_alpha" defaultValue:SKY_alpha];
80 scale = [systemInfo oo_floatForKey:@"sky_blur_scale" defaultValue:SKY_scale];
81
82 // Load star count
83 starCount = [systemInfo oo_floatForKey:@"sky_n_stars" defaultValue:-1];
84 starCountMultiplier = [systemInfo oo_floatForKey:@"star_count_multiplier" defaultValue:1.0f];
85 if (starCountMultiplier < 0.0f)
86 starCountMultiplier *= -1.0f;
87 if (0 <= starCount) {
88 // changed for 1.82, default set to 1
89 // lets OXPers modify the broad number without stopping variation
90 starCount *= starCountMultiplier;
91 } else {
92 starCount = starCountMultiplier * SKY_BASIS_STARS * (0.5 + randf());
93 }
94
95 // ...and nebula count. (Note: simplifying this would change the appearance of stars/blobs.)
96 nebulaCount = [systemInfo oo_floatForKey:@"sky_n_blurs" defaultValue:-1];
97 nebulaCountMultiplier = [systemInfo oo_floatForKey:@"nebula_count_multiplier" defaultValue:1.0f];
98 if (nebulaCountMultiplier < 0.0f)
99 nebulaCountMultiplier *= -1.0f;
100 if (0 <= nebulaCount) {
101 // changed for 1.82, default set to 1
102 // lets OXPers modify the broad number without stopping variation
103 nebulaCount *= nebulaCountMultiplier;
104 } else {
105 nebulaCount = nebulaCountMultiplier * SKY_BASIS_BLOBS * (0.5 + randf());
106 }
107
108 if ([UNIVERSE reducedDetail]) {
109 // limit stars and blobs to basis levels, and halve stars again
110 if (starCount > SKY_BASIS_STARS) {
111 starCount = SKY_BASIS_STARS;
112 }
113 starCount /= 2;
114 if (nebulaCount > SKY_BASIS_BLOBS) {
115 nebulaCount = SKY_BASIS_BLOBS;
116 }
117 }
118
119 skyDrawable = [[OOSkyDrawable alloc]
120 initWithColor1:col1
121 Color2:col2
122 Color3:col3
123 Color4:col4
124 starCount:starCount
125 nebulaCount:nebulaCount
126 nebulaHueFix:nebulaColorSet
127 clusterFactor:clusterChance
128 alpha:alpha
129 scale:scale];
130 [self setDrawable:skyDrawable];
131 [skyDrawable release];
132
133 [self setStatus:STATUS_EFFECT];
134
135 return self;
136}
#define SKY_BASIS_STARS
Definition SkyEntity.m:37
#define SKY_BASIS_BLOBS
Definition SkyEntity.m:38
OOColor * blendedColorWithFraction:ofColor:(float fraction,[ofColor] OOColor *color)
Definition OOColor.m:309
float randf(void)

References OOColor::blendedColorWithFraction:ofColor:, OOColor::colorWithDescription:, Entity::init, nil, randf(), readColor1:andColor2:andColor3:andColor4:fromDictionary:, OOEntityWithDrawable::setDrawable:, Entity::setStatus:, SKY_BASIS_BLOBS, SKY_BASIS_STARS, skyColor, and UNIVERSE.

Here is the call graph for this function:

◆ isSky

- (BOOL) isSky
implementation

Reimplemented from Entity.

Definition at line 182 of file SkyEntity.m.

183{
184 return YES;
185}

References isSky.

Referenced by isSky.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isVisible

- (BOOL) isVisible
implementation

Reimplemented from Entity.

Definition at line 187 of file SkyEntity.m.

188{
189 return YES;
190}

References isVisible.

Referenced by isVisible.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readColor1:andColor2:andColor3:andColor4:fromDictionary:

- (BOOL) readColor1: (OOColor**) ioColor1
andColor2: (OOColor**) ioColor2
andColor3: (OOColor**) ioColor3
andColor4: (OOColor**) ioColor4
fromDictionary: (NSDictionary*) dictionary 
implementation

Provided by category SkyEntity(OOPrivate).

Definition at line 229 of file SkyEntity.m.

229 :(OOColor**)ioColor1 andColor2:(OOColor**)ioColor2 andColor3:(OOColor**)ioColor3 andColor4:(OOColor**)ioColor4 fromDictionary:(NSDictionary*)dictionary
230{
231 NSString* string = nil;
232 NSArray* tokens = nil;
233 id colorDesc = nil;
234 OOColor* color = nil;
235 BOOL nebulaSet = NO;
236
237 assert(ioColor1 != NULL && ioColor2 != NULL);
238
239 string = [dictionary oo_stringForKey:@"sky_rgb_colors"];
240 if (string != nil) {
241 tokens = ScanTokensFromString(string);
242
243 if ([tokens count] == 6) {
244 float r1 = OOClamp_0_1_f([tokens oo_floatAtIndex:0]);
245 float g1 = OOClamp_0_1_f([tokens oo_floatAtIndex:1]);
246 float b1 = OOClamp_0_1_f([tokens oo_floatAtIndex:2]);
247 float r2 = OOClamp_0_1_f([tokens oo_floatAtIndex:3]);
248 float g2 = OOClamp_0_1_f([tokens oo_floatAtIndex:4]);
249 float b2 = OOClamp_0_1_f([tokens oo_floatAtIndex:5]);
250 *ioColor1 = [OOColor colorWithRed:r1 green:g1 blue:b1 alpha:1.0];
251 *ioColor2 = [OOColor colorWithRed:r2 green:g2 blue:b2 alpha:1.0];
252 } else {
253 OOLogWARN(@"sky.fromDict", @"could not interpret \"%@\" as two RGB colours (must be six numbers).", string);
254 }
255 }
256 colorDesc = [dictionary objectForKey:@"sky_color_1"];
257 if (colorDesc != nil) {
258 color = [[OOColor colorWithDescription:colorDesc] premultipliedColor];
259 if (color != nil)
260 *ioColor1 = color;
261 else
262 OOLogWARN(@"sky.fromDict", @"could not interpret \"%@\" as a colour.", colorDesc);
263 }
264 colorDesc = [dictionary objectForKey:@"sky_color_2"];
265 if (colorDesc != nil) {
266 color = [[OOColor colorWithDescription:colorDesc] premultipliedColor];
267 if (color != nil)
268 *ioColor2 = color;
269 else
270 OOLogWARN(@"sky.fromDict", @"could not interpret \"%@\" as a colour.", colorDesc);
271 }
272
273 colorDesc = [dictionary objectForKey:@"nebula_color_1"];
274 if (colorDesc != nil) {
275 color = [[OOColor colorWithDescription:colorDesc] premultipliedColor];
276 if (color != nil) {
277 *ioColor3 = color;
278 nebulaSet = YES;
279 } else
280 OOLogWARN(@"sky.fromDict", @"could not interpret \"%@\" as a colour.", colorDesc);
281 } else {
282 colorDesc = [dictionary objectForKey:@"sky_color_1"];
283 if (colorDesc != nil) {
284 color = [[OOColor colorWithDescription:colorDesc] premultipliedColor];
285 if (color != nil)
286 *ioColor3 = color;
287 else
288 OOLogWARN(@"sky.fromDict", @"could not interpret \"%@\" as a colour.", colorDesc);
289 }
290 }
291
292 colorDesc = [dictionary objectForKey:@"nebula_color_2"];
293 if (colorDesc != nil) {
294 color = [[OOColor colorWithDescription:colorDesc] premultipliedColor];
295 if (color != nil) {
296 *ioColor4 = color;
297 nebulaSet = YES;
298 } else
299 OOLogWARN(@"sky.fromDict", @"could not interpret \"%@\" as a colour.", colorDesc);
300 } else {
301 colorDesc = [dictionary objectForKey:@"sky_color_2"];
302 if (colorDesc != nil) {
303 color = [[OOColor colorWithDescription:colorDesc] premultipliedColor];
304 if (color != nil)
305 *ioColor4 = color;
306 else
307 OOLogWARN(@"sky.fromDict", @"could not interpret \"%@\" as a colour.", colorDesc);
308 }
309 }
310 return nebulaSet;
311}
OOINLINE float OOClamp_0_1_f(float value) INLINE_CONST_FUNC
unsigned count
NSMutableArray * ScanTokensFromString(NSString *values)
OOColor * colorWithRed:green:blue:alpha:(float red,[green] float green,[blue] float blue,[alpha] float alpha)
Definition OOColor.m:107
OOColor * premultipliedColor()
Definition OOColor.m:447

Referenced by initWithColors:col2:andSystemInfo:.

Here is the caller graph for this function:

◆ skyColor

References skyColor.

◆ update:

- (void) update: (OOTimeDelta) delta_t
implementation

Reimplemented from Entity.

Definition at line 170 of file SkyEntity.m.

170 :(OOTimeDelta)delta_t
171{
172 PlayerEntity* player = PLAYER;
175 if (player != nil) {
176 position = [player viewpointPosition];
177 } else {
178 OOLog(@"sky.warning", @"%@", @"PLAYER is nil");
179 }
180}
#define OOLog(class, format,...)
Definition OOLogging.h:84
double OOTimeDelta
Definition OOTypes.h:193
#define PLAYER
GLfloat zero_distance
Definition Entity.h:104
GLfloat cam_zero_distance
Definition Entity.h:105
HPVector position
Definition Entity.m:576
HPVector viewpointPosition()

References Entity::cam_zero_distance, MAX_CLEAR_DEPTH, nil, OOLog, PLAYER, Entity::position, PlayerEntity::viewpointPosition, and Entity::zero_distance.

Here is the call graph for this function:

Member Data Documentation

◆ skyColor


The documentation for this class was generated from the following files: