-
Notifications
You must be signed in to change notification settings - Fork 6
/
defines.hpp
255 lines (239 loc) · 5.69 KB
/
defines.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
#pragma once
#include <vector>
#include <string>
#include "util.hpp"
enum ESpectrType {
M = 0,
K = 1,
G = 2,
F = 3,
A = 4,
B = 5,
O = 6,
X = 7
};
enum EStarType {
MainSeqStar = 0,
GiantStar = 1,
WhiteDwarf = 2,
NeutronStar = 3,
BlackHole = 4
};
enum EPlanetSingularity
{
None = 0,
TidalLocked = 1,
TidalLocked2 = 2,
TidalLocked4 = 4,
LaySide = 8,
ClockwiseRotate = 0x10,
MultipleSatellites = 0x20
};
enum class EPlanetType
{
None = 0,
Vocano = 1,
Ocean = 2,
Desert = 3,
Ice = 4,
Gas = 5
};
enum class EThemeDistribute
{
Default = 0,
Birth = 1,
Interstellar = 2,
Rare = 3
};
const float orbitRadius[17] = {
0.0f,
0.4f,
0.7f,
1.0f,
1.4f,
1.9f,
2.5f,
3.3f,
4.3f,
5.5f,
6.9f,
8.4f,
10.0f,
11.7f,
13.5f,
15.4f,
17.5f
};
const int themeres[] = {
0x00000000,
0x000088e6,
0x00060000,
0x00060000,
0x00020001,
0x00020001,
0x00000276,
0x0000057e,
0x0000a8ee,
0x0000167e,
0x0000957e,
0x0000133e,
0x0000166e,
0x0001007e,
0x0000aae6,
0x0000a8fe,
0x0000a0c0,
0x0000127e,
0x0000a8ee,
0x0000167e,
0x0000137e,
0x00060000,
0x000028fe,
0x00001856,
0x0000137e,
0x00002cfe
};
class PlanetData
{
public:
int seed;
int infoSeed;
int id;
int index;
int orbitAround;
int number;
int orbitIndex;
std::string name;
std::string overrideName;
float orbitRadius = 1.0f;
float orbitInclination;
float orbitLongitude;
double orbitalPeriod = 3600.0;
float orbitPhase;
float obliquity;
double rotationPeriod = 480.0;
float rotationPhase;
float radius = 200.0f;
float scale = 1.0f;
float sunDistance;
float habitableBias;
float temperatureBias;
float ionHeight;
float windStrength;
float luminosity;
float landPercent;
double mod_x;
double mod_y;
float waterHeight;
int waterItemId;
bool levelized;
int iceFlag;
EPlanetType type;
int singularity;
int theme;
int algoId;
int style;
PlanetData* orbitAroundPlanet = NULL;
std::vector<int> gasItems;
std::vector<float> gasSpeeds;
inline float realRadius() {
return radius * scale;
}
std::string GetPlanetSingularityString()
{
std::string singularityString = "";
if (orbitAround > 0)
singularityString += "卫星";
if ((singularity & EPlanetSingularity::TidalLocked) != EPlanetSingularity::None)
singularityString += "潮汐锁定永昼永夜";
if ((singularity & EPlanetSingularity::TidalLocked2) != EPlanetSingularity::None)
singularityString += "潮汐锁定1:2";
if ((singularity & EPlanetSingularity::TidalLocked4) != EPlanetSingularity::None)
singularityString += "潮汐锁定1:4";
if ((singularity & EPlanetSingularity::LaySide) != EPlanetSingularity::None)
singularityString += "横躺自转";
if ((singularity & EPlanetSingularity::ClockwiseRotate) != EPlanetSingularity::None)
singularityString += "反向自转";
if ((singularity & EPlanetSingularity::MultipleSatellites) != EPlanetSingularity::None)
singularityString += "多卫星";
return singularityString;
}
};
class StarData {
public:
int seed;
int index;
int id;
std::string name;
std::string overrideName;
VectorLF3 position;
VectorLF3 uPosition;
float mass = 1.0f;
float lifetime = 50.0f;
float age;
EStarType type;
float temperature = 8500.0f;
ESpectrType spectr;
float classFactor;
float color;
float luminosity = 1.0f;
float radius = 1.0f;
float acdiskRadius;
float habitableRadius = 1.0f;
float lightBalanceRadius = 1.0f;
float dysonRadius = 10.0f;
float orbitScaler = 1.0f;
float asterBelt1OrbitIndex;
float asterBelt2OrbitIndex;
float asterBelt1Radius;
float asterBelt2Radius;
int planetCount;
float level;
float resourceCoef = 1.0f;
std::vector< PlanetData> planets;
inline float physicsRadius() {
return radius * 1200;
}
inline float dysonLumino() {
return Mathf.Round((float)Math.Pow(luminosity, 0.33000001311302185) * 1000.0f) / 1000.0f;
}
std::string typeString()
{
std::string text = "";
if (type == EStarType::GiantStar)
{
text = ((spectr <= ESpectrType::K) ? (text + "红巨星") : ((spectr <= ESpectrType::F) ? (text + "黄巨星") : ((spectr != ESpectrType::A) ? (text + "蓝巨星") : (text + "白巨星"))));
}
else if (type == EStarType::WhiteDwarf)
{
text += "白矮星";
}
else if (type == EStarType::NeutronStar)
{
text += "中子星";
}
else if (type == EStarType::BlackHole)
{
text += "黑洞";
}
else if (type == EStarType::MainSeqStar)
{
if(spectr == ESpectrType::A)
text = text + "A型恒星";
else if (spectr == ESpectrType::B)
text = text + "B型恒星";
else if (spectr == ESpectrType::F)
text = text + "F型恒星";
else if (spectr == ESpectrType::G)
text = text + "G型恒星";
else if (spectr == ESpectrType::K)
text = text + "K型恒星";
else if (spectr == ESpectrType::M)
text = text + "M型恒星";
else if (spectr == ESpectrType::O)
text = text + "O型恒星";
else
text = text + "X型恒星";
}
return text;
}
};