00001 /* -*- C++ -*- */ 00002 00003 /* COPYRIGHT 00004 * 00005 * This file is part of the Visual Effects Engine - VEE 00006 * 00007 * Read the "VEE-LICENSE" file for the license. 00008 * 00009 * Authors & Copyright: 00010 * 00011 * Tommi Ilmonen, Tuukka Heikura, Marko Myllymaa and 00012 * Janne Kontkanen 2001-2004 00013 * 00014 * Additional copyrights: Tekes 2003-2004 00015 * 00016 * firstname.lastname@hut.fi 00017 * 00018 */ 00019 00020 #ifndef GEE_SPHERE_GROUP_H 00021 #define GEE_SPHERE_GROUP_H 00022 00023 #include <gee_containment.h> 00024 00025 #include <vector> 00026 00027 class GEE_SphereGroup : public GEE_Containment 00028 { 00029 public: 00030 class Sphere 00031 { 00032 public: 00033 VEE_Vector3 m_location; 00034 float m_radius; 00035 float m_radiusSquared; 00036 }; 00037 00038 GEE_SphereGroup(); 00039 ~GEE_SphereGroup(); 00040 00041 virtual void getBoundingBox(VEE_BoundingBox *); 00042 virtual bool contains(const VEE_Vector3 &); 00043 virtual bool intersects(const GEE_SimpleTriangle &); 00044 00045 void setRadius(float r) { m_radius = r; } 00046 00047 void addSphere(const VEE_Vector3 &, float radius = -1.0f); 00048 void clear() { m_locations.clear(); } 00049 00050 const Sphere * locationBegin() const { return & * m_locations.begin(); } 00051 const Sphere * locationEnd() const { return & * m_locations.end(); } 00052 00053 protected: 00054 uint locationCount() const { return m_locations.size(); } 00055 00056 float m_radius; 00057 00058 private: 00059 00060 00061 std::vector<Sphere> m_locations; 00062 VEE_BoundingBox m_bbox; 00063 }; 00064 00065 #endif