zenilib: Zeni::Video_DX9 Class Reference

zenilib 0.5.3.0

- Main Page
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends | List of all members
Zeni::Video_DX9 Class Reference
Zenilib

The Direct3D9 Rendering System. More...

`#include <Video_DX9.h>`

Inherits Zeni::Video.

## Public Types

typedef 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)
typedef HRESULT(WINAPI * | D3DXCreateMatrixStack_fcn )(DWORD Flags, LPD3DXMATRIXSTACK *ppStack)
typedef HRESULT(WINAPI * | D3DXCreateRenderToSurface_fcn )(LPDIRECT3DDEVICE9 pDevice, UINT Width, UINT Height, D3DFORMAT Format, BOOL DepthStencil, D3DFORMAT DepthStencilFormat, LPD3DXRENDERTOSURFACE *ppRenderToSurface)
typedef HRESULT(WINAPI * | D3DXCreateTexture_fcn )(LPDIRECT3DDEVICE9 pDevice, UINT Width, UINT Height, UINT MipLevels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, LPDIRECT3DTEXTURE9 *ppTexture)
typedef HRESULT(WINAPI * | D3DXFilterTexture_fcn )(LPDIRECT3DBASETEXTURE9 pBaseTexture, CONST PALETTEENTRY *pPalette, UINT SrcLevel, DWORD Filter)
typedef LPDIRECT3D9(WINAPI * | Direct3DCreate9_fcn )(UINT SDKVersion)
Public Types inherited from Zeni::Video
enum | TEST { ZENI_NEVER = 0, ZENI_LESS = 1, ZENI_EQUAL = 2, ZENI_GREATER = 4, ZENI_NOT_EQUAL = 8, ZENI_LESS_OR_EQUAL = 3, ZENI_GREATER_OR_EQUAL = 6, ZENI_ALWAYS = 15 }
enum | VIDEO_MODE { ZENI_VIDEO_ANY, ZENI_VIDEO_GL_FIXED, ZENI_VIDEO_DX9, ZENI_VIDEO_GL_SHADER }

## Public Member Functions

