当前位置: 首页>>代码示例>>C++>>正文


C++ TwNewBar函数代码示例

本文整理汇总了C++中TwNewBar函数的典型用法代码示例。如果您正苦于以下问题:C++ TwNewBar函数的具体用法?C++ TwNewBar怎么用?C++ TwNewBar使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了TwNewBar函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: TwInit

void AntTweakBarWrapper::Init()
{
	TwInit(TW_OPENGL, NULL);
	m_control_panel_bar = TwNewBar("Control Panel");
	//TwDefine(" 'Control Panel' size='200 210' position='114 10' color='255 255 255' text=dark ");
	char control_bar_pos_string [255];
    sprintf(control_bar_pos_string, "'Control Panel' position='%d 10' color='255 255 0' ", DEFAULT_SCREEN_WIDTH-210);
    TwDefine(control_bar_pos_string);

	TwAddVarRW(m_control_panel_bar, "Start Simulation", TwType(sizeof(bool)), &(g_start_simulation), " label='Start Simulation' key=s group='Debug Information' help='Toggle simulation mode.'");
	TwAddVarRW(m_control_panel_bar, "Render FP", TwType(sizeof(bool)), &(g_show_render), " label='Render FP' key=w group='Debug Information' help='Toggle render display mode.'");
	TwAddVarRW(m_control_panel_bar, "Wireframe", TwType(sizeof(bool)), &(g_show_wireframe), " label='Wireframe mode' key=w group='Debug Information' help='Toggle wireframe display mode.'");
	TwAddVarRW(m_control_panel_bar, "Edge List", TwType(sizeof(bool)), &(g_show_edgelist), " label='Edgelist mode'  group='Debug Information' help='Toggle edgelist display mode.'");
	TwAddVarRW(m_control_panel_bar, "Line Width", TW_TYPE_FLOAT, &(g_linewidth),"label='Line Width' min=0 max=100 step=0.05  help='line width' group='Debug Information'");
	TwAddVarRW(m_control_panel_bar, "Fixed Vertex", TwType(sizeof(bool)), &(g_show_fixedvertex), " label='Fixed Vertex' key=w group='Debug Information' help='Toggle fixed vertex mode.'");
	TwAddVarRW(m_control_panel_bar, "Point Size", TW_TYPE_FLOAT, &(g_pointsize),"label='Point Size' min=0 max=100 step=0.05  help='Point Size' group='Debug Information'");

	TwAddVarRW(m_control_panel_bar, "Zoom", TW_TYPE_FLOAT, &(cameraDistance),"label='Zoom Mode' min=-30 max=30 step=0.1 keyIncr=z keyDecr=Z help='zoom camera' group='Camera'");

	m_sim_bar = TwNewBar("Simulation Control");
	TwDefine("'Simulation Control' position='0 0' color='255 0 0'");

	TwEnumVal shapeEV[NUM_SIMULATION] = { {PositionBasedDynamic, "Position Based Dynamic"}, {MassSpring, "Mass Spring"}, {FiniteElement, "Finite Element"}, {FastMassSpring, "Fast Mass Spring"}, {ProjectiveDynamic, "Projective Dynamic"} };
    TwType simmethod = TwDefineEnum("simmethod", shapeEV, NUM_SIMULATION);
	TwAddVarRW(m_sim_bar, "Simulation Method", simmethod, &g_CurrentMethod, " keyIncr='<' keyDecr='>' help='Change Simulation Method.' ");
}
开发者ID:apapaxiong,项目名称:openglFrame,代码行数:26,代码来源:UI_warpper.cpp

示例2: TwNewBar

  void ParticleEditor::Initialize()
  {
    system_window_ = TwNewBar("System Editor");
    TwAddVarCB(system_window_,
               "System Index", 
               TW_TYPE_INT32,
               TweakBarParticleSetSystem,
               TweakBarParticleGetSystem,
               nullptr,
               "");

    emitter_window_ = TwNewBar("Emitter Editor");
    TwAddVarCB(emitter_window_, 
               "Emitter Index", 
               TW_TYPE_INT32, 
               TweakBarParticleSetEmitter,
               TweakBarParticleGetEmitter,
               nullptr, 
               "");

    state_window_ = TwNewBar("State Editor");
    TwAddVarCB(state_window_, 
               "State Index", 
               TW_TYPE_INT32, 
               TweakBarParticleSetState,
               TweakBarParticleGetState,
               nullptr, 
               "");
  }
开发者ID:Marktopus,项目名称:WickedSickSingle,代码行数:29,代码来源:ParticleEffectEditor.cpp

示例3: TwNewBar

