zenilib: zenilib/jni/external/zenilib/zeni_graphics/Zeni/Vertex2f.h 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
Vertex2f.h
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
42 #ifndef ZENI_VERTEX2F_H
43 #define ZENI_VERTEX2F_H
44
45 #include <Zeni/Color.h>
46 #include <Zeni/Coordinate.h>
47 #include <Zeni/Line_Segment.h>
48 #include <Zeni/Quadrilateral.h>
49 #include <Zeni/Renderable.h>
50 #include <Zeni/String.h>
51 #include <Zeni/Triangle.h>
52
53 namespace Zeni {
54
55 class ZENI_GRAPHICS_DLL Vertex2f {
56 protected:
57 Vertex2f();
58 Vertex2f(const Point2f &position);
59 public:
60 virtual ~Vertex2f();
61
62 virtual Point3f get_position() const;
63
64 inline void * get_address() const;
65 #if defined(_WINDOWS) && defined(X64)
66 inline unsigned long long get_offset() const;
67 #else
68 inline unsigned long get_offset() const;
69 #endif
70
71 private:
72 #ifdef X64
73 float m_alignment_rubbish;
74 #endif
75
76 public:
77 Point3f position;
78 };
79
80 class ZENI_GRAPHICS_DLL Vertex2f_Color : public Renderable, public Vertex2f {
81 public:
83 Vertex2f_Color();
84 Vertex2f_Color(const Point2f &position, const Color &color);
85 Vertex2f_Color(const Point2f &position, const Uint32 &argb);
86
87 Vertex2f_Color * interpolate_to(const float &rhs_part, const Vertex2f_Color &rhs) const;
88
89 inline const Uint32 & get_Color() const;
90 inline void set_Color(const Color &color);
91 inline void set_Color(const Uint32 &argb);
92
93 // Begin rendering functions
94
95 virtual bool is_3d() const;
96
97 #ifndef DISABLE_GL_FIXED
98 virtual void render_to(Video_GL_Fixed &screen) const;
99 virtual void subrender_to(Video_GL_Fixed &screen) const;
100 #endif
101
102 #ifndef DISABLE_GL_Shader
103 virtual void render_to(Video_GL_Shader &screen) const;
104 virtual void subrender_to(Video_GL_Shader &screen) const;
105 #endif
106
107 #ifndef DISABLE_DX9
108 virtual void render_to(Video_DX9 &screen) const;
109 #endif
110
111 private:
112 Uint32 m_argb;
113 };
114
115 class ZENI_GRAPHICS_DLL Vertex2f_Texture : public Renderable, public Vertex2f {
116 public:
118 Vertex2f_Texture();
119 Vertex2f_Texture(const Point2f &position, const Point2f &texture_coordinate);
120
121 Vertex2f_Texture * interpolate_to(const float &rhs_part, const Vertex2f_Texture &rhs) const;
122
123 // Begin rendering functions
124
125 virtual bool is_3d() const;
126
127 // NOTE: Not really meaningful to render a textured point in isolation;
128 // assert(false) for all but subrender_to(Video_GL &)
129
130 #ifndef DISABLE_GL_FIXED
131 virtual void render_to(Video_GL_Fixed &screen) const;
132 virtual void subrender_to(Video_GL_Fixed &screen) const;
133 #endif
134
135 #ifndef DISABLE_GL_Shader
136 virtual void render_to(Video_GL_Shader &screen) const;
137 virtual void subrender_to(Video_GL_Shader &screen) const;
138 #endif
139
140 #ifndef DISABLE_DX9
141 virtual void render_to(Video_DX9 &screen) const;
142 #endif
143
144 Point2f texture_coordinate;
145 };
146
147 #ifdef _WINDOWS
148 ZENI_GRAPHICS_EXT template class ZENI_GRAPHICS_DLL Line_Segment<Vertex2f_Color>;
149 ZENI_GRAPHICS_EXT template class ZENI_GRAPHICS_DLL Line_Segment<Vertex2f_Texture>;
150 ZENI_GRAPHICS_EXT template class ZENI_GRAPHICS_DLL Quadrilateral<Vertex2f_Color>;
151 ZENI_GRAPHICS_EXT template class ZENI_GRAPHICS_DLL Quadrilateral<Vertex2f_Texture>;
152 ZENI_GRAPHICS_EXT template class ZENI_GRAPHICS_DLL Triangle<Vertex2f_Color>;
153 ZENI_GRAPHICS_EXT template class ZENI_GRAPHICS_DLL Triangle<Vertex2f_Texture>;
154 #endif
155
156 }
157
158 #endif
Zeni::Video_DX9
The Direct3D9 Rendering System.
Definition: Video_DX9.h:62
color
GLuint color
Definition: glew.h:7185
Zeni::Line_Segment
An Abstraction of a Line.
Definition: Line_Segment.h:36
Zeni::Vertex2f_Color
An Abstraction of a Vertex in 2-space, colored.
Definition: Vertex2f.h:80
Zeni::Vertex2f::position
Point3f position
Definition: Vertex2f.h:77
Zeni::Quadrilateral
An Abstraction of a Quadrilateral.
Definition: Quadrilateral.h:37
Zeni::Renderable
A Renderable Interface.
Definition: Renderable.h:47
Renderable.h
Zeni::Point3f
A 3D Point represented with floats.
Definition: Coordinate.h:133
Uint32
uint32_t Uint32
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:145
Coordinate.h
Zeni::Video_GL_Fixed
The OpenGL Rendering System.
Definition: Video_GL_Fixed.h:70
Quadrilateral.h
Triangle.h
Zeni::Video_GL_Shader
The OpenGL Rendering System.
Definition: Video_GL_Shader.h:70
Zeni::Vertex2f
Definition: Vertex2f.h:55
Zeni::Vertex2f_Texture
An Abstraction of a Vertex in 2-space, textured.
Definition: Vertex2f.h:115
String.h
Zeni::Triangle
An Abstraction of a Triangle.
Definition: Triangle.h:36
Color.h
Zeni::Point2f
A 2D Point represented with floats.
Definition: Coordinate.h:98
Zeni::Vertex2f_Texture::texture_coordinate
Point2f texture_coordinate
Definition: Vertex2f.h:144
Zeni::Color
Color.
Definition: Color.h:41
Line_Segment.h