AggregateBSDF.h
Go to the documentation of this file.00001 /**<!--------------------------------------------------------------------> 00002 @class AggregateBSDF 00003 @author Travis Fischer (fisch0920@gmail.com) 00004 @author Matthew Jacobs (jacobs.mh@gmail.com) 00005 @date Fall 2008 00006 00007 @brief 00008 Linear combination of different BSDF implementations, where the 00009 coefficients are determined either a priori (inherent property described 00010 in scenefile) or via a texture map lookup 00011 <!-------------------------------------------------------------------->**/ 00012 00013 #ifndef AGGREGATE_BSDF_H_ 00014 #define AGGREGATE_BSDF_H_ 00015 00016 #include <materials/BSDF.h> 00017 00018 struct BSDFNode { 00019 BSDF *bsdf; 00020 real_t pdf; 00021 00022 BSDFNode(BSDF *bsdf_, real_t pdf_) 00023 : bsdf(bsdf_), pdf(pdf_) 00024 { } 00025 }; 00026 00027 DECLARE_STL_TYPEDEF(std::vector<BSDFNode>, BSDFList); 00028 00029 class AggregateBSDF : public BSDF { 00030 public: 00031 ///@name Constructors 00032 //@{----------------------------------------------------------------- 00033 00034 inline explicit AggregateBSDF(SurfacePoint &pt, Material *parent = NULL) 00035 : BSDF(pt, parent), m_bsdf(0) 00036 { } 00037 00038 virtual ~AggregateBSDF(); 00039 00040 //@}----------------------------------------------------------------- 00041 ///@name Initialization 00042 //@{----------------------------------------------------------------- 00043 00044 /** 00045 * @brief 00046 * Initializes this aggregate BSDF for sampling by selecting one 00047 * of the possible child BSDFs 00048 */ 00049 virtual void init(); 00050 00051 00052 //@}----------------------------------------------------------------- 00053 ///@name Main usage interface 00054 //@{----------------------------------------------------------------- 00055 00056 virtual void setWi(const Vector3 &wi); 00057 00058 virtual Event sample(); 00059 00060 virtual real_t getPdf(const Event &event); 00061 00062 virtual SpectralSampleSet getBSDF(const Vector3 &wi, const Vector3 &wo); 00063 00064 virtual bool isSpecular(Event &event) const; 00065 00066 00067 //@}----------------------------------------------------------------- 00068 00069 protected: 00070 BSDFList m_bsdfs; 00071 00072 unsigned m_bsdf; 00073 }; 00074 00075 #endif // AGGREGATE_BSDF_H_ 00076
Generated on 28 Feb 2009 for Milton by
1.5.6