void outPut::init_Bars()
{
    b_scene = TwNewBar("Scene");
    _scene3d.distance = _dimensions.x+_dimensions.y;
    _scene3d.zoom = 60;
    _scene3d.focus = coords3d<float>::retournercoords3d(_dimensions.x/2,_dimensions.y/2,0);
    //_scene3d.orientation = {0, 0, 0, 1}; // direction pointing to +x and +y
    _scene3d.orientation[0]=_scene3d.orientation[1]=_scene3d.orientation[2]=0;
    _scene3d.orientation[3]=1;
    TwAddVarRW(b_scene, "Orientation", TW_TYPE_QUAT4F, &(_scene3d.orientation),"axisx=x axisy=y axisz=z");
    TwAddVarRW(b_scene, "Distance", TW_TYPE_DOUBLE, &(_scene3d.distance),"");
    TwAddVarRW(b_scene, "Zoom", TW_TYPE_DOUBLE, &(_scene3d.zoom),"min = 5 max = 200");
    TwAddVarRW(b_scene, "x", TW_TYPE_FLOAT, &(_scene3d.focus.x), "group = 'Focus' ");
    TwAddVarRW(b_scene, "y", TW_TYPE_FLOAT, &(_scene3d.focus.y), "group = 'Focus' ");
    TwAddVarRW(b_scene, "z", TW_TYPE_FLOAT, &(_scene3d.focus.z), "group = 'Focus'");
    TwAddButton(b_scene, "Centrer", cbCenterView, this, " group = 'Focus' ");
    TwAddVarRW(b_scene, "Test de profondeur résultat", TW_TYPE_BOOLCPP,
               &(_reg.ZTEST_RESULT), "label='Z test resultat'");

    TwAddVarRW(b_scene, "Temps de calcul (ms)", TW_TYPE_INT32, &(_status.drawDelay), "min=0 max=1000");

    //_scene3d.lightDir = {1,1,-1};
    _scene3d.lightDir[0]=_scene3d.lightDir[1]=1;
    _scene3d.lightDir[2]=-1;
    //_scene3d.lightPos = {-1,-1,1,0};
    _scene3d.lightPos[0]=_scene3d.lightPos[1]=-1;
    _scene3d.lightPos[2]=1;
    _scene3d.lightPos[3]=0;
    TwAddVarRW(b_scene, "Direction", TW_TYPE_DIR3F, &(_scene3d.lightDir), "group = Lumiere" );
    TwAddVarRW(b_scene, "Directionnelle", TW_TYPE_FLOAT, &(_scene3d.lightPos[3]), "group = Lumiere min=0 max =1" );

    b_reglages = TwNewBar("Reglages");
    TwAddVarRO(b_reglages, "MAX_FPS", TW_TYPE_INT32, &(_reg.MAX_FPS), "group='Window settings'");
    TwAddButton(b_reglages, "Recalculer", recalculate, this, " group = Rendu ");
    TwAddVarRW(b_reglages, "Multiplicateur", TW_TYPE_DOUBLE, &(_reg.MULTIPLIER), "group = 'Rendu' min = 0 max = 100");
    TwType colorsType;
    colorsType = TwDefineEnum("ColorsType", NULL, 0);
    //TwAddVarRW(b_reglages, "Couleurs", colorsType, &(_reg.COLORS), " enum='0 {Réelles}, 1 {Colorisé}, 2 {Uniforme}'");
    TwAddVarRW(b_reglages, "Filaire", TW_TYPE_BOOLCPP, &(_reg.WIREFRAME), " group = Rendu ");
    TwAddVarRW(b_reglages, "Normales", TW_TYPE_BOOLCPP, &(_reg.DRAW_NORMALS), "group = 'Rendu'");
    TwAddVarRW(b_reglages, "Couleur unie", TW_TYPE_COLOR3F, &(_reg.UNIFORM_COLOR), "colormode=hls group = 'Rendu'");
    b_postprocess = TwNewBar("Post-processing");
    _effect = 0;
    TwAddVarRW(b_postprocess, "Effet", TW_TYPE_INT32, &(_effect),"max=20 keyincr = p keydecr = m");

    b_pathfind = TwNewBar("Pathfind");
    TwAddVarRW(b_pathfind, "En cours", TW_TYPE_BOOLCPP, &(_status.running), "help='Fermer le programme' key=ESC");
    TwAddVarRW(b_pathfind, "Pause", TW_TYPE_BOOLCPP, &(_status.pause), "key=t");

    TwSetTopBar(b_scene);
    TwDefine(" Reglages iconified=true ");
    TwDefine(" Pathfind iconified=true ");
    TwDefine(" Post-processing iconified=true ");
}
开发者ID:Firobe,项目名称:Pathfinder,代码行数:54,代码来源:output_2.cpp

示例4: initAnt

