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 PHY_CONTACT_H 00028 #define PHY_CONTACT_H 00029 00030 #include <PVLE/Physics/SurfaceParams.h> 00031 #include <PVLE/Physics/Converters.h> 00032 #include <ode/ode.h> 00033 #include <osg/Vec3> 00034 #include <boost/cast.hpp> 00035 00036 namespace Physics { 00037 00038 //class AbstractGeom; 00039 class Geom; 00040 00043 class Contact : protected dContact { 00044 friend class Geom; 00045 friend class Joint; 00046 friend class NearCallback; 00047 00048 public: 00049 osg::Vec3 getPos() const { return toGraphVec3(geom.pos); } 00050 osg::Vec3 getNormal() const { return toGraphVec3(geom.normal); } 00051 dReal getDepth() const { return geom.depth; } 00052 Geom * getGeom1() const { return static_cast<Geom*>(dGeomGetData(geom.g1)); } 00053 Geom * getGeom2() const { return static_cast<Geom*>(dGeomGetData(geom.g2)); } 00054 00055 osg::Vec3 getFrictionDir() const { return toGraphVec3(fdir1); } 00056 SurfaceParams & getSurfaceParams() { return SurfaceParams::asSurfaceParams(surface); } 00057 const SurfaceParams & getSurfaceParams() const { return SurfaceParams::asSurfaceParams(surface); } 00058 00060 dReal arithmeticCineticEnergy; 00061 }; 00062 00063 00064 } // namespace Physics 00065 00066 00067 #endif // PHY_CONTACT_H