Ignore:
Timestamp:
03/30/07 11:38:28 (18 years ago)
Author:
gumbau
Message:
 
File:
1 edited

Legend:

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

    r2291 r2300  
    11191119                                        mGeoMesh        =       mesh_aux; 
    11201120 
     1121                                        // Visualize mesh. 
     1122                                        geoMeshView->setMesh(mGeoMesh); 
     1123 
    11211124                                        //      Simplify the mesh object. 
    11221125                                        if(simplifyEdgeCollapse()) 
     
    11721175                                        undo(); 
    11731176 
    1174  
    11751177                                        std::cout << "Simplificando tronco..."; 
    11761178                                        std::cout << "OK!" << std::endl; 
     
    11841186                                        //      Gets the mesh Shared Vertex. 
    11851187                                        mGeoMesh        =       mesh_aux; 
     1188 
     1189                                        // Visualize mesh. 
     1190                                        geoMeshView->setMesh(mGeoMesh); 
    11861191 
    11871192                                        //      Simplify the mesh object. 
     
    11981203                                } 
    11991204                                 
    1200                                 break;  
     1205                                break; 
    12011206 
    12021207                        case    LODSTRIPS_AUTO: 
     
    12271232                                        //      Gets the mesh Shared Vertex. 
    12281233                                        mGeoMesh        =       mesh_aux; 
     1234 
     1235                                        // Visualize mesh. 
     1236                                        geoMeshView->setMesh(mGeoMesh); 
    12291237 
    12301238                                        //      Simplify the mesh object. 
     
    21252133bool GeoMeshViewUI::simplifyEdgeCollapse() 
    21262134{ 
    2127         Real    percent; 
     2135        int                     error; 
    21282136 
    21292137        //      Free memory. 
     
    21332141        } 
    21342142 
    2135         //    If input field empty. 
     2143        //      If input field empty. 
    21362144        if (mMeshReduction->fvalue() <= 0.0) 
    21372145        { 
     
    21612169        } 
    21622170 
    2163         mMeshSimplifier->setMeshLeaves(idMeshLeaves); 
    2164  
    21652171        if (mPercent->value()) 
    21662172        { 
     
    21692175                                mMeshReduction->fvalue() > 0.0) 
    21702176                { 
    2171                         percent =       mMeshReduction->fvalue(); 
    2172                         percent =       percent / 100.0; 
    2173  
    2174                         mMeshSimplifier->Simplify(percent); 
    2175  
    2176                         //      Deletes the previous mesh. 
    2177                         delete mUndoMesh; 
    2178  
    2179                         mUndoMesh       =       new Mesh(); 
    2180  
    2181                         //      Sets the undo mesh. 
    2182                         *mUndoMesh      =       *mGeoMesh; 
    2183  
    2184                         delete    mGeoMesh; 
    2185  
    2186                         mGeoMesh        =       mMeshSimplifier->GetMesh(); 
     2177                        Real    value; 
     2178 
     2179                        value   =       mMeshReduction->fvalue(); 
     2180                        value   =       value / 100.0; 
     2181 
     2182                        error   =       mMeshSimplifier->Simplify(value); 
    21872183                } 
    21882184                else 
     
    21972193        { 
    21982194                //      Simplification until number of vertices. 
    2199                 uint32 v        =       (uint32)mMeshReduction->fvalue(); 
    2200  
    2201                 mMeshSimplifier->Simplify(v); 
    2202  
     2195                uint32 value    =       (uint32)mMeshReduction->fvalue(); 
     2196 
     2197                error   =       mMeshSimplifier->Simplify(value); 
     2198        } 
     2199 
     2200        //      If no error happens. 
     2201        if (error == NO_GL_ERROR) 
     2202        { 
    22032203                //      Deletes the previous mesh. 
    22042204                delete mUndoMesh; 
     
    22092209                *mUndoMesh      =       *mGeoMesh; 
    22102210 
    2211                 delete  mGeoMesh; 
     2211                delete    mGeoMesh; 
    22122212 
    22132213                mGeoMesh        =       mMeshSimplifier->GetMesh(); 
     2214        } 
     2215        //      If and error happens. 
     2216        else 
     2217        { 
     2218                char    error_message[512]=""; 
     2219 
     2220                if ((error & FRAMEBUFFER_ERROR) == FRAMEBUFFER_ERROR) 
     2221                { 
     2222                        strcat( error_message, 
     2223                                        "GL_EXT_framebuffer_object extension not found.\n"); 
     2224                } 
     2225 
     2226                if ((error & VERTEX_BUFFER_ERROR) == VERTEX_BUFFER_ERROR) 
     2227                { 
     2228                        strcat( error_message, 
     2229                                        "GL_ARB_vertex_buffer_object extension not found.\n"); 
     2230                } 
     2231 
     2232                if ((error & OCCLUSION_QUERY_ERROR) 
     2233                                == 
     2234                                OCCLUSION_QUERY_ERROR) 
     2235                { 
     2236                        strcat( error_message, 
     2237                                        "GL_ARB_occlusion_query extension not found.\n"); 
     2238                } 
     2239 
     2240                if ((error & IMAGING_ERROR) == IMAGING_ERROR) 
     2241                { 
     2242                        strcat( error_message, 
     2243                                        "GL_ARB_imaging extension not found.\n"); 
     2244                } 
     2245 
     2246                if ((error & MULTITEXTURE_ERROR) == MULTITEXTURE_ERROR) 
     2247                { 
     2248                        strcat( error_message, 
     2249                                        "GL_ARB_multitexture extension not found.\n"); 
     2250                } 
     2251 
     2252                if ((error & SWAP_CONTROL_ERROR) == SWAP_CONTROL_ERROR) 
     2253                { 
     2254                        strcat( error_message, 
     2255                                        "WGL_EXT_swap_control extension not found.\n"); 
     2256                } 
     2257 
     2258                strcat( error_message, 
     2259                                                "\nUpdating the video card driver may resolve the problem."); 
     2260 
     2261                fltk::alert(error_message); 
     2262 
     2263                return  false; 
    22142264        } 
    22152265 
     
    22612311 
    22622312                        mUndoMesh       =       new Mesh(); 
    2263                          
     2313 
    22642314                        //      Sets the undo mesh. 
    22652315                        *mUndoMesh      =       *mGeoMesh; 
     
    22682318 
    22692319                        mGeoMesh        =       mTreeSimplifier->GetMesh(); 
    2270                          
     2320 
    22712321                        geoMeshView->setMesh(mGeoMesh); 
    22722322                } 
Note: See TracChangeset for help on using the changeset viewer.