void | apply_Texture (const String &name)
| Apply a texture by name. More...
void | apply_Texture (const unsigned long &id)
| Apply a texture by id. More...
void | apply_Texture (const Texture &texture)
| Apply a texture by id. More...
bool | begin_prerender ()
| Must be called before begin_render. More...
bool | begin_render ()
| Must be called before all rendering functions; Returns true if rendering can proceed. More...
void | clear_depth_buffer ()
| Can reset the depth buffer at any time if necessary. More...
void | clear_render_target (const Color &color=Color(0.0f, 0.0f, 0.0f, 0.0f))
| Clear the viewport. More...
Font * | create_Font (const String &filename, const float &glyph_height, const float &virtual_screen_height)
| Function for creating a Font; used internally by Fonts. More...
Shader * | create_Fragment_Shader (const String &filename)
| Create a Fragment_Shader from a file. More...
Program * | create_Program ()
| Create a Program from a file. More...
Texture * | create_Texture (const Image &image)
| Function for creating a Texture from an Image. More...
Texture * | create_Texture (const Point2i &size, const bool &repeat)
| Function for creating a Texture for render-to-texture. More...
Vertex_Buffer_Renderer * | create_Vertex_Buffer_Renderer (Vertex_Buffer &vertex_buffer)
| Function for creating a Vertex_Buffer_Renderer. More...
Shader * | create_Vertex_Shader (const String &filename)
| Create a Vertex_Shader from a file. More...
void | end_render ()
| Must be called after all rendering functions. More...
LPDIRECT3D9 & | get_d3d ()
| See DirectX Documentation for details. More...
const D3DCAPS9 & | get_d3d_capabilities ()
| See DirectX Documentation for details. More...
LPDIRECT3DDEVICE9 & | get_d3d_device ()
| See DirectX Documentation for details. More...
const D3DPRESENT_PARAMETERS & | get_d3d_parameters ()
| See DirectX Documentation for details. More...
const int & | get_dpi ()
| Get the screen's DPI. More...
float | get_dpi_ratio ()
| Get the ratio of the screen's DPI to the normal DPI. More...
LPD3DXMATRIXSTACK & | get_matrix_stack ()
| Get access to a matrix stack stored by this class. More...
int | get_maximum_anisotropy () const
| Get the current level of anisotrophy. More...
Point2f | get_pixel_offset () const
| Get the pixel offset in the 2d view. More...
const Point2i & | get_render_target_size () const
| Get the dimensions of the render target. More...
bool | has_vertex_buffers () const
| Determine whether Vertex_Buffers are supported. More...
bool | is_fvf_3d () const
Texture * | load_Texture (const String &filename, const bool &repeat, const bool &lazy_loading=false)
| Function for loading a Texture; used internally by Textures. More...
void | pop_world_stack ()
| Pop a model view matrix off the stack. More...
void | push_world_stack ()
| Push a model view matrix onto the stack. More...
void | render (const Renderable &renderable)
| Render a Renderable. More...
void | rotate_scene (const Vector3f &about, const float &radians)
| Rotate the scene. More...
void | scale_scene (const Vector3f &factor)
| Scale the scene. More...
void | select_world_matrix ()
| Select the world (model view) matrix; Call before [translate/rotate/scale] scene. More...
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. More...
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. More...
void | set_alpha_test (const bool &enabled, const TEST &test, const float &value)
| Set the alpha test. More...
void | set_ambient_lighting (const Color &color)
| Set ambient lighting on/off. More...
void | set_backface_culling (const bool &on)
| Set backface culling on/off. More...
void | set_clear_Color (const Color &color)
| Set the blank background color. More...
void | set_Color (const Color &)
| Set the current color. More...
void | set_Fog (const Fog &fog)
| Set Fog. More...
void | set_fvf (const bool &is_3d)
void | set_fvf_3d (const bool &on)
void | set_Light (const int &number, const Light &light)
| Set a particular Light. More...
void | set_lighting (const bool &on=true)
| Set lighting on/off. More...
void | set_Material (const Material &material)
| Set a Material. More...
void | set_program (Program &program)
| Enable a program. More...
void | set_projection_matrix (const Matrix4f &projection)
| Set the projection Matrix4f. More...
void | set_render_target (Texture &texture)
| Set a render target. More...
void | set_vertical_sync (const bool &on)
| Set vertical_sync on/off. More...
void | set_view_matrix (const Matrix4f &view)
| Set the view Matrix4f. More...
void | set_viewport (const std::pair< Point2i, Point2i > &viewport=std::make_pair(Point2i(), get_Video().get_render_target_size()))
| Set the viewport. More...
void | set_ztest (const bool &enabled)
| Enable or disable testing of the Z-Buffer. More...
void | set_zwrite (const bool &enabled)
| Enable or disable writing to the Z-Buffer. More...
void | transform_scene (const Matrix4f &transformation)
| Transform the scene. More...
void | translate_scene (const Vector3f &direction)
| Translate the scene. More...
void | unapply_Texture ()
| Unapply a texture. More...
void | unset_Fog ()
| Unset Fog. More...
void | unset_Light (const int &number)
| Unset a particular Light. More...
void | unset_Material (const Material &material)
| Unset a Material. More...
void | unset_program ()
| Disable a program. More...
void | unset_render_target ()
| Unset a render target. More...
Public Member Functions inherited from Zeni::Video
void | apply_Texture (const String &name)
| Apply a texture by name. More...
std::pair< Point2i, Point2i > | calculate_viewport (const std::pair< Point2f, Point2f > &camera2d, const std::pair< Point2i, Point2i > &viewport, const bool &fix_aspect_ratio)
| Calculate the viewport. More...
std::pair< Point2i, Point2i > | calculate_viewport (const float &aspect_ratio, const std::pair< Point2i, Point2i > &viewport=std::make_pair(Point2i(), get().get_render_target_size())) const
| Calculate the viewport. More...
TEST | get_alpha_test_function () const
| Determine which alpha test is in use. More...
float | get_alpha_test_value () const
| Determine what value the alpha test is comparing against. More...
const Color & | get_clear_Color () const
| Get the blank background color. More...
const Color & | get_Color () const
| Get the current color. More...
const Fog * | get_Fog () const
| Get pointer to current Fog, or 0 if no Fog. More...
ShHandle | get_fragment_shader_compiler () const
| Get the fragment shader compiler. More...
const Light * | get_Light (const int &number) const
| Get pointer to Light, or 0 if no such Light. More...
const Matrix4f & | get_projection_matrix () const
| Get the projection Matrix4f. More...
ShHandle | get_vertex_shader_compiler () const
| Get the vertex shader compiler. More...
const Matrix4f & | get_view_matrix () const
| Get the view Matrix4f. More...
const std::pair< Point2i, Point2i > & | get_viewport () const
| Get the viewport. More...
bool | is_3d () const
| Determine whether currently rendering in 3D. More...
bool | is_alpha_test_enabled () const
| Determine whether alpha testing is enabled. More...
bool | is_ztest_enabled () const
| Determine whether testing the Z-Buffer is enabled. More...
bool | is_zwrite_enabled () const
| Determine whether writing to Z-Buffer is enabled. More...
void | rotate_scene (const Quaternion &rotation)
| Rotate the scene. More...
void | set_2d ()
| Set the default 2D view filling the entire display area. More...
void | set_2d (const std::pair< Point2f, Point2f > &camera2d, const bool &fix_aspect_ratio=false)
| Set a 2D view for the entire viewing area. More...
void | set_3d (const Camera &camera)
| Set a 3D view filling the entire display area. More...
void | set_viewport (const float &aspect_ratio, const std::pair< Point2i, Point2i > &viewport=std::make_pair(Point2i(), get().get_render_target_size()))
| Set the viewport. More...
Public Member Functions inherited from Zeni::Singleton< Video >
void | fax_post_reinit (Event::Handler *const &handler)
void | fax_pre_uninit (Event::Handler *const &handler)
void | give_post_reinit (Event::Handler *const &handler)
void | give_pre_uninit (Event::Handler *const &handler)
void | lend_post_reinit (Event::Handler *const &handler)
void | lend_pre_uninit (Event::Handler *const &handler)

## Static Public Member Functions

