Subversion Repositories gelsvn

Rev

Rev 650 | Rev 657 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 650 Rev 656
Line 1267... Line 1267...
1267
    }
1267
    }
1268
    bool MeshEditor::try_spinning_ball(){
1268
    bool MeshEditor::try_spinning_ball(){
1269
        return active_view_control().try_spin();
1269
        return active_view_control().try_spin();
1270
    }
1270
    }
1271
    
1271
    
-
 
1272
    bool MeshEditor::grab_mesh(const CGLA::Vec2i& pos)
-
 
1273
    {
-
 
1274
        if(depth_pick(pos[0], pos[1], depth))
-
 
1275
        {
-
 
1276
            dragging = true;
-
 
1277
            mouse_x = pos[0];
-
 
1278
            mouse_y = pos[1];
-
 
1279
            Vec3d p0 = screen2world(mouse_x, mouse_y, depth);
-
 
1280
            Manifold& m = active_mesh();
-
 
1281
            active_visobj().save_old();
-
 
1282
            Vec3d c;
-
 
1283
            float r;
-
 
1284
            bsphere(m, c, r);
-
 
1285
            for(auto vid : m.vertices())
-
 
1286
            {
-
 
1287
                double l = sqr_length(p0-m.pos(vid));
-
 
1288
                weight_vector[vid] = exp(-l/(0.01*r*r));
-
 
1289
            }
-
 
1290
            return true;
-
 
1291
        }
-
 
1292
        return false;
-
 
1293
    }
-
 
1294
    
-
 
1295
    bool MeshEditor::drag_mesh(const CGLA::Vec2i& pos)
-
 
1296
    {
-
 
1297
        if(dragging)
-
 
1298
        {
-
 
1299
            Vec3d p0 = screen2world(mouse_x, mouse_y, depth);
-
 
1300
            Vec3d p1 = screen2world(pos[0], pos[1], depth);
-
 
1301
            Vec3d v = p1-p0;
-
 
1302
            Manifold& m = active_mesh();
-
 
1303
            for(auto vid : m.vertices())
-
 
1304
                m.pos(vid) = active_visobj().mesh_old().pos(vid) + weight_vector[vid] * v;
-
 
1305
            post_create_display_list();
-
 
1306
            return true;
-
 
1307
        }
-
 
1308
        return false;
-
 
1309
    }
-
 
1310
    
-
 
1311
    void MeshEditor::release_mesh()
-
 
1312
    {
-
 
1313
        dragging = false;
-
 
1314
    }
-
 
1315
 
-
 
1316
    
1272
 
1317
 
1273
    void MeshEditor::display(int scale){
1318
    void MeshEditor::display(int scale){
1274
        glClearColor(1, 1, 1, 0);
1319
        glClearColor(1, 1, 1, 0);
1275
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
1320
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
1276
        
-
 
1277
        
-
 
1278
        glPushMatrix();
-
 
1279
        
-
 
1280
        active_visobj().display(display_render_mode, theConsole, display_smooth_shading, display_gamma);
1321
        active_visobj().display(display_render_mode, theConsole, display_smooth_shading, display_gamma);
1281
        
-
 
1282
        glPopMatrix();
-
 
1283
        
-
 
1284
        if(console_visible)
1322
        if(console_visible)
1285
        {
1323
        {
1286
            glUseProgram(0);
1324
            glUseProgram(0);
1287
            theConsole.display(scale);
1325
            theConsole.display(scale);
1288
        }
1326
        }
Line 1360... Line 1398...
1360
        
1398
        
1361
        //        register_console_function("harmonics.reset_shape", console_reset_shape, "");
1399
        //        register_console_function("harmonics.reset_shape", console_reset_shape, "");
1362
        register_console_function("harmonics.analyze", console_analyze, "");
1400
        register_console_function("harmonics.analyze", console_analyze, "");
1363
        //        register_console_function("harmonics.partial_reconstruct", console_partial_reconstruct,"");
1401
        //        register_console_function("harmonics.partial_reconstruct", console_partial_reconstruct,"");
1364
 
1402
 
1365
        //        register_console_function("polarize", console_polarize ,"");
-
 
1366
        //        register_console_function("polar.simplify", console_simplify_polar ,"");
-
 
1367
        //        register_console_function("polar.segment", console_polar_segment ,"");
-
 
1368
        //        register_console_function("polar.skeleton", console_polar_skeleton ,"");
-
 
1369
        //        register_console_function("polar.refit", console_refit_polar ,"");
-
 
1370
        //        register_console_function("polar.subdivide", console_polar_subdivide ,"");
-
 
1371
        register_console_function("Dijkstra", console_Dijkstra,"");
1403
        register_console_function("Dijkstra", console_Dijkstra,"");
1372
        
1404
        
1373
        register_console_function("transform.scale", console_scale, "Scale mesh");
1405
        register_console_function("transform.scale", console_scale, "Scale mesh");
1374
        
1406
        
1375
        active.reg(theConsole, "active_mesh", "The active mesh");
1407
        active.reg(theConsole, "active_mesh", "The active mesh");