zenilib: Zeni::Video 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 | Protected Attributes | Friends | List of all members
Zeni::Video Class Referenceabstract
Zenilib

The Video Rendering Singleton. More...

`#include <Video.h>`

Inherits Zeni::Singleton< Video >.

Inherited by Zeni::Video_DX9, Zeni::Video_GL_Fixed, and Zeni::Video_GL_Shader.

## Public Types

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...
virtual void | apply_Texture (const unsigned long &id)=0
| Apply a texture by id. More...
virtual void | apply_Texture (const Texture &texture)=0
| Apply a texture by id. More...
virtual bool | begin_prerender ()=0
| Must be called before begin_render. More...
virtual bool | begin_render ()=0
| Must be called before all rendering functions; Returns true if rendering can proceed. 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...
virtual void | clear_depth_buffer ()=0
| Can reset the depth buffer at any time if necessary. More...
virtual void | clear_render_target (const Color &color=Color(0.0f, 0.0f, 0.0f, 0.0f))=0
| Clear the viewport. More...
virtual Font * | create_Font (const String &filename, const float &glyph_height, const float &virtual_screen_height)=0
| Function for creating a Font; used internally by Fonts. More...
virtual Shader * | create_Fragment_Shader (const String &filename)=0
| Create a Fragment_Shader from a file. More...
virtual Program * | create_Program ()=0
| Create a Program from a file. More...
virtual Texture * | create_Texture (const Image &image)=0
| Function for creating a Texture from an Image. More...
virtual Texture * | create_Texture (const Point2i &size, const bool &repeat)=0
| Function for creating a Texture for render-to-texture. More...
virtual Vertex_Buffer_Renderer * | create_Vertex_Buffer_Renderer (Vertex_Buffer &vertex_buffer)=0
| Function for creating a Vertex_Buffer_Renderer. More...
virtual Shader * | create_Vertex_Shader (const String &filename)=0
| Create a Vertex_Shader from a file. More...
virtual void | end_render ()=0
| Must be called after all rendering functions. 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...
virtual int | get_maximum_anisotropy () const =0
| Get the current level of anisotrophy. More...
virtual Point2f | get_pixel_offset () const =0
| Get the pixel offset in the 2d view. More...
const Matrix4f & | get_projection_matrix () const
| Get the projection Matrix4f. More...
virtual const Point2i & | get_render_target_size () const =0
| Get the dimensions of the render target. 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...
virtual bool | has_vertex_buffers () const =0
| Determine whether Vertex_Buffers are supported. 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...
virtual Texture * | load_Texture (const String &filename, const bool &repeat, const bool &lazy_loading=false)=0
| Function for loading a Texture; used internally by Textures. More...
virtual void | pop_world_stack ()=0
| Pop a model view matrix off the stack. More...
virtual void | push_world_stack ()=0
| Push a model view matrix onto the stack. More...
virtual void | render (const Renderable &renderable)=0
| Render a Renderable. More...
virtual void | rotate_scene (const Vector3f &about, const float &radians)=0
| Rotate the scene. More...
void | rotate_scene (const Quaternion &rotation)
| Rotate the scene. More...
virtual void | scale_scene (const Vector3f &factor)=0
| Scale the scene. More...
virtual void | select_world_matrix ()=0
| Select the world (model view) matrix; Call before [translate/rotate/scale] 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...
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. More...
void | set_3d (const Camera &camera)
| Set a 3D view filling the entire display area. More...
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. More...
virtual void | set_alpha_test (const bool &enabled, const TEST &test=ZENI_ALWAYS, const float &value=0.0f)=0
| Set the alpha test. More...
virtual void | set_ambient_lighting (const Color &color)=0
| Set ambient lighting on/off. More...
virtual void | set_backface_culling (const bool &on)=0
| Set backface culling on/off. More...
virtual void | set_clear_Color (const Color &color)=0
| Set the blank background color. More...
virtual void | set_Color (const Color &color)=0
| Set the current color. More...
virtual void | set_Fog (const Fog &fog)=0
| Set Fog. More...
virtual void | set_Light (const int &number, const Light &light)=0
| Set a particular Light. More...
virtual void | set_lighting (const bool &on=true)=0
| Set lighting on/off. More...
virtual void | set_Material (const Material &material)=0
| Set a Material. More...
virtual void | set_program (Program &program)=0
| Enable a program. More...
virtual void | set_projection_matrix (const Matrix4f &projection)=0
| Set the projection Matrix4f. More...
virtual void | set_render_target (Texture &texture)=0
| Set a render target. More...
virtual void | set_vertical_sync (const bool &on)=0
| Set vertical_sync on/off. More...
virtual void | set_view_matrix (const Matrix4f &view)=0
| Set the view Matrix4f. More...
virtual void | set_viewport (const std::pair< Point2i, Point2i > &viewport=std::make_pair(Point2i(), get().get_render_target_size()))=0
| Set the viewport. 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...
virtual void | set_ztest (const bool &enabled)=0
| Enable or disable testing of the Z-Buffer. More...
virtual void | set_zwrite (const bool &enabled)=0
| Enable or disable writing to the Z-Buffer. More...
virtual void | transform_scene (const Matrix4f &transformation)=0
| Transform the scene. More...
virtual void | translate_scene (const Vector3f &direction)=0
| Translate the scene. More...
virtual void | unapply_Texture ()=0
| Unapply a texture. More...
virtual void | unset_Fog ()=0
| Unset Fog. More...
virtual void | unset_Light (const int &number)=0
| Unset a particular Light. More...
virtual void | unset_Material (const Material &material)=0
| Unset a Material. More...
virtual void | unset_program ()=0
| Disable a program. More...
virtual void | unset_render_target ()=0
| Unset a render target. 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 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