static D3DXCompileShader_fcn | D3DXCompileShader ()
static D3DXCreateMatrixStack_fcn | D3DXCreateMatrixStack ()
static D3DXCreateRenderToSurface_fcn | D3DXCreateRenderToSurface ()
static D3DXCreateTexture_fcn | D3DXCreateTexture ()
static D3DXFilterTexture_fcn | D3DXFilterTexture ()
static Direct3DCreate9_fcn | Direct3DCreate9 ()
Static Public Member Functions inherited from Zeni::Video
static void | change_resolution (const Point2i &resolution)
static const Color & | get_ambient_lighting ()
| Get the current ambient lighting Color. More...
static bool | get_backface_culling ()
| Determine whether backface culling is enabled. More...
static bool | get_lighting ()
| Determine whether dynamic lighting is enabled. More...
static int | get_multisampling ()
| Get the current level of multisampling. More...
static bool | get_normal_interpolation ()
| Determine whether normal interpolation is enabled. More...
static bool | get_vertical_sync ()
| Determine whether vertical sync is enabled. More...
static VIDEO_MODE | get_video_mode ()
| Get the currently selected video mode. More...
static void | preinit_from_file (const String &filename)
| Set rendering options from a file. More...
static void | preinit_from_file (const XML_Document &file)
| Set rendering options from a file. More...
static void | preinit_multisampling (const int &multisampling=0)
| Set a multisampling value. More...
static void | preinit_vertical_sync (const bool &vertical_sync=false)
| Set vertical_sync to true. More...
static void | preinit_video_mode (const VIDEO_MODE &vm=ZENI_VIDEO_ANY)
| Set which rendering engine to use. More...
static void | print_errors ()
| Print any errors that may have occurred. More...
static bool | revert ()
| Restore previously saved options; Returns true if successful. More...
static void | save (const bool &backup=true)
| Save options. More...
static void | set_failsafe_defaults ()
| Set failsafe default options. More...
Static Public Member Functions inherited from Zeni::Singleton< Video >
static void | completely_destroy ()
static void | destroy ()
static Video & | get ()
static bool | is_initialized ()
static void | remove_post_reinit (Event::Handler *const &handler)
static void | remove_pre_uninit (Event::Handler *const &handler)

## Protected Member Functions

void | destroy_device ()
void | init ()
void | init_context ()
bool | init_device ()
Protected Member Functions inherited from Zeni::Video
| Video ()
virtual | ~Video ()=0
String | compile_glsles_shader (const String &filename, const ShHandle &compiler)
| Compile an OpenGL ES shader to GLSL/HLSL. More...
Protected Member Functions inherited from Zeni::Singleton< Video >
| Singleton ()
virtual | ~Singleton ()

## Friends

Video & | get_Video ()
| Get access to the singleton. More...
class | Video

## Additional Inherited Members

Protected Attributes inherited from Zeni::Video
ShHandle | m_fragment_compiler
ShHandle | m_vertex_compiler

## Detailed Description

The Direct3D9 Rendering System.

This class supports Direct3D9-specific rendering.

Author
  bazald

Contact: bazal.nosp@m.d@ze.nosp@m.nipex.nosp@m..com

Definition at line 62 of file Video_DX9.h.

## Member Typedef Documentation

typedef HRESULT(WINAPI * Zeni::Video_DX9::D3DXCompileShader_fcn)(LPCSTR pSrcData, UINT srcDataLen, const D3DXMACRO *pDefines, LPD3DXINCLUDE pInclude, LPCSTR pFunctionName, LPCSTR pProfile, DWORD Flags, LPD3DXBUFFER *ppShader, LPD3DXBUFFER *ppErrorMsgs, LPD3DXCONSTANTTABLE *ppConstantTable)

Definition at line 100 of file Video_DX9.h.

typedef HRESULT(WINAPI * Zeni::Video_DX9::D3DXCreateMatrixStack_fcn)(DWORD Flags, LPD3DXMATRIXSTACK *ppStack)

Definition at line 97 of file Video_DX9.h.

typedef HRESULT(WINAPI * Zeni::Video_DX9::D3DXCreateRenderToSurface_fcn)(LPDIRECT3DDEVICE9 pDevice, UINT Width, UINT Height, D3DFORMAT Format, BOOL DepthStencil, D3DFORMAT DepthStencilFormat, LPD3DXRENDERTOSURFACE *ppRenderToSurface)

Definition at line 75 of file Video_DX9.h.

typedef HRESULT(WINAPI * Zeni::Video_DX9::D3DXCreateTexture_fcn)(LPDIRECT3DDEVICE9 pDevice, UINT Width, UINT Height, UINT MipLevels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, LPDIRECT3DTEXTURE9 *ppTexture)

Definition at line 83 of file Video_DX9.h.

typedef HRESULT(WINAPI * Zeni::Video_DX9::D3DXFilterTexture_fcn)(LPDIRECT3DBASETEXTURE9 pBaseTexture, CONST PALETTEENTRY *pPalette, UINT SrcLevel, DWORD Filter)

Definition at line 92 of file Video_DX9.h.

typedef LPDIRECT3D9(WINAPI * Zeni::Video_DX9::Direct3DCreate9_fcn)(UINT SDKVersion)

Definition at line 74 of file Video_DX9.h.

## Member Function Documentation

void Zeni::Video_DX9::apply_Texture | ( | const String & | name | ) |

inline

Apply a texture by name.

Definition at line 146 of file Video_DX9.h.

References Zeni::Video::apply_Texture().

Referenced by Zeni::Material::set().

void Zeni::Video_DX9::apply_Texture | ( | const unsigned long & | id | ) |

virtual

Apply a texture by id.

Implements Zeni::Video.

Definition at line 355 of file Video_DX9.cpp.

References Zeni::Textures::apply_Texture(), Zeni::get_Textures(), and set_fvf().

void Zeni::Video_DX9::apply_Texture | ( | const Texture & | texture | ) |

virtual

Apply a texture by id.

Implements Zeni::Video.

Definition at line 363 of file Video_DX9.cpp.

References Zeni::Texture::apply_Texture(), and set_fvf().

bool Zeni::Video_DX9::begin_prerender | ( |  | ) |

virtual

Must be called before begin_render.

Implements Zeni::Video.

Definition at line 163 of file Video_DX9.cpp.

References assert, D3DERR_DEVICELOST, D3DERR_DEVICENOTRESET, D3DERR_DRIVERINTERNALERROR, Zeni::g_video_dx9_reset, Zeni::get_Fonts(), Zeni::get_Textures(), HRESULT(), init_context(), and Zeni::Database< TYPE >::unlose_resources().

bool Zeni::Video_DX9::begin_render | ( |  | ) |

virtual

Must be called before all rendering functions; Returns true if rendering can proceed.

Implements Zeni::Video.

