zenilib  0.5.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Vertex_Buffer.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_VERTEX_BUFFER_HXX
19 #define ZENI_VERTEX_BUFFER_HXX
20 
21 #include <Zeni/Vertex_Buffer.h>
22 
23 namespace Zeni {
24 
25  void Vertex_Buffer::do_normal_alignment(const bool align_normals_) {
26  m_align_normals = align_normals_;
27  }
28 
30  return m_align_normals;
31  }
32 
33  size_t Vertex_Buffer::num_vertices_cm() const {
34  return 3u * m_triangles_cm.size();
35  }
36 
37  size_t Vertex_Buffer::num_vertices_t() const {
38  return 3u * m_triangles_t.size();
39  }
40 
41  void Vertex_Buffer::unprerender() {
42  lose();
43  m_descriptors_cm.clear();
44  m_descriptors_t.clear();
45  m_prerendered = false;
46  }
47 
48 #ifndef DISABLE_GL_FIXED
49 
50  size_t Vertex_Buffer_Renderer_GL_Fixed::vertex_size() const {
51  return 3u * sizeof(float);
52  }
53 
54  size_t Vertex_Buffer_Renderer_GL_Fixed::normal_size() const {
55  return 3u * sizeof(float);
56  }
57 
58  size_t Vertex_Buffer_Renderer_GL_Fixed::color_size() const {
59  return 4u * sizeof(unsigned char);
60  }
61 
62  size_t Vertex_Buffer_Renderer_GL_Fixed::texel_size() const {
63  return 2u * sizeof(float);
64  }
65 
66  bool Vertex_Buffer_Renderer_GL_Fixed::buffers_supported(Video_GL_Fixed &vgl) const {
67  return vgl.get_pglDeleteBuffersARB() != 0;
68  }
69 
70 #endif
71 #ifndef DISABLE_GL_SHADER
72 
73  size_t Vertex_Buffer_Renderer_GL_Shader::vertex_size() const {
74  return 3u * sizeof(float);
75  }
76 
77  size_t Vertex_Buffer_Renderer_GL_Shader::normal_size() const {
78  return 3u * sizeof(float);
79  }
80 
81  size_t Vertex_Buffer_Renderer_GL_Shader::color_size() const {
82  return 4u * sizeof(unsigned char);
83  }
84 
85  size_t Vertex_Buffer_Renderer_GL_Shader::texel_size() const {
86  return 2u * sizeof(float);
87  }
88 
89 #endif
90 #ifndef DISABLE_DX9
91 
92  size_t Vertex_Buffer_Renderer_DX9::vertex_c_size() const {
93  static Vertex3f_Color vert;
94  return sizeof(Vertex3f_Color) - vert.get_offset();
95  }
96 
97  size_t Vertex_Buffer_Renderer_DX9::vertex_t_size() const {
98  static Vertex3f_Texture vert;
99  return sizeof(Vertex3f_Texture) - vert.get_offset();
100  }
101 
102 #endif
103 
104 }
105 
106 #endif
void lose()
Lose the Vertex_Buffer.
bool will_do_normal_alignment() const
ALuint u
Definition: alMain.h:58
void do_normal_alignment(const bool align_normals_=true)