mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
define flatten-collision-nodes
This commit is contained in:
parent
3971dfc49b
commit
cb1c87d58c
@ -145,6 +145,7 @@ xform(const LMatrix4f &mat) {
|
||||
////////////////////////////////////////////////////////////////////
|
||||
PandaNode *CollisionNode::
|
||||
combine_with(PandaNode *other) {
|
||||
if (flatten_collision_nodes) {
|
||||
if (is_exact_type(get_class_type()) &&
|
||||
other->is_exact_type(get_class_type())) {
|
||||
// Two CollisionNodes can combine, but only if they have the same
|
||||
@ -161,11 +162,12 @@ combine_with(PandaNode *other) {
|
||||
return this;
|
||||
}
|
||||
|
||||
// Two CollisionNodes with different names can't combine.
|
||||
return (PandaNode *)NULL;
|
||||
// Two CollisionNodes with different names or different collide
|
||||
// masks can't combine.
|
||||
}
|
||||
}
|
||||
|
||||
return PandaNode::combine_with(other);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
@ -73,6 +73,17 @@ ConfigVariableBool allow_collider_multiple
|
||||
"false, a one-word BitMask is always used instead, which is faster "
|
||||
"per pass, but may require more passes."));
|
||||
|
||||
ConfigVariableBool flatten_collision_nodes
|
||||
("flatten-collision-nodes", false,
|
||||
PRC_DESC("Set this true to allow NodePath::flatten_medium() and "
|
||||
"flatten_strong() to combine multiple CollisionNodes "
|
||||
"into a single CollisionNode--but only if they share the "
|
||||
"same name and collide masks. When false, CollisionNodes "
|
||||
"are never combined. This is false by default, since "
|
||||
"collision tests rely heavily on bounding volume tests "
|
||||
"to be efficient, and combining CollisionNodes is likely "
|
||||
"to merge bounding volumes inappropriately."));
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: init_libcollide
|
||||
|
@ -28,6 +28,7 @@ NotifyCategoryDecl(collide, EXPCL_PANDA, EXPTP_PANDA);
|
||||
extern EXPCL_PANDA ConfigVariableBool respect_prev_transform;
|
||||
extern EXPCL_PANDA ConfigVariableBool respect_effective_normal;
|
||||
extern EXPCL_PANDA ConfigVariableBool allow_collider_multiple;
|
||||
extern EXPCL_PANDA ConfigVariableBool flatten_collision_nodes;
|
||||
|
||||
extern EXPCL_PANDA void init_libcollide();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user