src/io/PovrayWriter.cpp
void PovrayWriter::writeTextureList(ofstream& out, DataCollector<>& dataCollector)
    {
      // prepare some data structures
      Mesh* mesh = dataCollector.getMesh();
      DOFVector<std::list<VertexInfo>>* vertexInfos = dataCollector.getVertexInfos();
      DOFVector<std::list<VertexInfo>>::Iterator it(vertexInfos, USED_DOFS);


      // begin of texture_list block
      out << "\ttexture_list {" << endl;

      // compute and write the number of textures/colors (one for each vertex)
      int nTextures = mesh->getNumberOfVertices();
      out << "\t\t" << nTextures << "," << endl;

      // For all DOFs of vertices, write the coordinates.
      for (it.reset(); !it.end(); ++it)
      {
        // for all vertex infos of this DOF
        for (std::list<VertexInfo>::iterator it2 = it->begin(); it2 != it->end(); ++it2)
        {
          // test: use y-coordinate to compute color
          double redValue = it2->coords[1];
          redValue = std::max(0., redValue);
          redValue = std::min(redValue, 1.);

          out << "\n\t\ttexture{ pigment{ rgb"<< getColorString(redValue) <<" } }" << ",";
        }
      }
      long pos = out.tellp();
      out.seekp(pos - 1);
      out << endl;
      // end of texture_list block
      out << "\t}" << endl;
    }
// writes the list of textures (basically one color for each vertex, used to draw a color gradient on each triangle)
writes the list of textures (basically one color for each vertex, used to draw a color gradient on each triangle)
writes the list of textures ( basically one color for each vertex used to draw a color gradient on each triangle )
void PovrayWriter::writeTextureList(ofstream& out, DataCollector<>& dataCollector)
    {
      Mesh* mesh = dataCollector.getMesh();
      DOFVector<std::list<VertexInfo>>* vertexInfos = dataCollector.getVertexInfos();
      DOFVector<std::list<VertexInfo>>::Iterator it(vertexInfos, USED_DOFS);
      out << "\ttexture_list {" << endl;
      int nTextures = mesh->getNumberOfVertices();
      out << "\t\t" << nTextures << "," << endl;
      for (it.reset(); !it.end(); ++it)
      {
        for (std::list<VertexInfo>::iterator it2 = it->begin(); it2 != it->end(); ++it2)
        {
          double redValue = it2->coords[1];
          redValue = std::max(0., redValue);
          redValue = std::min(redValue, 1.);
          out << "\n\t\ttexture{ pigment{ rgb"<< getColorString(redValue) <<" } }" << ",";
        }
      }
      long pos = out.tellp();
      out.seekp(pos - 1);
      out << endl;
      out << "\t}" << endl;
    }
void PovrayWriter :: writeTextureList ( ofstream & out , DataCollector < > & dataCollector ) { Mesh * mesh = dataCollector . getMesh ( ) ; DOFVector < std :: list < VertexInfo > > * vertexInfos = dataCollector . getVertexInfos ( ) ; DOFVector < std :: list < VertexInfo > > :: Iterator it ( vertexInfos , USED_DOFS ) ; out << " \t " << endl ; int nTextures = mesh -> getNumberOfVertices ( ) ; out << " \t \t " << nTextures << " " << endl ; for ( it . reset ( ) ; ! it . end ( ) ; ++ it ) { for ( std :: list < VertexInfo > :: iterator it2 = it -> begin ( ) ; it2 != it -> end ( ) ; ++ it2 ) { double redValue = it2 -> coords [ 1 ] ; redValue = std :: max ( 0. , redValue ) ; redValue = std :: min ( redValue , 1. ) ; out << " \n \t \t " << getColorString ( redValue ) << " " << " " ; } } long pos = out . tellp ( ) ; out . seekp ( pos - 1 ) ; out << endl ; out << " \t " << endl ; }
writes the list of textures (basically one color for each vertex, used to draw a color gradient on each triangle)
writes the list of textures ( basically one color for each vertex used to draw a color gradient on each triangle )
// prepare some data structures // begin of texture_list block // compute and write the number of textures/colors (one for each vertex) // For all DOFs of vertices, write the coordinates. // for all vertex infos of this DOF // test: use y-coordinate to compute color // end of texture_list block