CollisionEventHandler.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_COLLISION_EVENT_HANDLER_H
00029 #define OPAL_COLLISION_EVENT_HANDLER_H
00030 
00031 // project headers
00032 #include "Defines.h"
00033 #include "EventHandler.h"
00034 
00035 namespace opal
00036 {
00037         class Solid;
00038 
00041         struct CollisionEvent
00042         {
00043                 CollisionEvent()
00044                 {
00045                         thisSolid = NULL;
00046                         otherSolid = NULL;
00047                         // "pos" is initialized in its own constructor.
00048                         // "normal" is initialized in its own constructor.
00049                         depth = 0;
00050                 }
00051 
00053                 Solid* thisSolid;
00054 
00057                 Solid* otherSolid;
00058 
00060                 Point3r pos;
00061 
00063                 Vec3r normal;
00064 
00068                 real depth;
00069         };
00070 
00075         class CollisionEventHandler : public EventHandler
00076         {
00077                 public:
00078                         OPAL_DECL CollisionEventHandler();
00079 
00080                         OPAL_DECL virtual ~CollisionEventHandler();
00081 
00085                         OPAL_DECL virtual void OPAL_CALL handleCollisionEvent(
00086                             const CollisionEvent& e ) = 0;
00087 
00090                         OPAL_DECL virtual void OPAL_CALL internal_pushCollisionEvent(
00091                             const CollisionEvent& e );
00092 
00095                         OPAL_DECL virtual void OPAL_CALL
00096                         internal_handlePendingCollisionEvents();
00097 
00098                 protected:
00101                         std::vector<CollisionEvent> mPendingCollisionEvents;
00102 
00103                 private:
00104 
00105         };
00106 }
00107 
00108 #endif
00109 

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