| 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 ()

## Protected Attributes

ShHandle | m_fragment_compiler
ShHandle | m_vertex_compiler

## Friends

class | Singleton< Video >

## Detailed Description

The Video Rendering Singleton.

Not literally related to video, as in movies, this base class supports graphics rendering. If you do not intend to write your own Renderables, this might be all you need. If you do intend to write your own Renderables, expect to use the derived Video classes as well.

Author
  bazald

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

Definition at line 71 of file Video.h.

## Member Enumeration Documentation

enum Zeni::Video::TEST

Enumerator
ZENI_NEVER |
ZENI_LESS |
ZENI_EQUAL |
ZENI_GREATER |
ZENI_NOT_EQUAL |
ZENI_LESS_OR_EQUAL |
ZENI_GREATER_OR_EQUAL |
ZENI_ALWAYS |

Definition at line 98 of file Video.h.

enum Zeni::Video::VIDEO_MODE

Enumerator
ZENI_VIDEO_ANY |
ZENI_VIDEO_GL_FIXED |
ZENI_VIDEO_DX9 |
ZENI_VIDEO_GL_SHADER |

Definition at line 96 of file Video.h.

## Constructor & Destructor Documentation

Zeni::Video::Video | ( |  | ) |

protected

Definition at line 119 of file Video.cpp.

References Zeni::get_Window(), Zeni::Singleton< TYPE >::lend_post_reinit(), Zeni::Singleton< TYPE >::lend_pre_uninit(), Zeni::Singleton< Window >::remove_post_reinit(), ShFinalize(), and ShInitialize().

Zeni::Video::~Video | ( |  | ) |

protectedpure virtual

Definition at line 145 of file Video.cpp.

References Zeni::Singleton< Window >::remove_pre_uninit().

## Member Function Documentation

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

inline

Apply a texture by name.

Definition at line 118 of file Video.hxx.

References Zeni::get_Textures().

Referenced by Zeni::Video_GL_Fixed::apply_Texture(), Zeni::Video_GL_Shader::apply_Texture(), Zeni::Video_DX9::apply_Texture(), and Zeni::Font_FT::render_text().

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

pure virtual

Apply a texture by id.

Implemented in Zeni::Video_DX9, Zeni::Video_GL_Fixed, and Zeni::Video_GL_Shader.

virtual void Zeni::Video::apply_Texture | ( | const Texture & | texture | ) |

pure virtual

Apply a texture by id.

Implemented in Zeni::Video_DX9, Zeni::Video_GL_Fixed, and Zeni::Video_GL_Shader.

virtual bool Zeni::Video::begin_prerender | ( |  | ) |

pure virtual

Must be called before begin_render.

Implemented in Zeni::Video_DX9, Zeni::Video_GL_Fixed, and Zeni::Video_GL_Shader.

Referenced by engine_draw_frame(), and Zeni::Game::run().

virtual bool Zeni::Video::begin_render | ( |  | ) |

pure virtual

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

Implemented in Zeni::Video_DX9, Zeni::Video_GL_Fixed, and Zeni::Video_GL_Shader.

Referenced by engine_draw_frame(), and Zeni::Game::run().

std::pair< Point2i, Point2i > Zeni::Video::calculate_viewport | ( | const std::pair< Point2f, Point2f > & | camera2d,
|  | const std::pair< Point2i, Point2i > & | viewport,
|  | const bool & | fix_aspect_ratio
| ) |  |

Calculate the viewport.

Definition at line 242 of file Video.cpp.

Referenced by Zeni::Widget_Gamestate::perform_logic(), set_2d_view(), and set_viewport().

std::pair< Point2i, Point2i > Zeni::Video::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.

Definition at line 249 of file Video.cpp.

References int.

void Zeni::Video::change_resolution | ( | const Point2i & | resolution | ) |

static

Definition at line 366 of file Video.cpp.

