TAPs 0.7.7.3
TAPsWriteTAPs.cpp
Go to the documentation of this file.
00001 /******************************************************************************
00002 TAPsWriteTAPs.hpp
00003 
00004 Create and write a .TAPs file from an OpenGL Polygonal Model Object.
00005 
00006 SUKITTI PUNAK   (11/22/2004)
00007 UPDATE          (05/15/2005)
00008 ******************************************************************************/
00009 #include "TAPsWriteTAPs.hpp"
00010 // Using Inclusion Model (i.e. definitions are included in declarations)
00011 //                       (this name.cpp is included in name.hpp)
00012 // Each friend is defined directly inside its declaration.
00013 
00014 BEGIN_NAMESPACE_TAPs
00015 //=============================================================================
00016 template <typename T> FILE * WriteTAPs<T>::fileOut = NULL;
00017 template <typename T> std::vector<HEVertex<T> *> WriteTAPs<T>::g_heVertexPtrList;
00018 //=============================================================================
00019 //-----------------------------------------------------------------------------
00020 // Write the output file
00021 template <typename T>
00022 bool WriteTAPs<T>::WriteFile( OpenGL::OpenGLModel<T> * const prModel, char *fileName )
00023 {
00024     //-------------------------------------------------------------------
00025     // Open the output file
00026     fileOut = fopen( fileName, "w" );
00027     if ( !fileOut ) {
00028         std::cout << "WARNING: Failed Writing File --> Cannot open the file for writing!"
00029             << std::endl;
00030         return false;
00031     }
00032     //-------------------------------------------------------------------
00033     // Write the output file from an HalfEdgeModel object
00034     {
00035         OpenGL::HalfEdgeModel<T> * const  heModel = 
00036             dynamic_cast< OpenGL::HalfEdgeModel<T> * const >( prModel );
00037         if ( heModel ) {
00038             std::cout << "Writing A HalfEdge Model to TAPs file \"" 
00039                 << fileName << "\"\n";
00040             WriteNodeFormat( heModel );
00041             WriteNodeMaterial( heModel );
00042             WriteNodeImageTexture( heModel );
00043             WriteNodeVertices( heModel );
00044             WriteNodeFaces( heModel );
00045             WriteNodeTextureCoordinates( heModel );
00046             fclose(fileOut);
00047             return true;
00048         }
00049     }
00050     //-------------------------------------------------------------------
00051     // Write the output file from an XPolygonalModel object
00052     {
00053         OpenGL::XPolygonalModel<T> * const  xPolygonalModel = 
00054             dynamic_cast< OpenGL::XPolygonalModel<T> * const >( prModel );
00055         if ( xPolygonalModel ) {
00056             std::cout << "Writing An XPolygonal Model to TAPs file \"" 
00057                 << fileName << "\"\n";
00058             WriteNodeFormat( xPolygonalModel );
00059             WriteNodeMaterial( xPolygonalModel );
00060             WriteNodeImageTexture( xPolygonalModel );
00061             WriteNodeVertices( xPolygonalModel );
00062             WriteNodeFaces( xPolygonalModel );
00063             WriteNodeTextureCoordinates( xPolygonalModel );
00064             fclose(fileOut);
00065             return true;
00066         }
00067     }
00068     //-------------------------------------------------------------------
00069     // Write the output file from a PolygonalModel object
00070     {
00071         OpenGL::PolygonalModel<T> * const  polygonalModel = 
00072             dynamic_cast< OpenGL::PolygonalModel<T> * const >( prModel );
00073         if ( polygonalModel ) {
00074             std::cout << "Writing A Polygonal Model to TAPs file \"" 
00075                 << fileName << "\"\n";
00076             WriteNodeFormat( polygonalModel );
00077             WriteNodeMaterial( polygonalModel );
00078             WriteNodeImageTexture( polygonalModel );
00079             WriteNodeVertices( polygonalModel );
00080             WriteNodeFaces( polygonalModel );
00081             WriteNodeTextureCoordinates( polygonalModel );
00082             fclose(fileOut);
00083             return true;
00084         }
00085     }
00086     //-------------------------------------------------------------------
00087     std::cout << "WARNING: Failed Writing File --> the model is unrecognized!"
00088         << std::endl;
00089     return false;
00090 }
00091 //-----------------------------------------------------------------------------
00092 //=============================================================================
00093 //-----------------------------------------------------------------------------
00094 // Write Format Node
00095 template <typename T>
00096 void WriteTAPs<T>::WriteNodeFormat( OpenGL::OpenGLModel<T> * const prModel )
00097 {
00098     // Example:
00099     //   Format TAPs_OpenGL_Model
00100     fprintf( fileOut, "Format TAPs_OpenGL_Model\n\n" );
00101 }
00102 //-----------------------------------------------------------------------------
00103 //=============================================================================
00104 //-----------------------------------------------------------------------------
00105 // Write Material Node
00106 template <typename T>
00107 void WriteTAPs<T>::WriteNodeMaterial( OpenGL::OpenGLModel<T> * const prModel )
00108 {
00109     //Example:
00110     //  Material
00111     //  {
00112     //    ambient     0.1 0.2 0.3 1.0
00113     //    diffuse     0.2 0.4 0.6 0.5   # alpha is the transparency
00114     //    specular    0.81 0.82 0.83 1.0
00115     //    shininess   1
00116     //    emission    0 0 0 0
00117     //  }
00118     fprintf( fileOut, "Material\n{\n" );
00119     fprintf( fileOut, "  ambient     %g %g %g %g\n", 
00120              prModel->GetMaterial()->GetAmbient( 0 ),
00121              prModel->material.GetAmbient( 1 ),
00122              prModel->material.GetAmbient( 2 ),
00123              prModel->material.GetAmbient( 3 ) );
00124     fprintf( fileOut, "  diffuse     %g %g %g %g\n", 
00125              prModel->material.GetDiffuse( 0 ),
00126              prModel->material.GetDiffuse( 1 ),
00127              prModel->material.GetDiffuse( 2 ),
00128              prModel->material.GetDiffuse( 3 ) );
00129     fprintf( fileOut, "  specular    %g %g %g %g\n", 
00130              prModel->material.GetSpecular( 0 ),
00131              prModel->material.GetSpecular( 1 ),
00132              prModel->material.GetSpecular( 2 ),
00133              prModel->material.GetSpecular( 3 ) );
00134     fprintf( fileOut, "  shininess   %g\n", 
00135              prModel->material.GetShininess( ) );
00136     fprintf( fileOut, "  emission    %g %g %g %g\n", 
00137              prModel->material.GetEmission( 0 ),
00138              prModel->material.GetEmission( 1 ),
00139              prModel->material.GetEmission( 2 ),
00140              prModel->material.GetEmission( 3 ) );
00141     fprintf( fileOut, "}\n\n" );
00142 }
00143 //-----------------------------------------------------------------------------
00144 //=============================================================================
00145 //-----------------------------------------------------------------------------
00146 // Write Vertices Node
00147 template <typename T>
00148 void WriteTAPs<T>::WriteNodeVertices( OpenGL::PolygonalModel<T> * const prModel )
00149 {
00150     //Example:
00151     //  Vertices 6
00152     //  {
00153     //    #  x  y  z
00154     //       1 -1  0
00155     //       1  1  0
00156     //      -1  1  0
00157     //      -1 -1  0
00158     //      -2 -1  0
00159     //  }
00160     //----------------------------------------------------------------
00161     // Write number of vertices
00162     fprintf( fileOut, "Vertices %d\n{\n  #  x  y  z\n", prModel->GetNoVertices() );
00163     // Write all vertices
00164     for ( int i = 0; i < prModel->GetNoVertices(); ++i ) {
00165         fprintf( fileOut, "     %g %g %g", 
00166             static_cast<float>( prModel->GetVertexList()[i][0] ), 
00167             static_cast<float>( prModel->GetVertexList()[i][1] ), 
00168             static_cast<float>( prModel->GetVertexList()[i][2] )
00169         );
00170         fprintf( fileOut, "\t# %d\n", i );
00171     }
00172     // Write a close curly brace
00173     fprintf( fileOut, "}\n\n" );
00174 }
00175 //-----------------------------------------------------------------------------
00176 // Write Vertices Node
00177 template <typename T>
00178 void WriteTAPs<T>::WriteNodeVertices( OpenGL::XPolygonalModel<T> * const prModel )
00179 {
00180     //Example:
00181     //  Vertices 6
00182     //  {
00183     //    #  x  y  z
00184     //       1 -1  0
00185     //       1  1  0
00186     //      -1  1  0
00187     //      -1 -1  0
00188     //      -2 -1  0
00189     //  }
00190     //----------------------------------------------------------------
00191     // Write number of vertices
00192     fprintf( fileOut, "Vertices %d\n{\n  #  x  y  z\n", prModel->GetNoVertices() );
00193     // Write all vertices
00194     for ( int i = 0; i < prModel->GetNoVertices(); ++i ) {
00195         fprintf( fileOut, "     %g %g %g", 
00196             static_cast<float>( prModel->GetVertexList()[i][0] ), 
00197             static_cast<float>( prModel->GetVertexList()[i][1] ), 
00198             static_cast<float>( prModel->GetVertexList()[i][2] )
00199         );
00200         fprintf( fileOut, "\t# %d\n", i );
00201     }
00202     // Write a close curly brace
00203     fprintf( fileOut, "}\n\n" );
00204 }
00205 //-----------------------------------------------------------------------------
00206 // Write Vertices Node
00207 template <typename T>
00208 void WriteTAPs<T>::WriteNodeVertices( OpenGL::HalfEdgeModel<T> * const prModel )
00209 {
00210     //Example:
00211     //  Vertices 6
00212     //  {
00213     //    #  x  y  z
00214     //       1 -1  0
00215     //       1  1  0
00216     //      -1  1  0
00217     //      -1 -1  0
00218     //      -2 -1  0
00219     //  }
00220     //----------------------------------------------------------------
00221     // Write number of vertices
00222     fprintf( fileOut, "Vertices %d\n{\n  #  x  y  z\n", prModel->GetNoVertices() );
00223     // Write all vertices
00224     HEVertex<T> * heVertex = prModel->GetVertexList()->Head();
00225     //g_heVertexPtrList
00226     int i = 0;  // vertex number
00227     while ( heVertex != NULL ) {
00228         g_heVertexPtrList.push_back( heVertex );    // record g_heVertexPtrList
00229         fprintf( fileOut, "     %g %g %g", 
00230             static_cast<float>( (*heVertex)[0] ), 
00231             static_cast<float>( (*heVertex)[1] ), 
00232             static_cast<float>( (*heVertex)[2] )
00233         );
00234         fprintf( fileOut, "\t# %d\n", i++ );
00235         heVertex = heVertex->Next();
00236     }
00237     // Write a close curly brace
00238     fprintf( fileOut, "}\n\n" );
00239 }
00240 //-----------------------------------------------------------------------------
00241 //=============================================================================
00242 //-----------------------------------------------------------------------------
00243 // Write Face Node
00244 template <typename T>
00245 void WriteTAPs<T>::WriteNodeFaces( OpenGL::PolygonalModel<T> * const prModel )
00246 {
00247     //Example:
00248     //  Faces 2
00249     //  {
00250     //    #nb_nodes   node_0 node_1 ... node_(nb_nodes-1)
00251     //       4        0 1 2 3
00252     //       3        2 3 4
00253     //  }
00254     //----------------------------------------------------------------
00255     // Write number of faces
00256     fprintf( fileOut, 
00257         "Faces %d\n{\n  #nb_nodes   node_0 node_1 ... node_(nb_nodes-1)\n", 
00258         prModel->GetNoFaces() );
00259     // Write all faces
00260     for ( int i = 0; i < prModel->GetNoFaces(); ++i ) {
00261         fprintf( fileOut, "\t%d\t", prModel->GetFaceList()[i].GetNoVertices() );
00262         for ( int v = 0; v < prModel->GetFaceList()[i].GetNoVertices(); ++v ) {
00263             fprintf( fileOut, "%d ", prModel->GetFaceList()[i].GetVertexNo( v ) );
00264         }
00265         fprintf( fileOut, "\t# %d\n", i );
00266     }
00267     // Write a close curly brace
00268     fprintf( fileOut, "}\n\n" );
00269 }
00270 //-----------------------------------------------------------------------------
00271 // Write Face Node
00272 template <typename T>
00273 void WriteTAPs<T>::WriteNodeFaces( OpenGL::XPolygonalModel<T> * const prModel )
00274 {
00275     //Example:
00276     //  Faces 2
00277     //  {
00278     //    #nb_nodes   node_0 node_1 ... node_(nb_nodes-1)
00279     //       4        0 1 2 3
00280     //       3        2 3 4
00281     //  }
00282     //----------------------------------------------------------------
00283     // Write number of faces
00284     fprintf( fileOut, 
00285         "Faces %d\n{\n  #nb_nodes   node_0 node_1 ... node_(nb_nodes-1)\n", 
00286         prModel->GetNoFaces() );
00287     // Write all faces
00288     for ( int i = 0; i < prModel->GetNoFaces(); ++i ) {
00289         fprintf( fileOut, "\t%d\t", prModel->GetFaceList()[i].GetNoVertices() );
00290         for ( int v = 0; v < prModel->GetFaceList()[i].GetNoVertices(); ++v ) {
00291             fprintf( fileOut, "%d ", prModel->GetFaceList()[i].GetVertexNo( v ) );
00292         }
00293         fprintf( fileOut, "\t# %d\n", i );
00294     }
00295     // Write a close curly brace
00296     fprintf( fileOut, "}\n\n" );
00297 }
00298 //-----------------------------------------------------------------------------
00299 // Write Face Node
00300 template <typename T>
00301 void WriteTAPs<T>::WriteNodeFaces( OpenGL::HalfEdgeModel<T> * const prModel )
00302 {
00303     //Example:
00304     //  Faces 2
00305     //  {
00306     //    #nb_nodes   node_0 node_1 ... node_(nb_nodes-1)
00307     //       4        0 1 2 3
00308     //       3        2 3 4
00309     //  }
00310     //----------------------------------------------------------------
00311     // Write number of faces
00312     fprintf( fileOut, 
00313         "Faces %d\n{\n  #nb_nodes   node_0 node_1 ... node_(nb_nodes-1)\n", 
00314         prModel->GetNoFaces() );
00315     // Write all faces
00316     HEFace<T> * heFace = prModel->GetFaceList()->Head();
00317     HEHalfEdge<T> * firstHalfEdge;
00318     HEHalfEdge<T> * halfEdge;
00319     std::vector<int> vertexList;
00320     int faceNumber = 0; // face number
00321     int numberOfVertex;
00322     while ( heFace != NULL ) {
00323         //------------------------------------------------------
00324         // Get Number of Vertex and Vertex List in the face
00325         firstHalfEdge = halfEdge = heFace->IncidentHalfEdge();
00326         numberOfVertex = 0;
00327         do {
00328             ++numberOfVertex;
00329             //----------------------------------------------
00330             // Find the vertex number in the g_heVertexPtrList
00331             // (The slow (bottleneck) part of this file writing)
00332             // (Can be improved by included vertex numbers into the HalfEdgeModel)
00333             // (i.e. sacrifice more the memory space)
00334             for ( int i = 0; i < static_cast<int>(g_heVertexPtrList.size()); ++i ) {
00335                 if ( g_heVertexPtrList[i] == halfEdge->Vertex() ) {
00336                     vertexList.push_back( i );
00337                     break;
00338                 }
00339             }
00340             halfEdge = halfEdge->Next();
00341         } while ( firstHalfEdge != halfEdge );
00342         fprintf( fileOut, "\t%d\t", numberOfVertex );
00343         //------------------------------------------------------
00344         // Write Vertex List
00345         for ( int v = 0; v < static_cast<int>(vertexList.size()); ++v ) {
00346             fprintf( fileOut, "%d ", vertexList[v] );
00347         }
00348         //------------------------------------------------------
00349         // Write Face Number as a comment
00350         fprintf( fileOut, "\t# %d\n", faceNumber++ );
00351         heFace = heFace->Next();
00352         vertexList.clear();
00353     }
00354     // Write a close curly brace
00355     fprintf( fileOut, "}\n\n" );
00356     //--------------------------------------------------------------------
00357     // Clear g_heVertexPtrList
00358     g_heVertexPtrList.clear();
00359 }
00360 //-----------------------------------------------------------------------------
00361 //=============================================================================
00362 //-----------------------------------------------------------------------------
00363 // Write TextureCoordinates Node
00364 template <typename T>
00365 void WriteTAPs<T>::WriteNodeTextureCoordinates( OpenGL::PolygonalModel<T> * const prModel )
00366 {
00367 #ifdef  TAPs_ENABLE_FACE_VERTEX_TEXTURE_COORDINATES
00368 
00369 #else //TAPs_ENABLE_FACE_VERTEX_TEXTURE_COORDINATES
00370 
00371     //Example:
00372     //  TextureCoordinates 2
00373     //  {
00374     //    # Texture Coordinates assigned at face vertices
00375     //    # vertices    s_0    t_0    s_1    t_1    s_2    t_2    s_3    t_3
00376     //    0    4      0.3166 0.6316 0.3441 0.6337 0.3537 0.6127 0.3225 0.6008
00377     //    1    4      0.3015 0.8142 0.3624 0.8094 0.3548 0.7738 0.3012 0.7804
00378     //  }
00379     //Another Example:
00380     //  TextureCoordinates 1
00381     //  {
00382     //    # Texture Coordinates assigned at face vertices
00383     //    # vertices    s_0    t_0    s_1    t_1    s_2    t_2    s_3    t_3
00384     //    0    4        1      0      1      1      0      1      0      0
00385     //  }
00386     //--------------------------------------------------------------------
00387     // Skip writing this node if all of Texture Coordinates are zeroes!
00388     bool skip = true;
00389     for ( int i = 0; i < prModel->GetNoFaces(); ++i ) {
00390         if ( prModel->GetFaceList()[i].GetNoTexCoords() > 0 ) {
00391             skip = false;
00392             break;
00393         }
00394     }
00395     if ( skip ) return;
00396     //--------------------------------------------------------------------
00397     // Write Tecture Coordinates
00398     fprintf( fileOut, "TextureCoordinates %i\n{\n", prModel->GetNoFaces() );
00399     fprintf( fileOut, "  # Texture Coordinates assigned at face vertices\n" );
00400     fprintf( fileOut, "  # vertices    s_0    t_0    s_1    t_1    s_2    t_2    s_3    t_3\n" );
00401     // Write all faces
00402     for ( int i = 0; i < prModel->GetNoFaces(); ++i ) {
00403         if ( prModel->GetFaceList()[i].GetNoTexCoords() > 0 ) {
00404             fprintf( fileOut, "\t%d\t%d\t", i, prModel->GetFaceList()[i].GetNoTexCoords() );
00405             for ( int v = 0; v < prModel->GetFaceList()[i].GetNoTexCoords()*2; ++v ) {
00406                 fprintf( fileOut, "%g ", prModel->GetFaceList()[i].GetTexCoordHalfNo( v ) );
00407             }
00408             fprintf( fileOut, "\n" );
00409         }
00410     }
00411     // Write a close curly brace
00412     fprintf( fileOut, "}\n\n" );
00413 
00414 #endif//TAPs_ENABLE_FACE_VERTEX_TEXTURE_COORDINATES
00415 
00416 }
00417 //-----------------------------------------------------------------------------
00418 // Write TextureCoordinates Node
00419 template <typename T>
00420 void WriteTAPs<T>::WriteNodeTextureCoordinates( OpenGL::XPolygonalModel<T> * const prModel )
00421 {
00422 #ifdef  TAPs_ENABLE_FACE_VERTEX_TEXTURE_COORDINATES
00423 
00424 #else //TAPs_ENABLE_FACE_VERTEX_TEXTURE_COORDINATES
00425 
00426     //Example:
00427     //  TextureCoordinates 2
00428     //  {
00429     //    # Texture Coordinates assigned at face vertices
00430     //    # vertices    s_0    t_0    s_1    t_1    s_2    t_2    s_3    t_3
00431     //    0    4      0.3166 0.6316 0.3441 0.6337 0.3537 0.6127 0.3225 0.6008
00432     //    1    4      0.3015 0.8142 0.3624 0.8094 0.3548 0.7738 0.3012 0.7804
00433     //  }
00434     //Another Example:
00435     //  TextureCoordinates 1
00436     //  {
00437     //    # Texture Coordinates assigned at face vertices
00438     //    # vertices    s_0    t_0    s_1    t_1    s_2    t_2    s_3    t_3
00439     //    0    4        1      0      1      1      0      1      0      0
00440     //  }
00441     //--------------------------------------------------------------------
00442     // Skip writing this node if all of Texture Coordinates are zeroes!
00443     bool skip = true;
00444     for ( int i = 0; i < prModel->GetNoFaces(); ++i ) {
00445         if ( prModel->GetFaceList()[i].GetNoTexCoords() > 0 ) {
00446             skip = false;
00447             break;
00448         }
00449     }
00450     if ( skip ) return;
00451     //--------------------------------------------------------------------
00452     // Write Tecture Coordinates
00453     fprintf( fileOut, "TextureCoordinates %i\n{\n", prModel->GetNoFaces() );
00454     fprintf( fileOut, "  # Texture Coordinates assigned at face vertices\n" );
00455     fprintf( fileOut, "  # vertices    s_0    t_0    s_1    t_1    s_2    t_2    s_3    t_3\n" );
00456     // Write all faces
00457     for ( int i = 0; i < prModel->GetNoFaces(); ++i ) {
00458         if ( prModel->GetFaceList()[i].GetNoTexCoords() > 0 ) {
00459             fprintf( fileOut, "\t%d\t%d\t", i, prModel->GetFaceList()[i].GetNoTexCoords() );
00460             for ( int v = 0; v < prModel->GetFaceList()[i].GetNoTexCoords()*2; ++v ) {
00461                 fprintf( fileOut, "%g ", prModel->GetFaceList()[i].GetTexCoordHalfNo( v ) );
00462             }
00463             fprintf( fileOut, "\n" );
00464         }
00465     }
00466     // Write a close curly brace
00467     fprintf( fileOut, "}\n\n" );
00468 
00469 #endif//TAPs_ENABLE_FACE_VERTEX_TEXTURE_COORDINATES
00470 
00471 }
00472 //-----------------------------------------------------------------------------
00473 // Write TextureCoordinates Node
00474 template <typename T>
00475 void WriteTAPs<T>::WriteNodeTextureCoordinates( OpenGL::HalfEdgeModel<T> * const prModel )
00476 {
00477 #ifdef  TAPs_ENABLE_FACE_VERTEX_TEXTURE_COORDINATES
00478 
00479 #else //TAPs_ENABLE_FACE_VERTEX_TEXTURE_COORDINATES
00480 
00481     //Example:
00482     //  TextureCoordinates 2
00483     //  {
00484     //    # Texture Coordinates assigned at face vertices
00485     //    # vertices    s_0    t_0    s_1    t_1    s_2    t_2    s_3    t_3
00486     //    0    4      0.3166 0.6316 0.3441 0.6337 0.3537 0.6127 0.3225 0.6008
00487     //    1    4      0.3015 0.8142 0.3624 0.8094 0.3548 0.7738 0.3012 0.7804
00488     //  }
00489     //Another Example:
00490     //  TextureCoordinates 1
00491     //  {
00492     //    # Texture Coordinates assigned at face vertices
00493     //    # vertices    s_0    t_0    s_1    t_1    s_2    t_2    s_3    t_3
00494     //    0    4        1      0      1      1      0      1      0      0
00495     //  }
00496     //--------------------------------------------------------------------
00497     // Skip writing this node if all of Texture Coordinates are zeroes!
00498     HEFace<T> * heFace = prModel->GetFaceList()->Head();
00499     bool skip = true;
00500     while ( heFace ) {
00501         if ( heFace->GetNoTexCoords() > 0 ) {
00502             skip = false;
00503             break;
00504         }
00505         heFace = heFace->Next();
00506     }
00507     if ( skip ) return;
00508     //--------------------------------------------------------------------
00509     // Write Texture Coordinates
00510     fprintf( fileOut, "TextureCoordinates %i\n{\n", prModel->GetNoFaces() );
00511     fprintf( fileOut, "  # Texture Coordinates assigned at face vertices\n" );
00512     fprintf( fileOut, "  # vertices    s_0    t_0    s_1    t_1    s_2    t_2    s_3    t_3\n" );
00513     // Write all faces
00514     heFace = prModel->GetFaceList()->Head();
00515     int i = 0;
00516     while ( heFace ) {
00517         if ( heFace->GetNoTexCoords() > 0 ) {
00518             fprintf( fileOut, "\t%d\t%d\t", i, heFace->GetNoTexCoords() );
00519             for ( int v = 0; v < heFace->GetNoTexCoords()*2; ++v ) {
00520                 fprintf( fileOut, "%g ", heFace->GetTexCoordHalfNo( v ) );
00521             }
00522             fprintf( fileOut, "\n" );
00523         }
00524         ++i;
00525         heFace = heFace->Next();
00526     }
00527     // Write a close curly brace
00528     fprintf( fileOut, "}\n\n" );
00529 
00530 #endif//TAPs_ENABLE_FACE_VERTEX_TEXTURE_COORDINATES
00531 
00532 }
00533 //-----------------------------------------------------------------------------
00534 //=============================================================================
00535 //-----------------------------------------------------------------------------
00536 // Write ImageTexture Node
00537 template <typename T>
00538 void WriteTAPs<T>::WriteNodeImageTexture( OpenGL::OpenGLModel<T> * const prModel )
00539 {
00540     // ImageTexture
00541     // {
00542     //   fileName   ../Textures/dg_gallbladder.bmp
00543     //   repeatS        false
00544     //   repeatT        false
00545     // }
00546     //-------------------------------------------------------------------
00547     if ( prModel->GetImageFileName() ) {
00548         fprintf( fileOut, "ImageTexture\n{\n" );
00549         fprintf( fileOut, "  fileName  %s\n", prModel->GetImageFileName() );
00550         fprintf( fileOut, "  repeatS\tfalse\n" );
00551         fprintf( fileOut, "  repeatT\tfalse\n" );
00552         fprintf( fileOut, "}\n\n" );
00553     }
00554 }
00555 //-----------------------------------------------------------------------------
00556 //=============================================================================
00557 END_NAMESPACE_TAPs
00558 //-----------------------------------------------------------------------------
00559 //345678901234567890123456789012345678901234567890123456789012345678901234567890
00560 //--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines