Ignore:
Timestamp:
10/02/06 14:17:27 (18 years ago)
Author:
gumbau
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshViewUI.cpp

    r1543 r1549  
    4242                strcpy(filename,fcho->value()); 
    4343                geoMeshView->LoadTexture(filename); 
     44 
     45                //      For each submesh. 
     46                for (int i      =       0; i < mGeoMesh->mSubMeshCount; i++) 
     47                { 
     48                        geoMeshView->changeTexFile(i,filename); 
     49                } 
     50 
     51                //      Refresh mesh. 
     52                geoMeshView->setMesh(mGeoMesh); 
    4453        } 
    4554} 
     
    5362 
    5463 
    55 inline void GeoMeshViewUI::cb_menuFileLoadTextureSubMesh_i(fltk::Item *item, void *) 
    56 { 
     64inline void GeoMeshViewUI::cb_menuFileLoadTextureSubMesh_i(     fltk::Item *item, 
     65                                                                                                                                                                                                                                                void *) 
     66{ 
     67        fltk::FileChooser       *fcho; 
     68 
    5769        static char pattern[] = "*.{jpg|tga|png|bmp}"; 
    5870 
    59         const char * label = item->label(); 
    60         int isubmesh = label[strlen(label)-1]-48; 
    61  
    62         fltk::FileChooser       *fcho = new fltk::FileChooser("",pattern,fltk::FileChooser::CREATE,"Open image file"); 
     71        const char *label       =       item->label(); 
     72        int isubmesh                    =       label[strlen(label)-1]-48; 
     73 
     74        fcho    =       new fltk::FileChooser("", 
     75                                                                                                                                pattern, 
     76                                                                                                                                fltk::FileChooser::CREATE, 
     77                                                                                                                                "Open image file"); 
    6378        fcho->exec(); 
    64         char filename[256]=""; 
     79 
     80        char filename[256]      =       ""; 
     81 
    6582        if (fcho->value()) 
    6683        { 
    6784                strcpy(filename,fcho->value()); 
    68                 geoMeshView->LoadTextureSubMesh(isubmesh,filename); 
    69         } 
     85 
     86                geoMeshView->changeTexFile(isubmesh,filename); 
     87 
     88                //      Refresh mesh. 
     89                geoMeshView->setMesh(mGeoMesh); 
     90        } 
     91 
    7092} 
    7193 
     
    957979} 
    958980 
    959 VertexBuffer *origSubMeshVB=NULL; 
    960 int orig_numindices=0; 
    961 Index *orig_indices=NULL; 
     981VertexBuffer *origSubMeshVB     =       NULL; 
     982int orig_numindices                                     =       0; 
     983Index *orig_indices                                     =       NULL; 
    962984 
    963985//--------------------------------------------------------------------------- 
     
    973995        mProcessBar->position(0); 
    974996 
    975         origSubMeshVB=NULL; 
     997        origSubMeshVB   =       NULL; 
    976998     
    977999        //      Initialize error flag. 
     
    9821004        { 
    9831005                //      Choose between aplication state. 
    984                 switch(mApplicationState) 
     1006                switch (mApplicationState) 
    9851007                { 
    9861008                        //      Stripify state. 
     
    11481170                //      Refresh geometry attributes. 
    11491171                refreshApplicationBar(); 
    1150  
    1151                 //      Set textures. 
    1152                 geoMeshView->resetTextures(); 
    1153                 setTextures(); 
    11541172        } 
    11551173         
     
    11981216        { 
    11991217                //      Choose between aplication state. 
    1200                 if (mApplicationState==LODSTRIPS_AUTO || mApplicationState==LODTREES_AUTO) 
     1218                if (mApplicationState == LODSTRIPS_AUTO 
     1219                                || 
     1220                                mApplicationState == LODTREES_AUTO) 
    12011221                { 
    12021222                        file_name       =       fltk::file_chooser("Build LOD","*.mesh",""); 
     
    12151235 
    12161236                                //      Simplification sequence. 
    1217                                 //oMeshSimpSequence = new MeshSimplificationSequence(); 
    1218  
    1219                                 //      Loads a simplification sequence file. 
    1220                                 //oMeshSimpSequence->Load(Serializer("SimplifSequence.txt",Serializer::READ)); 
    1221  
    1222                                 //      Simplification sequence. 
    12231237                                oMeshSimpSequence =     mMeshSimplifier->GetSimplificationSequence(); 
    12241238 
     
    12261240                                if (oMeshSimpSequence && mGeoMesh) 
    12271241                                { 
    1228                                         oLodStrip               =       new LodStripsConstructor(       mGeoMesh, 
    1229                                                         oMeshSimpSequence, 
    1230                                                         idMeshLeaves, 
    1231                                                         progress_function); 
     1242                                        oLodStrip       =       new LodStripsConstructor(       mGeoMesh, 
     1243                                                                                                                                                                                                oMeshSimpSequence, 
     1244                                                                                                                                                                                                idMeshLeaves, 
     1245                                                                                                                                                                                                progress_function); 
    12321246 
    12331247                                        oLodStrip->UpdateMesh(); 
     
    12481262 
    12491263                                        mesh_saver      =       new     GeoMeshSaver(); 
    1250                                         //                                      file_name[strlen(file_name) - 4]        =       '\0'; 
    1251  
    1252                                         mesh_saver->leavesSubMesh=idMeshLeaves; 
    1253                                         mesh_saver->leavesVB=origSubMeshVB; 
    1254                                         mesh_saver->numindices=orig_numindices; 
    1255                                         mesh_saver->indices=orig_indices; 
     1264 
     1265                                        mesh_saver->leavesSubMesh       =       idMeshLeaves; 
     1266                                        mesh_saver->leavesVB                    =       origSubMeshVB; 
     1267                                        mesh_saver->numindices          =       orig_numindices; 
     1268                                        mesh_saver->indices                             =       orig_indices; 
     1269 
    12561270                                        mesh_saver->save(mGeoMesh,file_name); 
     1271 
    12571272                                        delete  mesh_saver; 
     1273 
    12581274                                        oLodStrip->Save(file_name); 
    12591275 
    12601276                                        //      Delete simplified mesh. 
    12611277                                        delete  mMeshSimplifier; 
    1262                                         //      Close file. 
    1263                                         //                                              delete  oSerializer;                             
    12641278                                } 
    12651279                                else 
     
    12691283                                } 
    12701284 
    1271                                 //      Deletes the siplification sequence object. 
    1272                                 //delete        oMeshSimpSequence; 
    1273  
    1274                                 if (mApplicationState==LODTREES_AUTO) 
    1275                                 { 
    1276                                         //      Open file chooser dialog. 
    1277 /*                                      file_name       =       fltk::file_chooser("Build LOD","*",""); 
    1278                                          
    1279                                         if (!file_name) 
    1280                                         { 
    1281                                                 break; 
    1282                                         }*/ 
    1283  
    1284                                         std::cout << "Creando secuencia de simplificacion de hojas..."; 
    1285                                          
     1285                                if (mApplicationState == LODTREES_AUTO) 
     1286                                { 
    12861287                                        createLeavesSequence(file_name); 
    1287                                          
    1288                                         std::cout << "OK!" << std::endl;                 
    12891288                                } 
    12901289                        } 
     
    12931292                //      Refresh data aplication. 
    12941293                refreshApplicationBar(); 
    1295  
    1296                 //      Set textures. 
    1297                 geoMeshView->resetTextures(); 
    1298                 setTextures(); 
    12991294        }        
    13001295} 
     
    22782273                //      Repaint the window. 
    22792274                mMainWindow->redraw(); 
    2280  
    2281                 //      Set textures. 
    2282                 geoMeshView->resetTextures(); 
    2283                 setTextures(); 
    22842275        } 
    22852276} 
     
    24472438                        mMB->label(char_value); 
    24482439 
     2440                        //      Set textures. 
     2441                        geoMeshView->resetTextures(); 
     2442                        setTextures(); 
     2443 
    24492444                        //      Visualize mesh. 
    24502445                        geoMeshView->setMesh(mGeoMesh); 
    24512446                         
    2452                         //      Set textures. 
    2453                         geoMeshView->resetTextures(); 
    2454                         setTextures(); 
    2455  
    24562447                        //      Hide right panel. 
    24572448                        hideRightPanel(); 
     
    25112502                material        = string(mGeoMesh->mSubMesh[submesh].mMaterialName); 
    25122503 
     2504                //      If exists material. 
    25132505                if (loader->existsMaterial(material)) 
    2514                 {                        
     2506                { 
     2507                        //      Gets file name. 
    25152508                        filename        =       loader->getTextureFileName(material); 
    25162509 
    2517                         geoMeshView->LoadTextureSubMesh(submesh,        filename.c_str()); 
     2510                        geoMeshView->addTexFile(filename.c_str()); 
     2511                } 
     2512                //      If not exists material. 
     2513                else 
     2514                { 
     2515                        //      File name empty. 
     2516                        filename        =       string(); 
     2517 
     2518                        geoMeshView->addTexFile(filename.c_str()); 
    25182519                } 
    25192520        } 
Note: See TracChangeset for help on using the changeset viewer.