References Zeni::Window::alert_window_resized(), Zeni::Singleton< Video >::destroy(), Zeni::get_File_Ops(), Zeni::Window::get_height(), Zeni::Window::get_width(), Zeni::get_Window(), preinit_from_file(), Zeni::Point2i::x, and Zeni::Point2i::y.

Referenced by Zeni::Gamestate_Base::on_video_resize().

virtual void Zeni::Video::clear_depth_buffer | ( |  | ) |

pure virtual

Can reset the depth buffer at any time if necessary.

Implemented in Zeni::Video_DX9, Zeni::Video_GL_Fixed, and Zeni::Video_GL_Shader.

Referenced by Zeni::Popup_State::render().

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

pure virtual

Clear the viewport.

Implemented in Zeni::Video_DX9, Zeni::Video_GL_Fixed, and Zeni::Video_GL_Shader.

String Zeni::Video::compile_glsles_shader | ( | const String & | filename,
|  | const ShHandle & | compiler
| ) |  |

protected

Compile an OpenGL ES shader to GLSL/HLSL.

Definition at line 304 of file Video.cpp.

References Zeni::String::c_str(), SH_OBJECT_CODE, SH_OBJECT_CODE_LENGTH, SH_VALIDATE, ShCompile(), ShGetInfo(), and ShGetObjectCode().

Referenced by Zeni::Video_GL_Shader::create_Fragment_Shader(), Zeni::Video_DX9::create_Fragment_Shader(), Zeni::Video_GL_Shader::create_Vertex_Shader(), and Zeni::Video_DX9::create_Vertex_Shader().

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

pure virtual

Function for creating a Font; used internally by Fonts.

Implemented in Zeni::Video_DX9, Zeni::Video_GL_Fixed, and Zeni::Video_GL_Shader.

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

pure virtual

Create a Fragment_Shader from a file.

Implemented in Zeni::Video_DX9, Zeni::Video_GL_Fixed, and Zeni::Video_GL_Shader.

virtual Program* Zeni::Video::create_Program | ( |  | ) |

pure virtual

Create a Program from a file.

Implemented in Zeni::Video_DX9, Zeni::Video_GL_Fixed, and Zeni::Video_GL_Shader.

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

pure virtual

Function for creating a Texture from an Image.

Implemented in Zeni::Video_DX9, Zeni::Video_GL_Fixed, and Zeni::Video_GL_Shader.

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

pure virtual

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

Implemented in Zeni::Video_DX9, Zeni::Video_GL_Fixed, and Zeni::Video_GL_Shader.

virtual Vertex_Buffer_Renderer* Zeni::Video::create_Vertex_Buffer_Renderer | ( | Vertex_Buffer & | vertex_buffer | ) |

pure virtual

Function for creating a Vertex_Buffer_Renderer.

Implemented in Zeni::Video_DX9, Zeni::Video_GL_Fixed, and Zeni::Video_GL_Shader.

Referenced by Zeni::Vertex_Buffer::render().

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

pure virtual

Create a Vertex_Shader from a file.

Implemented in Zeni::Video_DX9, Zeni::Video_GL_Fixed, and Zeni::Video_GL_Shader.

virtual void Zeni::Video::end_render | ( |  | ) |

pure virtual

Must be called after all rendering functions.

Implemented in Zeni::Video_DX9, Zeni::Video_GL_Fixed, and Zeni::Video_GL_Shader.

Referenced by engine_draw_frame(), and Zeni::Game::run().

Video::TEST Zeni::Video::get_alpha_test_function | ( |  | ) | const

inline

Determine which alpha test is in use.

Definition at line 73 of file Video.hxx.

Referenced by Zeni::Video_GL_Shader::init(), and Zeni::Video_DX9::init_context().

float Zeni::Video::get_alpha_test_value | ( |  | ) | const

inline

Determine what value the alpha test is comparing against.

Definition at line 77 of file Video.hxx.

Referenced by Zeni::Video_GL_Shader::init(), and Zeni::Video_DX9::init_context().

const Color & Zeni::Video::get_ambient_lighting | ( |  | ) |

inlinestatic

Get the current ambient lighting Color.

Definition at line 45 of file Video.hxx.

Referenced by Zeni::Video_GL_Shader::init(), and Zeni::Video_DX9::init_context().

bool Zeni::Video::get_backface_culling | ( |  | ) |

inlinestatic

Determine whether backface culling is enabled.

Definition at line 37 of file Video.hxx.

Referenced by Zeni::Video_GL_Shader::init(), Zeni::Video_DX9::init_context(), Zeni::Video_GL_Shader::set_2d_view(), and Zeni::Video_GL_Shader::set_3d_view().

const Color & Zeni::Video::get_clear_Color | ( |  | ) | const

inline

Get the blank background color.

Definition at line 114 of file Video.hxx.

Referenced by Zeni::Video_GL_Shader::begin_render(), Zeni::Video_DX9::begin_render(), Zeni::Video_GL_Shader::init(), Zeni::Video_DX9::init_context(), and Zeni::Widget_Gamestate::on_push().