void initAnt()
{
    ///@note Bad size errors will be thrown if this is not called before bar creation.
    TwWindowSize(g_mirrorWindowSz.x, g_mirrorWindowSz.y);

    TwDefine(" GLOBAL fontsize=3 ");

    // Create a tweak bar
    g_pMainTweakbar = TwNewBar("TweakBar");
    g_pShaderTweakbar = TwNewBar("ShaderTweakBar");
    g_gallery.m_pMainTweakbar = g_pMainTweakbar;
    g_gallery.m_pShaderTweakbar = g_pShaderTweakbar;

    TwDefine(" GLOBAL fontsize=3 ");
    TwDefine(" TweakBar size='300 580' ");
    TwDefine(" TweakBar position='10 10' ");
    TwDefine(" ShaderTweakBar size='300 420' ");
    TwDefine(" ShaderTweakBar position='290 170' ");

    TwAddVarRW(g_pMainTweakbar, "FBO Scale", TW_TYPE_FLOAT, &m_fboScale,
        " min=0.05 max=1.0 step=0.005 group='Performance' ");
    TwAddVarRW(g_pMainTweakbar, "Cinemascope", TW_TYPE_FLOAT, &m_cinemaScope,
        " min=0.05 max=1.0 step=0.005 group='Performance' ");
    TwAddButton(g_pMainTweakbar, "Toggle Perf HUD", TogglePerfHUDCB, NULL, " group='Performance' ");

    TwAddVarRW(g_pMainTweakbar, "Snap Turn", TW_TYPE_BOOLCPP, &m_snapTurn, "  group='Controls' ");
    TwAddButton(g_pMainTweakbar, "Reset Position", ResetPositionCB, NULL, " group='Controls' ");
    TwAddButton(g_pMainTweakbar, "Recenter Pose", RecenterPoseCB, NULL, " group='Controls' ");
    TwAddButton(g_pMainTweakbar, "Hide Tweakbar", HideTweakbarCB, NULL, " group='Controls' ");

    TwAddVarRW(g_pMainTweakbar, "Chassis Pos X", TW_TYPE_FLOAT, &m_chassisPos.x,
        " min=-10 max=10 step=0.05 group='Controls' ");
    TwAddVarRW(g_pMainTweakbar, "Chassis Pos Y", TW_TYPE_FLOAT, &m_chassisPos.y,
        " min=-10 max=10 step=0.05 group='Controls' ");
    TwAddVarRW(g_pMainTweakbar, "Chassis Pos Z", TW_TYPE_FLOAT, &m_chassisPos.z,
        " min=-10 max=10 step=0.05 group='Controls' ");
    TwAddVarRW(g_pMainTweakbar, "Chassis Yaw", TW_TYPE_FLOAT, &m_chassisYaw,
        " min=-10 max=10 step=0.05 group='Controls' ");

    TwAddVarRW(g_pMainTweakbar, "Animated Thumbnails", TW_TYPE_BOOLCPP, &g_gallery.m_globalShadertoyState.animatedThumbnails, "  group='Gallery' ");
    TwAddVarRW(g_pMainTweakbar, "Panes As Portals", TW_TYPE_BOOLCPP, &g_gallery.m_globalShadertoyState.panesAsPortals, "  group='Gallery' ");

    TwAddButton(g_pMainTweakbar, "Enter/Exit Shader", ToggleShaderWorldCB, NULL, " group='Shader' ");
    TwAddVarRW(g_pMainTweakbar, "headSize", TW_TYPE_FLOAT, &m_headSize,
        " label='headSize' precision=4 min=0.0001 step=0.001 group='Shader' ");
    TwAddButton(g_pMainTweakbar, "Reset Timer", ResetTimerCB, &g_gallery,
        " label='Reset Timer' group='Shader' ");
}
开发者ID:chansonyan,项目名称:RiftRay,代码行数:48,代码来源:main_glfw_ovrsdk13.cpp

示例5: TwNewBar

