37#define SKY_BASIS_STARS 4800
38#define SKY_BASIS_BLOBS 1280
39#define SKY_clusterChance 0.80
43@interface SkyEntity (OOPrivate)
45- (BOOL)readColor1:(
OOColor**)ioColor1 andColor2:(
OOColor**)ioColor2 andColor3:(
OOColor**)ioColor3 andColor4:(
OOColor**)ioColor4 fromDictionary:(NSDictionary*)dictionary;
51- (id)initWithColors:(
OOColor*)col1 col2:(
OOColor*)col2 andSystemInfo:(NSDictionary*)systemInfo
58 nebulaCountMultiplier;
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];
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;
90 starCount *= starCountMultiplier;
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) {
103 nebulaCount *= nebulaCountMultiplier;
125 nebulaCount:nebulaCount
126 nebulaHueFix:nebulaColorSet
127 clusterFactor:clusterChance
150- (BOOL)changeProperty:(NSString*)key withDictionary:(NSDictionary*)dict
152 id object = [
dict objectForKey:key];
155 if ([key isEqualToString:
@"sun_color"]) {
161 [UNIVERSE setLighting];
164 OOLogWARN(
@"script.warning",
@"Change to property '%@' not applied, will apply only on leaving and re-entering this system.", key);
178 OOLog(
@"sky.warning",
@"%@",
@"PLAYER is nil");
207- (void)drawImmediate:(
bool)immediate translucent:(
bool)translucent
217#ifdef OO_DEBUG_MONITOR_ENABLED
218- (NSString*)descriptionForObjDump
221 return [
self descriptionForObjDumpBasic];
227@implementation SkyEntity (OOPrivate)
229- (BOOL)readColor1:(
OOColor**)ioColor1 andColor2:(
OOColor**)ioColor2 andColor3:(
OOColor**)ioColor3 andColor4:(
OOColor**)ioColor4 fromDictionary:(NSDictionary*)dictionary
231 NSString*
string =
nil;
232 NSArray* tokens =
nil;
237 assert(ioColor1 != NULL && ioColor2 != NULL);
239 string = [
dictionary oo_stringForKey:@"sky_rgb_colors"];
243 if ([tokens
count] == 6) {
253 OOLogWARN(
@"sky.fromDict",
@"could not interpret \"%@\
" as two RGB colours (must be six numbers).",
string);
256 colorDesc = [
dictionary objectForKey:@"sky_color_1"];
257 if (colorDesc !=
nil) {
262 OOLogWARN(
@"sky.fromDict",
@"could not interpret \"%@\
" as a colour.", colorDesc);
264 colorDesc = [
dictionary objectForKey:@"sky_color_2"];
265 if (colorDesc !=
nil) {
270 OOLogWARN(
@"sky.fromDict",
@"could not interpret \"%@\
" as a colour.", colorDesc);
273 colorDesc = [
dictionary objectForKey:@"nebula_color_1"];
274 if (colorDesc !=
nil) {
280 OOLogWARN(
@"sky.fromDict",
@"could not interpret \"%@\
" as a colour.", colorDesc);
282 colorDesc = [
dictionary objectForKey:@"sky_color_1"];
283 if (colorDesc !=
nil) {
288 OOLogWARN(
@"sky.fromDict",
@"could not interpret \"%@\
" as a colour.", colorDesc);
292 colorDesc = [
dictionary objectForKey:@"nebula_color_2"];
293 if (colorDesc !=
nil) {
299 OOLogWARN(
@"sky.fromDict",
@"could not interpret \"%@\
" as a colour.", colorDesc);
301 colorDesc = [
dictionary objectForKey:@"sky_color_2"];
302 if (colorDesc !=
nil) {
307 OOLogWARN(
@"sky.fromDict",
@"could not interpret \"%@\
" as a colour.", colorDesc);
OOINLINE float OOClamp_0_1_f(float value) INLINE_CONST_FUNC
#define OOLogWARN(class, format,...)
#define OOLog(class, format,...)
BOOL OOCheckOpenGLErrors(NSString *format,...)
NSMutableArray * ScanTokensFromString(NSString *values)
GLfloat cam_zero_distance
void setStatus:(OOEntityStatus stat)
OOColor * colorWithRed:green:blue:alpha:(float red,[green] float green,[blue] float blue,[alpha] float alpha)
OOColor * colorWithDescription:(id description)
OOColor * premultipliedColor()
OOColor * blendedColorWithFraction:ofColor:(float fraction,[ofColor] OOColor *color)
void setDrawable:(OODrawable *drawable)
void drawImmediate:translucent:(bool immediate, [translucent] bool translucent)
HPVector viewpointPosition()
GLfloat cameraRangeFront()
GLfloat cameraRangeBack()
BOOL readColor1:andColor2:andColor3:andColor4:fromDictionary:(OOColor **ioColor1,[andColor2] OOColor **ioColor2,[andColor3] OOColor **ioColor3,[andColor4] OOColor **ioColor4,[fromDictionary] NSDictionary *dictionary)