Oolite
Loading...
Searching...
No Matches
OOPlanetEntity(Private) Category Reference
+ Inheritance diagram for OOPlanetEntity(Private):
+ Collaboration diagram for OOPlanetEntity(Private):

Instance Methods

(void) - setUpTerrainParametersWithSourceInfo:targetInfo:
 
(void) - setUpLandParametersWithSourceInfo:targetInfo:
 
(void) - setUpAtmosphereParametersWithSourceInfo:targetInfo:
 
(void) - setUpColorParametersWithSourceInfo:targetInfo:isAtmosphere:
 
(void) - setUpTypeParametersWithSourceInfo:targetInfo:
 
- Instance Methods inherited from <OOGraphicsResetClient>
(void) - resetGraphicsState
 

Detailed Description

Definition at line 59 of file OOPlanetEntity.m.

Method Documentation

◆ setUpAtmosphereParametersWithSourceInfo:targetInfo:

- (void) setUpAtmosphereParametersWithSourceInfo: (NSDictionary *)  sourceInfo
targetInfo: (NSMutableDictionary *)  targetInfo 

Extends class OOPlanetEntity.

Definition at line 289 of file OOPlanetEntity.m.

323 :(NSDictionary *)sourceInfo targetInfo:(NSMutableDictionary *)targetInfo
324{
325 [self setUpColorParametersWithSourceInfo:sourceInfo targetInfo:targetInfo isAtmosphere:YES];
326}

Referenced by OOPlanetEntity::initFromDictionary:withAtmosphere:andSeed:forSystem:.

+ Here is the caller graph for this function:

◆ setUpColorParametersWithSourceInfo:targetInfo:isAtmosphere:

- (void) setUpColorParametersWithSourceInfo: (NSDictionary *)  sourceInfo
targetInfo: (NSMutableDictionary *)  targetInfo
isAtmosphere: (BOOL)  isAtmosphere 

Extends class OOPlanetEntity.

Definition at line 289 of file OOPlanetEntity.m.

329 :(NSDictionary *)sourceInfo targetInfo:(NSMutableDictionary *)targetInfo isAtmosphere:(BOOL)isAtmosphere
330{
331 // Stir the PRNG fourteen times for backwards compatibility.
332 unsigned i;
333 for (i = 0; i < 14; i++)
334 {
336 }
337
338 Vector landHSB, seaHSB, landPolarHSB, seaPolarHSB, illumHSB;
339 Vector terminatorThreshold;
340 OOColor *color;
341
342 landHSB = RandomHSBColor();
343
344 if (!isAtmosphere)
345 {
346 do
347 {
348 seaHSB = RandomHSBColor();
349 }
350 while (dot_product(landHSB, seaHSB) > .80f); // make sure land and sea colors differ significantly
351
352 // saturation bias - avoids really grey oceans
353 if (seaHSB.y < 0.22f) seaHSB.y = seaHSB.y * 0.3f + 0.2f;
354 // brightness bias - avoids really bright landmasses
355 if (landHSB.z > 0.66f) landHSB.z = 0.66f;
356
357 // planetinfo.plist overrides
358 color = [OOColor colorWithDescription:[sourceInfo objectForKey:@"land_color"]];
359 if (color != nil) landHSB = HSBColorWithColor(color);
360 else ScanVectorFromString([sourceInfo oo_stringForKey:@"land_hsb_color"], &landHSB);
361
362 color = [OOColor colorWithDescription:[sourceInfo objectForKey:@"sea_color"]];
363 if (color != nil) seaHSB = HSBColorWithColor(color);
364 else ScanVectorFromString([sourceInfo oo_stringForKey:@"sea_hsb_color"], &seaHSB);
365
366 color = [OOColor colorWithDescription:[sourceInfo objectForKey:@"illumination_color"]];
367 if (color != nil) illumHSB = HSBColorWithColor(color);
368 else
369 {
370 NSString *illumHSBColorString = [sourceInfo oo_stringForKey:@"illumination_hsb_color"];
371 if (illumHSBColorString) ScanVectorFromString(illumHSBColorString, &illumHSB);
372 else illumHSB = HSBColorWithColor([OOColor colorWithRed:0.8f green:0.8f blue:0.4f alpha:1.0f]);
373 }
374
375 // polar areas are brighter but have less colour (closer to white)
376 color = [OOColor colorWithDescription:[sourceInfo objectForKey:@"polar_land_color"]];
377 if (color != nil)
378 {
379 landPolarHSB = HSBColorWithColor(color);
380 }
381 else
382 {
383 landPolarHSB = LighterHSBColor(landHSB);
384 }
385
386 color = [OOColor colorWithDescription:[sourceInfo objectForKey:@"polar_sea_color"]];
387 if (color != nil)
388 {
389 seaPolarHSB = HSBColorWithColor(color);
390 }
391 else
392 {
393 seaPolarHSB = LighterHSBColor(seaHSB);
394 }
395
396 [targetInfo setObject:ColorWithHSBColor(landHSB) forKey:@"land_color"];
397 [targetInfo setObject:ColorWithHSBColor(seaHSB) forKey:@"sea_color"];
398 [targetInfo setObject:ColorWithHSBColor(landPolarHSB) forKey:@"polar_land_color"];
399 [targetInfo setObject:ColorWithHSBColor(seaPolarHSB) forKey:@"polar_sea_color"];
400 [targetInfo setObject:ColorWithHSBColor(illumHSB) forKey:@"illumination_color"];
401 }
402 else
403 {
404 landHSB = RandomHSBColor(); // NB: randomcolor is called twice to make the cloud colour similar to the old one.
405
406 // add a cloud_color tinge to sky blue({0.66, 0.3, 1}).
407 seaHSB = vector_add(landHSB,((Vector){1.333, 0.6, 2})); // 1 part cloud, 2 parts sky blue
408 scale_vector(&seaHSB, 0.333);
409
410 float cloudAlpha = OOClamp_0_1_f([sourceInfo oo_floatForKey:@"cloud_alpha" defaultValue:1.0f]);
411 [targetInfo setObject:[NSNumber numberWithFloat:cloudAlpha] forKey:@"cloud_alpha"];
412
413 // planetinfo overrides
414 color = [OOColor colorWithDescription:[sourceInfo objectForKey:@"air_color"]];
415 if (color != nil) seaHSB = HSBColorWithColor(color);
416
417 color = [OOColor colorWithDescription:[sourceInfo objectForKey:@"cloud_color"]];
418 if (color != nil) landHSB = HSBColorWithColor(color);
419
420 // polar areas: brighter, less saturation
421 landPolarHSB = vector_add(landHSB,LighterHSBColor(landHSB));
422 scale_vector(&landPolarHSB, 0.5);
423
424 color = [OOColor colorWithDescription:[sourceInfo objectForKey:@"polar_cloud_color"]];
425 if (color != nil) landPolarHSB = HSBColorWithColor(color);
426
427 [targetInfo setObject:ColorWithHSBColor(seaHSB) forKey:@"air_color"];
428 [targetInfo setObject:ColorWithHSBColor(landHSB) forKey:@"cloud_color"];
429 [targetInfo setObject:ColorWithHSBColor(landPolarHSB) forKey:@"polar_cloud_color"];
430 [targetInfo setObject:[NSNumber numberWithFloat:[sourceInfo oo_floatForKey:@"air_color_mix_ratio"]] forKey:@"air_color_mix_ratio"];
431 }
432 terminatorThreshold = [sourceInfo oo_vectorForKey:@"terminator_threshold_vector" defaultValue:OO_TERMINATOR_THRESHOLD_VECTOR_DEFAULT];
433 [targetInfo setObject:[NSString stringWithFormat:@"%f %f %f", terminatorThreshold.x, terminatorThreshold.y, terminatorThreshold.z] forKey:@"terminator_threshold_vector"];
434}
return nil
BOOL ScanVectorFromString(NSString *xyzString, Vector *outVector)
OOColor * colorWithDescription:(id description)
Definition OOColor.m:127
int gen_rnd_number(void)

