-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathViewerView.cpp
More file actions
177 lines (155 loc) · 4.66 KB
/
Copy pathViewerView.cpp
File metadata and controls
177 lines (155 loc) · 4.66 KB
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
//-----------------------------------------------------------------------------
//
// @doc
//
// @module ViewerView.cpp - View main view support |
//
// This module contains the support for the main view.
//
// Copyright (c) 1999 - Descartes Systems Sciences, Inc.
//
// @end
//
// $History: DcComEngGenConfigurePage.h $
//
//-----------------------------------------------------------------------------
#include "stdafx.h"
#include "Viewer.h"
#include "ViewerView.h"
#include "../_CoreLib/Script.h"
#include "../_CoreLib/Exception.h"
#include "../_CoreLib/Matrix.h"
#include "../_CoreLib/Utility.h"
#include "../_CoreLib/PerformanceTimer.h"
#include "../_MeshLib/MeshObj.h"
#include "../_MeshLib/Hull.h"
#include "../_RenderLib/Landscape.h"
#include "../_RenderLib/RenderGlobals.h"
#include "SelectDlg.h"
//
// Debug new
//
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//-----------------------------------------------------------------------------
//
// @mfunc <c CViewerView> constructor.
//
// @rdesc None.
//
//-----------------------------------------------------------------------------
CViewerView::CViewerView ()
{
//
// Initialize the sun
//
m_sSkySun .Create (
CSkyBody::Type_Sun, // type
"env/sun", // texture
0.0f, // longitude of the ascending node
23.4393f, // Incliation to the ecliptic
282.9404f, // Argument of perihelion
149600000.0f, // Mean distance
0.016709f, // Eccentricity
356.0470f, // Mean anomaly
0.9856002585f, // Mean anomaly adjust
695000.0f, // Radius of body
CVector3 (.7f, .7f, .5f), // Daytime color
CVector3 (.7f, .5f, .5f) // Nighttime color
);
//
// Initialize the sun flare
//
m_sSkySunFlare .Create (
CSkyBody::Type_Flare, // type
"effects/flare1", // texture
0.0f, // longitude of the ascending node
23.4393f, // Incliation to the ecliptic
282.9404f, // Argument of perihelion
149600000.0f, // Mean distance
0.016709f, // Eccentricity
356.0470f, // Mean anomaly
0.9856002585f, // Mean anomaly adjust
8 * 695000.0f, // Radius of body
CVector3 (.4f, .4f, .0f), // Daytime color
CVector3 (.4f, .2f, .0f) // Nighttime color
);
//
// Initialize the moon
//
m_sSkyMoon .Create (
CSkyBody::Type_Moon, // type
"env/moon", // texture
125.1228f, // longitude of the ascending node
5.1454f, // Incliation to the ecliptic
318.0634f, // Argument of perihelion
384000.0f, // Mean distance
0.054900f, // Eccentricity
115.3654f, // Mean anomaly
13.0649929509f, // Mean anomaly adjust
1738.0f, // Radius of body
CVector3 (.1f, .1f, .1f), // Daytime color
CVector3 (.4f, .4f, .4f) // Nighttime color
);
//
// Initialize the clouds
//
m_sSkyClouds1 .Create (
CSkyClouds::Type_Clouds, // type
"env/clouds", // texture
CVector2 (0.0, 1.0), // texture speed
1.0f, // texture scale
CVector3 (0.5f, 0.5f, 0.5f), // daytime color
CVector3 (0.11f, 0.10f, 0.09f), // nighttime color
1.0f // transition gamma
);
m_sSkyClouds2 .Create (
CSkyClouds::Type_Clouds, // type
"env/clouds", // texture
CVector2 (1.0, 5.0), // texture speed
0.25f, // texture scale
CVector3 (0.3f, 0.3f, 0.3f), // daytime color
CVector3 (0.11f, 0.10f, 0.09f), // nighttime color
1.0f // transition gamma
);
m_sSkyStars .Create (
CSkyClouds::Type_Stars, // type
"env/stars", // texture
CVector2 (7.0f, 0.0), // texture speed
1.0f / 24.0f, // texture scale
CVector3 (0.0f, 0.0f, 0.0f), // daytime color
CVector3 (0.2f, 0.2f, 0.2f), // nighttime color
0.3f // transition gamma
);
//
// Initialize the sky dome
//
g_sSkyDome .Create (
8, // resolution
55, // sweep in degrees
1024 * 12, // size at horizon
1.0f, // height scale factor
CVector3 (0, 0, -512 * 10), // offset
CVector3 (1.0f, 1.0f, 1.0f), // day ambient
CVector3 (0.4f, 0.4f, 0.4f), // night ambient
CVector3 (0.25f, 0.31f, .63f), // day sky color
CVector3 (0.1f, 0.1f, 0.11f) // night sky color
);
//
// Add the bodies and clouds to the sky dome
//
g_sSkyDome .AddBody (&m_sSkyMoon);
g_sSkyDome .AddBody (&m_sSkySunFlare);
g_sSkyDome .AddBody (&m_sSkySun);
g_sSkyDome .AddClouds (&m_sSkyStars);
g_sSkyDome .AddClouds (&m_sSkyClouds1);
g_sSkyDome .AddClouds (&m_sSkyClouds2);
//
// Compute starting values for the sky
// (Must be done at start of every frame)
//
g_sSkyDome .ComputePositions (0);
}