mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-06 11:51:58 -04:00
*** empty log message ***
This commit is contained in:
parent
4bc982d242
commit
7315d16487
@ -50,6 +50,14 @@ operator = (const CollisionHandlerEvent::SortEntries &) {
|
|||||||
// The event name will be based on the in_pattern
|
// The event name will be based on the in_pattern
|
||||||
// string specified here, with all occurrences of the
|
// string specified here, with all occurrences of the
|
||||||
// above strings replaced with the corresponding values.
|
// 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::
|
INLINE void CollisionHandlerEvent::
|
||||||
set_in_pattern(const string &in_pattern) {
|
set_in_pattern(const string &in_pattern) {
|
||||||
@ -68,6 +76,42 @@ get_in_pattern() const {
|
|||||||
return _in_pattern;
|
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
|
// Function: CollisionHandlerEvent::set_out_pattern
|
||||||
@ -78,12 +122,11 @@ get_in_pattern() const {
|
|||||||
//
|
//
|
||||||
// In general, the in_pattern event is thrown on the
|
// In general, the in_pattern event is thrown on the
|
||||||
// first detection of a collision between two particular
|
// first detection of a collision between two particular
|
||||||
// nodes. Thereafter, as long as a collision between
|
// nodes. In subsequent passes, as long as a collision
|
||||||
// those two nodes continues to be detected each frame,
|
// between those two nodes continues to be detected each
|
||||||
// no further events (associated with this particular
|
// frame, the again_pattern is thrown. The first frame
|
||||||
// pair of nodes) are thrown. The first frame in which
|
// in which the collision is no longer detected, the
|
||||||
// the collision is no longer detected, the out_pattern
|
// out_pattern event is thrown.
|
||||||
// event is thrown.
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
INLINE void CollisionHandlerEvent::
|
INLINE void CollisionHandlerEvent::
|
||||||
set_out_pattern(const string &out_pattern) {
|
set_out_pattern(const string &out_pattern) {
|
||||||
|
@ -105,6 +105,7 @@ end_group() {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
// This element is in both b and a. It hasn't changed.
|
// This element is in both b and a. It hasn't changed.
|
||||||
|
throw_event_pattern(_again_pattern, *cb);
|
||||||
++ca;
|
++ca;
|
||||||
++cb;
|
++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
|
// Function: CollisionHandlerEvent::throw_event_pattern
|
||||||
// Access: Private
|
// Access: Private
|
||||||
|
@ -35,13 +35,18 @@ public:
|
|||||||
PUBLISHED:
|
PUBLISHED:
|
||||||
INLINE void set_in_pattern(const string &pattern);
|
INLINE void set_in_pattern(const string &pattern);
|
||||||
INLINE string get_in_pattern() const;
|
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 void set_out_pattern(const string &pattern);
|
||||||
INLINE string get_out_pattern() const;
|
INLINE string get_out_pattern() const;
|
||||||
|
|
||||||
|
void clear();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void throw_event_pattern(const string &pattern, CollisionEntry *entry);
|
void throw_event_pattern(const string &pattern, CollisionEntry *entry);
|
||||||
|
|
||||||
string _in_pattern;
|
string _in_pattern;
|
||||||
|
string _again_pattern;
|
||||||
string _out_pattern;
|
string _out_pattern;
|
||||||
|
|
||||||
int _index;
|
int _index;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user