Exemplo n.º 1
0
void zerokernel::VariableListEntry::setVariable(settings::IVariable *variable)
{
    switch (variable->getType())
    {
    case settings::VariableType::BOOL:
        control = std::move(createCheckbox(variable));
        break;
    case settings::VariableType::INT:
    case settings::VariableType::FLOAT:
        control = std::move(createSpinner(variable));
        break;
    case settings::VariableType::STRING:
        control = std::move(createTextInput(variable));
        break;
    case settings::VariableType::COLOR:
        control = std::move(createColorPicker(variable));
        break;
    case settings::VariableType::KEY:
        control = std::move(createKeyInput(variable));
        break;
    }
    if (control)
    {
        control->setParent(this);
        control->bb.setMargin(0, 0, 0, 4);
    }
}
Exemplo n.º 2
0
  void menuSetup(void)
  {
    mEnvironmentTexture = SGET("cubemap.dds");
		mStartup = true;

    AddToken("FractalCoordinates",MC_FRACTAL_COORDINATES);

    createButton("Default Mandelbrot", MC_DEFAULT_MANDELBROT, "DefaultMandelbrot");
    createButton("Filter Fractal", MC_FILTER_FRACTAL, "FilterFractal");
		createButton("Optimize Mesh", MC_OPTIMIZE_MESH, "OptimizeMesh");

    createCheckbox("Preview Only", MC_PREVIEW_ONLY, "PreviewOnly", false );
		createCheckbox("Use Rectangle Subdivision", MC_RECTANGLE_SUBDIVISION,"RectangleSubdivision",true);
		createCheckbox("Use Multi-Threading", MC_USE_THREADING,"UseThreading",false);
    createCheckbox("View3D", MC_VIEW3D,"View3d",false);
    createCheckbox("Wireframe Overlay", MC_WIREFRAME_OVERLAY,"WireframeOverlay",false);
    createCheckbox("Show Normals", MC_SHOW_NORMALS,"ShowNormals",false);

    createSlider("Color Scale", MC_SMOOTH_COLOR, "SmoothColor", 1, 32, 16, true );
    createSlider("Iteration Count", MC_ITERATION_COUNT, "IterationCount", 40, 100000, 1024, true );
		createSlider("Clock Cycles Per Frame Mhz", MC_CLOCK_CYCLES, "ClockCycles", 20, 1000, 100, true );

    createSlider("Clamp Low",       MC_CLAMP_LOW,   "ClampLow",  0.0f, 1, 0.0f, false );
    createSlider("Clamp High",      MC_CLAMP_HIGH,  "ClampHigh",  0.001f, 0.3f, 0.3f, false );
    createSlider("Clamp Scale",     MC_CLAMP_SCALE, "ClampScale", 0.1f, 8, 1.0f, false );
    createSlider("Rotation Speed",  MC_ROTATION_SPEED, "RotationSpeed", -10, 10, 0.0f, false );

    CPARSER.Parse("TuiComboBegin ColorPalette");
    CPARSER.Parse("TuiName \"Color Palette\"");

    {
      WildCard *wc = createWildCard("*.pal");
      FileFind ff(wc,0);
      StringVector list;
      ff.GetFiles(list);
      StringVector::iterator i;
      for (i=list.begin(); i!=list.end(); i++)
      {
        CPARSER.Parse("TuiChoice \"%s\"", (*i).c_str() );
      }
      releaseWildCard(wc);
    }

    CPARSER.Parse("TuiArg default.pal");
    CPARSER.Parse("TuiScript ColorPalette %%1");
    CPARSER.Parse("TuiEnd");

    AddToken("ColorPalette", MC_COLOR_PALETTE );

    CPARSER.Parse("TuiComboBegin FloatingPointResolution");
    CPARSER.Parse("TuiName \"Float Resolution\"");

    CPARSER.Parse("TuiChoices SMALL MEDIUM BIGFLOAT FIXED32");

    CPARSER.Parse("TuiArg SMALL");
    CPARSER.Parse("TuiScript FloatingPointResolution %%1");
    CPARSER.Parse("TuiEnd");

    AddToken("FloatingPointResolution", MC_FLOATING_POINT_RESOLUTION );

    CPARSER.Parse("TuiComboBegin EnvironmentTexture");
    CPARSER.Parse("TuiName \"Environment Texture\"");

    {
      WildCard *wc = createWildCard("cubemap*.dds");
      FileFind ff(wc,"..\\..\\media\\CodeSuppository");
      StringVector list;
      ff.GetFiles(list);
      StringVector::iterator i;
      for (i=list.begin(); i!=list.end(); i++)
      {
        CPARSER.Parse("TuiChoice \"%s\"", (*i).c_str() );
      }
      releaseWildCard(wc);
    }

    CPARSER.Parse("TuiArg %s", mEnvironmentTexture.Get());
    CPARSER.Parse("TuiScript EnvironmentTexture %%1");
    CPARSER.Parse("TuiEnd");

    AddToken("EnvironmentTexture", MC_ENVIRONMENT_TEXTURE );

    createButton("Memory Report", MC_MEMORY_REPORT, "MemoryReport");


    CPARSER.Parse("TuiPageBegin MainMenu");
    CPARSER.Parse("TuiElement DefaultMandelbrot");
    CPARSER.Parse("TuiElement PreviewOnly");
		CPARSER.Parse("TuiElement RectangleSubdivision");
		CPARSER.Parse("TuiElement FloatingPointResolution");
		CPARSER.Parse("TuiElement UseThreading");
    CPARSER.Parse("TuiElement View3d");
    CPARSER.Parse("TuiElement WireframeOverlay");
    CPARSER.Parse("TuiElement ShowNormals");
		CPARSER.Parse("TuiElement FilterFractal");
		CPARSER.Parse("TuiElement OptimizeMesh");
    CPARSER.Parse("TuiElement SmoothColor");
    CPARSER.Parse("TuiElement IterationCount");
		CPARSER.Parse("TuiElement ClockCycles");
		CPARSER.Parse("TuiElement ClampLow");
		CPARSER.Parse("TuiElement ClampHigh");
		CPARSER.Parse("TuiElement ClampScale");
    CPARSER.Parse("TuiElement RotationSpeed");
		CPARSER.Parse("TuiElement ColorPalette");
    CPARSER.Parse("TuiElement EnvironmentTexture");
    CPARSER.Parse("TuiElement FractalCoordinates");
    CPARSER.Parse("TuiElement MemoryReport");
    CPARSER.Parse("TuiPageEnd");

    CPARSER.Parse("TuiPage MainMenu");


		//
		AddToken("CreateDynamics", MC_CREATE_DYNAMICS );
		AddToken("PsScript", MC_PSSCRIPT);
		AddToken("PsLookAt", MC_PSLOOKAT);

    CPARSER.Parse("TuiLoad ThreadFrac.psc");
    CPARSER.Parse("TuiPageExecute MainMenu");



		mStartup = false;


  }