SceneDialog::SceneDialog()
{
	// Create a tweak bar
    m_dialog = TwNewBar("Scene");
    TwDefine(" GLOBAL help='This example shows how to integrate AntTweakBar into a DirectX11 application.' "); // Message added to the help bar.
	int barSize[2] = {200, 1060};
    TwSetParam(m_dialog, NULL, "size", TW_PARAM_INT32, 2, barSize);
	TwDefine(" Scene position='10 10' ");

	TwAddButton(m_dialog, "Load Scene", LoadAGL, this, " label='Load Scene' key=c help='Load an Agile file into the editor.' group='I/O'");
	TwAddButton(m_dialog, "Save Scene", SaveAGL, this, " label='Save Scene' key=c help='Save a scene into an Agile file.' group='I/O'");

	TwAddVarRW(m_dialog, "Rotation", TW_TYPE_QUAT4F, Scene::GetInstance()->GetQuaternionRotation(), "opened=true axisz=-z");

	TwStructMember pointMembers[] = { 
        { "X", TW_TYPE_FLOAT, offsetof(AglVector3, x), " Step=0.01 " },
        { "Y", TW_TYPE_FLOAT, offsetof(AglVector3, y), " Step=0.01 " },
		{ "Z", TW_TYPE_FLOAT, offsetof(AglVector3, z), " Step=0.01 " }};
    TwType pointType = TwDefineStruct("POINT", pointMembers, 3, sizeof(AglVector3), NULL, NULL);

	TwAddVarRW(m_dialog, "Position", pointType, Scene::GetInstance()->GetPosition(), "");

	TwAddVarRW(m_dialog, "ShowHideDiffuse", TW_TYPE_BOOLCPP, &DIFFUSEON, "group='Show/Hide'");
	TwAddVarRW(m_dialog, "ShowHideSpec", TW_TYPE_BOOLCPP, &SPECULARON, "group='Show/Hide'");
	TwAddVarRW(m_dialog, "ShowHideGlow", TW_TYPE_BOOLCPP, &GLOWON, "group='Show/Hide'");
	TwAddVarRW(m_dialog, "ShowHideNormal", TW_TYPE_BOOLCPP, &NORMALON, "group='Show/Hide'");

	m_meshDialog = new MeshDialog();
	m_materialDialog = new MaterialDialog();
	m_particleSystemDialog = new ParticleSystemDialog();
	m_mergeDialog = new MergeDialog();
}
开发者ID:MattiasLiljeson,项目名称:Amalgamation,代码行数:32,代码来源:SceneDialog.cpp

示例6: main

int main(int args, char **argv)
{
  glutInit(&args, argv);
  glutInitWindowSize(800, 600);
  glutInitDisplayMode(GLUT_RGBA | GLUT_DEPTH | GLUT_DOUBLE);
  glutCreateWindow("simple vertex shader");

  TwInit(TW_OPENGL, NULL);
  TwBar *bar = TwNewBar("myBar");
  TwDefine("myBar size='200 400' color = '96 216 224'");

  TwAddVarRW(bar, "ObjectRotate", TW_TYPE_QUAT4F, &g_Rotate, "label='Object Rotation' opened=true");
  TwAddVarRW(bar, "LightDir", TW_TYPE_DIR3F, &g_lightPos, "label='light Pos' opened=true");
  glutMouseFunc((GLUTmousebuttonfun)TwEventMouseButtonGLUT);
  glutMotionFunc((GLUTmousemotionfun)TwEventMouseMotionGLUT);
  glutPassiveMotionFunc((GLUTmousemotionfun)TwEventMouseMotionGLUT);
  glutKeyboardFunc((GLUTkeyboardfun)TwEventKeyboardGLUT);
  TwGLUTModifiersFunc(glutGetModifiers);
  glutDisplayFunc(RenderScene);
  glutReshapeFunc(ChangeSize);
  SetupRC();
  glutMainLoop();
  Terminate();
  return 0;
}
开发者ID:RamboWu,项目名称:openglex,代码行数:25,代码来源:simple.cpp

示例7: init

void init(void)
{
	

	// Define técnica de shading: GL_FLAT, GL_SMOOTH
	glShadeModel(GL_SMOOTH);
	
	glPolygonMode(GL_FRONT, GL_FILL); // GL_LINE, GL_POINT, GL_FILL

	// Activa o teste de profundidade
	glEnable(GL_DEPTH_TEST);
	glEnable(GL_TEXTURE_2D); 
	//glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); 
	TwInit(TW_OPENGL, NULL);

	mainBar = TwNewBar("Parameters");
	TwAddVarRW(mainBar, "Time Scale", TW_TYPE_FLOAT, &TimeScale,
		" group='Simulation' keyincr=U keydecr=I help='Simulation's time scale'");
	TwAddVarRW(mainBar, "Speed", TW_TYPE_FLOAT, &camSpeed,
		" group='Camera' keyincr=S keydecr=X help='Camera movement speed' ");
	TwAddVarRW(mainBar, "Manual", TW_TYPE_BOOL16, &manualCam,
		" group='Camera' keyincr=C help='Toogle camera mode' ");
	TwAddVarRW(mainBar, "Show Orbits", TW_TYPE_BOOL16, &orbits,
		" group='Orbits' keyincr=O help='Toogle orbits' ");

	// Compila o modelo
	createFloorToDL();
}
开发者ID:vvolkgang,项目名称:YASS,代码行数:28,代码来源:main.c

示例8: initGUI

