*** empty log message ***

This commit is contained in:
David Rose 2001-01-31 22:27:46 +00:00
parent 4bc982d242
commit 7315d16487
3 changed files with 76 additions and 6 deletions

View File

@ -50,6 +50,14 @@ operator = (const CollisionHandlerEvent::SortEntries &) {
// The event name will be based on the in_pattern
// string specified here, with all occurrences of the
// above strings replaced with the corresponding values.
//
// In general, the in_pattern event is thrown on the
// first detection of a collision between two particular
// nodes. In subsequent passes, as long as a collision
// between those two nodes continues to be detected each
// frame, the again_pattern is thrown. The first frame
// in which the collision is no longer detected, the
// out_pattern event is thrown.
////////////////////////////////////////////////////////////////////
INLINE void CollisionHandlerEvent::
set_in_pattern(const string &in_pattern) {
@ -68,6 +76,42 @@ get_in_pattern() const {
return _in_pattern;
}
////////////////////////////////////////////////////////////////////
// Function: CollisionHandlerEvent::set_again_pattern
// Access: Public
// Description: Sets the pattern string that indicates how the event
// names are generated when a collision between two
// particular nodes is *still* detected. This event is
// each consecutive time a collision between two
// particular nodes is detected, starting with the
// second time.
//
// In general, the in_pattern event is thrown on the
// first detection of a collision between two particular
// nodes. In subsequent passes, as long as a collision
// between those two nodes continues to be detected each
// frame, the again_pattern is thrown. The first frame
// in which the collision is no longer detected, the
// out_pattern event is thrown.
////////////////////////////////////////////////////////////////////
INLINE void CollisionHandlerEvent::
set_again_pattern(const string &again_pattern) {
_again_pattern = again_pattern;
}
////////////////////////////////////////////////////////////////////
// Function: CollisionHandlerEvent::get_again_pattern
// Access: Public
// Description: Returns the pattern string that indicates how the
// event names are generated when a collision between
// two particular nodes is *still* detected. See
// set_again_pattern() and set_in_pattern().
////////////////////////////////////////////////////////////////////
INLINE string CollisionHandlerEvent::
get_again_pattern() const {
return _again_pattern;
}
////////////////////////////////////////////////////////////////////
// Function: CollisionHandlerEvent::set_out_pattern
@ -78,12 +122,11 @@ get_in_pattern() const {
//
// In general, the in_pattern event is thrown on the
// first detection of a collision between two particular
// nodes. Thereafter, as long as a collision between
// those two nodes continues to be detected each frame,
// no further events (associated with this particular
// pair of nodes) are thrown. The first frame in which
// the collision is no longer detected, the out_pattern
// event is thrown.
// nodes. In subsequent passes, as long as a collision
// between those two nodes continues to be detected each
// frame, the again_pattern is thrown. The first frame
// in which the collision is no longer detected, the
// out_pattern event is thrown.
////////////////////////////////////////////////////////////////////
INLINE void CollisionHandlerEvent::
set_out_pattern(const string &out_pattern) {

View File

@ -105,6 +105,7 @@ end_group() {
} else {
// This element is in both b and a. It hasn't changed.
throw_event_pattern(_again_pattern, *cb);
++ca;
++cb;
}
@ -125,6 +126,27 @@ end_group() {
}
}
////////////////////////////////////////////////////////////////////
// Function: CollisionHandlerEvent::clear
// Access: Public
// Description: Empties the list of elements that all colliders are
// known to be colliding with. No "out" events will be
// thrown; if the same collision is detected next frame,
// a new "in" event will be thrown for each collision.
//
// This can be called each frame to defeat the
// persistant "in" event mechanism, which prevents the
// same "in" event from being thrown repeatedly.
// However, also see set_again_pattern(), which can be
// used to set the event that is thrown when a collision
// is detected for more than one consecutive frames.
////////////////////////////////////////////////////////////////////
void CollisionHandlerEvent::
clear() {
_last_colliding.clear();
_current_colliding.clear();
}
////////////////////////////////////////////////////////////////////
// Function: CollisionHandlerEvent::throw_event_pattern
// Access: Private

View File

@ -35,13 +35,18 @@ public:
PUBLISHED:
INLINE void set_in_pattern(const string &pattern);
INLINE string get_in_pattern() const;
INLINE void set_again_pattern(const string &pattern);
INLINE string get_again_pattern() const;
INLINE void set_out_pattern(const string &pattern);
INLINE string get_out_pattern() const;
void clear();
private:
void throw_event_pattern(const string &pattern, CollisionEntry *entry);
string _in_pattern;
string _again_pattern;
string _out_pattern;
int _index;