Exemplo n.º 3
0
int main(int argc, char** argv)
{
	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH);
	glutInitWindowSize(800, 600);
	mainWindow = glutCreateWindow("Heightmaps");

    

    /*std::cout << "P2" << std::endl;
    std::cout << map->width << std::endl;
    std::cout << map->height << std::endl;
    std::cout << map->depth << std::endl;
    for(int i = 0; i < map->width * map->height; i++)
    {
        std::cout << map->data[i] << std::endl;
    }*/
    
	sceneTransform = Transformation(
		Vector3(0, 0, -100),
		Vector3(0.3, 0.3, 0.3),
		Vector3(0, 0, 0)
	);
	light = Light(Vector4(10, 10, -10, 0));
	prepareScene();    
	sceneTransform.rotation.data[0] = -35;
    
	// Enable depth checking.
	glEnable(GL_DEPTH_TEST);

    glutIdleFunc(idle);
	glutTimerFunc(10, animate, 1);
	glutReshapeFunc(reshape);
	glutDisplayFunc(display);
	glutKeyboardFunc(keyboard);

	glui = GLUI_Master.create_glui("Heightmap Controls", 0, 800, 50);
    GLUI_Panel* mainPan = new GLUI_Panel(glui, "", GLUI_PANEL_NONE);
    
    
    GLUI_Panel* pan;
    createStaticText(mainPan, "Heightmap Utility");
    createStaticText(mainPan, "by Andrew Crowell");
    createStaticText(mainPan, "for CIS*4800 A4, 2010");
    createStaticText(mainPan, "");
    createStaticText(mainPan, "The W and A keys rotate the map.");
    pan = new GLUI_Panel(mainPan, "Heightmap");
    
    createTextField(pan, "Filename", mapFilename, loadMap);
	createFloatSpinner(pan, "R", &mapColor.data[Color::RedChannel], refreshGeometry)->set_float_limits(0, 1);
	createFloatSpinner(pan, "G", &mapColor.data[Color::GreenChannel], refreshGeometry)->set_float_limits(0, 1);
	createFloatSpinner(pan, "B", &mapColor.data[Color::BlueChannel], refreshGeometry)->set_float_limits(0, 1);
	createFloatSpinner(pan, "Z Scale", &mapScaleZ, refreshGeometry);
	createCheckbox(pan, "Randomize", &mapRandomize, refreshGeometry);
	
    pan = new GLUI_Panel(mainPan, "Message");
    errorMessageLabel = createStaticText(pan, "                                                ");
        
    createExitButton(glui, "Exit");
    
	glui->set_main_gfx_window(mainWindow);
	GLUI_Master.set_glutIdleFunc(idle); 

	loadMap(0);
	glutMainLoop();
	
    return 0;
}