◆ setUpLandParametersWithSourceInfo:targetInfo:

- (void) setUpLandParametersWithSourceInfo: (NSDictionary *)  sourceInfo
targetInfo: (NSMutableDictionary *)  targetInfo 

Extends class OOPlanetEntity.

Definition at line 289 of file OOPlanetEntity.m.

317 :(NSDictionary *)sourceInfo targetInfo:(NSMutableDictionary *)targetInfo
318{
319 [self setUpColorParametersWithSourceInfo:sourceInfo targetInfo:targetInfo isAtmosphere:NO];
320}

Referenced by OOPlanetEntity::initFromDictionary:withAtmosphere:andSeed:forSystem:.

+ Here is the caller graph for this function:

◆ setUpTerrainParametersWithSourceInfo:targetInfo:

- (void) setUpTerrainParametersWithSourceInfo: (NSDictionary *)  sourceInfo
targetInfo: (NSMutableDictionary *)  targetInfo 

Extends class OOPlanetEntity.

Definition at line 289 of file OOPlanetEntity.m.

303 :(NSDictionary *)sourceInfo targetInfo:(NSMutableDictionary *)targetInfo
304{
305 NSArray *keys = [NSArray arrayWithObjects:@"atmosphere_rotational_velocity",@"rotational_velocity",@"cloud_alpha",@"has_atmosphere",@"percent_cloud",@"percent_ice",@"percent_land",@"radius",@"seed",nil];
306 NSString *key = nil;
307 foreach (key, keys) {
308 id sval = [sourceInfo objectForKey:key];
309 if (sval != nil) {
310 [targetInfo setObject:sval forKey:key];
311 }
312 }
313
314}

Referenced by OOPlanetEntity::initFromDictionary:withAtmosphere:andSeed:forSystem:.

+ Here is the caller graph for this function:

◆ setUpTypeParametersWithSourceInfo:targetInfo:

- (void) setUpTypeParametersWithSourceInfo: (NSDictionary *)  sourceInfo
targetInfo: (NSMutableDictionary *)  targetInfo 

Extends class OOPlanetEntity.

Definition at line 289 of file OOPlanetEntity.m.

295 :(NSDictionary *)sourceInfo targetInfo:(NSMutableDictionary *)targetInfo
296{
297 [targetInfo oo_setBool:[sourceInfo oo_boolForKey:@"mainForLocalSystem"] forKey:@"mainForLocalSystem"];
298 [targetInfo oo_setBool:[sourceInfo oo_boolForKey:@"isMiniature"] forKey:@"isMiniature"];
299
300}

Referenced by OOPlanetEntity::initFromDictionary:withAtmosphere:andSeed:forSystem:.

+ Here is the caller graph for this function:

The documentation for this category was generated from the following file: