本文整理汇总了C++中igl::ReTwBar::TwAddButton方法的典型用法代码示例。如果您正苦于以下问题:C++ ReTwBar::TwAddButton方法的具体用法?C++ ReTwBar::TwAddButton怎么用?C++ ReTwBar::TwAddButton使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类igl::ReTwBar
的用法示例。
在下文中一共展示了ReTwBar::TwAddButton方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
if(!igl::readOFF(filename,vV,vF,vN))
{
return 1;
}
}else if(ext == "wrl")
{
// Convert extension to lower case
if(!igl::readWRL(filename,vV,vF))
{
return 1;
}
//}else
//{
// // Convert extension to lower case
// MatrixXi T;
// if(!igl::readMESH(filename,V,T,F))
// {
// return 1;
// }
// //if(F.size() > T.size() || F.size() == 0)
// {
// boundary_facets(T,F);
// }
}
if(vV.size() > 0)
{
if(!list_to_matrix(vV,V))
{
return 1;
}
polygon_mesh_to_triangle_mesh(vF,F);
}
MatrixXi F_unique;
unique_simplices(F, F_unique);
F = F_unique;
init_patches();
init_relative();
randomly_color(CC,s.C);
// Init glut
glutInit(&argc,argv);
if( !TwInit(TW_OPENGL, NULL) )
{
// A fatal error occured
fprintf(stderr, "AntTweakBar initialization failed: %s\n", TwGetLastError());
return 1;
}
// Create a tweak bar
rebar.TwNewBar("bar");
TwDefine("bar label='Patches' size='200 550' text=light alpha='200' color='68 68 68'");
rebar.TwAddVarRW("camera_rotation", TW_TYPE_QUAT4D,
s.camera.m_rotation_conj.coeffs().data(), "open readonly=true");
TwType RotationTypeTW = ReTwDefineEnumFromString("RotationType",
"igl_trackball,two-axis-valuator-fixed-up");
rebar.TwAddVarCB( "rotation_type", RotationTypeTW,
set_rotation_type,get_rotation_type,NULL,"keyIncr=] keyDecr=[");
TwType CenterTypeTW = ReTwDefineEnumFromString("CenterType","orbit,fps");
rebar.TwAddVarRW("center_type", CenterTypeTW,¢er_type,
"keyIncr={ keyDecr=}");
TwType OrientMethodTW = ReTwDefineEnumFromString("OrientMethod",
"outward,ambient-occlusion");
rebar.TwAddVarCB( "orient_method", OrientMethodTW,
set_orient_method,get_orient_method,NULL,"keyIncr=< keyDecr=>");
rebar.TwAddVarRW("wireframe_visible",TW_TYPE_BOOLCPP,&wireframe_visible,"key=l");
rebar.TwAddVarRW("fill_visible",TW_TYPE_BOOLCPP,&fill_visible,"key=f");
rebar.TwAddButton("randomize_colors",randomize_colors,NULL,"key=c");
if(out_filename != "")
{
rebar.TwAddButton("save",
saveCB,NULL,
C_STR("label='Save to `"<<out_filename<<"`' "<<
"key=s"));
}
rebar.load(REBAR_NAME);
animation_from_quat = Quaterniond(1,0,0,0);
s.camera.m_rotation_conj = animation_from_quat;
animation_start_time = get_seconds();
// Init antweakbar
#ifdef __APPLE__
glutInitDisplayString( "rgba depth double samples>=8");
#else
glutInitDisplayString( "rgba depth double "); // samples>=8 somehow not supported on Kenshi's machines...?
#endif
glutInitWindowSize(glutGet(GLUT_SCREEN_WIDTH)/2.0,glutGet(GLUT_SCREEN_HEIGHT)/2.0);
glutCreateWindow("patches");
glutDisplayFunc(display);
glutReshapeFunc(reshape);
glutKeyboardFunc(key);
glutMouseFunc(mouse);
glutMotionFunc(mouse_drag);
glutPassiveMotionFunc((GLUTmousemotionfun)TwEventMouseMotionGLUT);
glutMainLoop();
return 0;
}