Skip to content

Commit

Permalink
Ripped out GLOO, now need to slowly start replacing bits and pieces w…
Browse files Browse the repository at this point in the history
…ith Horde3D
  • Loading branch information
DavidMikeSimon committed Aug 21, 2011
1 parent 0ffa40c commit 46b3d8a
Show file tree
Hide file tree
Showing 29 changed files with 68 additions and 801 deletions.
4 changes: 2 additions & 2 deletions cpp/app.cpp
Expand Up @@ -22,7 +22,7 @@ along with Orbit Ribbon. If not, see http://www.gnu.org/licenses/


#include <Horde3D.h> #include <Horde3D.h>
#include <Horde3DUtils.h> #include <Horde3DUtils.h>
#include <GL/glew.h> //#include <GL/glew.h>
#include <SDL/SDL.h> #include <SDL/SDL.h>
#include <SDL/SDL_image.h> #include <SDL/SDL_image.h>
#include <boost/array.hpp> #include <boost/array.hpp>
Expand Down Expand Up @@ -73,7 +73,7 @@ void App::frame_loop() {
unsigned int unsimulated_ticks = 0; unsigned int unsimulated_ticks = 0;


while (1) { while (1) {
GLint frame_start = SDL_GetTicks(); int frame_start = SDL_GetTicks();


// Fetch the latest state of the input devices // Fetch the latest state of the input devices
Input::update(); Input::update();
Expand Down
2 changes: 1 addition & 1 deletion cpp/avatar.cpp
Expand Up @@ -23,7 +23,7 @@ along with Orbit Ribbon. If not, see http://www.gnu.org/licenses/
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
#include <ode/ode.h> #include <ode/ode.h>
#include <cmath> #include <cmath>
#include <GL/glew.h> //#include <GL/glew.h>


#include "autoxsd/orepkgdesc.h" #include "autoxsd/orepkgdesc.h"
#include "avatar.h" #include "avatar.h"
Expand Down
4 changes: 2 additions & 2 deletions cpp/background.cpp
Expand Up @@ -23,13 +23,13 @@ along with Orbit Ribbon. If not, see http://www.gnu.org/licenses/
#include <cmath> #include <cmath>
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
#include <boost/random.hpp> #include <boost/random.hpp>
#include <GL/glew.h> //#include <GL/glew.h>


#include "autoxsd/orepkgdesc.h" #include "autoxsd/orepkgdesc.h"
#include "background.h" #include "background.h"
#include "except.h" #include "except.h"
#include "geometry.h" #include "geometry.h"
#include "gloo.h"
#include "mesh.h" #include "mesh.h"


// Settings for the main star // Settings for the main star
Expand Down
4 changes: 0 additions & 4 deletions cpp/background.h
Expand Up @@ -31,15 +31,11 @@ along with Orbit Ribbon. If not, see http://www.gnu.org/licenses/
#include "geometry.h" #include "geometry.h"


class MeshAnimation; class MeshAnimation;
class GLOOTexture;


class Background { class Background {
private: private:
boost::shared_ptr<ORE1::SkySettingsType> _sky; boost::shared_ptr<ORE1::SkySettingsType> _sky;
boost::taus88 _random_gen; boost::taus88 _random_gen;
std::vector<boost::shared_ptr<GLOOTexture> > _starbox_faces;
boost::shared_ptr<GLOOTexture> _star_tex;
boost::shared_ptr<MeshAnimation> _distant_bubble;
Vector _sky_offset; Vector _sky_offset;


struct RandomStuffDensityRange { struct RandomStuffDensityRange {
Expand Down
2 changes: 1 addition & 1 deletion cpp/bubble.cpp
Expand Up @@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License
along with Orbit Ribbon. If not, see http://www.gnu.org/licenses/ along with Orbit Ribbon. If not, see http://www.gnu.org/licenses/
*/ */


#include <GL/glew.h> //#include <GL/glew.h>


#include "bubble.h" #include "bubble.h"
#include "autoxsd/orepkgdesc.h" #include "autoxsd/orepkgdesc.h"
Expand Down
10 changes: 5 additions & 5 deletions cpp/display.cpp
Expand Up @@ -23,7 +23,7 @@ along with Orbit Ribbon. If not, see http://www.gnu.org/licenses/
#include <boost/array.hpp> #include <boost/array.hpp>
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
#include <GL/glew.h> //#include <GL/glew.h>
#include <SDL/SDL.h> #include <SDL/SDL.h>
#include <SDL/SDL_image.h> #include <SDL/SDL_image.h>


Expand All @@ -40,13 +40,13 @@ along with Orbit Ribbon. If not, see http://www.gnu.org/licenses/
#include "mode.h" #include "mode.h"
#include "mouse_cursor.h" #include "mouse_cursor.h"
#include "performance.h" #include "performance.h"
#include "gloo.h"


SDL_Surface* screen; SDL_Surface* screen;


int Display::screen_width = 0; int Display::screen_width = 0;
int Display::screen_height = 0; int Display::screen_height = 0;
GLfloat Display::screen_ratio = 0; float Display::screen_ratio = 0;
const SDL_VideoInfo* Display::vid_info = NULL; const SDL_VideoInfo* Display::vid_info = NULL;


const int SDL_VIDEO_FLAGS = SDL_OPENGL | SDL_GL_DOUBLEBUFFER; const int SDL_VIDEO_FLAGS = SDL_OPENGL | SDL_GL_DOUBLEBUFFER;
Expand Down Expand Up @@ -209,7 +209,7 @@ void Display::init() {
// Quadratic value arrived at emperically, works OK but I don't think it's very realistic // Quadratic value arrived at emperically, works OK but I don't think it's very realistic
float sprite_quadratic[] = { 0.0, 0.0, 0.0000015 }; float sprite_quadratic[] = { 0.0, 0.0, 0.0000015 };
glPointParameterfv(GL_POINT_DISTANCE_ATTENUATION, sprite_quadratic); glPointParameterfv(GL_POINT_DISTANCE_ATTENUATION, sprite_quadratic);
GLfloat sprite_sizes[2]; float sprite_sizes[2];
glGetFloatv(GL_ALIASED_POINT_SIZE_RANGE, sprite_sizes); glGetFloatv(GL_ALIASED_POINT_SIZE_RANGE, sprite_sizes);
glPointParameterf(GL_POINT_SIZE_MIN, sprite_sizes[0]); glPointParameterf(GL_POINT_SIZE_MIN, sprite_sizes[0]);
glPointParameterf(GL_POINT_SIZE_MAX, sprite_sizes[1]); glPointParameterf(GL_POINT_SIZE_MAX, sprite_sizes[1]);
Expand All @@ -231,7 +231,7 @@ void Display::init() {
glEnableClientState(GL_TEXTURE_COORD_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glEnableClientState(GL_INDEX_ARRAY); glEnableClientState(GL_INDEX_ARRAY);


screen_ratio = GLfloat(screen_width)/GLfloat(screen_height); screen_ratio = float(screen_width)/float(screen_height);


glViewport(0, 0, screen_width, screen_height); glViewport(0, 0, screen_width, screen_height);
glMatrixMode(GL_PROJECTION); glMatrixMode(GL_PROJECTION);
Expand Down
4 changes: 2 additions & 2 deletions cpp/display.h
Expand Up @@ -24,7 +24,7 @@ along with Orbit Ribbon. If not, see http://www.gnu.org/licenses/
#define ORBIT_RIBBON_DISPLAY_H #define ORBIT_RIBBON_DISPLAY_H


#include <list> #include <list>
#include <GL/glew.h> //#include <GL/glew.h>


#include "geometry.h" #include "geometry.h"


Expand All @@ -51,7 +51,7 @@ struct SDL_VideoInfo;
class Display { class Display {
private: private:
static int screen_width, screen_height; static int screen_width, screen_height;
static GLfloat screen_ratio; static float screen_ratio;
static const SDL_VideoInfo* vid_info; static const SDL_VideoInfo* vid_info;


public: public:
Expand Down
6 changes: 3 additions & 3 deletions cpp/font.cpp
Expand Up @@ -28,7 +28,7 @@ along with Orbit Ribbon. If not, see http://www.gnu.org/licenses/


#include "except.h" #include "except.h"
#include "font.h" #include "font.h"
#include "gloo.h"


#include "autoxsd/fontdesc.h" #include "autoxsd/fontdesc.h"
#include "autoxsd/fontdesc-pimpl.h" #include "autoxsd/fontdesc-pimpl.h"
Expand Down Expand Up @@ -101,8 +101,8 @@ void Font::draw(const Point& upper_left, float height, const std::string& str) {
std::pair<unsigned char, short> hy = get_glyph_height_and_y_offset(height); std::pair<unsigned char, short> hy = get_glyph_height_and_y_offset(height);
std::map<char, std::pair<short, unsigned char> >& glyphmap = _glyph_data[hy.first]; std::map<char, std::pair<short, unsigned char> >& glyphmap = _glyph_data[hy.first];


static GLfloat points[FONT_MAX_STR_LENGTH*8]; static float points[FONT_MAX_STR_LENGTH*8];
static GLfloat uv_points[FONT_MAX_STR_LENGTH*8]; static float uv_points[FONT_MAX_STR_LENGTH*8];
float x = 0.0; float x = 0.0;
Size t = _tex->get_size(); Size t = _tex->get_size();
unsigned int glyphs = 0; unsigned int glyphs = 0;
Expand Down
3 changes: 0 additions & 3 deletions cpp/font.h
Expand Up @@ -26,12 +26,9 @@ along with Orbit Ribbon. If not, see http://www.gnu.org/licenses/
#include <map> #include <map>


class Point; class Point;
class GLOOTexture;


class Font { class Font {
private: private:
boost::shared_ptr<GLOOTexture> _tex;

// Key is max glyph height, value maps input char to offset and width. Offset is -1 for no character (i.e. space) // Key is max glyph height, value maps input char to offset and width. Offset is -1 for no character (i.e. space)
std::map<unsigned char, std::map<char, std::pair<short, unsigned char> > > _glyph_data; std::map<unsigned char, std::map<char, std::pair<short, unsigned char> > > _glyph_data;


Expand Down
6 changes: 3 additions & 3 deletions cpp/gameobj.cpp
Expand Up @@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License
along with Orbit Ribbon. If not, see http://www.gnu.org/licenses/ along with Orbit Ribbon. If not, see http://www.gnu.org/licenses/
*/ */


#include <GL/glew.h> //#include <GL/glew.h>
#include <ode/ode.h> #include <ode/ode.h>
#include <boost/array.hpp> #include <boost/array.hpp>
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
Expand All @@ -35,7 +35,7 @@ along with Orbit Ribbon. If not, see http://www.gnu.org/licenses/
#include "gameobj.h" #include "gameobj.h"
#include "geometry.h" #include "geometry.h"
#include "globals.h" #include "globals.h"
#include "gloo.h"


// Default coefficients for linear and angular damping on new GameObjs // Default coefficients for linear and angular damping on new GameObjs
const float DEFAULT_VEL_DAMP_COEF = 0.15; const float DEFAULT_VEL_DAMP_COEF = 0.15;
Expand Down Expand Up @@ -166,7 +166,7 @@ void GameObj::step() {


// Apply damping // Apply damping
if (b != 0) { if (b != 0) {
GLint i; int i;
dReal x, y, z; dReal x, y, z;
dVector3 v; dVector3 v;


Expand Down
2 changes: 1 addition & 1 deletion cpp/gameobj.h
Expand Up @@ -23,7 +23,7 @@ along with Orbit Ribbon. If not, see http://www.gnu.org/licenses/
#ifndef ORBIT_RIBBON_GAMEOBJ_H #ifndef ORBIT_RIBBON_GAMEOBJ_H
#define ORBIT_RIBBON_GAMEOBJ_H #define ORBIT_RIBBON_GAMEOBJ_H


#include <GL/glew.h> //#include <GL/glew.h>
#include <ode/ode.h> #include <ode/ode.h>
#include <boost/array.hpp> #include <boost/array.hpp>
#include <boost/utility.hpp> #include <boost/utility.hpp>
Expand Down
2 changes: 1 addition & 1 deletion cpp/gameplay_mode.cpp
Expand Up @@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License
along with Orbit Ribbon. If not, see http://www.gnu.org/licenses/ along with Orbit Ribbon. If not, see http://www.gnu.org/licenses/
*/ */


#include <GL/glew.h> //#include <GL/glew.h>
#include <boost/format.hpp> #include <boost/format.hpp>
#include <cmath> #include <cmath>


Expand Down
5 changes: 2 additions & 3 deletions cpp/gameplay_mode.h
Expand Up @@ -24,7 +24,7 @@ along with Orbit Ribbon. If not, see http://www.gnu.org/licenses/
#define ORBIT_RIBBON_GAMEPLAY_MODE_H #define ORBIT_RIBBON_GAMEPLAY_MODE_H


#include "geometry.h" #include "geometry.h"
#include "gloo.h"
#include "mode.h" #include "mode.h"
#include "mission_fsm.h" #include "mission_fsm.h"


Expand All @@ -35,7 +35,6 @@ class GameplayMode : public Mode {
MissionFSM _fsm; MissionFSM _fsm;
std::string _avatar_key; std::string _avatar_key;
Point _condition_widget_cursor; Point _condition_widget_cursor;
GLOOCamera _camera;


public: public:
GameplayMode(); GameplayMode();
Expand All @@ -47,7 +46,7 @@ class GameplayMode : public Mode {


bool handle_input(); bool handle_input();


const GLOOCamera* get_camera(bool top); void set_camera(bool top);
void draw_3d_far(bool top); void draw_3d_far(bool top);
void draw_3d_near(bool top); void draw_3d_near(bool top);
void draw_2d(bool top); void draw_2d(bool top);
Expand Down
36 changes: 18 additions & 18 deletions cpp/geometry.cpp
Expand Up @@ -19,7 +19,7 @@ You should have received a copy of the GNU General Public License
along with Orbit Ribbon. If not, see http://www.gnu.org/licenses/ along with Orbit Ribbon. If not, see http://www.gnu.org/licenses/
*/ */


#include <GL/glew.h> //#include <GL/glew.h>
#include <boost/format.hpp> #include <boost/format.hpp>
#include <cmath> #include <cmath>
#include <string> #include <string>
Expand All @@ -29,27 +29,27 @@ along with Orbit Ribbon. If not, see http://www.gnu.org/licenses/


const float SIMILARITY_DELTA = 0.0001; const float SIMILARITY_DELTA = 0.0001;


GLfloat rev2rad(GLfloat ang) { float rev2rad(float ang) {
return 2.0*ang*M_PI; return 2.0*ang*M_PI;
} }


GLfloat rad2rev(GLfloat ang) { float rad2rev(float ang) {
return ang/(M_PI*2.0); return ang/(M_PI*2.0);
} }


GLfloat rev2deg(GLfloat ang) { float rev2deg(float ang) {
return 360.0*ang; return 360.0*ang;
} }


GLfloat deg2rev(GLfloat ang) { float deg2rev(float ang) {
return ang/360.0; return ang/360.0;
} }


GLfloat rad2deg(GLfloat ang) { float rad2deg(float ang) {
return (360.0*ang)/(M_PI*2); return (360.0*ang)/(M_PI*2);
} }


GLfloat deg2rad(GLfloat ang) { float deg2rad(float ang) {
return (ang/360.0)*2*M_PI; return (ang/360.0)*2*M_PI;
} }


Expand Down Expand Up @@ -102,7 +102,7 @@ Point Point::operator*(const Point& other) const {
return Point(x*other.x, y*other.y, z*other.z); return Point(x*other.x, y*other.y, z*other.z);
} }


Point Point::operator*(GLfloat f) const { Point Point::operator*(float f) const {
return Point(x*f, y*f, z*f); return Point(x*f, y*f, z*f);
} }


Expand All @@ -112,7 +112,7 @@ void Point::operator*=(const Point& other) {
z *= other.z; z *= other.z;
} }


void Point::operator*=(GLfloat f) { void Point::operator*=(float f) {
x *= f; x *= f;
y *= f; y *= f;
z *= f; z *= f;
Expand All @@ -122,7 +122,7 @@ Point Point::operator/(const Point& other) const {
return Point(x/other.x, y/other.y, z/other.z); return Point(x/other.x, y/other.y, z/other.z);
} }


Point Point::operator/(GLfloat f) const { Point Point::operator/(float f) const {
return Point(x/f, y/f, z/f); return Point(x/f, y/f, z/f);
} }


Expand All @@ -132,7 +132,7 @@ void Point::operator/=(const Point& other) {
z /= other.z; z /= other.z;
} }


void Point::operator/=(GLfloat f) { void Point::operator/=(float f) {
x /= f; x /= f;
y /= f; y /= f;
z /= f; z /= f;
Expand All @@ -154,11 +154,11 @@ bool Point::near_to(const Point& other) const {
); );
} }


GLfloat Point::mag() const { float Point::mag() const {
return std::sqrt(pow(std::sqrt(x*x + y*y), 2) + z*z); return std::sqrt(pow(std::sqrt(x*x + y*y), 2) + z*z);
} }


GLfloat Point::dot_prod(const Point& other) const { float Point::dot_prod(const Point& other) const {
return x*other.x + y*other.y + z*other.z; return x*other.x + y*other.y + z*other.z;
} }


Expand All @@ -170,20 +170,20 @@ Point Point::cross_prod(const Point& other) const {
); );
} }


GLfloat Point::dist_to(const Point& other) const { float Point::dist_to(const Point& other) const {
return std::sqrt(sq_dist_to(other)); return std::sqrt(sq_dist_to(other));
} }


GLfloat Point::sq_dist_to(const Point& other) const { float Point::sq_dist_to(const Point& other) const {
return (x-other.x)*(x-other.x) + (y-other.y)*(y-other.y) + (z-other.z)*(z-other.z); return (x-other.x)*(x-other.x) + (y-other.y)*(y-other.y) + (z-other.z)*(z-other.z);
} }


GLfloat Point::ang_to(const Point& other) const { float Point::ang_to(const Point& other) const {
return rad2rev(std::acos((dot_prod(other))/(mag()*other.mag()))); return rad2rev(std::acos((dot_prod(other))/(mag()*other.mag())));
} }


Point Point::to_length(float len) const { Point Point::to_length(float len) const {
GLfloat old_len = mag(); float old_len = mag();
if (old_len != 0.0) { if (old_len != 0.0) {
return (*this) * (len/old_len); return (*this) * (len/old_len);
} else { } else {
Expand All @@ -201,7 +201,7 @@ Point Point::project_onto(const Plane& p) const {
return *this - (n*dist); return *this - (n*dist);
} }


Plane::Plane(GLfloat na, GLfloat nb, GLfloat nc, GLfloat nd) : Plane::Plane(float na, float nb, float nc, float nd) :
a(na), b(nb), c(nc), d(nd) a(na), b(nb), c(nc), d(nd)
{} {}


Expand Down
2 changes: 1 addition & 1 deletion cpp/globals.cpp
Expand Up @@ -25,7 +25,7 @@ along with Orbit Ribbon. If not, see http://www.gnu.org/licenses/
#include "font.h" #include "font.h"
#include "gameobj.h" #include "gameobj.h"
#include "globals.h" #include "globals.h"
#include "gloo.h"
#include "mode.h" #include "mode.h"
#include "ore.h" #include "ore.h"
#include "mouse_cursor.h" #include "mouse_cursor.h"
Expand Down
2 changes: 0 additions & 2 deletions cpp/globals.h
Expand Up @@ -40,9 +40,7 @@ along with Orbit Ribbon. If not, see http://www.gnu.org/licenses/
class Background; class Background;
class GameObj; class GameObj;
class Mode; class Mode;
class GLOOFont;
class Font; class Font;
class GLOOTexture;
class OrePackage; class OrePackage;
class MouseCursor; class MouseCursor;


Expand Down

0 comments on commit 46b3d8a

Please sign in to comment.