00001
00002
00003 #ifndef __RADIOSITY_H
00004 #define __RADIOSITY_H
00005
00006 #include <gra/reflection/ReflectionModel.h>
00007 #include <esg/Intersector.h>
00008 #include <esg/energy/PolygonalEnergy.h>
00009 #include <esg/mesh/Mesh.h>
00010
00011 using namespace esg;
00012
00013 namespace gra {
00014
00015 class GRA_EXPORT Radiosity : public ReflectionModel {
00016 public:
00017 struct Patch {
00018 PolygonalEnergy * pEnergy;
00019 Mesh::Plane * pMeshPlane;
00020 Vector3 reflectance;
00021 Vector3 emittance;
00022 Vector3 normal;
00023 Vector3 centre;
00024 float area;
00025
00026 Patch (PolygonalEnergy *,
00027 Mesh::Plane *,
00028 const Vector3 & ,
00029 const Vector3 & ,
00030 const Vector3 & ,
00031 float );
00032 };
00033
00034 protected:
00035 Intersector * _pIntersector;
00036 int _quadLevel;
00037 float _dFError;
00038 List<Patch> _scenePatches;
00039 int _stage;
00040 bool _useAmbient;
00041
00042 protected:
00043
00044
00045
00046 virtual float _edge_area (const Vector3& ,
00047 const Vector3& ,
00048 const Vector3& );
00049
00050
00051
00052
00053 virtual float _est_patch_factor(Patch& ,
00054 const Vector3& ,
00055 const Vector3& );
00056
00057
00058
00059
00060 virtual float _patch_factor(Patch& ,
00061 const Vector3& ,
00062 const Vector3& );
00063
00064
00065
00066
00067 virtual float _est_form_factor (Patch& , Patch& );
00068
00069
00070
00071
00072 virtual void _make_form_factors (Patch& , Vector3[]);
00073
00074
00075
00076
00077 virtual float _visibility (Patch& , Patch& );
00078
00079 public:
00080 Radiosity (Intersector * i = NULL,
00081 int q = 0,
00082 float f = 0.0,
00083 bool a = true)
00084 : _pIntersector(i),
00085 _quadLevel(q),
00086 _dFError(f),
00087 _useAmbient(a) {}
00088
00089 virtual ~Radiosity () { _scenePatches.deleteAll(); }
00090
00091
00092
00093
00094
00095
00096 virtual void setBRDF (BRDF *) {}
00097
00098
00099
00100
00101 virtual void setEmittance (Emittance *) {}
00102
00103
00104
00105
00106
00107
00108
00109 virtual void setScene (Scene * );
00110
00111
00112
00113
00114
00115
00116 virtual Color3f* illuminatePoint (PointEnv&);
00117 };
00118
00119 }
00120
00121 #endif // __RADIOSITY_H