Oolite 1.91.0.7604-240417-a536cbe
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
28#import "OOPlanetEntity.h"
29
30#import "Entity.h"
31#import "legacy_random.h"
32#import "OOColor.h"
33
34
35#define SUN_CORONA_SAMPLES 729 // Samples at half-degree intervals, with a bit of overlap.
36#define MAX_CORONAFLARE 600000.0 // nova flare
37
38#ifndef SUN_DIRECT_VISION_GLARE
39#define SUN_DIRECT_VISION_GLARE 1
40#endif
41
42#if SUN_DIRECT_VISION_GLARE
43#define SUN_GLARE_MULT_FACTOR 3.0
44#define SUN_GLARE_ADD_FACTOR (M_PI/16.0)
45#define SUN_GLARE_CORONA_FACTOR 0.5f
46#else
47#define SUN_GLARE_CORONA_FACTOR 1.5
48#endif
49
50
51@class ShipEntity;
52
53
55{
56@private
57 GLfloat sun_diffuse[4];
58 GLfloat sun_specular[4];
60 GLfloat discColor[4];
61 GLfloat outerCoronaColor[4];
63 GLfloat cor16k, lim16k;
65 double corona_speed_factor; // multiply delta_t by this before adding it to corona_stage
66 double corona_stage; // 0.0 -> 1.0
67 GLfloat rvalue[SUN_CORONA_SAMPLES]; // stores random values for adjusting colors in the corona
70 GLuint sunTriangles[3240*3];
71 GLfloat sunVertices[1801*3];
72 GLfloat sunColors[1801*4];
81 NSString *_name;
83
84- (id) initSunWithColor:(OOColor*)sun_color andDictionary:(NSDictionary*) dict;
85- (BOOL) setSunColor:(OOColor*)sun_color;
86- (BOOL) changeSunProperty:(NSString *)key withDictionary:(NSDictionary*) dict;
87
88- (OOStellarBodyType) planetType;
89
90- (void) getDiffuseComponents:(GLfloat[4])components;
91- (void) getSpecularComponents:(GLfloat[4])components;
92
93- (void) setRadius:(GLfloat) rad andCorona:(GLfloat)corona;
94
95- (BOOL) willGoNova;
96- (BOOL) goneNova;
97- (void) setGoingNova:(BOOL) yesno inTime:(double)interval;
98
99- (void) drawStarGlare;
100- (void) drawDirectVisionSunGlare;
101- (void) resetNova;
102
103@end
OOStellarBodyType
double OOTimeDelta
Definition OOTypes.h:224
GLfloat sun_specular[4]
Definition OOSunEntity.h:59
float _sunCoronaAlphaFactor
Definition OOSunEntity.h:80
GLfloat outerCoronaColor[4]
Definition OOSunEntity.h:62
double corona_speed_factor
Definition OOSunEntity.h:66
GLfloat sun_diffuse[4]
Definition OOSunEntity.h:58
GLfloat rvalue[SUN_CORONA_SAMPLES]
Definition OOSunEntity.h:68
GLfloat lim16k
Definition OOSunEntity.h:64
float corona_blending
Definition OOSunEntity.h:69
double corona_stage
Definition OOSunEntity.h:67
NSString * _name
Definition OOSunEntity.h:82
float _novaExpansionRate
Definition OOSunEntity.h:77
GLuint sunTriangles[3240 *3]
Definition OOSunEntity.h:71
OOTimeDelta _novaCountdown
Definition OOSunEntity.h:75
GLfloat sunColors[1801 *4]
Definition OOSunEntity.h:73
GLfloat discColor[4]
Definition OOSunEntity.h:61
GLfloat sunVertices[1801 *3]
Definition OOSunEntity.h:72
GLfloat cor16k
Definition OOSunEntity.h:64
OOTimeDelta _novaExpansionTimer
Definition OOSunEntity.h:76
float _sunBrightnessFactor
Definition OOSunEntity.h:79