void initGUI() {
    // Initialize AntTweakBar GUI
    if (!TwInit(TW_OPENGL, NULL))
    {
        assert(0);
    }

    TwWindowSize(g_WindowWidth, g_WindowHeight);
    TwBar *controlBar = TwNewBar("Controls");
    TwDefine(" Controls position='10 10' size='200 320' refresh=0.1 ");

    TwAddVarCB(controlBar, "use_shaders", TW_TYPE_BOOLCPP, cbSetShaderStatus, cbGetShaderStatus, NULL, " label='shaders' key=s help='Turn programmable pipeline on/off.' ");

    // Shader panel setup
    TwAddVarRW(controlBar, "vs", TW_TYPE_BOOLCPP, &g_UseVertexShader, " group='Shaders' label='vertex' key=v help='Toggle vertex shader.' ");
    TwAddVarRW(controlBar, "gs", TW_TYPE_BOOLCPP, &g_UseGeometryShader, " group='Shaders' label='geometry' key=g help='Toggle geometry shader.' ");
    TwAddVarRW(controlBar, "fs", TW_TYPE_BOOLCPP, &g_UseFragmentShader, " group='Shaders' label='fragment' key=f help='Toggle fragment shader.' ");
    TwAddButton(controlBar, "build", cbCompileShaderProgram, NULL, " group='Shaders' label='build' key=b help='Build shader program.' ");
	//TwDefine( " Controls/Shaders readonly=true "); 

    // Render panel setup
    TwAddVarRW(controlBar, "wiremode", TW_TYPE_BOOLCPP, &g_WireMode, " group='Render' label='wire mode' key=w help='Toggle wire mode.' ");
    TwAddVarRW(controlBar, "face_culling", TW_TYPE_BOOLCPP, &g_FaceCulling, " group=Render label='face culling' key=c help='Toggle face culling.' ");

    // Scene panel setup
    TwEnumVal geometry_type[] = { 
        { ELEPHANT_GEOMETRY    , "Elephant"},
        { CUBE_GEOMETRY        , "Cube"    },
    };
    TwType geom_type = TwDefineEnum("Model", geometry_type, NUM_GEOMETRY_TYPES);
    TwAddVarRW(controlBar, "model", geom_type, &g_GeometryType, " group='Scene' keyIncr=Space help='Change model.' ");
    TwAddVarRW(controlBar, "auto-rotation", TW_TYPE_BOOLCPP, &g_SceneRotEnabled, " group='Scene' label='rotation' key=r help='Toggle scene rotation.' ");
    TwAddVarRW(controlBar, "Translate", TW_TYPE_FLOAT, &g_SceneTraZ, " group='Scene' label='translate' min=1 max=1000 step=0.5 keyIncr=t keyDecr=T help='Scene translation.' ");
    TwAddVarRW(controlBar, "SceneRotation", TW_TYPE_QUAT4F, &g_SceneRot, " group='Scene' label='rotation' open help='Toggle scene orientation.' ");
}
开发者ID:Bublafus,项目名称:NPR-techniques,代码行数:35,代码来源:AntTweakConfiguration.cpp

示例9: TwInit

void SSAO::BuildUI() {
	TwInit(TW_DIRECT3D11, _device);
	TwWindowSize(_screenWidth, _screenHeight);
	_bar = TwNewBar("AmbientOcclusion");
	TwDefine(" GLOBAL help='This example shows how to integrate AntTweakBar into a DirectX11 application.' "); // Message added to the help bar.
	int barSize[2] = {300, 375};
	TwSetParam(_bar, NULL, "size", TW_PARAM_INT32, 2, barSize);

	TwAddVarCB(_bar, "Rad", TW_TYPE_FLOAT, SSAO::SetRad, SSAO::GetRad, this, "group=ShaderParams min=0 max=20 step=0.001 keyincr=+ keydecr=-");
	TwAddVarCB(_bar, "TotalStr", TW_TYPE_FLOAT, SSAO::SetTotStr, SSAO::GetTotStr, this, "group=ShaderParams min=0 max=50 step=0.1 keyincr=+ keydecr=-");
	TwAddVarCB(_bar, "Strength", TW_TYPE_FLOAT, SSAO::SetStrength, SSAO::GetStrength, this, "group=ShaderParams min=0.1 max=100 step=0.1 keyincr=+ keydecr=-");
	TwAddVarCB(_bar, "Offset", TW_TYPE_FLOAT, SSAO::SetOffset, SSAO::GetOffset, this, "group=ShaderParams min=0 max=100 step=0.5 keyincr=+ keydecr=-");
	TwAddVarCB(_bar, "Falloff", TW_TYPE_FLOAT, SSAO::SetFalloff, SSAO::GetFalloff, this, "group=ShaderParams min=0 max=0.01 step=0.00001 keyincr=+ keydecr=-");
	TwAddVarCB(_bar, "BlurSize", TW_TYPE_FLOAT, SSAO::SetBlur, SSAO::GetBlur, this, "group=ShaderParams min=1 max=16 step=1 keyincr=+ keydecr=-");
	TwAddButton(_bar, "Reset", SSAO::ResetButton, this, "");
	TwAddButton(_bar, "ShowDebug", SSAO::ShowDebug, this, "");

	TwEnumVal* a = new TwEnumVal[3];
	a[0].Value = 0; a[0].Label = "buddha";
	a[1].Value = 1; a[1].Label = "hairball";
	a[2].Value = 2; a[2].Label = "sib";
	_index = 0;

	TwType actMesh = TwDefineEnum("mesh", a, 3);

	TwAddVarCB(_bar, "ActiveVol", actMesh, SSAO::SetMesh, SSAO::GetMesh, this, 
		" group='Mesh' keyIncr=Backspace keyDecr=SHIFT+Backspace help='Stop or change the rotation mode.' ");

}
开发者ID:Jake-Baugh,项目名称:screen-space-ambient-occlusion,代码行数:29,代码来源:ssaoEffect.cpp

