mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
fluid capping options
This commit is contained in:
parent
31fb723776
commit
6a0d9b0a3b
@ -19,6 +19,7 @@
|
|||||||
#include "collisionLevelStateBase.h"
|
#include "collisionLevelStateBase.h"
|
||||||
#include "collisionSolid.h"
|
#include "collisionSolid.h"
|
||||||
#include "collisionNode.h"
|
#include "collisionNode.h"
|
||||||
|
#include "config_collide.h"
|
||||||
#include "dcast.h"
|
#include "dcast.h"
|
||||||
|
|
||||||
PStatCollector CollisionLevelStateBase::_node_volume_pcollector("Collision Volumes:PandaNode");
|
PStatCollector CollisionLevelStateBase::_node_volume_pcollector("Collision Volumes:PandaNode");
|
||||||
@ -75,6 +76,11 @@ prepare_collider(const ColliderDef &def, const NodePath &root) {
|
|||||||
// with. That makes things complicated!
|
// with. That makes things complicated!
|
||||||
if (bv->as_bounding_sphere()) {
|
if (bv->as_bounding_sphere()) {
|
||||||
LPoint3f pos_delta = def._node_path.get_pos_delta(root);
|
LPoint3f pos_delta = def._node_path.get_pos_delta(root);
|
||||||
|
|
||||||
|
LVector3f cap(pos_delta);
|
||||||
|
if(cap.length()>fluid_cap_amount) {
|
||||||
|
pos_delta=LPoint3f(cap/cap.length())*fluid_cap_amount;
|
||||||
|
}
|
||||||
if (pos_delta != LVector3f::zero()) {
|
if (pos_delta != LVector3f::zero()) {
|
||||||
// If the node has a delta, we have to include the starting
|
// If the node has a delta, we have to include the starting
|
||||||
// position in the volume as well. We only do this for bounding
|
// position in the volume as well. We only do this for bounding
|
||||||
@ -84,6 +90,7 @@ prepare_collider(const ColliderDef &def, const NodePath &root) {
|
|||||||
LMatrix4f inv_trans = LMatrix4f::translate_mat(-pos_delta);
|
LMatrix4f inv_trans = LMatrix4f::translate_mat(-pos_delta);
|
||||||
PT(GeometricBoundingVolume) gbv_prev;
|
PT(GeometricBoundingVolume) gbv_prev;
|
||||||
gbv_prev = DCAST(GeometricBoundingVolume, bv->make_copy());
|
gbv_prev = DCAST(GeometricBoundingVolume, bv->make_copy());
|
||||||
|
|
||||||
gbv_prev->xform(inv_trans);
|
gbv_prev->xform(inv_trans);
|
||||||
gbv->extend_by(gbv_prev);
|
gbv->extend_by(gbv_prev);
|
||||||
}
|
}
|
||||||
|
@ -30,9 +30,11 @@
|
|||||||
#include "plist.h"
|
#include "plist.h"
|
||||||
#include "pStatCollector.h"
|
#include "pStatCollector.h"
|
||||||
#include "bitMask.h"
|
#include "bitMask.h"
|
||||||
|
#include "lvector3.h"
|
||||||
#include "register_type.h"
|
#include "register_type.h"
|
||||||
#include "collisionSolid.h"
|
#include "collisionSolid.h"
|
||||||
|
|
||||||
|
|
||||||
class CollisionSolid;
|
class CollisionSolid;
|
||||||
class CollisionNode;
|
class CollisionNode;
|
||||||
|
|
||||||
|
@ -86,6 +86,9 @@ ConfigVariableBool flatten_collision_nodes
|
|||||||
"to be efficient, and combining CollisionNodes is likely "
|
"to be efficient, and combining CollisionNodes is likely "
|
||||||
"to merge bounding volumes inappropriately."));
|
"to merge bounding volumes inappropriately."));
|
||||||
|
|
||||||
|
ConfigVariableInt fluid_cap_amount
|
||||||
|
("fluid-cap-amount", 100,
|
||||||
|
PRC_DESC("ensures that fluid pos doesn't check beyond X feet"));
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: init_libcollide
|
// Function: init_libcollide
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include "pandabase.h"
|
#include "pandabase.h"
|
||||||
#include "notifyCategoryProxy.h"
|
#include "notifyCategoryProxy.h"
|
||||||
#include "configVariableBool.h"
|
#include "configVariableBool.h"
|
||||||
|
#include "configVariableInt.h"
|
||||||
|
|
||||||
NotifyCategoryDecl(collide, EXPCL_PANDA_COLLIDE, EXPTP_PANDA_COLLIDE);
|
NotifyCategoryDecl(collide, EXPCL_PANDA_COLLIDE, EXPTP_PANDA_COLLIDE);
|
||||||
|
|
||||||
@ -29,6 +30,7 @@ extern EXPCL_PANDA_COLLIDE ConfigVariableBool respect_prev_transform;
|
|||||||
extern EXPCL_PANDA_COLLIDE ConfigVariableBool respect_effective_normal;
|
extern EXPCL_PANDA_COLLIDE ConfigVariableBool respect_effective_normal;
|
||||||
extern EXPCL_PANDA_COLLIDE ConfigVariableBool allow_collider_multiple;
|
extern EXPCL_PANDA_COLLIDE ConfigVariableBool allow_collider_multiple;
|
||||||
extern EXPCL_PANDA_COLLIDE ConfigVariableBool flatten_collision_nodes;
|
extern EXPCL_PANDA_COLLIDE ConfigVariableBool flatten_collision_nodes;
|
||||||
|
extern EXPCL_PANDA_COLLIDE ConfigVariableInt fluid_cap_amount;
|
||||||
|
|
||||||
extern EXPCL_PANDA_COLLIDE void init_libcollide();
|
extern EXPCL_PANDA_COLLIDE void init_libcollide();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user