goat3dgfx

changeset 12:1868c5975f31

foo
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 24 Nov 2013 18:18:38 +0200
parents d061fe1a31ec
children 25bf39105c82
files Makefile.in configure src/camera.cc src/goat3dgfx.cc src/scene.cc src/scene.h
diffstat 6 files changed, 38 insertions(+), 7 deletions(-) [+]
line diff
     1.1 --- a/Makefile.in	Sun Nov 24 14:00:14 2013 +0200
     1.2 +++ b/Makefile.in	Sun Nov 24 18:18:38 2013 +0200
     1.3 @@ -23,6 +23,7 @@
     1.4  	pic = -fPIC
     1.5  endif
     1.6  
     1.7 +inc = -Isrc -Isrc/vr
     1.8  warn = -Wall
     1.9  
    1.10  libs_ldflags = -limago -lanim -lpsys -lvmath
     2.1 --- a/configure	Sun Nov 24 14:00:14 2013 +0200
     2.2 +++ b/configure	Sun Nov 24 18:18:38 2013 +0200
     2.3 @@ -183,7 +183,7 @@
     2.4  		emit '#undef USE_VR'
     2.5  	fi
     2.6  
     2.7 -	emit '#endif /* GOAT3DGFX_CONFIG_H_ */'
     2.8 +	emit '#endif // GOAT3DGFX_CONFIG_H_'
     2.9  }
    2.10  
    2.11  
     3.1 --- a/src/camera.cc	Sun Nov 24 14:00:14 2013 +0200
     3.2 +++ b/src/camera.cc	Sun Nov 24 18:18:38 2013 +0200
     3.3 @@ -1,5 +1,6 @@
     3.4  #include "opengl.h"
     3.5  #include "camera.h"
     3.6 +#include "unistate.h"
     3.7  #include "vr.h"
     3.8  
     3.9  Camera::Camera()
    3.10 @@ -37,12 +38,12 @@
    3.11  
    3.12  void Camera::use() const
    3.13  {
    3.14 -	mult_matrix(matrix());
    3.15 +	set_view_matrix(matrix());
    3.16  }
    3.17  
    3.18  void Camera::use_inverse() const
    3.19  {
    3.20 -	mult_matrix(inv_matrix());
    3.21 +	set_view_matrix(inv_matrix());
    3.22  }
    3.23  
    3.24  void Camera::input_move(float x, float y, float z)
     4.1 --- a/src/goat3dgfx.cc	Sun Nov 24 14:00:14 2013 +0200
     4.2 +++ b/src/goat3dgfx.cc	Sun Nov 24 18:18:38 2013 +0200
     4.3 @@ -1,17 +1,17 @@
     4.4  #include "config.h"
     4.5 -#include "goat3dgfx.h"
     4.6 +#include "opengl.h"
     4.7  #include "vr.h"
     4.8  #include "logger.h"
     4.9  
    4.10  bool init_goat_graphics()
    4.11  {
    4.12 -	log_info("initializing goat3d graphics\n");
    4.13 +	info_log("initializing goat3d graphics\n");
    4.14  
    4.15  	glewInit();
    4.16  
    4.17  #ifdef USE_VR
    4.18 -	if(vr_init() == -1) {
    4.19 -		log_fatal("failed to initialize the VR system\n");
    4.20 +	if(vr_init(VR_INIT_OCULUS) == -1) {
    4.21 +		fatal_log("failed to initialize the VR system\n");
    4.22  		return false;
    4.23  	}
    4.24  #endif
     5.1 --- a/src/scene.cc	Sun Nov 24 14:00:14 2013 +0200
     5.2 +++ b/src/scene.cc	Sun Nov 24 18:18:38 2013 +0200
     5.3 @@ -1,5 +1,6 @@
     5.4  #include "scene.h"
     5.5  #include "opengl.h"
     5.6 +#include "goat3d.h"
     5.7  
     5.8  Scene::~Scene()
     5.9  {
    5.10 @@ -24,6 +25,31 @@
    5.11  	curves.clear();
    5.12  }
    5.13  
    5.14 +bool Scene::load(const char *fname)
    5.15 +{
    5.16 +	goat3d *goat = goat3d_create();
    5.17 +	if(!goat) {
    5.18 +		return false;
    5.19 +	}
    5.20 +	if(goat3d_load(goat, fname) == -1) {
    5.21 +		return false;
    5.22 +	}
    5.23 +
    5.24 +	int num_meshes = goat3d_get_mesh_count(goat);
    5.25 +	for(int i=0; i<num_meshes; i++) {
    5.26 +		goat3d_mesh *gmesh = goat3d_get_mesh(goat, i);
    5.27 +		// TODO cont...
    5.28 +	}
    5.29 +
    5.30 +	goat3d_free(goat);
    5.31 +	return true;
    5.32 +}
    5.33 +
    5.34 +bool Scene::save(const char *fname) const
    5.35 +{
    5.36 +	return false;	// TODO
    5.37 +}
    5.38 +
    5.39  void Scene::draw(long msec) const
    5.40  {
    5.41  	for(size_t i=0; i<objects.size(); i++) {
     6.1 --- a/src/scene.h	Sun Nov 24 14:00:14 2013 +0200
     6.2 +++ b/src/scene.h	Sun Nov 24 18:18:38 2013 +0200
     6.3 @@ -14,6 +14,9 @@
     6.4  	~Scene();
     6.5  	void destroy();
     6.6  
     6.7 +	bool load(const char *fname);
     6.8 +	bool save(const char *fname) const;
     6.9 +
    6.10  	void draw(long msec = 0) const;
    6.11  };
    6.12