SuperTuxKart
shared_gpu_objects.hpp
1 // SuperTuxKart - a fun racing game with go-kart
2 // Copyright (C) 2014-2015 SuperTuxKart-Team
3 //
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 3
7 // of the License, or (at your option) any later version.
8 //
9 // This program 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 General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 
18 #ifndef HEADER_SHARED_GPU_OBJECTS_HPP
19 #define HEADER_SHARED_GPU_OBJECTS_HPP
20 
21 #include "graphics/gl_headers.hpp"
22 
23 #include <assert.h>
24 
26 {
27 private:
28  static bool m_has_been_initialised;
29  static GLuint m_sky_tri_vbo;
30  static GLuint m_frustrum_vbo;
31  static GLuint m_frustrum_indices;
32  static GLuint m_View_projection_matrices_ubo;
33  static GLuint m_lighting_data_ubo;
34  static GLuint m_full_screen_quad_vao;
35  static GLuint m_ui_vao;
36  static GLuint m_quad_buffer;
37  static GLuint m_quad_vbo;
38 
39  static void initQuadVBO();
40  static void initQuadBuffer();
41  static void initSkyTriVBO();
42  static void initFrustrumVBO();
43  static void initShadowVPMUBO();
44  static void initLightingDataUBO();
45 
46 public:
47  static void init();
48  static void reset();
49  // ------------------------------------------------------------------------
50  static GLuint getSkyTriVBO()
51  {
52  assert(m_has_been_initialised);
53  return m_sky_tri_vbo;
54  } // getSkyTriVBO
55  // ------------------------------------------------------------------------
56  static GLuint getFrustrumVBO()
57  {
58  assert(m_has_been_initialised);
59  return m_frustrum_vbo;
60  } // getFrustrumVBO
61  // ------------------------------------------------------------------------
62  static GLuint getFrustrumIndices()
63  {
64  assert(m_has_been_initialised);
65  return m_frustrum_indices;
66  } // getFrustrumIndices
67  // ------------------------------------------------------------------------
68  static GLuint getViewProjectionMatricesUBO()
69  {
70  assert(m_has_been_initialised);
71  return m_View_projection_matrices_ubo;
72  } // getViewProjectionMatricesUBO
73  // ------------------------------------------------------------------------
74  static GLuint getLightingDataUBO()
75  {
76  assert(m_has_been_initialised);
77  return m_lighting_data_ubo;
78  } // getLightingDataUBO
79  // -------------- ----------------------------------------------------------
80  static GLuint getFullScreenQuadVAO()
81  {
82  assert(m_has_been_initialised);
83  return m_full_screen_quad_vao;
84  } // getFullScreenQuadVAO
85  // ------------------------------------------------------------------------
86  static GLuint getUI_VAO()
87  {
88  assert(m_has_been_initialised);
89  return m_ui_vao;
90  } // getUI_VAO
91  // ------------------------------------------------------------------------
92  static GLuint getQuadBuffer()
93  {
94  assert(m_has_been_initialised);
95  return m_quad_buffer;
96  } // getQuadBuffer
97  // ------------------------------------------------------------------------
98  static GLuint getQuadVBO()
99  {
100  assert(m_has_been_initialised);
101  return m_quad_vbo;
102  } // getQuadVBO
103 
104 }; // class SharedGPUObjects
105 
106 
107 #endif
Definition: shared_gpu_objects.hpp:26
static void initQuadVBO()
Initialises m_full_screen_quad_vbo.
Definition: shared_gpu_objects.cpp:40
static void reset()
A simple reset function.
Definition: shared_gpu_objects.cpp:181