Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Ripped out GLOO, now need to slowly start replacing bits and pieces w…

…ith Horde3D
  • Loading branch information...
commit 46b3d8a4b02e9e7b3725c3ee38ea7d5b521f354a 1 parent 0ffa40c
David Simon authored
4 cpp/app.cpp
@@ -22,7 +22,7 @@ along with Orbit Ribbon. If not, see http://www.gnu.org/licenses/
22 22
23 23 #include <Horde3D.h>
24 24 #include <Horde3DUtils.h>
25   -#include <GL/glew.h>
  25 +//#include <GL/glew.h>
26 26 #include <SDL/SDL.h>
27 27 #include <SDL/SDL_image.h>
28 28 #include <boost/array.hpp>
@@ -73,7 +73,7 @@ void App::frame_loop() {
73 73 unsigned int unsimulated_ticks = 0;
74 74
75 75 while (1) {
76   - GLint frame_start = SDL_GetTicks();
  76 + int frame_start = SDL_GetTicks();
77 77
78 78 // Fetch the latest state of the input devices
79 79 Input::update();
2  cpp/avatar.cpp
@@ -23,7 +23,7 @@ along with Orbit Ribbon. If not, see http://www.gnu.org/licenses/
23 23 #include <boost/lexical_cast.hpp>
24 24 #include <ode/ode.h>
25 25 #include <cmath>
26   -#include <GL/glew.h>
  26 +//#include <GL/glew.h>
27 27
28 28 #include "autoxsd/orepkgdesc.h"
29 29 #include "avatar.h"
4 cpp/background.cpp
@@ -23,13 +23,13 @@ along with Orbit Ribbon. If not, see http://www.gnu.org/licenses/
23 23 #include <cmath>
24 24 #include <boost/foreach.hpp>
25 25 #include <boost/random.hpp>
26   -#include <GL/glew.h>
  26 +//#include <GL/glew.h>
27 27
28 28 #include "autoxsd/orepkgdesc.h"
29 29 #include "background.h"
30 30 #include "except.h"
31 31 #include "geometry.h"
32   -#include "gloo.h"
  32 +
33 33 #include "mesh.h"
34 34
35 35 // Settings for the main star
4 cpp/background.h
@@ -31,15 +31,11 @@ along with Orbit Ribbon. If not, see http://www.gnu.org/licenses/
31 31 #include "geometry.h"
32 32
33 33 class MeshAnimation;
34   -class GLOOTexture;
35 34
36 35 class Background {
37 36 private:
38 37 boost::shared_ptr<ORE1::SkySettingsType> _sky;
39 38 boost::taus88 _random_gen;
40   - std::vector<boost::shared_ptr<GLOOTexture> > _starbox_faces;
41   - boost::shared_ptr<GLOOTexture> _star_tex;
42   - boost::shared_ptr<MeshAnimation> _distant_bubble;
43 39 Vector _sky_offset;
44 40
45 41 struct RandomStuffDensityRange {
2  cpp/bubble.cpp
@@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License
20 20 along with Orbit Ribbon. If not, see http://www.gnu.org/licenses/
21 21 */
22 22
23   -#include <GL/glew.h>
  23 +//#include <GL/glew.h>
24 24
25 25 #include "bubble.h"
26 26 #include "autoxsd/orepkgdesc.h"
10 cpp/display.cpp
@@ -23,7 +23,7 @@ along with Orbit Ribbon. If not, see http://www.gnu.org/licenses/
23 23 #include <boost/array.hpp>
24 24 #include <boost/foreach.hpp>
25 25 #include <boost/lexical_cast.hpp>
26   -#include <GL/glew.h>
  26 +//#include <GL/glew.h>
27 27 #include <SDL/SDL.h>
28 28 #include <SDL/SDL_image.h>
29 29
@@ -40,13 +40,13 @@ along with Orbit Ribbon. If not, see http://www.gnu.org/licenses/
40 40 #include "mode.h"
41 41 #include "mouse_cursor.h"
42 42 #include "performance.h"
43   -#include "gloo.h"
  43 +
44 44
45 45 SDL_Surface* screen;
46 46
47 47 int Display::screen_width = 0;
48 48 int Display::screen_height = 0;
49   -GLfloat Display::screen_ratio = 0;
  49 +float Display::screen_ratio = 0;
50 50 const SDL_VideoInfo* Display::vid_info = NULL;
51 51
52 52 const int SDL_VIDEO_FLAGS = SDL_OPENGL | SDL_GL_DOUBLEBUFFER;
@@ -209,7 +209,7 @@ void Display::init() {
209 209 // Quadratic value arrived at emperically, works OK but I don't think it's very realistic
210 210 float sprite_quadratic[] = { 0.0, 0.0, 0.0000015 };
211 211 glPointParameterfv(GL_POINT_DISTANCE_ATTENUATION, sprite_quadratic);
212   - GLfloat sprite_sizes[2];
  212 + float sprite_sizes[2];
213 213 glGetFloatv(GL_ALIASED_POINT_SIZE_RANGE, sprite_sizes);
214 214 glPointParameterf(GL_POINT_SIZE_MIN, sprite_sizes[0]);
215 215 glPointParameterf(GL_POINT_SIZE_MAX, sprite_sizes[1]);
@@ -231,7 +231,7 @@ void Display::init() {
231 231 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
232 232 glEnableClientState(GL_INDEX_ARRAY);
233 233
234   - screen_ratio = GLfloat(screen_width)/GLfloat(screen_height);
  234 + screen_ratio = float(screen_width)/float(screen_height);
235 235
236 236 glViewport(0, 0, screen_width, screen_height);
237 237 glMatrixMode(GL_PROJECTION);
4 cpp/display.h
@@ -24,7 +24,7 @@ along with Orbit Ribbon. If not, see http://www.gnu.org/licenses/
24 24 #define ORBIT_RIBBON_DISPLAY_H
25 25
26 26 #include <list>
27   -#include <GL/glew.h>
  27 +//#include <GL/glew.h>
28 28
29 29 #include "geometry.h"
30 30
@@ -51,7 +51,7 @@ struct SDL_VideoInfo;
51 51 class Display {
52 52 private:
53 53 static int screen_width, screen_height;
54   - static GLfloat screen_ratio;
  54 + static float screen_ratio;
55 55 static const SDL_VideoInfo* vid_info;
56 56
57 57 public:
6 cpp/font.cpp
@@ -28,7 +28,7 @@ along with Orbit Ribbon. If not, see http://www.gnu.org/licenses/
28 28
29 29 #include "except.h"
30 30 #include "font.h"
31   -#include "gloo.h"
  31 +
32 32
33 33 #include "autoxsd/fontdesc.h"
34 34 #include "autoxsd/fontdesc-pimpl.h"
@@ -101,8 +101,8 @@ void Font::draw(const Point& upper_left, float height, const std::string& str) {
101 101 std::pair<unsigned char, short> hy = get_glyph_height_and_y_offset(height);
102 102 std::map<char, std::pair<short, unsigned char> >& glyphmap = _glyph_data[hy.first];
103 103
104   - static GLfloat points[FONT_MAX_STR_LENGTH*8];
105   - static GLfloat uv_points[FONT_MAX_STR_LENGTH*8];
  104 + static float points[FONT_MAX_STR_LENGTH*8];
  105 + static float uv_points[FONT_MAX_STR_LENGTH*8];
106 106 float x = 0.0;
107 107 Size t = _tex->get_size();
108 108 unsigned int glyphs = 0;
3  cpp/font.h
@@ -26,12 +26,9 @@ along with Orbit Ribbon. If not, see http://www.gnu.org/licenses/
26 26 #include <map>
27 27
28 28 class Point;
29   -class GLOOTexture;
30 29
31 30 class Font {
32 31 private:
33   - boost::shared_ptr<GLOOTexture> _tex;
34   -
35 32 // Key is max glyph height, value maps input char to offset and width. Offset is -1 for no character (i.e. space)
36 33 std::map<unsigned char, std::map<char, std::pair<short, unsigned char> > > _glyph_data;
37 34
6 cpp/gameobj.cpp
@@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License
20 20 along with Orbit Ribbon. If not, see http://www.gnu.org/licenses/
21 21 */
22 22
23   -#include <GL/glew.h>
  23 +//#include <GL/glew.h>
24 24 #include <ode/ode.h>
25 25 #include <boost/array.hpp>
26 26 #include <boost/foreach.hpp>
@@ -35,7 +35,7 @@ along with Orbit Ribbon. If not, see http://www.gnu.org/licenses/
35 35 #include "gameobj.h"
36 36 #include "geometry.h"
37 37 #include "globals.h"
38   -#include "gloo.h"
  38 +
39 39
40 40 // Default coefficients for linear and angular damping on new GameObjs
41 41 const float DEFAULT_VEL_DAMP_COEF = 0.15;
@@ -166,7 +166,7 @@ void GameObj::step() {
166 166
167 167 // Apply damping
168 168 if (b != 0) {
169   - GLint i;
  169 + int i;
170 170 dReal x, y, z;
171 171 dVector3 v;
172 172
2  cpp/gameobj.h
@@ -23,7 +23,7 @@ along with Orbit Ribbon. If not, see http://www.gnu.org/licenses/
23 23 #ifndef ORBIT_RIBBON_GAMEOBJ_H
24 24 #define ORBIT_RIBBON_GAMEOBJ_H
25 25
26   -#include <GL/glew.h>
  26 +//#include <GL/glew.h>
27 27 #include <ode/ode.h>
28 28 #include <boost/array.hpp>
29 29 #include <boost/utility.hpp>
2  cpp/gameplay_mode.cpp
@@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License
20 20 along with Orbit Ribbon. If not, see http://www.gnu.org/licenses/
21 21 */
22 22
23   -#include <GL/glew.h>
  23 +//#include <GL/glew.h>
24 24 #include <boost/format.hpp>
25 25 #include <cmath>
26 26
5 cpp/gameplay_mode.h
@@ -24,7 +24,7 @@ along with Orbit Ribbon. If not, see http://www.gnu.org/licenses/
24 24 #define ORBIT_RIBBON_GAMEPLAY_MODE_H
25 25
26 26 #include "geometry.h"
27   -#include "gloo.h"
  27 +
28 28 #include "mode.h"
29 29 #include "mission_fsm.h"
30 30
@@ -35,7 +35,6 @@ class GameplayMode : public Mode {
35 35 MissionFSM _fsm;
36 36 std::string _avatar_key;
37 37 Point _condition_widget_cursor;
38   - GLOOCamera _camera;
39 38
40 39 public:
41 40 GameplayMode();
@@ -47,7 +46,7 @@ class GameplayMode : public Mode {
47 46
48 47 bool handle_input();
49 48
50   - const GLOOCamera* get_camera(bool top);
  49 + void set_camera(bool top);
51 50 void draw_3d_far(bool top);
52 51 void draw_3d_near(bool top);
53 52 void draw_2d(bool top);
36 cpp/geometry.cpp
@@ -19,7 +19,7 @@ You should have received a copy of the GNU General Public License
19 19 along with Orbit Ribbon. If not, see http://www.gnu.org/licenses/
20 20 */
21 21
22   -#include <GL/glew.h>
  22 +//#include <GL/glew.h>
23 23 #include <boost/format.hpp>
24 24 #include <cmath>
25 25 #include <string>
@@ -29,27 +29,27 @@ along with Orbit Ribbon. If not, see http://www.gnu.org/licenses/
29 29
30 30 const float SIMILARITY_DELTA = 0.0001;
31 31
32   -GLfloat rev2rad(GLfloat ang) {
  32 +float rev2rad(float ang) {
33 33 return 2.0*ang*M_PI;
34 34 }
35 35
36   -GLfloat rad2rev(GLfloat ang) {
  36 +float rad2rev(float ang) {
37 37 return ang/(M_PI*2.0);
38 38 }
39 39
40   -GLfloat rev2deg(GLfloat ang) {
  40 +float rev2deg(float ang) {
41 41 return 360.0*ang;
42 42 }
43 43
44   -GLfloat deg2rev(GLfloat ang) {
  44 +float deg2rev(float ang) {
45 45 return ang/360.0;
46 46 }
47 47
48   -GLfloat rad2deg(GLfloat ang) {
  48 +float rad2deg(float ang) {
49 49 return (360.0*ang)/(M_PI*2);
50 50 }
51 51
52   -GLfloat deg2rad(GLfloat ang) {
  52 +float deg2rad(float ang) {
53 53 return (ang/360.0)*2*M_PI;
54 54 }
55 55
@@ -102,7 +102,7 @@ Point Point::operator*(const Point& other) const {
102 102 return Point(x*other.x, y*other.y, z*other.z);
103 103 }
104 104
105   -Point Point::operator*(GLfloat f) const {
  105 +Point Point::operator*(float f) const {
106 106 return Point(x*f, y*f, z*f);
107 107 }
108 108
@@ -112,7 +112,7 @@ void Point::operator*=(const Point& other) {
112 112 z *= other.z;
113 113 }
114 114
115   -void Point::operator*=(GLfloat f) {
  115 +void Point::operator*=(float f) {
116 116 x *= f;
117 117 y *= f;
118 118 z *= f;
@@ -122,7 +122,7 @@ Point Point::operator/(const Point& other) const {
122 122 return Point(x/other.x, y/other.y, z/other.z);
123 123 }
124 124
125   -Point Point::operator/(GLfloat f) const {
  125 +Point Point::operator/(float f) const {
126 126 return Point(x/f, y/f, z/f);
127 127 }
128 128
@@ -132,7 +132,7 @@ void Point::operator/=(const Point& other) {
132 132 z /= other.z;
133 133 }
134 134
135   -void Point::operator/=(GLfloat f) {
  135 +void Point::operator/=(float f) {
136 136 x /= f;
137 137 y /= f;
138 138 z /= f;
@@ -154,11 +154,11 @@ bool Point::near_to(const Point& other) const {
154 154 );
155 155 }
156 156
157   -GLfloat Point::mag() const {
  157 +float Point::mag() const {
158 158 return std::sqrt(pow(std::sqrt(x*x + y*y), 2) + z*z);
159 159 }
160 160
161   -GLfloat Point::dot_prod(const Point& other) const {
  161 +float Point::dot_prod(const Point& other) const {
162 162 return x*other.x + y*other.y + z*other.z;
163 163 }
164 164
@@ -170,20 +170,20 @@ Point Point::cross_prod(const Point& other) const {
170 170 );
171 171 }
172 172
173   -GLfloat Point::dist_to(const Point& other) const {
  173 +float Point::dist_to(const Point& other) const {
174 174 return std::sqrt(sq_dist_to(other));
175 175 }
176 176
177   -GLfloat Point::sq_dist_to(const Point& other) const {
  177 +float Point::sq_dist_to(const Point& other) const {
178 178 return (x-other.x)*(x-other.x) + (y-other.y)*(y-other.y) + (z-other.z)*(z-other.z);
179 179 }
180 180
181   -GLfloat Point::ang_to(const Point& other) const {
  181 +float Point::ang_to(const Point& other) const {
182 182 return rad2rev(std::acos((dot_prod(other))/(mag()*other.mag())));
183 183 }
184 184
185 185 Point Point::to_length(float len) const {
186   - GLfloat old_len = mag();
  186 + float old_len = mag();
187 187 if (old_len != 0.0) {
188 188 return (*this) * (len/old_len);
189 189 } else {
@@ -201,7 +201,7 @@ Point Point::project_onto(const Plane& p) const {
201 201 return *this - (n*dist);
202 202 }
203 203
204   -Plane::Plane(GLfloat na, GLfloat nb, GLfloat nc, GLfloat nd) :
  204 +Plane::Plane(float na, float nb, float nc, float nd) :
205 205 a(na), b(nb), c(nc), d(nd)
206 206 {}
207 207
2  cpp/globals.cpp
@@ -25,7 +25,7 @@ along with Orbit Ribbon. If not, see http://www.gnu.org/licenses/
25 25 #include "font.h"
26 26 #include "gameobj.h"
27 27 #include "globals.h"
28   -#include "gloo.h"
  28 +
29 29 #include "mode.h"
30 30 #include "ore.h"
31 31 #include "mouse_cursor.h"
2  cpp/globals.h
@@ -40,9 +40,7 @@ along with Orbit Ribbon. If not, see http://www.gnu.org/licenses/
40 40 class Background;
41 41 class GameObj;
42 42 class Mode;
43   -class GLOOFont;
44 43 class Font;
45   -class GLOOTexture;
46 44 class OrePackage;
47 45 class MouseCursor;
48 46
464 cpp/gloo.cpp
... ... @@ -1,464 +0,0 @@
1   -/*
2   -gloo.cpp: Implementation of GL Object-Oriented utility classes.
3   -
4   -Copyright 2011 David Simon <david.mike.simon@gmail.com>
5   -
6   -This file is part of Orbit Ribbon.
7   -
8   -Orbit Ribbon is free software: you can redistribute it and/or modify
9   -it under the terms of the GNU General Public License as published by
10   -the Free Software Foundation, either version 3 of the License, or
11   -(at your option) any later version.
12   -
13   -Orbit Ribbon is distributed in the hope that it will be awesome,
14   -but WITHOUT ANY WARRANTY; without even the implied warranty of
15   -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16   -GNU General Public License for more details.
17   -
18   -You should have received a copy of the GNU General Public License
19   -along with Orbit Ribbon. If not, see http://www.gnu.org/licenses/
20   -*/
21   -
22   -#include <memory>
23   -#include <list>
24   -#include <string>
25   -#include <sstream>
26   -#include <GL/glew.h>
27   -#include <boost/format.hpp>
28   -#include <boost/lexical_cast.hpp>
29   -#include <boost/shared_ptr.hpp>
30   -#include <SDL/SDL.h>
31   -#include <SDL/SDL_image.h>
32   -#include <ode/ode.h>
33   -
34   -#include "cache.h"
35   -#include "constants.h"
36   -#include "except.h"
37   -#include "geometry.h"
38   -#include "globals.h"
39   -#include "gloo.h"
40   -#include "ore.h"
41   -#include "sim.h"
42   -
43   -#include "debug.h"
44   -
45   -// How many kilobytes should be allocated for the vertices buffer and faces buffer respectively
46   -const int VERTICES_BUFFER_ALLOCATED_SIZE = 4096;
47   -const int FACES_BUFFER_ALLOCATED_SIZE = 2048;
48   -
49   -GLOOPushedMatrix::GLOOPushedMatrix() {
50   - glPushMatrix();
51   -}
52   -
53   -GLOOPushedMatrix::~GLOOPushedMatrix() {
54   - glPopMatrix();
55   -}
56   -
57   -struct SDLSurf {
58   - SDL_Surface* s;
59   - SDLSurf(SDL_Surface* i) : s(i) {
60   - if (!i) throw GameException(std::string("Error while loading texture surface: ") + SDL_GetError());
61   - SDL_LockSurface(s);
62   - }
63   - ~SDLSurf() { SDL_UnlockSurface(s); SDL_FreeSurface(s); }
64   - SDL_Surface* operator->() { return s; }
65   - SDL_Surface& operator*() { return *s; }
66   -};
67   -
68   -boost::shared_ptr<GLOOTexture> GLOOTexture::TextureCache::generate(const std::string& id) {
69   - try {
70   - // Create an SDL surface from the requested ORE image file
71   - boost::shared_ptr<OreFileData> fd = Globals::ore->get_data(std::string("image-") + id);
72   - SDL_RWops* rwops = fd->get_const_sdl_rwops();
73   - return boost::shared_ptr<GLOOTexture>(new GLOOTexture(rwops));
74   - } catch (const std::exception& e) {
75   - throw GameException("Unable to load texture " + id + " : " + e.what());
76   - }
77   -}
78   -
79   -GLOOTexture::TextureCache GLOOTexture::_cache;
80   -
81   -void GLOOTexture::throw_pixel_format_exception(const SDL_PixelFormat* format) {
82   - throw GameException(
83   - std::string("Unknown pixel format :") +
84   - " BPP " + boost::lexical_cast<std::string>((unsigned int)format->BitsPerPixel) +
85   - " Rs " + boost::lexical_cast<std::string>((unsigned int)format->Rshift) +
86   - " Gs " + boost::lexical_cast<std::string>((unsigned int)format->Gshift) +
87   - " Bs " + boost::lexical_cast<std::string>((unsigned int)format->Bshift) +
88   - " As " + boost::lexical_cast<std::string>((unsigned int)format->Ashift)
89   - );
90   -}
91   -
92   -GLOOTexture::GLOOTexture(SDL_RWops* rwops, bool alpha_tex) {
93   - SDLSurf surf(IMG_Load_RW(rwops, 0)); //SDLSurf takes care of locking surface now and later unlocking/freeing it
94   - GLenum tgt_format, src_format;
95   -
96   - if (surf->format->BitsPerPixel == 8) {
97   - _mipmapped = false;
98   - if (alpha_tex) {
99   - tgt_format = GL_COMPRESSED_ALPHA;
100   - src_format = GL_ALPHA;
101   - } else {
102   - tgt_format = GL_COMPRESSED_LUMINANCE;
103   - src_format = GL_LUMINANCE;
104   - }
105   - } else if (surf->format->BitsPerPixel >= 24) {
106   - _mipmapped = true;
107   - tgt_format = GL_COMPRESSED_RGB;
108   - if (alpha_tex) {
109   - throw GameException("Cannot use multi-channel texture as alpha texture");
110   - }
111   - if (surf->format->Bshift == 0 && surf->format->Gshift == 8 && surf->format->Rshift == 16) {
112   - src_format = GL_BGR;
113   - } else if (surf->format->Rshift == 0 && surf->format->Gshift == 8 && surf->format->Bshift == 16) {
114   - src_format = GL_RGB;
115   - } else {
116   - throw_pixel_format_exception(surf->format);
117   - }
118   - if (surf->format->Ashift) {
119   - tgt_format = GL_COMPRESSED_RGBA;
120   - src_format = (src_format == GL_RGB ? GL_RGBA : GL_BGRA);
121   - }
122   - } else {
123   - throw_pixel_format_exception(surf->format);
124   - }
125   -
126   - _width = surf->w;
127   - _height = surf->h;
128   - glGenTextures(1, &(_tex_name));
129   - glBindTexture(GL_TEXTURE_2D, _tex_name);
130   - glTexImage2D(GL_TEXTURE_2D, 0, tgt_format, surf->w, surf->h, 0, src_format, GL_UNSIGNED_BYTE, surf->pixels);
131   - if (_mipmapped) {
132   - glGenerateMipmap(GL_TEXTURE_2D);
133   - }
134   - if (glGetError()) {
135   - throw GameException("GL error while loading texture");
136   - }
137   -}
138   -
139   -boost::shared_ptr<GLOOTexture> GLOOTexture::load(const std::string& name) {
140   - return _cache.get(name);
141   -}
142   -
143   -void GLOOTexture::bind() {
144   - glBindTexture(GL_TEXTURE_2D, _tex_name);
145   - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, _mipmapped ? GL_NEAREST_MIPMAP_LINEAR : GL_LINEAR);
146   -}
147   -
148   -void GLOOTexture::draw_2d(const Point& pos) {
149   - const static GLfloat uv_points[8] = {
150   - 0.0, 1.0,
151   - 1.0, 1.0,
152   - 1.0, 0.0,
153   - 0.0, 0.0
154   - };
155   -
156   - GLfloat points[8] = {
157   - pos.x, pos.y + _height,
158   - pos.x + _width, pos.y + _height,
159   - pos.x + _width, pos.y,
160   - pos.x, pos.y
161   - };
162   -
163   - bind();
164   -
165   - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
166   - glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT);
167   - glBindBuffer(GL_ARRAY_BUFFER, 0);
168   - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
169   - glDisableClientState(GL_NORMAL_ARRAY);
170   - glVertexPointer(2, GL_FLOAT, 0, points);
171   - glTexCoordPointer(2, GL_FLOAT, 0, uv_points);
172   - glDrawArrays(GL_QUADS, 0, 8);
173   - glPopClientAttrib();
174   - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
175   -}
176   -
177   -GLOOTexture::~GLOOTexture() {
178   - glDeleteTextures(1, &_tex_name);
179   -}
180   -
181   -void GLOOVertex::set_gl_vbo_pointers() {
182   - const char* offset = 0;
183   - glVertexPointer(3, GL_FLOAT, sizeof(GLOOVertex), offset);
184   - glNormalPointer(GL_FLOAT, sizeof(GLOOVertex), offset + 3*sizeof(float));
185   - glClientActiveTexture(GL_TEXTURE0);
186   - glTexCoordPointer(2, GL_FLOAT, sizeof(GLOOVertex), offset + 6*sizeof(float));
187   -}
188   -
189   -_VBOManager::Allocation::Allocation(unsigned int bytes, _VBOManager* man) :
190   - _man(man)
191   -{
192   - AllocRange rng;
193   - rng.bytes = bytes;
194   - rng.offset = 0;
195   - if (!_man->_ranges.empty()) {
196   - rng.offset = _man->_ranges.back().offset + _man->_ranges.back().bytes;
197   - }
198   - if (rng.offset + rng.bytes > _man->_max_bytes) {
199   - throw OreException("Ran out of space while attempting allocation within VBO!");
200   - }
201   - _man->_ranges.push_back(rng);
202   - _iter = _man->_ranges.end();
203   - --_iter;
204   -}
205   -
206   -void* _VBOManager::Allocation::map() {
207   - if (_man->_mapped) {
208   - throw OreException("Attempted to map memory within already-mapped VBO");
209   - } else {
210   - _man->_mapped = true;
211   - return glMapBufferRange(_man->_tgt, offset(), bytes(), GL_MAP_WRITE_BIT);
212   - }
213   -}
214   -
215   -void _VBOManager::Allocation::unmap() {
216   - if (_man->_mapped) {
217   - GLenum result = glUnmapBuffer(_man->_tgt);
218   - if (result == GL_FALSE) {
219   - throw OreException("Memory corruption during VBO unmap");
220   - }
221   - _man->_mapped = false;
222   - }
223   -}
224   -
225   -_VBOManager::Allocation::~Allocation() {
226   - unmap();
227   - _man->_ranges.erase(_iter);
228   -}
229   -
230   -_VBOManager::_VBOManager(GLenum tgt, unsigned int max_bytes) :
231   - _tgt(tgt),
232   - _max_bytes(max_bytes),
233   - _mapped(false)
234   -{
235   - glGenBuffers(1, &_buf_id);
236   - glBindBuffer(tgt, _buf_id);
237   - glBufferData(tgt, max_bytes, NULL, GL_STATIC_DRAW);
238   -}
239   -
240   -_VBOManager::~_VBOManager() {
241   - glBindBuffer(_tgt, 0);
242   - glDeleteBuffers(1, &_buf_id);
243   -}
244   -
245   -float _VBOManager::get_usage() const {
246   - float used = 0.0;
247   - if (!_ranges.empty()) {
248   - used = float(_ranges.back().offset + _ranges.back().bytes);
249   - }
250   - return used/float(_max_bytes);
251   -}
252   -
253   -bool GLOOBufferedMesh::_initialized = false;
254   -boost::scoped_ptr<_VBOManager> GLOOBufferedMesh::_vertices_vboman, GLOOBufferedMesh::_faces_vboman;
255   -std::map<dTriMeshDataID, const GLOOBufferedMesh*> GLOOBufferedMesh::_trimesh_id_map;
256   -
257   -const GLOOBufferedMesh* GLOOBufferedMesh::get_mesh_from_geom(dGeomID g) {
258   - if (dGeomGetClass(g) != dTriMeshClass) {
259   - return 0;
260   - }
261   -
262   - dTriMeshDataID d = dGeomTriMeshGetData(g);
263   - std::map<dTriMeshDataID, const GLOOBufferedMesh*>::iterator i = _trimesh_id_map.find(d);
264   - if (i == _trimesh_id_map.end()) {
265   - return 0;
266   - } else {
267   - return i->second;
268   - }
269   -}
270   -
271   -GLOOBufferedMesh::GLOOBufferedMesh(unsigned int vertex_count, unsigned int face_count, boost::shared_ptr<GLOOTexture> tex, bool gen_trimesh_data) :
272   - _trimesh_id(0),
273   - _tex(tex),
274   - _vertices_added(0),
275   - _total_vertices(vertex_count),
276   - _faces_added(0),
277   - _total_faces(face_count)
278   -{
279   - if (!_initialized) {
280   - _vertices_vboman.reset(new _VBOManager(GL_ARRAY_BUFFER, VERTICES_BUFFER_ALLOCATED_SIZE*1024));
281   - _faces_vboman.reset(new _VBOManager(GL_ELEMENT_ARRAY_BUFFER, FACES_BUFFER_ALLOCATED_SIZE*1024));
282   - GLOOVertex::set_gl_vbo_pointers();
283   - _initialized = true;
284   - }
285   -
286   - if (gen_trimesh_data) {
287   - _trimesh_vertices.reserve(3*vertex_count);
288   - _trimesh_normals.reserve(3*vertex_count);
289   - _trimesh_indices.reserve(3*face_count);
290   - }
291   -
292   - _vertices_alloc = _vertices_vboman->allocate(_total_vertices*sizeof(GLOOVertex));
293   - _next_vertex = (GLOOVertex*)_vertices_alloc->map();
294   -
295   - _faces_alloc = _faces_vboman->allocate(_total_faces*sizeof(GLOOFace));
296   - _next_face = (GLOOFace*)_faces_alloc->map();
297   -}
298   -
299   -void GLOOBufferedMesh::deinit() {
300   - if (_initialized) {
301   - _vertices_vboman.reset();
302   - _faces_vboman.reset();
303   - _initialized = false;
304   - }
305   -}
306   -
307   -void GLOOBufferedMesh::load_vertex(const GLOOVertex& v) {
308   - if (_vertices_added >= _total_vertices) {
309   - throw OreException("Attempted to load more vertices than space was allocated for");
310   - }
311   - if (!_next_vertex) {
312   - throw OreException("Attempted to load a vertex while unmapped");
313   - }
314   - if (_trimesh_vertices.capacity() > 0) {
315   - _trimesh_vertices.push_back(v.x);
316   - _trimesh_vertices.push_back(v.y);
317   - _trimesh_vertices.push_back(v.z);
318   - _trimesh_normals.push_back(v.nx);
319   - _trimesh_normals.push_back(v.ny);
320   - _trimesh_normals.push_back(v.nz);
321   - }
322   - *_next_vertex = v;
323   - ++_next_vertex;
324   - ++_vertices_added;
325   -}
326   -
327   -void GLOOBufferedMesh::load_face(const GLOOFace& f) {
328   - if (_faces_added >= _total_faces) {
329   - throw OreException("Attempted to load more faces than space was allocated for");
330   - }
331   - if (!_next_face) {
332   - throw OreException("Attempted to load a face while unmapped");
333   - }
334   - if (_trimesh_indices.capacity() > 0) {
335   - _trimesh_indices.push_back(f.a);
336   - _trimesh_indices.push_back(f.b);
337   - _trimesh_indices.push_back(f.c);
338   - }
339   - unsigned int vtx_offset = (_vertices_alloc->offset()/sizeof(GLOOVertex));
340   - _next_face->a = f.a + vtx_offset;
341   - _next_face->b = f.b + vtx_offset;
342   - _next_face->c = f.c + vtx_offset;
343   - ++_next_face;
344   - ++_faces_added;
345   -}
346   -
347   -void GLOOBufferedMesh::finish_loading() {
348   - if (_next_vertex == 0 && _next_face == 0) {
349   - return;
350   - }
351   -
352   - if (_vertices_added != _total_vertices) {
353   - throw OreException((boost::format("Allocated space for %1% vertices, but only loaded %2%") % _total_vertices % _vertices_added).str());
354   - }
355   -
356   - if (_faces_added != _total_faces) {
357   - throw OreException((boost::format("Allocated space for %1% faces, but only loaded %2%") % _total_faces % _faces_added).str());
358   - }
359   -
360   - if (_trimesh_vertices.capacity() > 0) {
361   - _trimesh_id = dGeomTriMeshDataCreate();
362   - dGeomTriMeshDataBuildDouble1(_trimesh_id,
363   - &*(_trimesh_vertices.begin()), 3*sizeof(dReal), _total_vertices,
364   - &*(_trimesh_indices.begin()), _total_faces*3, 3*sizeof(unsigned int),
365   - &*(_trimesh_normals.begin()));
366   - _trimesh_id_map[_trimesh_id] = this;
367   - }
368   -
369   - _vertices_alloc->unmap();
370   - _next_vertex = 0;
371   - _faces_alloc->unmap();
372   - _next_face = 0;
373   -}
374   -
375   -void GLOOBufferedMesh::draw() {
376   - if (_vertices_vboman->mapped() or _faces_vboman->mapped()) {
377   - throw OreException("Attempted to draw GLOOBufferedMesh while still mapped");
378   - }
379   -
380   - if (_tex) {
381   - _tex->bind();
382   - } else {
383   - glDisable(GL_TEXTURE_2D);
384   - }
385   -
386   - glDrawRangeElements(
387   - GL_TRIANGLES,
388   - (_vertices_alloc->offset())/sizeof(GLOOVertex),
389   - (_vertices_alloc->offset() + _vertices_alloc->bytes())/sizeof(GLOOVertex),
390   - _faces_alloc->bytes()/GLOOFace::elem_bytes(),
391   - GLOOFace::gl_type(),
392   - (const char*)(0) + _faces_alloc->offset()
393   - );
394   -
395   - if (!_tex) {
396   - glEnable(GL_TEXTURE_2D);
397   - }
398   -}
399   -
400   -dTriMeshDataID GLOOBufferedMesh::get_trimesh_data() const {
401   - if (_vertices_vboman->mapped() or _faces_vboman->mapped()) {
402   - throw OreException("Attempted to get trimesh data from GLOOBufferedMesh while still mapped");
403   - }
404   - return _trimesh_id;
405   -}
406   -
407   -Point GLOOBufferedMesh::get_vertex_pos(unsigned int v_idx) const {
408   - return Point(
409   - _trimesh_vertices[v_idx*3],
410   - _trimesh_vertices[v_idx*3 + 1],
411   - _trimesh_vertices[v_idx*3 + 2]
412   - );
413   -}
414   -
415   -Vector GLOOBufferedMesh::get_vertex_norm(unsigned int v_idx) const {
416   - return Vector(
417   - _trimesh_normals[v_idx*3],
418   - _trimesh_normals[v_idx*3 + 1],
419   - _trimesh_normals[v_idx*3 + 2]
420   - );
421   -}
422   -
423   -GLOOFace GLOOBufferedMesh::get_face(unsigned int f_idx) const {
424   - return GLOOFace(
425   - _trimesh_indices[f_idx*3],
426   - _trimesh_indices[f_idx*3 + 1],
427   - _trimesh_indices[f_idx*3 + 2]
428   - );
429   -}
430   -
431   -Vector GLOOBufferedMesh::get_interpolated_normal(dGeomID g, const Point& p, unsigned int f_idx) const {
432   - GLOOFace face = get_face(f_idx);
433   - Vector normals[3] = { get_vertex_norm(face.a), get_vertex_norm(face.b), get_vertex_norm(face.c) };
434   - Vector b = get_barycentric(OdeGeomUtil::get_pos_rel_point(g, p), get_vertex_pos(face.a), get_vertex_pos(face.b), get_vertex_pos(face.c));
435   - return OdeGeomUtil::vector_to_world(g, normals[0]*b[0] + normals[1]*b[1] + normals[2]*b[2]);
436   -}
437   -
438   -GLOOBufferedMesh::~GLOOBufferedMesh() {
439   - if (_trimesh_id != 0) {
440   - _trimesh_id_map.erase(_trimesh_id);
441   - dGeomTriMeshDataDestroy(_trimesh_id);
442   - }
443   - finish_loading();
444   -}
445   -
446   -void GLOOCamera::setup() const {
447   - gluLookAt(
448   - pos.x, pos.y, pos.z,
449   - tgt.x, tgt.y, tgt.z,
450   - up.x, up.y, up.z
451   - );
452   -}
453   -
454   -void GLOOCamera::operator*=(float n) {
455   - pos *= n;
456   - tgt *= n;
457   - up *= n;
458   -}
459   -
460   -void GLOOCamera::operator+=(const GLOOCamera& other) {
461   - pos += other.pos;
462   - tgt += other.tgt;
463   - up += other.up;
464   -}
216 cpp/gloo.h
... ... @@ -1,216 +0,0 @@
1   -/*
2   -gloo.h: Header for GL Object-Oriented utility classes.
3   -
4   -Copyright 2011 David Simon <david.mike.simon@gmail.com>
5   -
6   -This file is part of Orbit Ribbon.
7   -
8   -Orbit Ribbon is free software: you can redistribute it and/or modify
9   -it under the terms of the GNU General Public License as published by
10   -the Free Software Foundation, either version 3 of the License, or
11   -(at your option) any later version.
12   -
13   -Orbit Ribbon is distributed in the hope that it will be awesome,
14   -but WITHOUT ANY WARRANTY; without even the implied warranty of
15   -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16   -GNU General Public License for more details.
17   -
18   -You should have received a copy of the GNU General Public License
19   -along with Orbit Ribbon. If not, see http://www.gnu.org/licenses/
20   -*/
21   -
22   -#ifndef ORBIT_RIBBON_GLOO_H
23   -#define ORBIT_RIBBON_GLOO_H
24   -
25   -#include <boost/format.hpp>
26   -#include <boost/shared_ptr.hpp>
27   -#include <boost/scoped_ptr.hpp>
28   -#include <boost/utility.hpp>
29   -#include <string>
30   -#include <list>
31   -#include <vector>
32   -#include <map>
33   -#include <SDL/SDL.h>
34   -#include <GL/glew.h>
35   -#include <ode/ode.h>
36   -
37   -#include "cache.h"
38   -#include "geometry.h"
39   -
40   -class GameObj;
41   -
42   -class GLOOPushedMatrix : boost::noncopyable {
43   - public:
44   - GLOOPushedMatrix();
45   - ~GLOOPushedMatrix();
46   -};
47   -
48   -class GLOOTexture;
49   -
50   -class GLOOTexture : boost::noncopyable {
51   - private:
52   - GLuint _tex_name;
53   - int _width, _height;
54   - bool _mipmapped;
55   -
56   - class TextureCache : public CacheBase<GLOOTexture> {
57   - boost::shared_ptr<GLOOTexture> generate(const std::string& id);
58   - };
59   -
60   - friend class TextureCache;
61   - static TextureCache _cache;
62   -
63   - void throw_pixel_format_exception(const SDL_PixelFormat* format);
64   -
65   - public:
66   - GLOOTexture(SDL_RWops* rwops, bool alpha_tex = false);
67   -
68   - static boost::shared_ptr<GLOOTexture> load(const std::string& name);
69   - static void deinit() { _cache.clear(); }
70   -
71   - int get_width() const { return _width; }
72   - int get_height() const { return _height; }
73   - Size get_size() const { return Size(_width, _height); }
74   - bool is_mipmapped() const { return _mipmapped; }
75   -
76   - void bind();
77   - void draw_2d(const Point& pos);
78   -
79   - virtual ~GLOOTexture();
80   -};
81   -
82   -struct GLOOVertex {
83   - GLfloat x, y, z;
84   - GLfloat nx, ny, nz;
85   - GLfloat u, v;
86   -
87   - static void set_gl_vbo_pointers();
88   -};
89   -
90   -struct GLOOFace {
91   - // Indices to the vertices forming a triangle face
92   - GLuint a, b, c;
93   -
94   - GLOOFace() {}
95   - GLOOFace(GLuint ia, GLuint ib, GLuint ic) : a(ia), b(ib), c(ic) {}
96   -
97   - static GLenum gl_type() { return GL_UNSIGNED_INT; }
98   - static unsigned int elem_bytes() { return sizeof(GLuint); }
99   -};
100   -
101   -class _VBOManager;
102   -class _VBOManager : boost::noncopyable {
103   - private:
104   - struct AllocRange {
105   - unsigned int offset, bytes;
106   - };
107   -
108   - GLenum _tgt;
109   - GLuint _buf_id;
110   - unsigned int _max_bytes;
111   - bool _mapped;
112   - std::list<AllocRange> _ranges;
113   -
114   - public:
115   - class Allocation;
116   - friend class Allocation;
117   - class Allocation : boost::noncopyable {
118   - private:
119   - std::list<AllocRange>::iterator _iter;
120   - _VBOManager* _man;
121   -
122   - Allocation(unsigned int length, _VBOManager* man);
123   -
124   - friend class _VBOManager;
125   -
126   - public:
127   - unsigned int offset() { return _iter->offset; }
128   - unsigned int bytes() { return _iter->bytes; }
129   - void* map();
130   - void unmap();
131   -
132   - ~Allocation();
133   - };
134   -
135   - _VBOManager(GLenum tgt, unsigned int max_bytes);
136   - ~_VBOManager();
137   -
138   - boost::shared_ptr<Allocation> allocate(unsigned int bytes)
139   - { return boost::shared_ptr<Allocation>(new Allocation(bytes, this)); }
140   -
141   - float get_usage() const;
142   -
143   - bool mapped() const { return _mapped; }
144   -};
145   -
146   -class GLOOBufferedMesh;
147   -class GLOOBufferedMesh : boost::noncopyable {
148   - private:
149   - static bool _initialized;
150   - static boost::scoped_ptr<_VBOManager> _vertices_vboman, _faces_vboman;
151   - static std::map<dTriMeshDataID, const GLOOBufferedMesh*> _trimesh_id_map;
152   -
153   - std::vector<dReal> _trimesh_vertices;
154   - std::vector<dReal> _trimesh_normals;
155   - std::vector<unsigned int> _trimesh_indices;
156   - dTriMeshDataID _trimesh_id;
157   -
158   - boost::shared_ptr<GLOOTexture> _tex;
159   - boost::shared_ptr<_VBOManager::Allocation> _vertices_alloc, _faces_alloc;
160   - unsigned int _vertices_added, _total_vertices, _faces_added, _total_faces;
161   - GLOOVertex* _next_vertex;
162   - GLOOFace* _next_face;
163   -
164   - GLOOBufferedMesh(unsigned int vertex_count, unsigned int face_count, boost::shared_ptr<GLOOTexture> tex, bool gen_trimesh_data);
165   -
166   - public:
167   - static void deinit();
168   -
169   - static boost::shared_ptr<GLOOBufferedMesh> create(unsigned int vertex_count, unsigned int face_count, boost::shared_ptr<GLOOTexture> tex, bool gen_trimesh_data)
170   - { return boost::shared_ptr<GLOOBufferedMesh>(new GLOOBufferedMesh(vertex_count, face_count, tex, gen_trimesh_data)); }
171   -
172   - static float get_vertices_usage() { return _vertices_vboman ? _vertices_vboman->get_usage() : 0.0; }
173   - static float get_faces_usage() { return _faces_vboman ? _faces_vboman->get_usage() : 0.0; }
174   - static std::string get_usage_info() {
175   - return (boost::format("VBO:%.2f%% IBO:%.2f%%") % (get_vertices_usage()*100) % (get_faces_usage()*100)).str();
176   - }
177   -
178   - static const GLOOBufferedMesh* get_mesh_from_geom(dGeomID g);
179   -
180   - // These functions can only be called before the finish_loading() method is called
181   - void load_vertex(const GLOOVertex& v);
182   - void load_face(const GLOOFace& f);
183   -
184   - // Once you're done calling the load_* methods, call this method to make the Mesh ready to draw
185   - void finish_loading();
186   -
187   - // Call this method to draw the mesh, after finish_loading() has been called
188   - void draw();
189   -
190   - // Call this method after finish_loading() has been called, and only if you specified true for gen_trimesh_data
191   - dTriMeshDataID get_trimesh_data() const;
192   -
193   - // You can only call these if gen_trimesh_data had been activated
194   - Point get_vertex_pos(unsigned int v_idx) const;
195   - Vector get_vertex_norm(unsigned int v_idx) const;
196   - GLOOFace get_face(unsigned int f_idx) const ;
197   - Vector get_interpolated_normal(dGeomID g, const Point& p, unsigned int f_idx) const;
198   -
199   - virtual ~GLOOBufferedMesh();
200   -};
201   -
202   -struct GLOOCamera {
203   - Point pos;
204   - Point tgt;
205   - Vector up;
206   -
207   - GLOOCamera() : up(0, 1, 0) {}
208   - GLOOCamera(const Point& p, const Point& t, const Vector& u) : pos(p), tgt(t), up(u) {}
209   -
210   - void setup() const;
211   -
212   - void operator*=(float n);
213   - void operator+=(const GLOOCamera& other);
214   -};
215   -
216   -#endif
12 cpp/gui.cpp
@@ -30,7 +30,7 @@ along with Orbit Ribbon. If not, see http://www.gnu.org/licenses/
30 30 #include "input.h"
31 31 #include "font.h"
32 32 #include "globals.h"
33   -#include "gloo.h"
  33 +
34 34 #include "mouse_cursor.h"
35 35
36 36 namespace GUI {
@@ -42,7 +42,7 @@ static const float CHECKED_COLOR[4] = { 0.2, 0.6, 0.0, 1.0 };
42 42 static const float INNER_CHECKED_COLOR[4] = { 0.4, 0.9, 0.1, 1.0 };
43 43
44 44 void draw_diamond_box(const Box& box, float r, float g, float b, float a) {
45   - GLfloat points[12] = {
  45 + float points[12] = {
46 46 box.top_left.x + DIAMOND_BOX_BORDER.x/2, box.top_left.y,
47 47 box.top_left.x, box.top_left.y + box.size.y/2,
48 48 box.top_left.x + DIAMOND_BOX_BORDER.x/2, box.top_left.y + box.size.y,
@@ -79,7 +79,7 @@ void draw_diamond_box(const Box& box, const float* color) {
79 79 }
80 80
81 81 void draw_box(const Box& box, float r, float g, float b, float a) {
82   - GLfloat points[8] = {
  82 + float points[8] = {
83 83 box.top_left.x, box.top_left.y,
84 84 box.top_left.x, box.top_left.y+box.size.y,
85 85 box.top_left.x+box.size.x, box.top_left.y+box.size.y,
@@ -181,7 +181,7 @@ void Slider::draw(const Box& box) {
181 181 gauge_dbox_area.size.x = gauge_dbox_area.size.y*5;
182 182 draw_diamond_box(gauge_dbox_area, focused() ? FOCUSED_COLOR : PASSIVE_COLOR);
183 183
184   - GLfloat gauge_points[10] = {
  184 + float gauge_points[10] = {
185 185 gauge_area.top_left.x, gauge_area.top_left.y + gauge_area.size.y, // Point 0 : Left tip of triangle
186 186 gauge_area.top_left.x + _value*gauge_area.size.x, gauge_area.top_left.y + gauge_area.size.y, // Point 1 : Bottom of gauge line
187 187 gauge_area.top_left.x + _value*gauge_area.size.x, gauge_area.top_left.y + (1-_value)*gauge_area.size.y, // Point 2 : Top of gauge line
@@ -199,7 +199,7 @@ void Slider::draw(const Box& box) {
199 199 glVertexPointer(2, GL_FLOAT, 0, gauge_points);
200 200
201 201 const static GLushort triangle_indices[3] = { 0, 1, 2 };
202   - GLfloat triangle_colors[9] = {
  202 + float triangle_colors[9] = {
203 203 0.5, 0.5, 0.5, // Color 0 : Left tip of triangle
204 204 0.3, 0.3+(0.6*_value), 0.3, // Color 1 : Bottom of gauge line
205 205 0.3, 0.3+(0.6*_value), 0.3 // Color 2 : Top of gauge line
@@ -208,7 +208,7 @@ void Slider::draw(const Box& box) {
208 208 glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_SHORT, triangle_indices);
209 209
210 210 const static GLushort quad_indices[4] = { 4, 3, 2, 1 };
211   - GLfloat quad_colors[15] = { // TODO: Maybe make this area a pretty gradient too
  211 + float quad_colors[15] = { // TODO: Maybe make this area a pretty gradient too
212 212 0.0, 0.0, 0.0,
213 213 0.1, 0.1, 0.1,
214 214 0.1, 0.1, 0.1,
2  cpp/gui.h
@@ -28,7 +28,7 @@ along with Orbit Ribbon. If not, see http://www.gnu.org/licenses/
28 28 #include <list>
29 29
30 30 #include "geometry.h"
31   -#include "gloo.h"
  31 +
32 32
33 33 namespace GUI {
34 34 const Vector DIAMOND_BOX_BORDER(8, 2); // A diamond box's contents are drawn this number of pixels from the left/right and top/bottom of the box respectively
7 cpp/interp_mode.h
@@ -26,14 +26,13 @@ along with Orbit Ribbon. If not, see http://www.gnu.org/licenses/
26 26 #include <boost/shared_ptr.hpp>
27 27 #include <SDL/SDL.h>
28 28
  29 +#include "geometry.h"
29 30 #include "globals.h"
30   -#include "gloo.h"
31 31 #include "mode.h"
32 32
33 33 template <template <typename> class InterpFunctor> class InterpolationMode : public Mode {
34 34 private:
35   - GLOOCamera _camera;
36   - InterpFunctor<GLOOCamera> _camera_interpolator;
  35 + InterpFunctor<Vector> _camera_interpolator;
37 36 boost::shared_ptr<Mode> _src, _tgt;
38 37 unsigned int _ms, _start;
39 38 bool _started, _reverse;
@@ -41,7 +40,7 @@ template <template <typename> class InterpFunctor> class InterpolationMode : pub
41 40 public:
42 41 InterpolationMode(unsigned int ms, const boost::shared_ptr<Mode>& tgt) : _tgt(tgt), _ms(ms), _started(false), _reverse(false) {}
43 42
44   - const GLOOCamera* get_camera(bool top __attribute__ ((unused))) {
  43 + void set_camera(bool top __attribute__ ((unused))) {
45 44 if (!_started) {
46 45 _started = true;
47 46 _start = SDL_GetTicks();
16 cpp/mesh.cpp
@@ -30,7 +30,7 @@ along with Orbit Ribbon. If not, see http://www.gnu.org/licenses/
30 30 #include "cache.h"
31 31 #include "debug.h"
32 32 #include "globals.h"
33   -#include "gloo.h"
  33 +
34 34 #include "mesh.h"
35 35 #include "ore.h"
36 36 #include "sim.h"
@@ -155,19 +155,19 @@ class _VertexParser : public OREAnim1::VertexType_pskel {
155 155 GLOOVertex _vert;
156 156
157 157 public:
158   - void p(boost::array<GLfloat,3>* pos) {
  158 + void p(boost::array<float,3>* pos) {
159 159 _vert.x = pos->at(0);
160 160 _vert.y = pos->at(1);
161 161 _vert.z = pos->at(2);
162 162 }
163 163