const Color & Zeni::Video::get_Color | ( |  | ) | const

inline

Get the current color.

Definition at line 110 of file Video.hxx.

Referenced by Zeni::Video_GL_Shader::init(), Zeni::Video_DX9::init_context(), and Zeni::Font_FT::render_text().

const Fog * Zeni::Video::get_Fog | ( |  | ) | const

Get pointer to current Fog, or 0 if no Fog.

Definition at line 291 of file Video.cpp.

Referenced by Zeni::Video_GL_Shader::init(), and Zeni::Video_DX9::init_context().

ShHandle Zeni::Video::get_fragment_shader_compiler | ( |  | ) | const

inline

Get the fragment shader compiler.

Definition at line 89 of file Video.hxx.

References m_fragment_compiler.

const Light * Zeni::Video::get_Light | ( | const int & | number | ) | const

Get pointer to Light, or 0 if no such Light.

Definition at line 274 of file Video.cpp.

Referenced by Zeni::Video_GL_Shader::init(), and Zeni::Video_DX9::init_context().

bool Zeni::Video::get_lighting | ( |  | ) |

inlinestatic

Determine whether dynamic lighting is enabled.

Definition at line 41 of file Video.hxx.

Referenced by Zeni::Texture_DX9::apply_Texture(), Zeni::Video_GL_Shader::init(), Zeni::Video_DX9::init_context(), and Zeni::Material::set().

virtual int Zeni::Video::get_maximum_anisotropy | ( |  | ) | const

pure virtual

Get the current level of anisotrophy.

Implemented in Zeni::Video_DX9, Zeni::Video_GL_Fixed, and Zeni::Video_GL_Shader.

Referenced by Zeni::Textures::set_texturing_mode().

int Zeni::Video::get_multisampling | ( |  | ) |

inlinestatic

Get the current level of multisampling.

Definition at line 57 of file Video.hxx.

Referenced by Zeni::Video_GL_Shader::init(), Zeni::Video_DX9::init(), and Zeni::Video_DX9::init_context().

bool Zeni::Video::get_normal_interpolation | ( |  | ) |

inlinestatic

Determine whether normal interpolation is enabled.

Definition at line 49 of file Video.hxx.

virtual Point2f Zeni::Video::get_pixel_offset | ( |  | ) | const

pure virtual

Get the pixel offset in the 2d view.

Implemented in Zeni::Video_DX9, Zeni::Video_GL_Fixed, and Zeni::Video_GL_Shader.

Referenced by set_2d_view().

const Matrix4f & Zeni::Video::get_projection_matrix | ( |  | ) | const

inline

Get the projection Matrix4f.

Definition at line 131 of file Video.hxx.

virtual const Point2i& Zeni::Video::get_render_target_size | ( |  | ) | const

pure virtual

Get the dimensions of the render target.

Implemented in Zeni::Video_DX9, Zeni::Video_GL_Fixed, and Zeni::Video_GL_Shader.

Referenced by set_2d(), and set_3d().

ShHandle Zeni::Video::get_vertex_shader_compiler | ( |  | ) | const

inline

Get the vertex shader compiler.

Definition at line 85 of file Video.hxx.

References m_vertex_compiler.

bool Zeni::Video::get_vertical_sync | ( |  | ) |

inlinestatic

Determine whether vertical sync is enabled.

Definition at line 53 of file Video.hxx.

Referenced by Zeni::Video_GL_Shader::end_render(), Zeni::Video_GL_Shader::init(), Zeni::Video_DX9::init(), and Zeni::Window::Window().

Video::VIDEO_MODE Zeni::Video::get_video_mode | ( |  | ) |

inlinestatic

Get the currently selected video mode.

Definition at line 33 of file Video.hxx.

const Matrix4f & Zeni::Video::get_view_matrix | ( |  | ) | const

inline

Get the view Matrix4f.

Definition at line 127 of file Video.hxx.

const std::pair< Point2i, Point2i > & Zeni::Video::get_viewport | ( |  | ) | const

inline

Get the viewport.

Definition at line 135 of file Video.hxx.

Referenced by set_2d_view().

virtual bool Zeni::Video::has_vertex_buffers | ( |  | ) | const

pure virtual

Determine whether Vertex_Buffers are supported.

Implemented in Zeni::Video_DX9, Zeni::Video_GL_Fixed, and Zeni::Video_GL_Shader.

bool Zeni::Video::is_3d | ( |  | ) | const

inline

Determine whether currently rendering in 3D.

Definition at line 81 of file Video.hxx.

Referenced by Zeni::Video_DX9::set_fvf(), and Zeni::Video_GL_Shader::set_projection_matrix().

bool Zeni::Video::is_alpha_test_enabled | ( |  | ) | const

inline

Determine whether alpha testing is enabled.

Definition at line 69 of file Video.hxx.

