PointEmittance.cc

Go to the documentation of this file.
00001 #include <esg/emittance/PointEmittance.h>
00002 
00003 using namespace esg;
00004 
00005 Sphere PointEmittance::_stochasticEmitter = Sphere(0., 0., 0., 1.);
00006 
00007 Emittance* PointEmittance::clone() const {
00008     PointEmittance * pRet = new PointEmittance();
00009     pRet->_duplicate_attributes(*this);
00010     return pRet;
00011 }
00012 
00013 bool PointEmittance::intensity(const Vector3& v, Color3f& c) const
00014 {
00015     Vector3 dir(v - _location);
00016     float   d = dir.length();
00017     c.set(_intensity);
00018     ESG_ATTENUATION(d, c);
00019     return true;
00020 }
00021 
00022 bool PointEmittance::intensity(const Vector3&, float d, Color3f& c) const
00023 {
00024     c.set(_intensity);
00025     ESG_ATTENUATION(d, c);
00026     return true;
00027 }
00028 
00029 bool PointEmittance::stochasticEmission(Vector3& d)
00030 {
00031     PointEnv pe;
00032     _stochasticEmitter.randomSample(ENV_WANT_SURFACE_POINT, pe, NULL);
00033     if (!(pe.mask & ENV_HAVE_SURFACE_POINT)) return false;
00034     d.set(pe.intersection);
00035     return true;
00036 }

Generated on Wed Jun 28 12:24:32 2006 for esg by  doxygen 1.4.6