Example #1
0
	void UIManager::Main_Menu_UI()
	{
		std::vector<IUI_Object*> uiObjects;

		//////////////////////////////////////////////////////////////
		// Create UI objects for this setup (MAIN_MENU_UI)
		//
		// Note: This requires that there be an active camera set in
		// the g_Engine global reference.
		//////////////////////////////////////////////////////////////
		if (g_Engine->GetActiveCamera() != nullptr)
		{
			// Set up button dimensions and offset
			float bWidth = 200.0f;
			float bHeight = 64.5f;
			float offsetX = -(bWidth / 2);
			float offsetY = -(bHeight / 2) + 50;

			// Create a start button and initialize it, then add to vector
			Button *pTempButton = g_Engine->GetFactory()->CreateObject<Button>();
			if (pTempButton)
			{
				// Initialize the button
				pTempButton->Initialize("Calibri", 36, offsetX, offsetY,
					bWidth, bHeight, "START", BUTTONTYPES::START_BUTTON, BUTTONTEXTURES::MENU_BUTTON_TEXTURE, D3DCOLOR_XRGB(255, 255, 255));

				uiObjects.push_back(pTempButton);
				pTempButton = nullptr;
			}

			// Create a exit button and initialize it, then add to vector
			pTempButton = g_Engine->GetFactory()->CreateObject<Button>();
			if (pTempButton)
			{
				// Offset this button so that it is 10p below the "START"
				offsetY += bHeight + 10;

				// Initialize the button
				pTempButton->Initialize("Calibri", 36, offsetX, offsetY,
					bWidth, bHeight, "EXIT", BUTTONTYPES::EXIT_BUTTON, BUTTONTEXTURES::MENU_BUTTON_TEXTURE, D3DCOLOR_XRGB(255, 255, 255));

				uiObjects.push_back(pTempButton);
				pTempButton = nullptr;
			}
		}

		// Set the UI Objects
		SetUIObjects(uiObjects);
	}
    void Initialize(ID3D11Device* device)
    {
        TwBar* tweakBar = Settings.TweakBar();

        EnableSun.Initialize(tweakBar, "EnableSun", "Sun Light", "Enable Sun", "Enables the sun light", true);
        Settings.AddSetting(&EnableSun);

        SunAreaLightApproximation.Initialize(tweakBar, "SunAreaLightApproximation", "Sun Light", "Sun Area Light Approximation", "Controls whether the sun is treated as a disc area light in the real-time shader", true);
        Settings.AddSetting(&SunAreaLightApproximation);

        SunTintColor.Initialize(tweakBar, "SunTintColor", "Sun Light", "Sun Tint Color", "The color of the sun", Float3(1.0000f, 1.0000f, 1.0000f), false, -340282300000000000000000000000000000000.0000f, 340282300000000000000000000000000000000.0000f, 0.0100f, ColorUnit::None);
        Settings.AddSetting(&SunTintColor);

        SunIntensityScale.Initialize(tweakBar, "SunIntensityScale", "Sun Light", "Sun Intensity Scale", "Scale the intensity of the sun", 1.0000f, 0.0000f, 340282300000000000000000000000000000000.0000f, 0.0100f, ConversionMode::None, 1.0000f);
        Settings.AddSetting(&SunIntensityScale);

        SunSize.Initialize(tweakBar, "SunSize", "Sun Light", "Sun Size", "Angular radius of the sun in degrees", 0.2700f, 0.0100f, 340282300000000000000000000000000000000.0000f, 0.0010f, ConversionMode::None, 1.0000f);
        Settings.AddSetting(&SunSize);

        NormalizeSunIntensity.Initialize(tweakBar, "NormalizeSunIntensity", "Sun Light", "Normalize Sun Intensity", "", false);
        Settings.AddSetting(&NormalizeSunIntensity);

        SunDirType.Initialize(tweakBar, "SunDirType", "Sun Light", "Sun Dir Type", "Input direction type for the sun", SunDirectionTypes::UnitVector, 2, SunDirectionTypesLabels);
        Settings.AddSetting(&SunDirType);

        SunDirection.Initialize(tweakBar, "SunDirection", "Sun Light", "Sun Direction", "Director of the sun", Float3(-0.7500f, 0.9770f, -0.4000f));
        Settings.AddSetting(&SunDirection);

        SunAzimuth.Initialize(tweakBar, "SunAzimuth", "Sun Light", "Sun Azimuth", "Angle around the horizon", 0.0000f, 0.0000f, 360.0000f, 0.0100f, ConversionMode::None, 1.0000f);
        Settings.AddSetting(&SunAzimuth);

        SunElevation.Initialize(tweakBar, "SunElevation", "Sun Light", "Sun Elevation", "Elevation of sun from ground. 0 degrees is aligned on the horizon while 90 degrees is directly overhead", 0.0000f, 0.0000f, 90.0000f, 0.0100f, ConversionMode::None, 1.0000f);
        Settings.AddSetting(&SunElevation);

        Turbidity.Initialize(tweakBar, "Turbidity", "Sky", "Turbidity", "Atmospheric turbidity (thickness) uses for procedural sun and sky model", 2.0000f, 1.0000f, 10.0000f, 0.0100f, ConversionMode::None, 1.0000f);
        Settings.AddSetting(&Turbidity);

        GroundAlbedo.Initialize(tweakBar, "GroundAlbedo", "Sky", "Ground Albedo", "Ground albedo color used for procedural sun and sky model", Float3(0.5000f, 0.5000f, 0.5000f), false, -340282300000000000000000000000000000000.0000f, 340282300000000000000000000000000000000.0000f, 0.0100f, ColorUnit::None);
        Settings.AddSetting(&GroundAlbedo);

        MSAAMode.Initialize(tweakBar, "MSAAMode", "Anti Aliasing", "MSAAMode", "MSAA mode to use for full-resolution rendering", MSAAModes::MSAANone, 2, MSAAModesLabels);
        Settings.AddSetting(&MSAAMode);

        FilterSize.Initialize(tweakBar, "FilterSize", "Anti Aliasing", "Filter Size", "Filter radius for MSAA resolve", 2.0000f, 0.0000f, 6.0000f, 0.0100f, ConversionMode::None, 1.0000f);
        Settings.AddSetting(&FilterSize);

        EnableAlbedoMaps.Initialize(tweakBar, "EnableAlbedoMaps", "Scene", "Enable Albedo Maps", "Enables albedo maps", true);
        Settings.AddSetting(&EnableAlbedoMaps);

        EnableNormalMaps.Initialize(tweakBar, "EnableNormalMaps", "Scene", "Enable Normal Maps", "Enables normal maps", true);
        Settings.AddSetting(&EnableNormalMaps);

        NormalMapIntensity.Initialize(tweakBar, "NormalMapIntensity", "Scene", "Normal Map Intensity", "Intensity of the normal map", 0.5000f, 0.0000f, 1.0000f, 0.0100f, ConversionMode::None, 1.0000f);
        Settings.AddSetting(&NormalMapIntensity);

        DiffuseIntensity.Initialize(tweakBar, "DiffuseIntensity", "Scene", "Diffuse Intensity", "Diffuse albedo intensity parameter for the material", 0.7500f, 0.0000f, 1.0000f, 0.0010f, ConversionMode::None, 1.0000f);
        Settings.AddSetting(&DiffuseIntensity);

        Roughness.Initialize(tweakBar, "Roughness", "Scene", "Specular Roughness", "Specular roughness parameter for the material", 0.2500f, 0.0010f, 1.0000f, 0.0010f, ConversionMode::None, 1.0000f);
        Settings.AddSetting(&Roughness);

        SpecularIntensity.Initialize(tweakBar, "SpecularIntensity", "Scene", "Specular Intensity", "Specular intensity parameter for the material", 0.0400f, 0.0000f, 1.0000f, 0.0010f, ConversionMode::None, 1.0000f);
        Settings.AddSetting(&SpecularIntensity);

        NumParticles.Initialize(tweakBar, "NumParticles", "Particles", "Num Particles (x1024)", "The number of particles to render, in increments of 1024", 8, 0, 32);
        Settings.AddSetting(&NumParticles);

        EmitRadius.Initialize(tweakBar, "EmitRadius", "Particles", "Emit Radius", "The radius in which to emit particles", 2.0000f, 0.0100f, 340282300000000000000000000000000000000.0000f, 0.0100f, ConversionMode::None, 1.0000f);
        Settings.AddSetting(&EmitRadius);

        EmitCenterX.Initialize(tweakBar, "EmitCenterX", "Particles", "Emit Center X", "The X coordinate of the point from which to emit particles", 0.0000f, -340282300000000000000000000000000000000.0000f, 340282300000000000000000000000000000000.0000f, 0.0100f, ConversionMode::None, 1.0000f);
        Settings.AddSetting(&EmitCenterX);

        EmitCenterY.Initialize(tweakBar, "EmitCenterY", "Particles", "Emit Center Y", "The Y coordinate of the point from which to emit particles", 2.5000f, -340282300000000000000000000000000000000.0000f, 340282300000000000000000000000000000000.0000f, 0.0100f, ConversionMode::None, 1.0000f);
        Settings.AddSetting(&EmitCenterY);

        EmitCenterZ.Initialize(tweakBar, "EmitCenterZ", "Particles", "Emit Center Z", "The Z coordinate of the point from which to emit particles", 0.0000f, -340282300000000000000000000000000000000.0000f, 340282300000000000000000000000000000000.0000f, 0.0100f, ConversionMode::None, 1.0000f);
        Settings.AddSetting(&EmitCenterZ);

        RotationSpeed.Initialize(tweakBar, "RotationSpeed", "Particles", "Rotation Speed", "Controls how fast to rotate the particles around the emitter center", 0.5000f, 0.0000f, 340282300000000000000000000000000000000.0000f, 0.0100f, ConversionMode::None, 1.0000f);
        Settings.AddSetting(&RotationSpeed);

        AbsorptionScale.Initialize(tweakBar, "AbsorptionScale", "Particles", "Absorption Scale", "Scaled the absorption coefficient used for particle self-shadowing", 1.0000f, 0.0000f, 340282300000000000000000000000000000000.0000f, 0.0100f, ConversionMode::None, 1.0000f);
        Settings.AddSetting(&AbsorptionScale);

        SortParticles.Initialize(tweakBar, "SortParticles", "Particles", "Sort Particles", "Enables sorting each particle by their depth", true);
        Settings.AddSetting(&SortParticles);

        EnableParticleAlbedoMap.Initialize(tweakBar, "EnableParticleAlbedoMap", "Particles", "Enable Particle Albedo Map", "Enables or disables sampling an albedo map in the particle pixel shader", true);
        Settings.AddSetting(&EnableParticleAlbedoMap);

        BillboardParticles.Initialize(tweakBar, "BillboardParticles", "Particles", "Billboard Particles", "Enables or disabled billboarding of particles towards the camera", true);
        Settings.AddSetting(&BillboardParticles);

        RenderLowRes.Initialize(tweakBar, "RenderLowRes", "Particles", "Render Low-Res", "Renders the particles at half resolution", true);
        Settings.AddSetting(&RenderLowRes);

        LowResRenderMode.Initialize(tweakBar, "LowResRenderMode", "Particles", "Low-Res Render Mode", "Specifies the technique to use for upscaling particles from half resolution", LowResRenderModes::MSAA, 2, LowResRenderModesLabels);
        Settings.AddSetting(&LowResRenderMode);

        ResolveSubPixelThreshold.Initialize(tweakBar, "ResolveSubPixelThreshold", "Particles", "Resolve Sub-Pixel Threshold", "Threshold used during low-resolution resolve for determining pixels containing sub-pixel edges", 0.0250f, 0.0000f, 1.0000f, 0.0010f, ConversionMode::None, 1.0000f);
        Settings.AddSetting(&ResolveSubPixelThreshold);

        CompositeSubPixelThreshold.Initialize(tweakBar, "CompositeSubPixelThreshold", "Particles", "Composite Sub-Pixel Threshold", "Threshold used during low-resolution composite for determining pixels containing sub-pixel edges", 0.1000f, 0.0000f, 1.0000f, 0.0010f, ConversionMode::None, 1.0000f);
        Settings.AddSetting(&CompositeSubPixelThreshold);

        ProgrammableSamplePoints.Initialize(tweakBar, "ProgrammableSamplePoints", "Particles", "Programmable Sample Points", "Use programmable sample positions when rendering low-resolution particles with 'MSAA' mode", true);
        Settings.AddSetting(&ProgrammableSamplePoints);
        ProgrammableSamplePoints.SetVisible(false);

        NearestDepthThreshold.Initialize(tweakBar, "NearestDepthThreshold", "Particles", "Nearest-Depth Threshold", "Depth threshold to use for nearest-depth upsampling", 0.2500f, 0.0000f, 100.0000f, 0.0100f, ConversionMode::None, 1.0000f);
        Settings.AddSetting(&NearestDepthThreshold);

        BloomExposure.Initialize(tweakBar, "BloomExposure", "Post Processing", "Bloom Exposure Offset", "Exposure offset applied to generate the input of the bloom pass", -4.0000f, -10.0000f, 0.0000f, 0.0100f, ConversionMode::None, 1.0000f);
        Settings.AddSetting(&BloomExposure);

        BloomMagnitude.Initialize(tweakBar, "BloomMagnitude", "Post Processing", "Bloom Magnitude", "Scale factor applied to the bloom results when combined with tone-mapped result", 1.0000f, 0.0000f, 2.0000f, 0.0100f, ConversionMode::None, 1.0000f);
        Settings.AddSetting(&BloomMagnitude);

        BloomBlurSigma.Initialize(tweakBar, "BloomBlurSigma", "Post Processing", "Bloom Blur Sigma", "Sigma parameter of the Gaussian filter used in the bloom pass", 2.5000f, 0.5000f, 2.5000f, 0.0100f, ConversionMode::None, 1.0000f);
        Settings.AddSetting(&BloomBlurSigma);

        EnableVSync.Initialize(tweakBar, "EnableVSync", "Debug", "Enable VSync", "Enables or disables vertical sync during Present", true);
        Settings.AddSetting(&EnableVSync);

        TakeScreenshot.Initialize(tweakBar, "TakeScreenshot", "Debug", "Take Screenshot", "Captures the screen output (before HUD rendering), and saves it to a file");
        Settings.AddSetting(&TakeScreenshot);

        ShowMSAAEdges.Initialize(tweakBar, "ShowMSAAEdges", "Debug", "Show MSAAEdges", "When using MSAA low-res render mode, shows pixels that use subpixel data", false);
        Settings.AddSetting(&ShowMSAAEdges);

        TwHelper::SetOpened(tweakBar, "Sun Light", false);

        TwHelper::SetOpened(tweakBar, "Sky", false);

        TwHelper::SetOpened(tweakBar, "Anti Aliasing", false);

        TwHelper::SetOpened(tweakBar, "Scene", false);

        TwHelper::SetOpened(tweakBar, "Particles", true);

        TwHelper::SetOpened(tweakBar, "Post Processing", false);

        TwHelper::SetOpened(tweakBar, "Debug", true);

        CBuffer.Initialize(device);
    }