Referenced by Zeni::Video_GL_Shader::init(), and Zeni::Video_DX9::init_context().

bool Zeni::Video::is_ztest_enabled | ( |  | ) | const

inline

Determine whether testing the Z-Buffer is enabled.

Definition at line 65 of file Video.hxx.

Referenced by Zeni::Video_GL_Shader::init(), and Zeni::Video_DX9::init_context().

bool Zeni::Video::is_zwrite_enabled | ( |  | ) | const

inline

Determine whether writing to Z-Buffer is enabled.

Definition at line 61 of file Video.hxx.

Referenced by Zeni::Video_GL_Shader::begin_render(), Zeni::Video_GL_Shader::clear_depth_buffer(), Zeni::Video_GL_Shader::init(), and Zeni::Video_DX9::init_context().

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

pure virtual

Function for loading a Texture; used internally by Textures.

Implemented in Zeni::Video_DX9, Zeni::Video_GL_Fixed, and Zeni::Video_GL_Shader.

virtual void Zeni::Video::pop_world_stack | ( |  | ) |

pure virtual

Pop a model view matrix off the stack.

Implemented in Zeni::Video_DX9, Zeni::Video_GL_Fixed, and Zeni::Video_GL_Shader.

Referenced by Zeni::Model::render(), Zeni::Widget::render(), and Zeni::Selector::render_impl().

void Zeni::Video::preinit_from_file | ( | const String & | filename | ) |

static

Set rendering options from a file.

Definition at line 336 of file Video.cpp.

References file.

Referenced by change_resolution(), and revert().

void Zeni::Video::preinit_from_file | ( | const XML_Document & | file | ) |

static

Set rendering options from a file.

Definition at line 341 of file Video.cpp.

References Zeni::Window::preinit_from_xml(), preinit_multisampling(), preinit_vertical_sync(), preinit_video_mode(), Zeni::XML_Element_c::to_string(), ZENI_VIDEO_ANY, ZENI_VIDEO_DX9, ZENI_VIDEO_GL_FIXED, and ZENI_VIDEO_GL_SHADER.

void Zeni::Video::preinit_multisampling | ( | const int & | multisampling = `0` | ) |

static

Set a multisampling value.

Definition at line 328 of file Video.cpp.

Referenced by Zeni::Video_DX9::init_device(), load_config(), and preinit_from_file().

void Zeni::Video::preinit_vertical_sync | ( | const bool & | vertical_sync = `false` | ) |

static

Set vertical_sync to true.

Definition at line 332 of file Video.cpp.

Referenced by load_config(), and preinit_from_file().

void Zeni::Video::preinit_video_mode | ( | const VIDEO_MODE & | vm = `ZENI_VIDEO_ANY` | ) |

static

Set which rendering engine to use.

Definition at line 324 of file Video.cpp.

Referenced by load_config(), and preinit_from_file().

void Zeni::Video::print_errors | ( |  | ) |

static

Print any errors that may have occurred.

Definition at line 529 of file Video.cpp.

References glGetError, and Zeni::gluErrorString().

Referenced by print_errors().

virtual void Zeni::Video::push_world_stack | ( |  | ) |

pure virtual

Push a model view matrix onto the stack.

Implemented in Zeni::Video_DX9, Zeni::Video_GL_Fixed, and Zeni::Video_GL_Shader.

Referenced by Zeni::Model::render(), Zeni::Widget::render(), and Zeni::Selector::render_impl().

virtual void Zeni::Video::render | ( | const Renderable & | renderable | ) |

pure virtual

Render a Renderable.

Implemented in Zeni::Video_DX9, Zeni::Video_GL_Fixed, and Zeni::Video_GL_Shader.

Referenced by Zeni::Vertex_Buffer::debug_render(), Zeni::Popup_State::render(), Zeni::render_image(), Zeni::Popup_Menu_State::Sound_Check_Box::render_impl(), Zeni::Text_Box::render_impl(), Zeni::Widget_Renderer_Color::render_to(), Zeni::Widget_Renderer_Texture::render_to(), Zeni::Widget_Renderer_Check_Box::render_to(), and Zeni::Widget_Renderer_Slider::render_to().

bool Zeni::Video::revert | ( |  | ) |

static

Restore previously saved options; Returns true if successful.

Definition at line 457 of file Video.cpp.

References Zeni::File_Ops::copy_file(), Zeni::File_Ops::delete_file(), Zeni::File_Ops::get_appdata_path(), Zeni::get_File_Ops(), Zeni::get_Video(), preinit_from_file(), save(), and set_failsafe_defaults().

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

pure virtual

Rotate the scene.

Implemented in Zeni::Video_DX9, Zeni::Video_GL_Fixed, and Zeni::Video_GL_Shader.

Referenced by Zeni::Model::render(), and rotate_scene().

void Zeni::Video::rotate_scene | ( | const Quaternion & | rotation | ) |

