00001 // Filename: omniBoundingVolume.h 00002 // Created by: drose (22Jun00) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 #ifndef OMNIBOUNDINGVOLUME_H 00020 #define OMNIBOUNDINGVOLUME_H 00021 00022 #include <pandabase.h> 00023 00024 #include "geometricBoundingVolume.h" 00025 00026 /////////////////////////////////////////////////////////////////// 00027 // Class : OmniBoundingVolume 00028 // Description : This is a special kind of GeometricBoundingVolume 00029 // that fills all of space. 00030 //////////////////////////////////////////////////////////////////// 00031 class EXPCL_PANDA OmniBoundingVolume : public GeometricBoundingVolume { 00032 PUBLISHED: 00033 INLINE_MATHUTIL OmniBoundingVolume(); 00034 00035 public: 00036 virtual BoundingVolume *make_copy() const; 00037 00038 virtual LPoint3f get_approx_center() const; 00039 virtual void xform(const LMatrix4f &mat); 00040 00041 virtual void output(ostream &out) const; 00042 00043 protected: 00044 virtual bool extend_other(BoundingVolume *other) const; 00045 virtual bool around_other(BoundingVolume *other, 00046 const BoundingVolume **first, 00047 const BoundingVolume **last) const; 00048 virtual int contains_other(const BoundingVolume *other) const; 00049 00050 00051 virtual bool extend_by_point(const LPoint3f &point); 00052 virtual bool extend_by_sphere(const BoundingSphere *sphere); 00053 virtual bool extend_by_hexahedron(const BoundingHexahedron *hexahedron); 00054 00055 virtual bool around_points(const LPoint3f *first, 00056 const LPoint3f *last); 00057 virtual bool around_spheres(const BoundingVolume **first, 00058 const BoundingVolume **last); 00059 virtual bool around_hexahedrons(const BoundingVolume **first, 00060 const BoundingVolume **last); 00061 00062 virtual int contains_point(const LPoint3f &point) const; 00063 virtual int contains_lineseg(const LPoint3f &a, const LPoint3f &b) const; 00064 virtual int contains_hexahedron(const BoundingHexahedron *hexahedron) const; 00065 virtual int contains_sphere(const BoundingSphere *sphere) const; 00066 00067 public: 00068 static TypeHandle get_class_type() { 00069 return _type_handle; 00070 } 00071 static void init_type() { 00072 GeometricBoundingVolume::init_type(); 00073 register_type(_type_handle, "OmniBoundingVolume", 00074 GeometricBoundingVolume::get_class_type()); 00075 } 00076 virtual TypeHandle get_type() const { 00077 return get_class_type(); 00078 } 00079 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00080 00081 private: 00082 static TypeHandle _type_handle; 00083 00084 friend class BoundingHexahedron; 00085 }; 00086 00087 #include "omniBoundingVolume.I" 00088 00089 #endif