Definition at line 197 of file Video_DX9.cpp.

References assert, D3DCLEAR_TARGET, D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB, D3DERR_DEVICELOST, D3DERR_DEVICEREMOVED, DWORD(), Zeni::g_video_dx9_reset, Zeni::Video::get_clear_Color(), Zeni::get_Window(), and HRESULT().

void Zeni::Video_DX9::clear_depth_buffer | ( |  | ) |

virtual

Can reset the depth buffer at any time if necessary.

Implements Zeni::Video.

Definition at line 250 of file Video_DX9.cpp.

References D3DCLEAR_ZBUFFER.

void Zeni::Video_DX9::clear_render_target | ( | const Color & | color = `Color(0.0f, 0.0f, 0.0f, 0.0f)` | ) |

virtual

Clear the viewport.

Implements Zeni::Video.

Definition at line 488 of file Video_DX9.cpp.

References Zeni::Color::a_ub(), Zeni::Color::b_ub(), D3DCLEAR_TARGET, D3DCLEAR_ZBUFFER, D3DCOLOR_ARGB, Zeni::Color::g_ub(), get_render_target_size(), Zeni::Color::r_ub(), set_viewport(), Zeni::Point2i::x, and Zeni::Point2i::y.

Font * Zeni::Video_DX9::create_Font | ( | const String & | filename,
|  | const float & | glyph_height,
|  | const float & | virtual_screen_height
| ) |  |

virtual

Function for creating a Font; used internally by Fonts.

Implements Zeni::Video.

Definition at line 573 of file Video_DX9.cpp.

Shader * Zeni::Video_DX9::create_Fragment_Shader | ( | const String & | filename | ) |

virtual

Create a Fragment_Shader from a file.

Implements Zeni::Video.

Definition at line 585 of file Video_DX9.cpp.

References Zeni::Video::compile_glsles_shader(), Zeni::Shader::FRAGMENT, and Zeni::Video::m_fragment_compiler.

Program * Zeni::Video_DX9::create_Program | ( |  | ) |

virtual

Create a Program from a file.

Implements Zeni::Video.

Definition at line 589 of file Video_DX9.cpp.

Texture * Zeni::Video_DX9::create_Texture | ( | const Image & | image | ) |

virtual

Function for creating a Texture from an Image.

Implements Zeni::Video.

Definition at line 557 of file Video_DX9.cpp.

Texture * Zeni::Video_DX9::create_Texture | ( | const Point2i & | size,
|  | const bool & | repeat
| ) |  |

virtual

Function for creating a Texture for render-to-texture.

Implements Zeni::Video.

Definition at line 561 of file Video_DX9.cpp.

References Zeni::Window::get_size(), Zeni::get_Window(), max, Zeni::Point2i::x, and Zeni::Point2i::y.

Vertex_Buffer_Renderer * Zeni::Video_DX9::create_Vertex_Buffer_Renderer | ( | Vertex_Buffer & | vertex_buffer | ) |

virtual

Function for creating a Vertex_Buffer_Renderer.

Implements Zeni::Video.

Definition at line 577 of file Video_DX9.cpp.

Shader * Zeni::Video_DX9::create_Vertex_Shader | ( | const String & | filename | ) |

virtual

Create a Vertex_Shader from a file.

Implements Zeni::Video.

Definition at line 581 of file Video_DX9.cpp.

References Zeni::Video::compile_glsles_shader(), Zeni::Video::m_vertex_compiler, and Zeni::Shader::VERTEX.

static D3DXCompileShader_fcn Zeni::Video_DX9::D3DXCompileShader | ( |  | ) |

inlinestatic

Definition at line 118 of file Video_DX9.h.

Referenced by Zeni::Shader_DX9::Shader_DX9().

static D3DXCreateMatrixStack_fcn Zeni::Video_DX9::D3DXCreateMatrixStack | ( |  | ) |

inlinestatic

Definition at line 117 of file Video_DX9.h.

Referenced by init_device().

static D3DXCreateRenderToSurface_fcn Zeni::Video_DX9::D3DXCreateRenderToSurface | ( |  | ) |

inlinestatic

Definition at line 114 of file Video_DX9.h.

Referenced by Zeni::Texture_DX9::Texture_DX9().

static D3DXCreateTexture_fcn Zeni::Video_DX9::D3DXCreateTexture | ( |  | ) |

inlinestatic

Definition at line 115 of file Video_DX9.h.

Referenced by Zeni::Texture_DX9::Texture_DX9().

static D3DXFilterTexture_fcn Zeni::Video_DX9::D3DXFilterTexture | ( |  | ) |

inlinestatic

Definition at line 116 of file Video_DX9.h.

void Zeni::Video_DX9::destroy_device | ( |  | ) |

protected

Definition at line 778 of file Video_DX9.cpp.

References Zeni::Video::m_fragment_compiler, Zeni::Video::m_vertex_compiler, and ShDestruct().

Referenced by set_vertical_sync().

static Direct3DCreate9_fcn Zeni::Video_DX9::Direct3DCreate9 | ( |  | ) |

inlinestatic

Definition at line 113 of file Video_DX9.h.

void Zeni::Video_DX9::end_render | ( |  | ) |

virtual

Must be called after all rendering functions.

Implements Zeni::Video.

Definition at line 223 of file Video_DX9.cpp.

LPDIRECT3D9 & Zeni::Video_DX9::get_d3d | ( |  | ) |

inline

See DirectX Documentation for details.

Definition at line 44 of file Video_DX9.hxx.

const D3DCAPS9 & Zeni::Video_DX9::get_d3d_capabilities | ( |  | ) |

See DirectX Documentation for details.

Definition at line 593 of file Video_DX9.cpp.

