00001
00002
00003 #ifndef __OSG_ADAPTER_H
00004 #define __OSG_ADAPTER_H
00005
00006 #include <esg/Group.h>
00007 #include <esg/spacesorting/BVH.h>
00008 #include <esg/explorer/RayIntExplorer.h>
00009 #include <esg/explorer/ExtentExplorer.h>
00010 #include <esg/explorer/NExtentsExplorer.h>
00011 #include <esg/OSGPolygon.h>
00012 #include <esg/Export>
00013
00014 #include <osg/Array>
00015 #include <osg/PrimitiveSet>
00016 #include <osg/Geometry>
00017
00018 namespace esg {
00019
00030 class ESG_OSG_EXPORT OSGAdapter {
00031 protected:
00032 Group* _pGroupNode;
00033
00034 void _put_polygon(osg::Geometry::PrimitiveSetList *,
00035 osg::Vec3Array *,
00036 osg::Vec3Array *,
00037 osg::Geometry::AttributeBinding);
00038
00039 public:
00043 enum bvType { BV_FDH14, BV_AABB, BV_SPHERE };
00044
00045 public:
00046 OSGAdapter (osg::Geometry* ,
00047 unsigned ,
00048 unsigned ,
00049 BVList::SplitStrategy ,
00050 bvType );
00051
00052 OSGAdapter (AutoPtr<Geometry>* ,
00053 unsigned ,
00054 unsigned ,
00055 BVList::SplitStrategy ,
00056 bvType );
00057
00058
00059
00060 OSGAdapter (Geometry* ,
00061 unsigned ,
00062 unsigned ,
00063 BVList::SplitStrategy ,
00064 bvType );
00065
00066 virtual ~OSGAdapter () { if (_pGroupNode) delete _pGroupNode; }
00067
00068
00069
00070
00071
00072
00073 double* getVertices (Matrix4* ,
00074 unsigned* );
00075
00076
00077
00078 double distance (Matrix4* ,
00079 OSGAdapter& ,
00080 Matrix4* ,
00081 BVH::Node** ,
00082 BVH::Node** ,
00083 Vector3* pDir=NULL ,
00084 unsigned d1=UINT_MAX ,
00085 unsigned d2=UINT_MAX );
00086
00087
00088 bool separation (Matrix4* ,
00089 OSGAdapter& ,
00090 Matrix4* ,
00091 Vector3* pDir=NULL ,
00092 unsigned d1=UINT_MAX ,
00093 unsigned d2=UINT_MAX );
00094
00095
00096 Geometry** collision (Matrix4* ,
00097 float, float, float ,
00098 float ,
00099 int* );
00100
00101
00102 PointEnv* rayIntersection (const Matrix4* pTrMat ,
00103 const Vector3& origin,
00104 const Vector3& direction,
00105 int mask = (ENV_WANT_INTERSECTION|ENV_WANT_NORMAL|ENV_WANT_TRANSFORMATION),
00106 float maxDist = FLT_MAX);
00107
00108
00109 Interval extent (const Matrix4* pTrMat ,
00110 const Vector3& direction);
00111
00112
00113 Interval* nExtents (const Matrix4* pTrMat ,
00114 const Vector3* directions,
00115 unsigned nDirs);
00116 };
00117
00118 };
00119
00120 #endif // __OSG_ADAPTER_H