Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/collide/collisionHandlerEvent.I

Go to the documentation of this file.
00001 // Filename: collisionHandlerEvent.I
00002 // Created by:  drose (16Mar02)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 
00020 ////////////////////////////////////////////////////////////////////
00021 //     Function: CollisionHandlerEvent::SortEntries::operator ()
00022 //       Access: Public
00023 //  Description: Orders the CollisionEntries in the set so that there
00024 //               is one entry for each node/node intersection
00025 //               detected.
00026 ////////////////////////////////////////////////////////////////////
00027 INLINE bool CollisionHandlerEvent::SortEntries::
00028 operator () (const PT(CollisionEntry) &a,
00029              const PT(CollisionEntry) &b) const {
00030   if (a->get_from_node() != b->get_from_node()) {
00031     return a->get_from_node() < b->get_from_node();
00032   }
00033   if (a->get_into_node() != b->get_into_node()) {
00034     return a->get_into_node() < b->get_into_node();
00035   }
00036   return false;
00037 }
00038 
00039 ////////////////////////////////////////////////////////////////////
00040 //     Function: CollisionHandlerEvent::SortEntries::operator =
00041 //       Access: Public
00042 //  Description: The assignment operator does absolutely nothing,
00043 //               since this is just a function object class that
00044 //               stores no data.  We define it just to quiet up g++ in
00045 //               -Wall mode.
00046 ////////////////////////////////////////////////////////////////////
00047 INLINE void CollisionHandlerEvent::SortEntries::
00048 operator = (const CollisionHandlerEvent::SortEntries &) {
00049 }
00050 
00051 ////////////////////////////////////////////////////////////////////
00052 //     Function: CollisionHandlerEvent::set_in_pattern
00053 //       Access: Public
00054 //  Description: Sets the pattern string that indicates how the event
00055 //               names are generated for each collision detected.
00056 //               This is a string that may contain any of the
00057 //               following:
00058 //
00059 //                  %fn  - the name of the "from" object's node
00060 //                  %in  - the name of the "into" object's node
00061 //                  %ft  - 't' if "from" is tangible, 'i' if intangible
00062 //                  %it  - 't' if "into" is tangible, 'i' if intangible
00063 //
00064 //               The event name will be based on the in_pattern
00065 //               string specified here, with all occurrences of the
00066 //               above strings replaced with the corresponding values.
00067 //
00068 //               In general, the in_pattern event is thrown on the
00069 //               first detection of a collision between two particular
00070 //               nodes.  In subsequent passes, as long as a collision
00071 //               between those two nodes continues to be detected each
00072 //               frame, the again_pattern is thrown.  The first frame
00073 //               in which the collision is no longer detected, the
00074 //               out_pattern event is thrown.
00075 ////////////////////////////////////////////////////////////////////
00076 INLINE void CollisionHandlerEvent::
00077 set_in_pattern(const string &in_pattern) {
00078   _in_pattern = in_pattern;
00079 }
00080 
00081 ////////////////////////////////////////////////////////////////////
00082 //     Function: CollisionHandlerEvent::get_in_pattern
00083 //       Access: Public
00084 //  Description: Returns the pattern string that indicates how the
00085 //               event names are generated for each collision
00086 //               detected.  See set_in_pattern().
00087 ////////////////////////////////////////////////////////////////////
00088 INLINE string CollisionHandlerEvent::
00089 get_in_pattern() const {
00090   return _in_pattern;
00091 }
00092 
00093 ////////////////////////////////////////////////////////////////////
00094 //     Function: CollisionHandlerEvent::set_again_pattern
00095 //       Access: Public
00096 //  Description: Sets the pattern string that indicates how the event
00097 //               names are generated when a collision between two
00098 //               particular nodes is *still* detected.  This event is
00099 //               thrown each consecutive time a collision between two
00100 //               particular nodes is detected, starting with the
00101 //               second time.
00102 //
00103 //               In general, the in_pattern event is thrown on the
00104 //               first detection of a collision between two particular
00105 //               nodes.  In subsequent passes, as long as a collision
00106 //               between those two nodes continues to be detected each
00107 //               frame, the again_pattern is thrown.  The first frame
00108 //               in which the collision is no longer detected, the
00109 //               out_pattern event is thrown.
00110 ////////////////////////////////////////////////////////////////////
00111 INLINE void CollisionHandlerEvent::
00112 set_again_pattern(const string &again_pattern) {
00113   _again_pattern = again_pattern;
00114 }
00115 
00116 ////////////////////////////////////////////////////////////////////
00117 //     Function: CollisionHandlerEvent::get_again_pattern
00118 //       Access: Public
00119 //  Description: Returns the pattern string that indicates how the
00120 //               event names are generated when a collision between
00121 //               two particular nodes is *still* detected.  See
00122 //               set_again_pattern() and set_in_pattern().
00123 ////////////////////////////////////////////////////////////////////
00124 INLINE string CollisionHandlerEvent::
00125 get_again_pattern() const {
00126   return _again_pattern;
00127 }
00128 
00129 
00130 ////////////////////////////////////////////////////////////////////
00131 //     Function: CollisionHandlerEvent::set_out_pattern
00132 //       Access: Public
00133 //  Description: Sets the pattern string that indicates how the event
00134 //               names are generated when a collision between two
00135 //               particular nodes is *no longer* detected.
00136 //
00137 //               In general, the in_pattern event is thrown on the
00138 //               first detection of a collision between two particular
00139 //               nodes.  In subsequent passes, as long as a collision
00140 //               between those two nodes continues to be detected each
00141 //               frame, the again_pattern is thrown.  The first frame
00142 //               in which the collision is no longer detected, the
00143 //               out_pattern event is thrown.
00144 ////////////////////////////////////////////////////////////////////
00145 INLINE void CollisionHandlerEvent::
00146 set_out_pattern(const string &out_pattern) {
00147   _out_pattern = out_pattern;
00148 }
00149 
00150 ////////////////////////////////////////////////////////////////////
00151 //     Function: CollisionHandlerEvent::get_out_pattern
00152 //       Access: Public
00153 //  Description: Returns the pattern string that indicates how the
00154 //               event names are generated when a collision between
00155 //               two particular nodes is *no longer* detected.  See
00156 //               set_out_pattern() and set_in_pattern().
00157 ////////////////////////////////////////////////////////////////////
00158 INLINE string CollisionHandlerEvent::
00159 get_out_pattern() const {
00160   return _out_pattern;
00161 }
00162 

Generated on Fri May 2 00:35:30 2003 for Panda by doxygen1.3