inline

Rotate the scene.

Definition at line 122 of file Video.hxx.

References Zeni::Quaternion::get_rotation(), and rotate_scene().

void Zeni::Video::save | ( | const bool & | backup = `true` | ) |

static

Save options.

Definition at line 389 of file Video.cpp.

References Zeni::File_Ops::copy_file(), Zeni::File_Ops::create_directory(), file, Zeni::Textures::get_anisotropic_filtering(), Zeni::File_Ops::get_appdata_path(), Zeni::Textures::get_bilinear_filtering(), Zeni::get_File_Ops(), Zeni::Window::get_height(), Zeni::Textures::get_mipmapping(), Zeni::Window::get_width(), Zeni::Window::is_full_screen(), Zeni::XML_Document::load(), Zeni::XML_Element::set_bool(), Zeni::XML_Element::set_int(), Zeni::XML_Element::set_string(), Zeni::XML_Document::try_load(), Zeni::XML_Document::try_save(), ZENI_VIDEO_DX9, ZENI_VIDEO_GL_FIXED, and ZENI_VIDEO_GL_SHADER.

Referenced by Zeni::Gamestate_Base::on_video_resize(), and revert().

virtual void Zeni::Video::scale_scene | ( | const Vector3f & | factor | ) |

pure virtual

Scale the scene.

Implemented in Zeni::Video_DX9, Zeni::Video_GL_Fixed, and Zeni::Video_GL_Shader.

Referenced by Zeni::Model::render().

virtual void Zeni::Video::select_world_matrix | ( |  | ) |

pure virtual

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

Implemented in Zeni::Video_DX9, Zeni::Video_GL_Fixed, and Zeni::Video_GL_Shader.

void Zeni::Video::set_2d | ( |  | ) |

inline

Set the default 2D view filling the entire display area.

Definition at line 93 of file Video.hxx.

References get_render_target_size(), set_2d_view(), Zeni::Point2i::x, and Zeni::Point2i::y.

Referenced by Zeni::Video_GL_Shader::init(), Zeni::Video_DX9::init_context(), Zeni::Widget_Gamestate::render(), Zeni::Popup_State::render(), and Zeni::Gamestate_Base::render().

void Zeni::Video::set_2d | ( | const std::pair< Point2f, Point2f > & | camera2d,
|  | const bool & | fix_aspect_ratio = `false`
| ) |  |

inline

Set a 2D view for the entire viewing area.

Definition at line 99 of file Video.hxx.

References get_render_target_size(), and set_2d_view().

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

pure virtual

Set a 2D view for a viewport.

Implemented in Zeni::Video_DX9, Zeni::Video_GL_Fixed, and Zeni::Video_GL_Shader.

Definition at line 153 of file Video.cpp.

References calculate_viewport(), get_pixel_offset(), get_viewport(), Zeni::Matrix4f::Identity(), Zeni::Matrix4f::Orthographic(), set_projection_matrix(), set_view_matrix(), set_viewport(), Zeni::Point2f::x, Zeni::Point2f::y, ZENI_2D_FAR, and ZENI_2D_NEAR.

Referenced by set_2d(), Zeni::Video_GL_Shader::set_2d_view(), and Zeni::Video_DX9::set_2d_view().

void Zeni::Video::set_3d | ( | const Camera & | camera | ) |

inline

Set a 3D view filling the entire display area.

Definition at line 105 of file Video.hxx.

References get_render_target_size(), and set_3d_view().

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

pure virtual

Set a 3D view for a viewport.

Implemented in Zeni::Video_DX9, Zeni::Video_GL_Fixed, and Zeni::Video_GL_Shader.

Definition at line 174 of file Video.cpp.

References Zeni::Camera::get_projection_matrix(), Zeni::Camera::get_view_matrix(), set_projection_matrix(), set_view_matrix(), and set_viewport().

Referenced by set_3d(), Zeni::Video_GL_Shader::set_3d_view(), and Zeni::Video_DX9::set_3d_view().

void Zeni::Video::set_alpha_test | ( | const bool & | enabled,
|  | const TEST & | test = `ZENI_ALWAYS`,
|  | const float & | value = `0.0f`
| ) |  |

pure virtual

Set the alpha test.

Implemented in Zeni::Video_DX9, Zeni::Video_GL_Fixed, and Zeni::Video_GL_Shader.

Definition at line 202 of file Video.cpp.

Referenced by Zeni::Video_GL_Shader::set_alpha_test(), and Zeni::Video_DX9::set_alpha_test().

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

pure virtual

Set ambient lighting on/off.

Implemented in Zeni::Video_DX9, Zeni::Video_GL_Fixed, and Zeni::Video_GL_Shader.

Definition at line 222 of file Video.cpp.

Referenced by Zeni::Video_GL_Shader::set_ambient_lighting(), and Zeni::Video_DX9::set_ambient_lighting().

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

