RayCaster.cpp

Go to the documentation of this file.
00001 /**<!-------------------------------------------------------------------->
00002    @file   RayCaster.cpp
00003    @author Travis Fischer (fisch0920@gmail.com)
00004    @author Matthew Jacobs (jacobs.mh@gmail.com)
00005    @date   Fall 2008
00006 
00007    @brief
00008       Simple, non-recursive raycaster
00009    <!-------------------------------------------------------------------->**/
00010 
00011 #include "RayCaster.h"
00012 #include <DirectIllumination.h>
00013 #include <SurfacePoint.h>
00014 #include <Material.h>
00015 #include <Camera.h>
00016 #include <Scene.h>
00017 #include <QtCore>
00018 #include <Ray.h>
00019 
00020 void RayCaster::init() {
00021    m_ambient = getValue<SpectralSampleSet>("ambient", m_ambient);
00022    
00023    RayTracer::init();
00024 }
00025 
00026 void RayCaster::_evaluate(const Ray &ray, SpectralSampleSet &outRadiance, 
00027                           PropertyMap &data)
00028 {
00029    // find closest intersection
00030    SurfacePoint pt;
00031    const real_t t = m_scene->getIntersection(ray, pt);
00032    
00033    // lazily initialize SurfacePoint and return if no intersection
00034    if (!pt.init(ray, t)) {
00035       outRadiance += m_scene->getBackgroundRadiance(ray.direction);
00036       return;
00037    }
00038    
00039    // evaluate emitted radiance from intersection point
00040    outRadiance += pt.emitter->getLe(-ray.direction);
00041    
00042    // estimate direct illumination
00043    outRadiance += m_directIllumination->evaluate(pt);
00044    
00045    // ambient term
00046    outRadiance += m_ambient;
00047 }
00048 

Generated on 28 Feb 2009 for Milton by doxygen 1.5.6