00001 /* 00002 File: HierRad.h 00003 00004 Function: Provides a class for lighting a scene using hierarchical 00005 (wavelet) radiosity. 00006 00007 Author(s): Andrew Willmott 00008 00009 Copyright: (c) 1997-2000, Andrew Willmott 00010 */ 00011 00012 #ifndef __HierRad__ 00013 #define __HierRad__ 00014 00015 #include "RadMethod.h" 00016 #include "HRElem.h" 00017 #include "Cluster.h" 00018 00019 class HierRad : public RadMethod 00020 { 00021 public: 00022 HierRad(); 00023 ~HierRad(); 00024 00025 virtual HRLink 00026 *CreateLink(); 00027 // create a new elem->elem link 00028 00029 Void SetScene(scScenePtr scene); 00030 Void ResetOptions(); 00031 RadElem *NewMesh(); 00032 Int Stage(Int stage); 00033 Void Draw(Renderer &r); 00034 Void DrawMatrix(Renderer &r); 00035 Void DumpStats(); 00036 Void ColourVertices(); 00037 PatchList *GetElements(); 00038 00039 Void PrintCmds(ostream &s) const; 00040 Bool ParseCmd(StrConst str, istream &s); 00041 00042 // Render methods 00043 Bool Render(); // override 00044 00045 // Linking methods 00046 Bool CreateClusterLink(); 00047 // for clustering 00048 Bool CreateInitialPatchLinks(); 00049 // for normal wavelet radiosity. 00050 00051 // Solution methods 00052 Bool ScheduledSolve(); 00053 Bool MultiGridSolve(); 00054 Bool TwoStageSolve(); 00055 00056 // Extras 00057 HRElem *ClosestHRIntersection(Point &start, Vector &direction, 00058 Point &hitPoint); 00059 00060 // Fields 00061 HRElemList clusterableElems; 00062 Cluster *cluster; 00063 HRElemPtr *trees; 00064 Int numTrees; 00065 HRElemPtr clusTree; 00066 PatchList *leaves; 00067 00068 Int iterations; 00069 Int poly; 00070 GCLReal error; 00071 Int linkPatch; 00072 Int linksCreated; 00073 Int linksCreatedLast; 00074 00075 00076 static Void *New() { return(new HierRad); }; 00077 }; 00078 00079 #endif