pure virtual

Set backface culling on/off.

Implemented in Zeni::Video_DX9, Zeni::Video_GL_Fixed, and Zeni::Video_GL_Shader.

Definition at line 186 of file Video.cpp.

Referenced by Zeni::Video_GL_Shader::set_backface_culling(), and Zeni::Video_DX9::set_backface_culling().

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

pure virtual

Set the blank background color.

Implemented in Zeni::Video_DX9, Zeni::Video_GL_Fixed, and Zeni::Video_GL_Shader.

Definition at line 214 of file Video.cpp.

Referenced by Zeni::Widget_Gamestate::on_pop(), Zeni::Title_State< PLAY_STATE, INSTRUCTIONS_STATE >::perform_logic(), Zeni::Video_GL_Shader::set_clear_Color(), Zeni::Video_DX9::set_clear_Color(), Zeni::Title_State< PLAY_STATE, INSTRUCTIONS_STATE >::Title_State(), and Zeni::Title_State< PLAY_STATE, INSTRUCTIONS_STATE >::~Title_State().

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

pure virtual

Set the current color.

Implemented in Zeni::Video_DX9, Zeni::Video_GL_Fixed, and Zeni::Video_GL_Shader.

Definition at line 210 of file Video.cpp.

Referenced by Zeni::Font_FT::render_text(), Zeni::Video_GL_Shader::set_Color(), and Zeni::Video_DX9::set_Color().

void Zeni::Video::set_failsafe_defaults | ( |  | ) |

static

Set failsafe default options.

Definition at line 511 of file Video.cpp.

References Zeni::Window::set_failsafe_defaults(), Zeni::Textures::set_texturing_mode(), ZENI_VIDEO_ANY, ZENI_VIDEO_DX9, ZENI_VIDEO_GL_FIXED, and ZENI_VIDEO_GL_SHADER.

Referenced by revert().

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

pure virtual

Set Fog.

Implemented in Zeni::Video_DX9, Zeni::Video_GL_Fixed, and Zeni::Video_GL_Shader.

Definition at line 295 of file Video.cpp.

Referenced by Zeni::Video_GL_Shader::set_Fog(), and Zeni::Video_DX9::set_Fog().

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

pure virtual

Set a particular Light.

Implemented in Zeni::Video_DX9, Zeni::Video_GL_Fixed, and Zeni::Video_GL_Shader.

Definition at line 283 of file Video.cpp.

References light.

Referenced by Zeni::Video_GL_Shader::set_Light(), and Zeni::Video_DX9::set_Light().

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

pure virtual

Set lighting on/off.

Implemented in Zeni::Video_DX9, Zeni::Video_GL_Fixed, and Zeni::Video_GL_Shader.

Definition at line 218 of file Video.cpp.

Referenced by Zeni::Video_GL_Shader::set_lighting(), and Zeni::Video_DX9::set_lighting().

virtual void Zeni::Video::set_Material | ( | const Material & | material | ) |

pure virtual

Set a Material.

Implemented in Zeni::Video_DX9, Zeni::Video_GL_Fixed, and Zeni::Video_GL_Shader.

Referenced by Zeni::Renderable::pre_render(), and Zeni::render().

virtual void Zeni::Video::set_program | ( | Program & | program | ) |

pure virtual

Enable a program.

Implemented in Zeni::Video_DX9, Zeni::Video_GL_Fixed, and Zeni::Video_GL_Shader.

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

pure virtual

Set the projection Matrix4f.

Implemented in Zeni::Video_DX9, Zeni::Video_GL_Fixed, and Zeni::Video_GL_Shader.

Definition at line 230 of file Video.cpp.

Referenced by set_2d_view(), set_3d_view(), Zeni::Video_GL_Shader::set_projection_matrix(), and Zeni::Video_DX9::set_projection_matrix().

virtual void Zeni::Video::set_render_target | ( | Texture & | texture | ) |

pure virtual

Set a render target.

Implemented in Zeni::Video_DX9, Zeni::Video_GL_Fixed, and Zeni::Video_GL_Shader.

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

pure virtual

Set vertical_sync on/off.

Implemented in Zeni::Video_DX9, Zeni::Video_GL_Fixed, and Zeni::Video_GL_Shader.

Definition at line 190 of file Video.cpp.

Referenced by Zeni::Video_GL_Shader::set_vertical_sync(), and Zeni::Video_DX9::set_vertical_sync().

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

pure virtual

Set the view Matrix4f.

Implemented in Zeni::Video_DX9, Zeni::Video_GL_Fixed, and Zeni::Video_GL_Shader.

Definition at line 226 of file Video.cpp.

Referenced by set_2d_view(), set_3d_view(), Zeni::Video_GL_Shader::set_view_matrix(), and Zeni::Video_DX9::set_view_matrix().

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

pure virtual

Set the viewport.

