Oolite
Loading...
Searching...
No Matches
OOSunEntity.h
Go to the documentation of this file.
1/*
2
3OOSunEntity.h
4
5Entity subclass representing a sun.
6
7Oolite
8Copyright (C) 2004-2013 Giles C Williams and contributors
9
10This program is free software; you can redistribute it and/or
11modify it under the terms of the GNU General Public License
12as published by the Free Software Foundation; either version 2
13of the License, or (at your option) any later version.
14
15This program is distributed in the hope that it will be useful,
16but WITHOUT ANY WARRANTY; without even the implied warranty of
17MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18GNU General Public License for more details.
19
20You should have received a copy of the GNU General Public License
21along with this program; if not, write to the Free Software
22Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
23MA 02110-1301, USA.
24
25*/
26
27#import "OOPlanetEntity.h"
28
29#import "Entity.h"
30#import "OOColor.h"
31#import "legacy_random.h"
32
33#define SUN_CORONA_SAMPLES 729 // Samples at half-degree intervals, with a bit of overlap.
34#define MAX_CORONAFLARE 600000.0 // nova flare
35
36#ifndef SUN_DIRECT_VISION_GLARE
37#define SUN_DIRECT_VISION_GLARE 1
38#endif
39
40#if SUN_DIRECT_VISION_GLARE
41#define SUN_GLARE_MULT_FACTOR 3.0
42#define SUN_GLARE_ADD_FACTOR (M_PI / 16.0)
43#define SUN_GLARE_CORONA_FACTOR 0.5f
44#else
45#define SUN_GLARE_CORONA_FACTOR 1.5
46#endif
47
48@class ShipEntity;
49
51@private
52 GLfloat sun_diffuse[4];
53 GLfloat sun_specular[4];
54
55 GLfloat discColor[4];
56 GLfloat outerCoronaColor[4];
57
58 GLfloat cor16k, lim16k;
59
60 double corona_speed_factor; // multiply delta_t by this before adding it to corona_stage
61 double corona_stage; // 0.0 -> 1.0
62 GLfloat rvalue[SUN_CORONA_SAMPLES]; // stores random values for adjusting colors in the corona
64
65 GLuint sunTriangles[3240 * 3];
66 GLfloat sunVertices[1801 * 3];
67 GLfloat sunColors[1801 * 4];
68
72
75
76 NSString* _name;
77}
78
79- (id)initSunWithColor:(OOColor*)sun_color andDictionary:(NSDictionary*)dict;
80- (BOOL)setSunColor:(OOColor*)sun_color;
81- (BOOL)changeSunProperty:(NSString*)key withDictionary:(NSDictionary*)dict;
82
83- (OOStellarBodyType)planetType;
84
85- (void)getDiffuseComponents:(GLfloat[4])components;
86- (void)getSpecularComponents:(GLfloat[4])components;
87
88- (void)setRadius:(GLfloat)rad andCorona:(GLfloat)corona;
89
90- (BOOL)willGoNova;
91- (BOOL)goneNova;
92- (void)setGoingNova:(BOOL)yesno inTime:(double)interval;
93
94- (void)drawStarGlare;
95- (void)drawDirectVisionSunGlare;
96- (void)resetNova;
97
98@end
OOStellarBodyType
double OOTimeDelta
Definition OOTypes.h:193
GLfloat sun_specular[4]
Definition OOSunEntity.h:53
float _sunCoronaAlphaFactor
Definition OOSunEntity.h:74
GLfloat outerCoronaColor[4]
Definition OOSunEntity.h:56
double corona_speed_factor
Definition OOSunEntity.h:60
GLfloat sun_diffuse[4]
Definition OOSunEntity.h:52
GLfloat rvalue[SUN_CORONA_SAMPLES]
Definition OOSunEntity.h:62
GLfloat lim16k
Definition OOSunEntity.h:58
float corona_blending
Definition OOSunEntity.h:63
double corona_stage
Definition OOSunEntity.h:61
NSString * _name
Definition OOSunEntity.h:76
float _novaExpansionRate
Definition OOSunEntity.h:71
GLuint sunTriangles[3240 *3]
Definition OOSunEntity.h:65
OOTimeDelta _novaCountdown
Definition OOSunEntity.h:69
GLfloat sunColors[1801 *4]
Definition OOSunEntity.h:67
GLfloat discColor[4]
Definition OOSunEntity.h:55
GLfloat sunVertices[1801 *3]
Definition OOSunEntity.h:66
GLfloat cor16k
Definition OOSunEntity.h:58
OOTimeDelta _novaExpansionTimer
Definition OOSunEntity.h:70
float _sunBrightnessFactor
Definition OOSunEntity.h:73