LPDIRECT3DDEVICE9 & Zeni::Video_DX9::get_d3d_device | ( |  | ) |

inline

See DirectX Documentation for details.

Definition at line 48 of file Video_DX9.hxx.

Referenced by Zeni::Texture_DX9::apply_Texture(), Modern_State::Modern_State(), Zeni::Vertex_Buffer_Renderer_DX9::render(), Zeni::Line_Segment< VERTEX >::render_to(), Zeni::Triangle< VERTEX >::render_to(), Zeni::Quadrilateral< VERTEX >::render_to(), Zeni::Vertex3f_Color::render_to(), Zeni::Vertex2f_Color::render_to(), Zeni::Fog::set(), Zeni::Light::set(), Zeni::Material::set(), Zeni::Shader_DX9::Shader_DX9(), Zeni::Texture_DX9::Texture_DX9(), and Zeni::Vertex_Buffer_Renderer_DX9::Vertex_Buffer_Renderer_DX9().

const D3DPRESENT_PARAMETERS & Zeni::Video_DX9::get_d3d_parameters | ( |  | ) |

See DirectX Documentation for details.

Definition at line 597 of file Video_DX9.cpp.

const int & Zeni::Video_DX9::get_dpi | ( |  | ) |

inline

Get the screen's DPI.

Definition at line 56 of file Video_DX9.hxx.

float Zeni::Video_DX9::get_dpi_ratio | ( |  | ) |

inline

Get the ratio of the screen's DPI to the normal DPI.

Definition at line 60 of file Video_DX9.hxx.

References ZENI_STANDARD_DPI.

LPD3DXMATRIXSTACK & Zeni::Video_DX9::get_matrix_stack | ( |  | ) |

inline

Get access to a matrix stack stored by this class.

Definition at line 52 of file Video_DX9.hxx.

Referenced by pop_world_stack(), and push_world_stack().

int Zeni::Video_DX9::get_maximum_anisotropy | ( |  | ) | const

virtual

Get the current level of anisotrophy.

Implements Zeni::Video.

Definition at line 254 of file Video_DX9.cpp.

References int, and _D3DCAPS9::MaxAnisotropy.

Point2f Zeni::Video_DX9::get_pixel_offset | ( |  | ) | const

virtual

Get the pixel offset in the 2d view.

Implements Zeni::Video.

Definition at line 530 of file Video_DX9.cpp.

const Point2i & Zeni::Video_DX9::get_render_target_size | ( |  | ) | const

inlinevirtual

Get the dimensions of the render target.

Implements Zeni::Video.

Definition at line 494 of file Video_DX9.cpp.

References Zeni::Window::get_size(), Zeni::Texture_DX9::get_size(), and Zeni::get_Window().

Referenced by clear_render_target().

bool Zeni::Video_DX9::has_vertex_buffers | ( |  | ) | const

virtual

Determine whether Vertex_Buffers are supported.

Implements Zeni::Video.

Definition at line 258 of file Video_DX9.cpp.

void Zeni::Video_DX9::init | ( |  | ) |

protected

Definition at line 601 of file Video_DX9.cpp.

References _D3DPRESENT_PARAMETERS_::AutoDepthStencilFormat, _D3DPRESENT_PARAMETERS_::BackBufferCount, _D3DPRESENT_PARAMETERS_::BackBufferFormat, _D3DPRESENT_PARAMETERS_::BackBufferHeight, _D3DPRESENT_PARAMETERS_::BackBufferWidth, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_A8R8G8B8, D3DFMT_D16, D3DMULTISAMPLE_10_SAMPLES, D3DMULTISAMPLE_11_SAMPLES, D3DMULTISAMPLE_12_SAMPLES, D3DMULTISAMPLE_13_SAMPLES, D3DMULTISAMPLE_14_SAMPLES, D3DMULTISAMPLE_15_SAMPLES, D3DMULTISAMPLE_16_SAMPLES, D3DMULTISAMPLE_2_SAMPLES, D3DMULTISAMPLE_3_SAMPLES, D3DMULTISAMPLE_4_SAMPLES, D3DMULTISAMPLE_5_SAMPLES, D3DMULTISAMPLE_6_SAMPLES, D3DMULTISAMPLE_7_SAMPLES, D3DMULTISAMPLE_8_SAMPLES, D3DMULTISAMPLE_9_SAMPLES, D3DMULTISAMPLE_NONE, D3DPRESENT_INTERVAL_IMMEDIATE, D3DPRESENT_INTERVAL_ONE, D3DPRESENT_RATE_DEFAULT, D3DSWAPEFFECT_DISCARD, _D3DPRESENT_PARAMETERS_::EnableAutoDepthStencil, _D3DPRESENT_PARAMETERS_::Flags, _D3DPRESENT_PARAMETERS_::FullScreen_RefreshRateInHz, Zeni::Video::get_multisampling(), Zeni::Video::get_vertical_sync(), Zeni::get_Window(), _D3DPRESENT_PARAMETERS_::hDeviceWindow, SDL_SysWMinfo::info, init_context(), init_device(), _D3DPRESENT_PARAMETERS_::MultiSampleQuality, _D3DPRESENT_PARAMETERS_::MultiSampleType, _D3DPRESENT_PARAMETERS_::PresentationInterval, SDL_GetWindowWMInfo(), SDL_VERSION, _D3DPRESENT_PARAMETERS_::SwapEffect, UINT(), SDL_SysWMinfo::version, and _D3DPRESENT_PARAMETERS_::Windowed.

Referenced by set_vertical_sync().

void Zeni::Video_DX9::init_context | ( |  | ) |

protected

Definition at line 742 of file Video_DX9.cpp.

