PovrayWriter.h 2.23 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
/******************************************************************************
 *
 * AMDiS - Adaptive multidimensional simulations
 *
 * Copyright (C) 2013 Dresden University of Technology. All Rights Reserved.
 * Web: https://fusionforge.zih.tu-dresden.de/projects/amdis
 *
 * Authors: 
 * Simon Vey, Thomas Witkowski, Andreas Naumann, Simon Praetorius, et al.
 *
 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 *
 *
 * This file is part of AMDiS
 *
 * See also license.opensource.txt in the distribution.
 * 
 ******************************************************************************/
20 21


Thomas Witkowski's avatar
Thomas Witkowski committed
22 23 24 25 26 27 28 29 30 31 32

/** \file FileWriter.h */

// Marcel Schiffel, 23.06.09

#ifndef AMDIS_POVRAYWRITER_H
#define AMDIS_POVRAYWRITER_H

#include <string>
#include <fstream>
#include <iostream>
33
#include "Global.h"
Thomas Witkowski's avatar
Thomas Witkowski committed
34 35 36
#include "DataCollector.h"
#include "FileWriter.h"

37
namespace AMDiS { namespace io {
Thomas Witkowski's avatar
Thomas Witkowski committed
38 39 40 41 42 43 44 45 46 47 48

  typedef struct {
    double minx;
    double maxx;
    double miny;
    double maxy;
    double minz;
    double maxz;
  } BoundingBox;


49 50 51 52 53 54 55
  /** \ingroup Output
   *  
   * \brief
   * Class which writes a container to a povray-file.
   */ 
  class PovrayWriter 
  {
Thomas Witkowski's avatar
Thomas Witkowski committed
56
  public:
57
    PovrayWriter(DataCollector<> *dc) : dataCollector(dc), bBox(NULL) { }
Thomas Witkowski's avatar
Thomas Witkowski committed
58 59

    ~PovrayWriter();
60 61 62
    
    /// writes a povray script for the current time step to the specified file.
    void writeFile(std::string filename);
Thomas Witkowski's avatar
Thomas Witkowski committed
63 64

    // provides the bounding box of the mesh (lazy evaluation, bounding box is computed only once)
65
    BoundingBox *getBoundingBox(std::ofstream&);
Thomas Witkowski's avatar
Thomas Witkowski committed
66 67

  private:
68
    DataCollector<> *dataCollector;
Thomas Witkowski's avatar
Thomas Witkowski committed
69 70 71
    BoundingBox *bBox;

    // TODO: remove!
72 73 74 75 76 77 78 79 80 81 82
    void tryMeshTraversal(std::ofstream&);

    void writeTestStuff(std::ofstream&, DataCollector<>&); // TODO: remove/rename
    void writeHeader(std::ofstream&);
    void writeIncludes(std::ofstream&);
    void writeCamera(std::ofstream&);
    void writeLight(std::ofstream&);
    void writeMesh2(std::ofstream&, DataCollector<>&);
    void writeVertexVectors(std::ofstream&, DataCollector<>&);
    void writeTextureList(std::ofstream&, DataCollector<>&);
    void writeFaceIndices(std::ofstream&, DataCollector<>&);
Thomas Witkowski's avatar
Thomas Witkowski committed
83 84
  };

85
} } // end namespace io, AMDiS
Thomas Witkowski's avatar
Thomas Witkowski committed
86 87

#endif