goat3dgfx

diff src/vr/vr.cc @ 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 d061fe1a31ec
children 6236080aaea4
line diff
     1.1 --- a/src/vr/vr.cc	Sat Nov 30 15:15:34 2013 +0200
     1.2 +++ b/src/vr/vr.cc	Sat Nov 30 20:52:21 2013 +0200
     1.3 @@ -35,7 +35,10 @@
     1.4  extern "C" void vr_shutdown(void)
     1.5  {
     1.6  	delete [] vr_ctx.info.display;
     1.7 +	delete vr_ctx.ovr_sfusion;
     1.8  	//System::Destroy();
     1.9 +
    1.10 +	memset(&vr_ctx, 0, sizeof vr_ctx);
    1.11  }
    1.12  
    1.13  static void init_ctx()
    1.14 @@ -144,7 +147,8 @@
    1.15  			printf("  name: %s\n", sinfo.ProductName);
    1.16  		}
    1.17  
    1.18 -		vr_ctx.ovr_sfusion.AttachToSensor(vr_ctx.ovr_sensor_dev);
    1.19 +		vr_ctx.ovr_sfusion = new SensorFusion;
    1.20 +		vr_ctx.ovr_sfusion->AttachToSensor(vr_ctx.ovr_sensor_dev);
    1.21  	}
    1.22  	return true;
    1.23  }
    1.24 @@ -285,12 +289,12 @@
    1.25  
    1.26  extern "C" void vr_set_prediction_sec(float dt)
    1.27  {
    1.28 -	vr_ctx.ovr_sfusion.SetPrediction(dt);
    1.29 +	vr_ctx.ovr_sfusion->SetPrediction(dt);
    1.30  }
    1.31  
    1.32  extern "C" float vr_get_prediction_sec(void)
    1.33  {
    1.34 -	return vr_ctx.ovr_sfusion.GetPredictionDelta();
    1.35 +	return vr_ctx.ovr_sfusion->GetPredictionDelta();
    1.36  }
    1.37  
    1.38  extern "C" void vr_get_view_matrix(float *res, int eye)
    1.39 @@ -316,7 +320,7 @@
    1.40  
    1.41  extern "C" void vr_get_rotation(float *quat)
    1.42  {
    1.43 -	Quatf oq = vr_ctx.ovr_sfusion.GetPredictedOrientation();
    1.44 +	Quatf oq = vr_ctx.ovr_sfusion->GetPredictedOrientation();
    1.45  	quat[0] = oq.x;
    1.46  	quat[1] = oq.y;
    1.47  	quat[2] = oq.z;
    1.48 @@ -325,7 +329,7 @@
    1.49  
    1.50  extern "C" void vr_get_rotation_euler(float *euler)
    1.51  {
    1.52 -	Quatf oq = vr_ctx.ovr_sfusion.GetPredictedOrientation();
    1.53 +	Quatf oq = vr_ctx.ovr_sfusion->GetPredictedOrientation();
    1.54  	oq.GetEulerAngles<Axis_Y, Axis_X, Axis_Z>(euler + 1, euler, euler + 2);
    1.55  }
    1.56