2009-02-04 14:43:33 +00:00
/****************************************************************************
* Copyright ( C ) 2009 Daniel Chappuis *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This file is part of ReactPhysics3D . *
* *
* ReactPhysics3D is free software : you can redistribute it and / or modify *
2009-06-05 14:22:40 +00:00
* it under the terms of the GNU Lesser General Public License as published *
* by the Free Software Foundation , either version 3 of the License , or *
2009-02-04 14:43:33 +00:00
* ( 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 *
2009-06-05 14:22:40 +00:00
* GNU Lesser General Public License for more details . *
2009-02-04 14:43:33 +00:00
* *
2009-06-05 14:22:40 +00:00
* You should have received a copy of the GNU Lesser General Public License *
2009-02-04 14:43:33 +00:00
* along with ReactPhysics3D . If not , see < http : //www.gnu.org/licenses/>. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
# ifndef OBJECTS_H
# define OBJECTS_H
// Libraries
# include "../reactphysics3d/reactphysics3d.h"
// Namespaces
using namespace reactphysics3d ;
/*
Here we define all the objects that can appear in the simulation like cube , sphere , plane , . . .
*/
// ----- Class Object (abstract) ----- //
// Represent an object of the simulation
2009-02-13 11:26:51 +00:00
class Object {
protected :
RigidBody * rigidBody ; // Rigid Body that represents the object
2009-02-04 14:43:33 +00:00
2009-02-13 11:26:51 +00:00
public :
2009-08-04 12:21:15 +00:00
Object ( const Vector3D & position , const Quaternion & orientation , const Kilogram & mass , const Matrix3x3 & inertiaTensor , const OBB & obb ) ; // Constructor of the class Object
virtual ~ Object ( ) ; // Destructor of the class Object
2009-02-13 11:26:51 +00:00
2009-07-21 20:28:27 +00:00
virtual void draw ( ) const = 0 ; // pure virtual method to draw the object
RigidBody * getRigidBody ( ) ; // Return the pointer to the rigid body
2009-02-04 14:43:33 +00:00
} ;
// ----- Class Cube ----- //
// Represente a Cube in the simulation
class Cube : public Object {
private :
2009-02-13 11:26:51 +00:00
float size ; // Size of a side in the cube
static const Matrix3x3 inertiaTensor ; // Inertia tensor of a cube
2009-02-04 14:43:33 +00:00
public :
2009-08-04 12:21:15 +00:00
Cube ( const Vector3D & position , const Quaternion & orientation , float size , const Kilogram & mass ) ; // Constructor of the class cube
virtual ~ Cube ( ) ; // Destructor of the class cube
virtual void draw ( ) const ; // Method to draw the cube
2009-02-04 14:43:33 +00:00
} ;
// ----- Class Plane ---- //
// Represent a plane in the simulation
class Plane : public Object {
2009-02-13 11:26:51 +00:00
private :
2009-07-21 20:28:27 +00:00
float width ; // Width of the plane
float height ; // Height of the plane
Vector3D d1 ; // Unit vector in the plane
Vector3D d2 ; // Unit vector in the plane
Vector3D normalVector ; // Unit normal vector of the plane
2009-02-13 11:26:51 +00:00
2009-02-04 14:43:33 +00:00
public :
2009-08-04 12:21:15 +00:00
Plane ( const Vector3D & position , const Quaternion & orientation , float width , float height , const Vector3D & d1 , const Vector3D & d2 , const Kilogram & mass ) ; // Constructor of the class Plane
virtual ~ Plane ( ) ; // Destructor of the class Plane
virtual void draw ( ) const ; // Method to draw the plane
2009-02-04 14:43:33 +00:00
} ;
# endif