Example #1
0
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 ");
}
Example #2
0
	bool TweakBar::Initialize()
	{
		TwDefine(" GLOBAL fontscaling=2 ");
		if(!TwInit(TW_OPENGL, NULL))
		{
			Engine::Error("Initialization Failed: Tweak Bar");
			return false;
		}

		m_bar = TwNewBar("CONTROLS");
		TwWindowSize(TheGraphics::Instance()->GetWidth(), TheGraphics::Instance()->GetHeight());
		int barSize[2]	= { 1280, 160 };
		int barPos[2]	= { 0, 544 };
		TwSetParam(m_bar, NULL, "size", TW_PARAM_INT32, 2, barSize);
		TwSetParam(m_bar, NULL, "position", TW_PARAM_INT32, 2, barPos);
		TwDefine(" CONTROLS alpha=255 movable=false fontsize=3 color='100 100 100' iconifiable=false resizable=false");

		m_act = TwNewBar("GROUP");
		TwDefine(" GROUP size='256 60' position='1024 520' alwaystop=true alpha=255 movable=false fontsize=3 color='150 70 70' iconifiable=false resizable=false");
		TwSetTopBar(m_act);
		return true;
	}