00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef BOUNDEDOBJECT_H
00020 #define BOUNDEDOBJECT_H
00021
00022 #include "pandabase.h"
00023
00024 #include "boundingVolume.h"
00025 #include "cycleData.h"
00026 #include "cycleDataReader.h"
00027 #include "cycleDataWriter.h"
00028 #include "pipelineCycler.h"
00029 #include "typedObject.h"
00030 #include "pointerTo.h"
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 class EXPCL_PANDA BoundedObject {
00041 public:
00042 INLINE BoundedObject();
00043 INLINE BoundedObject(const BoundedObject ©);
00044 INLINE void operator = (const BoundedObject ©);
00045 virtual ~BoundedObject();
00046
00047 PUBLISHED:
00048 enum BoundingVolumeType {
00049 BVT_static,
00050 BVT_dynamic_sphere,
00051 };
00052
00053 INLINE void set_bound(BoundingVolumeType type);
00054 INLINE void set_bound(const BoundingVolume &volume);
00055 const BoundingVolume &get_bound() const;
00056
00057 INLINE bool mark_bound_stale();
00058 INLINE void force_bound_stale();
00059 INLINE bool is_bound_stale() const;
00060
00061 INLINE void set_final(bool flag);
00062 INLINE bool is_final() const;
00063
00064 protected:
00065 virtual void propagate_stale_bound();
00066 virtual BoundingVolume *recompute_bound();
00067
00068 INLINE const BoundingVolume *get_bound_ptr() const;
00069 INLINE BoundingVolume *set_bound_ptr(BoundingVolume *bound);
00070
00071 private:
00072 enum Flags {
00073 F_bound_stale = 0x0001,
00074 F_final = 0x0002,
00075 };
00076
00077
00078 class EXPCL_PANDA CData : public CycleData {
00079 public:
00080 INLINE CData();
00081 INLINE CData(const CData ©);
00082 INLINE void operator = (const CData ©);
00083
00084 virtual CycleData *make_copy() const;
00085
00086 int _flags;
00087 BoundingVolumeType _bound_type;
00088 PT(BoundingVolume) _bound;
00089 };
00090
00091 PipelineCycler<CData> _cycler;
00092 typedef CycleDataReader<CData> CDReader;
00093 typedef CycleDataWriter<CData> CDWriter;
00094
00095 public:
00096 static TypeHandle get_class_type() {
00097 return _type_handle;
00098 }
00099 static void init_type() {
00100 register_type(_type_handle, "BoundedObject");
00101 }
00102
00103 private:
00104 static TypeHandle _type_handle;
00105
00106 friend class PandaNode;
00107 friend class CData;
00108 };
00109
00110 #include "boundedObject.I"
00111
00112 #endif
00113