Oolite
Loading...
Searching...
No Matches
OOSkyDrawable.m
Go to the documentation of this file.
1/*
2
3OOSkyDrawable.m
4
5
6Copyright (C) 2007-2013 Jens Ayton
7
8Permission is hereby granted, free of charge, to any person obtaining a copy
9of this software and associated documentation files (the "Software"), to deal
10in the Software without restriction, including without limitation the rights
11to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12copies of the Software, and to permit persons to whom the Software is
13furnished to do so, subject to the following conditions:
14
15The above copyright notice and this permission notice shall be included in all
16copies or substantial portions of the Software.
17
18THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24SOFTWARE.
25
26*/
27
28#import "OOSkyDrawable.h"
29#import "GameController.h"
32#import "OOColor.h"
34#import "OOMacroOpenGL.h"
36#import "OOTexture.h"
37#import "ResourceManager.h"
38#import "Universe.h"
39
40#define SKY_ELEMENT_SCALE_FACTOR (BILLBOARD_DEPTH / 500.0f)
41#define NEBULA_SHUFFLE_FACTOR 0.005f
42#define DEBUG_COLORS 0 // If set, rgb = xyz (offset to range from 0.1 to 1.0).
43
44/* Min and max coords are 0 and 1 normally, but the default
45 sky-render-inset-coords can be used to modify them slightly as an attempted
46 work-around for artefacts on buggy S3/Via renderers.
47*/
48static float sMinTexCoord = 0.0f, sMaxTexCoord = 1.0f;
49static BOOL sInited = NO;
50
51/* Struct used to describe quads initially. This form is optimized for
52 reasoning about.
53*/
59
60enum {
64};
65
66/* Class containing a set of quads with the same texture. This form is
67 optimized for rendering.
68*/
69@interface OOSkyQuadSet : NSObject {
70@private
72 unsigned _count;
73 GLfloat* _positions; // 3 entries per vertex, 12 per quad
74 GLfloat* _texCoords; // 2 entries per vertex, 8 per quad
75 GLfloat* _colors; // 4 entries per vertex, 16 per quad
76}
77
78+ (void)addQuads:(OOSkyQuadDesc*)quads count:(unsigned)count toArray:(NSMutableArray*)ioArray;
79
80- (id)initWithQuadsWithTexture:(OOTexture*)texture inArray:(OOSkyQuadDesc*)array count:(unsigned)totalCount;
81
82- (void)render;
83
84#ifdef OO_DEBUG_MONITOR_ENABLED
85- (size_t)totalSize;
86- (OOTexture*)texture;
87#endif
88
89@end
90
91/* Textures are global because there is always a sky, but the sky isn't
92 replaced very often, so the textures are likely to fall out of the cache.
93*/
96
97static OOColor* SaturatedColorInRange(OOColor* color1, OOColor* color2, BOOL hueFix);
98
99@interface OOSkyDrawable (OOPrivate) <OOGraphicsResetClient>
100
101- (void)setUpStarsWithColor1:(OOColor*)color1 color2:(OOColor*)color2;
102- (void)setUpNebulaeWithColor1:(OOColor*)color1
103 color2:(OOColor*)color2
104 clusterFactor:(float)nebulaClusterFactor
105 nebulaHueFix:(BOOL)nebulaHueFix
106 alpha:(float)nebulaAlpha
107 scale:(float)nebulaScale;
108
109- (void)loadStarTextures;
110- (void)loadNebulaTextures;
111
112- (void)addQuads:(OOSkyQuadDesc*)quads count:(unsigned)count;
113
115
116@end
117
118@implementation OOSkyDrawable
119
120- (id)initWithColor1:(OOColor*)color1
121 Color2:(OOColor*)color2
122 Color3:(OOColor*)color3
123 Color4:(OOColor*)color4
124 starCount:(unsigned)starCount
125 nebulaCount:(unsigned)nebulaCount
126 nebulaHueFix:(BOOL)nebulaHueFix
127 clusterFactor:(float)nebulaClusterFactor
128 alpha:(float)nebulaAlpha
129 scale:(float)nebulaScale
130{
131 NSAutoreleasePool* pool = nil;
132
133 if (!sInited) {
134 sInited = YES;
135 if ([[NSUserDefaults standardUserDefaults] boolForKey:@"sky-render-inset-coords"]) {
136 sMinTexCoord += 1.0f / 128.0f;
137 sMaxTexCoord -= 1.0f / 128.0f;
138 }
139 }
140
141 self = [super init];
142 if (self == nil)
143 return nil;
144
145 _starCount = starCount;
146 _nebulaCount = nebulaCount;
147
148 pool = [[NSAutoreleasePool alloc] init];
149 [self setUpStarsWithColor1:color1 color2:color2];
150
151 if (![UNIVERSE reducedDetail]) {
152 [self setUpNebulaeWithColor1:color3
153 color2:color4
154 clusterFactor:nebulaClusterFactor
155 nebulaHueFix:nebulaHueFix
156 alpha:nebulaAlpha
157 scale:nebulaScale];
158 }
159 [pool release];
160
162
163 return self;
164}
165
166- (void)dealloc
167{
169
170 [_quadSets release];
172 if (_displayListName != 0)
173 glDeleteLists(_displayListName, 1);
174
175 [super dealloc];
176}
177
179{
180 // While technically translucent, the sky doesn't need to be depth-sorted
181 // since it'll be behind everything else anyway.
182
185
186 OOGL(glDisable(GL_DEPTH_TEST)); // don't read the depth buffer
187 OOGL(glEnable(GL_TEXTURE_2D));
188
189 // Make stars dim in atmosphere. Note: works OK on night side because sky is dark blue, not black.
190 GLfloat fogColor[4] = { 0.02, 0.02, 0.02, 1.0 };
191 OOGL(glFogfv(GL_FOG_COLOR, fogColor));
192
193 if (_displayListName != 0) {
194 OOGL(glCallList(_displayListName));
195 } else {
196 // Set up display list
198 _displayListName = glGenLists(1);
199
200 OOGL(glNewList(_displayListName, GL_COMPILE));
201
202 OOGL(glEnableClientState(GL_TEXTURE_COORD_ARRAY));
203 OOGL(glEnableClientState(GL_COLOR_ARRAY));
204
205 [_quadSets makeObjectsPerformSelector:@selector(render)];
206
207 OOGL(glDisableClientState(GL_TEXTURE_COORD_ARRAY));
208 OOGL(glDisableClientState(GL_COLOR_ARRAY));
209
210 OOGL(glEndList());
211 }
212
213 // Restore state
214 OOGL(glEnable(GL_DEPTH_TEST));
215 OOGL(glDisable(GL_TEXTURE_2D));
216
217 // Resetting fog is draw loop's responsibility.
218
220 OOCheckOpenGLErrors(@"OOSkyDrawable after rendering");
221}
222
224{
225 return YES;
226}
227
229{
230 return INFINITY;
231}
232
233#ifdef OO_DEBUG_MONITOR_ENABLED
234- (NSSet*)allTextures
235{
236 NSMutableSet* result = [NSMutableSet setWithCapacity:[_quadSets count]];
237
238 OOSkyQuadSet* quadSet = nil;
239 foreach (quadSet, _quadSets) {
240 [result addObject:[quadSet texture]];
241 }
242
243 return result;
244}
245
246- (size_t)totalSize
247{
248 size_t result = [super totalSize];
249
250 OOSkyQuadSet* quadSet = nil;
251 foreach (quadSet, _quadSets) {
252 result += [quadSet totalSize];
253 }
254
255 return result;
256}
257#endif
258
259@end
260
261#if DEBUG_COLORS
262static OOColor* DebugColor(Vector orientation)
263{
264 Vector color = vector_add(make_vector(0.55, 0.55, 0.55), vector_multiply_scalar(vector_normal(orientation), 0.45));
265 return [OOColor colorWithCalibratedRed:color.x green:color.y blue:color.z alpha:1.0];
266}
267#endif
268
269@implementation OOSkyDrawable (OOPrivate)
270
271- (void)setUpStarsWithColor1:(OOColor*)color1 color2:(OOColor*)color2
272{
273 OOSkyQuadDesc *quads = NULL, *currQuad = NULL;
274 unsigned i;
275 Quaternion q;
276 Vector vi, vj, vk;
277 float size;
278 Vector middle, offset;
279
280 [self loadStarTextures];
281
282 quads = malloc(sizeof *quads * _starCount);
283 if (quads == NULL)
284 return;
285
286 currQuad = quads;
287 for (i = 0; i != _starCount; ++i) {
288 // Select a direction and rotation.
289 q = OORandomQuaternion();
290 basis_vectors_from_quaternion(q, &vi, &vj, &vk);
291
292 // Select colour and texture.
293#if DEBUG_COLORS
294 currQuad->color = DebugColor(vk);
295#else
296 currQuad->color = [color1 blendedColorWithFraction:randf() ofColor:color2];
297#endif
298 currQuad->texture = [sStarTextures selectTexture]; // Not retained, since sStarTextures is never released.
299
300 // Select scale; calculate centre position and offset to first corner.
301 size = (1 + (ranrot_rand() % 6)) * SKY_ELEMENT_SCALE_FACTOR;
303 offset = vector_multiply_scalar(vector_add(vi, vj), 0.5f * size);
304
305 // Scale the "side" vectors.
308
309 // Set up corners.
310 currQuad->corners[0] = vector_subtract(middle, offset);
311 currQuad->corners[1] = vector_add(currQuad->corners[0], vj2);
312 currQuad->corners[2] = vector_add(currQuad->corners[1], vi2);
313 currQuad->corners[3] = vector_add(currQuad->corners[0], vi2);
314
315 ++currQuad;
316 }
317
318 [self addQuads:quads count:_starCount];
319 free(quads);
320}
321
322- (void)setUpNebulaeWithColor1:(OOColor*)color1
323 color2:(OOColor*)color2
324 clusterFactor:(float)nebulaClusterFactor
325 nebulaHueFix:(BOOL)nebulaHueFix
326 alpha:(float)nebulaAlpha
327 scale:(float)nebulaScale
328{
329 OOSkyQuadDesc *quads = NULL, *currQuad = NULL;
330 unsigned i, actualCount = 0;
331 OOColor* color;
332 Quaternion q;
333 Vector vi, vj, vk;
334 double size, r2;
335 Vector middle, offset;
336 int r1;
337
338 [self loadNebulaTextures];
339
340 quads = malloc(sizeof *quads * _nebulaCount);
341 if (quads == NULL)
342 return;
343
344 currQuad = quads;
345 for (i = 0; i < _nebulaCount; ++i) {
346 color = SaturatedColorInRange(color1, color2, nebulaHueFix);
347
348 // Select a direction and rotation.
349 q = OORandomQuaternion();
350
351 // Create a cluster of nebula quads.
352 while ((i < _nebulaCount) && (randf() < nebulaClusterFactor)) {
353 // Select size.
354 r1 = 1 + (ranrot_rand() & 15);
355 size = nebulaScale * r1 * SKY_ELEMENT_SCALE_FACTOR;
356
357 // Calculate centre position and offset to first corner.
358 basis_vectors_from_quaternion(q, &vi, &vj, &vk);
359
360 // Select colour and texture. Smaller nebula quads are dimmer.
361#if DEBUG_COLORS
362 currQuad->color = DebugColor(vk);
363#else
364 currQuad->color = [color colorWithBrightnessFactor:nebulaAlpha * (0.5f + (float)r1 / 32.0f)];
365#endif
366 currQuad->texture = [sNebulaTextures selectTexture]; // Not retained, since sStarTextures is never released.
367
369 offset = vector_multiply_scalar(vector_add(vi, vj), 0.5f * size);
370
371 // Rotate vi and vj by a random angle
372 r2 = randf() * M_PI * 2.0;
376
377 // Scale the "side" vectors.
380
381 // Set up corners.
382 currQuad->corners[0] = vector_subtract(middle, offset);
383 currQuad->corners[1] = vector_add(currQuad->corners[0], vj);
384 currQuad->corners[2] = vector_add(currQuad->corners[1], vi);
385 currQuad->corners[3] = vector_add(currQuad->corners[0], vi);
386
387 // Shuffle direction quat around a bit to spread the cluster out.
389 q.x += size * (randf() - 0.5);
390 q.y += size * (randf() - 0.5);
391 q.z += size * (randf() - 0.5);
392 q.w += size * (randf() - 0.5);
394
395 ++i;
396 ++currQuad;
397 ++actualCount;
398 }
399 }
400
401 /* The above code generates less than _nebulaCount quads, because i is
402 incremented once in the outer loop as well as in the inner loop. To
403 keep skies looking the same, we leave the bug in and fill in the
404 actual generated count here.
405 */
406 _nebulaCount = actualCount;
407
408 [self addQuads:quads count:_nebulaCount];
409 free(quads);
410}
411
412- (void)addQuads:(OOSkyQuadDesc*)quads count:(unsigned)count
413{
414 if (_quadSets == nil)
415 _quadSets = [[NSMutableArray alloc] init];
416
417 [OOSkyQuadSet addQuads:quads count:count toArray:_quadSets];
418}
419
421{
422 if (sStarTextures == nil) {
424 initWithPListName:@"startextures.plist"
425 options:kOOTextureMinFilterMipMap | kOOTextureMagFilterLinear | kOOTextureAlphaMask
426 anisotropy:0.0f
427 lodBias:-0.0f];
428 if (sStarTextures == nil) {
429 [NSException raise:OOLITE_EXCEPTION_DATA_NOT_FOUND format:@"No star textures could be loaded."];
430 }
431 }
432
433 [sStarTextures setSeed:RANROTGetFullSeed()];
434}
435
437{
438 if (sNebulaTextures == nil) {
440 initWithPListName:@"nebulatextures.plist"
441 options:kOOTextureDefaultOptions | kOOTextureAlphaMask
442 anisotropy:0.0f
443 lodBias:0.0f];
444 if (sNebulaTextures == nil) {
445 [NSException raise:OOLITE_EXCEPTION_DATA_NOT_FOUND format:@"No nebula textures could be loaded."];
446 }
447 }
448
449 [sNebulaTextures setSeed:RANROTGetFullSeed()];
450}
451
457
459{
461
462 if (_displayListName != 0) {
463 glDeleteLists(_displayListName, 1);
464 _displayListName = 0;
465 }
466}
467
468@end
469
470@implementation OOSkyQuadSet
471
472+ (void)addQuads:(OOSkyQuadDesc*)quads count:(unsigned)count toArray:(NSMutableArray*)ioArray
473{
474 NSMutableSet* seenTextures = nil;
475 OOTexture* texture = nil;
476 OOSkyQuadSet* quadSet = nil;
477 unsigned i;
478
479 // Iterate over all quads.
480 seenTextures = [NSMutableSet set];
481 for (i = 0; i != count; ++i) {
482 texture = quads[i].texture;
483
484 // If we haven't seen this quad's texture before...
485 if (![seenTextures containsObject:texture]) {
486 [seenTextures addObject:texture];
487
488 // ...create a quad set for this texture.
489 quadSet = [[self alloc] initWithQuadsWithTexture:texture
490 inArray:quads
491 count:count];
492 if (quadSet != nil) {
493 [ioArray addObject:quadSet];
494 [quadSet release];
495 }
496 }
497 }
498}
499
500- (id)initWithQuadsWithTexture:(OOTexture*)texture inArray:(OOSkyQuadDesc*)array count:(unsigned)totalCount
501{
502 BOOL OK = YES;
503 unsigned i, j, vertexCount;
504 GLfloat* pos;
505 GLfloat* tc;
506 GLfloat* col;
507 GLfloat r, g, b, x;
508 size_t posSize, tcSize, colSize;
509 unsigned count = 0;
510 int skyColorCorrection = [[NSUserDefaults standardUserDefaults] oo_integerForKey:@"sky-color-correction" defaultValue:0];
511
512// Hejl / Burgess-Dawson filmic tone mapping
513// this algorithm has gamma correction already embedded
514#define SKYCOLOR_TONEMAP_COMPONENT(skyColorComponent) \
515 do { \
516 x = MAX(0.0, skyColorComponent - 0.004); \
517 *col++ = (x * (6.2 * x + 0.5)) / (x * (6.2 * x + 1.7) + 0.06); \
518 } while (0)
519
520 self = [super init];
521 if (self == nil)
522 OK = NO;
523
524 if (OK) {
525 // Count the quads in the array using this texture.
526 for (i = 0; i != totalCount; ++i) {
527 if (array[i].texture == texture)
528 ++_count;
529 }
530 if (_count == 0)
531 OK = NO;
532 }
533
534 if (OK) {
535 // Allocate arrays.
536 vertexCount = _count * 4;
537 posSize = sizeof *_positions * vertexCount * kSkyQuadSetPositionEntriesPerVertex;
538 tcSize = sizeof *_texCoords * vertexCount * kSkyQuadSetTexCoordEntriesPerVertex;
539 colSize = sizeof *_colors * vertexCount * kSkyQuadSetColorEntriesPerVertex;
540
541 _positions = malloc(posSize);
542 _texCoords = malloc(tcSize);
543 _colors = malloc(colSize);
544
545 if (_positions == NULL || _texCoords == NULL || _colors == NULL)
546 OK = NO;
547
548 pos = _positions;
549 tc = _texCoords;
550 col = _colors;
551 }
552
553 if (OK) {
554 // Find the matching quads again, and convert them to renderable representation.
555 for (i = 0; i != totalCount; ++i) {
556 if (array[i].texture == texture) {
557 r = [array[i].color redComponent];
558 g = [array[i].color greenComponent];
559 b = [array[i].color blueComponent];
560
561 // Loop over vertices
562 for (j = 0; j != 4; ++j) {
563 *pos++ = array[i].corners[j].x;
564 *pos++ = array[i].corners[j].y;
565 *pos++ = array[i].corners[j].z;
566
567 // Colour is the same for each vertex
568 if (skyColorCorrection == 0) // no color correction
569 {
570 *col++ = r;
571 *col++ = g;
572 *col++ = b;
573 } else if (skyColorCorrection == 1) // gamma correction only
574 {
575 *col++ = pow(r, 1.0 / 2.2);
576 *col++ = pow(g, 1.0 / 2.2);
577 *col++ = pow(b, 1.0 / 2.2);
578 } else // gamma correctioin + filmic tone mapping
579 {
583 }
584 *col++ = 1.0f; // Alpha is unused but needs to be there
585 }
586
587 // Texture co-ordinates are the same for each quad.
588 *tc++ = sMinTexCoord;
589 *tc++ = sMinTexCoord;
590
591 *tc++ = sMaxTexCoord;
592 *tc++ = sMinTexCoord;
593
594 *tc++ = sMaxTexCoord;
595 *tc++ = sMaxTexCoord;
596
597 *tc++ = sMinTexCoord;
598 *tc++ = sMaxTexCoord;
599
600 count++;
601 }
602 }
603
604 _texture = [texture retain];
605 OOLog(@"sky.setup", @"Generated quadset with %u quads for texture %@", count, _texture);
606 }
607
608 if (!OK) {
609 [self release];
610 self = nil;
611 }
612
613 return self;
614}
615
616- (void)dealloc
617{
618 [_texture release];
619
620 if (_positions != NULL)
621 free(_positions);
622 if (_texCoords != NULL)
623 free(_texCoords);
624 if (_colors != NULL)
625 free(_colors);
626
627 [super dealloc];
628}
629
630- (NSString*)description
631{
632 return [NSString stringWithFormat:@"<%@ %p>{%u quads, texture: %@}", [self class], self, _count, _texture];
633}
634
635- (void)render
636{
638
639 [_texture apply];
640
641 OOGL(glVertexPointer(kSkyQuadSetPositionEntriesPerVertex, GL_FLOAT, 0, _positions));
642 OOGL(glTexCoordPointer(kSkyQuadSetTexCoordEntriesPerVertex, GL_FLOAT, 0, _texCoords));
643 OOGL(glColorPointer(kSkyQuadSetColorEntriesPerVertex, GL_FLOAT, 0, _colors));
644
645 OOGL(glDrawArrays(GL_QUADS, 0, 4 * _count));
646}
647
648#ifdef OO_DEBUG_MONITOR_ENABLED
649- (size_t)totalSize
650{
651 return [self oo_objectSize] + _count * 4 * (sizeof *_positions + sizeof *_texCoords + sizeof *_colors);
652}
653
654- (OOTexture*)texture
655{
656 return _texture;
657}
658#endif
659
660@end
661
662static OOColor* SaturatedColorInRange(OOColor* color1, OOColor* color2, BOOL hueFix)
663{
664 OOColor* color = nil;
665 float hue, saturation, brightness, alpha;
666
667 color = [color1 blendedColorWithFraction:randf() ofColor:color2];
668 [color getHue:&hue saturation:&saturation brightness:&brightness alpha:&alpha];
669
670 saturation = 0.5 * saturation + 0.5; // move saturation up a notch!
671
672 /* NOTE: this changes the hue, because getHue:... produces hue values
673 in [0, 360], but colorWithCalibratedHue:... takes hue values in
674 [0, 1].
675 */
676 if (hueFix) {
677 /* now nebula colours can be independently set, correct the
678 * range so they behave expectedly if they have actually been
679 * set in planetinfo */
680 hue /= 360.0;
681 }
682 /* else keep it how it was before so the nebula hues are clearer */
683
684 return [OOColor colorWithHue:hue saturation:saturation brightness:brightness alpha:alpha];
685}
static BOOL sInited
Definition OOCPUInfo.m:56
#define OOLog(class, format,...)
Definition OOLogging.h:84
#define OO_ENTER_OPENGL()
#define M_PI
Definition OOMaths.h:54
@ OPENGL_STATE_ADDITIVE_BLENDING
Definition OOOpenGL.h:123
#define OOVerifyOpenGLState()
Definition OOOpenGL.h:133
BOOL OOCheckOpenGLErrors(NSString *format,...)
Definition OOOpenGL.m:38
#define OOSetOpenGLState(STATE)
Definition OOOpenGL.h:132
#define OOGL(statement)
Definition OOOpenGL.h:262
unsigned count
return nil
void basis_vectors_from_quaternion(Quaternion quat, Vector *outRight, Vector *outUp, Vector *outForward)
void quaternion_rotate_about_axis(Quaternion *quat, Vector axis, OOScalar angle) NONNULL_FUNC
OOINLINE void quaternion_normalize(Quaternion *quat) NONNULL_FUNC ALWAYS_INLINE_FUNC
Vector vector_up_from_quaternion(Quaternion quat) CONST_FUNC
OOINLINE Quaternion OORandomQuaternion(void) ALWAYS_INLINE_FUNC
Vector vector_right_from_quaternion(Quaternion quat) CONST_FUNC
float x
static float sMaxTexCoord
#define SKY_ELEMENT_SCALE_FACTOR
static float sMinTexCoord
@ kSkyQuadSetTexCoordEntriesPerVertex
@ kSkyQuadSetPositionEntriesPerVertex
@ kSkyQuadSetColorEntriesPerVertex
static OOProbabilisticTextureManager * sNebulaTextures
#define NEBULA_SHUFFLE_FACTOR
#define SKYCOLOR_TONEMAP_COMPONENT(skyColorComponent)
static OOProbabilisticTextureManager * sStarTextures
static OOColor * SaturatedColorInRange(OOColor *color1, OOColor *color2, BOOL hueFix)
OOINLINE Vector vector_add(Vector a, Vector b) INLINE_CONST_FUNC
Definition OOVector.h:195
OOINLINE Vector vector_subtract(Vector a, Vector b) INLINE_CONST_FUNC
Definition OOVector.h:218
OOINLINE Vector make_vector(OOScalar vx, OOScalar vy, OOScalar vz) INLINE_CONST_FUNC
Definition OOVector.h:149
struct Vector Vector
OOINLINE Vector vector_multiply_scalar(Vector v, OOScalar s) INLINE_CONST_FUNC
Definition OOVector.h:180
OOINLINE Vector vector_normal(Vector vec) INLINE_CONST_FUNC
Definition OOVector.h:270
#define UNIVERSE
Definition Universe.h:827
#define BILLBOARD_DEPTH
Definition Universe.h:154
void getHue:saturation:brightness:alpha:(float *hue,[saturation] float *saturation,[brightness] float *brightness,[alpha] float *alpha)
Definition OOColor.m:403
OOColor * colorWithBrightnessFactor:(float factor)
Definition OOColor.m:457
OOColor * colorWithHue:saturation:brightness:alpha:(float hue,[saturation] float saturation,[brightness] float brightness,[alpha] float alpha)
Definition OOColor.m:100
OOColor * blendedColorWithFraction:ofColor:(float fraction,[ofColor] OOColor *color)
Definition OOColor.m:309
void registerClient:(id< OOGraphicsResetClient > client)
void unregisterClient:(id< OOGraphicsResetClient > client)
OOGraphicsResetManager * sharedManager()
unsigned _nebulaCount
GLfloat maxDrawDistance()
GLint _displayListName
void loadNebulaTextures()
unsigned _starCount
void addQuads:count:(OOSkyQuadDesc *quads,[count] unsigned count)
void ensureTexturesLoaded()
void setUpStarsWithColor1:color2:(OOColor *color1,[color2] OOColor *color2)
void setUpNebulaeWithColor1:color2:clusterFactor:nebulaHueFix:alpha:scale:(OOColor *color1,[color2] OOColor *color2,[clusterFactor] float nebulaClusterFactor,[nebulaHueFix] BOOL nebulaHueFix,[alpha] float nebulaAlpha,[scale] float nebulaScale)
unsigned _count
NSString * description()
GLfloat * _positions
void addQuads:count:toArray:(OOSkyQuadDesc *quads,[count] unsigned count,[toArray] NSMutableArray *ioArray)
OOTexture * _texture
GLfloat * _colors
GLfloat * _texCoords
void apply()
Definition OOTexture.m:258
voidpf void uLong size
Definition ioapi.h:126
voidpf uLong offset
Definition ioapi.h:132
float randf(void)
#define ranrot_rand()
OOColor * color
Vector corners[4]
OOTexture * texture
OOScalar w
OOScalar x
OOScalar y
OOScalar z
OOScalar x
Definition OOVector.h:32
OOScalar y
Definition OOVector.h:33
OOScalar z
Definition OOVector.h:34