00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef BVHStaticTriangle_hxx
00019 #define BVHStaticTriangle_hxx
00020
00021 #include <simgear/math/SGGeometry.hxx>
00022 #include "BVHStaticData.hxx"
00023 #include "BVHStaticLeaf.hxx"
00024
00025 namespace simgear {
00026
00027 class BVHStaticTriangle : public BVHStaticLeaf {
00028 public:
00029 BVHStaticTriangle(unsigned material, const unsigned indices[3]);
00030 virtual ~BVHStaticTriangle();
00031
00032 virtual void accept(BVHVisitor& visitor, const BVHStaticData& data) const;
00033
00034 virtual SGBoxf computeBoundingBox(const BVHStaticData& data) const;
00035 virtual SGVec3f computeCenter(const BVHStaticData& data) const;
00036
00037 SGTrianglef getTriangle(const BVHStaticData& data) const
00038 {
00039 return SGTrianglef(data.getVertex(_indices[0]),
00040 data.getVertex(_indices[1]),
00041 data.getVertex(_indices[2]));
00042 }
00043
00044 unsigned getMaterialIndex() const
00045 { return _material; }
00046
00047 private:
00048 unsigned _indices[3];
00049 unsigned _material;
00050 };
00051
00052 }
00053
00054 #endif