Oolite 1.91.0.7645-241119-222d325
Loading...
Searching...
No Matches
SkyEntity Class Reference

#include <SkyEntity.h>

+ Inheritance diagram for SkyEntity:
+ Collaboration diagram for SkyEntity:

Instance Methods

(id) - initWithColors:col1: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]
 
(NSString *) - descriptionForObjDump [implementation]
 
(BOOL) - readColor1:andColor2:andColor3:andColor4:fromDictionary: [implementation]
 
- Instance Methods inherited from OOEntityWithDrawable
(OODrawable *) - drawable
 
(void) - setDrawable:
 
(double) - findCollisionRadius [implementation]
 
(NSSet *) - allTextures [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
 
(BOOL) - isInSpace
 
(BOOL) - isImmuneToBreakPatternHide
 
(GLfloat) - universalTime
 
(GLfloat) - spawnTime
 
(GLfloat) - timeElapsedSinceSpawn
 
(void) - setAtmosphereFogging:
 
(OOColor *) - fogUniform
 
(NSString *) - descriptionForObjDumpBasic
 
(id) - init [implementation]
 
(NSString *) - descriptionComponents [implementation]
 
(BOOL) - checkLinkedLists [implementation]
 
(id< OOWeakReferenceSupport >) - superShaderBindingTarget [implementation]
 
(Vector) - relativePosition [implementation]
 
(void) - subEntityReallyDied: [implementation]
 
(BOOL) - isBreakPattern
 
(void) - inspect [implementation]
 
(BOOL) - isECMBlast
 
(NSArray *) - debugInspectorModules [implementation]
 
(NSString *) - inspScanClassLine
 
(NSString *) - inspStatusLine
 
(NSString *) - inspRetainCountLine
 
(NSString *) - inspPositionLine
 
(NSString *) - inspVelocityLine
 
(NSString *) - inspOrientationLine
 
(NSString *) - inspEnergyLine
 
(NSString *) - inspOwnerLine
 
(NSString *) - inspTargetLine
 
(NSString *) - inspDescription [implementation]
 
(NSString *) - inspBasicIdentityLine [implementation]
 
(BOOL) - isExhaust
 
(BOOL) - isFlasher
 
(BOOL) - isVisibleToScripts
 
(NSString *) - oo_jsClassName
 
(void) - getJSClass:andPrototype:
 
(void) - deleteJSSelf
 
(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

OOColorskyColor
 
- 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
 
- Protected Attributes inherited from OOWeakRefObject
OOWeakReferenceweakSelf
 

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
 
OOColoratmosphereFogging
 
int zero_index
 
Entityx_previous
 
Entityx_next
 
Entityy_previous
 
Entityy_next
 
Entityz_previous
 
Entityz_next
 
Entitycollision_chain
 
OOUniversalID shadingEntityID
 
Entitycollider
 
CollisionRegioncollisionRegion
 

Detailed Description

Definition at line 32 of file SkyEntity.h.

Method Documentation

◆ cameraRangeBack

- (GLfloat) cameraRangeBack
implementation

Reimplemented from Entity.

Definition at line 1 of file SkyEntity.m.

230{
231 return MAX_CLEAR_DEPTH;
232}
#define MAX_CLEAR_DEPTH

◆ cameraRangeFront

- (GLfloat) cameraRangeFront
implementation

Reimplemented from Entity.

Definition at line 1 of file SkyEntity.m.

224{
225 return MAX_CLEAR_DEPTH;
226}

◆ canCollide

- (BOOL) canCollide
implementation

Reimplemented from Entity.

Definition at line 1 of file SkyEntity.m.

218{
219 return NO;
220}

◆ changeProperty:withDictionary:

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

Definition at line 1 of file SkyEntity.m.

164 :(NSString *)key withDictionary:(NSDictionary*)dict
165{
166 id object = [dict objectForKey:key];
167
168 // TODO: properties requiring reInit?
169 if ([key isEqualToString:@"sun_color"])
170 {
171 OOColor *col=[[OOColor colorWithDescription:object] retain];
172 if (col != nil)
173 {
174 [skyColor release];
175 skyColor = [col copy];
176 [col release];
177 [UNIVERSE setLighting];
178 }
179 }
180 else
181 {
182 OOLogWARN(@"script.warning", @"Change to property '%@' not applied, will apply only on leaving and re-entering this system.",key);
183 return NO;
184 }
185 return YES;
186}
#define OOLogWARN(class, format,...)
Definition OOLogging.h:113
return nil
OOColor * colorWithDescription:(id description)
Definition OOColor.m:127
OOColor * skyColor
Definition SkyEntity.h:34

◆ dealloc

- (void) dealloc
implementation

Reimplemented from OOEntityWithDrawable.

Definition at line 1 of file SkyEntity.m.

151{
152 [skyColor release];
153
154 [super dealloc];
155}

◆ descriptionForObjDump

- (NSString *) descriptionForObjDump
implementation

Reimplemented from Entity.

Definition at line 1 of file SkyEntity.m.

247{
248 // Don't include range and visibility flag as they're irrelevant.
249 return [self descriptionForObjDumpBasic];
250}

◆ drawImmediate:translucent:

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

Reimplemented from OOEntityWithDrawable.

Definition at line 1 of file SkyEntity.m.

235 :(bool)immediate translucent:(bool)translucent
236{
237 if ([UNIVERSE breakPatternHide]) return;
238
239 [super drawImmediate:immediate translucent:translucent];
240
241 OOCheckOpenGLErrors(@"SkyEntity after drawing %@", self);
242}
BOOL OOCheckOpenGLErrors(NSString *format,...)
Definition OOOpenGL.m:39
#define UNIVERSE
Definition Universe.h:833

◆ initWithColors:col1:andSystemInfo:

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

Definition at line 1 of file SkyEntity.m.

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

◆ isSky

- (BOOL) isSky
implementation

Reimplemented from Entity.

Definition at line 1 of file SkyEntity.m.

206{
207 return YES;
208}

◆ isVisible

- (BOOL) isVisible
implementation

Reimplemented from Entity.

Definition at line 1 of file SkyEntity.m.

212{
213 return YES;
214}

◆ 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 1 of file SkyEntity.m.

258 :(OOColor **)ioColor1 andColor2:(OOColor **)ioColor2 andColor3:(OOColor **)ioColor3 andColor4:(OOColor **)ioColor4 fromDictionary:(NSDictionary *)dictionary
259{
260 NSString *string = nil;
261 NSArray *tokens = nil;
262 id colorDesc = nil;
263 OOColor *color = nil;
264 BOOL nebulaSet = NO;
265
266 assert(ioColor1 != NULL && ioColor2 != NULL);
267
268 string = [dictionary oo_stringForKey:@"sky_rgb_colors"];
269 if (string != nil)
270 {
271 tokens = ScanTokensFromString(string);
272
273 if ([tokens count] == 6)
274 {
275 float r1 = OOClamp_0_1_f([tokens oo_floatAtIndex:0]);
276 float g1 = OOClamp_0_1_f([tokens oo_floatAtIndex:1]);
277 float b1 = OOClamp_0_1_f([tokens oo_floatAtIndex:2]);
278 float r2 = OOClamp_0_1_f([tokens oo_floatAtIndex:3]);
279 float g2 = OOClamp_0_1_f([tokens oo_floatAtIndex:4]);
280 float b2 = OOClamp_0_1_f([tokens oo_floatAtIndex:5]);
281 *ioColor1 = [OOColor colorWithRed:r1 green:g1 blue:b1 alpha:1.0];
282 *ioColor2 = [OOColor colorWithRed:r2 green:g2 blue:b2 alpha:1.0];
283 }
284 else
285 {
286 OOLogWARN(@"sky.fromDict", @"could not interpret \"%@\" as two RGB colours (must be six numbers).", string);
287 }
288 }
289 colorDesc = [dictionary objectForKey:@"sky_color_1"];
290 if (colorDesc != nil)
291 {
292 color = [[OOColor colorWithDescription:colorDesc] premultipliedColor];
293 if (color != nil) *ioColor1 = color;
294 else OOLogWARN(@"sky.fromDict", @"could not interpret \"%@\" as a colour.", colorDesc);
295 }
296 colorDesc = [dictionary objectForKey:@"sky_color_2"];
297 if (colorDesc != nil)
298 {
299 color = [[OOColor colorWithDescription:colorDesc] premultipliedColor];
300 if (color != nil) *ioColor2 = color;
301 else OOLogWARN(@"sky.fromDict", @"could not interpret \"%@\" as a colour.", colorDesc);
302 }
303
304 colorDesc = [dictionary objectForKey:@"nebula_color_1"];
305 if (colorDesc != nil)
306 {
307 color = [[OOColor colorWithDescription:colorDesc] premultipliedColor];
308 if (color != nil)
309 {
310 *ioColor3 = color;
311 nebulaSet = YES;
312 }
313 else OOLogWARN(@"sky.fromDict", @"could not interpret \"%@\" as a colour.", colorDesc);
314 }
315 else
316 {
317 colorDesc = [dictionary objectForKey:@"sky_color_1"];
318 if (colorDesc != nil)
319 {
320 color = [[OOColor colorWithDescription:colorDesc] premultipliedColor];
321 if (color != nil) *ioColor3 = color;
322 else OOLogWARN(@"sky.fromDict", @"could not interpret \"%@\" as a colour.", colorDesc);
323 }
324 }
325
326 colorDesc = [dictionary objectForKey:@"nebula_color_2"];
327 if (colorDesc != nil)
328 {
329 color = [[OOColor colorWithDescription:colorDesc] premultipliedColor];
330 if (color != nil)
331 {
332 *ioColor4 = color;
333 nebulaSet = YES;
334 }
335 else OOLogWARN(@"sky.fromDict", @"could not interpret \"%@\" as a colour.", colorDesc);
336 }
337 else
338 {
339 colorDesc = [dictionary objectForKey:@"sky_color_2"];
340 if (colorDesc != nil)
341 {
342 color = [[OOColor colorWithDescription:colorDesc] premultipliedColor];
343 if (color != nil) *ioColor4 = color;
344 else OOLogWARN(@"sky.fromDict", @"could not interpret \"%@\" as a colour.", colorDesc);
345 }
346 }
347 return nebulaSet;
348}
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:95
OOColor * premultipliedColor()
Definition OOColor.m:492

◆ skyColor

- (OOColor *) skyColor

◆ update:

- (void) update: (OOTimeDelta) delta_t
implementation

Reimplemented from Entity.

Definition at line 1 of file SkyEntity.m.

189 :(OOTimeDelta) delta_t
190{
191 PlayerEntity *player = PLAYER;
194 if (player != nil)
195 {
196 position = [player viewpointPosition];
197 }
198 else
199 {
200 OOLog(@"sky.warning", @"%@", @"PLAYER is nil");
201 }
202}
#define OOLog(class, format,...)
Definition OOLogging.h:88
double OOTimeDelta
Definition OOTypes.h:224
#define PLAYER
GLfloat zero_distance
Definition Entity.h:108
GLfloat cam_zero_distance
Definition Entity.h:109
HPVector position
Definition Entity.h:112
HPVector viewpointPosition()

Member Data Documentation

◆ skyColor

- (OOColor *) skyColor
protected

Definition at line 34 of file SkyEntity.h.


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