Starshatter_Open
Open source Starshatter engine
Main Page
Classes
Files
File List
File Members
All
Classes
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Video.h
Go to the documentation of this file.
1
/* Project nGen
2
John DiCamillo
3
Copyright © 1997-2002. All Rights Reserved.
4
5
SUBSYSTEM: nGen.lib
6
FILE: Video.h
7
AUTHOR: John DiCamillo
8
9
10
OVERVIEW
11
========
12
Abstract Video Interface
13
*/
14
15
#ifndef Video_h
16
#define Video_h
17
18
#include "
Geometry.h
"
19
#include "
Color.h
"
20
#include "
List.h
"
21
22
// +--------------------------------------------------------------------+
23
24
class
Video
;
25
struct
VideoMode
;
26
class
VideoSettings
;
27
class
VideoPrivateData
;
28
29
class
Bitmap
;
30
class
Camera
;
31
struct
Rect
;
32
struct
Poly
;
33
struct
Material
;
34
struct
VertexSet
;
35
class
Light
;
36
class
Solid
;
37
class
Surface
;
38
39
// +--------------------------------------------------------------------+
40
41
struct
RenderStats
42
{
43
int
nframe
;
44
int
nverts
;
45
int
npolys
;
46
int
nlines
;
47
48
int
ncalls
;
49
50
int
total_verts
;
51
int
total_polys
;
52
int
total_lines
;
53
54
void
Clear
() {
nverts
=
npolys
=
nlines
=
ncalls
=
55
total_verts
=
total_polys
=
total_lines
= 0; }
56
};
57
58
// +--------------------------------------------------------------------+
59
60
class
Video
61
{
62
public
:
63
enum
STATUS
{
VIDEO_OK
,
VIDEO_ERR
,
VIDEO_BAD_PARM
};
64
65
enum
RENDER_STATE
{
66
FILL_MODE
,
67
SHADE_MODE
,
68
LIGHTING_ENABLE
,
69
Z_ENABLE
,
70
Z_WRITE_ENABLE
,
71
Z_BIAS
,
72
TEXTURE_FILTER
,
73
DITHER_ENABLE
,
74
SPECULAR_ENABLE
,
75
FOG_ENABLE
,
76
FOG_COLOR
,
77
FOG_DENSITY
,
78
STENCIL_ENABLE
,
79
TEXTURE_WRAP
,
80
LIGHTING_PASS
,
81
82
RENDER_STATE_MAX
83
};
84
85
enum
BLEND_TYPE
{
86
BLEND_SOLID
= 1,
87
BLEND_ALPHA
= 2,
88
BLEND_ADDITIVE
= 4,
89
BLEND_FORCE_DWORD
= 0x7fffffff,
90
};
91
92
enum
SHADE_TYPE
{
93
SHADE_FLAT
= 1,
94
SHADE_GOURAUD
= 2,
95
SHADE_PHONG
= 3,
96
SHADE_FORCE_DWORD
= 0x7fffffff,
97
};
98
99
enum
FILL_TYPE
{
100
FILL_POINT
= 1,
101
FILL_WIREFRAME
= 2,
102
FILL_SOLID
= 3,
103
FILL_FORCE_DWORD
= 0x7fffffff,
104
};
105
106
enum
FILTER_TYPE
{
107
FILTER_NONE
= 1,
108
FILTER_LINEAR
= 2,
109
FILTER_MIPMAP
= 3,
110
FILTER_MIPLINEAR
= 4,
111
FILTER_TRILINEAR
= 6,
112
FILTER_FORCE_DWORD
= 0x7fffffff,
113
};
114
115
enum
PROJECTION_TYPE
{
116
PROJECTION_PERSPECTIVE
= 1,
117
PROJECTION_ORTHOGONAL
= 2,
118
PROJECTION_FORCE_DWORD
= 0x7fffffff,
119
};
120
121
Video
();
122
virtual
~Video
();
123
124
STATUS
Status
()
const
{
return
status
; }
125
virtual
const
VideoSettings
*
126
GetVideoSettings
()
const
{
return
0; }
127
virtual
bool
SetVideoSettings
(
const
VideoSettings
* vs) {
return
false
; }
128
virtual
bool
Reset
(
const
VideoSettings
* vs) {
return
false
; }
129
130
virtual
bool
SetBackgroundColor
(
Color
c) {
return
false
; }
131
virtual
bool
SetGammaLevel
(
int
g) {
return
true
; }
132
virtual
bool
SetObjTransform
(
const
Matrix
& o,
const
Point
& l){
return
false
; }
133
134
virtual
int
Width
()
const
{
return
0; }
135
virtual
int
Height
()
const
{
return
0; }
136
virtual
int
Depth
()
const
{
return
0; }
137
138
virtual
void
RecoverSurfaces
() { }
139
140
virtual
bool
ClearAll
() {
return
false
; }
141
virtual
bool
ClearDepthBuffer
() {
return
false
; }
142
virtual
bool
Present
() {
return
false
; }
143
virtual
bool
Pause
() {
return
false
; }
144
virtual
bool
Resume
() {
return
false
; }
145
146
virtual
bool
IsWindowed
()
const
;
147
virtual
bool
IsFullScreen
()
const
;
148
virtual
bool
IsModeSupported
(
int
width,
int
height,
int
bpp)
149
const
{
return
true
; }
150
virtual
bool
IsHardware
()
const
{
return
false
; }
151
virtual
bool
IsHardwareTL
()
const
{
return
false
; }
152
virtual
int
ZDepth
()
const
{
return
0; }
153
virtual
DWORD
VidMemFree
()
const
{
return
0; }
154
virtual
int
D3DLevel
()
const
{
return
0; }
155
virtual
int
MaxTexSize
()
const
{
return
256; }
156
virtual
int
MaxTexAspect
()
const
{
return
0; }
157
virtual
int
GammaLevel
()
const
{
return
190; }
158
159
virtual
bool
IsShadowEnabled
()
const
{
return
shadow_enabled
; }
160
virtual
bool
IsBumpMapEnabled
()
const
{
return
bump_enabled
; }
161
virtual
bool
IsSpecMapEnabled
()
const
{
return
spec_enabled
; }
162
163
virtual
void
SetShadowEnabled
(
bool
e) {
shadow_enabled
= e; }
164
virtual
void
SetBumpMapEnabled
(
bool
e) {
bump_enabled
= e; }
165
virtual
void
SetSpecMapEnabled
(
bool
e) {
spec_enabled
= e; }
166
167
virtual
bool
Capture
(
Bitmap
& bmp) {
return
false
; }
168
virtual
bool
GetWindowRect
(
Rect
& r) {
return
false
; }
169
virtual
bool
SetWindowRect
(
const
Rect
& r) {
return
false
; }
170
virtual
bool
SetViewport
(
int
x,
int
y,
int
w,
int
h) {
return
false
; }
171
virtual
bool
SetCamera
(
const
Camera
* cam) {
camera
= cam;
172
return
false
; }
173
virtual
bool
SetProjection
(
float
fov,
174
float
znear=1.0f,
175
float
zfar=1.0e6f,
176
DWORD type=
PROJECTION_PERSPECTIVE
) {
return
false
; }
177
virtual
bool
SetEnvironment
(
Bitmap
** faces) {
return
false
; }
178
virtual
bool
SetAmbient
(
Color
c) {
return
false
; }
179
virtual
bool
SetLights
(
const
List<Light>
& lights) {
return
false
; }
180
virtual
bool
SetRenderState
(
RENDER_STATE
state, DWORD value) {
return
false
; }
181
virtual
bool
SetBlendType
(
int
blend_type) {
return
false
; }
182
virtual
bool
StartFrame
() {
return
false
; }
183
virtual
bool
EndFrame
() {
return
false
; }
184
185
virtual
bool
DrawPolys
(
int
npolys,
Poly
* p) {
return
false
; }
186
virtual
bool
DrawScreenPolys
(
int
npolys,
Poly
* p,
int
blend=0) {
return
false
; }
187
virtual
bool
DrawSolid
(
Solid
* s, DWORD blend_modes=0xf) {
return
false
; }
188
virtual
bool
DrawShadow
(
Solid
* s,
int
nverts,
Vec3
* verts,
bool
vis=
false
)
189
{
return
false
; }
190
virtual
bool
DrawLines
(
int
nlines,
Vec3
* v,
Color
c,
int
blend=0) {
return
false
; }
191
virtual
bool
DrawScreenLines
(
int
nlines,
float
* v,
Color
c,
int
blend=0)
192
{
return
false
; }
193
virtual
bool
DrawPoints
(
VertexSet
* v) {
return
false
; }
194
virtual
bool
DrawPolyOutline
(
Poly
* p) {
return
false
; }
195
virtual
bool
UseMaterial
(
Material
* m) {
return
false
; }
196
197
virtual
bool
UseXFont
(
const
char
* name,
int
size,
bool
b,
bool
i) {
return
false
; }
198
virtual
bool
DrawText
(
const
char
* text,
int
count,
const
Rect
& rect,
199
DWORD format,
Color
c) {
return
false
; }
200
201
virtual
void
PreloadTexture
(
Bitmap
* bmp) { }
202
virtual
void
PreloadSurface
(
Surface
* s) { }
203
virtual
void
InvalidateCache
() { }
204
205
const
Camera
*
GetCamera
()
const
{
return
camera
; }
206
const
RenderStats
&
GetStats
()
const
{
return
stats
; }
207
static
Video
*
GetInstance
() {
return
video_instance
; }
208
209
protected
:
210
STATUS
status
;
211
RenderStats
stats
;
212
const
Camera
*
camera
;
213
214
bool
shadow_enabled
;
215
bool
bump_enabled
;
216
bool
spec_enabled
;
217
218
static
Video
*
video_instance
;
219
};
220
221
// +--------------------------------------------------------------------+
222
223
class
VideoPrivateData
224
{
225
public
:
226
VideoPrivateData
() :
valid
(false) { }
227
virtual
~VideoPrivateData
() { }
228
229
virtual
int
GetType
()
const
{
return
0; }
230
231
virtual
bool
IsValid
()
const
{
return
valid
; }
232
virtual
void
Invalidate
() {
valid
=
false
; }
233
virtual
void
Validate
() {
valid
=
true
; }
234
235
protected
:
236
bool
valid
;
237
};
238
239
// +--------------------------------------------------------------------+
240
241
#endif Video_h
242
nGenEx
Video.h
Generated on Tue Jun 5 2012 20:46:39 for Starshatter_Open by
1.8.1