00001
00002
00003 #ifndef __SHADOW_EXPLORER_H
00004 #define __SHADOW_EXPLORER_H
00005
00006 #include <esg/Definitions.h>
00007 #include <esg/explorer/RayIntExplorer.h>
00008 #include <esg/LightArray.h>
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 namespace esg {
00019
00020 class OGSCENE_EXPORT ShadowExplorer : public RayIntExplorer {
00021 protected:
00022 PointEnv _env;
00023 Geometry * _pGeometry;
00024 SceneGraphObject::OID _lightOID;
00025 LightArray::BlockingObj _blockingObj;
00026
00027 protected:
00028
00029
00030
00031 virtual bool _explore (SceneGraphObject&);
00032 virtual bool _iterate (SceneGraphObject&) {return false;}
00033 virtual bool _process_leaf (SceneGraphObject&) {return false;}
00034 virtual void _accept_new_transformation (const Matrix4&) {}
00035
00036 public:
00037 ShadowExplorer(const Vector3& o,
00038 const Vector3& d,
00039 SceneGraphObject::OID oid,
00040 float m = MAXFLOAT)
00041 : RayIntExplorer(o, d, NULL, m), _lightOID(oid) {}
00042
00043 virtual void explore (SceneGraphObject&);
00044
00045 bool result () { return (_blockingObj.pObj != NULL); }
00046
00047 const LightArray::BlockingObj& getBlockingObj (void) const { return _blockingObj; }
00048
00049 virtual void reinit (const Vector3& o,
00050 const Vector3& d,
00051 SceneGraphObject::OID oid,
00052 Intersector* pI = NULL,
00053 float m = MAXFLOAT)
00054 {
00055 _transformed = false;
00056 _origin.set(o);
00057 _direction.set(d);
00058 _trOrigin.set(o);
00059 _trDirection.set(d);
00060 _maxDist = m;
00061 _blockingObj.pObj = NULL;
00062 _blockingObj.transformed = false;
00063 _lightOID = oid;
00064 }
00065
00066 virtual void reinit (const Vector3& o,
00067 const Vector3& d,
00068 SceneGraphObject::OID oid,
00069 float m = MAXFLOAT)
00070 {
00071 _transformed = false;
00072 _origin.set(o);
00073 _direction.set(d);
00074 _trOrigin.set(o);
00075 _trDirection.set(d);
00076 _maxDist = m;
00077 _blockingObj.pObj = NULL;
00078 _blockingObj.transformed = false;
00079 _lightOID = oid;
00080 }
00081 };
00082
00083 };
00084
00085 #endif // __SHADOW_POINT_EXPLORER_H