00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef VRS_RAYTRACINGTECHNIQUE_H
00021 #define VRS_RAYTRACINGTECHNIQUE_H
00022
00023 #include <vrs/technique.h>
00024 #include <vrs/intersectioninfo.h>
00025 #include <vrs/ray.h>
00026
00027 namespace VRS {
00028
00029 class Engine;
00030 class Shape;
00031
00038 class VRS_CORE_API RayTracingTechnique :
00039 public Technique
00040 {
00041 public:
00042 virtual void start(Engine* engine);
00043 virtual void stop(Engine* engine);
00044
00045 virtual void setCallback(Callback1<SO<IntersectionInfo> >* callback);
00050 virtual void registerIntersection(IntersectionInfo* info);
00051 virtual void registerIntersection(
00052 const Vector& point,
00053 const Vector& normal,
00054 const Ray& ray,
00055 const Matrix& modelview,
00056 const Matrix& orientation,
00057 const Matrix& projection,
00058 int hint = 0,
00059 unsigned int instanceInfo = 0,
00060 UINT32 id = 0
00061 );
00065 static bool checkBounds(const Ray& ray, const Bounds& bbox);
00067
00068 VRS_TYPEINFO(RayTracingTechnique, Technique);
00069
00070 protected:
00071 void intersect(Engine*, const Shape*, const Ray&);
00075 void check (
00076 Engine*,
00077 const Matrix&,
00078 const Matrix&,
00079 const Matrix&,
00080 const Shape*,
00081 const Ray&
00082 );
00088 private:
00089 SO<Callback1<SO<IntersectionInfo> > > callback_;
00090 SO<Shape> realShape_;
00091 };
00092
00093 }
00094
00095 #endif // VRS_RAYTRACINGTECHNIQUE_H