00001 /* 00002 File: HRMesh.h 00003 00004 Function: Defines a hierarchical mesh for use with hierarchical/ 00005 wavelet radiosity methods. 00006 00007 Author(s): Andrew Willmott 00008 00009 Copyright: (c) 1997-2000, Andrew Willmott 00010 */ 00011 00012 00013 #ifndef __HRMesh__ 00014 #define __HRMesh__ 00015 00016 #include "HRElem.h" 00017 #include "HierMesh.h" 00018 00019 // --- Hierarchical Radiosity mesh element ------------------------------------ 00020 00021 00022 class HRMeshElem : public HRElem, public HierElem 00024 { 00025 public: 00026 HRMeshElem(); 00027 00028 Void Reset(); 00029 Void Print(ostream &s); 00030 Void CreatePatches(PatchList &patches); 00031 00032 Bool IsLeaf() 00033 { return((flags & hrIntNode) == 0); }; 00034 Void ApplyToChildren(Void (HRElem::*method)(Void*), 00035 Void *ref = 0); 00036 Void MakeChildLinks(HRElem *other, HRLink *link, 00037 Int which, Int levels); 00038 HRMeshElem *Child(Int i) 00039 { return((HRMeshElem*) child[i]); }; 00040 00041 Void Draw(Renderer &r); 00042 Void DrawNodeElem(Renderer &r); 00043 Void DrawLeafElem(Renderer &r); 00044 Void DrawMatrixRec(Void *dmi); 00045 00046 Void EltUpdateBounds(Point &min, Point &max); 00047 GCLReal EltArea() { return(area); }; 00048 GCLReal EltProjArea(const Vector &v) 00049 { return(area * Max(0.0, dot(normal, v))); }; 00050 Point EltCentre() { return(centre); }; 00051 Colour EltE() { return(Emittance()); }; 00052 Colour EltRho() { return(Reflectance()); }; 00053 00054 Void EltSetVisPoints(HRElem *to, Point p[]); 00055 Void EltGetSamples(Int numSamples, Point pts[]); 00056 00057 // --- kernel sampling... ------------------------------------------------- 00058 00059 Void SampleKernel( 00060 const GCLMat &fromU, // source patch samples 00061 HRMeshElem *to, // dest. patch 00062 const GCLMat &toU, // destination samples 00063 GCLMat &samples, // results of sampling 00064 GCLReal *visPtr // accumulate visibility 00065 ); 00069 Void SubToSubFormFactor( 00070 Int nFrom, 00071 HRMeshElem *to, 00072 Int nTo, 00073 GCLMat &samples, 00074 GCLReal *visPtr 00075 ); 00079 Void EstSubFormFactor( 00080 Int nFrom, 00081 HRMeshElem *to, 00082 const GCLMat &toU, 00083 GCLMat &samples, 00084 GCLReal *visPtr 00085 ); 00089 Void DrawSampledLeaf(Renderer &r, Int n); 00091 Void HRCorrectLeaves(); 00093 Void SetHighlight(Int h); 00094 }; 00095 00096 #endif