References D3DBLEND_INVSRCALPHA, D3DBLEND_SRCALPHA, D3DBLENDOP_ADD, D3DRS_ALPHABLENDENABLE, D3DRS_BLENDOP, D3DRS_DESTBLEND, D3DRS_MULTISAMPLEANTIALIAS, D3DRS_NORMALIZENORMALS, D3DRS_SRCBLEND, D3DTA_DIFFUSE, D3DTA_TEXTURE, D3DTSS_ALPHAARG1, D3DTSS_ALPHAARG2, D3DTSS_COLORARG1, D3DTSS_COLORARG2, DWORD(), Zeni::Video::get_alpha_test_function(), Zeni::Video::get_alpha_test_value(), Zeni::Video::get_ambient_lighting(), Zeni::Video::get_backface_culling(), Zeni::Video::get_clear_Color(), Zeni::Video::get_Color(), Zeni::Video::get_Fog(), Zeni::Video::get_Light(), Zeni::Video::get_lighting(), Zeni::Video::get_multisampling(), i, Zeni::Video::is_alpha_test_enabled(), Zeni::Video::is_ztest_enabled(), Zeni::Video::is_zwrite_enabled(), Zeni::Video::set_2d(), set_alpha_test(), set_ambient_lighting(), set_backface_culling(), set_clear_Color(), set_Color(), set_Fog(), set_Light(), set_lighting(), set_ztest(), and set_zwrite().

Referenced by begin_prerender(), and init().

bool Zeni::Video_DX9::init_device | ( |  | ) |

protected

Generate vertex and fragment shader compilers

Definition at line 679 of file Video_DX9.cpp.

References D3DADAPTER_DEFAULT, D3DCREATE_HARDWARE_VERTEXPROCESSING, D3DCREATE_MIXED_VERTEXPROCESSING, D3DCREATE_SOFTWARE_VERTEXPROCESSING, D3DDEVCAPS_HWTRANSFORMANDLIGHT, D3DDEVTYPE_HAL, D3DFMT_A8R8G8B8, D3DMULTISAMPLE_10_SAMPLES, D3DMULTISAMPLE_11_SAMPLES, D3DMULTISAMPLE_12_SAMPLES, D3DMULTISAMPLE_13_SAMPLES, D3DMULTISAMPLE_14_SAMPLES, D3DMULTISAMPLE_15_SAMPLES, D3DMULTISAMPLE_16_SAMPLES, D3DMULTISAMPLE_2_SAMPLES, D3DMULTISAMPLE_3_SAMPLES, D3DMULTISAMPLE_4_SAMPLES, D3DMULTISAMPLE_5_SAMPLES, D3DMULTISAMPLE_6_SAMPLES, D3DMULTISAMPLE_7_SAMPLES, D3DMULTISAMPLE_8_SAMPLES, D3DMULTISAMPLE_9_SAMPLES, D3DMULTISAMPLE_NONE, D3DXCreateMatrixStack(), DWORD(), _D3DPRESENT_PARAMETERS_::hDeviceWindow, Zeni::Video::m_fragment_compiler, Zeni::Video::m_vertex_compiler, ShBuiltInResources::MaxCombinedTextureImageUnits, ShBuiltInResources::MaxDrawBuffers, ShBuiltInResources::MaxFragmentUniformVectors, ShBuiltInResources::MaxTextureImageUnits, ShBuiltInResources::MaxVaryingVectors, ShBuiltInResources::MaxVertexAttribs, ShBuiltInResources::MaxVertexTextureImageUnits, ShBuiltInResources::MaxVertexUniformVectors, _D3DPRESENT_PARAMETERS_::MultiSampleType, ShBuiltInResources::OES_EGL_image_external, ShBuiltInResources::OES_standard_derivatives, Zeni::Video::preinit_multisampling(), SH_FRAGMENT_SHADER, SH_GLES2_SPEC, SH_HLSL9_OUTPUT, SH_VERTEX_SHADER, ShConstructCompiler(), ShInitBuiltInResources(), _D3DCAPS9::VertexProcessingCaps, and _D3DPRESENT_PARAMETERS_::Windowed.

Referenced by init().

bool Zeni::Video_DX9::is_fvf_3d | ( |  | ) | const

Definition at line 828 of file Video_DX9.cpp.

Texture * Zeni::Video_DX9::load_Texture | ( | const String & | filename,
|  | const bool & | repeat,
|  | const bool & | lazy_loading = `false`
| ) |  |

virtual

Function for loading a Texture; used internally by Textures.

Implements Zeni::Video.

Definition at line 553 of file Video_DX9.cpp.

void Zeni::Video_DX9::pop_world_stack | ( |  | ) |

virtual

Pop a model view matrix off the stack.

Implements Zeni::Video.

Definition at line 505 of file Video_DX9.cpp.

References D3DTS_WORLD, and get_matrix_stack().

void Zeni::Video_DX9::push_world_stack | ( |  | ) |

virtual

Push a model view matrix onto the stack.

Implements Zeni::Video.

Definition at line 501 of file Video_DX9.cpp.

References get_matrix_stack().

void Zeni::Video_DX9::render | ( | const Renderable & | renderable | ) |

virtual

Render a Renderable.

Implements Zeni::Video.

Definition at line 227 of file Video_DX9.cpp.

References Zeni::Renderable::is_3d(), Zeni::Renderable::post_render(), Zeni::Renderable::pre_render(), Zeni::Renderable::render_to(), and set_fvf().

void Zeni::Video_DX9::rotate_scene | ( | const Vector3f & | about,
|  | const float & | radians
| ) |  |

virtual

Rotate the scene.

Implements Zeni::Video.

Definition at line 515 of file Video_DX9.cpp.

References D3DTS_WORLD.

void Zeni::Video_DX9::scale_scene | ( | const Vector3f & | factor | ) |

