diff --git a/sources/demo/Camera.cpp b/sources/demo/Camera.cpp
new file mode 100644
index 00000000..4d9e6eec
--- /dev/null
+++ b/sources/demo/Camera.cpp
@@ -0,0 +1,34 @@
+/****************************************************************************
+ * Copyright (C) 2009 Daniel Chappuis *
+ ****************************************************************************
+ * This file is part of ReactPhysics3D. *
+ * *
+ * ReactPhysics3D is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * ReactPhysics3D is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with ReactPhysics3D. If not, see . *
+ ***************************************************************************/
+
+// Libraries
+#include "Camera.h"
+
+// Initialization of static variables
+double Camera::speed=0.5;
+
+// Constructor of the camera
+Camera::Camera() {
+
+}
+
+// Destructor of the camera
+Camera::~Camera() {
+
+}
diff --git a/sources/demo/Camera.h b/sources/demo/Camera.h
new file mode 100644
index 00000000..7ca15361
--- /dev/null
+++ b/sources/demo/Camera.h
@@ -0,0 +1,91 @@
+/****************************************************************************
+ * Copyright (C) 2009 Daniel Chappuis *
+ ****************************************************************************
+ * This file is part of ReactPhysics3D. *
+ * *
+ * ReactPhysics3D is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * ReactPhysics3D is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with ReactPhysics3D. If not, see . *
+ ***************************************************************************/
+
+#ifndef CAMERA_H
+#define CAMERA_H
+
+// Libraries
+#include "../reactphysics3d/reactphysics3d.h" // We want the mathematics stuff of reactphysics3d
+
+// Namespaces
+using namespace reactphysics3d;
+
+// Class Camera (abstract class)
+// In the project we will use two different camera. This is the superclass of the two
+// cameras. We will use a OutSideCamera that move arround the scene and an OnBoardCamera
+// that will simulate the deplacement of a viewer inside the scene
+class Camera {
+ protected :
+ Vector3D position; // Position of the camera
+ Vector3D lookAtPoint; // Point where the camera is looking
+ Vector3D viewVector; // Vector from the camera position to the view point
+ static double speed; // Speed movement of the camera
+
+ public :
+ Camera(); // Constructor
+ Camera(const Camera& camera); // Copy-constructor
+ virtual ~Camera(); // Destructor
+ virtual Vector3D getPosition() const; // Get the position of the camera
+ virtual void setPosition(const Vector3D& pos); // Set the position of the camera
+ virtual Vector3D getLookAtPoint() const; // Return the point where the camera is looking
+ virtual Vector3D getViewVector() const; // Return the view vector of the camera
+ virtual void updateViewVector()=0; // Update the view vector of the camera
+ static void increaseSpeed(); // Increase the speed of camera movement
+ static void decreaseSpeed(); // Decrease the speed of camera movement
+};
+
+// Get the position of the camera (inline function)
+inline Vector3D Camera::getPosition() const {
+ // Return the position of the camera
+ return position;
+}
+
+// Set the position of the camera (inline function)
+inline void Camera::setPosition(const Vector3D& pos) {
+ // Set the position of the camera
+ position = pos;
+}
+
+// Return the point where the camera is looking (inline function)
+inline Vector3D Camera::getLookAtPoint() const {
+ return lookAtPoint;
+}
+
+// Return the view vector of the camera (inline function)
+inline Vector3D Camera::getViewVector() const {
+ return viewVector;
+}
+
+// Increase the speed movement of the camera (inline function)
+inline void Camera::increaseSpeed()
+{
+ speed= speed+0.05;
+ if(speed>1)
+ speed=1;
+}
+
+// Decrease the speep movement of the camera (inline function)
+inline void Camera::decreaseSpeed()
+{
+ speed = speed-0.05;
+ if(speed<=0)
+ speed=0.005;
+}
+
+#endif
diff --git a/sources/demo/OutSideCamera.cpp b/sources/demo/OutSideCamera.cpp
new file mode 100644
index 00000000..b830c6ab
--- /dev/null
+++ b/sources/demo/OutSideCamera.cpp
@@ -0,0 +1,115 @@
+/****************************************************************************
+ * Copyright (C) 2009 Daniel Chappuis *
+ ****************************************************************************
+ * This file is part of ReactPhysics3D. *
+ * *
+ * ReactPhysics3D is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * ReactPhysics3D is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with ReactPhysics3D. If not, see . *
+ ***************************************************************************/
+
+// Libraries
+#include "OutSideCamera.h"
+#include
+
+// Constants
+const double PI = 3.141592;
+
+// Constructor
+OutSideCamera::OutSideCamera() {
+
+ // Initialize the attributes
+ heightFromFloor = 20.0;
+ horizontalAngleRotation = 0;
+ verticalAngleRotation = 45;
+ distanceFromOrigin = 10.0;
+ lookAtPoint.setAllValues(0.0, 0.0, 0.0);
+
+ // Update the position of the camera
+ updatePosition();
+
+ // Update the view vector of the camera
+ updateViewVector();
+}
+
+// Destructor
+OutSideCamera::~OutSideCamera() {
+
+}
+
+// Compute the new position of the camera
+void OutSideCamera::updatePosition() {
+
+ // Compute the floor distance from origin
+ double floorDistance = distanceFromOrigin * cos(PI/180.0 * verticalAngleRotation);
+
+ // Update the position of the camera
+ position.setAllValues(floorDistance*cos(PI/180.0 * horizontalAngleRotation), distanceFromOrigin*sin(PI/180*verticalAngleRotation),
+ floorDistance*sin(PI/180.0 * horizontalAngleRotation));
+}
+
+// Set the camera rotation angle and update the position of the camera
+void OutSideCamera::modifyHorizontalAngleRotation(int screenDistance, float fps) {
+
+ // Update the horizontal rotation angle of the camera
+ horizontalAngleRotation = (horizontalAngleRotation + int(screenDistance * 60.0 / fps)) % 360;
+
+ // Update the position and the view vector of the camera
+ updatePosition();
+ updateViewVector();
+}
+
+// Set the vertical camera rotation angle
+void OutSideCamera::modifyVerticalAngleRotation(int screenDistance, float fps) {
+
+ // Update the vertical rotation angle of the camera
+ verticalAngleRotation = verticalAngleRotation + (screenDistance * 60.0 / fps);
+
+ // Vertical angle limits
+ if (verticalAngleRotation > 89) {
+ verticalAngleRotation = 89;
+ }
+ if (verticalAngleRotation < 1) {
+ verticalAngleRotation = 1;
+ }
+
+ // Update the position and the view vector of the camera
+ updatePosition();
+ updateViewVector();
+}
+
+// Increase the distance from origine of the camera (used for the zoom)
+void OutSideCamera::increaseDistance(float fps) {
+
+ // Increase the distance from origin
+ distanceFromOrigin = distanceFromOrigin + (speed * 60 / fps);
+
+ // Update the position and the view vector of the camera
+ updatePosition();
+ updateViewVector();
+}
+
+// Decrease the distance from origine of the camera (used for the zoom)
+void OutSideCamera::decreaseDistance(float fps) {
+
+ // Decrease the distance from origin
+ distanceFromOrigin = distanceFromOrigin - (speed * 60 / fps);
+
+ // Limit condition
+ if(distanceFromOrigin < 1) {
+ distanceFromOrigin=1;
+ }
+
+ // Update the position and the view vector of the camera
+ updatePosition();
+ updateViewVector();
+}
diff --git a/sources/demo/OutSideCamera.h b/sources/demo/OutSideCamera.h
new file mode 100644
index 00000000..b0a61027
--- /dev/null
+++ b/sources/demo/OutSideCamera.h
@@ -0,0 +1,64 @@
+/****************************************************************************
+ * Copyright (C) 2009 Daniel Chappuis *
+ ****************************************************************************
+ * This file is part of ReactPhysics3D. *
+ * *
+ * ReactPhysics3D is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * ReactPhysics3D is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with ReactPhysics3D. If not, see . *
+ ***************************************************************************/
+
+#ifndef OUTSIDE_CAMERA_H
+#define OUTSIDE_CAMERA_H
+
+// Libraries
+#include "Camera.h"
+
+// ---- Class OutSideCamera ----
+// This camera can be move everywhere around the scene to obtain a outside view of the house
+class OutSideCamera : public Camera {
+ private :
+ double heightFromFloor; // Height from the floor
+ int horizontalAngleRotation; // Horizontal rotation angle (in degree)
+ int verticalAngleRotation; // Vertical rotation angle (in degree)
+ double distanceFromOrigin; // Distance of the camera from the origin (used to zoom)
+
+ public :
+ OutSideCamera(); // Constructor
+ OutSideCamera(const OutSideCamera& camera); // Copy-constructor
+ virtual ~OutSideCamera(); // Destructor
+ void updatePosition(); // Compute the new position of the camera
+ void updateViewVector(); // Update the view vector of the camera
+ double getHeightFromFloor() const; // Get the height of the camera from the floor
+ void setHeightFromFloor(double height); // Set the height of the camera from the floor
+ void modifyHorizontalAngleRotation(int screenDistance, float fps); // Modify the horizontal camera rotation angle
+ void modifyVerticalAngleRotation(int screenDistance, float fps); // Modify the vertical camera rotation angle
+ void increaseDistance(float fps); // Increase the distance of the camera from the origin
+ void decreaseDistance(float fps); // Decrease the distance of the camera from the origin
+};
+
+// Compute the new view vector of the camera (inline function)
+inline void OutSideCamera::updateViewVector() {
+ viewVector = Vector3D(0.0, 0.0, 0.0) - position;
+}
+
+// Get the height of the camera from the floor (inline function)
+inline double OutSideCamera::getHeightFromFloor() const {
+ return heightFromFloor;
+}
+
+// Set the height of the camera from the floor (inline function)
+inline void OutSideCamera::setHeightFromFloor(double height) {
+ heightFromFloor = height;
+}
+
+#endif