示例10: glutCreateMenu

void DemoWindow::initTWBar()
{
	glutCreateMenu(NULL);
	// Initialize AntTweakBar
    TwInit(TW_OPENGL, NULL);

	//// Set GLUT event callbacks
 //   // - Directly redirect GLUT mouse button events to AntTweakBar
 //   glutMouseFunc((GLUTmousebuttonfun)TwEventMouseButtonGLUT);
 //   // - Directly redirect GLUT mouse motion events to AntTweakBar
 //   glutMotionFunc((GLUTmousemotionfun)TwEventMouseMotionGLUT);
 //   // - Directly redirect GLUT mouse "passive" motion events to AntTweakBar (same as MouseMotion)
 //   glutPassiveMotionFunc((GLUTmousemotionfun)TwEventMouseMotionGLUT);
 //   // - Directly redirect GLUT key events to AntTweakBar
 //   glutKeyboardFunc((GLUTkeyboardfun)TwEventKeyboardGLUT);
 //   // - Directly redirect GLUT special key events to AntTweakBar
 //   glutSpecialFunc((GLUTspecialfun)TwEventSpecialGLUT);
    // - Send 'glutGetModifers' function pointer to AntTweakBar;
    //   required because the GLUT key event functions do not report key modifiers states.
    TwGLUTModifiersFunc(glutGetModifiers);
	bar = TwNewBar("TweakBar");
	TwWindowSize(100, 100);
    TwDefine(" GLOBAL help='This example shows how to integrate AntTweakBar with GLUT and OpenGL.' "); // Message added to the help bar.
    TwDefine(" TweakBar size='200 400' color='96 216 224' "); // change default tweak bar size and color

}
开发者ID:billhj,项目名称:Etoile,代码行数:26,代码来源:DemoWindow.cpp

示例11: Position

ModelLightingClass::ModelLightingClass(string barName, bool p_quad, const XMFLOAT3 & postion):Entity(),
	Position(postion), Rotation(0.0f, 0.0f, 0.0f), Scale(1.0f, 1.0f, 1.0f), Quaternion(XMQuaternionIdentity())
{
	m_vertexBuffer = 0;
	m_indexBuffer = 0;
	m_model = 0;


	m_bar = TwNewBar(barName.c_str());

	string define = barName + " iconified=true  alpha=200";
	string group = barName + "/Rotation opened = false";
	TwDefine(define.c_str());

	TwAddVarRW(m_bar, "XRotation", TW_TYPE_FLOAT, &Rotation.x, " step=0.01 group=Rotation");
	TwAddVarRW(m_bar, "YRotation", TW_TYPE_FLOAT, &Rotation.y, " step=0.01 group=Rotation");
	TwAddVarRW(m_bar, "ZRotation", TW_TYPE_FLOAT, &Rotation.z, "min=0 max=6.28 step=0.01 group=Rotation");
	TwDefine(group.c_str());

	TwAddVarRW(m_bar, "XPosition", TW_TYPE_FLOAT, &Position.x, "  step=0.1 group=Position");
	TwAddVarRW(m_bar, "YPosition", TW_TYPE_FLOAT, &Position.y, "  step=0.1 group=Position");
	TwAddVarRW(m_bar, "ZPosition", TW_TYPE_FLOAT, &Position.z, "  step=0.1 group=Position");
	group = barName + "/Position opened = false";
	TwDefine(group.c_str());

	TwAddVarRW(m_bar, "XScale", TW_TYPE_FLOAT, &Scale.x, "  step=0.01 group=Scale");
	TwAddVarRW(m_bar, "YScale", TW_TYPE_FLOAT, &Scale.y, "  step=0.01 group=Scale");
	TwAddVarRW(m_bar, "ZScale", TW_TYPE_FLOAT, &Scale.z, "  step=0.01 group=Scale");
	group = barName + "/Scale opened = false";
	TwDefine(group.c_str());
}
开发者ID:VincentHui,项目名称:Genisis,代码行数:31,代码来源:ModelLightingClass.cpp

