00001 //----------------------------------------------------------------------------------- 00002 // 00003 // Pro-Vocation Light Engine (PVLE) 00004 // Copyright (C) 2007-2009 Sukender, KinoX & Buzib 00005 // For more information, contact us : sukender@free.fr 00006 // 00007 // This program is free software; you can redistribute it and/or modify 00008 // it under the terms of the GNU General Public License as published by 00009 // the Free Software Foundation; either version 3 of the License, or 00010 // (at your option) any later version. 00011 // 00012 // For any use that is not compatible with the terms of the GNU 00013 // General Public License, please contact the authors for alternative 00014 // licensing options. 00015 // 00016 // This program is distributed in the hope that it will be useful, 00017 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 // GNU General Public License for more details. 00020 // 00021 // You should have received a copy of the GNU General Public License along 00022 // with this program; if not, write to the Free Software Foundation, Inc., 00023 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00024 // 00025 //----------------------------------------------------------------------------------- 00026 00027 #ifndef ENT_GEOM_COLLISION_CONTAINER_H 00028 #define ENT_GEOM_COLLISION_CONTAINER_H 00029 00030 #include <PVLE/Export.h> 00031 #include <osg/Referenced> 00032 00033 namespace Physics { 00034 class Contact; 00035 class Geom; 00036 class Body; 00037 } 00038 00039 00040 class C3DPhy; 00041 class UnpilotedUnit; 00042 class Zone; 00043 class Ammo; 00044 00049 class PVLE_EXPORT IGeomCollisionContainer : public virtual osg::Referenced { 00050 public: 00051 enum EContainerType { C3DPHY, UNIT, ZONE, AMMO, OTHER }; 00052 virtual EContainerType getType() const =0; 00053 00054 virtual C3DPhy * as3DPhy() { return 0; } 00055 virtual UnpilotedUnit * asUnit() { return 0; } 00056 virtual Zone * asZone() { return 0; } 00057 virtual Ammo * asAmmo() { return 0; } 00058 virtual const char* className() const = 0; 00059 00060 /* 00061 // Bad, but simpler :P (avoids derivates to define also const versions) - Of course, non-const methods must only return "this" pointer (must not do anything non const, actually) 00062 const C3DPhy * as3DPhy() const { return const_cast<IGeomCollisionContainer*>(this)->as3DPhy(); } 00063 const UnpilotedUnit * asUnit() const { return const_cast<IGeomCollisionContainer*>(this)->asUnit(); } 00064 const Zone * asZone() const { return const_cast<IGeomCollisionContainer*>(this)->asZone(); } 00065 const Ammo * asAmmo() const { return const_cast<IGeomCollisionContainer*>(this)->asAmmo(); } 00066 */ 00067 00068 /* 00070 virtual Physics::Geom * getGeom() =0; 00071 */ 00072 00082 virtual bool hitBefore(Physics::Contact * pContacts, unsigned int nbContacts, Physics::Contact * pMaxEnergyContact, Physics::Geom & thisGeom, Physics::Geom & otherGeom, Physics::Body *& inout_pThisBody, Physics::Body *& inout_pOtherBody) =0; 00083 00086 virtual void hitAfter(Physics::Contact * pContacts, unsigned int nbContacts, Physics::Contact * pMaxEnergyContact, Physics::Geom & thisGeom, Physics::Geom & otherGeom, bool contactJointCreated) {} 00087 00088 //void addCallback(); 00089 00090 protected: 00093 virtual ~IGeomCollisionContainer() {} 00094 }; 00095 00096 00097 #endif // ENT_GEOM_COLLISION_CONTAINER_H