00001 /*---------------------------------------------------------------------------*\ 00002 * OpenSG * 00003 * * 00004 * * 00005 * Copyright (C) 2000-2002 by the OpenSG Forum * 00006 * * 00007 * www.opensg.org * 00008 * * 00009 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de * 00010 * * 00011 \*---------------------------------------------------------------------------*/ 00012 /*---------------------------------------------------------------------------*\ 00013 * License * 00014 * * 00015 * This library is free software; you can redistribute it and/or modify it * 00016 * under the terms of the GNU Library General Public License as published * 00017 * by the Free Software Foundation, version 2. * 00018 * * 00019 * This library is distributed in the hope that it will be useful, but * 00020 * WITHOUT ANY WARRANTY; without even the implied warranty of * 00021 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00022 * Library General Public License for more details. * 00023 * * 00024 * You should have received a copy of the GNU Library General Public * 00025 * License along with this library; if not, write to the Free Software * 00026 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * 00027 * * 00028 * * 00029 \*---------------------------------------------------------------------------*/ 00030 /*---------------------------------------------------------------------------*\ 00031 * Changes * 00032 * * 00033 * * 00034 * * 00035 * * 00036 * * 00037 * * 00038 \*---------------------------------------------------------------------------*/ 00039 00040 #ifndef _OSGDYNAMICVOLUME_H_ 00041 #define _OSGDYNAMICVOLUME_H_ 00042 00043 #include <OSGBaseTypes.h> 00044 #include <OSGBaseFunctions.h> 00045 00046 #include <OSGVolume.h> 00047 00048 OSG_BEGIN_NAMESPACE 00049 00053 class OSG_BASE_DLLMAPPING DynamicVolume : public Volume 00054 { 00055 /*========================== PUBLIC =================================*/ 00056 00057 public: 00058 00059 enum Type 00060 { 00061 BOX_VOLUME, 00062 SPHERE_VOLUME 00063 }; 00064 00065 /*---------------------------------------------------------------------*/ 00069 DynamicVolume( Type type = BOX_VOLUME); 00070 DynamicVolume(const DynamicVolume &obj ); 00071 00073 /*---------------------------------------------------------------------*/ 00077 virtual ~DynamicVolume(void); 00078 00080 /*---------------------------------------------------------------------*/ 00084 const Volume &getInstance (void ) const; 00085 Volume &getInstance (void ); 00086 void instanceChanged(void ); 00087 00088 00089 Type getType (void ) const; 00090 void setVolumeType (Type type); 00091 void morphToType (Type type); 00092 00094 /*---------------------------------------------------------------------*/ 00098 virtual void getCenter (Pnt3f ¢er ) const; 00099 virtual Real32 getScalarVolume(void ) const; 00100 virtual void getBounds (Pnt3f &min, Pnt3f &max) const; 00101 00103 /*---------------------------------------------------------------------*/ 00107 virtual void extendBy(const Pnt3f &pt ); 00108 virtual void extendBy(const Volume &volume); 00109 00111 /*---------------------------------------------------------------------*/ 00115 virtual bool intersect (const Pnt3f &point ) const; 00116 virtual bool intersect (const Line &line ) const; 00117 virtual bool intersect (const Line &line, 00118 Real32 &enter, 00119 Real32 &exit ) const; 00120 virtual bool intersect (const Volume &volume) const; 00121 virtual bool isOnSurface(const Pnt3f &point ) const; 00122 00124 /*---------------------------------------------------------------------*/ 00128 virtual void transform (const Matrix &matrix); 00129 00131 /*---------------------------------------------------------------------*/ 00135 virtual void dump( UInt32 uiIndent = 0, 00136 const BitVector bvFlags = 0) const; 00137 00139 /*---------------------------------------------------------------------*/ 00143 bool operator ==(const DynamicVolume &other ) const; 00144 00145 DynamicVolume &operator = (const DynamicVolume &source); 00146 00148 /*========================= PROTECTED ===============================*/ 00149 00150 protected: 00151 00152 /*========================== PRIVATE ================================*/ 00153 00154 private: 00155 00156 Type _type; 00157 Real64 _volumeMem[5]; // use Real64 to create the 32 bytes for alignment 00158 // safety. This assumes that Real64 has the most 00159 // stringent alignment requirements!!! 00160 }; 00161 00162 OSG_BASE_DLLMAPPING 00163 std::ostream &operator <<( std::ostream &outStream, 00164 const DynamicVolume &vol); 00165 00166 typedef DynamicVolume* DynamicVolumeP; 00167 00168 OSG_END_NAMESPACE 00169 00170 #include "OSGDynamicVolume.inl" 00171 00172 #endif // _OSGDYNAMICVOLUME_H_
1.4.3