Solid.h

Go to the documentation of this file.
00001 /*************************************************************************
00002 *                                                                       *
00003 * Open Physics Abstraction Layer                                        *
00004 * Copyright (C) 2004-2005                                               *
00005 * Alan Fischer  alan.fischer@gmail.com                                  *
00006 * Andres Reinot  andres@reinot.com                                      *
00007 * Tyler Streeter  tylerstreeter@gmail.com                               *
00008 * All rights reserved.                                                  *
00009 * Web: opal.sourceforge.net                                             *
00010 *                                                                       *
00011 * This library is free software; you can redistribute it and/or         *
00012 * modify it under the terms of EITHER:                                  *
00013 *   (1) The GNU Lesser General Public License as published by the Free  *
00014 *       Software Foundation; either version 2.1 of the License, or (at  *
00015 *       your option) any later version. The text of the GNU Lesser      *
00016 *       General Public License is included with this library in the     *
00017 *       file license-LGPL.txt.                                          *
00018 *   (2) The BSD-style license that is included with this library in     *
00019 *       the file license-BSD.txt.                                       *
00020 *                                                                       *
00021 * This library is distributed in the hope that it will be useful,       *
00022 * but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00023 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files    *
00024 * license-LGPL.txt and license-BSD.txt for more details.                *
00025 *                                                                       *
00026 *************************************************************************/
00027 
00028 #ifndef OPAL_SOLID_H
00029 #define OPAL_SOLID_H
00030 
00031 // project headers
00032 #include "CollisionEventHandler.h"
00033 #include "Defines.h"
00034 #include "MovementEventHandler.h"
00035 #include "SolidData.h"
00036 
00037 namespace opal
00038 {
00039         class Mass;
00040         class Simulator;
00041         class Space;
00042         class ShapeData;
00043 
00049         class Solid
00050         {
00051                 public:
00052                         Solid();
00053 
00057                         virtual void OPAL_CALL init( const SolidData& data ) = 0;
00058 
00060                         virtual const SolidData& OPAL_CALL getData();
00061 
00063                         virtual void OPAL_CALL setName( const std::string& name );
00064 
00066                         virtual const std::string& OPAL_CALL getName() const;
00067 
00069                         virtual bool OPAL_CALL isEnabled() const;
00070 
00074                         virtual void OPAL_CALL setEnabled( bool e );
00075 
00077                         virtual bool OPAL_CALL isStatic() const;
00078 
00080                         virtual void OPAL_CALL setStatic( bool s ) = 0;
00081 
00084                         virtual void OPAL_CALL setSpace( Space* newSpace ) = 0;
00085 
00088                         virtual void OPAL_CALL setSleeping( bool sleeping ) = 0;
00089 
00092                         virtual bool OPAL_CALL isSleeping() const = 0;
00093 
00095                         virtual void OPAL_CALL setSleepiness( real s );
00096 
00098                         virtual real OPAL_CALL getSleepiness() const;
00099 
00101                         virtual void OPAL_CALL setLinearDamping( real ld );
00102 
00104                         virtual real OPAL_CALL getLinearDamping() const;
00105 
00107                         virtual void OPAL_CALL setAngularDamping( real ad );
00108 
00110                         virtual real OPAL_CALL getAngularDamping() const;
00111 
00116                         virtual void OPAL_CALL setUserData( void* data );
00117 
00119                         virtual void* OPAL_CALL getUserData() const;
00120 
00122                         virtual void OPAL_CALL setTransform( const Matrix44r& t );
00123 
00125                         virtual const Matrix44r& OPAL_CALL getTransform() const;
00126 
00128                         virtual void OPAL_CALL setPosition( real x, real y, real z );
00129 
00131                         virtual void OPAL_CALL setPosition( const Point3r & p );
00132 
00134                         virtual Point3r OPAL_CALL getPosition() const;
00135 
00137                         virtual Vec3r OPAL_CALL getEulerXYZ() const;
00138 
00140                         virtual Quaternion OPAL_CALL getQuaternion() const;
00141 
00143                         virtual void OPAL_CALL setQuaternion( const Quaternion & q );
00144 
00146                         virtual void OPAL_CALL setQuaternion( real w, real x, real y, real z );
00147 
00150                         virtual void OPAL_CALL getLocalAABB( real aabb[ 6 ] ) const;
00151 
00154                         virtual void OPAL_CALL getGlobalAABB( real aabb[ 6 ] ) const;
00155 
00158                         virtual void OPAL_CALL clearShapes() = 0;
00159 
00162                         virtual void OPAL_CALL addShape( ShapeData& data ) = 0;
00163 
00167                         virtual void OPAL_CALL addForce( const Force& f );
00168 
00170                         virtual void OPAL_CALL zeroForces() = 0;
00171 
00173                         virtual void OPAL_CALL setLocalLinearVel( const Vec3r& vel ) = 0;
00174 
00176                         virtual Vec3r OPAL_CALL getLocalLinearVel() const = 0;
00177 
00180                         virtual Vec3r OPAL_CALL getLocalLinearVelAtLocalPos(
00181                             const Point3r& p ) const = 0;
00182 
00184                         virtual void OPAL_CALL setLocalAngularVel( const Vec3r& vel ) = 0;
00185 
00187                         virtual Vec3r OPAL_CALL getLocalAngularVel() const = 0;
00188 
00190                         virtual void OPAL_CALL setGlobalLinearVel( const Vec3r& vel ) = 0;
00191 
00193                         virtual Vec3r OPAL_CALL getGlobalLinearVel() const = 0;
00194 
00197                         virtual Vec3r OPAL_CALL getGlobalLinearVelAtLocalPos(
00198                             const Point3r& p ) const = 0;
00199 
00201                         virtual void OPAL_CALL setGlobalAngularVel( const Vec3r& vel ) = 0;
00202 
00204                         virtual Vec3r OPAL_CALL getGlobalAngularVel() const = 0;
00205 
00207                         virtual void OPAL_CALL setMass( const Mass & newmass, const Matrix44r & offset ) = 0;
00208 
00211                         virtual void OPAL_CALL translateMass( const Vec3r& offset ) = 0;
00212 
00214                         virtual void OPAL_CALL setCollisionEventHandler(
00215                             CollisionEventHandler* eventHandler );
00216 
00219                         virtual CollisionEventHandler* OPAL_CALL
00220                         getCollisionEventHandler() const;
00221 
00224                         //virtual void OPAL_CALL setFastRotation(bool fast);
00225 
00226                         //virtual bool OPAL_CALL getFastRotation()const;
00227 
00228                         //virtual void OPAL_CALL setFastRotationAxis(Vec3r axis);
00229 
00232                         virtual real OPAL_CALL getMass() const = 0;
00233 
00236                         virtual Matrix44r OPAL_CALL getInertiaTensor() const = 0;
00237 
00239                         virtual bool OPAL_CALL isMoving() const;
00240 
00242                         virtual void OPAL_CALL setMovingState( bool moving );
00243 
00245                         virtual void OPAL_CALL setMovementEventHandler(
00246                             MovementEventHandler* eventHandler );
00247 
00250                         virtual MovementEventHandler* OPAL_CALL getMovementEventHandler() const;
00251 
00253                         virtual void OPAL_CALL internal_updateOPALTransform() = 0;
00254 
00256                         virtual void OPAL_CALL internal_updateEngineTransform() = 0;
00257 
00259                         virtual void OPAL_CALL internal_applyForces( real stepSize );
00260 
00262                         void internal_updateSleeping();
00263 
00265                         virtual void OPAL_CALL internal_destroy();
00266 
00267                 protected:
00268                         virtual ~Solid();
00269 
00272                         virtual void applyForce( const Force& f ) = 0;
00273 
00275                         void addToLocalAABB( const real aabb[ 6 ] );
00276 
00278                         void resetAABB();
00279 
00281                         std::vector<Force> mForceList;
00282 
00284                         SolidData mData;
00285 
00290                         real mLocalAABB[ 6 ];
00291 
00293                         CollisionEventHandler* mCollisionEventHandler;
00294 
00297                         void* mUserData;
00298 
00300                 private:
00301                         mutable bool mIsMoving;
00302                         MovementEventHandler* mMovementEventHandler;
00303         };
00304 }
00305 
00306 #endif
00307 

Generated on Tue May 16 17:49:52 2006 for OPAL by  doxygen 1.4.6-NO