示例12: glutPassiveMotionFunc

void RotationsViewer::initializeGui()
{
    glutPassiveMotionFunc((GLUTmousemotionfun)TwEventMouseMotionGLUT);
    TwGLUTModifiersFunc(glutGetModifiers);
    TwInit(TW_OPENGL, NULL);
    TwWindowSize(mWindowWidth, mWindowHeight);

    TwCopyStdStringToClientFunc(onCopyStdStringToClient);

    mDemoBar = TwNewBar("Demo controls");
    TwDefine(" 'Demo controls' size='200 175' position='5 5' iconified=false fontresizable=false alpha=200");

    TwEnumVal modeTypeEV[] = { { DEMO1, "Convert" }, { DEMO2, "Curve" } };
    modeType = TwDefineEnum("ModeType", modeTypeEV, 2);
    TwAddVarRW(mDemoBar, "Demo", modeType, &mMode, NULL);

    TwAddVarRW(mDemoBar, "X Angle", TW_TYPE_DOUBLE, &mXAngle, " group='Convert params' ");
    TwAddVarRW(mDemoBar, "Y Angle", TW_TYPE_DOUBLE, &mYAngle, " group='Convert params' ");
    TwAddVarRW(mDemoBar, "Z Angle", TW_TYPE_DOUBLE, &mZAngle, " group='Convert params' ");
    TwEnumVal rooTypeEV[] = { { XYZ, "XYZ" }, { XZY, "XZY" }, { YXZ, "YXZ" }, { YZX, "YZX" }, { ZXY, "ZXY" }, { ZYX, "ZYX" } };
    rooType = TwDefineEnum("RooType", rooTypeEV, 6);
    TwAddVarRW(mDemoBar, "Rot Order", rooType, &mRotOrder, " group='Convert params' ");

    TwEnumVal splineTypeEV[] = { { ASplineQuat::LINEAR, "Linear" }, { ASplineQuat::CUBIC, "Cubic" } };
    splineType = TwDefineEnum("SplineType", splineTypeEV, 2);
    TwAddVarCB(mDemoBar, "Spline type", splineType, onSetStyleCb, onGetStyleCb, this, " group='Curve params'");
}
开发者ID:codemodo,项目名称:animation_toolkit,代码行数:27,代码来源:RotationsViewer.cpp

示例13: initGUI

/** Initializes GUI - only AntweakBar menu creation */
void initGUI()
{
    // Initialize AntTweakBar GUI
    if (!TwInit(TW_OPENGL, NULL))
    {
        assert(0);
    }

    TwWindowSize(g_WindowWidth, g_WindowHeight);
    TwBar *controlBar = TwNewBar("Controls");
    TwDefine("Controls position='10 10' size='200 300' refresh=0.1  color='130 140 150'");
	
	TwAddVarCB(controlBar, "gpu", TW_TYPE_BOOLCPP, cbSetGPUUsage, cbGetGPUUsage, NULL, " group='CUDA' label='Compute on:' true='GPU' false='CPU' ");
	//TwAddVarRW(controlBar, "restart", TW_TYPE_BOOLCPP, &g_initData, " group='PROGRAM' label='Restart: ' true='' false='restart' ");
    
    TwAddVarRW(controlBar, "melt", TW_TYPE_BOOLCPP, &g_melt, " group='Render' label='Melt' key=m help='Start melting' ");
	TwAddVarRW(controlBar, "wiremode", TW_TYPE_BOOLCPP, &g_WireMode, " group='Render' label='Wire mode' key=w help='Toggle wire mode.' ");
    TwAddVarRW(controlBar, "march", TW_TYPE_BOOLCPP, &g_useMarchingCubes, " group='Render' label='March. Cubes' help='Toggle marching cubes.' ");
    
    TwAddVarRW(controlBar, "auto-rotation", TW_TYPE_BOOLCPP, &g_SceneRotEnabled, " group='Scene' label='rotation' key=r help='Toggle scene rotation.' ");
    TwAddVarRW(controlBar, "Translate", TW_TYPE_FLOAT, &g_SceneTraZ, " group='Scene' label='translate' min=1 max=1000 step=10 keyIncr=t keyDecr=T help='Scene translation.' ");
    TwAddVarRW(controlBar, "SceneRotation", TW_TYPE_QUAT4F, &g_SceneRot, " group='Scene' label='rotation' open help='Toggle scene orientation.' ");
	
	TwAddVarRO(controlBar, "fps", TW_TYPE_FLOAT, &g_fps, " group='INFO' label='Current fps' ");
	TwAddVarRO(controlBar, "ice", TW_TYPE_FLOAT, &g_iceParticles, " group='INFO' label='Ice particles' ");
	
}
开发者ID:Jaa-c,项目名称:GPU-led,代码行数:28,代码来源:main.cpp

