本文整理汇总了C++中TwDefine函数的典型用法代码示例。如果您正苦于以下问题:C++ TwDefine函数的具体用法?C++ TwDefine怎么用?C++ TwDefine使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TwDefine函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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
}
示例2: 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());
}
示例3: TwDefine
void KinectUser::showParams( bool show )
{
if( show )
TwDefine( "Kinect visible=true" );
else
TwDefine( "Kinect visible=false" );
}
示例4: 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.' ");
}
示例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();
}
示例6: setupAntTweakBar
static void setupAntTweakBar()
{
g_bar = TwNewBar("TweakBar");
TwDefine(" TweakBar size='320 640' "); // resize bar
TwDefine(" GLOBAL help='Simulation control.' "); // Message added to the help bar.
/*TwAddVarRW(g_bar, "TD", TW_TYPE_FLOAT, &var_TIME_DELTA,
" label='Time delta' precision=5 min=0 max=1 step=0.01 ");*/
TwAddVarRW(g_bar, "FPS", TW_TYPE_DOUBLE, &g_twVar.info_fps,
" group=INFO label='Frame rate:' precision=1 ");
TwAddSeparator(g_bar, "SEP0", 0);
/*TwAddVarRW(g_bar, "ANIMATION_SPEED", TW_TYPE_FLOAT, &var_ANIMATION_SPEED,
" group=ANIMATION label='Speed' precision=1 min=0 max=10 step=0.1 ");*/
TwAddVarRW(g_bar, "GRAVITY", TW_TYPE_FLOAT, &g_twVar.sim_gravity,
" group=SIMULATION label='Gravity' precision=10 min=-1 max=1 step=0.0001 ");
TwAddVarRW(g_bar, "SIMULATE", TW_TYPE_BOOL8, &g_twVar.sim_enable,
" group=SIMULATION label='Run simulation' ");
TwAddButton(g_bar, "SIMULATION_STEP", [](void*) { g_twVar.sim_step = true; }, NULL,
" group=SIMULATION label='Step simulation' key=N ");
TwAddButton(g_bar, "SIMULATION_RESET", [](void*) { g_ball->reset(false); s_model->resetAnimation(); }, NULL,
" group=SIMULATION label='Reset' ");
TwAddSeparator(g_bar, "SEP1", 0);
TwAddVarRW(g_bar, "BLEND_VERT_STIFF", TW_TYPE_BOOL8, &g_twVar.blend_useWeights,
" group=BLEND label='Use skin weights' ");
TwAddVarRW(g_bar, "BLEND_STIFF_MULT", TW_TYPE_FLOAT, &g_twVar.blend_multiplier,
" group=BLEND label='Multiplier' precision=4 min=0 max=1 step=0.0001 ");
TwAddVarRW(g_bar, "BLEND_CONST_STIFF", TW_TYPE_FLOAT, &g_twVar.constraint_stiffness,
" group=BLEND label='Stiffness k' precision=4 min=0 max=1 step=0.0001 ");
TwAddSeparator(g_bar, "SEP2", 0);
TwAddVarRW(g_bar, "RENDER_FILL", TW_TYPE_BOOL8, &g_twVar.render_fill,
" group=RENDER label='Fill' ");
TwAddVarRW(g_bar, "RENDER_WIREFRAME", TW_TYPE_BOOL8, &g_twVar.render_wireframe,
" group=RENDER label='Wireframe' ");
TwAddVarRW(g_bar, "RENDER_DISTMAG", TW_TYPE_BOOL8, &g_twVar.render_distMag,
" group=RENDER label='Distortion magnitude' ");
TwAddVarRW(g_bar, "rec_record", TW_TYPE_BOOL8, ffmpegRec(),
" group=RECORD label='Record' ");
TwAddSeparator(g_bar, "SEP3", 0);
TwAddButton(g_bar, "BALL_RESET", [](void*) { g_ball->reset(); }, NULL, " label='Throw ball' ");
}
示例7: CreateBar
void CreateBar()
{
TwBar *waspskeletonBar = TwNewBar("WaspSkeletonBar");
TwDefine(" GLOBAL help='This is to rotate a single bone.' ");
TwDefine(" WaspSkeletonBar size='200 400' color='96 216 224' ");
CreateBarLabels(waspskeletonBar, skeletonWasp);
}
示例8: 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 ");
}
示例9: TwNewBar
void IntroOpenGl::CreateGui()
{
m_bar = TwNewBar("IntroToOpenGL");
TwDefine(" IntroToOpenGL position='10 10' "); // move bar to position (10, 10)
TwDefine(" IntroToOpenGL size='430 320' "); // resize bar
TwDefine(" IntroToOpenGL color='128 128 128' alpha=32 "); // semi-transparent blue bar
TwDefine(" IntroToOpenGL resizable=false "); // mybar cannot be resized
TwAddButton(m_bar, "label_01", NULL, NULL, "label='simply opengl scene, nothing much happening'"); //show as label
TwAddButton(m_bar, "mainMenu", Callback, this, "label='main menu'"); //show as button
}
示例10: TwNewBar
void APP_SpotRotate::CreateGui()
{
m_bar = TwNewBar("SpotRotate");
TwDefine(" SpotRotate position='10 10' "); // move bar to position (10, 10)
TwDefine(" SpotRotate size='430 320' "); // resize bar
TwDefine(" SpotRotate color='128 128 128' alpha=32 "); // semi-transparent blue bar
TwDefine(" SpotRotate resizable=false "); // mybar cannot be resized
TwAddButton(m_bar, "label_01", NULL, NULL, "label='proof of concept for bill borded sprites with rotation'"); //show as label
TwAddButton(m_bar, "mainMenu", Callback, this, "label='main menu'"); //show as button
}
示例11: createTweakBar
int createTweakBar(context_t *ctx, int scene) {
const char me[]="createTweakBar";
char buff[128];
int EE; /* we have an error */
EE = 0;
// NOTE: these are nice to have
twBumpMappingModes=TwDefineEnum("BumpMappingModes", twBumpMappingModesEV, 3);
twFilteringModes=TwDefineEnum("FilteringModes", twFilteringModesEV, 4);
twObjects=TwDefineEnum("Objects", twObjectsEV, 10);
twCubeMaps=TwDefineEnum("CubeMap", twCubeMapsEV, 3);
twShaders=TwDefineEnum("Shader", twShadersEV, 3);
/* Create a tweak bar for interactive parameter adjustment */
if (!EE) EE |= !(ctx->tbar = TwNewBar(TBAR_NAME));
/* documentation for the TwDefine parameter strings here:
http://www.antisphere.com/Wiki/tools:anttweakbar:twbarparamsyntax */
/* add a message to be seen in the "help" window */
if (!EE) EE |= !TwDefine(" GLOBAL help='This description of Project 2 "
"has not been changed by anyone but students "
"are encouraged to write something descriptive "
"here.' ");
/* change location where bar will be drawn, over to the right some
to expose more of the left edge of window. Note that we are
exploiting the automatic compile-time concatentation of strings
in C, which connects TBAR_NAME with the rest of the string to
make one contiguous string */
sprintf(buff, TBAR_NAME " position='%d %d' ",
ctx->winSizeX - ctx->tbarSizeX - ctx->tbarMargin,
ctx->tbarMargin);
if (!EE) EE |= !TwDefine(buff);
/* adjust other aspects of the bar */
sprintf(buff, TBAR_NAME " color='0 0 0' alpha=10 size='%d %d' ",
ctx->tbarSizeX, ctx->tbarSizeY);
if (!EE) EE |= !TwDefine(buff);
// NOTE: we broke this section out for easy update of tweak bar vars per-scene
if (!EE) EE |= updateTweakBarVars(scene);
/* see also:
http://www.antisphere.com/Wiki/tools:anttweakbar:twtype
http://www.antisphere.com/Wiki/tools:anttweakbar:twdefineenum
*/
if (EE) {
spotErrorAdd("%s: AntTweakBar initialization failed:\n\t%s", me, TwGetLastError());
return 1;
}
return 0;
}
示例12: AddLight
void AddLight (void)
{
Light light;
light.position = glm::vec4 (0, 10, 0, 0);
light.color = glm::vec4 (1, 1, 1, 1);
light.direction = glm::vec4 (0, -1, 0, 0);
light.spot.exponent = 2.0f;
light.spot.angle = PCH_PI/4.0f;
light.spot.cosine = cosf (light.spot.angle);
light.spot.tangent = tanf (light.spot.angle);
light.spot.penumbra_angle = light.spot.angle * 0.8f;
light.spot.penumbra_cosine = cosf (light.spot.penumbra_angle);
light.specular.color = glm::vec3 (1, 1, 1);
light.attenuation = glm::vec4 (0.0f, 0.0f, 0.007f, 50.0f);
light.CalculateFrustum ();
r->AddLight (light);
std::ostringstream stream;
stream << "lights/active visible=true min=0 max=" << r->GetNumLights () - 1;
TwDefine (stream.str ().c_str ());
if (r->GetNumLights () == 1)
{
TwDefine ("lights/position visible=true");
TwDefine ("lights/direction visible=true");
TwDefine ("lights/color visible=true");
TwDefine ("lights/spot visible=true");
TwDefine ("lights/attenuation visible=true");
TwDefine ("lights/specular visible=true");
TwDefine ("lights/remove visible=true");
}
}
示例13: TwDefine
void AudioBehaviour::setBar () {
bar.init ("Configuration", 255, 510, 200, 200, 200, 100);
bar.enable ();
TwDefine (" Configuration valueswidth=80 ");
//TwDefine (" Configuration position='750 310' ");
// general settings
bar.addParam ("black", &fade2black, " group='General Settings' label='Fade to black' help='general fade to black' min=0.01 max=0.99 step=0.01 ", false);
bar.addSeparator ("separator1");
bar.addParam ("blacktype", &fade2blackType, " group='General Settings' label='Fade to black mode' help='selects RGB or HSV fade to black type' true='HSV' false='RGB' ", false);
bar.addSeparator ("separator1");
nameStr = new char [10];
optionStr = new char [170];
for (int i=0; i<NUM_POINTS; i++) {
SphericPointConfig& _config = sphericPoints[i]->config;
setBarParam (i, "enable", "Point Enabled", "enable and disable point", _config.enabled);
setBarParam (i, "audio", "Audio Enabled", "enable and disable audio input", _config.audio_enabled);
setBarParam (i, "gain", "Gain", "input gain", -5.0, 5.0, 0.01, _config.gain);
setBarParam (i, "filter", "Filter", "input low pass filter", 0.01, 0.99, 0.01, _config.filter);
setBarParam (i, "huemin", "HUE min.", "minimum HUE value", -180, 360, 1, _config.hue_min);
setBarParam (i, "huemax", "HUE max.", "maximum HUE value", 0, 540, 1, _config.hue_max);
setBarParam (i, "decayh", "Dist. decay HUE", "amount of color change due to distance", -5.0, 5.0, 0.01, _config.distDecayH);
setBarParam (i, "decays", "Dist. decay Sat.", "amount of saturation change due to distance", -5.0, 5.0, 0.01, _config.distDecayS);
setBarParam (i, "decayv", "Dist. decay Value", "amount of bright change due to distance (size)", -5.0, 5.0, 0.01, _config.distDecayV);
setBarParam (i, "blend", "Blend", "blend factor for this point", 0.01, 1.0, 0.01, _config.blendFactor);
setBarParam (i, "movstep", "Movement Speed", "actually a step value for the noise signal which controls the position", 0.0, 0.1, 0.0001, _config.movNoiseStep);
setBarParam (i, "huestep", "Color change Speed ", "actually a step value for the noise signal which controls HUE", 0.0, 0.1, 0.0001, _config.hueNoiseStep);
setBarParam (i, "sat", "Saturation", "saturation of the point", 0.0, 1.0, 0.01, sphericPoints[i]->color.S);
// add separator
sprintf (nameStr, "%i", i);
bar.addSeparator (nameStr);
// set group closed (all but first)
if (i==0) {continue;}
sprintf (optionStr, " Configuration/'Spheric Point / Band %i' opened=false ", i);
TwDefine (optionStr);
}
delete nameStr, optionStr;
}
示例14: TwDefineEnum
void TweakDemEditor::updateBar(TwBar *bar)
{
EditorHandler *e = dynamic_cast<EditorHandler*>(eventHandler.get());
if (e == NULL) {
return;
}
// Adding the list of edited graphs
TwEnumVal *editModes= new TwEnumVal[2];
editModes[0].Value = ADD;
editModes[0].Label = "ADD";
editModes[1].Value = MAX;
editModes[1].Label = "MAX";
TwType editType = TwDefineEnum("EditType", editModes, 2);
TwAddVarCB(bar, "EditMode", editType, SetDemEditModeCallback, GetDemEditModeCallback, NULL, " label='Edit Mode' group='DemEditor' key='e' ");
TwAddVarRW(bar, "demBrushRadius", TW_TYPE_FLOAT, &(e->relativeRadius), " group=DemEditor label='Brush Radius' help='Size of the Dem Editor Brush' min=0.0 step=0.01 ");
TwAddVarRW(bar, "demBrushColor", TW_TYPE_FLOAT, &(e->brushColor[0]), " group=DemEditor label='Brush altitude' help='Altitude applied to the texture' step='0.1' ");
TwAddButton(bar, "demReset", ResetDemCB, NULL, " group=DemEditor label='Reset' help='Cancels all editing operations performed on active editors' ");
char def[200];
sprintf(def, "%s/DemEditor label='Dem Edition'", TwGetBarName(bar));
char name[20];
TwDefine(def);
set<string> groupNames;
for (int i = 0; i < e->getEditorCount(); i++) {
string n = e->getEditor(i)->getGroup();
if (groupNames.find(n) == groupNames.end()) {
groupNames.insert(n);
sprintf(name, "demEditorGroup%d", i);
sprintf(def, " group=%s label='Activate %s' help='Activate or Deactivate the selected Editor' ", n.c_str(), n.c_str());
TwAddVarCB(bar, name, TW_TYPE_BOOLCPP, SetDemEditorGroupStateCallback, GetDemEditorGroupStateCallback, e->getEditor(i), def);
sprintf(def, " group=%s ", n.c_str());
TwAddSeparator(bar, NULL, def);
sprintf(def, "%s/%s label='%s' group=DemEditor ", TwGetBarName(bar), n.c_str(), n.c_str());
TwDefine(def);
}
}
for (int i = 0; i < e->getEditorCount(); i++) {
sprintf(name, "DemEditor%d", i);
sprintf(def, " group=%s label='%s' help='Activate or Deactivate the selected Editor' ", e->getEditor(i)->getName().c_str(), e->getEditor(i)->getName().c_str());
TwAddVarCB(bar, name, TW_TYPE_BOOLCPP, SetDemEditorStateCallback, GetDemEditorStateCallback, e->getEditor(i), def);
}
delete[] editModes;
}
示例15: toolBoxSetup
void toolBoxSetup()
{
TwBar *bar = TwNewBar("Info & Options");
TwDefine(" GLOBAL help='PRT Simple Example' ");
TwDefine(" 'Info & Options' size='200 200' color='96 216 224' ");
TwAddSeparator(bar, "cam separator", "group='Camera'");
TwAddVarRW(bar, "Speed", TW_TYPE_FLOAT, &camSpeed, "group='Camera'");
TwAddVarRW(bar, "PosX", TW_TYPE_FLOAT, &g_Camera->m_Position.x, "group='Camera'");
TwAddVarRW(bar, "PosY", TW_TYPE_FLOAT, &g_Camera->m_Position.y, "group='Camera'");
TwAddVarRW(bar, "PosZ", TW_TYPE_FLOAT, &g_Camera->m_Position.z, "group='Camera'");
TwAddVarRW(bar, "Pitch", TW_TYPE_FLOAT, &g_Camera->m_PitchDegrees, "group='Camera'");
TwAddVarRW(bar, "Heading", TW_TYPE_FLOAT, &g_Camera->m_HeadingDegrees, "group='Camera'");
}