zenilib: zenilib/jni/external/zenilib/zeni_graphics/Video_DX9.cpp Source File

zenilib 0.5.3.0

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Video_DX9.cpp
Go to the documentation of this file.
1 /* This file is part of the Zenipex Library (zenilib).
2 * Copyright (C) 2011 Mitchell Keith Bloch (bazald).
3 *
4 * zenilib is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * zenilib is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with zenilib. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18 #include <zeni_graphics.h>
19
20 #ifndef DISABLE_DX9
21
22 #include <GLSLANG/ShaderLang.h>
23 #include <SDL/SDL_syswm.h>
24
25 #include <cassert>
26 #include <iostream>
27
28 #include <d3d9.h>
29 #include <d3dx9.h>
30
31 #if defined(_DEBUG) && defined(_WINDOWS)
32 #define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__)
33 #define new DEBUG_NEW
34 #endif
35
36 namespace Zeni {
37
38 Video_DX9::Video_DX9()
39 : m_d3d_capabilities(0),
40 m_d3d_parameters(0),
41 m_d3d(0),
42 m_d3d_device(0),
43 m_matrix_stack(0),
44 m_begun_render(false),
45 m_textured(false),
46 m_fvf_3d(false),
47 m_render_target(0),
48 m_render_to_surface(0),
49 m_back_buffer(0)
50 {
51 m_d3d9 = LoadLibrary("d3d9.dll");
52 if(!m_d3d9) {
53 std::cerr << "Loading d3d9.dll failed." << std::endl;
54
55 throw Video_Init_Failure();
56 }
57
58 g_Direct3DCreate9 = (Direct3DCreate9_fcn)GetProcAddress(m_d3d9, "Direct3DCreate9");
59 if(!g_Direct3DCreate9) {
60 std::cerr << "Loading d3d9.dll failed." << std::endl;
61
62 FreeLibrary(m_d3d9);
63
64 zero_handles();
65
66 throw Video_Init_Failure();
67 }
68
69 m_d3dx9 = LoadLibrary("D3DX9_43.dll");
70 if(!m_d3dx9) m_d3dx9 = LoadLibrary("D3DX9_42.dll");
71 if(!m_d3dx9) m_d3dx9 = LoadLibrary("D3DX9_41.dll");
72 if(!m_d3dx9) m_d3dx9 = LoadLibrary("D3DX9_40.dll");
73 if(!m_d3dx9) m_d3dx9 = LoadLibrary("D3DX9_39.dll");
74 if(!m_d3dx9) m_d3dx9 = LoadLibrary("D3DX9_38.dll");
75 if(!m_d3dx9) m_d3dx9 = LoadLibrary("D3DX9_37.dll");
76 if(!m_d3dx9) m_d3dx9 = LoadLibrary("d3dx9_36.dll");
77 if(!m_d3dx9) m_d3dx9 = LoadLibrary("d3dx9_35.dll");
78 if(!m_d3dx9) m_d3dx9 = LoadLibrary("d3dx9_34.dll");
79 if(!m_d3dx9) m_d3dx9 = LoadLibrary("d3dx9_33.dll");
80 if(!m_d3dx9) m_d3dx9 = LoadLibrary("d3dx9_32.dll");
81 if(!m_d3dx9) m_d3dx9 = LoadLibrary("d3dx9_31.dll");
82 if(!m_d3dx9) m_d3dx9 = LoadLibrary("d3dx9_30.dll");
83 if(!m_d3dx9) m_d3dx9 = LoadLibrary("d3dx9_29.dll");
84 if(!m_d3dx9) m_d3dx9 = LoadLibrary("d3dx9_28.dll");
85 if(!m_d3dx9) m_d3dx9 = LoadLibrary("d3dx9_27.dll");
86 if(!m_d3dx9) m_d3dx9 = LoadLibrary("d3dx9_26.dll");
87 if(!m_d3dx9) m_d3dx9 = LoadLibrary("d3dx9_25.dll");
88 if(!m_d3dx9) m_d3dx9 = LoadLibrary("d3dx9_24.dll");
89 if(!m_d3dx9) {
90 std::cerr << "Loading d3dx9.dll failed." << std::endl;
91
92 FreeLibrary(m_d3d9);
93
94 zero_handles();
95
96 throw Video_Init_Failure();
97 }
98
99 g_D3DXCreateRenderToSurface = (D3DXCreateRenderToSurface_fcn)GetProcAddress(m_d3dx9, "D3DXCreateRenderToSurface");
100 g_D3DXCreateTexture = (D3DXCreateTexture_fcn)GetProcAddress(m_d3dx9, "D3DXCreateTexture");
101 g_D3DXFilterTexture = (D3DXFilterTexture_fcn)GetProcAddress(m_d3dx9, "D3DXFilterTexture");
102 g_D3DXCreateMatrixStack = (D3DXCreateMatrixStack_fcn)GetProcAddress(m_d3dx9, "D3DXCreateMatrixStack");
103 g_D3DXCompileShader = (D3DXCompileShader_fcn)GetProcAddress(m_d3dx9, "D3DXCompileShader");
104 if(!g_D3DXCreateRenderToSurface || !g_D3DXCreateTexture ||
105 !g_D3DXFilterTexture || !g_D3DXCreateMatrixStack ||
106 !g_D3DXCompileShader)
107 {
108 std::cerr << "Loading d3dx9.dll failed." << std::endl;
109
110 FreeLibrary(m_d3dx9);
111 FreeLibrary(m_d3d9);
112
113 zero_handles();
114
115 throw Video_Init_Failure();
116 }
117
118 m_d3d = Direct3DCreate9()(D3D_SDK_VERSION);
119 if(!m_d3d) {
120 FreeLibrary(m_d3dx9);
121 FreeLibrary(m_d3d9);
122
123 zero_handles();
124
125 throw Video_Init_Failure();
126 }
127
128 try {
129 init();
130 }
131 catch(...) {
132 delete m_d3d_parameters;
133 delete m_d3d_capabilities;
134
135 FreeLibrary(m_d3dx9);
136 FreeLibrary(m_d3d9);
137
138 zero_handles();
139
140 throw Video_Init_Failure();
141 }
142 }
143
144 Video_DX9::~Video_DX9() {
145 destroy_device();
146
147 if(m_d3d) {
148 m_d3d->Release();
149 m_d3d = 0;
150 }
151
152 delete m_d3d_parameters;
153 delete m_d3d_capabilities;
154
155 FreeLibrary(m_d3dx9);
156 FreeLibrary(m_d3d9);
157
158 zero_handles();
159 }
160
161 static bool g_video_dx9_reset = false;
162
163 bool Video_DX9::begin_prerender() {
164 assert(!m_render_target && !m_render_to_surface);
165
166 if(g_video_dx9_reset) {
167 const HRESULT result = m_d3d_device->TestCooperativeLevel();
168
169 if(result == D3DERR_DEVICELOST)
170 return false;
171 else if(result == D3DERR_DRIVERINTERNALERROR)
172 throw Video_Device_Failure();
173
174 if(result == D3DERR_DEVICENOTRESET) {
175 if(m_back_buffer) {
176 m_back_buffer->Release();
177 m_back_buffer = 0;
178 }
179
180 if(FAILED(m_d3d_device->Reset(m_d3d_parameters)))
181 throw Video_Device_Failure();
182
183 g_video_dx9_reset = false;
184
185 m_d3d_device->GetRenderTarget(0, &m_back_buffer);
186
187 init_context();
188 }
189 }
190
191 get_Textures().unlose_resources();
192 get_Fonts().unlose_resources();
193
194 return true;
195 }
196
197 bool Video_DX9::begin_render() {
198 assert(!m_render_target && !m_render_to_surface);
199
200 HRESULT result = m_begun_render ? m_d3d_device->Present(0, 0, 0, 0) : S_OK;
201
202 if(result == S_OK) {
203 m_begun_render = true;
204
205 D3DVIEWPORT9 vp = {0, 0, DWORD(get_Window().get_width()), DWORD(get_Window().get_height()), 0, 1};
206 m_d3d_device->SetViewport(&vp);
207 m_d3d_device->Clear(0, 0, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(get_clear_Color().r_ub(), get_clear_Color().g_ub(), get_clear_Color().b_ub()), 1.0f, 0);
208 m_d3d_device->BeginScene();
209
210 return true;
211 }
212 else if(result == D3DERR_DEVICELOST) {
213 g_video_dx9_reset = true;
214 return false;
215 }
216 else if(result == D3DERR_DEVICEREMOVED) {
217 throw Video_Device_Failure();
218 }
219
220 return false;
221 }
222
223 void Video_DX9::end_render() {
224 m_d3d_device->EndScene();
225 }
226
227 void Video_DX9::render(const Renderable &renderable) {
228 class PrePostRenderActor {
229 PrePostRenderActor & operator=(const PrePostRenderActor &) {return *this;}
230
231 public:
232 PrePostRenderActor(const Renderable &renderable_)
233 : renderable(renderable_)
234 {
235 renderable.pre_render();
236 }
237
238 ~PrePostRenderActor() {
239 renderable.post_render();
240 }
241 private:
242 const Renderable &renderable;
243 } ppra(renderable);
244
245 set_fvf(renderable.is_3d());
246
247 renderable.render_to(*this);
248 }
249
250 void Video_DX9::clear_depth_buffer() {
251 m_d3d_device->Clear(0, 0, D3DCLEAR_ZBUFFER, D3DCOLOR(), 1.0f, 0);
252 }
253
254 int Video_DX9::get_maximum_anisotropy() const {
255 return int(m_d3d_capabilities->MaxAnisotropy);
256 }
257
258 bool Video_DX9::has_vertex_buffers() const {
259 return true;
260 }
261
262 void Video_DX9::set_2d_view(const std::pair<Point2f, Point2f> &camera2d, const std::pair<Point2i, Point2i> &viewport, const bool &fix_aspect_ratio) {
263 Video::set_2d_view(camera2d, viewport, fix_aspect_ratio);
264
265 Matrix4f world = Matrix4f::Scale(Vector3f(1.0f, 1.0f, 0.5f)) *
266 Matrix4f::Translate(Vector3f(0.0f, 0.0f, 1.0f));
267 D3DXMATRIX * const world_ptr = reinterpret_cast< D3DXMATRIX *>(&world);
268
269 m_d3d_device->SetTransform(D3DTS_WORLD, world_ptr);
270 m_matrix_stack->LoadMatrix(world_ptr);
271 }
272
273 void Video_DX9::set_3d_view(const Camera &camera, const std::pair<Point2i, Point2i> &viewport) {
274 Video::set_3d_view(camera, viewport);
275
276 Matrix4f world = Matrix4f::Identity();
277 D3DXMATRIX * const world_ptr = reinterpret_cast< D3DXMATRIX *>(&world);
278
279 m_d3d_device->SetTransform(D3DTS_WORLD, world_ptr);
280 m_matrix_stack->LoadMatrix(world_ptr);
281 }
282
283 void Video_DX9::set_backface_culling(const bool &on) {
284 Video::set_backface_culling(on);
285
286 if(on)
287 m_d3d_device->SetRenderState(D3DRS_CULLMODE, D3DCULL_CW);
288 else
289 m_d3d_device->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
290 }
291
292 void Video_DX9::set_vertical_sync(const bool &on) {
293 Video::set_vertical_sync(on);
294
295 destroy_device();
296 init();
297 }
298
299 void Video_DX9::set_zwrite(const bool &enabled) {
300 Video::set_zwrite(enabled);
301
302 m_d3d_device->SetRenderState(D3DRS_ZWRITEENABLE, DWORD(enabled));
303 }
304
305 void Video_DX9::set_ztest(const bool &enabled) {
306 Video::set_ztest(enabled);
307
308 if(enabled) {
309 m_d3d_device->SetRenderState(D3DRS_ZFUNC, D3DCMP_LESSEQUAL);
310 m_d3d_device->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);
311 }
312 else
313 m_d3d_device->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
314 }
315
316 void Video_DX9::set_alpha_test(const bool &enabled,
317 const TEST &test,
318 const float &value)
319 {
320 Video::set_alpha_test(enabled, test, value);
321
322 D3DCMPFUNC func;
323
324 switch(test) {
325 case ZENI_NEVER: func = D3DCMP_NEVER; break;
326 case ZENI_LESS: func = D3DCMP_LESS; break;
327 case ZENI_EQUAL: func = D3DCMP_EQUAL; break;
328 case ZENI_GREATER: func = D3DCMP_GREATER; break;
329 case ZENI_NOT_EQUAL: func = D3DCMP_NOTEQUAL; break;
330 case ZENI_LESS_OR_EQUAL: func = D3DCMP_LESSEQUAL; break;
331 case ZENI_GREATER_OR_EQUAL: func = D3DCMP_GREATEREQUAL; break;
332 case ZENI_ALWAYS: func = D3DCMP_ALWAYS; break;
333 default:
334 assert(false);
335 return;
336 }
337
338 int ref = static_cast<int>(255.0f * value + 0.5f);
339 if(ref < 0)
340 ref = 0;
341 else if(ref > 0xFF)
342 ref = 0xFF;
343
344 m_d3d_device->SetRenderState(D3DRS_ALPHATESTENABLE, DWORD(enabled));
345 m_d3d_device->SetRenderState(D3DRS_ALPHAREF, DWORD(ref));
346 m_d3d_device->SetRenderState(D3DRS_ALPHAFUNC, func);
347 }
348
349 void Video_DX9::set_Color(const Color &color) {
350 Video::set_Color(color);
351
352 m_d3d_device->SetRenderState(D3DRS_TEXTUREFACTOR, color.get_argb());
353 }
354
355 void Video_DX9::apply_Texture(const unsigned long &id) {
356 get_Textures().apply_Texture(id);
357
358 m_textured = true;
359
360 set_fvf();
361 }
362
363 void Video_DX9::apply_Texture(const Texture &texture) {
364 texture.apply_Texture();
365
366 m_textured = true;
367
368 set_fvf();
369 }
370
371 void Video_DX9::unapply_Texture() {
372 m_textured = false;
373
374 m_d3d_device->SetTexture(0, 0);
375
376 m_d3d_device->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_DIFFUSE);
377 m_d3d_device->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_DIFFUSE);
378 m_d3d_device->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
379 m_d3d_device->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
380
381 set_fvf();
382 }
383
384 void Video_DX9::set_lighting(const bool &on) {
385 Video::set_lighting(on);
386
387 m_d3d_device->SetRenderState(D3DRS_LIGHTING, DWORD(on));
388 m_d3d_device->SetRenderState(D3DRS_SPECULARENABLE, DWORD(on));
389 }
390
391 void Video_DX9::set_ambient_lighting(const Color &color) {
392 Video::set_ambient_lighting(color);
393
394 m_d3d_device->SetRenderState(D3DRS_AMBIENT, color.get_argb());
395 }
396
397 void Video_DX9::set_Light(const int &number, const Light &light) {
398 if(number < 0 || 7 < number)
399 throw Light_Out_of_Range(); // Match OpenGL - Limit for both may actually be higher
400
401 Video::set_Light(number, light);
402
403 light.set(DWORD(number), *this);
404 }
405
406 void Video_DX9::unset_Light(const int &number) {
407 if(number < 0 || 7 < number)
408 throw Light_Out_of_Range(); // Match OpenGL - Limit for both may actually be higher
409
410 Video::unset_Light(number);
411
412 m_d3d_device->LightEnable(DWORD(number), FALSE);
413 }
414
415 void Video_DX9::set_Material(const Material &material) {
416 material.set(*this);
417 }
418
419 void Video_DX9::unset_Material(const Material &material) {
420 material.unset(*this);
421 }
422
423 void Video_DX9::set_Fog(const Fog &fog) {
424 Video::set_Fog(fog);
425
426 m_d3d_device->SetRenderState(D3DRS_FOGENABLE, true);
427 fog.set(*this);
428 }
429
430 void Video_DX9::unset_Fog() {
431 Video::unset_Fog();
432
433 m_d3d_device->SetRenderState(D3DRS_FOGENABLE, false);
434 m_d3d_device->SetRenderState(D3DRS_FOGTABLEMODE, D3DFOG_NONE);
435 }
436
437 void Video_DX9::set_program(Program &program) {
438 Program_DX9 &pdx = dynamic_cast< Program_DX9 &>(program);
439
440 if(pdx.get_vertex_shader())
441 m_d3d_device->SetVertexShader(pdx.get_vertex_shader()->get_vertex_shader());
442 if(pdx.get_fragment_shader())
443 m_d3d_device->SetPixelShader(pdx.get_fragment_shader()->get_pixel_shader());
444 }
445
446 void Video_DX9::unset_program() {
447 m_d3d_device->SetVertexShader(0);
448 m_d3d_device->SetPixelShader(0);
449 }
450
451 void Video_DX9::set_render_target(Texture &texture) {
452 if(m_render_target)
453 throw Video_Render_To_Texture_Error();
454
455 Texture_DX9 &tdx = dynamic_cast< Texture_DX9 &>(texture);
456
457 LPDIRECT3DSURFACE9 render_surface = 0;
458
459 if(FAILED(tdx.m_texture->GetSurfaceLevel(0, &render_surface)))
460 throw Video_Render_To_Texture_Error();
461
462 m_render_to_surface = tdx.render_to_surface();
463
464 if(!m_render_to_surface || FAILED(m_d3d_device->SetRenderTarget(0, render_surface)))
465 throw Video_Render_To_Texture_Error();
466
467 if(FAILED(m_d3d_device->BeginScene())) {
468 m_d3d_device->SetRenderTarget(0, m_back_buffer);
469 throw Video_Render_To_Texture_Error();
470 }
471
472 m_render_target = &tdx;
473 }
474
475 void Video_DX9::unset_render_target() {
476 if(!m_render_target || !m_render_to_surface)
477 throw Video_Render_To_Texture_Error();
478
479 m_render_target = 0;
480
481 m_d3d_device->EndScene();
482 m_render_to_surface = 0;
483
484 if(FAILED(m_d3d_device->SetRenderTarget(0, m_back_buffer)))
485 throw Video_Render_To_Texture_Error();
486 }
487
488 void Video_DX9::clear_render_target(const Color &color) {
489 const Point2i &render_target_size = get_render_target_size();
490 set_viewport(std::make_pair(Point2i(0, 0), Point2i(render_target_size.x, render_target_size.y)));
491 m_d3d_device->Clear(0, 0, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_ARGB(color.a_ub(), color.r_ub(), color.g_ub(), color.b_ub()), 1.0f, 0);
492 }
493
494 inline const Point2i & Video_DX9::get_render_target_size() const {
495 if(m_render_target)
496 return m_render_target->get_size();
497 else
498 return get_Window().get_size();
499 }
500
501 void Video_DX9::push_world_stack() {
502 get_matrix_stack()->Push();
503 }
504
505 void Video_DX9::pop_world_stack() {
506 get_matrix_stack()->Pop();
507 m_d3d_device->SetTransform(D3DTS_WORLD, m_matrix_stack->GetTop());
508 }
509
510 void Video_DX9::translate_scene(const Vector3f &direction) {
511 m_matrix_stack->TranslateLocal(direction.i, direction.j, direction.k);
512 m_d3d_device->SetTransform(D3DTS_WORLD, m_matrix_stack->GetTop());
513 }
514
515 void Video_DX9::rotate_scene(const Vector3f &about, const float &radians) {
516 m_matrix_stack->RotateAxisLocal(reinterpret_cast<const D3DXVECTOR3 *>(&about), radians);
517 m_d3d_device->SetTransform(D3DTS_WORLD, m_matrix_stack->GetTop());
518 }
519
520 void Video_DX9::scale_scene(const Vector3f &factor) {
521 m_matrix_stack->ScaleLocal(factor.i, factor.j, factor.k);
522 m_d3d_device->SetTransform(D3DTS_WORLD, m_matrix_stack->GetTop());
523 }
524
525 void Video_DX9::transform_scene(const Matrix4f &transformation) {
526 m_matrix_stack->MultMatrixLocal(reinterpret_cast<const D3DXMATRIX * const>(&transformation));
527 m_d3d_device->SetTransform(D3DTS_WORLD, m_matrix_stack->GetTop());
528 }
529
530 Point2f Video_DX9::get_pixel_offset() const {
531 return Point2f(0.5f, 0.5f);
532 }
533
534 void Video_DX9::set_view_matrix(const Matrix4f &view) {
535 Video::set_view_matrix(view);
536
537 m_d3d_device->SetTransform(D3DTS_VIEW, reinterpret_cast<D3DXMATRIX *>(const_cast<Matrix4f *>(&view)));
538 }
539
540 void Video_DX9::set_projection_matrix(const Matrix4f &projection) {
541 Video::set_projection_matrix(projection);
542
543 m_d3d_device->SetTransform(D3DTS_PROJECTION, reinterpret_cast<D3DXMATRIX *>(const_cast<Matrix4f *>(&projection)));
544 }
545
546 void Video_DX9::set_viewport(const std::pair<Point2i, Point2i> &viewport) {
547 Video::set_viewport(viewport);
548
549 D3DVIEWPORT9 vp = {DWORD(viewport.first.x), DWORD(viewport.first.y), DWORD(viewport.second.x - viewport.first.x), DWORD(viewport.second.y - viewport.first.y), 0u, 1u};
550 m_d3d_device->SetViewport(&vp);
551 }
552
553 Texture * Video_DX9::load_Texture(const String &filename, const bool &repeat, const bool & /*lazy_loading*/ ) {
554 return new Texture_DX9(filename, repeat);
555 }
556
557 Texture * Video_DX9::create_Texture(const Image &image) {
558 return new Texture_DX9(image);
559 }
560
561 Texture * Video_DX9::create_Texture(const Point2i &size, const bool &repeat) {
562 const Point2i &max = get_Window().get_size();
563
564 Point2i corrected(size);
565 while(corrected.x > max.x)
566 corrected.x /= 2;
567 while(corrected.y > max.y)
568 corrected.y /= 2;
569
570 return new Texture_DX9(corrected, repeat);
571 }
572
573 Font * Video_DX9::create_Font(const String &filename, const float &glyph_height, const float &virtual_screen_height) {
574 return new Font_FT(filename, glyph_height, virtual_screen_height);
575 }
576
577 Vertex_Buffer_Renderer * Video_DX9::create_Vertex_Buffer_Renderer(Vertex_Buffer &vertex_buffer) {
578 return new Vertex_Buffer_Renderer_DX9(vertex_buffer);
579 }
580
581 Shader * Video_DX9::create_Vertex_Shader(const String &filename) {
582 return new Shader_DX9(compile_glsles_shader(filename, m_vertex_compiler), Shader::VERTEX, *this);
583 }
584
585 Shader * Video_DX9::create_Fragment_Shader(const String &filename) {
586 return new Shader_DX9(compile_glsles_shader(filename, m_fragment_compiler), Shader::FRAGMENT, *this);
587 }
588
589 Program * Video_DX9::create_Program() {
590 return new Program_DX9();
591 }
592
593 const D3DCAPS9 & Video_DX9::get_d3d_capabilities() {
594 return *m_d3d_capabilities;
595 }
596
597 const D3DPRESENT_PARAMETERS & Video_DX9::get_d3d_parameters() {
598 return *m_d3d_parameters;
599 }
600
601 void Video_DX9::init() {
602 SDL_SysWMinfo wmInfo;
603 SDL_VERSION(&wmInfo.version);
604 #if SDL_VERSION_ATLEAST(2,0,0)
605 SDL_GetWindowWMInfo(get_Window().get_window(), &wmInfo);
606 HWND hWnd = wmInfo.info.win.window;
607 #else
608 SDL_GetWMInfo(&wmInfo);
609 HWND hWnd = wmInfo.window;
610 #endif
611
612 std::cerr << "Initializing DirectX 9" << std::endl;
613
614 try {
615 m_d3d_capabilities = new D3DCAPS9;
616 m_d3d_parameters = new D3DPRESENT_PARAMETERS;
617 }
618 catch (...) {
619 throw Video_Init_Failure();
620 }
621
622 m_d3d->GetDeviceCaps(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, m_d3d_capabilities);
623
624 m_dpi = GetDeviceCaps(GetDC(hWnd), LOGPIXELSY);
625
626 ZeroMemory(m_d3d_parameters, sizeof(m_d3d_parameters));
627
628 m_d3d_parameters->hDeviceWindow = hWnd;
629
630 m_d3d_parameters->Windowed = true;
631 m_d3d_parameters->FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT;
632
633 m_d3d_parameters->BackBufferCount = 1;
634 m_d3d_parameters->BackBufferWidth = UINT(get_Window().get_width());
635 m_d3d_parameters->BackBufferHeight = UINT(get_Window().get_height());
636 m_d3d_parameters->BackBufferFormat = D3DFMT_A8R8G8B8;
637 m_d3d_parameters->SwapEffect = D3DSWAPEFFECT_DISCARD;
638 m_d3d_parameters->PresentationInterval = get_vertical_sync() ? D3DPRESENT_INTERVAL_ONE : D3DPRESENT_INTERVAL_IMMEDIATE;
639 m_d3d_parameters->Flags = 0; //D3DPRESENTFLAG_LOCKABLE_BACKBUFFER;
640
641 m_d3d_parameters->EnableAutoDepthStencil = true;
642 m_d3d_parameters->AutoDepthStencilFormat = D3DFMT_D16;
643
644 if(get_multisampling() > 1)
645 switch(get_multisampling()) {
646 case 2: m_d3d_parameters->MultiSampleType = D3DMULTISAMPLE_2_SAMPLES; break;
647 case 3: m_d3d_parameters->MultiSampleType = D3DMULTISAMPLE_3_SAMPLES; break;
648 case 4: m_d3d_parameters->MultiSampleType = D3DMULTISAMPLE_4_SAMPLES; break;
649 case 5: m_d3d_parameters->MultiSampleType = D3DMULTISAMPLE_5_SAMPLES; break;
650 case 6: m_d3d_parameters->MultiSampleType = D3DMULTISAMPLE_6_SAMPLES; break;
651 case 7: m_d3d_parameters->MultiSampleType = D3DMULTISAMPLE_7_SAMPLES; break;
652 case 8: m_d3d_parameters->MultiSampleType = D3DMULTISAMPLE_8_SAMPLES; break;
653 case 9: m_d3d_parameters->MultiSampleType = D3DMULTISAMPLE_9_SAMPLES; break;
654 case 10: m_d3d_parameters->MultiSampleType = D3DMULTISAMPLE_10_SAMPLES; break;
655 case 11: m_d3d_parameters->MultiSampleType = D3DMULTISAMPLE_11_SAMPLES; break;
656 case 12: m_d3d_parameters->MultiSampleType = D3DMULTISAMPLE_12_SAMPLES; break;
657 case 13: m_d3d_parameters->MultiSampleType = D3DMULTISAMPLE_13_SAMPLES; break;
658 case 14: m_d3d_parameters->MultiSampleType = D3DMULTISAMPLE_14_SAMPLES; break;
659 case 15: m_d3d_parameters->MultiSampleType = D3DMULTISAMPLE_15_SAMPLES; break;
660 case 16:
661 default: m_d3d_parameters->MultiSampleType = D3DMULTISAMPLE_16_SAMPLES; break;
662 }
663 else if(get_multisampling() < 0)
664 m_d3d_parameters->MultiSampleType = D3DMULTISAMPLE_16_SAMPLES;
665 else
666 m_d3d_parameters->MultiSampleType = D3DMULTISAMPLE_NONE;
667 m_d3d_parameters->MultiSampleQuality = 0;
668
669 // Initialize the D3D device
670 if(!init_device())
671 throw Video_Init_Failure();
672
673 // Initialize the rendering context
674 init_context();
675
676 m_d3d_device->GetRenderTarget(0, &m_back_buffer);
677 }
678
679 bool Video_DX9::init_device() {
680 DWORD num_quality_levels;
681 while(FAILED(m_d3d->CheckDeviceMultiSampleType(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_A8R8G8B8, m_d3d_parameters->Windowed, m_d3d_parameters->MultiSampleType, &num_quality_levels))) {
682 switch(m_d3d_parameters->MultiSampleType) {
683 case D3DMULTISAMPLE_2_SAMPLES: m_d3d_parameters->MultiSampleType = D3DMULTISAMPLE_NONE; preinit_multisampling(0); break;
684 case D3DMULTISAMPLE_3_SAMPLES: m_d3d_parameters->MultiSampleType = D3DMULTISAMPLE_2_SAMPLES; preinit_multisampling(2); break;
685 case D3DMULTISAMPLE_4_SAMPLES: m_d3d_parameters->MultiSampleType = D3DMULTISAMPLE_3_SAMPLES; preinit_multisampling(3); break;
686 case D3DMULTISAMPLE_5_SAMPLES: m_d3d_parameters->MultiSampleType = D3DMULTISAMPLE_4_SAMPLES; preinit_multisampling(4); break;
687 case D3DMULTISAMPLE_6_SAMPLES: m_d3d_parameters->MultiSampleType = D3DMULTISAMPLE_5_SAMPLES; preinit_multisampling(5); break;
688 case D3DMULTISAMPLE_7_SAMPLES: m_d3d_parameters->MultiSampleType = D3DMULTISAMPLE_6_SAMPLES; preinit_multisampling(6); break;
689 case D3DMULTISAMPLE_8_SAMPLES: m_d3d_parameters->MultiSampleType = D3DMULTISAMPLE_7_SAMPLES; preinit_multisampling(7); break;
690 case D3DMULTISAMPLE_9_SAMPLES: m_d3d_parameters->MultiSampleType = D3DMULTISAMPLE_8_SAMPLES; preinit_multisampling(8); break;
691 case D3DMULTISAMPLE_10_SAMPLES: m_d3d_parameters->MultiSampleType = D3DMULTISAMPLE_9_SAMPLES; preinit_multisampling(9); break;
692 case D3DMULTISAMPLE_11_SAMPLES: m_d3d_parameters->MultiSampleType = D3DMULTISAMPLE_10_SAMPLES; preinit_multisampling(10); break;
693 case D3DMULTISAMPLE_12_SAMPLES: m_d3d_parameters->MultiSampleType = D3DMULTISAMPLE_11_SAMPLES; preinit_multisampling(11); break;
694 case D3DMULTISAMPLE_13_SAMPLES: m_d3d_parameters->MultiSampleType = D3DMULTISAMPLE_12_SAMPLES; preinit_multisampling(12); break;
695 case D3DMULTISAMPLE_14_SAMPLES: m_d3d_parameters->MultiSampleType = D3DMULTISAMPLE_13_SAMPLES; preinit_multisampling(13); break;
696 case D3DMULTISAMPLE_15_SAMPLES: m_d3d_parameters->MultiSampleType = D3DMULTISAMPLE_14_SAMPLES; preinit_multisampling(14); break;
697 case D3DMULTISAMPLE_16_SAMPLES: m_d3d_parameters->MultiSampleType = D3DMULTISAMPLE_15_SAMPLES; preinit_multisampling(15); break;
698
699 case D3DMULTISAMPLE_NONE:
700 default:
701 return false;
702 }
703 }
704
705 const bool try_hardware = (m_d3d_capabilities->VertexProcessingCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) != 0;
706
707 if((!try_hardware || FAILED(m_d3d->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, m_d3d_parameters->hDeviceWindow, D3DCREATE_HARDWARE_VERTEXPROCESSING, m_d3d_parameters, &m_d3d_device))) &&
708 (!try_hardware || FAILED(m_d3d->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, m_d3d_parameters->hDeviceWindow, D3DCREATE_MIXED_VERTEXPROCESSING, m_d3d_parameters, &m_d3d_device))) &&
709 FAILED(m_d3d->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, m_d3d_parameters->hDeviceWindow, D3DCREATE_SOFTWARE_VERTEXPROCESSING, m_d3d_parameters, &m_d3d_device)))
710 {
711 // HARDWARE, MIXED, and SOFTWARE all failed
712 return false;
713 }
714
715 // Set Up Matrix Stack
716 D3DXCreateMatrixStack()(0, &m_matrix_stack);
717 m_matrix_stack->LoadIdentity();
718
720
721 ShBuiltInResources resources;
722 ShInitBuiltInResources(&resources);
723
724 resources.MaxVertexAttribs = 8;
725 resources.MaxVertexUniformVectors = 128;
726 resources.MaxVaryingVectors = 8;
727 resources.MaxVertexTextureImageUnits = 0;
728 resources.MaxCombinedTextureImageUnits = 8;
729 resources.MaxTextureImageUnits = 8;
730 resources.MaxFragmentUniformVectors = 16;
731 resources.MaxDrawBuffers = 1;
732
733 resources.OES_standard_derivatives = 0;
734 resources.OES_EGL_image_external = 0;
735
736 m_vertex_compiler = ShConstructCompiler(SH_VERTEX_SHADER, SH_GLES2_SPEC, SH_HLSL9_OUTPUT, &resources);
737 m_fragment_compiler = ShConstructCompiler(SH_FRAGMENT_SHADER, SH_GLES2_SPEC, SH_HLSL9_OUTPUT, &resources);
738
739 return true;
740 }
741
742 void Video_DX9::init_context() {
743 // Enable Alpha Blitting
744 m_d3d_device->SetRenderState(D3DRS_ALPHABLENDENABLE, true);
745 m_d3d_device->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
746 m_d3d_device->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
747 m_d3d_device->SetRenderState(D3DRS_BLENDOP, D3DBLENDOP_ADD);
748
749 // Configure Texture Stages
750 m_d3d_device->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_DIFFUSE);
751 m_d3d_device->SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_TEXTURE);
752 m_d3d_device->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_DIFFUSE);
753 m_d3d_device->SetTextureStageState(0, D3DTSS_ALPHAARG2, D3DTA_TEXTURE);
754
755 // Set Lighting Variables
756 m_d3d_device->SetRenderState(D3DRS_NORMALIZENORMALS, true);
757
758 // Multisampling
759 m_d3d_device->SetRenderState(D3DRS_MULTISAMPLEANTIALIAS, DWORD(get_multisampling() > 1));
760
761 // More basic stuff
762 set_2d();
763 set_Color(get_Color());
764 set_clear_Color(get_clear_Color());
765 set_backface_culling(get_backface_culling());
766 set_lighting(get_lighting());
767 set_ambient_lighting(get_ambient_lighting());
768 for(int i = 0; i != 8; ++i)
769 if(const Light * const lp = get_Light(i))
770 set_Light(i, *lp);
771 if(const Fog * const fp = get_Fog())
772 set_Fog(*fp);
773 set_alpha_test(is_alpha_test_enabled(), get_alpha_test_function(), get_alpha_test_value());
774 set_zwrite(is_zwrite_enabled());
775 set_ztest(is_ztest_enabled());
776 }
777
778 void Video_DX9::destroy_device() {
779 ShDestruct(m_vertex_compiler);
780 ShDestruct(m_fragment_compiler);
781
782 if(m_matrix_stack) {
783 m_matrix_stack->Release();
784 m_matrix_stack = 0;
785 }
786
787 if(m_back_buffer) {
788 m_back_buffer->Release();
789 m_back_buffer = 0;
790 }
791
792 if(m_d3d_device) {
793 m_d3d_device->Release();
794 m_d3d_device = 0;
795 }
796 }
797
798 void Video_DX9::zero_handles() {
799 g_Direct3DCreate9 = 0;
800
801 g_D3DXCreateRenderToSurface = 0;
802 g_D3DXCreateTexture = 0;
803 g_D3DXFilterTexture = 0;
804 g_D3DXCreateMatrixStack = 0;
805 g_D3DXCompileShader = 0;
806 }
807
808 void Video_DX9::set_fvf(const bool &is_3d) {
809 m_fvf_3d = is_3d;
810
811 set_fvf();
812 }
813
814 void Video_DX9::set_fvf() {
815 DWORD fvf = D3DFVF_XYZ;
816
817 if(m_fvf_3d)
818 fvf |= D3DFVF_NORMAL;
819
820 if(m_textured)
821 fvf |= D3DFVF_TEX1;
822 else
823 fvf |= D3DFVF_DIFFUSE;
824
825 m_d3d_device->SetFVF(fvf);
826 }
827
828 bool Video_DX9::is_fvf_3d() const {
829 return m_fvf_3d;
830 }
831
832 void Video_DX9::set_fvf_3d(const bool &on) {
833 m_fvf_3d = on;
834
835 set_fvf();
836 }
837
838 Video_DX9::Direct3DCreate9_fcn Video_DX9::g_Direct3DCreate9 = 0;
839
840 Video_DX9::D3DXCreateRenderToSurface_fcn Video_DX9::g_D3DXCreateRenderToSurface = 0;
841 Video_DX9::D3DXCreateTexture_fcn Video_DX9::g_D3DXCreateTexture = 0;
842 Video_DX9::D3DXFilterTexture_fcn Video_DX9::g_D3DXFilterTexture = 0;
843 Video_DX9::D3DXCreateMatrixStack_fcn Video_DX9::g_D3DXCreateMatrixStack = 0;
844 Video_DX9::D3DXCompileShader_fcn Video_DX9::g_D3DXCompileShader = 0;
845
846 }
847
848 #else
849
850 namespace Zeni {
851 void * this_pointer_is_dead_beef = (void *)0xDEADBEEF;
852 }
853
854 #endif
D3DFMT_D16
Definition: d3d9types.h:1390
D3DTS_PROJECTION
Definition: d3d9types.h:315
_D3DPRESENT_PARAMETERS_::AutoDepthStencilFormat
D3DFORMAT AutoDepthStencilFormat
Definition: d3d9types.h:1516
Zeni::Point2i::y
Sint32 y
Definition: Coordinate.h:94
Zeni::Video_DX9::create_Vertex_Buffer_Renderer
Vertex_Buffer_Renderer * create_Vertex_Buffer_Renderer(Vertex_Buffer &vertex_buffer)
Function for creating a Vertex_Buffer_Renderer.
Definition: Video_DX9.cpp:577
Zeni::Video_DX9::set_projection_matrix
void set_projection_matrix(const Matrix4f &projection)
Set the projection Matrix4f.
Definition: Video_DX9.cpp:540
SDL_GetWindowWMInfo
DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_Window *window, SDL_SysWMinfo *info)
This function allows access to driver-dependent window information.
Definition: SDL_video.c:3002
d3d9.h
Zeni::Light
An Abstraction of a Light.
Definition: Light.h:57
Zeni::Video::set_lighting
virtual void set_lighting(const bool &on=true)=0
Set lighting on/off.
Definition: Video.cpp:218
D3DERR_DEVICELOST
#define D3DERR_DEVICELOST
Definition: d3d9.h:1997
Zeni::Video::get_clear_Color
const Color & get_clear_Color() const
Get the blank background color.
Definition: Video.hxx:114
_D3DVIEWPORT9
Definition: d3d9types.h:95
D3DMULTISAMPLE_16_SAMPLES
Definition: d3d9types.h:1293
Zeni::Video_DX9::D3DXCompileShader_fcn
HRESULT(WINAPI * D3DXCompileShader_fcn)(LPCSTR pSrcData, UINT srcDataLen, const D3DXMACRO *pDefines, LPD3DXINCLUDE pInclude, LPCSTR pFunctionName, LPCSTR pProfile, DWORD Flags, LPD3DXBUFFER *ppShader, LPD3DXBUFFER *ppErrorMsgs, LPD3DXCONSTANTTABLE *ppConstantTable)
Definition: Video_DX9.h:100
D3DMULTISAMPLE_15_SAMPLES
Definition: d3d9types.h:1292
D3DZB_FALSE
Definition: d3d9types.h:296
Zeni::Video_DX9::load_Texture
Texture * load_Texture(const String &filename, const bool &repeat, const bool &lazy_loading=false)
Function for loading a Texture; used internally by Textures.
Definition: Video_DX9.cpp:553
D3DCMP_GREATER
Definition: d3d9types.h:268
_D3DPRESENT_PARAMETERS_::BackBufferCount
UINT BackBufferCount
Definition: d3d9types.h:1507
_D3DPRESENT_PARAMETERS_::SwapEffect
D3DSWAPEFFECT SwapEffect
Definition: d3d9types.h:1512
Zeni::Color::a_ub
unsigned char a_ub() const
Get the alpha channel [0x00, 0xFF].
Definition: Color.hxx:39
Zeni::Video::set_vertical_sync
virtual void set_vertical_sync(const bool &on)=0
Set vertical_sync on/off.
Definition: Video.cpp:190
_D3DPRESENT_PARAMETERS_::BackBufferFormat
D3DFORMAT BackBufferFormat
Definition: d3d9types.h:1506
light
const GLubyte GLuint GLuint GLuint GLuint alpha GLboolean GLboolean GLboolean GLboolean alpha GLint GLint GLsizei GLsizei GLenum type GLenum GLint GLenum GLint GLint GLsizei GLsizei GLint border GLenum GLint GLint GLint GLint GLint GLsizei GLsizei height GLsizei GLsizei GLenum GLenum const GLvoid *pixels GLenum GLint GLint GLint GLint j2 GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble zFar GLenum light
Definition: SDL_glfuncs.h:144
Zeni::Shader_DX9
Definition: Shader.h:203
D3DMULTISAMPLE_4_SAMPLES
Definition: d3d9types.h:1281
Zeni::Texture_DX9
Definition: Texture.h:145
_D3DPRESENT_PARAMETERS_::hDeviceWindow
HWND hDeviceWindow
Definition: d3d9types.h:1513
color
GLuint color
Definition: glew.h:7185
D3DCMP_GREATEREQUAL
Definition: d3d9types.h:270
Zeni::g_video_dx9_reset
static bool g_video_dx9_reset
Definition: Video_DX9.cpp:161
Zeni::Video_Init_Failure
Definition: Video.h:293
Zeni::Camera
Camera / Point of View.
Definition: Camera.h:49
Zeni::Renderable::post_render
virtual void post_render() const
Definition: Renderable.cpp:61
D3DMULTISAMPLE_2_SAMPLES
Definition: d3d9types.h:1279
Zeni::Renderable::render_to
virtual void render_to(Video_GL_Fixed &screen) const =0
Overridden for OpenGL rendering.
D3DCMPFUNC
enum _D3DCMPFUNC D3DCMPFUNC
Zeni::Video_DX9::create_Font
Font * create_Font(const String &filename, const float &glyph_height, const float &virtual_screen_height)
Function for creating a Font; used internally by Fonts.
Definition: Video_DX9.cpp:573
Direct3DCreate9
IDirect3D9 *WINAPI Direct3DCreate9(UINT SDKVersion)
f
GLclampf f
Definition: glew.h:3390
HRESULT
typedef HRESULT(WINAPI *LPD3DXIMTSIGNALCALLBACK)(CONST D3DXVECTOR2 *uv
Zeni::Shader_DX9::get_vertex_shader
LPDIRECT3DVERTEXSHADER9 get_vertex_shader() const
Definition: Shader.hxx:57
D3DBLEND_INVSRCALPHA
Definition: d3d9types.h:217
D3DRS_CULLMODE
Definition: d3d9types.h:342
Zeni::Video::set_view_matrix
virtual void set_view_matrix(const Matrix4f &view)=0
Set the view Matrix4f.
Definition: Video.cpp:226
Zeni::Video_DX9::Direct3DCreate9_fcn
LPDIRECT3D9(WINAPI * Direct3DCreate9_fcn)(UINT SDKVersion)
Definition: Video_DX9.h:74
Zeni::Video::unset_Fog
virtual void unset_Fog()=0
Unset Fog.
Definition: Video.cpp:300
ShBuiltInResources::MaxDrawBuffers
int MaxDrawBuffers
Definition: ShaderLang.h:213
D3DBLENDOP_ADD
Definition: d3d9types.h:239
Zeni::Video_DX9::unset_program
void unset_program()
Disable a program.
Definition: Video_DX9.cpp:446
D3DCOLOR_ARGB
#define D3DCOLOR_ARGB(a, r, g, b)
Definition: d3d9types.h:37
SH_FRAGMENT_SHADER
Definition: ShaderLang.h:49
enabled
GLenum GLsizei const GLuint GLboolean enabled
Definition: glew.h:2538
D3D_SDK_VERSION
#define D3D_SDK_VERSION
Definition: d3d9.h:32
Zeni::Video_DX9::set_2d_view
void set_2d_view(const std::pair< Point2f, Point2f > &camera2d, const std::pair< Point2i, Point2i > &viewport=std::make_pair(Point2i(), get_Video().get_render_target_size()), const bool &fix_aspect_ratio=false)
Set a 2D view for a viewport.
Definition: Video_DX9.cpp:262
ShBuiltInResources::MaxTextureImageUnits
int MaxTextureImageUnits
Definition: ShaderLang.h:211
Zeni::Program
Definition: Shader.h:108
ShBuiltInResources::MaxVertexUniformVectors
int MaxVertexUniformVectors
Definition: ShaderLang.h:207
Zeni::Video::get_backface_culling
static bool get_backface_culling()
Determine whether backface culling is enabled.
Definition: Video.hxx:37
Zeni::Video::get_Light
const Light * get_Light(const int &number) const
Get pointer to Light, or 0 if no such Light.
Definition: Video.cpp:274
Zeni::Video::get_lighting
static bool get_lighting()
Determine whether dynamic lighting is enabled.
Definition: Video.hxx:41
D3DMULTISAMPLE_NONE
Definition: d3d9types.h:1277
ShaderLang.h
ShConstructCompiler
COMPILER_EXPORT ShHandle ShConstructCompiler(ShShaderType type, ShShaderSpec spec, ShShaderOutput output, const ShBuiltInResources *resources)
Definition: ShaderLang.cpp:140
Zeni::Video::set_Light
virtual void set_Light(const int &number, const Light &light)=0
Set a particular Light.
Definition: Video.cpp:283
ShBuiltInResources::MaxFragmentUniformVectors
int MaxFragmentUniformVectors
Definition: ShaderLang.h:212
Zeni::Shader_DX9::get_pixel_shader
LPDIRECT3DPIXELSHADER9 get_pixel_shader() const
Definition: Shader.hxx:61
D3DRS_NORMALIZENORMALS
Definition: d3d9types.h:379
init
static void init(struct bs2b *bs2b)
Definition: bs2b.c:46
D3DCREATE_MIXED_VERTEXPROCESSING
#define D3DCREATE_MIXED_VERTEXPROCESSING
Definition: d3d9.h:1836
Zeni::Video_DX9::init_device
bool init_device()
Definition: Video_DX9.cpp:679
ShBuiltInResources::MaxVertexTextureImageUnits
int MaxVertexTextureImageUnits
Definition: ShaderLang.h:209
Zeni::Material
An Abstraction of a Material.
Definition: Material.h:56
D3DSWAPEFFECT_DISCARD
Definition: d3d9types.h:1472
Zeni::Video_DX9::set_ambient_lighting
void set_ambient_lighting(const Color &color)
Set ambient lighting on/off.
Definition: Video_DX9.cpp:391
SDL_SysWMinfo::version
SDL_version version
Definition: SDL_syswm.h:161
Zeni::Video_DX9::set_Fog
void set_Fog(const Fog &fog)
Set Fog.
Definition: Video_DX9.cpp:423
D3DMULTISAMPLE_12_SAMPLES
Definition: d3d9types.h:1289
Zeni::Video_DX9::D3DXCreateMatrixStack
static D3DXCreateMatrixStack_fcn D3DXCreateMatrixStack()
Definition: Video_DX9.h:117
_D3DPRESENT_PARAMETERS_::Flags
DWORD Flags
Definition: d3d9types.h:1517
Zeni::Video_DX9::set_ztest
void set_ztest(const bool &enabled)
Enable or disable testing of the Z-Buffer.
Definition: Video_DX9.cpp:305
Zeni::Program_DX9::get_fragment_shader
const Shader_DX9 * get_fragment_shader() const
Definition: Shader.hxx:69
Zeni::Video_DX9::begin_render
bool begin_render()
Must be called before all rendering functions; Returns true if rendering can proceed.
Definition: Video_DX9.cpp:197
Zeni::Video_DX9::init_context
void init_context()
Definition: Video_DX9.cpp:742
D3DRS_ALPHABLENDENABLE
Definition: d3d9types.h:347
D3DMULTISAMPLE_14_SAMPLES
Definition: d3d9types.h:1291
D3DRS_ZENABLE
Definition: d3d9types.h:334
D3DMULTISAMPLE_3_SAMPLES
Definition: d3d9types.h:1280
Zeni::Font_FT
Definition: Font.h:99
Zeni::Video_DX9::create_Fragment_Shader
Shader * create_Fragment_Shader(const String &filename)
Create a Fragment_Shader from a file.
Definition: Video_DX9.cpp:585
D3DFVF_TEX1
#define D3DFVF_TEX1
Definition: d3d9types.h:673
Zeni::Video::is_alpha_test_enabled
bool is_alpha_test_enabled() const
Determine whether alpha testing is enabled.
Definition: Video.hxx:69
D3DRS_ALPHATESTENABLE
Definition: d3d9types.h:338
Zeni::Shader::VERTEX
Definition: Shader.h:102
D3DRS_DESTBLEND
Definition: d3d9types.h:341
Zeni::Light::set
void set(const GLenum &number, Video_GL_Fixed &screen) const
Definition: Light.cpp:52
D3DTSS_COLOROP
Definition: d3d9types.h:480
Zeni::Video::get_alpha_test_function
TEST get_alpha_test_function() const
Determine which alpha test is in use.
Definition: Video.hxx:73
assert
#define assert(x)
Definition: SDL_malloc.c:1234
Zeni::Video::set_zwrite
virtual void set_zwrite(const bool &enabled)=0
Enable or disable writing to the Z-Buffer.
Definition: Video.cpp:194
Zeni::Video::compile_glsles_shader
String compile_glsles_shader(const String &filename, const ShHandle &compiler)
Compile an OpenGL ES shader to GLSL/HLSL.
Definition: Video.cpp:304
D3DBLEND_SRCALPHA
Definition: d3d9types.h:216
Zeni::Renderable
A Renderable Interface.
Definition: Renderable.h:47
D3DMULTISAMPLE_6_SAMPLES
Definition: d3d9types.h:1283
UINT
typedef UINT(WINAPI *PFNWGLGETCONTEXTGPUIDAMDPROC)(HGLRC hglrc)
func
GLenum func
Definition: SDL_opengl.h:5654
Zeni::Video_DX9::begin_prerender
bool begin_prerender()
Must be called before begin_render.
Definition: Video_DX9.cpp:163
Zeni::Video_DX9::set_program
void set_program(Program &program)
Enable a program.
Definition: Video_DX9.cpp:437
D3DRS_BLENDOP
Definition: d3d9types.h:401
D3DFVF_DIFFUSE
#define D3DFVF_DIFFUSE
Definition: d3d9types.h:667
D3DCULL_NONE
Definition: d3d9types.h:257
_D3DPRESENT_PARAMETERS_::EnableAutoDepthStencil
BOOL EnableAutoDepthStencil
Definition: d3d9types.h:1515
D3DMULTISAMPLE_5_SAMPLES
Definition: d3d9types.h:1282
D3DCREATE_SOFTWARE_VERTEXPROCESSING
#define D3DCREATE_SOFTWARE_VERTEXPROCESSING
Definition: d3d9.h:1834
Zeni::Video::m_vertex_compiler
ShHandle m_vertex_compiler
Definition: Video.h:243
D3DCLEAR_ZBUFFER
#define D3DCLEAR_ZBUFFER
Definition: d3d9types.h:190
Zeni::Video::is_3d
bool is_3d() const
Determine whether currently rendering in 3D.
Definition: Video.hxx:81
Zeni::Image
Image.
Definition: Image.h:52
image
EGLImageKHR image
Definition: eglext.h:88
Zeni::Renderable::is_3d
virtual bool is_3d() const =0
Tell the rendering system if we&#39;re using 3D coordinates.
d3dx9.h
Zeni::Fog::set
void set(Video_GL_Fixed &screen) const
Definition: Fog.cpp:48
Zeni::Video_DX9::get_pixel_offset
Point2f get_pixel_offset() const
Get the pixel offset in the 2d view.
Definition: Video_DX9.cpp:530
D3DFOG_NONE
Definition: d3d9types.h:288
Zeni::Video_DX9::set_zwrite
void set_zwrite(const bool &enabled)
Enable or disable writing to the Z-Buffer.
Definition: Video_DX9.cpp:299
Zeni::String
Definition: String.h:29
D3DTSS_ALPHAARG2
Definition: d3d9types.h:485
D3DMULTISAMPLE_7_SAMPLES
Definition: d3d9types.h:1284
Zeni::Video_DX9::clear_render_target
void clear_render_target(const Color &color=Color(0.0f, 0.0f, 0.0f, 0.0f))
Clear the viewport.
Definition: Video_DX9.cpp:488
D3DRS_ZWRITEENABLE
Definition: d3d9types.h:337
D3DADAPTER_DEFAULT
#define D3DADAPTER_DEFAULT
Definition: d3d9.h:1873
Zeni::Video_DX9::get_render_target_size
const Point2i & get_render_target_size() const
Get the dimensions of the render target.
Definition: Video_DX9.cpp:494
Zeni::Video_DX9::set_3d_view
void set_3d_view(const Camera &camera, const std::pair< Point2i, Point2i > &viewport=std::make_pair(Point2i(), get_Video().get_render_target_size()))
Set a 3D view for a viewport.
Definition: Video_DX9.cpp:273
Zeni::Color::r_ub
unsigned char r_ub() const
Get the red channel [0x00, 0xFF].
Definition: Color.hxx:27
SDL_VERSION
#define SDL_VERSION(x)
Macro to determine SDL version program was compiled against.
Definition: SDL_version.h:79
D3DRS_AMBIENT
Definition: d3d9types.h:375
D3DMULTISAMPLE_13_SAMPLES
Definition: d3d9types.h:1290
SH_HLSL9_OUTPUT
Definition: ShaderLang.h:84
D3DMULTISAMPLE_8_SAMPLES
Definition: d3d9types.h:1285
D3DTSS_COLORARG1
Definition: d3d9types.h:481
Zeni::Video_DX9::is_fvf_3d
bool is_fvf_3d() const
Definition: Video_DX9.cpp:828
Zeni::Program_DX9
Definition: Shader.h:224
D3DMULTISAMPLE_11_SAMPLES
Definition: d3d9types.h:1288
D3DRS_TEXTUREFACTOR
Definition: d3d9types.h:364
Zeni::Video::is_zwrite_enabled
bool is_zwrite_enabled() const
Determine whether writing to Z-Buffer is enabled.
Definition: Video.hxx:61
SH_GLES2_SPEC
Definition: ShaderLang.h:54
Zeni::Video::ZENI_EQUAL
Definition: Video.h:100
Zeni::Video_DX9::set_Material
void set_Material(const Material &material)
Set a Material.
Definition: Video_DX9.cpp:415
Zeni::Video_DX9::transform_scene
void transform_scene(const Matrix4f &transformation)
Transform the scene.
Definition: Video_DX9.cpp:525
SH_VERTEX_SHADER
Definition: ShaderLang.h:50
Zeni::Video_DX9::scale_scene
void scale_scene(const Vector3f &factor)
Scale the scene.
Definition: Video_DX9.cpp:520
D3DFVF_NORMAL
#define D3DFVF_NORMAL
Definition: d3d9types.h:665
Zeni::Texture
An Abstraction of a Texture.
Definition: Texture.h:61
Zeni::Vector3f
A Featureful 3-Space Vector Class.
Definition: Vector3f.h:58
ShBuiltInResources::MaxVertexAttribs
int MaxVertexAttribs
Definition: ShaderLang.h:206
Zeni::Video_DX9::end_render
void end_render()
Must be called after all rendering functions.
Definition: Video_DX9.cpp:223
u
ALuint u
Definition: alMain.h:58
Zeni::Video::preinit_multisampling
static void preinit_multisampling(const int &multisampling=0)
Set a multisampling value.
Definition: Video.cpp:328
Zeni::Video_DX9::push_world_stack
void push_world_stack()
Push a model view matrix onto the stack.
Definition: Video_DX9.cpp:501
D3DCMP_LESSEQUAL
Definition: d3d9types.h:267
Zeni::Video::set_ztest
virtual void set_ztest(const bool &enabled)=0
Enable or disable testing of the Z-Buffer.
Definition: Video.cpp:198
result
GLuint64EXT * result
Definition: glew.h:12708
_D3DPRESENT_PARAMETERS_::PresentationInterval
UINT PresentationInterval
Definition: d3d9types.h:1521
Zeni::Light_Out_of_Range
Definition: Video.h:297
_D3DPRESENT_PARAMETERS_::FullScreen_RefreshRateInHz
UINT FullScreen_RefreshRateInHz
Definition: d3d9types.h:1520
Zeni::Video_DX9::rotate_scene
void rotate_scene(const Vector3f &about, const float &radians)
Rotate the scene.
Definition: Video_DX9.cpp:515
D3DCMP_LESS
Definition: d3d9types.h:265
Zeni::Video_DX9::set_alpha_test
void set_alpha_test(const bool &enabled, const TEST &test, const float &value)
Set the alpha test.
Definition: Video_DX9.cpp:316
D3DTSS_ALPHAOP
Definition: d3d9types.h:483
Zeni::Color::b_ub
unsigned char b_ub() const
Get the blue channel [0x00, 0xFF].
Definition: Color.hxx:35
Zeni::Video_Device_Failure
Definition: Video_DX9.h:251
Zeni::Video::set_ambient_lighting
virtual void set_ambient_lighting(const Color &color)=0
Set ambient lighting on/off.
Definition: Video.cpp:222
Zeni::Video_DX9::set_render_target
void set_render_target(Texture &texture)
Set a render target.
Definition: Video_DX9.cpp:451
Zeni::Material::unset
void unset(Video_GL_Fixed &screen) const
Definition: Material.cpp:115
int
int
Definition: SDL_systhread.c:37
SDL_SysWMinfo
Definition: SDL_syswm.h:159
_D3DPRESENT_PARAMETERS_::Windowed
BOOL Windowed
Definition: d3d9types.h:1514
Zeni::Fog
An Abstraction of Fog.
Definition: Fog.h:47
Zeni::Video_DX9::unapply_Texture
void unapply_Texture()
Unapply a texture.
Definition: Video_DX9.cpp:371
Zeni::Video_DX9::get_maximum_anisotropy
int get_maximum_anisotropy() const
Get the current level of anisotrophy.
Definition: Video_DX9.cpp:254
D3DERR_DRIVERINTERNALERROR
#define D3DERR_DRIVERINTERNALERROR
Definition: d3d9.h:1993
Zeni::Video_DX9::unset_render_target
void unset_render_target()
Unset a render target.
Definition: Video_DX9.cpp:475
Zeni::Video::get_ambient_lighting
static const Color & get_ambient_lighting()
Get the current ambient lighting Color.
Definition: Video.hxx:45
Zeni::Video::set_3d_view
virtual void set_3d_view(const Camera &camera, const std::pair< Point2i, Point2i > &viewport=std::make_pair(Point2i(), get().get_render_target_size()))=0
Set a 3D view for a viewport.
Definition: Video.cpp:174
Zeni::Video_Render_To_Texture_Error
Definition: Video.h:301
ShDestruct
COMPILER_EXPORT void ShDestruct(ShHandle handle)
Definition: ShaderLang.cpp:158
sort_controllers.filename
string filename
Definition: sort_controllers.py:8
ShInitBuiltInResources
COMPILER_EXPORT void ShInitBuiltInResources(ShBuiltInResources *resources)
Definition: ShaderLang.cpp:109
_D3DPRESENT_PARAMETERS_::MultiSampleQuality
DWORD MultiSampleQuality
Definition: d3d9types.h:1510
D3DCOLOR_XRGB
#define D3DCOLOR_XRGB(r, g, b)
Definition: d3d9types.h:40
Zeni::Video::set_2d
void set_2d()
Set the default 2D view filling the entire display area.
Definition: Video.hxx:93
Zeni::Video_DX9::set_fvf_3d
void set_fvf_3d(const bool &on)
Definition: Video_DX9.cpp:832
D3DCOLOR
DWORD D3DCOLOR
Definition: d3d9types.h:32
Zeni::Video::ZENI_GREATER_OR_EQUAL
Definition: Video.h:104
D3DMULTISAMPLE_10_SAMPLES
Definition: d3d9types.h:1287
D3DTSS_COLORARG2
Definition: d3d9types.h:482
Zeni::Video::get_multisampling
static int get_multisampling()
Get the current level of multisampling.
Definition: Video.hxx:57
Zeni::Video::ZENI_NOT_EQUAL
Definition: Video.h:102
Zeni::Video::ZENI_ALWAYS
Definition: Video.h:105
Zeni::Font
Font Abstraction.
Definition: Font.h:70
Zeni::Video_DX9::create_Vertex_Shader
Shader * create_Vertex_Shader(const String &filename)
Create a Vertex_Shader from a file.
Definition: Video_DX9.cpp:581
D3DRS_FOGTABLEMODE
Definition: d3d9types.h:351
Zeni::Video::set_Color
virtual void set_Color(const Color &color)=0
Set the current color.
Definition: Video.cpp:210
Zeni::Video::ZENI_LESS_OR_EQUAL
Definition: Video.h:103
Zeni::Video::ZENI_GREATER
Definition: Video.h:101
Zeni::Video_DX9::set_backface_culling
void set_backface_culling(const bool &on)
Set backface culling on/off.
Definition: Video_DX9.cpp:283
D3DPRESENT_INTERVAL_ONE
#define D3DPRESENT_INTERVAL_ONE
Definition: d3d9caps.h:267
Zeni::Video_DX9::set_lighting
void set_lighting(const bool &on=true)
Set lighting on/off.
Definition: Video_DX9.cpp:384
Zeni::Video::set_2d_view
virtual void set_2d_view(const std::pair< Point2f, Point2f > &camera2d, const std::pair< Point2i, Point2i > &viewport=std::make_pair(Point2i(), get().get_render_target_size()), const bool &fix_aspect_ratio=false)=0
Set a 2D view for a viewport.
Definition: Video.cpp:153
D3DCMP_EQUAL
Definition: d3d9types.h:266
Zeni::Video_DX9::unset_Material
void unset_Material(const Material &material)
Unset a Material.
Definition: Video_DX9.cpp:419
Zeni::Vector3f::k
float k
Definition: Vector3f.h:119
program
GLbitfield GLuint program
Definition: gl2ext.h:1203
Zeni::Video_DX9::init
void init()
Definition: Video_DX9.cpp:601
FALSE
#define FALSE
Definition: ftobjs.h:57
D3DDEVTYPE_HAL
Definition: d3d9types.h:1265
SDL_SysWMinfo::info
union SDL_SysWMinfo::@78 info
Zeni::Vertex_Buffer
A Vertex_Buffer that accepts Triangle and Quadrilaterals.
Definition: Vertex_Buffer.h:85
Zeni::Program_DX9::get_vertex_shader
const Shader_DX9 * get_vertex_shader() const
Definition: Shader.hxx:65
_D3DPRESENT_PARAMETERS_::BackBufferHeight
UINT BackBufferHeight
Definition: d3d9types.h:1505
Zeni::Video_DX9::set_Color
void set_Color(const Color &)
Set the current color.
Definition: Video_DX9.cpp:349
Zeni::Video_DX9::set_clear_Color
void set_clear_Color(const Color &color)
Set the blank background color.
Definition: Video_DX9.h:145
Zeni::Matrix4f::Translate
static Matrix4f Translate(const Vector3f &translation_factor)
Definition: Matrix4f.hxx:70
Zeni::Material::set
void set(Video_GL_Fixed &screen) const
Definition: Material.cpp:83
Zeni::Video::set_Fog
virtual void set_Fog(const Fog &fog)=0
Set Fog.
Definition: Video.cpp:295
D3DZB_TRUE
Definition: d3d9types.h:297
Zeni::get_Textures
Textures & get_Textures()
Get access to the singleton.
Definition: Textures.cpp:64
D3DFMT_A8R8G8B8
Definition: d3d9types.h:1343
Zeni::get_Window
Window & get_Window()
Get access to the singleton.
Definition: Window.cpp:392
Zeni::Texture::apply_Texture
virtual void apply_Texture() const =0
Apply a Texture to upcoming polygons.
_D3DPRESENT_PARAMETERS_::BackBufferWidth
UINT BackBufferWidth
Definition: d3d9types.h:1504
Zeni::Video_DX9::clear_depth_buffer
void clear_depth_buffer()
Can reset the depth buffer at any time if necessary.
Definition: Video_DX9.cpp:250
Zeni::Video_DX9::get_d3d_parameters
const D3DPRESENT_PARAMETERS & get_d3d_parameters()
See DirectX Documentation for details.
Definition: Video_DX9.cpp:597
Zeni::Textures::apply_Texture
void apply_Texture(const String &name)
Apply a texture for upcoming polygons (Called by Video::apply_Texture)
Definition: Textures.cpp:68
Zeni::Video::set_projection_matrix
virtual void set_projection_matrix(const Matrix4f &projection)=0
Set the projection Matrix4f.
Definition: Video.cpp:230
Zeni::Vector3f::j
float j
Definition: Vector3f.h:115
ShBuiltInResources::MaxCombinedTextureImageUnits
int MaxCombinedTextureImageUnits
Definition: ShaderLang.h:210
Zeni::Video_DX9::set_Light
void set_Light(const int &number, const Light &light)
Set a particular Light.
Definition: Video_DX9.cpp:397
Zeni::Video::set_viewport
virtual void set_viewport(const std::pair< Point2i, Point2i > &viewport=std::make_pair(Point2i(), get().get_render_target_size()))=0
Set the viewport.
Definition: Video.cpp:234
texture
GLenum GLenum GLuint texture
Definition: gl2ext.h:850
Zeni::Video_DX9::pop_world_stack
void pop_world_stack()
Pop a model view matrix off the stack.
Definition: Video_DX9.cpp:505
D3DTS_WORLD
#define D3DTS_WORLD
Definition: d3d9types.h:328
D3DDEVCAPS_HWTRANSFORMANDLIGHT
#define D3DDEVCAPS_HWTRANSFORMANDLIGHT
Definition: d3d9caps.h:296
D3DRS_ZFUNC
Definition: d3d9types.h:343
Zeni::Database::unlose_resources
void unlose_resources()
If resources have been lost, then reload them.
Definition: Database.hxx:415
value
EGLSurface EGLint void ** value
Definition: eglext.h:301
Zeni::Shader
A base class for Vertex_Shader and Fragment_Shader.
Definition: Shader.h:97
_D3DCAPS9::VertexProcessingCaps
DWORD VertexProcessingCaps
Definition: d3d9caps.h:176
D3DCLEAR_TARGET
#define D3DCLEAR_TARGET
Definition: d3d9types.h:189
D3DCREATE_HARDWARE_VERTEXPROCESSING
#define D3DCREATE_HARDWARE_VERTEXPROCESSING
Definition: d3d9.h:1835
Zeni::Video_DX9::get_matrix_stack
LPD3DXMATRIXSTACK & get_matrix_stack()
Get access to a matrix stack stored by this class.
Definition: Video_DX9.hxx:52
Zeni::Video_DX9::create_Texture
Texture * create_Texture(const Image &image)
Function for creating a Texture from an Image.
Definition: Video_DX9.cpp:557
D3DPRESENT_RATE_DEFAULT
#define D3DPRESENT_RATE_DEFAULT
Definition: d3d9types.h:1498
Zeni::Video_DX9::D3DXCreateTexture_fcn
HRESULT(WINAPI * D3DXCreateTexture_fcn)(LPDIRECT3DDEVICE9 pDevice, UINT Width, UINT Height, UINT MipLevels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, LPDIRECT3DTEXTURE9 *ppTexture)
Definition: Video_DX9.h:83
D3DCULL_CW
Definition: d3d9types.h:258
Zeni::Point2i::x
Sint32 x
Definition: Coordinate.h:94
_D3DPRESENT_PARAMETERS_::MultiSampleType
D3DMULTISAMPLE_TYPE MultiSampleType
Definition: d3d9types.h:1509
Zeni::Video_DX9::destroy_device
void destroy_device()
Definition: Video_DX9.cpp:778
ShBuiltInResources
Definition: ShaderLang.h:203
Zeni::Video_DX9::has_vertex_buffers
bool has_vertex_buffers() const
Determine whether Vertex_Buffers are supported.
Definition: Video_DX9.cpp:258
DWORD
typedef DWORD(WINAPI *XInputGetState_t)(DWORD dwUserIndex
_D3DPRESENT_PARAMETERS_
Definition: d3d9types.h:1502
Zeni::Video_DX9::get_d3d_capabilities
const D3DCAPS9 & get_d3d_capabilities()
See DirectX Documentation for details.
Definition: Video_DX9.cpp:593
Zeni::this_pointer_is_dead_beef
void * this_pointer_is_dead_beef
Definition: Video_DX9.cpp:851
Zeni::Color::g_ub
unsigned char g_ub() const
Get the green channel [0x00, 0xFF].
Definition: Color.hxx:31
D3DRS_FOGENABLE
Definition: d3d9types.h:348
D3DRS_ALPHAREF
Definition: d3d9types.h:344
D3DRS_SRCBLEND
Definition: d3d9types.h:340
Zeni::Texture_DX9::render_to_surface
ID3DXRenderToSurface * render_to_surface() const
Definition: Texture.hxx:58
Zeni::Matrix4f::Identity
static Matrix4f Identity()
Definition: Matrix4f.hxx:52
Zeni::Video::ZENI_NEVER
Definition: Video.h:98
D3DFVF_XYZ
#define D3DFVF_XYZ
Definition: d3d9types.h:656
Zeni::Shader::FRAGMENT
Definition: Shader.h:102
Zeni::Video_DX9::set_viewport
void set_viewport(const std::pair< Point2i, Point2i > &viewport=std::make_pair(Point2i(), get_Video().get_render_target_size()))
Set the viewport.
Definition: Video_DX9.cpp:546
Zeni::Video_DX9::D3DXCreateMatrixStack_fcn
HRESULT(WINAPI * D3DXCreateMatrixStack_fcn)(DWORD Flags, LPD3DXMATRIXSTACK *ppStack)
Definition: Video_DX9.h:97
D3DTOP_SELECTARG1
Definition: d3d9types.h:555
Zeni::Video::get_vertical_sync
static bool get_vertical_sync()
Determine whether vertical sync is enabled.
Definition: Video.hxx:53
Zeni::Video::set_backface_culling
virtual void set_backface_culling(const bool &on)=0
Set backface culling on/off.
Definition: Video.cpp:186
Zeni::Video::is_ztest_enabled
bool is_ztest_enabled() const
Determine whether testing the Z-Buffer is enabled.
Definition: Video.hxx:65
Zeni::Video_DX9::unset_Light
void unset_Light(const int &number)
Unset a particular Light.
Definition: Video_DX9.cpp:406
D3DERR_DEVICENOTRESET
#define D3DERR_DEVICENOTRESET
Definition: d3d9.h:1998
D3DCMP_NEVER
Definition: d3d9types.h:264
Zeni::Video_DX9::create_Program
Program * create_Program()
Create a Program from a file.
Definition: Video_DX9.cpp:589
Zeni::Window::get_size
static const Point2i & get_size()
Definition: Window.hxx:29
ref
GLclampf ref
Definition: gl2ext.h:1455
Zeni::Vertex_Buffer_Renderer_DX9
Definition: Vertex_Buffer.h:260
D3DPRESENT_PARAMETERS
struct _D3DPRESENT_PARAMETERS_ D3DPRESENT_PARAMETERS
Zeni::get_Fonts
Fonts & get_Fonts()
Get access to the singleton.
Definition: Fonts.cpp:60
Zeni::Video::TEST
TEST
Definition: Video.h:98
Zeni::Video_DX9::unset_Fog
void unset_Fog()
Unset Fog.
Definition: Video_DX9.cpp:430
Zeni::Video::get_Color
const Color & get_Color() const
Get the current color.
Definition: Video.hxx:110
D3DCMP_NOTEQUAL
Definition: d3d9types.h:269
Zeni::Video_DX9::D3DXCreateRenderToSurface_fcn
HRESULT(WINAPI * D3DXCreateRenderToSurface_fcn)(LPDIRECT3DDEVICE9 pDevice, UINT Width, UINT Height, D3DFORMAT Format, BOOL DepthStencil, D3DFORMAT DepthStencilFormat, LPD3DXRENDERTOSURFACE *ppRenderToSurface)
Definition: Video_DX9.h:75
Zeni::Renderable::pre_render
virtual void pre_render() const
Definition: Renderable.cpp:56
Zeni::Texture_DX9::get_size
const Point2i & get_size() const
Get the resolution of the Texture on the GPU.
Definition: Texture.hxx:54
D3DRS_ALPHAFUNC
Definition: d3d9types.h:345
Zeni::Matrix4f
A Featureful 4-Space Matrix Class.
Definition: Matrix4f.h:47
Zeni::Video_DX9::set_vertical_sync
void set_vertical_sync(const bool &on)
Set vertical_sync on/off.
Definition: Video_DX9.cpp:292
D3DRS_SPECULARENABLE
Definition: d3d9types.h:349
Zeni::Video_DX9::D3DXFilterTexture_fcn
HRESULT(WINAPI * D3DXFilterTexture_fcn)(LPDIRECT3DBASETEXTURE9 pBaseTexture, CONST PALETTEENTRY *pPalette, UINT SrcLevel, DWORD Filter)
Definition: Video_DX9.h:92
D3DPRESENT_INTERVAL_IMMEDIATE
#define D3DPRESENT_INTERVAL_IMMEDIATE
Definition: d3d9caps.h:271
i
int i
Definition: pngrutil.c:1377
Zeni::Video_DX9::set_fvf
void set_fvf(const bool &is_3d)
Definition: Video_DX9.cpp:808
D3DCAPS9
struct _D3DCAPS9 D3DCAPS9
Zeni::Video::set_alpha_test
virtual void set_alpha_test(const bool &enabled, const TEST &test=ZENI_ALWAYS, const float &value=0.0f)=0
Set the alpha test.
Definition: Video.cpp:202
Zeni::Video::ZENI_LESS
Definition: Video.h:99
D3DCMP_ALWAYS
Definition: d3d9types.h:271
Zeni::Video::unset_Light
virtual void unset_Light(const int &number)=0
Unset a particular Light.
Definition: Video.cpp:287
D3DTA_DIFFUSE
#define D3DTA_DIFFUSE
Definition: d3d9types.h:615
zeni_graphics.h
_D3DCAPS9::MaxAnisotropy
DWORD MaxAnisotropy
Definition: d3d9caps.h:160
max
#define max(x, y)
Definition: os.h:79
ShBuiltInResources::OES_EGL_image_external
int OES_EGL_image_external
Definition: ShaderLang.h:218
Zeni::Video_DX9::render
void render(const Renderable &renderable)
Render a Renderable.
Definition: Video_DX9.cpp:227
D3DTSS_ALPHAARG1
Definition: d3d9types.h:484
Zeni::Color::get_argb
Uint32 get_argb() const
Get a Uint32 representation of 0xAARRGGBB.
Definition: Color.hxx:47
D3DERR_DEVICEREMOVED
#define D3DERR_DEVICEREMOVED
Definition: d3d9.h:2011
Zeni::Video_DX9::translate_scene
void translate_scene(const Vector3f &direction)
Translate the scene.
Definition: Video_DX9.cpp:510
LPDIRECT3DSURFACE9
struct IDirect3DSurface9 * LPDIRECT3DSURFACE9
Definition: d3d9.h:1658
Zeni::Video::m_fragment_compiler
ShHandle m_fragment_compiler
Definition: Video.h:244
Zeni::Point2f
A 2D Point represented with floats.
Definition: Coordinate.h:98
Zeni::Video::get_Fog
const Fog * get_Fog() const
Get pointer to current Fog, or 0 if no Fog.
Definition: Video.cpp:291
Zeni::Vector3f::i
float i
Definition: Vector3f.h:111
SDL_syswm.h
Zeni::Vertex_Buffer_Renderer
Definition: Vertex_Buffer.h:71
D3DTA_TEXTURE
#define D3DTA_TEXTURE
Definition: d3d9types.h:617
Zeni::Video_DX9::apply_Texture
void apply_Texture(const String &name)
Apply a texture by name.
Definition: Video_DX9.h:146
Zeni::Matrix4f::Scale
static Matrix4f Scale(const Vector3f &scaling_factor)
Definition: Matrix4f.hxx:59
false
#define false
Definition: ftrandom.c:50
Zeni::Color
Color.
Definition: Color.h:41
D3DMULTISAMPLE_9_SAMPLES
Definition: d3d9types.h:1286
ShBuiltInResources::MaxVaryingVectors
int MaxVaryingVectors
Definition: ShaderLang.h:208
ShBuiltInResources::OES_standard_derivatives
int OES_standard_derivatives
Definition: ShaderLang.h:217
Zeni::Video::get_alpha_test_value
float get_alpha_test_value() const
Determine what value the alpha test is comparing against.
Definition: Video.hxx:77
D3DTS_VIEW
Definition: d3d9types.h:314
_D3DMATRIX
Definition: d3d9types.h:80
D3DRS_LIGHTING
Definition: d3d9types.h:374
size
GLsizei size
Definition: gl2ext.h:1467
D3DRS_MULTISAMPLEANTIALIAS
Definition: d3d9types.h:393
Zeni::Video_DX9::set_view_matrix
void set_view_matrix(const Matrix4f &view)
Set the view Matrix4f.
Definition: Video_DX9.cpp:534
_D3DCAPS9
Definition: d3d9caps.h:121
Zeni::Point2i
A 2D Point represented with integers.
Definition: Coordinate.h:85