示例14: TwNewBar

void BasicTriangleScene::init(GLFWwindow* window)
{
    Scene::init(window);

    tweakBar = TwNewBar("settings");
    vertexBuffer = new Buffer(3);
    colorBuffer = new Buffer(3);
    vertexBuffer->addVertexAttribPointer(0,3,0);
    colorBuffer->addVertexAttribPointer(1,3,0);
    vertexBuffer->addData(vertices,sizeof(vertices) / sizeof(GLfloat));
    colorBuffer->addData(colors,sizeof(colors) / sizeof(GLfloat));

    shader = new Shader(PathFind::getAsset("shd/triangle.vert"), PathFind::getAsset("shd/triangle.frag"));
    shader->bind();

    glGenVertexArrays(1,&VAO);
    glBindVertexArray(VAO);
        vertexBuffer->init();
        colorBuffer->init();
    glBindVertexArray(0);

    TwAddVarRW(tweakBar, "Background Color", TW_TYPE_COLOR3F, &bgcolor, " label='Background Color' ");

    glfwSetMouseButtonCallback(window, (GLFWmousebuttonfun)TwEventMouseButtonGLFW3);
    glfwSetKeyCallback(window, (GLFWkeyfun)TwEventKeyGLFW3);
    glfwSetCharModsCallback(window, (GLFWcharmodsfun) TwEventCharModsGLFW3);
    glfwSetCursorPosCallback(window,(GLFWcursorposfun)TwEventCursorPosGLFW3);
    glfwSetScrollCallback(window,(GLFWscrollfun)TwEventScrollGLFW3);
}
开发者ID:lejonmcgowan,项目名称:OpenGLWrapper,代码行数:29,代码来源:BasicTriangleScene.cpp

示例15: m_game

Gui::Gui(Scene& scene,
         Game& game,
         Camera& camera,
         Input& input,
         Timer& timer) :
    m_game(game),
    m_camera(camera),
    m_scene(scene),
    m_timer(timer)
{
    TwInit(TW_OPENGL_CORE, nullptr);
    TwWindowSize(WINDOW_WIDTH, WINDOW_HEIGHT);

    const std::string barname = "GraphicsTweaker";
    m_tweakbar = TwNewBar(barname.c_str());
    m_tweaker = std::make_unique<Tweaker>(m_tweakbar);
    
    const int border = 10;
    std::ostringstream stream;
    stream << barname << " label='Graphics Tweaker' " 
        << "position='" << border << " " << border << "' "
        << "size='250 " << WINDOW_HEIGHT-border*2 << "' "
        << "alpha=180 text=light valueswidth=80 color='0 0 0' "
        << "refresh=0.05 iconified=false resizable=true "
        << "fontsize=2 fontresizable=false ";
    TwDefine(stream.str().c_str());

    FillTweakBar();

    auto AddKeyCallback = [&input](unsigned int key, unsigned int code)
    {
        input.AddCallback(key, false, [code]()
        { 
            TwKeyPressed(code, 0);
        });
    };

    // Keys required for modifying entries in the tweak bar
    AddKeyCallback(GLFW_KEY_0, '0');
    AddKeyCallback(GLFW_KEY_1, '1');
    AddKeyCallback(GLFW_KEY_2, '2');
    AddKeyCallback(GLFW_KEY_3, '3');
    AddKeyCallback(GLFW_KEY_4, '4');
    AddKeyCallback(GLFW_KEY_5, '5');
    AddKeyCallback(GLFW_KEY_6, '6');
    AddKeyCallback(GLFW_KEY_7, '7');
    AddKeyCallback(GLFW_KEY_8, '8');
    AddKeyCallback(GLFW_KEY_9, '9');
    AddKeyCallback(GLFW_KEY_PERIOD, '.');
    AddKeyCallback(GLFW_KEY_MINUS, '-');
    AddKeyCallback(GLFW_KEY_ENTER, TW_KEY_RETURN);
    AddKeyCallback(GLFW_KEY_LEFT, TW_KEY_LEFT);
    AddKeyCallback(GLFW_KEY_RIGHT, TW_KEY_RIGHT);
    AddKeyCallback(GLFW_KEY_TAB, TW_KEY_TAB);
    AddKeyCallback(GLFW_KEY_END, TW_KEY_END);
    AddKeyCallback(GLFW_KEY_HOME, TW_KEY_HOME);
    AddKeyCallback(GLFW_KEY_BACKSPACE, TW_KEY_BACKSPACE);

    LogInfo("GUI: Tweak bar initialised");
}
开发者ID:karajensen,项目名称:tiny-toon-tanks,代码行数:60,代码来源:Gui.cpp


注:本文中的TwNewBar函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。