-
Notifications
You must be signed in to change notification settings - Fork 0
/
World.cpp
90 lines (69 loc) · 1.57 KB
/
World.cpp
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
/*-----------------------------------------------------------------------------
World.cpp
2006 Shamus Young
-------------------------------------------------------------------------------
This just holds some values for the lighting colors. and the direction of the
"sun". REMEMBER that the light vector won't work if you move it off the
X Y plane, so the Z value should always be zero.
-----------------------------------------------------------------------------*/
#include "precompiled.h"
static vec3 light_vector( -0.75f, 0.25f, 0.0f );
static rgba light_color( 2.1f, 2.1f, 0.1f, 1.0f );
static rgba ambient_color( 0.6f, 0.6f, 0.6f, 1.0f );
static rgba fog_color( 0.7f, 0.7f, 0.7f, 1.0f );
static float fade;
static long last_update;
static CPointer* pointer;
vec3 WorldLightVector ( void )
{
return light_vector;
}
float WorldFade ( void )
{
return fade;
}
vec4 WorldLightQuat ( void )
{
vec4 q;
q.x = light_vector.x;
q.y = light_vector.y;
q.z = light_vector.z;
q.w = 0.0f;
return q;
}
rgba WorldLightColor ( void )
{
return light_color;
}
rgba WorldFogColor ( void )
{
return fog_color;
}
rgba WorldAmbientColor ( void )
{
return ambient_color;
}
void WorldInit ( void )
{
CTerrain* t;
pointer = new CPointer ();
t = new CTerrain ( MapSize () );
new CSky ();
last_update = GetTickCount ();
}
void WorldTerm ( void )
{
}
void WorldUpdate ( void )
{
long now;
long delta;
now = GetTickCount ();
delta = now - last_update;
last_update = now;
fade += ( float )delta / 500.0f;
if ( fade > 1.0f ) {
EntityFadeStart ();
fade = 0.0f;
}
}