FileRenderOutput.cpp

Go to the documentation of this file.
00001 /**<!-------------------------------------------------------------------->
00002    @file   FileRenderOutput.cpp
00003    @author Travis Fischer (fisch0920@gmail.com)
00004    @author Matthew Jacobs (jacobs.mh@gmail.com)
00005    @date   Fall 2008
00006    
00007    @brief
00008       Records point samples from a renderer and naively reconstructs the 
00009    underlying image by storing samples into the bin/pixel which they fall 
00010    into, overwriting previous samples, and not using any reconstruction 
00011    filter. Writes results out to the given file in a custom format upon 
00012    completion of rendering.
00013    <!-------------------------------------------------------------------->**/
00014 
00015 #include "FileRenderOutput.h"
00016 #include "PointSample.h"
00017 
00018 #include <ResourceManager.h>
00019 #include <SpectralSampleSet.h>
00020 #include <QtCore>
00021 
00022 void FileRenderOutput::_addSample(const PointSample &sample) {
00023    ASSERT(m_output);
00024    unsigned col, row;
00025    
00026    m_viewport.getBin(sample.position, col, row);
00027    NaiveRenderOutput::_addSample(sample);
00028    
00029    // save an intermediate, temporary version of the render
00030    if (row == 0 && col == 0)
00031       m_output->save((std::string(".temp") + m_fileName).c_str());
00032 }
00033 
00034 void FileRenderOutput::finalize() {
00035    ASSERT(m_output);
00036    
00037    if (!m_output->save(m_fileName.c_str())) {
00038       ResourceManager::log.error << "error saving rendered results to file '" 
00039          << m_fileName << "'" << endl;
00040    } else {
00041       ResourceManager::log.info  << "saved rendered results to file '"
00042          << m_fileName << "'" << endl;
00043    }
00044 }
00045 

Generated on 28 Feb 2009 for Milton by doxygen 1.5.6