00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef BVHStaticData_hxx
00019 #define BVHStaticData_hxx
00020
00021 #include <vector>
00022 #include <simgear/structure/SGReferenced.hxx>
00023 #include <simgear/structure/SGSharedPtr.hxx>
00024 #include <simgear/math/SGGeometry.hxx>
00025
00029 class SGMaterial;
00030
00031 namespace simgear {
00032
00033 class BVHStaticData : public SGReferenced {
00034 public:
00035 virtual ~BVHStaticData() {}
00036
00037 unsigned addVertex(const SGVec3f& vertex)
00038 { _vertices.push_back(vertex); return _vertices.size() - 1; }
00039 const SGVec3f& getVertex(unsigned i) const
00040 { return _vertices[i]; }
00041
00042
00043 unsigned addMaterial(const SGMaterial* material)
00044 { _materials.push_back(material); return _materials.size() - 1; }
00045 const SGMaterial* getMaterial(unsigned i) const
00046 { if (_materials.size() <= i) return 0; return _materials[i]; }
00047
00048 void trim()
00049 {
00050 std::vector<SGVec3f>(_vertices).swap(_vertices);
00051 std::vector<const SGMaterial*>(_materials).swap(_materials);
00052 }
00053
00054 private:
00055 std::vector<SGVec3f> _vertices;
00056 std::vector<const SGMaterial*> _materials;
00057 };
00058
00059 }
00060
00061 #endif