zenilib  0.5.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Video.hxx
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 #ifndef ZENI_VIDEO_HXX
19 #define ZENI_VIDEO_HXX
20 
21 // HXXed below
22 #include <Zeni/Camera.h>
23 #include <Zeni/Renderable.h>
24 #include <Zeni/Textures.h>
25 #include <Zeni/Quaternion.h>
26 
27 #include <Zeni/Video.h>
28 
29 #include <Zeni/Define.h>
30 
31 namespace Zeni {
32 
34  return g_video_mode;
35  }
36 
38  return g_backface_culling;
39  }
40 
42  return g_lighting;
43  }
44 
46  return g_ambient_lighting;
47  }
48 
50  return g_normal_interp;
51  }
52 
54  return g_vertical_sync;
55  }
56 
58  return g_multisampling;
59  }
60 
61  bool Video::is_zwrite_enabled() const {
62  return g_zwrite;
63  }
64 
65  bool Video::is_ztest_enabled() const {
66  return g_ztest;
67  }
68 
70  return m_alpha_test;
71  }
72 
74  return m_alpha_function;
75  }
76 
78  return m_alpha_value;
79  }
80 
81  bool Video::is_3d() const {
82  return m_3d;
83  }
84 
86  return m_vertex_compiler;
87  }
88 
90  return m_fragment_compiler;
91  }
92 
93  void Video::set_2d() {
95  set_2d_view(std::make_pair(Point2f(), Point2f(float(size.x), float(size.y))),
96  std::make_pair(Point2i(), size));
97  }
98 
99  void Video::set_2d(const std::pair<Point2f, Point2f> &camera2d, const bool &fix_aspect_ratio) {
100  set_2d_view(camera2d,
101  std::make_pair(Point2i(), get_render_target_size()),
102  fix_aspect_ratio);
103  }
104 
105  void Video::set_3d(const Camera &camera) {
106  set_3d_view(camera,
107  std::make_pair(Point2i(), get_render_target_size()));
108  }
109 
110  const Color & Video::get_Color() const {
111  return m_color;
112  }
113 
114  const Color & Video::get_clear_Color() const {
115  return g_clear_color;
116  }
117 
119  apply_Texture(get_Textures().get_id(name));
120  }
121 
122  void Video::rotate_scene(const Quaternion &rotation) {
123  const std::pair<Vector3f, float> rayngel = rotation.get_rotation();
124  rotate_scene(rayngel.first, rayngel.second);
125  }
126 
128  return m_view;
129  }
130 
132  return m_projection;
133  }
134 
135  const std::pair<Point2i, Point2i> & Video::get_viewport() const {
136  return m_viewport;
137  }
138 
139 }
140 
141 #include <Zeni/Undefine.h>
142 
143 #include <Zeni/Camera.hxx>
144 #include <Zeni/Renderable.hxx>
145 #include <Zeni/Textures.hxx>
146 #include <Zeni/Quaternion.hxx>
147 
148 #endif
const Color & get_clear_Color() const
Get the blank background color.
Definition: Video.hxx:114
const Matrix4f & get_projection_matrix() const
Get the projection Matrix4f.
Definition: Video.hxx:131
Camera / Point of View.
Definition: Camera.h:49
const std::pair< Point2i, Point2i > & get_viewport() const
Get the viewport.
Definition: Video.hxx:135
void * ShHandle
Definition: ShaderLang.h:255
static bool get_backface_culling()
Determine whether backface culling is enabled.
Definition: Video.hxx:37
static bool get_lighting()
Determine whether dynamic lighting is enabled.
Definition: Video.hxx:41
ShHandle get_fragment_shader_compiler() const
Get the fragment shader compiler.
Definition: Video.hxx:89
VIDEO_MODE
Definition: Video.h:96
virtual const Point2i & get_render_target_size() const =0
Get the dimensions of the render target.
EGLImageKHR EGLint * name
Definition: eglext.h:284
bool is_alpha_test_enabled() const
Determine whether alpha testing is enabled.
Definition: Video.hxx:69
TEST get_alpha_test_function() const
Determine which alpha test is in use.
Definition: Video.hxx:73
ShHandle m_vertex_compiler
Definition: Video.h:243
bool is_3d() const
Determine whether currently rendering in 3D.
Definition: Video.hxx:81
ShHandle get_vertex_shader_compiler() const
Get the vertex shader compiler.
Definition: Video.hxx:85
bool is_zwrite_enabled() const
Determine whether writing to Z-Buffer is enabled.
Definition: Video.hxx:61
static bool get_normal_interpolation()
Determine whether normal interpolation is enabled.
Definition: Video.hxx:49
void apply_Texture(const String &name)
Apply a texture by name.
Definition: Video.hxx:118
const Matrix4f & get_view_matrix() const
Get the view Matrix4f.
Definition: Video.hxx:127
void set_3d(const Camera &camera)
Set a 3D view filling the entire display area.
Definition: Video.hxx:105
std::pair< Vector3f, float > get_rotation() const
Get the rotation in radians left about an axis.
Definition: Quaternion.hxx:182
virtual void rotate_scene(const Vector3f &about, const float &radians)=0
Rotate the scene.
static const Color & get_ambient_lighting()
Get the current ambient lighting Color.
Definition: Video.hxx:45
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
void set_2d()
Set the default 2D view filling the entire display area.
Definition: Video.hxx:93
A Featureful Quaternion Class.
Definition: Quaternion.h:44
static int get_multisampling()
Get the current level of multisampling.
Definition: Video.hxx:57
static VIDEO_MODE get_video_mode()
Get the currently selected video mode.
Definition: Video.hxx:33
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
Textures & get_Textures()
Get access to the singleton.
Definition: Textures.cpp:64
static bool get_vertical_sync()
Determine whether vertical sync is enabled.
Definition: Video.hxx:53
bool is_ztest_enabled() const
Determine whether testing the Z-Buffer is enabled.
Definition: Video.hxx:65
const Color & get_Color() const
Get the current color.
Definition: Video.hxx:110
A Featureful 4-Space Matrix Class.
Definition: Matrix4f.h:47
ShHandle m_fragment_compiler
Definition: Video.h:244
A 2D Point represented with floats.
Definition: Coordinate.h:98
Color.
Definition: Color.h:41
float get_alpha_test_value() const
Determine what value the alpha test is comparing against.
Definition: Video.hxx:77
GLsizei size
Definition: gl2ext.h:1467
A 2D Point represented with integers.
Definition: Coordinate.h:85