| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- // Filename: boundedObject.h
- // Created by: drose (02Oct99)
- //
- ////////////////////////////////////////////////////////////////////
- //
- // PANDA 3D SOFTWARE
- // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
- //
- // All use of this software is subject to the terms of the Panda 3d
- // Software license. You should have received a copy of this license
- // along with this source code; you will also find a current copy of
- // the license at http://www.panda3d.org/license.txt .
- //
- // To contact the maintainers of this program write to
- // [email protected] .
- //
- ////////////////////////////////////////////////////////////////////
- #ifndef BOUNDEDOBJECT_H
- #define BOUNDEDOBJECT_H
- #include <pandabase.h>
- #include "boundingVolume.h"
- #include <typedObject.h>
- #include <pointerTo.h>
- ////////////////////////////////////////////////////////////////////
- // Class : BoundedObject
- // Description : This is any object (particularly in a scene graph)
- // that may have a bounding volume established for it.
- // The user may set a fixed bounding volume, or s/he may
- // specify that the volume should be recomputed
- // dynamically.
- ////////////////////////////////////////////////////////////////////
- class EXPCL_PANDA BoundedObject {
- public:
- INLINE_GRAPH BoundedObject();
- virtual ~BoundedObject();
- PUBLISHED:
- enum BoundingVolumeType {
- BVT_static,
- BVT_dynamic_sphere,
- };
- INLINE_GRAPH void set_bound(BoundingVolumeType type);
- INLINE_GRAPH void set_bound(const BoundingVolume &volume);
- INLINE_GRAPH const BoundingVolume &get_bound() const;
- INLINE_GRAPH bool mark_bound_stale();
- INLINE_GRAPH void force_bound_stale();
- INLINE_GRAPH bool is_bound_stale() const;
- INLINE_GRAPH void set_final(bool flag);
- INLINE_GRAPH bool is_final() const;
- protected:
- virtual void propagate_stale_bound();
- virtual void recompute_bound();
- private:
- enum Flags {
- F_bound_stale = 0x0001,
- F_final = 0x0002,
- };
- int _flags;
- BoundingVolumeType _bound_type;
- protected:
- PT(BoundingVolume) _bound;
- public:
- static TypeHandle get_class_type() {
- return _type_handle;
- }
- static void init_type() {
- register_type(_type_handle, "BoundedObject");
- }
- private:
- static TypeHandle _type_handle;
- };
- #ifndef DONT_INLINE_GRAPH
- #include "boundedObject.I"
- #endif
- #endif
|