Implemented in Zeni::Video_DX9, Zeni::Video_GL_Fixed, and Zeni::Video_GL_Shader.

Definition at line 234 of file Video.cpp.

Referenced by set_2d_view(), set_3d_view(), Zeni::Video_GL_Shader::set_viewport(), Zeni::Video_DX9::set_viewport(), and set_viewport().

void Zeni::Video::set_viewport | ( | const float & | aspect_ratio,
|  | const std::pair< Point2i, Point2i > & | viewport = `std::make_pair(Point2i(), get().get_render_target_size())`
| ) |  |

Set the viewport.

Definition at line 238 of file Video.cpp.

References calculate_viewport(), and set_viewport().

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

pure virtual

Enable or disable testing of the Z-Buffer.

Implemented in Zeni::Video_DX9, Zeni::Video_GL_Fixed, and Zeni::Video_GL_Shader.

Definition at line 198 of file Video.cpp.

Referenced by Zeni::Video_GL_Shader::set_ztest(), and Zeni::Video_DX9::set_ztest().

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

pure virtual

Enable or disable writing to the Z-Buffer.

Implemented in Zeni::Video_DX9, Zeni::Video_GL_Fixed, and Zeni::Video_GL_Shader.

Definition at line 194 of file Video.cpp.

Referenced by Zeni::Video_GL_Shader::set_zwrite(), and Zeni::Video_DX9::set_zwrite().

virtual void Zeni::Video::transform_scene | ( | const Matrix4f & | transformation | ) |

pure virtual

Transform the scene.

Implemented in Zeni::Video_DX9, Zeni::Video_GL_Fixed, and Zeni::Video_GL_Shader.

virtual void Zeni::Video::translate_scene | ( | const Vector3f & | direction | ) |

pure virtual

Translate the scene.

Implemented in Zeni::Video_DX9, Zeni::Video_GL_Fixed, and Zeni::Video_GL_Shader.

Referenced by Zeni::Model::render(), Zeni::Widget::render(), and Zeni::Selector::render_impl().

virtual void Zeni::Video::unapply_Texture | ( |  | ) |

pure virtual

Unapply a texture.

Implemented in Zeni::Video_DX9, Zeni::Video_GL_Fixed, and Zeni::Video_GL_Shader.

Referenced by Zeni::Font_FT::render_text().

void Zeni::Video::unset_Fog | ( |  | ) |

pure virtual

Unset Fog.

Implemented in Zeni::Video_DX9, Zeni::Video_GL_Fixed, and Zeni::Video_GL_Shader.

Definition at line 300 of file Video.cpp.

Referenced by Zeni::Video_GL_Shader::unset_Fog(), and Zeni::Video_DX9::unset_Fog().

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

pure virtual

Unset a particular Light.

Implemented in Zeni::Video_DX9, Zeni::Video_GL_Fixed, and Zeni::Video_GL_Shader.

Definition at line 287 of file Video.cpp.

Referenced by Zeni::Video_GL_Shader::unset_Light(), and Zeni::Video_DX9::unset_Light().

virtual void Zeni::Video::unset_Material | ( | const Material & | material | ) |

pure virtual

Unset a Material.

Implemented in Zeni::Video_DX9, Zeni::Video_GL_Fixed, and Zeni::Video_GL_Shader.

Referenced by Zeni::Renderable::post_render(), and Zeni::render().

virtual void Zeni::Video::unset_program | ( |  | ) |

pure virtual

Disable a program.

Implemented in Zeni::Video_DX9, Zeni::Video_GL_Fixed, and Zeni::Video_GL_Shader.

virtual void Zeni::Video::unset_render_target | ( |  | ) |

pure virtual

Unset a render target.

Implemented in Zeni::Video_DX9, Zeni::Video_GL_Fixed, and Zeni::Video_GL_Shader.

## Friends And Related Function Documentation

friend class Singleton< Video >

friend

Definition at line 72 of file Video.h.

## Member Data Documentation

ShHandle Zeni::Video::m_fragment_compiler

protected

Definition at line 244 of file Video.h.

Referenced by Zeni::Video_GL_Shader::create_Fragment_Shader(), Zeni::Video_DX9::create_Fragment_Shader(), Zeni::Video_DX9::destroy_device(), get_fragment_shader_compiler(), Zeni::Video_GL_Shader::init(), Zeni::Video_DX9::init_device(), and Zeni::Video_GL_Shader::uninit().

ShHandle Zeni::Video::m_vertex_compiler

protected

Definition at line 243 of file Video.h.

Referenced by Zeni::Video_GL_Shader::create_Vertex_Shader(), Zeni::Video_DX9::create_Vertex_Shader(), Zeni::Video_DX9::destroy_device(), get_vertex_shader_compiler(), Zeni::Video_GL_Shader::init(), Zeni::Video_DX9::init_device(), and Zeni::Video_GL_Shader::uninit().

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

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