mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 18:31:55 -04:00
pipeline BoundedObject
This commit is contained in:
parent
520ace5e68
commit
da79251b45
@ -209,11 +209,11 @@ output(ostream &out) const {
|
|||||||
// Access: Protected, Virtual
|
// Access: Protected, Virtual
|
||||||
// Description: Recomputes the dynamic bounding volume for this node.
|
// Description: Recomputes the dynamic bounding volume for this node.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void CollisionNode::
|
BoundingVolume *CollisionNode::
|
||||||
recompute_bound() {
|
recompute_bound() {
|
||||||
// First, get ourselves a fresh, empty bounding volume.
|
// First, get ourselves a fresh, empty bounding volume.
|
||||||
BoundedObject::recompute_bound();
|
BoundingVolume *bound = BoundedObject::recompute_bound();
|
||||||
nassertv(_bound != (BoundingVolume *)NULL);
|
nassertr(bound != (BoundingVolume *)NULL, bound);
|
||||||
|
|
||||||
// Now actually compute the bounding volume by putting it around all
|
// Now actually compute the bounding volume by putting it around all
|
||||||
// of our solids' bounding volumes.
|
// of our solids' bounding volumes.
|
||||||
@ -226,20 +226,23 @@ recompute_bound() {
|
|||||||
|
|
||||||
const BoundingVolume **child_begin = &child_volumes[0];
|
const BoundingVolume **child_begin = &child_volumes[0];
|
||||||
const BoundingVolume **child_end = child_begin + child_volumes.size();
|
const BoundingVolume **child_end = child_begin + child_volumes.size();
|
||||||
|
|
||||||
bool success =
|
bool success =
|
||||||
_bound->around(child_begin, child_end);
|
bound->around(child_begin, child_end);
|
||||||
|
|
||||||
#ifdef NOTIFY_DEBUG
|
#ifdef NOTIFY_DEBUG
|
||||||
if (!success) {
|
if (!success) {
|
||||||
collide_cat.error()
|
collide_cat.error()
|
||||||
<< "Unable to generate bounding volume for " << *this << ":\n"
|
<< "Unable to generate bounding volume for " << *this << ":\n"
|
||||||
<< "Cannot put " << _bound->get_type() << " around:\n";
|
<< "Cannot put " << bound->get_type() << " around:\n";
|
||||||
for (int i = 0; i < (int)child_volumes.size(); i++) {
|
for (int i = 0; i < (int)child_volumes.size(); i++) {
|
||||||
collide_cat.error(false)
|
collide_cat.error(false)
|
||||||
<< " " << *child_volumes[i] << "\n";
|
<< " " << *child_volumes[i] << "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
return bound;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
@ -67,7 +67,7 @@ public:
|
|||||||
virtual void output(ostream &out) const;
|
virtual void output(ostream &out) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void recompute_bound();
|
virtual BoundingVolume *recompute_bound();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CollideMask _from_collide_mask;
|
CollideMask _from_collide_mask;
|
||||||
|
@ -104,13 +104,13 @@ output(ostream &out) const {
|
|||||||
// Access: Protected, Virtual
|
// Access: Protected, Virtual
|
||||||
// Description:
|
// Description:
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void CollisionPlane::
|
BoundingVolume *CollisionPlane::
|
||||||
recompute_bound() {
|
recompute_bound() {
|
||||||
// Planes have an infinite bounding volume.
|
// Planes always have an infinite bounding volume.
|
||||||
BoundedObject::recompute_bound();
|
BoundedObject::recompute_bound();
|
||||||
// Less than ideal: we throw away whatever we just allocated in
|
// Less than ideal: we throw away whatever we just allocated in
|
||||||
// BoundedObject.
|
// BoundedObject.
|
||||||
_bound = new OmniBoundingVolume;
|
return set_bound_ptr(new OmniBoundingVolume);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
@ -59,7 +59,7 @@ PUBLISHED:
|
|||||||
INLINE const Planef &get_plane() const;
|
INLINE const Planef &get_plane() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void recompute_bound();
|
virtual BoundingVolume *recompute_bound();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual int
|
virtual int
|
||||||
|
@ -202,13 +202,13 @@ output(ostream &out) const {
|
|||||||
// Access: Protected, Virtual
|
// Access: Protected, Virtual
|
||||||
// Description:
|
// Description:
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void CollisionPolygon::
|
BoundingVolume *CollisionPolygon::
|
||||||
recompute_bound() {
|
recompute_bound() {
|
||||||
// First, get ourselves a fresh, empty bounding volume.
|
// First, get ourselves a fresh, empty bounding volume.
|
||||||
BoundedObject::recompute_bound();
|
BoundingVolume *bound = BoundedObject::recompute_bound();
|
||||||
assert(_bound != (BoundingVolume*)0L);
|
nassertr(bound != (BoundingVolume*)0L, bound);
|
||||||
|
|
||||||
GeometricBoundingVolume *gbv = DCAST(GeometricBoundingVolume, _bound);
|
GeometricBoundingVolume *gbv = DCAST(GeometricBoundingVolume, bound);
|
||||||
|
|
||||||
// Now actually compute the bounding volume by putting it around all
|
// Now actually compute the bounding volume by putting it around all
|
||||||
// of our vertices.
|
// of our vertices.
|
||||||
@ -221,6 +221,8 @@ recompute_bound() {
|
|||||||
const LPoint3f *vertices_begin = &vertices[0];
|
const LPoint3f *vertices_begin = &vertices[0];
|
||||||
const LPoint3f *vertices_end = vertices_begin + vertices.size();
|
const LPoint3f *vertices_end = vertices_begin + vertices.size();
|
||||||
gbv->around(vertices_begin, vertices_end);
|
gbv->around(vertices_begin, vertices_end);
|
||||||
|
|
||||||
|
return bound;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
@ -61,7 +61,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
INLINE CollisionPolygon(void);
|
INLINE CollisionPolygon(void);
|
||||||
virtual void recompute_bound();
|
virtual BoundingVolume *recompute_bound();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual int
|
virtual int
|
||||||
|
@ -125,12 +125,12 @@ set_from_lens(LensNode *camera, const LPoint2f &point) {
|
|||||||
// Access: Protected, Virtual
|
// Access: Protected, Virtual
|
||||||
// Description:
|
// Description:
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void CollisionRay::
|
BoundingVolume *CollisionRay::
|
||||||
recompute_bound() {
|
recompute_bound() {
|
||||||
BoundedObject::recompute_bound();
|
BoundedObject::recompute_bound();
|
||||||
// Less than ideal: we throw away whatever we just allocated in
|
// Less than ideal: we throw away whatever we just allocated in
|
||||||
// BoundedObject.
|
// BoundedObject.
|
||||||
_bound = new BoundingLine(_origin, _origin + _direction);
|
return set_bound_ptr(new BoundingLine(_origin, _origin + _direction));
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
@ -67,7 +67,7 @@ PUBLISHED:
|
|||||||
INLINE bool set_from_lens(LensNode *camera, float px, float py);
|
INLINE bool set_from_lens(LensNode *camera, float px, float py);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void recompute_bound();
|
virtual BoundingVolume *recompute_bound();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void recompute_viz(Node *parent);
|
virtual void recompute_viz(Node *parent);
|
||||||
|
@ -124,20 +124,22 @@ set_from_lens(LensNode *camera, const LPoint2f &point) {
|
|||||||
// Access: Protected, Virtual
|
// Access: Protected, Virtual
|
||||||
// Description:
|
// Description:
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void CollisionSegment::
|
BoundingVolume *CollisionSegment::
|
||||||
recompute_bound() {
|
recompute_bound() {
|
||||||
BoundedObject::recompute_bound();
|
BoundingVolume *bound = BoundedObject::recompute_bound();
|
||||||
|
|
||||||
if (_bound->is_of_type(GeometricBoundingVolume::get_class_type())) {
|
if (bound->is_of_type(GeometricBoundingVolume::get_class_type())) {
|
||||||
GeometricBoundingVolume *gbound;
|
GeometricBoundingVolume *gbound;
|
||||||
DCAST_INTO_V(gbound, _bound);
|
DCAST_INTO_R(gbound, bound, bound);
|
||||||
|
|
||||||
// This makes the assumption that _a and _b are laid out
|
// This makes the assumption that _a and _b are laid out
|
||||||
// sequentially in memory. It works because that's they way
|
// sequentially in memory. It works because that's they way
|
||||||
// they're defined in the class.
|
// they're defined in the class.
|
||||||
nassertv(&_a + 1 == &_b);
|
nassertr(&_a + 1 == &_b, bound);
|
||||||
gbound->around(&_a, &_b + 1);
|
gbound->around(&_a, &_b + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return bound;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
@ -70,7 +70,7 @@ PUBLISHED:
|
|||||||
INLINE bool set_from_lens(LensNode *camera, float px, float py);
|
INLINE bool set_from_lens(LensNode *camera, float px, float py);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void recompute_bound();
|
virtual BoundingVolume *recompute_bound();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void recompute_viz(Node *parent);
|
virtual void recompute_viz(Node *parent);
|
||||||
|
@ -103,13 +103,15 @@ output(ostream &out) const {
|
|||||||
// Access: Protected, Virtual
|
// Access: Protected, Virtual
|
||||||
// Description:
|
// Description:
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void CollisionSphere::
|
BoundingVolume *CollisionSphere::
|
||||||
recompute_bound() {
|
recompute_bound() {
|
||||||
BoundedObject::recompute_bound();
|
BoundingVolume *bound = BoundedObject::recompute_bound();
|
||||||
nassertv(_bound != (BoundingVolume*)0L);
|
nassertr(bound != (BoundingVolume*)0L, bound);
|
||||||
nassertv(!_center.is_nan() && !cnan(_radius));
|
nassertr(!_center.is_nan() && !cnan(_radius), bound);
|
||||||
BoundingSphere sphere(_center, _radius);
|
BoundingSphere sphere(_center, _radius);
|
||||||
_bound->extend_by(&sphere);
|
bound->extend_by(&sphere);
|
||||||
|
|
||||||
|
return bound;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
@ -56,7 +56,7 @@ PUBLISHED:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
INLINE CollisionSphere(void);
|
INLINE CollisionSphere(void);
|
||||||
virtual void recompute_bound();
|
virtual BoundingVolume *recompute_bound();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual int
|
virtual int
|
||||||
|
@ -613,13 +613,13 @@ init() {
|
|||||||
// Description: Recomputes the dynamic bounding volume for this Geom.
|
// Description: Recomputes the dynamic bounding volume for this Geom.
|
||||||
// This includes all of the vertices.
|
// This includes all of the vertices.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void Geom::
|
BoundingVolume *Geom::
|
||||||
recompute_bound() {
|
recompute_bound() {
|
||||||
// First, get ourselves a fresh, empty bounding volume.
|
// First, get ourselves a fresh, empty bounding volume.
|
||||||
BoundedObject::recompute_bound();
|
BoundingVolume *bound = BoundedObject::recompute_bound();
|
||||||
assert(_bound != (BoundingVolume*)0L);
|
nassertr(bound != (BoundingVolume*)0L, bound);
|
||||||
|
|
||||||
GeometricBoundingVolume *gbv = DCAST(GeometricBoundingVolume, _bound);
|
GeometricBoundingVolume *gbv = DCAST(GeometricBoundingVolume, bound);
|
||||||
|
|
||||||
// Now actually compute the bounding volume by putting it around all
|
// Now actually compute the bounding volume by putting it around all
|
||||||
// of our vertices.
|
// of our vertices.
|
||||||
@ -636,6 +636,8 @@ recompute_bound() {
|
|||||||
const LPoint3f *vertices_end = vertices_begin + vertices.size();
|
const LPoint3f *vertices_end = vertices_begin + vertices.size();
|
||||||
|
|
||||||
gbv->around(vertices_begin, vertices_end);
|
gbv->around(vertices_begin, vertices_end);
|
||||||
|
|
||||||
|
return bound;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
@ -232,7 +232,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
void init();
|
void init();
|
||||||
virtual void recompute_bound();
|
virtual BoundingVolume *recompute_bound();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
@ -19,23 +19,17 @@
|
|||||||
#include <notify.h>
|
#include <notify.h>
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: BoundedObject::is_bound_stale
|
// Function: BoundedObject::CData::Constructor
|
||||||
// Access: Published
|
// Access: Public
|
||||||
// Description: Returns true if the bound is currently marked stale
|
// Description:
|
||||||
// and will be recomputed the next time get_bound() is
|
|
||||||
// called.
|
|
||||||
//
|
|
||||||
// This function is defined up at the top of this file,
|
|
||||||
// because several of the inline functions below
|
|
||||||
// reference it.
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
INLINE_GRAPH bool BoundedObject::
|
INLINE_GRAPH BoundedObject::CData::
|
||||||
is_bound_stale() const {
|
CData() {
|
||||||
return (_flags & F_bound_stale) != 0;
|
_bound_type = BoundedObject::BVT_dynamic_sphere;
|
||||||
|
_flags = F_bound_stale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: BoundedObject::Constructor
|
// Function: BoundedObject::Constructor
|
||||||
// Access: Published
|
// Access: Published
|
||||||
@ -43,8 +37,6 @@ is_bound_stale() const {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
INLINE_GRAPH BoundedObject::
|
INLINE_GRAPH BoundedObject::
|
||||||
BoundedObject() {
|
BoundedObject() {
|
||||||
_bound_type = BVT_dynamic_sphere;
|
|
||||||
_flags = F_bound_stale;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -57,8 +49,9 @@ BoundedObject() {
|
|||||||
INLINE_GRAPH void BoundedObject::
|
INLINE_GRAPH void BoundedObject::
|
||||||
set_bound(BoundedObject::BoundingVolumeType type) {
|
set_bound(BoundedObject::BoundingVolumeType type) {
|
||||||
nassertv(type != BVT_static);
|
nassertv(type != BVT_static);
|
||||||
|
CDWriter cdata(_cycler);
|
||||||
mark_bound_stale();
|
mark_bound_stale();
|
||||||
_bound_type = type;
|
cdata->_bound_type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -70,10 +63,11 @@ set_bound(BoundedObject::BoundingVolumeType type) {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
INLINE_GRAPH void BoundedObject::
|
INLINE_GRAPH void BoundedObject::
|
||||||
set_bound(const BoundingVolume &bound) {
|
set_bound(const BoundingVolume &bound) {
|
||||||
|
CDWriter cdata(_cycler);
|
||||||
mark_bound_stale();
|
mark_bound_stale();
|
||||||
_bound_type = BVT_static;
|
cdata->_bound_type = BVT_static;
|
||||||
_flags &= ~F_bound_stale;
|
cdata->_flags &= ~F_bound_stale;
|
||||||
_bound = bound.make_copy();
|
cdata->_bound = bound.make_copy();
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -88,12 +82,14 @@ set_bound(const BoundingVolume &bound) {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
INLINE_GRAPH const BoundingVolume &BoundedObject::
|
INLINE_GRAPH const BoundingVolume &BoundedObject::
|
||||||
get_bound() const {
|
get_bound() const {
|
||||||
if (_bound_type == BVT_static) {
|
CDReader cdata(_cycler);
|
||||||
((BoundedObject *)this)->_flags &= ~F_bound_stale;
|
if (cdata->_bound_type == BVT_static) {
|
||||||
} else if (is_bound_stale() || _bound == (BoundingVolume *)NULL) {
|
CDWriter cdata_w(((BoundedObject *)this)->_cycler);
|
||||||
|
cdata_w->_flags &= ~F_bound_stale;
|
||||||
|
} else if (is_bound_stale() || cdata->_bound == (BoundingVolume *)NULL) {
|
||||||
((BoundedObject *)this)->recompute_bound();
|
((BoundedObject *)this)->recompute_bound();
|
||||||
}
|
}
|
||||||
return *_bound;
|
return *cdata->_bound;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -111,7 +107,8 @@ mark_bound_stale() {
|
|||||||
if (is_bound_stale()) {
|
if (is_bound_stale()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
_flags |= F_bound_stale;
|
CDWriter cdata(_cycler);
|
||||||
|
cdata->_flags |= F_bound_stale;
|
||||||
propagate_stale_bound();
|
propagate_stale_bound();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -126,10 +123,29 @@ mark_bound_stale() {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
INLINE_GRAPH void BoundedObject::
|
INLINE_GRAPH void BoundedObject::
|
||||||
force_bound_stale() {
|
force_bound_stale() {
|
||||||
_flags |= F_bound_stale;
|
CDWriter cdata(_cycler);
|
||||||
|
cdata->_flags |= F_bound_stale;
|
||||||
propagate_stale_bound();
|
propagate_stale_bound();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: BoundedObject::is_bound_stale
|
||||||
|
// Access: Published
|
||||||
|
// Description: Returns true if the bound is currently marked stale
|
||||||
|
// and will be recomputed the next time get_bound() is
|
||||||
|
// called.
|
||||||
|
//
|
||||||
|
// This function is defined up at the top of this file,
|
||||||
|
// because several of the inline functions below
|
||||||
|
// reference it.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE_GRAPH bool BoundedObject::
|
||||||
|
is_bound_stale() const {
|
||||||
|
CDReader cdata(_cycler);
|
||||||
|
return (cdata->_flags & F_bound_stale) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: BoundedObject::set_final
|
// Function: BoundedObject::set_final
|
||||||
// Access: Published
|
// Access: Published
|
||||||
@ -149,10 +165,11 @@ force_bound_stale() {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
INLINE_GRAPH void BoundedObject::
|
INLINE_GRAPH void BoundedObject::
|
||||||
set_final(bool flag) {
|
set_final(bool flag) {
|
||||||
|
CDWriter cdata(_cycler);
|
||||||
if (flag) {
|
if (flag) {
|
||||||
_flags |= F_final;
|
cdata->_flags |= F_final;
|
||||||
} else {
|
} else {
|
||||||
_flags &= ~F_final;
|
cdata->_flags &= ~F_final;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,5 +183,45 @@ set_final(bool flag) {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
INLINE_GRAPH bool BoundedObject::
|
INLINE_GRAPH bool BoundedObject::
|
||||||
is_final() const {
|
is_final() const {
|
||||||
return (_flags & F_final) != 0;
|
CDReader cdata(_cycler);
|
||||||
|
return (cdata->_flags & F_final) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: BoundedObject::get_bound_ptr
|
||||||
|
// Access: Protected
|
||||||
|
// Description: Returns the state of the _bound pointer. To be used
|
||||||
|
// only internally by derived classes.
|
||||||
|
//
|
||||||
|
// This returns a const pointer only; the bounding
|
||||||
|
// volume should not be modified directly, because that
|
||||||
|
// might interfere with pipelining. Instead, create a
|
||||||
|
// new copy with make_copy(), modify the copy, and
|
||||||
|
// set_bound_ptr() with the copy.
|
||||||
|
//
|
||||||
|
// Alternatively, if you have just called
|
||||||
|
// recompute_bound(), which is guaranteed to reset the
|
||||||
|
// pointer, just use the return value from that as a
|
||||||
|
// non-const BoundingVolume pointer.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE_GRAPH const BoundingVolume *BoundedObject::
|
||||||
|
get_bound_ptr() const {
|
||||||
|
CDReader cdata(_cycler);
|
||||||
|
return cdata->_bound;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: BoundedObject::set_bound_ptr
|
||||||
|
// Access: Protected
|
||||||
|
// Description: Changes the _bound pointer. To be used only
|
||||||
|
// internally by derived classes, usually in
|
||||||
|
// recompute_bound(). The return value is the same
|
||||||
|
// pointer passed in, as a convenience (it will now be
|
||||||
|
// reference counted).
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE_GRAPH BoundingVolume *BoundedObject::
|
||||||
|
set_bound_ptr(BoundingVolume *bound) {
|
||||||
|
CDWriter cdata(_cycler);
|
||||||
|
cdata->_bound = bound;
|
||||||
|
return bound;
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,19 @@
|
|||||||
|
|
||||||
TypeHandle BoundedObject::_type_handle;
|
TypeHandle BoundedObject::_type_handle;
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: BoundedObject::CData::Copy Constructor
|
||||||
|
// Access: Public
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
BoundedObject::CData::
|
||||||
|
CData(const BoundedObject::CData ©) :
|
||||||
|
_flags(copy._flags),
|
||||||
|
_bound_type(copy._bound_type),
|
||||||
|
_bound(copy._bound)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: BoundedObject::Destructor
|
// Function: BoundedObject::Destructor
|
||||||
// Access: Public, Virtual
|
// Access: Public, Virtual
|
||||||
@ -32,6 +45,16 @@ BoundedObject::
|
|||||||
~BoundedObject() {
|
~BoundedObject() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: BoundedObject::CData::make_copy
|
||||||
|
// Access: Public, Virtual
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
CycleData *BoundedObject::CData::
|
||||||
|
make_copy() const {
|
||||||
|
return new CData(*this);
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: BoundedObject::propagate_stale_bound
|
// Function: BoundedObject::propagate_stale_bound
|
||||||
// Access: Protected, Virtual
|
// Access: Protected, Virtual
|
||||||
@ -49,22 +72,29 @@ propagate_stale_bound() {
|
|||||||
// Description: Recomputes the dynamic bounding volume for this
|
// Description: Recomputes the dynamic bounding volume for this
|
||||||
// object. The default behavior is the compute an empty
|
// object. The default behavior is the compute an empty
|
||||||
// bounding volume; this may be overridden to extend it
|
// bounding volume; this may be overridden to extend it
|
||||||
// to create a nonempty bounding volume.
|
// to create a nonempty bounding volume. However, after
|
||||||
|
// calling this function, it is guaranteed that the
|
||||||
|
// _bound pointer will not be shared with any other
|
||||||
|
// stage of the pipeline, and this new pointer is
|
||||||
|
// returned.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void BoundedObject::
|
BoundingVolume *BoundedObject::
|
||||||
recompute_bound() {
|
recompute_bound() {
|
||||||
switch (_bound_type) {
|
CDWriter cdata(_cycler);
|
||||||
|
switch (cdata->_bound_type) {
|
||||||
case BVT_dynamic_sphere:
|
case BVT_dynamic_sphere:
|
||||||
_bound = new BoundingSphere;
|
cdata->_bound = new BoundingSphere;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
graph_cat.error()
|
graph_cat.error()
|
||||||
<< "Unexpected _bound_type: " << (int)_bound_type
|
<< "Unexpected _bound_type: " << (int)cdata->_bound_type
|
||||||
<< " in BoundedObject::recompute_bound()\n";
|
<< " in BoundedObject::recompute_bound()\n";
|
||||||
_bound = NULL;
|
cdata->_bound = new BoundingSphere;
|
||||||
}
|
}
|
||||||
|
|
||||||
_flags &= ~F_bound_stale;
|
cdata->_flags &= ~F_bound_stale;
|
||||||
// By default, the bound is empty.
|
|
||||||
|
// Now the _bound is new and empty.
|
||||||
|
return cdata->_bound;
|
||||||
}
|
}
|
||||||
|
@ -19,12 +19,15 @@
|
|||||||
#ifndef BOUNDEDOBJECT_H
|
#ifndef BOUNDEDOBJECT_H
|
||||||
#define BOUNDEDOBJECT_H
|
#define BOUNDEDOBJECT_H
|
||||||
|
|
||||||
#include <pandabase.h>
|
#include "pandabase.h"
|
||||||
|
|
||||||
#include "boundingVolume.h"
|
#include "boundingVolume.h"
|
||||||
|
#include "cycleData.h"
|
||||||
#include <typedObject.h>
|
#include "cycleDataReader.h"
|
||||||
#include <pointerTo.h>
|
#include "cycleDataWriter.h"
|
||||||
|
#include "pipelineCycler.h"
|
||||||
|
#include "typedObject.h"
|
||||||
|
#include "pointerTo.h"
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Class : BoundedObject
|
// Class : BoundedObject
|
||||||
@ -58,18 +61,32 @@ PUBLISHED:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void propagate_stale_bound();
|
virtual void propagate_stale_bound();
|
||||||
virtual void recompute_bound();
|
virtual BoundingVolume *recompute_bound();
|
||||||
|
|
||||||
|
INLINE_GRAPH const BoundingVolume *get_bound_ptr() const;
|
||||||
|
INLINE_GRAPH BoundingVolume *set_bound_ptr(BoundingVolume *bound);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum Flags {
|
enum Flags {
|
||||||
F_bound_stale = 0x0001,
|
F_bound_stale = 0x0001,
|
||||||
F_final = 0x0002,
|
F_final = 0x0002,
|
||||||
};
|
};
|
||||||
int _flags;
|
|
||||||
BoundingVolumeType _bound_type;
|
|
||||||
|
|
||||||
protected:
|
// This is the data that must be cycled between pipeline stages.
|
||||||
PT(BoundingVolume) _bound;
|
class EXPCL_PANDA CData : public CycleData {
|
||||||
|
public:
|
||||||
|
INLINE_GRAPH CData();
|
||||||
|
CData(const CData ©);
|
||||||
|
virtual CycleData *make_copy() const;
|
||||||
|
|
||||||
|
int _flags;
|
||||||
|
BoundingVolumeType _bound_type;
|
||||||
|
PT(BoundingVolume) _bound;
|
||||||
|
};
|
||||||
|
|
||||||
|
PipelineCycler<CData> _cycler;
|
||||||
|
typedef CycleDataReader<CData> CDReader;
|
||||||
|
typedef CycleDataWriter<CData> CDWriter;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static TypeHandle get_class_type() {
|
static TypeHandle get_class_type() {
|
||||||
|
@ -817,18 +817,18 @@ propagate_stale_bound() {
|
|||||||
// Description: Recomputes the dynamic bounding volume for this arc
|
// Description: Recomputes the dynamic bounding volume for this arc
|
||||||
// (and all of its descendants).
|
// (and all of its descendants).
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void NodeRelation::
|
BoundingVolume *NodeRelation::
|
||||||
recompute_bound() {
|
recompute_bound() {
|
||||||
// First, get ourselves a fresh, empty bounding volume.
|
// First, get ourselves a fresh, empty bounding volume.
|
||||||
BoundedObject::recompute_bound();
|
BoundingVolume *bound = BoundedObject::recompute_bound();
|
||||||
nassertv(_bound != (BoundingVolume*)NULL);
|
nassertr(bound != (BoundingVolume*)NULL, bound);
|
||||||
|
|
||||||
// Now actually compute the bounding volume by putting it around all
|
// Now actually compute the bounding volume by putting it around all
|
||||||
// of our child bounding volumes.
|
// of our child bounding volumes.
|
||||||
pvector<const BoundingVolume *> child_volumes;
|
pvector<const BoundingVolume *> child_volumes;
|
||||||
|
|
||||||
Node *node = _child;
|
Node *node = _child;
|
||||||
nassertv(node != (Node*)NULL);
|
nassertr(node != (Node*)NULL, bound);
|
||||||
|
|
||||||
child_volumes.push_back(&node->get_bound());
|
child_volumes.push_back(&node->get_bound());
|
||||||
|
|
||||||
@ -841,21 +841,23 @@ recompute_bound() {
|
|||||||
|
|
||||||
const BoundingVolume **child_begin = &child_volumes[0];
|
const BoundingVolume **child_begin = &child_volumes[0];
|
||||||
const BoundingVolume **child_end = child_begin + child_volumes.size();
|
const BoundingVolume **child_end = child_begin + child_volumes.size();
|
||||||
bool success =
|
|
||||||
_bound->around(child_begin, child_end);
|
|
||||||
|
|
||||||
|
bool success =
|
||||||
|
bound->around(child_begin, child_end);
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
if (!success) {
|
if (!success) {
|
||||||
graph_cat.error()
|
graph_cat.error()
|
||||||
<< "Unable to recompute bounding volume for " << *this << ":\n"
|
<< "Unable to recompute bounding volume for " << *this << ":\n"
|
||||||
<< "Cannot put " << _bound->get_type() << " around:\n";
|
<< "Cannot put " << bound->get_type() << " around:\n";
|
||||||
for (int i = 0; i < (int)child_volumes.size(); i++) {
|
for (int i = 0; i < (int)child_volumes.size(); i++) {
|
||||||
graph_cat.error(false)
|
graph_cat.error(false)
|
||||||
<< " " << *child_volumes[i] << "\n";
|
<< " " << *child_volumes[i] << "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
return bound;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
@ -211,7 +211,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void propagate_stale_bound();
|
virtual void propagate_stale_bound();
|
||||||
virtual void recompute_bound();
|
virtual BoundingVolume *recompute_bound();
|
||||||
|
|
||||||
PUBLISHED:
|
PUBLISHED:
|
||||||
INLINE_GRAPH static TypeHandle get_class_type();
|
INLINE_GRAPH static TypeHandle get_class_type();
|
||||||
|
@ -20,17 +20,11 @@
|
|||||||
cullHandler.h \
|
cullHandler.h \
|
||||||
cullResult.h \
|
cullResult.h \
|
||||||
qpcullTraverser.h qpcullTraverser.I \
|
qpcullTraverser.h qpcullTraverser.I \
|
||||||
cycleData.h cycleData.I \
|
|
||||||
cycleDataReader.h cycleDataReader.I \
|
|
||||||
cycleDataWriter.h cycleDataWriter.I \
|
|
||||||
qpgeomNode.h qpgeomNode.I \
|
qpgeomNode.h qpgeomNode.I \
|
||||||
qplensNode.h qplensNode.I \
|
qplensNode.h qplensNode.I \
|
||||||
nodeChain.h nodeChain.I \
|
nodeChain.h nodeChain.I \
|
||||||
nodeChainComponent.h nodeChainComponent.I \
|
nodeChainComponent.h nodeChainComponent.I \
|
||||||
pandaNode.h pandaNode.I \
|
pandaNode.h pandaNode.I \
|
||||||
pipeline.h pipeline.I \
|
|
||||||
pipelineCycler.h pipelineCycler.I \
|
|
||||||
pipelineCyclerBase.h pipelineCyclerBase.I \
|
|
||||||
renderAttrib.h renderAttrib.I \
|
renderAttrib.h renderAttrib.I \
|
||||||
renderState.h renderState.I \
|
renderState.h renderState.I \
|
||||||
textureAttrib.h textureAttrib.I \
|
textureAttrib.h textureAttrib.I \
|
||||||
@ -53,17 +47,11 @@
|
|||||||
cullHandler.cxx \
|
cullHandler.cxx \
|
||||||
cullResult.cxx \
|
cullResult.cxx \
|
||||||
qpcullTraverser.cxx \
|
qpcullTraverser.cxx \
|
||||||
cycleData.cxx \
|
|
||||||
cycleDataReader.cxx \
|
|
||||||
cycleDataWriter.cxx \
|
|
||||||
qpgeomNode.cxx \
|
qpgeomNode.cxx \
|
||||||
qplensNode.cxx \
|
qplensNode.cxx \
|
||||||
nodeChain.cxx \
|
nodeChain.cxx \
|
||||||
nodeChainComponent.cxx \
|
nodeChainComponent.cxx \
|
||||||
pandaNode.cxx \
|
pandaNode.cxx \
|
||||||
pipeline.cxx \
|
|
||||||
pipelineCycler.cxx \
|
|
||||||
pipelineCyclerBase.cxx \
|
|
||||||
renderAttrib.cxx \
|
renderAttrib.cxx \
|
||||||
renderState.cxx \
|
renderState.cxx \
|
||||||
textureAttrib.cxx \
|
textureAttrib.cxx \
|
||||||
@ -91,17 +79,11 @@
|
|||||||
cullHandler.h \
|
cullHandler.h \
|
||||||
cullResult.h \
|
cullResult.h \
|
||||||
qpcullTraverser.h qpcullTraverser.I \
|
qpcullTraverser.h qpcullTraverser.I \
|
||||||
cycleData.h cycleData.I \
|
|
||||||
cycleDataReader.h cycleDataReader.I \
|
|
||||||
cycleDataWriter.h cycleDataWriter.I \
|
|
||||||
qpgeomNode.h qpgeomNode.I \
|
qpgeomNode.h qpgeomNode.I \
|
||||||
qplensNode.h qplensNode.I \
|
qplensNode.h qplensNode.I \
|
||||||
nodeChain.h nodeChain.I \
|
nodeChain.h nodeChain.I \
|
||||||
nodeChainComponent.h nodeChainComponent.I \
|
nodeChainComponent.h nodeChainComponent.I \
|
||||||
pandaNode.h pandaNode.I \
|
pandaNode.h pandaNode.I \
|
||||||
pipeline.h pipeline.I \
|
|
||||||
pipelineCycler.h pipelineCycler.I \
|
|
||||||
pipelineCyclerBase.h pipelineCyclerBase.I \
|
|
||||||
renderAttrib.h renderAttrib.I \
|
renderAttrib.h renderAttrib.I \
|
||||||
renderState.h renderState.I \
|
renderState.h renderState.I \
|
||||||
textureAttrib.h textureAttrib.I \
|
textureAttrib.h textureAttrib.I \
|
||||||
|
@ -1,14 +1,8 @@
|
|||||||
#include "cycleData.cxx"
|
|
||||||
#include "cycleDataReader.cxx"
|
|
||||||
#include "cycleDataWriter.cxx"
|
|
||||||
#include "qpgeomNode.cxx"
|
#include "qpgeomNode.cxx"
|
||||||
#include "qplensNode.cxx"
|
#include "qplensNode.cxx"
|
||||||
#include "nodeChain.cxx"
|
#include "nodeChain.cxx"
|
||||||
#include "nodeChainComponent.cxx"
|
#include "nodeChainComponent.cxx"
|
||||||
#include "pandaNode.cxx"
|
#include "pandaNode.cxx"
|
||||||
#include "pipeline.cxx"
|
|
||||||
#include "pipelineCycler.cxx"
|
|
||||||
#include "pipelineCyclerBase.cxx"
|
|
||||||
#include "renderAttrib.cxx"
|
#include "renderAttrib.cxx"
|
||||||
#include "renderState.cxx"
|
#include "renderState.cxx"
|
||||||
#include "test_pgraph.cxx"
|
#include "test_pgraph.cxx"
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#define OTHER_LIBS interrogatedb:c dconfig:c dtoolconfig:m \
|
#define OTHER_LIBS interrogatedb:c dconfig:c dtoolconfig:m \
|
||||||
dtoolutil:c dtoolbase:c dtool:m
|
dtoolutil:c dtoolbase:c dtool:m
|
||||||
#define LOCAL_LIBS express pandabase
|
#define LOCAL_LIBS express pandabase
|
||||||
|
|
||||||
#begin lib_target
|
#begin lib_target
|
||||||
@ -8,59 +8,72 @@
|
|||||||
#define COMBINED_SOURCES $[TARGET]_composite1.cxx $[TARGET]_composite2.cxx
|
#define COMBINED_SOURCES $[TARGET]_composite1.cxx $[TARGET]_composite2.cxx
|
||||||
|
|
||||||
#define SOURCES \
|
#define SOURCES \
|
||||||
bam.h bamReader.I bamReader.N bamReader.h bamReaderParam.I \
|
bam.h bamReader.I bamReader.N bamReader.h bamReaderParam.I \
|
||||||
bamReaderParam.h bamWriter.I bamWriter.h bitMask.I \
|
bamReaderParam.h bamWriter.I bamWriter.h bitMask.I \
|
||||||
bitMask.h buttonEvent.I buttonEvent.h buttonHandle.I \
|
bitMask.h buttonEvent.I buttonEvent.h buttonHandle.I \
|
||||||
buttonHandle.h buttonRegistry.I buttonRegistry.h \
|
buttonHandle.h buttonRegistry.I buttonRegistry.h \
|
||||||
collideMask.h \
|
collideMask.h \
|
||||||
compareTo.I compareTo.h \
|
compareTo.I compareTo.h \
|
||||||
config_util.N config_util.h configurable.h \
|
config_util.N config_util.h configurable.h \
|
||||||
factoryBase.I factoryBase.h \
|
cycleData.h cycleData.I \
|
||||||
factoryParam.I factoryParam.h factoryParams.I \
|
cycleDataReader.h cycleDataReader.I \
|
||||||
factoryParams.h \
|
cycleDataWriter.h cycleDataWriter.I \
|
||||||
firstOfPairCompare.I firstOfPairCompare.h \
|
factoryBase.I factoryBase.h \
|
||||||
firstOfPairLess.I firstOfPairLess.h \
|
factoryParam.I factoryParam.h factoryParams.I \
|
||||||
globPattern.I globPattern.h \
|
factoryParams.h \
|
||||||
globalPointerRegistry.I globalPointerRegistry.h \
|
firstOfPairCompare.I firstOfPairCompare.h \
|
||||||
indirectCompareNames.I indirectCompareNames.h \
|
firstOfPairLess.I firstOfPairLess.h \
|
||||||
indirectCompareTo.I indirectCompareTo.h \
|
globPattern.I globPattern.h \
|
||||||
indirectLess.I indirectLess.h \
|
globalPointerRegistry.I globalPointerRegistry.h \
|
||||||
ioPtaDatagramFloat.h ioPtaDatagramInt.h \
|
indirectCompareNames.I indirectCompareNames.h \
|
||||||
ioPtaDatagramShort.h keyboardButton.h lineStream.I \
|
indirectCompareTo.I indirectCompareTo.h \
|
||||||
lineStream.h lineStreamBuf.I lineStreamBuf.h \
|
indirectLess.I indirectLess.h \
|
||||||
modifierButtons.I modifierButtons.h mouseButton.h \
|
ioPtaDatagramFloat.h ioPtaDatagramInt.h \
|
||||||
mouseData.h nameUniquifier.I nameUniquifier.h \
|
ioPtaDatagramShort.h keyboardButton.h lineStream.I \
|
||||||
ordered_vector.h ordered_vector.I ordered_vector.T \
|
lineStream.h lineStreamBuf.I lineStreamBuf.h \
|
||||||
pta_double.h \
|
modifierButtons.I modifierButtons.h mouseButton.h \
|
||||||
pta_float.h pta_int.h \
|
mouseData.h nameUniquifier.I nameUniquifier.h \
|
||||||
string_utils.I string_utils.N string_utils.h \
|
ordered_vector.h ordered_vector.I ordered_vector.T \
|
||||||
timedCycle.I timedCycle.h typedWritable.I \
|
pipeline.h pipeline.I \
|
||||||
typedWritable.h typedWritableReferenceCount.I \
|
pipelineCycler.h pipelineCycler.I \
|
||||||
typedWritableReferenceCount.h updateSeq.I updateSeq.h \
|
pipelineCyclerBase.h pipelineCyclerBase.I \
|
||||||
vector_double.h vector_float.h vector_typedWritable.h \
|
pta_double.h \
|
||||||
vector_ushort.h vector_writable.h \
|
pta_float.h pta_int.h \
|
||||||
writable.I writable.h writableConfigurable.h \
|
string_utils.I string_utils.N string_utils.h \
|
||||||
writableParam.I writableParam.h
|
timedCycle.I timedCycle.h typedWritable.I \
|
||||||
|
typedWritable.h typedWritableReferenceCount.I \
|
||||||
|
typedWritableReferenceCount.h updateSeq.I updateSeq.h \
|
||||||
|
vector_double.h vector_float.h vector_typedWritable.h \
|
||||||
|
vector_ushort.h vector_writable.h \
|
||||||
|
writable.I writable.h writableConfigurable.h \
|
||||||
|
writableParam.I writableParam.h
|
||||||
|
|
||||||
#define INCLUDED_SOURCES \
|
#define INCLUDED_SOURCES \
|
||||||
bamReader.cxx bamReaderParam.cxx bamWriter.cxx bitMask.cxx \
|
bamReader.cxx bamReaderParam.cxx bamWriter.cxx bitMask.cxx \
|
||||||
buttonEvent.cxx buttonHandle.cxx buttonRegistry.cxx \
|
buttonEvent.cxx buttonHandle.cxx buttonRegistry.cxx \
|
||||||
config_util.cxx configurable.cxx factoryBase.cxx \
|
config_util.cxx configurable.cxx \
|
||||||
factoryParam.cxx factoryParams.cxx globPattern.cxx \
|
cycleData.cxx \
|
||||||
globalPointerRegistry.cxx ioPtaDatagramFloat.cxx \
|
cycleDataReader.cxx \
|
||||||
ioPtaDatagramInt.cxx ioPtaDatagramShort.cxx \
|
cycleDataWriter.cxx \
|
||||||
keyboardButton.cxx lineStream.cxx lineStreamBuf.cxx \
|
factoryBase.cxx \
|
||||||
modifierButtons.cxx mouseButton.cxx mouseData.cxx \
|
factoryParam.cxx factoryParams.cxx globPattern.cxx \
|
||||||
nameUniquifier.cxx \
|
globalPointerRegistry.cxx ioPtaDatagramFloat.cxx \
|
||||||
ordered_vector.cxx \
|
ioPtaDatagramInt.cxx ioPtaDatagramShort.cxx \
|
||||||
pta_double.cxx pta_float.cxx \
|
keyboardButton.cxx lineStream.cxx lineStreamBuf.cxx \
|
||||||
pta_int.cxx pta_ushort.cxx \
|
modifierButtons.cxx mouseButton.cxx mouseData.cxx \
|
||||||
string_utils.cxx timedCycle.cxx typedWritable.cxx \
|
nameUniquifier.cxx \
|
||||||
typedWritableReferenceCount.cxx updateSeq.cxx \
|
ordered_vector.cxx \
|
||||||
vector_double.cxx vector_float.cxx \
|
pipeline.cxx \
|
||||||
vector_typedWritable.cxx \
|
pipelineCycler.cxx \
|
||||||
vector_ushort.cxx vector_writable.cxx writable.cxx \
|
pipelineCyclerBase.cxx \
|
||||||
writableConfigurable.cxx writableParam.cxx
|
pta_double.cxx pta_float.cxx \
|
||||||
|
pta_int.cxx pta_ushort.cxx \
|
||||||
|
string_utils.cxx timedCycle.cxx typedWritable.cxx \
|
||||||
|
typedWritableReferenceCount.cxx updateSeq.cxx \
|
||||||
|
vector_double.cxx vector_float.cxx \
|
||||||
|
vector_typedWritable.cxx \
|
||||||
|
vector_ushort.cxx vector_writable.cxx writable.cxx \
|
||||||
|
writableConfigurable.cxx writableParam.cxx
|
||||||
|
|
||||||
#define INSTALL_HEADERS \
|
#define INSTALL_HEADERS \
|
||||||
bam.h bamReader.I bamReader.h bamReaderParam.I bamReaderParam.h \
|
bam.h bamReader.I bamReader.h bamReaderParam.I bamReaderParam.h \
|
||||||
@ -69,6 +82,9 @@
|
|||||||
buttonRegistry.h collideMask.h \
|
buttonRegistry.h collideMask.h \
|
||||||
compareTo.I compareTo.h \
|
compareTo.I compareTo.h \
|
||||||
config_util.h configurable.h factory.I factory.h \
|
config_util.h configurable.h factory.I factory.h \
|
||||||
|
cycleData.h cycleData.I \
|
||||||
|
cycleDataReader.h cycleDataReader.I \
|
||||||
|
cycleDataWriter.h cycleDataWriter.I \
|
||||||
factoryBase.I factoryBase.h factoryParam.I factoryParam.h \
|
factoryBase.I factoryBase.h factoryParam.I factoryParam.h \
|
||||||
factoryParams.I factoryParams.h \
|
factoryParams.I factoryParams.h \
|
||||||
firstOfPairCompare.I firstOfPairCompare.h \
|
firstOfPairCompare.I firstOfPairCompare.h \
|
||||||
@ -83,6 +99,9 @@
|
|||||||
modifierButtons.h mouseButton.h mouseData.h nameUniquifier.I \
|
modifierButtons.h mouseButton.h mouseData.h nameUniquifier.I \
|
||||||
nameUniquifier.h \
|
nameUniquifier.h \
|
||||||
ordered_vector.h ordered_vector.I ordered_vector.T \
|
ordered_vector.h ordered_vector.I ordered_vector.T \
|
||||||
|
pipeline.h pipeline.I \
|
||||||
|
pipelineCycler.h pipelineCycler.I \
|
||||||
|
pipelineCyclerBase.h pipelineCyclerBase.I \
|
||||||
pta_double.h \
|
pta_double.h \
|
||||||
pta_float.h pta_int.h pta_ushort.h string_utils.I \
|
pta_float.h pta_int.h pta_ushort.h string_utils.I \
|
||||||
string_utils.h timedCycle.I timedCycle.h typedWritable.I \
|
string_utils.h timedCycle.I timedCycle.h typedWritable.I \
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
#include "bamReader.cxx"
|
#include "bamReader.cxx"
|
||||||
#include "bamReaderParam.cxx"
|
#include "bamReaderParam.cxx"
|
||||||
#include "bamWriter.cxx"
|
#include "bamWriter.cxx"
|
||||||
@ -8,6 +7,9 @@
|
|||||||
#include "buttonRegistry.cxx"
|
#include "buttonRegistry.cxx"
|
||||||
#include "config_util.cxx"
|
#include "config_util.cxx"
|
||||||
#include "configurable.cxx"
|
#include "configurable.cxx"
|
||||||
|
#include "cycleData.cxx"
|
||||||
|
#include "cycleDataReader.cxx"
|
||||||
|
#include "cycleDataWriter.cxx"
|
||||||
#include "factoryBase.cxx"
|
#include "factoryBase.cxx"
|
||||||
#include "factoryParam.cxx"
|
#include "factoryParam.cxx"
|
||||||
#include "factoryParams.cxx"
|
#include "factoryParams.cxx"
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
|
|
||||||
#include "nameUniquifier.cxx"
|
#include "nameUniquifier.cxx"
|
||||||
#include "ordered_vector.cxx"
|
#include "ordered_vector.cxx"
|
||||||
|
#include "pipeline.cxx"
|
||||||
|
#include "pipelineCycler.cxx"
|
||||||
|
#include "pipelineCyclerBase.cxx"
|
||||||
#include "pta_double.cxx"
|
#include "pta_double.cxx"
|
||||||
#include "pta_float.cxx"
|
#include "pta_float.cxx"
|
||||||
#include "pta_int.cxx"
|
#include "pta_int.cxx"
|
||||||
|
@ -54,21 +54,23 @@ changed_transition(TypeHandle trans_type) {
|
|||||||
// Description: Recomputes the dynamic bounding volume for this arc
|
// Description: Recomputes the dynamic bounding volume for this arc
|
||||||
// (and all of its descendants).
|
// (and all of its descendants).
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void RenderRelation::
|
BoundingVolume *RenderRelation::
|
||||||
recompute_bound() {
|
recompute_bound() {
|
||||||
// First, compute the bounding volume around all of our children.
|
// First, compute the bounding volume around all of our children.
|
||||||
NodeRelation::recompute_bound();
|
BoundingVolume *bound = NodeRelation::recompute_bound();
|
||||||
nassertv(_bound != (BoundingVolume *)NULL);
|
nassertr(bound != (BoundingVolume *)NULL, bound);
|
||||||
|
|
||||||
// Now, if we have a transform transition on the arc, apply it to
|
// Now, if we have a transform transition on the arc, apply it to
|
||||||
// the bounding volume.
|
// the bounding volume.
|
||||||
GeometricBoundingVolume *gbv;
|
GeometricBoundingVolume *gbv;
|
||||||
DCAST_INTO_V(gbv, _bound);
|
DCAST_INTO_R(gbv, bound, bound);
|
||||||
|
|
||||||
const TransformTransition *tt;
|
const TransformTransition *tt;
|
||||||
if (get_transition_into(tt, this)) {
|
if (get_transition_into(tt, this)) {
|
||||||
gbv->xform(tt->get_matrix());
|
gbv->xform(tt->get_matrix());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return bound;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
@ -41,7 +41,7 @@ public:
|
|||||||
virtual void changed_transition(TypeHandle transition_type);
|
virtual void changed_transition(TypeHandle transition_type);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void recompute_bound();
|
virtual BoundingVolume *recompute_bound();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// This is just to be called at initialization time; don't try to
|
// This is just to be called at initialization time; don't try to
|
||||||
|
@ -414,11 +414,11 @@ add_geoms_from(const GeomNode *other) {
|
|||||||
// Access: Protected, Virtual
|
// Access: Protected, Virtual
|
||||||
// Description: Recomputes the dynamic bounding volume for this node.
|
// Description: Recomputes the dynamic bounding volume for this node.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void GeomNode::
|
BoundingVolume *GeomNode::
|
||||||
recompute_bound() {
|
recompute_bound() {
|
||||||
// First, get ourselves a fresh, empty bounding volume.
|
// First, get ourselves a fresh, empty bounding volume.
|
||||||
BoundedObject::recompute_bound();
|
BoundingVolume *bound = BoundedObject::recompute_bound();
|
||||||
assert(_bound != (BoundingVolume *)NULL);
|
nassertr(bound != (BoundingVolume *)NULL, bound);
|
||||||
|
|
||||||
// Now actually compute the bounding volume by putting it around all
|
// Now actually compute the bounding volume by putting it around all
|
||||||
// of our drawable's bounding volumes.
|
// of our drawable's bounding volumes.
|
||||||
@ -431,7 +431,9 @@ recompute_bound() {
|
|||||||
|
|
||||||
const BoundingVolume **child_begin = &child_volumes[0];
|
const BoundingVolume **child_begin = &child_volumes[0];
|
||||||
const BoundingVolume **child_end = child_begin + child_volumes.size();
|
const BoundingVolume **child_end = child_begin + child_volumes.size();
|
||||||
_bound->around(child_begin, child_end);
|
|
||||||
|
bound->around(child_begin, child_end);
|
||||||
|
return bound;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
@ -73,7 +73,7 @@ PUBLISHED:
|
|||||||
void add_geoms_from(const GeomNode *other);
|
void add_geoms_from(const GeomNode *other);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void recompute_bound();
|
virtual BoundingVolume *recompute_bound();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef PTA(PT(dDrawable)) Geoms;
|
typedef PTA(PT(dDrawable)) Geoms;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user