Subversion Repositories gelsvn

Rev

Rev 614 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 614 Rev 618
Line 23... Line 23...
23
#include <CGLA/Vec2d.h>
23
#include <CGLA/Vec2d.h>
24
#include <CGLA/Vec3d.h>
24
#include <CGLA/Vec3d.h>
25
#include <CGLA/Mat3x3d.h>
25
#include <CGLA/Mat3x3d.h>
26
#include <CGLA/Mat2x2d.h>
26
#include <CGLA/Mat2x2d.h>
27
#include <CGLA/Mat2x3d.h>
27
#include <CGLA/Mat2x3d.h>
-
 
28
#include <CGLA/Mat4x4d.h>
28
 
29
 
29
#include <LinAlg/Matrix.h>
30
#include <LinAlg/Matrix.h>
30
#include <LinAlg/Vector.h>
31
#include <LinAlg/Vector.h>
31
#include <LinAlg/LapackFunc.h>
32
#include <LinAlg/LapackFunc.h>
32
 
33
 
Line 217... Line 218...
217
    VertexAttributeVector<double> par;
218
    VertexAttributeVector<double> par;
218
    make_height_fun(active_mesh(), fun, vmin, vmax);
219
    make_height_fun(active_mesh(), fun, vmin, vmax);
219
    polarize_mesh(active_mesh(), fun, vmin, vmax, divisions, par);
220
    polarize_mesh(active_mesh(), fun, vmin, vmax, divisions, par);
220
}
221
}
221
 
222
 
-
 
223
void transform_mesh(Manifold& mani, const Mat4x4d& m)
-
 
224
{
-
 
225
    for(VertexIDIterator vid = mani.vertices_begin(); vid != mani.vertices_end(); ++vid)
-
 
226
        mani.pos(*vid) = m.mul_3D_point(mani.pos(*vid));
-
 
227
}
-
 
228
 
-
 
229
void console_scale(const std::vector<std::string> & args)
-
 
230
{
-
 
231
    if(wantshelp(args)) {
-
 
232
        theConsole.printf("usage: scale sx sy sz");
-
 
233
        return;
-
 
234
    }
-
 
235
    
-
 
236
    Vec3d s;
-
 
237
 
-
 
238
    if(args.size() > 0){
-
 
239
        istringstream a0(args[0]);
-
 
240
        a0 >> s[0];
-
 
241
    }
-
 
242
    if(args.size() > 1){
-
 
243
        istringstream a0(args[0]);
-
 
244
        a0 >> s[1];
-
 
245
    }
-
 
246
    if(args.size() > 2){
-
 
247
        istringstream a0(args[0]);
-
 
248
        a0 >> s[2];
-
 
249
    }
-
 
250
    
-
 
251
    avo().save_old();
-
 
252
    transform_mesh(avo().mesh(),scaling_Mat4x4d(s));
-
 
253
    avo().refit();
-
 
254
}
-
 
255
 
-
 
256
 
222
void console_flatten(const std::vector<std::string> & args)
257
void console_flatten(const std::vector<std::string> & args)
223
{
258
{
224
    if(wantshelp(args)) {
259
    if(wantshelp(args)) {
225
        theConsole.printf("usage: flatten <floater|harmonic|barycentric>");
260
        theConsole.printf("usage: flatten <floater|harmonic|barycentric>");
226
        theConsole.printf("This function flattens a meshs with a simple boundary. It is mostly for showing mesh");
261
        theConsole.printf("This function flattens a meshs with a simple boundary. It is mostly for showing mesh");
Line 992... Line 1027...
992
        theConsole.printf("usage:  undo");
1027
        theConsole.printf("usage:  undo");
993
        theConsole.printf("This function undoes one operation. Repeated undo does nothing");
1028
        theConsole.printf("This function undoes one operation. Repeated undo does nothing");
994
        return;
1029
        return;
995
    }
1030
    }
996
    avo().restore_old();
1031
    avo().restore_old();
-
 
1032
    avo().refit();
997
    return;
1033
    return;
998
}
1034
}
999
 
1035
 
1000
 
1036
 
1001
void reshape(int W, int H)
1037
void reshape(int W, int H)
1002
{
1038
{
1003
    active_view_control().reshape(W,H);
1039
    active_view_control().reshape(W,H);
1004
}
1040
}
1005
 
1041
 
1006
Console::variable<string> display_render_mode("normal");
1042
Console::variable<string> display_render_mode("normal");
1007
Console::variable<int> display_smooth_shading;
1043
Console::variable<int> display_smooth_shading(true);
1008
Console::variable<float> display_gamma(2.2);
1044
Console::variable<float> display_gamma(2.2);
1009
 
1045
 
1010
void display()
1046
void display()
1011
{
1047
{
1012
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
1048
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
Line 1211... Line 1247...
1211
	theConsole.reg_cmdN("validity", console_valid,"");
1247
	theConsole.reg_cmdN("validity", console_valid,"");
1212
	theConsole.reg_cmdN("info", console_info,"");
1248
	theConsole.reg_cmdN("info", console_info,"");
1213
 
1249
 
1214
    theConsole.reg_cmdN("polarize", console_polarize ,"");
1250
    theConsole.reg_cmdN("polarize", console_polarize ,"");
1215
    
1251
    
-
 
1252
    theConsole.reg_cmdN("transform.scale", console_scale, "Scale mesh");
-
 
1253
    
1216
    active.reg(theConsole, "active_mesh", "The active mesh");
1254
    active.reg(theConsole, "active_mesh", "The active mesh");
1217
    display_render_mode.reg(theConsole, "display.render_mode", "Display render mode");
1255
    display_render_mode.reg(theConsole, "display.render_mode", "Display render mode");
1218
    display_smooth_shading.reg(theConsole, "display.smooth_shading", "1 for smooth shading 0 for flat");
1256
    display_smooth_shading.reg(theConsole, "display.smooth_shading", "1 for smooth shading 0 for flat");
1219
    display_gamma.reg(theConsole, "display.gamma", "The gamma setting for the display");
1257
    display_gamma.reg(theConsole, "display.gamma", "The gamma setting for the display");
1220
 
1258