PovrayWriter.h 2.38 KB
Newer Older
Thomas Witkowski's avatar
Thomas Witkowski committed
1 2 3 4
// ============================================================================
// ==                                                                        ==
// == AMDiS - Adaptive multidimensional simulations                          ==
// ==                                                                        ==
5
// ==  http://www.amdis-fem.org                                              ==
Thomas Witkowski's avatar
Thomas Witkowski committed
6 7
// ==                                                                        ==
// ============================================================================
8 9 10 11 12 13 14 15 16 17 18 19
//
// Software License for AMDiS
//
// Copyright (c) 2010 Dresden University of Technology 
// All rights reserved.
// Authors: Simon Vey, Thomas Witkowski et al.
//
// This file is part of AMDiS
//
// See also license.opensource.txt in the distribution.


Thomas Witkowski's avatar
Thomas Witkowski committed
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50

/** \file FileWriter.h */

// Marcel Schiffel, 23.06.09

#ifndef AMDIS_POVRAYWRITER_H
#define AMDIS_POVRAYWRITER_H

#include <string>
#include <fstream>
#include <iostream>
#include "DataCollector.h"
#include "FileWriter.h"

using namespace std;

namespace AMDiS {


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


  class PovrayWriter {
  public:
51
    PovrayWriter(FileWriter *fw, DataCollector<> *dc) : fileWriter(fw), dataCollector(dc)
Thomas Witkowski's avatar
Thomas Witkowski committed
52
    {
53
//       FUNCNAME("PovrayWriter::PovrayWriter()");	
Thomas Witkowski's avatar
Thomas Witkowski committed
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69

      // abort if problem not 3D //FIX THAT!!!
      /*	TEST_EXIT(dataCollector->getMesh()->getDim()==3)
		("Povray export only possible for 3D data!");*/  

      bBox = NULL;
    }

    ~PovrayWriter();
    int writeFile(const std::string filename);

    // provides the bounding box of the mesh (lazy evaluation, bounding box is computed only once)
    BoundingBox *getBoundingBox(ofstream&);

  private:
    FileWriter *fileWriter;
70
    DataCollector<> *dataCollector;
Thomas Witkowski's avatar
Thomas Witkowski committed
71 72 73 74 75
    BoundingBox *bBox;

    // TODO: remove!
    void tryMeshTraversal(ofstream&);

76
    void writeTestStuff(ofstream&, DataCollector<>&); // TODO: remove/rename
Thomas Witkowski's avatar
Thomas Witkowski committed
77 78 79 80
    void writeHeader(ofstream&);
    void writeIncludes(ofstream&);
    void writeCamera(ofstream&);
    void writeLight(ofstream&);
81 82 83 84
    void writeMesh2(ofstream&, DataCollector<>&);
    void writeVertexVectors(ofstream&, DataCollector<>&);
    void writeTextureList(ofstream&, DataCollector<>&);
    void writeFaceIndices(ofstream&, DataCollector<>&);
Thomas Witkowski's avatar
Thomas Witkowski committed
85 86 87 88 89
  };

} // end of namespace AMDiS

#endif