Vegastrike 0.5.1 rc1
1.0
Original sources for Vegastrike Evolved
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
sphere.h
Go to the documentation of this file.
1
#ifndef _GFX_SPHERE_H_
2
#define _GFX_SPHERE_H_
3
4
#include "
mesh.h
"
5
#include "
quaternion.h
"
6
#include <assert.h>
7
#include <string>
8
9
#ifndef M_PI
10
#define M_PI (3.1415926536F)
11
#endif
12
13
class
SphereMesh
:
public
Mesh
14
{
15
//no local vars allowed
16
protected
:
17
virtual
float
GetT
(
float
rho,
float
rho_min,
float
rho_max )
const
;
18
virtual
float
GetS
(
float
theta,
float
theta_min,
float
theta_max )
const
;
19
virtual
Mesh
*
AllocNewMeshesEachInSizeofMeshSpace
(
int
num )
20
{
21
assert(
sizeof
(
Mesh
) ==
sizeof
(*
this
) );
22
return
new
SphereMesh
[num];
23
}
24
void
InitSphere
(
float
radius,
25
int
stacks,
26
int
slices,
27
const
char
*
texture
,
28
const
std::string &
technique
,
29
const
char
*alpha = NULL,
30
bool
insideout =
false
,
31
const
BLENDFUNC
a
=
ONE
,
32
const
BLENDFUNC
b
=
ZERO
,
33
bool
envMap =
false
,
34
float
rho_min = 0.0,
35
float
rho_max =
M_PI
,
36
float
theta_min = 0.0,
37
float
theta_max = 2 *
M_PI
,
38
FILTER
mipmap =
MIPMAP
,
39
bool
reverse_normals =
false
,
40
bool
subclass =
false
);
41
public
:
SphereMesh
() :
Mesh
()
42
{
43
setConvex
(
true
);
44
}
45
virtual
int
MeshType
()
const
46
{
47
return
1;
48
}
49
virtual
void
SelectCullFace
(
int
whichdrawqueue );
50
virtual
void
RestoreCullFace
(
int
whichdrawqueue );
51
SphereMesh
(
float
radius,
52
int
stacks,
53
int
slices,
54
const
char
*
texture
,
55
const
std::string &
technique
,
56
const
char
*alpha = NULL,
57
bool
insideout =
false
,
58
const
BLENDFUNC
a
=
ONE
,
59
const
BLENDFUNC
b
=
ZERO
,
60
bool
envMap =
false
,
61
float
rho_min = 0.0,
62
float
rho_max =
M_PI
,
63
float
theta_min = 0.0,
64
float
theta_max = 2 *
M_PI
,
65
FILTER
mipmap =
MIPMAP
,
66
bool
reverse_normals =
false
)
67
{
68
InitSphere
( radius,
69
stacks,
70
slices,
71
texture,
72
technique,
73
alpha,
74
insideout,
75
a
,
76
b
,
77
envMap,
78
rho_min,
79
rho_max,
80
theta_min,
81
theta_max,
82
mipmap,
83
reverse_normals );
84
}
85
void
Draw
(
float
lod,
bool
centered =
false
,
const
Matrix
&m =
identity_matrix
);
86
virtual
void
ProcessDrawQueue
(
int
whichpass,
int
which,
bool
zsort,
const
QVector
&sortctr );
87
};
88
89
class
CityLights
:
public
SphereMesh
90
{
91
//no local vars allowed
92
//these VARS BELOW ARE STATIC...change it and DIE
93
static
float
wrapx;
94
static
float
wrapy;
95
protected
:
96
virtual
float
GetT
(
float
rho,
float
rho_min,
float
rho_max )
const
;
97
virtual
float
GetS
(
float
theta,
float
theta_min,
float
theta_max )
const
;
98
virtual
Mesh
*
AllocNewMeshesEachInSizeofMeshSpace
(
int
num )
99
{
100
assert(
sizeof
(
Mesh
) ==
sizeof
(*
this
) );
101
return
new
CityLights
[num];
102
}
103
public
:
CityLights
() :
SphereMesh
() {}
104
CityLights
(
float
radius,
105
int
stacks,
106
int
slices,
107
const
char
*
texture
,
108
int
texturewrapx,
109
int
texturewrapy,
110
bool
insideout =
false
,
111
const
BLENDFUNC
a
=
ONE
,
112
const
BLENDFUNC
b
=
ZERO
,
113
bool
envMap =
false
,
114
float
rho_min = 0.0,
115
float
rho_max =
M_PI
,
116
float
theta_min = 0.0,
117
float
theta_max = 2 *
M_PI
,
118
bool
inside_out =
true
);
119
virtual
void
ProcessDrawQueue
(
int
whichpass,
int
which,
bool
zsort,
const
QVector
&sortctr );
120
};
121
#endif
122
src
gfx
sphere.h
Generated on Fri May 29 2015 23:07:28 for Vegastrike 0.5.1 rc1 by
1.8.4