virtual

Scale the scene.

Implements Zeni::Video.

Definition at line 520 of file Video_DX9.cpp.

References D3DTS_WORLD, Zeni::Vector3f::i, Zeni::Vector3f::j, and Zeni::Vector3f::k.

void Zeni::Video_DX9::select_world_matrix | ( |  | ) |

inlinevirtual

Select the world (model view) matrix; Call before [translate/rotate/scale] scene.

Implements Zeni::Video.

Definition at line 174 of file Video_DX9.h.

void Zeni::Video_DX9::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`
| ) |  |

virtual

Set a 2D view for a viewport.

Implements Zeni::Video.

Definition at line 262 of file Video_DX9.cpp.

References D3DTS_WORLD, Zeni::Matrix4f::Scale(), Zeni::Video::set_2d_view(), and Zeni::Matrix4f::Translate().

void Zeni::Video_DX9::set_3d_view | ( | const Camera & | camera,
|  | const std::pair< Point2i, Point2i > & | viewport = `std::make_pair(Point2i(), get_Video().get_render_target_size())`
| ) |  |

virtual

Set a 3D view for a viewport.

Implements Zeni::Video.

Definition at line 273 of file Video_DX9.cpp.

References D3DTS_WORLD, Zeni::Matrix4f::Identity(), and Zeni::Video::set_3d_view().

void Zeni::Video_DX9::set_alpha_test | ( | const bool & | enabled,
|  | const TEST & | test,
|  | const float & | value
| ) |  |

virtual

Set the alpha test.

Implements Zeni::Video.

Definition at line 316 of file Video_DX9.cpp.

References assert, D3DCMP_ALWAYS, D3DCMP_EQUAL, D3DCMP_GREATER, D3DCMP_GREATEREQUAL, D3DCMP_LESS, D3DCMP_LESSEQUAL, D3DCMP_NEVER, D3DCMP_NOTEQUAL, D3DRS_ALPHAFUNC, D3DRS_ALPHAREF, D3DRS_ALPHATESTENABLE, DWORD(), Zeni::Video::set_alpha_test(), Zeni::Video::ZENI_ALWAYS, Zeni::Video::ZENI_EQUAL, Zeni::Video::ZENI_GREATER, Zeni::Video::ZENI_GREATER_OR_EQUAL, Zeni::Video::ZENI_LESS, Zeni::Video::ZENI_LESS_OR_EQUAL, Zeni::Video::ZENI_NEVER, and Zeni::Video::ZENI_NOT_EQUAL.

Referenced by init_context().

void Zeni::Video_DX9::set_ambient_lighting | ( | const Color & | color | ) |

virtual

Set ambient lighting on/off.

Implements Zeni::Video.

Definition at line 391 of file Video_DX9.cpp.

References D3DRS_AMBIENT, Zeni::Color::get_argb(), and Zeni::Video::set_ambient_lighting().

Referenced by init_context().

void Zeni::Video_DX9::set_backface_culling | ( | const bool & | on | ) |

virtual

Set backface culling on/off.

Implements Zeni::Video.

Definition at line 283 of file Video_DX9.cpp.

References D3DCULL_CW, D3DCULL_NONE, D3DRS_CULLMODE, and Zeni::Video::set_backface_culling().

Referenced by init_context().

void Zeni::Video_DX9::set_clear_Color | ( | const Color & | color | ) |

inlinevirtual

Set the blank background color.

Implements Zeni::Video.

Definition at line 145 of file Video_DX9.h.

References Zeni::Video::set_clear_Color().

Referenced by init_context().

void Zeni::Video_DX9::set_Color | ( | const Color & | color | ) |

virtual

Set the current color.

Implements Zeni::Video.

Definition at line 349 of file Video_DX9.cpp.

References D3DRS_TEXTUREFACTOR, Zeni::Color::get_argb(), and Zeni::Video::set_Color().

Referenced by init_context(), and Zeni::Material::set().

void Zeni::Video_DX9::set_Fog | ( | const Fog & | fog | ) |

virtual

Set Fog.

Implements Zeni::Video.

Definition at line 423 of file Video_DX9.cpp.

References D3DRS_FOGENABLE, Zeni::Fog::set(), and Zeni::Video::set_Fog().

Referenced by init_context().

void Zeni::Video_DX9::set_fvf | ( | const bool & | is_3d | ) |

Definition at line 808 of file Video_DX9.cpp.

References Zeni::Video::is_3d(), and set_fvf().

Referenced by apply_Texture(), render(), Zeni::Vertex_Buffer_Renderer_DX9::render(), set_fvf(), set_fvf_3d(), and unapply_Texture().

void Zeni::Video_DX9::set_fvf_3d | ( | const bool & | on | ) |

Definition at line 832 of file Video_DX9.cpp.

References set_fvf().

void Zeni::Video_DX9::set_Light | ( | const int & | number,
|  | const Light & | light
| ) |  |

virtual

Set a particular Light.

Implements Zeni::Video.

Definition at line 397 of file Video_DX9.cpp.

References DWORD(), Zeni::Light::set(), and Zeni::Video::set_Light().

Referenced by init_context().

void Zeni::Video_DX9::set_lighting | ( | const bool & | on = `true` | ) |

virtual

Set lighting on/off.

Implements Zeni::Video.

Definition at line 384 of file Video_DX9.cpp.

References D3DRS_LIGHTING, D3DRS_SPECULARENABLE, DWORD(), and Zeni::Video::set_lighting().

Referenced by init_context().

void Zeni::Video_DX9::set_Material | ( | const Material & | material | ) |

virtual

Set a Material.

Implements Zeni::Video.

Definition at line 415 of file Video_DX9.cpp.

References Zeni::Material::set().

Referenced by Zeni::render().

void Zeni::Video_DX9::set_program | ( | Program & | program | ) |

virtual

Enable a program.

Implements Zeni::Video.

Definition at line 437 of file Video_DX9.cpp.

References Zeni::Program_DX9::get_fragment_shader(), Zeni::Shader_DX9::get_pixel_shader(), Zeni::Shader_DX9::get_vertex_shader(), and Zeni::Program_DX9::get_vertex_shader().

void Zeni::Video_DX9::set_projection_matrix | ( | const Matrix4f & | projection | ) |

virtual

Set the projection Matrix4f.

Implements Zeni::Video.

Definition at line 540 of file Video_DX9.cpp.

References D3DTS_PROJECTION, and Zeni::Video::set_projection_matrix().

void Zeni::Video_DX9::set_render_target | ( | Texture & | texture | ) |

virtual

Set a render target.

Implements Zeni::Video.

Definition at line 451 of file Video_DX9.cpp.

References Zeni::Texture_DX9::render_to_surface().

void Zeni::Video_DX9::set_vertical_sync | ( | const bool & | on | ) |

virtual

Set vertical_sync on/off.

Implements Zeni::Video.

Definition at line 292 of file Video_DX9.cpp.

References destroy_device(), init(), and Zeni::Video::set_vertical_sync().

void Zeni::Video_DX9::set_view_matrix | ( | const Matrix4f & | view | ) |

virtual

Set the view Matrix4f.

Implements Zeni::Video.

Definition at line 534 of file Video_DX9.cpp.

References D3DTS_VIEW, and Zeni::Video::set_view_matrix().

void Zeni::Video_DX9::set_viewport | ( | const std::pair< Point2i, Point2i > & | viewport = `std::make_pair(Point2i(), get_Video().get_render_target_size())` | ) |

virtual

Set the viewport.

Implements Zeni::Video.

Definition at line 546 of file Video_DX9.cpp.

References DWORD(), Zeni::Video::set_viewport(), and u.

Referenced by clear_render_target().

void Zeni::Video_DX9::set_ztest | ( | const bool & | enabled | ) |

virtual

Enable or disable testing of the Z-Buffer.

Implements Zeni::Video.

Definition at line 305 of file Video_DX9.cpp.

References D3DCMP_LESSEQUAL, D3DRS_ZENABLE, D3DRS_ZFUNC, D3DZB_FALSE, D3DZB_TRUE, and Zeni::Video::set_ztest().

Referenced by init_context().

void Zeni::Video_DX9::set_zwrite | ( | const bool & | enabled | ) |

virtual

Enable or disable writing to the Z-Buffer.

Implements Zeni::Video.

Definition at line 299 of file Video_DX9.cpp.

References D3DRS_ZWRITEENABLE, DWORD(), and Zeni::Video::set_zwrite().

Referenced by init_context().

void Zeni::Video_DX9::transform_scene | ( | const Matrix4f & | transformation | ) |

virtual

Transform the scene.

Implements Zeni::Video.

Definition at line 525 of file Video_DX9.cpp.

References D3DTS_WORLD.

void Zeni::Video_DX9::translate_scene | ( | const Vector3f & | direction | ) |

virtual

Translate the scene.

Implements Zeni::Video.

Definition at line 510 of file Video_DX9.cpp.

References D3DTS_WORLD, Zeni::Vector3f::i, Zeni::Vector3f::j, and Zeni::Vector3f::k.

void Zeni::Video_DX9::unapply_Texture | ( |  | ) |

virtual

Unapply a texture.

Implements Zeni::Video.

Definition at line 371 of file Video_DX9.cpp.

References D3DTA_DIFFUSE, D3DTOP_SELECTARG1, D3DTSS_ALPHAARG1, D3DTSS_ALPHAOP, D3DTSS_COLORARG1, D3DTSS_COLOROP, and set_fvf().

Referenced by Zeni::Material::unset().

void Zeni::Video_DX9::unset_Fog | ( |  | ) |

virtual

Unset Fog.

Implements Zeni::Video.

Definition at line 430 of file Video_DX9.cpp.

References D3DFOG_NONE, D3DRS_FOGENABLE, D3DRS_FOGTABLEMODE, and Zeni::Video::unset_Fog().

void Zeni::Video_DX9::unset_Light | ( | const int & | number | ) |

virtual

Unset a particular Light.

Implements Zeni::Video.

Definition at line 406 of file Video_DX9.cpp.

References DWORD(), FALSE, and Zeni::Video::unset_Light().

void Zeni::Video_DX9::unset_Material | ( | const Material & | material | ) |

virtual

Unset a Material.

Implements Zeni::Video.

Definition at line 419 of file Video_DX9.cpp.

References Zeni::Material::unset().

Referenced by Zeni::render().

void Zeni::Video_DX9::unset_program | ( |  | ) |

virtual

Disable a program.

Implements Zeni::Video.

Definition at line 446 of file Video_DX9.cpp.

void Zeni::Video_DX9::unset_render_target | ( |  | ) |

virtual

Unset a render target.

Implements Zeni::Video.

Definition at line 475 of file Video_DX9.cpp.

## Friends And Related Function Documentation

Video& get_Video | ( |  | ) |

friend

Get access to the singleton.

Definition at line 149 of file Video.cpp.

friend class Video

friend

Definition at line 63 of file Video_DX9.h.

The documentation for this class was generated from the following files:

- zenilib/jni/external/zenilib/zeni_graphics/Zeni/Video_DX9.h
- zenilib/jni/external/zenilib/zeni_graphics/Video_DX9.cpp
- zenilib/jni/external/zenilib/zeni_graphics/Zeni/Video_DX9.hxx