goat3dgfx

changeset 15:7d6b667821cf

wrapped everything in the goatgfx namespace
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 30 Nov 2013 20:52:21 +0200
parents 693bb1df9553
children f61cc1df533c
files Makefile.in configure src/assload.cc src/assload.h src/camera.cc src/camera.h src/curve.cc src/curve.h src/curveload.cc src/curveload.h src/datapath.cc src/datapath.h src/dataset.h src/dataset.inl src/geom.cc src/geom.h src/gfxutil.cc src/gfxutil.h src/goat3dgfx.cc src/image.cc src/image.h src/logger.cc src/logger.h src/material.cc src/material.h src/mesh.cc src/mesh.h src/meshgen.cc src/meshgen.h src/object.cc src/object.h src/opengl.cc src/opengl.h src/psyspp.cc src/psyspp.h src/rtarg.cc src/rtarg.h src/scene.cc src/scene.h src/sdrman.cc src/sdrman.h src/shader.cc src/shader.h src/texgen.cc src/texgen.h src/texman.cc src/texman.h src/texture.cc src/texture.h src/timer.cc src/timer.h src/unistate.cc src/unistate.h src/vr/vr.cc src/vr/vr_impl.h src/xform_node.cc src/xform_node.h
diffstat 57 files changed, 211 insertions(+), 18 deletions(-) [+]
line diff
     1.1 --- a/Makefile.in	Sat Nov 30 15:15:34 2013 +0200
     1.2 +++ b/Makefile.in	Sat Nov 30 20:52:21 2013 +0200
     1.3 @@ -30,7 +30,7 @@
     1.4  
     1.5  CFLAGS = -pedantic $(warn) $(dbg) $(pic) $(opt) $(inc) $(cfg_cflags) $(libs_cflags)
     1.6  CXXFLAGS =  $(CFLAGS)
     1.7 -LDFLAGS = $(cfg_ldflags) $(libs_ldflags)
     1.8 +LDFLAGS = $(cfg_ldflags) $(libs_ldflags) -lgoat3d
     1.9  
    1.10  .PHONY: all
    1.11  all: $(lib_so) $(lib_a)
     2.1 --- a/configure	Sat Nov 30 15:15:34 2013 +0200
     2.2 +++ b/configure	Sat Nov 30 20:52:21 2013 +0200
     2.3 @@ -74,7 +74,7 @@
     2.4  		echo ok
     2.5  	fi
     2.6  
     2.7 -	LDFLAGS="$LDFLAGS -lovr"
     2.8 +	LDFLAGS="$LDFLAGS -lovr -ludev -lXinerama"
     2.9  	rm -f $tmpfile_bin $tmpfile_src
    2.10  }
    2.11  
     3.1 --- a/src/assload.cc	Sat Nov 30 15:15:34 2013 +0200
     3.2 +++ b/src/assload.cc	Sat Nov 30 20:52:21 2013 +0200
     3.3 @@ -12,8 +12,10 @@
     3.4  #include "assimp/postprocess.h"
     3.5  #include "texman.h"
     3.6  #include "material.h"
     3.7 +#include "scene.h"
     3.8  
     3.9  using namespace std;
    3.10 +using namespace goatgfx;
    3.11  
    3.12  static bool load_material(Material *mat, const aiMaterial *aimat);
    3.13  static Object *load_node(const aiScene *aiscn, const aiNode *ainode);
    3.14 @@ -428,6 +430,8 @@
    3.15  
    3.16  #else	// !defined USE_ASSIMP
    3.17  
    3.18 +using namespace goatgfx;
    3.19 +
    3.20  bool load_ass(Scene *scn, const char *fname)
    3.21  {
    3.22  	error_log("load_ass: assimp support not compiled in\n");
     4.1 --- a/src/assload.h	Sat Nov 30 15:15:34 2013 +0200
     4.2 +++ b/src/assload.h	Sat Nov 30 20:52:21 2013 +0200
     4.3 @@ -4,6 +4,10 @@
     4.4  #include <vector>
     4.5  #include "scene.h"
     4.6  
     4.7 +namespace goatgfx {
     4.8 +
     4.9  bool load_ass(Scene *scn, const char *fname);
    4.10  
    4.11 +}
    4.12 +
    4.13  #endif	// ASSLOAD_H_
     5.1 --- a/src/camera.cc	Sat Nov 30 15:15:34 2013 +0200
     5.2 +++ b/src/camera.cc	Sat Nov 30 20:52:21 2013 +0200
     5.3 @@ -3,6 +3,8 @@
     5.4  #include "unistate.h"
     5.5  #include "vr.h"
     5.6  
     5.7 +using namespace goatgfx;
     5.8 +
     5.9  Camera::Camera()
    5.10  {
    5.11  	roll = 0.0;
     6.1 --- a/src/camera.h	Sat Nov 30 15:15:34 2013 +0200
     6.2 +++ b/src/camera.h	Sat Nov 30 20:52:21 2013 +0200
     6.3 @@ -3,6 +3,8 @@
     6.4  
     6.5  #include <vmath/vmath.h>
     6.6  
     6.7 +namespace goatgfx {
     6.8 +
     6.9  class Camera {
    6.10  protected:
    6.11  	float roll;
    6.12 @@ -95,4 +97,6 @@
    6.13  	void track_vr();
    6.14  };
    6.15  
    6.16 +}	// namespace goatgfx
    6.17 +
    6.18  #endif	// CAMERA_H_
     7.1 --- a/src/curve.cc	Sat Nov 30 15:15:34 2013 +0200
     7.2 +++ b/src/curve.cc	Sat Nov 30 20:52:21 2013 +0200
     7.3 @@ -5,6 +5,8 @@
     7.4  #include "shader.h"
     7.5  #include "logger.h"
     7.6  
     7.7 +using namespace goatgfx;
     7.8 +
     7.9  #define DEF_THICKNESS	0.075
    7.10  #define DEF_SEGM_SUB	3
    7.11  #define DEF_RING_SUB	6
     8.1 --- a/src/curve.h	Sat Nov 30 15:15:34 2013 +0200
     8.2 +++ b/src/curve.h	Sat Nov 30 20:52:21 2013 +0200
     8.3 @@ -6,6 +6,8 @@
     8.4  #include "vmath/vmath.h"
     8.5  #include "mesh.h"
     8.6  
     8.7 +namespace goatgfx {
     8.8 +
     8.9  class Curve {
    8.10  private:
    8.11  	std::string name;
    8.12 @@ -61,4 +63,6 @@
    8.13  	void draw() const;
    8.14  };
    8.15  
    8.16 +}	// namespace goatgfx
    8.17 +
    8.18  #endif	// CURVE_H_
     9.1 --- a/src/curveload.cc	Sat Nov 30 15:15:34 2013 +0200
     9.2 +++ b/src/curveload.cc	Sat Nov 30 20:52:21 2013 +0200
     9.3 @@ -4,6 +4,8 @@
     9.4  #include "3dschunks.h"
     9.5  #include "logger.h"
     9.6  
     9.7 +using namespace goatgfx;
     9.8 +
     9.9  #ifndef _MSC_VER
    9.10  #include <stdint.h>
    9.11  #else
    10.1 --- a/src/curveload.h	Sat Nov 30 15:15:34 2013 +0200
    10.2 +++ b/src/curveload.h	Sat Nov 30 20:52:21 2013 +0200
    10.3 @@ -3,6 +3,10 @@
    10.4  
    10.5  #include "scene.h"
    10.6  
    10.7 +namespace goatgfx {
    10.8 +
    10.9  bool load_curves(Scene *scn, const char *fname);
   10.10  
   10.11 +}
   10.12 +
   10.13  #endif	// CURVELOAD_H_
    11.1 --- a/src/datapath.cc	Sat Nov 30 15:15:34 2013 +0200
    11.2 +++ b/src/datapath.cc	Sat Nov 30 20:52:21 2013 +0200
    11.3 @@ -4,8 +4,12 @@
    11.4  #include "logger.h"
    11.5  #include "datapath.h"
    11.6  
    11.7 +using namespace goatgfx;
    11.8 +
    11.9  static std::set<std::string> paths;
   11.10  
   11.11 +namespace goatgfx {
   11.12 +
   11.13  void add_data_path(const char *path)
   11.14  {
   11.15  	paths.insert(path);
   11.16 @@ -65,3 +69,5 @@
   11.17  	return std::string(path);
   11.18  }
   11.19  #endif
   11.20 +
   11.21 +}	// namespace goatgfx
    12.1 --- a/src/datapath.h	Sat Nov 30 15:15:34 2013 +0200
    12.2 +++ b/src/datapath.h	Sat Nov 30 20:52:21 2013 +0200
    12.3 @@ -3,8 +3,12 @@
    12.4  
    12.5  #include <string>
    12.6  
    12.7 +namespace goatgfx {
    12.8 +
    12.9  void add_data_path(const char *path);
   12.10  
   12.11  std::string datafile_path(const char *fname);
   12.12  
   12.13 +}	// namespace goatgfx
   12.14 +
   12.15  #endif	// DATAPATH_H_
    13.1 --- a/src/dataset.h	Sat Nov 30 15:15:34 2013 +0200
    13.2 +++ b/src/dataset.h	Sat Nov 30 20:52:21 2013 +0200
    13.3 @@ -22,6 +22,8 @@
    13.4  #include <string>
    13.5  #include <map>
    13.6  
    13.7 +namespace goatgfx {
    13.8 +
    13.9  template <typename T>
   13.10  class DataSet {
   13.11  protected:
   13.12 @@ -39,6 +41,8 @@
   13.13  	T get(const char *name) const;
   13.14  };
   13.15  
   13.16 +}	// namespace goatgfx
   13.17 +
   13.18  #include "dataset.inl"
   13.19  
   13.20  #endif	// DATASET_H_
    14.1 --- a/src/dataset.inl	Sat Nov 30 15:15:34 2013 +0200
    14.2 +++ b/src/dataset.inl	Sat Nov 30 20:52:21 2013 +0200
    14.3 @@ -2,6 +2,8 @@
    14.4  #include <string.h>
    14.5  #include "datapath.h"
    14.6  
    14.7 +namespace goatgfx {
    14.8 +
    14.9  template <typename T>
   14.10  DataSet<T>::DataSet(T (*load_func)(const char*), void (*destr_func)(T))
   14.11  {
   14.12 @@ -35,7 +37,7 @@
   14.13  		return iter->second;
   14.14  	}
   14.15  
   14.16 -	std::string path = datafile_path(name);
   14.17 +	std::string path = goatgfx::datafile_path(name);
   14.18  	if(path.empty()) {
   14.19  		fprintf(stderr, "can't find data file: %s\n", name);
   14.20  		return 0;
   14.21 @@ -47,3 +49,5 @@
   14.22  	}
   14.23  	return res;
   14.24  }
   14.25 +
   14.26 +}	// namespace goatgfx
    15.1 --- a/src/geom.cc	Sat Nov 30 15:15:34 2013 +0200
    15.2 +++ b/src/geom.cc	Sat Nov 30 20:52:21 2013 +0200
    15.3 @@ -3,6 +3,8 @@
    15.4  #include "geom.h"
    15.5  #include "logger.h"
    15.6  
    15.7 +using namespace goatgfx;
    15.8 +
    15.9  GeomObject::~GeomObject()
   15.10  {
   15.11  }
    16.1 --- a/src/geom.h	Sat Nov 30 15:15:34 2013 +0200
    16.2 +++ b/src/geom.h	Sat Nov 30 20:52:21 2013 +0200
    16.3 @@ -3,6 +3,8 @@
    16.4  
    16.5  #include "vmath/vmath.h"
    16.6  
    16.7 +namespace goatgfx {
    16.8 +
    16.9  class GeomObject;
   16.10  
   16.11  struct HitPoint {
   16.12 @@ -64,4 +66,6 @@
   16.13  	bool intersect(const Ray &ray, HitPoint *hit = 0) const;
   16.14  };
   16.15  
   16.16 +}	// namespace goatgfx
   16.17 +
   16.18  #endif	// GEOMOBJ_H_
    17.1 --- a/src/gfxutil.cc	Sat Nov 30 15:15:34 2013 +0200
    17.2 +++ b/src/gfxutil.cc	Sat Nov 30 20:52:21 2013 +0200
    17.3 @@ -8,6 +8,8 @@
    17.4  #include "opengl.h"
    17.5  #include "logger.h"
    17.6  
    17.7 +using namespace goatgfx;
    17.8 +
    17.9  void draw_rect(const Vector3 &v1, const Vector3 &v2, Texture2D *tex, ShaderProg *sdr)
   17.10  {
   17.11  	static ShaderProg *defsdr;
    18.1 --- a/src/gfxutil.h	Sat Nov 30 15:15:34 2013 +0200
    18.2 +++ b/src/gfxutil.h	Sat Nov 30 20:52:21 2013 +0200
    18.3 @@ -3,9 +3,13 @@
    18.4  
    18.5  #include <vmath/vmath.h>
    18.6  
    18.7 +namespace goatgfx {
    18.8 +
    18.9  class Texture2D;
   18.10  class ShaderProg;
   18.11  
   18.12  void draw_rect(const Vector3 &v1, const Vector3 &v2, Texture2D *tex = 0, ShaderProg *sdr = 0);
   18.13  
   18.14 +}	// namespace goatgfx
   18.15 +
   18.16  #endif	// GFXUTIL_H_
    19.1 --- a/src/goat3dgfx.cc	Sat Nov 30 15:15:34 2013 +0200
    19.2 +++ b/src/goat3dgfx.cc	Sat Nov 30 20:52:21 2013 +0200
    19.3 @@ -3,6 +3,8 @@
    19.4  #include "vr.h"
    19.5  #include "logger.h"
    19.6  
    19.7 +using namespace goatgfx;
    19.8 +
    19.9  bool init_goat_graphics()
   19.10  {
   19.11  	info_log("initializing goat3d graphics\n");
    20.1 --- a/src/image.cc	Sat Nov 30 15:15:34 2013 +0200
    20.2 +++ b/src/image.cc	Sat Nov 30 20:52:21 2013 +0200
    20.3 @@ -10,6 +10,7 @@
    20.4  #include "image.h"
    20.5  #include "logger.h"
    20.6  
    20.7 +using namespace goatgfx;
    20.8  
    20.9  static int pixel_elements(Image::Format fmt);
   20.10  static int elem_size(Image::Format fmt);
    21.1 --- a/src/image.h	Sat Nov 30 15:15:34 2013 +0200
    21.2 +++ b/src/image.h	Sat Nov 30 20:52:21 2013 +0200
    21.3 @@ -1,6 +1,7 @@
    21.4  #ifndef IMAGE_H_
    21.5  #define IMAGE_H_
    21.6  
    21.7 +namespace goatgfx {
    21.8  
    21.9  class Image {
   21.10  public:
   21.11 @@ -41,4 +42,6 @@
   21.12  	bool save(const char *fname) const;
   21.13  };
   21.14  
   21.15 +}	// namespace goatgfx
   21.16 +
   21.17  #endif	// IMAGE_H_
    22.1 --- a/src/logger.cc	Sat Nov 30 15:15:34 2013 +0200
    22.2 +++ b/src/logger.cc	Sat Nov 30 20:52:21 2013 +0200
    22.3 @@ -8,6 +8,8 @@
    22.4  #include <windows.h>
    22.5  #endif
    22.6  
    22.7 +using namespace goatgfx;
    22.8 +
    22.9  enum { LOG_INFO, LOG_WARNING, LOG_ERROR, LOG_FATAL, LOG_DEBUG };
   22.10  
   22.11  static int typecolor(int type);
   22.12 @@ -41,6 +43,8 @@
   22.13  #endif
   22.14  }
   22.15  
   22.16 +namespace goatgfx {
   22.17 +
   22.18  void info_log(const char *fmt, ...)
   22.19  {
   22.20  	va_list ap;
   22.21 @@ -86,6 +90,8 @@
   22.22  	va_end(ap);
   22.23  }
   22.24  
   22.25 +}	// namespace goatgfx
   22.26 +
   22.27  enum {
   22.28  	BLACK = 0,
   22.29  	RED,
    23.1 --- a/src/logger.h	Sat Nov 30 15:15:34 2013 +0200
    23.2 +++ b/src/logger.h	Sat Nov 30 20:52:21 2013 +0200
    23.3 @@ -1,10 +1,14 @@
    23.4  #ifndef LOGGER_H_
    23.5  #define LOGGER_H_
    23.6  
    23.7 +namespace goatgfx {
    23.8 +
    23.9  void info_log(const char *fmt, ...);
   23.10  void warning_log(const char *fmt, ...);
   23.11  void error_log(const char *fmt, ...);
   23.12  void fatal_log(const char *fmt, ...);
   23.13  void debug_log(const char *fmt, ...);
   23.14  
   23.15 +}	// namespace goatgfx
   23.16 +
   23.17  #endif	// LOGGER_H_
    24.1 --- a/src/material.cc	Sat Nov 30 15:15:34 2013 +0200
    24.2 +++ b/src/material.cc	Sat Nov 30 20:52:21 2013 +0200
    24.3 @@ -1,6 +1,8 @@
    24.4  #include "material.h"
    24.5  #include "unistate.h"
    24.6  
    24.7 +using namespace goatgfx;
    24.8 +
    24.9  Material::Material()
   24.10  	: diffuse(1, 1, 1), specular(0, 0, 0)
   24.11  {
    25.1 --- a/src/material.h	Sat Nov 30 15:15:34 2013 +0200
    25.2 +++ b/src/material.h	Sat Nov 30 20:52:21 2013 +0200
    25.3 @@ -4,6 +4,8 @@
    25.4  #include "vmath/vmath.h"
    25.5  #include "texture.h"
    25.6  
    25.7 +namespace goatgfx {
    25.8 +
    25.9  enum {
   25.10  	TEX_DIFFUSE,
   25.11  	TEX_SPECULAR,
   25.12 @@ -26,4 +28,6 @@
   25.13  	void setup(bool use_textures = true) const;
   25.14  };
   25.15  
   25.16 +}	// namespace goatgfx
   25.17 +
   25.18  #endif	// MATERIAL_H_
    26.1 --- a/src/mesh.cc	Sat Nov 30 15:15:34 2013 +0200
    26.2 +++ b/src/mesh.cc	Sat Nov 30 20:52:21 2013 +0200
    26.3 @@ -7,6 +7,8 @@
    26.4  #include "xform_node.h"
    26.5  #include "logger.h"
    26.6  
    26.7 +using namespace goatgfx;
    26.8 +
    26.9  int Mesh::global_sdr_loc[NUM_MESH_ATTR] = { 0, 1, 2, 3, 4, 5 };
   26.10  unsigned int Mesh::intersect_mode = ISECT_DEFAULT;
   26.11  float Mesh::vertex_sel_dist = 0.01;
    27.1 --- a/src/mesh.h	Sat Nov 30 15:15:34 2013 +0200
    27.2 +++ b/src/mesh.h	Sat Nov 30 20:52:21 2013 +0200
    27.3 @@ -6,6 +6,8 @@
    27.4  #include <vmath/vmath.h>
    27.5  #include "geom.h"
    27.6  
    27.7 +namespace goatgfx {
    27.8 +
    27.9  enum {
   27.10  	MESH_ATTR_VERTEX,
   27.11  	MESH_ATTR_NORMAL,
   27.12 @@ -207,5 +209,6 @@
   27.13  	bool intersect(const Ray &ray, HitPoint *hit = 0) const;
   27.14  };
   27.15  
   27.16 +}	// namespace goatgfx
   27.17  
   27.18  #endif	// MESH_H_
    28.1 --- a/src/meshgen.cc	Sat Nov 30 15:15:34 2013 +0200
    28.2 +++ b/src/meshgen.cc	Sat Nov 30 20:52:21 2013 +0200
    28.3 @@ -2,6 +2,8 @@
    28.4  #include "mesh.h"
    28.5  #include "logger.h"
    28.6  
    28.7 +using namespace goatgfx;
    28.8 +
    28.9  // -------- sphere --------
   28.10  
   28.11  #define SURAD(u)	((u) * 2.0 * M_PI)
    29.1 --- a/src/meshgen.h	Sat Nov 30 15:15:34 2013 +0200
    29.2 +++ b/src/meshgen.h	Sat Nov 30 20:52:21 2013 +0200
    29.3 @@ -1,6 +1,8 @@
    29.4  #ifndef MESHGEN_H_
    29.5  #define MESHGEN_H_
    29.6  
    29.7 +namespace goatgfx {
    29.8 +
    29.9  class Mesh;
   29.10  
   29.11  void gen_sphere(Mesh *mesh, float rad, int usub, int vsub, float urange = 1.0, float vrange = 1.0);
   29.12 @@ -8,4 +10,6 @@
   29.13  void gen_cone(Mesh *mesh, float rad, float height, int usub, int vsub, int capsub = 0, float urange = 1.0, float vrange = 1.0);
   29.14  void gen_plane(Mesh *mesh, float width, float height, int usub = 1, int vsub = 1);
   29.15  
   29.16 +}	// namespace goatgfx
   29.17 +
   29.18  #endif	// MESHGEN_H_
    30.1 --- a/src/object.cc	Sat Nov 30 15:15:34 2013 +0200
    30.2 +++ b/src/object.cc	Sat Nov 30 20:52:21 2013 +0200
    30.3 @@ -4,6 +4,8 @@
    30.4  #include "unistate.h"
    30.5  #include "logger.h"
    30.6  
    30.7 +using namespace goatgfx;
    30.8 +
    30.9  static void destroy_all_rec(XFormNode *node);
   30.10  static void get_all_meshes_rec(XFormNode *node, std::list<Mesh*> *reslist);
   30.11  
    31.1 --- a/src/object.h	Sat Nov 30 15:15:34 2013 +0200
    31.2 +++ b/src/object.h	Sat Nov 30 20:52:21 2013 +0200
    31.3 @@ -6,6 +6,8 @@
    31.4  #include "mesh.h"
    31.5  #include "material.h"
    31.6  
    31.7 +namespace goatgfx {
    31.8 +
    31.9  enum DrawMode {
   31.10  	DRAW_DEFAULT,
   31.11  	DRAW_WIREFRAME,
   31.12 @@ -48,4 +50,6 @@
   31.13  	static DrawMode set_draw_mode(DrawMode mode);
   31.14  };
   31.15  
   31.16 +}	// namespace goatgfx
   31.17 +
   31.18  #endif	// OBJECT_H_
    32.1 --- a/src/opengl.cc	Sat Nov 30 15:15:34 2013 +0200
    32.2 +++ b/src/opengl.cc	Sat Nov 30 20:52:21 2013 +0200
    32.3 @@ -1,5 +1,9 @@
    32.4  #include "opengl.h"
    32.5  
    32.6 +using namespace goatgfx;
    32.7 +
    32.8 +namespace goatgfx {
    32.9 +
   32.10  void init_opengl()
   32.11  {
   32.12  #ifdef __GLEW_H__
   32.13 @@ -27,3 +31,5 @@
   32.14  	}
   32.15  	return errnames[err - GL_INVALID_ENUM];
   32.16  }
   32.17 +
   32.18 +}	// namespace goatgfx
    33.1 --- a/src/opengl.h	Sat Nov 30 15:15:34 2013 +0200
    33.2 +++ b/src/opengl.h	Sat Nov 30 20:52:21 2013 +0200
    33.3 @@ -64,8 +64,12 @@
    33.4  		} \
    33.5  	} while(0)
    33.6  
    33.7 +namespace goatgfx {
    33.8 +
    33.9  void init_opengl();
   33.10  
   33.11  const char *strglerr(int err);
   33.12  
   33.13 +}	// namespace goatgfx
   33.14 +
   33.15  #endif	// OPENGL_H_
    34.1 --- a/src/psyspp.cc	Sat Nov 30 15:15:34 2013 +0200
    34.2 +++ b/src/psyspp.cc	Sat Nov 30 20:52:21 2013 +0200
    34.3 @@ -8,6 +8,8 @@
    34.4  #include "texman.h"
    34.5  #include "texgen.h"
    34.6  
    34.7 +using namespace goatgfx;
    34.8 +
    34.9  static void pdraw_start(const psys_emitter *em, void *cls);
   34.10  static void pdraw(const psys_emitter *em, const psys_particle *part, void *cls);
   34.11  static void pdraw_end(const psys_emitter *em, void *cls);
   34.12 @@ -59,7 +61,7 @@
   34.13  bool ParticleSystemAttributes::load(const char *fname)
   34.14  {
   34.15  	psys_texture_loader(psys_load_texture, 0, this);
   34.16 -	return psys_load_attr(psattr, datafile_path(fname).c_str()) != -1;
   34.17 +	return psys_load_attr(psattr, goatgfx::datafile_path(fname).c_str()) != -1;
   34.18  }
   34.19  
   34.20  bool ParticleSystemAttributes::load(FILE *fp)
    35.1 --- a/src/psyspp.h	Sat Nov 30 15:15:34 2013 +0200
    35.2 +++ b/src/psyspp.h	Sat Nov 30 20:52:21 2013 +0200
    35.3 @@ -5,6 +5,8 @@
    35.4  #include "texture.h"
    35.5  #include <psys/psys.h>
    35.6  
    35.7 +namespace goatgfx {
    35.8 +
    35.9  class ParticleSystemAttributes {
   35.10  private:
   35.11  	Texture *tex;
   35.12 @@ -76,4 +78,6 @@
   35.13  	void draw() const;
   35.14  };
   35.15  
   35.16 +}	// namespace goatgfx
   35.17 +
   35.18  #endif	// PSYSPP_H_
    36.1 --- a/src/rtarg.cc	Sat Nov 30 15:15:34 2013 +0200
    36.2 +++ b/src/rtarg.cc	Sat Nov 30 20:52:21 2013 +0200
    36.3 @@ -3,6 +3,8 @@
    36.4  #include "texture.h"
    36.5  #include "logger.h"
    36.6  
    36.7 +using namespace goatgfx;
    36.8 +
    36.9  RenderTarget::RenderTarget()
   36.10  {
   36.11  	width = height = 0;
   36.12 @@ -220,6 +222,8 @@
   36.13  struct Viewport { int vp[4]; };
   36.14  static std::stack<Viewport> vpstack;
   36.15  
   36.16 +namespace goatgfx {
   36.17 +
   36.18  void set_render_target(const RenderTarget *rtarg)
   36.19  {
   36.20  	Viewport vp;
   36.21 @@ -257,3 +261,4 @@
   36.22  	return x + 1;
   36.23  }
   36.24  
   36.25 +}	// namespace goatgfx
    37.1 --- a/src/rtarg.h	Sat Nov 30 15:15:34 2013 +0200
    37.2 +++ b/src/rtarg.h	Sat Nov 30 20:52:21 2013 +0200
    37.3 @@ -4,6 +4,8 @@
    37.4  #include "vmath/vmath.h"
    37.5  #include "opengl.h"
    37.6  
    37.7 +namespace goatgfx {
    37.8 +
    37.9  class Texture;
   37.10  
   37.11  class RenderTarget {
   37.12 @@ -46,4 +48,6 @@
   37.13  
   37.14  int next_pow2(int x);
   37.15  
   37.16 +}	// namespace goatgfx
   37.17 +
   37.18  #endif	// RTARG_H_
    38.1 --- a/src/scene.cc	Sat Nov 30 15:15:34 2013 +0200
    38.2 +++ b/src/scene.cc	Sat Nov 30 20:52:21 2013 +0200
    38.3 @@ -2,6 +2,8 @@
    38.4  #include "opengl.h"
    38.5  #include "goat3d.h"
    38.6  
    38.7 +using namespace goatgfx;
    38.8 +
    38.9  static Mesh *load_mesh(goat3d_mesh *gmesh);
   38.10  
   38.11  Scene::~Scene()
    39.1 --- a/src/scene.h	Sat Nov 30 15:15:34 2013 +0200
    39.2 +++ b/src/scene.h	Sat Nov 30 20:52:21 2013 +0200
    39.3 @@ -5,6 +5,8 @@
    39.4  #include "object.h"
    39.5  #include "curve.h"
    39.6  
    39.7 +namespace goatgfx {
    39.8 +
    39.9  class Scene {
   39.10  public:
   39.11  	std::vector<Object*> objects;
   39.12 @@ -20,4 +22,6 @@
   39.13  	void draw(long msec = 0) const;
   39.14  };
   39.15  
   39.16 +}	// namespace goatgfx
   39.17 +
   39.18  #endif	// SCENE_H_
    40.1 --- a/src/sdrman.cc	Sat Nov 30 15:15:34 2013 +0200
    40.2 +++ b/src/sdrman.cc	Sat Nov 30 20:52:21 2013 +0200
    40.3 @@ -1,5 +1,9 @@
    40.4  #include "sdrman.h"
    40.5  
    40.6 +using namespace goatgfx;
    40.7 +
    40.8 +namespace goatgfx {
    40.9 +
   40.10  ShaderSet vsdrset(GL_VERTEX_SHADER);
   40.11  ShaderSet psdrset(GL_FRAGMENT_SHADER);
   40.12  
   40.13 @@ -25,3 +29,5 @@
   40.14  	}
   40.15  	return prog;
   40.16  }
   40.17 +
   40.18 +}	// namespace goatgfx
    41.1 --- a/src/sdrman.h	Sat Nov 30 15:15:34 2013 +0200
    41.2 +++ b/src/sdrman.h	Sat Nov 30 20:52:21 2013 +0200
    41.3 @@ -3,9 +3,13 @@
    41.4  
    41.5  #include "shader.h"
    41.6  
    41.7 +namespace goatgfx {
    41.8 +
    41.9  extern ShaderSet vsdrset;
   41.10  extern ShaderSet psdrset;
   41.11  
   41.12  ShaderProg *get_sdrprog(const char *vname, const char *pname);
   41.13  
   41.14 +}	// namespace goatgfx
   41.15 +
   41.16  #endif	// SDRMAN_H_
    42.1 --- a/src/shader.cc	Sat Nov 30 15:15:34 2013 +0200
    42.2 +++ b/src/shader.cc	Sat Nov 30 20:52:21 2013 +0200
    42.3 @@ -14,6 +14,8 @@
    42.4  #include <alloca.h>
    42.5  #endif
    42.6  
    42.7 +using namespace goatgfx;
    42.8 +
    42.9  #ifdef __GLEW_H__
   42.10  #define HAVE_GEOMETRY_SHADER
   42.11  #define HAVE_TESSELATION_SHADER
    43.1 --- a/src/shader.h	Sat Nov 30 15:15:34 2013 +0200
    43.2 +++ b/src/shader.h	Sat Nov 30 20:52:21 2013 +0200
    43.3 @@ -6,6 +6,8 @@
    43.4  #include "opengl.h"
    43.5  #include "dataset.h"
    43.6  
    43.7 +namespace goatgfx {
    43.8 +
    43.9  class Shader {
   43.10  private:
   43.11  	unsigned int sdr;
   43.12 @@ -132,4 +134,6 @@
   43.13  	ShaderSet(unsigned int type);
   43.14  };
   43.15  
   43.16 +}	// namespace goatgfx
   43.17 +
   43.18  #endif	// SHADER_H_
    44.1 --- a/src/texgen.cc	Sat Nov 30 15:15:34 2013 +0200
    44.2 +++ b/src/texgen.cc	Sat Nov 30 20:52:21 2013 +0200
    44.3 @@ -1,8 +1,10 @@
    44.4  #include "texgen.h"
    44.5  
    44.6 +using namespace goatgfx;
    44.7 +
    44.8  static void intcolor(const Vector4 &color, int *icol);
    44.9  
   44.10 -Image *texgen_solid(int xsz, int ysz, const Vector4 &color)
   44.11 +Image *goatgfx::texgen_solid(int xsz, int ysz, const Vector4 &color)
   44.12  {
   44.13  	Image *img = new Image;
   44.14  	if(!img->create(xsz, ysz, Image::FMT_RGBA)) {
   44.15 @@ -23,7 +25,7 @@
   44.16  	return img;
   44.17  }
   44.18  
   44.19 -Image *texgen_chess(int xsz, int ysz, int usub, int vsub, const Vector4 &col1, const Vector4 &col2)
   44.20 +Image *goatgfx::texgen_chess(int xsz, int ysz, int usub, int vsub, const Vector4 &col1, const Vector4 &col2)
   44.21  {
   44.22  	Image *img = new Image;
   44.23  	if(!img->create(xsz, ysz, Image::FMT_RGBA)) {
   44.24 @@ -58,7 +60,7 @@
   44.25  }
   44.26  
   44.27  
   44.28 -Image *texgen(int xsz, int ysz, float usize, float vsize, Vector4 (*eval)(float, float, void*), void *cls)
   44.29 +Image *goatgfx::texgen(int xsz, int ysz, float usize, float vsize, Vector4 (*eval)(float, float, void*), void *cls)
   44.30  {
   44.31  	Image *img = new Image;
   44.32  	if(!img->create(xsz, ysz, Image::FMT_RGBA)) {
   44.33 @@ -109,7 +111,7 @@
   44.34  }
   44.35  
   44.36  
   44.37 -Image *texgen_fbm(int xsz, int ysz, float usize, float vsize, int octaves, const Vector4 &col1, const Vector4 &col2)
   44.38 +Image *goatgfx::texgen_fbm(int xsz, int ysz, float usize, float vsize, int octaves, const Vector4 &col1, const Vector4 &col2)
   44.39  {
   44.40  	NoiseArg arg = {octaves, col1, col2};
   44.41  	if(arg.octaves < 1) {
   44.42 @@ -119,7 +121,7 @@
   44.43  	return texgen(xsz, ysz, usize, vsize, fbm_eval, &arg);
   44.44  }
   44.45  
   44.46 -Image *texgen_fbm_abs(int xsz, int ysz, float usize, float vsize, int octaves, const Vector4 &col1, const Vector4 &col2)
   44.47 +Image *goatgfx::texgen_fbm_abs(int xsz, int ysz, float usize, float vsize, int octaves, const Vector4 &col1, const Vector4 &col2)
   44.48  {
   44.49  	NoiseArg arg = {octaves, col1, col2};
   44.50  	if(arg.octaves < 1) {
    45.1 --- a/src/texgen.h	Sat Nov 30 15:15:34 2013 +0200
    45.2 +++ b/src/texgen.h	Sat Nov 30 20:52:21 2013 +0200
    45.3 @@ -4,6 +4,8 @@
    45.4  #include "image.h"
    45.5  #include "vmath/vmath.h"
    45.6  
    45.7 +namespace goatgfx {
    45.8 +
    45.9  Image *texgen_solid(int xsz, int ysz, const Vector4 &color);
   45.10  Image *texgen_chess(int xsz, int ysz, int usub, int vsub, const Vector4 &col1, const Vector4 &col2);
   45.11  Image *texgen_fbm(int xsz, int ysz, float usize, float vsize, int octaves, const Vector4 &col1, const Vector4 &col2);
   45.12 @@ -11,4 +13,6 @@
   45.13  
   45.14  Image *texgen(int xsz, int ysz, float usize, float vsize, Vector4 (*eval)(float, float, void*), void *cls);
   45.15  
   45.16 +}	// namespace goatgfx
   45.17 +
   45.18  #endif	// TEXGEN_H_
    46.1 --- a/src/texman.cc	Sat Nov 30 15:15:34 2013 +0200
    46.2 +++ b/src/texman.cc	Sat Nov 30 20:52:21 2013 +0200
    46.3 @@ -1,3 +1,5 @@
    46.4  #include "texman.h"
    46.5  
    46.6 -TextureSet texset;
    46.7 +using namespace goatgfx;
    46.8 +
    46.9 +TextureSet goatgfx::texset;
    47.1 --- a/src/texman.h	Sat Nov 30 15:15:34 2013 +0200
    47.2 +++ b/src/texman.h	Sat Nov 30 20:52:21 2013 +0200
    47.3 @@ -3,6 +3,10 @@
    47.4  
    47.5  #include "texture.h"
    47.6  
    47.7 +namespace goatgfx {
    47.8 +
    47.9  extern TextureSet texset;
   47.10  
   47.11 +}
   47.12 +
   47.13  #endif	// TEXMAN_H_
    48.1 --- a/src/texture.cc	Sat Nov 30 15:15:34 2013 +0200
    48.2 +++ b/src/texture.cc	Sat Nov 30 20:52:21 2013 +0200
    48.3 @@ -6,6 +6,8 @@
    48.4  #include "logger.h"
    48.5  #include "datapath.h"
    48.6  
    48.7 +using namespace goatgfx;
    48.8 +
    48.9  static int glifmt_from_ifmt(unsigned int ifmt);
   48.10  static int glfmt_from_ifmt(unsigned int ifmt);
   48.11  static int gltype_from_ifmt(unsigned int ifmt);
   48.12 @@ -17,6 +19,8 @@
   48.13  	GL_TEXTURE_2D, GL_TEXTURE_2D, GL_TEXTURE_2D, GL_TEXTURE_2D
   48.14  };
   48.15  
   48.16 +namespace goatgfx {
   48.17 +
   48.18  void set_texture(Texture *tex, int tunit)
   48.19  {
   48.20  	if(tex) {
   48.21 @@ -44,6 +48,7 @@
   48.22  	return 0;
   48.23  }
   48.24  
   48.25 +}	// namespace goatgfx
   48.26  
   48.27  Texture::Texture()
   48.28  {
    49.1 --- a/src/texture.h	Sat Nov 30 15:15:34 2013 +0200
    49.2 +++ b/src/texture.h	Sat Nov 30 20:52:21 2013 +0200
    49.3 @@ -4,6 +4,8 @@
    49.4  #include "dataset.h"
    49.5  #include "opengl.h"
    49.6  
    49.7 +namespace goatgfx {
    49.8 +
    49.9  class Image;
   49.10  
   49.11  class Texture {
   49.12 @@ -77,4 +79,6 @@
   49.13  	TextureSet();
   49.14  };
   49.15  
   49.16 +}	// namespace goatgfx
   49.17 +
   49.18  #endif	// TEXTURE_H_
    50.1 --- a/src/timer.cc	Sat Nov 30 15:15:34 2013 +0200
    50.2 +++ b/src/timer.cc	Sat Nov 30 20:52:21 2013 +0200
    50.3 @@ -1,9 +1,13 @@
    50.4  #include "timer.h"
    50.5  
    50.6 +using namespace goatgfx;
    50.7 +
    50.8  #if defined(__APPLE__) && !defined(__unix__)
    50.9  #define __unix__
   50.10  #endif
   50.11  
   50.12 +namespace goatgfx {
   50.13 +
   50.14  #ifdef __unix__
   50.15  #include <time.h>
   50.16  #include <unistd.h>
   50.17 @@ -70,6 +74,8 @@
   50.18  	}
   50.19  }
   50.20  
   50.21 +}	// namespace goatgfx
   50.22 +
   50.23  
   50.24  Timer::Timer()
   50.25  {
    51.1 --- a/src/timer.h	Sat Nov 30 15:15:34 2013 +0200
    51.2 +++ b/src/timer.h	Sat Nov 30 20:52:21 2013 +0200
    51.3 @@ -1,6 +1,8 @@
    51.4  #ifndef TIMER_H_
    51.5  #define TIMER_H_
    51.6  
    51.7 +namespace goatgfx {
    51.8 +
    51.9  unsigned long get_time_msec(void);
   51.10  void sleep_msec(unsigned long msec);
   51.11  
   51.12 @@ -26,4 +28,5 @@
   51.13  	double get_sec() const;
   51.14  };
   51.15  
   51.16 +}	// namespace goatgfx
   51.17  #endif	// TIMER_H_
    52.1 --- a/src/unistate.cc	Sat Nov 30 15:15:34 2013 +0200
    52.2 +++ b/src/unistate.cc	Sat Nov 30 20:52:21 2013 +0200
    52.3 @@ -4,6 +4,8 @@
    52.4  #include "shader.h"
    52.5  #include "logger.h"
    52.6  
    52.7 +using namespace goatgfx;
    52.8 +
    52.9  struct StateItem {
   52.10  	StType type;
   52.11  
   52.12 @@ -19,6 +21,8 @@
   52.13  static StType float_type(int elem);
   52.14  static StType int_type(int elem);
   52.15  
   52.16 +namespace goatgfx {
   52.17 +
   52.18  std::vector<StateItem> state;
   52.19  std::map<std::string, int> stateidx;
   52.20  
   52.21 @@ -582,6 +586,8 @@
   52.22  #endif
   52.23  }
   52.24  
   52.25 +}	// namespace goatgfx
   52.26 +
   52.27  static const char *typestr(StType type)
   52.28  {
   52.29  	switch(type) {
    53.1 --- a/src/unistate.h	Sat Nov 30 15:15:34 2013 +0200
    53.2 +++ b/src/unistate.h	Sat Nov 30 20:52:21 2013 +0200
    53.3 @@ -3,6 +3,8 @@
    53.4  
    53.5  #include "vmath/vmath.h"
    53.6  
    53.7 +namespace goatgfx {
    53.8 +
    53.9  class ShaderProg;
   53.10  
   53.11  enum StType {
   53.12 @@ -101,4 +103,6 @@
   53.13  
   53.14  // TODO should do a matrix stack at some point ...
   53.15  
   53.16 +}	// namespace goatgfx
   53.17 +
   53.18  #endif	// UNISTATE_H_
    54.1 --- a/src/vr/vr.cc	Sat Nov 30 15:15:34 2013 +0200
    54.2 +++ b/src/vr/vr.cc	Sat Nov 30 20:52:21 2013 +0200
    54.3 @@ -35,7 +35,10 @@
    54.4  extern "C" void vr_shutdown(void)
    54.5  {
    54.6  	delete [] vr_ctx.info.display;
    54.7 +	delete vr_ctx.ovr_sfusion;
    54.8  	//System::Destroy();
    54.9 +
   54.10 +	memset(&vr_ctx, 0, sizeof vr_ctx);
   54.11  }
   54.12  
   54.13  static void init_ctx()
   54.14 @@ -144,7 +147,8 @@
   54.15  			printf("  name: %s\n", sinfo.ProductName);
   54.16  		}
   54.17  
   54.18 -		vr_ctx.ovr_sfusion.AttachToSensor(vr_ctx.ovr_sensor_dev);
   54.19 +		vr_ctx.ovr_sfusion = new SensorFusion;
   54.20 +		vr_ctx.ovr_sfusion->AttachToSensor(vr_ctx.ovr_sensor_dev);
   54.21  	}
   54.22  	return true;
   54.23  }
   54.24 @@ -285,12 +289,12 @@
   54.25  
   54.26  extern "C" void vr_set_prediction_sec(float dt)
   54.27  {
   54.28 -	vr_ctx.ovr_sfusion.SetPrediction(dt);
   54.29 +	vr_ctx.ovr_sfusion->SetPrediction(dt);
   54.30  }
   54.31  
   54.32  extern "C" float vr_get_prediction_sec(void)
   54.33  {
   54.34 -	return vr_ctx.ovr_sfusion.GetPredictionDelta();
   54.35 +	return vr_ctx.ovr_sfusion->GetPredictionDelta();
   54.36  }
   54.37  
   54.38  extern "C" void vr_get_view_matrix(float *res, int eye)
   54.39 @@ -316,7 +320,7 @@
   54.40  
   54.41  extern "C" void vr_get_rotation(float *quat)
   54.42  {
   54.43 -	Quatf oq = vr_ctx.ovr_sfusion.GetPredictedOrientation();
   54.44 +	Quatf oq = vr_ctx.ovr_sfusion->GetPredictedOrientation();
   54.45  	quat[0] = oq.x;
   54.46  	quat[1] = oq.y;
   54.47  	quat[2] = oq.z;
   54.48 @@ -325,7 +329,7 @@
   54.49  
   54.50  extern "C" void vr_get_rotation_euler(float *euler)
   54.51  {
   54.52 -	Quatf oq = vr_ctx.ovr_sfusion.GetPredictedOrientation();
   54.53 +	Quatf oq = vr_ctx.ovr_sfusion->GetPredictedOrientation();
   54.54  	oq.GetEulerAngles<Axis_Y, Axis_X, Axis_Z>(euler + 1, euler, euler + 2);
   54.55  }
   54.56  
    55.1 --- a/src/vr/vr_impl.h	Sat Nov 30 15:15:34 2013 +0200
    55.2 +++ b/src/vr/vr_impl.h	Sat Nov 30 20:52:21 2013 +0200
    55.3 @@ -9,7 +9,7 @@
    55.4  	DeviceManager *ovr_devman;
    55.5  	HMDDevice *ovr_hmd_dev;
    55.6  	SensorDevice *ovr_sensor_dev;
    55.7 -	SensorFusion ovr_sfusion;
    55.8 +	SensorFusion *ovr_sfusion;
    55.9  
   55.10  	struct {
   55.11  		char *display;
    56.1 --- a/src/xform_node.cc	Sat Nov 30 15:15:34 2013 +0200
    56.2 +++ b/src/xform_node.cc	Sat Nov 30 20:52:21 2013 +0200
    56.3 @@ -4,6 +4,8 @@
    56.4  #include "anim/anim.h"
    56.5  #include "anim/track.h"
    56.6  
    56.7 +using namespace goatgfx;
    56.8 +
    56.9  static inline anm_interpolator track_interpolator(Interp in);
   56.10  static inline anm_extrapolator track_extrapolator(Extrap ex);
   56.11  
    57.1 --- a/src/xform_node.h	Sat Nov 30 15:15:34 2013 +0200
    57.2 +++ b/src/xform_node.h	Sat Nov 30 20:52:21 2013 +0200
    57.3 @@ -9,12 +9,15 @@
    57.4  #include "vmath/quat.h"
    57.5  #include "vmath/matrix.h"
    57.6  
    57.7 -enum Interp { INTERP_STEP, INTERP_LINEAR, INTERP_CUBIC };
    57.8 -enum Extrap { EXTRAP_EXTEND, EXTRAP_CLAMP, EXTRAP_REPEAT };
    57.9  
   57.10  struct anm_node;
   57.11  struct anm_track;
   57.12  
   57.13 +namespace goatgfx {
   57.14 +
   57.15 +enum Interp { INTERP_STEP, INTERP_LINEAR, INTERP_CUBIC };
   57.16 +enum Extrap { EXTRAP_EXTEND, EXTRAP_CLAMP, EXTRAP_REPEAT };
   57.17 +
   57.18  // XXX all time arguments are milliseconds
   57.19  
   57.20  class XFormNode {
   57.21 @@ -131,4 +134,6 @@
   57.22  	Vector3 operator ()(long tmsec = 0) const;
   57.23  };
   57.24  
   57.25 +}	// namespace goatgfx
   57.26 +
   57.27  #endif	/* XFORM_NODE_H_ */