public void Initialize(ScreenManager screenManager, DefaultRenderer renderer) { _renderer = renderer; _screenManager = screenManager; screenCanvas = new GUICanvas(Vector2.Zero, new Vector2(GameSettings.g_ScreenWidth, GameSettings.g_ScreenHeight), 0, GUIStyle.GUIAlignment.None); var baseList = new GuiListToggle(Vector2.Zero, new Vector2(200, 30), 0, GUIStyle.GUIAlignment.TopRight, screenCanvas.Dimensions); screenCanvas.AddElement(baseList); baseList.AddElement(new GUITextBlockButton(Vector2.Zero, new Vector2(200, 35), "return", GUIRenderer.MonospaceFont, Color.Gray, Color.White) { ButtonObject = this, ButtonMethod = this.GetType().GetMethod("MainMenu") }); GuiTextBlockLoadDialog textureLoader; baseList.AddElement(textureLoader = new GuiTextBlockLoadDialog(Vector2.Zero, new Vector2(200, 35), "image: ", _guiContentLoader, GuiTextBlockLoadDialog.ContentType.Texture2D, GUIRenderer.MonospaceFont, Color.Gray, Color.White) ); //baseList.AddElement(_sizeBlock = new GUITextBlock(Vector2.Zero, new Vector2(200, 25), "Intensity: ", GUIRenderer.MonospaceFont, Color.Gray, Color.White)); //baseList.AddElement(new GuiSliderFloat(Vector2.Zero, new Vector2(200, 35), 2, 20, Color.Gray, Color.White) //{ // SliderObject = renderer, // SliderField = typeof(DefaultRenderer).GetField("BokehSize"), // SliderValue = (float)typeof(DefaultRenderer).GetField("BokehSize").GetValue(renderer) //}); renderer._backgroundTextureLoader = textureLoader; baseList.ParentResized(screenCanvas.Dimensions); }
/// <summary> /// Creates the GUI for the default editor /// </summary> /// <param name="sceneLogicCamera"></param> private void CreateGUI(Camera sceneLogicCamera) { GuiCanvas = new GUICanvas(Vector2.Zero, new Vector2(GameSettings.g_screenwidth, GameSettings.g_screenheight)); defaultStyle = new GUIStyle( dimensionsStyle: new Vector2(200,35), textFontStyle: _assets.MonospaceFont, blockColorStyle: Color.Gray, textColorStyle: Color.White, sliderColorStyle: Color.White, guiAlignmentStyle: GUIStyle.GUIAlignment.None, textAlignmentStyle: GUIStyle.TextAlignment.Left, textButtonAlignmentStyle: GUIStyle.TextAlignment.Center, textBorderStyle: new Vector2(10, 1), parentDimensionsStyle: GuiCanvas.Dimensions); //Editor gizmo control! GuiCanvas.AddElement(_leftSideList = new GUIList(Vector2.Zero, defaultStyle)); _leftSideList.AddElement(_gizmoTranslation = new GUITextBlockButton(defaultStyle, "Translate (T)") { ButtonObject = this, ButtonMethod = GetType().GetMethod("ChangeGizmoMode"), ButtonMethodArgs = new object[]{ EditorLogic.GizmoModes.Translation }, }); _leftSideList.AddElement(_gizmoRotation = new GUITextBlockButton(defaultStyle, "Rotate (R)") { ButtonObject = this, ButtonMethod = GetType().GetMethod("ChangeGizmoMode"), ButtonMethodArgs = new object[] { EditorLogic.GizmoModes.Rotation }, }); _leftSideList.AddElement(_gizmoScale = new GUITextBlockButton(defaultStyle, "Scale (Z)") { ButtonObject = this, ButtonMethod = GetType().GetMethod("ChangeGizmoMode"), ButtonMethodArgs = new object[] { EditorLogic.GizmoModes.Scale }, }); _leftSideList.AddElement(new GUITextBlockToggle(defaultStyle, "Local: ") { ToggleField = typeof(GameStats).GetField("e_LocalTransformation"), Toggle = GameStats.e_LocalTransformation }); _leftSideList.Alignment = GUIStyle.GUIAlignment.BottomLeft; ChangeGizmoMode(EditorLogic.GizmoModes.Translation); //Editor options GuiCanvas.AddElement(_rightSideList = new GuiListToggleScroll(new Vector2(-20,0), defaultStyle)); GUITextBlock helperText = new GUITextBlock(new Vector2(0, 100), new Vector2(300, 200), CreateHelperText(), defaultStyle.TextFontStyle, new Color(Color.DimGray, 0.2f), Color.White, GUIStyle.TextAlignment.Left, new Vector2(10, 1)) {IsHidden = true}; GuiCanvas.AddElement(helperText); _rightSideList.AddElement(new GUITextBlockToggle(defaultStyle, "Enable Editor") { ToggleField = typeof(GameStats).GetField("e_EnableSelection"), Toggle = GameStats.e_EnableSelection }); _rightSideList.AddElement(new GUITextBlockToggle(defaultStyle, "Highlight Meshes") { ToggleField = typeof(GameSettings).GetField("e_drawoutlines"), Toggle = GameSettings.e_drawoutlines }); _rightSideList.AddElement(new GUITextBlockToggle(defaultStyle, "Show Controls") { ToggleProperty = typeof(GUITextBlock).GetProperty("IsVisible"), ToggleObject = helperText, Toggle = helperText.IsVisible }); _rightSideList.AddElement(new GUITextBlockToggle(defaultStyle, "Default Material") { ToggleField = typeof(GameSettings).GetField("d_defaultmaterial"), Toggle = GameSettings.d_defaultmaterial }); _rightSideList.AddElement(new GuiSliderFloatText(defaultStyle, 0.1f, 3/*(float) (Math.PI - 0.1)*/, 2, "Field Of View: ") { SliderObject = sceneLogicCamera, SliderProperty = typeof(Camera).GetProperty("FieldOfView"), SliderValue = sceneLogicCamera.FieldOfView }); //_rightSideList.AddElement(new GuiDropList(defaultStyle, "Show: ") //{ //}); _rightSideList.AddElement(new GUITextBlock(defaultStyle, "Selection") { BlockColor = Color.DimGray, Dimensions = new Vector2(200, 10), TextAlignment = GUIStyle.TextAlignment.Center }); GuiListToggle _selectionList = new GuiListToggle(Vector2.Zero, defaultStyle); _objectDescriptionList = new GUIList(Vector2.Zero, defaultStyle); _objectDescriptionList.AddElement(_objectDescriptionName = new GUITextBlock(defaultStyle, "objDescName")); _objectDescriptionList.AddElement(_objectDescriptionPos = new GUITextBlock(defaultStyle, "objDescName")); _objectDescriptionList.AddElement(_objectButton1 = new GUITextBlockButton(defaultStyle, "objButton1") {IsHidden = true}); _objectDescriptionList.AddElement(_objectToggle0 = new GUITextBlockToggle(defaultStyle, "objToggle0") { IsHidden = true }); _objectDescriptionList.AddElement(_objectToggle1 = new GUITextBlockToggle(defaultStyle, "objToggle1") { IsHidden = true }); _objectDescriptionList.AddElement(_objectToggle2 = new GUITextBlockToggle(defaultStyle, "objToggle2") { IsHidden = true }); _objectDescriptionList.AddElement(_objectToggle3 = new GUITextBlockToggle(defaultStyle, "objToggle3") { IsHidden = true }); _objectDescriptionList.AddElement(_objectSlider0 = new GuiSliderFloatText(defaultStyle, 0,1,2,"objToggle1") { IsHidden = true }); _objectDescriptionList.AddElement(_objectSlider1 = new GuiSliderFloatText(defaultStyle, 0, 1, 2, "objToggle2") { IsHidden = true }); _objectDescriptionList.AddElement(_objectSlider2 = new GuiSliderIntText(defaultStyle, 0, 10, 1, "objToggle3") { IsHidden = true }); _objectDescriptionList.AddElement(_objectColorPicker1 = new GUIColorPicker(defaultStyle) { IsHidden = true }); _selectionList.AddElement(_objectDescriptionList); _rightSideList.AddElement(_selectionList); ///////////////////////////////////////////////////////////////// //Options ///////////////////////////////////////////////////////////////// _rightSideList.AddElement(new GUITextBlock(defaultStyle, "Options") {BlockColor = Color.DimGray, Dimensions = new Vector2(200,10), TextAlignment = GUIStyle.TextAlignment.Center}); GuiListToggle optionList = new GuiListToggle(Vector2.Zero, defaultStyle); _rightSideList.AddElement(optionList); ///////////////////////////////////////////////////////////////// //SDF ///////////////////////////////////////////////////////////////// /// optionList.AddElement(new GUITextBlock(Vector2.Zero, new Vector2(200, 10), "SDF", defaultStyle.TextFontStyle, Color.DarkSlateGray, Color.White, GUIStyle.TextAlignment.Center, Vector2.Zero)); GuiListToggle sdfList = new GuiListToggle(Vector2.Zero, defaultStyle) { ToggleBlockColor = Color.DarkSlateGray, IsToggled = false }; optionList.AddElement(sdfList); sdfList.AddElement(new GUITextBlockToggle(defaultStyle, "Draw SDF") { ToggleField = typeof(GameSettings).GetField("sdf_drawdistance"), Toggle = GameSettings.sdf_drawdistance }); sdfList.AddElement(new GUITextBlockToggle(defaultStyle, "Draw SDF volume") { ToggleField = typeof(GameSettings).GetField("sdf_drawvolume"), Toggle = GameSettings.sdf_drawvolume }); ///////////////////////////////////////////////////////////////// //Post Processing ///////////////////////////////////////////////////////////////// optionList.AddElement(new GUITextBlock(defaultStyle, "PostProcessing") { BlockColor = Color.DarkSlateGray, Dimensions = new Vector2(200, 10), TextAlignment = GUIStyle.TextAlignment.Center }); GuiListToggle postprocessingList = new GuiListToggle(Vector2.Zero, defaultStyle) {ToggleBlockColor = Color.DarkSlateGray, IsToggled = false}; optionList.AddElement(postprocessingList); postprocessingList.AddElement(new GUITextBlockToggle(defaultStyle, "Temporal AA") { ToggleField = typeof(GameSettings).GetField("g_taa"), Toggle = GameSettings.g_taa }); postprocessingList.AddElement(new GUITextBlockToggle(defaultStyle, "Tonemap TAA") { ToggleField = typeof(GameSettings).GetField("g_taa_tonemapped"), Toggle = GameSettings.g_taa_tonemapped }); postprocessingList.AddElement(new GuiSliderFloatText(defaultStyle, 0, 4, 2, "WhitePoint: ") { SliderProperty = typeof(GameSettings).GetProperty("WhitePoint"), SliderValue = GameSettings.WhitePoint }); postprocessingList.AddElement(new GuiSliderFloatText(defaultStyle, -8, 8, 2, "Exposure: ") { SliderProperty = typeof(GameSettings).GetProperty("Exposure"), SliderValue = GameSettings.Exposure }); postprocessingList.AddElement(new GuiSliderFloatText(defaultStyle, -1, 1, 2, "S-Curve: ") { SliderProperty = typeof(GameSettings).GetProperty("SCurveStrength"), SliderValue = GameSettings.SCurveStrength }); postprocessingList.AddElement(new GuiSliderFloatText(defaultStyle, 0, 1, 2, "Chr. Abb.: ") { SliderProperty = typeof(GameSettings).GetProperty("ChromaticAbberationStrength"), SliderValue = GameSettings.ChromaticAbberationStrength }); postprocessingList.AddElement(new GUITextBlockToggle(defaultStyle, "Color Grading") { ToggleField = typeof(GameSettings).GetField("g_ColorGrading"), Toggle = GameSettings.g_ColorGrading }); ///////////////////////////////////////////////////////////////// //SSR ///////////////////////////////////////////////////////////////// optionList.AddElement(new GUITextBlock(Vector2.Zero, new Vector2(200, 10), "Screen Space Reflections", defaultStyle.TextFontStyle, Color.DarkSlateGray, Color.White, GUIStyle.TextAlignment.Center, Vector2.Zero)); GuiListToggle ssrList = new GuiListToggle(Vector2.Zero, defaultStyle) { ToggleBlockColor = Color.DarkSlateGray, IsToggled = false }; optionList.AddElement(ssrList); ssrList.AddElement(new GUITextBlockToggle(defaultStyle, "Enable SSR") { ToggleProperty = typeof(GameSettings).GetProperty("g_SSReflection"), Toggle = GameSettings.g_SSReflection }); ssrList.AddElement(new GUITextBlockToggle(defaultStyle, "Stochastic distr.") { ToggleProperty = typeof(GameSettings).GetProperty("g_SSReflectionTaa"), Toggle = GameSettings.g_SSReflectionTaa }); ssrList.AddElement(new GUITextBlockToggle(defaultStyle, "Temporal Noise") { ToggleField = typeof(GameSettings).GetField("g_SSReflectionNoise"), Toggle = GameSettings.g_SSReflectionNoise }); ssrList.AddElement(new GUITextBlockToggle(defaultStyle, "Firefly Reduction") { ToggleProperty = typeof(GameSettings).GetProperty("g_SSReflection_FireflyReduction"), Toggle = GameSettings.g_SSReflection_FireflyReduction }); ssrList.AddElement(new GuiSliderFloatText(defaultStyle, 0, 5, 2, "Firefly Threshold ") { SliderProperty = typeof(GameSettings).GetProperty("g_SSReflection_FireflyThreshold"), SliderValue = GameSettings.g_SSReflection_FireflyThreshold }); ssrList.AddElement(new GuiSliderIntText(defaultStyle, 1, 100, 1, "Samples: ") { SliderProperty = typeof(GameSettings).GetProperty("g_SSReflections_Samples"), SliderValue = GameSettings.g_SSReflections_Samples }); ssrList.AddElement(new GuiSliderIntText(defaultStyle, 1, 100, 1, "Search Samples: ") { SliderProperty = typeof(GameSettings).GetProperty("g_SSReflections_RefinementSamples"), SliderValue = GameSettings.g_SSReflections_RefinementSamples }); ///////////////////////////////////////////////////////////////// //SSAO ///////////////////////////////////////////////////////////////// /// optionList.AddElement(new GUITextBlock(Vector2.Zero, new Vector2(200, 10), "Ambient Occlusion", defaultStyle.TextFontStyle, Color.DarkSlateGray, Color.White, GUIStyle.TextAlignment.Center, Vector2.Zero)); GuiListToggle ssaoList = new GuiListToggle(Vector2.Zero, defaultStyle) { ToggleBlockColor = Color.DarkSlateGray, IsToggled = false }; optionList.AddElement(ssaoList); ssaoList.AddElement(new GUITextBlockToggle(defaultStyle, "Enable SSAO") { ToggleProperty = typeof(GameSettings).GetProperty("g_ssao_draw"), Toggle = GameSettings.g_ssao_draw }); ssaoList.AddElement(new GUITextBlockToggle(defaultStyle, "SSAO Blur: ") { ToggleField = typeof(GameSettings).GetField("g_ssao_blur"), Toggle = GameSettings.g_ssao_blur }); ssaoList.AddElement(new GuiSliderIntText(defaultStyle, 1, 32, 1, "SSAO Samples: ") { SliderProperty = typeof(GameSettings).GetProperty("g_ssao_samples"), SliderValue = GameSettings.g_ssao_samples }); ssaoList.AddElement(new GuiSliderFloatText(defaultStyle, 1, 100, 2, "Sample Radius: ") { SliderProperty = typeof(GameSettings).GetProperty("g_ssao_radius"), SliderValue = GameSettings.g_ssao_radius }); ssaoList.AddElement(new GuiSliderFloatText(defaultStyle, 0, 4, 1, "SSAO Strength: ") { SliderProperty = typeof(GameSettings).GetProperty("g_ssao_strength"), SliderValue = GameSettings.g_ssao_strength }); ///////////////////////////////////////////////////////////////// //Bloom ///////////////////////////////////////////////////////////////// /// optionList.AddElement(new GUITextBlock(Vector2.Zero, new Vector2(200, 10), "Bloom", defaultStyle.TextFontStyle, Color.DarkSlateGray, Color.White, GUIStyle.TextAlignment.Center, Vector2.Zero)); GuiListToggle bloomList = new GuiListToggle(Vector2.Zero, defaultStyle) { ToggleBlockColor = Color.DarkSlateGray, IsToggled = false }; optionList.AddElement(bloomList); bloomList.AddElement(new GUITextBlockToggle(defaultStyle, "Enable Bloom") { ToggleField = typeof(GameSettings).GetField("g_BloomEnable"), Toggle = GameSettings.g_BloomEnable }); bloomList.AddElement(new GuiSliderFloatText(defaultStyle, 0, 4, 1, "Threshold: ") { SliderField = typeof(GameSettings).GetField("g_BloomThreshold"), SliderValue = GameSettings.g_BloomThreshold }); bloomList.AddElement(new GuiSliderFloatText(defaultStyle, 0, 8, 1, "MIP0 Radius: ") { SliderField = typeof(GameSettings).GetField("g_BloomRadius1"), SliderValue = GameSettings.g_BloomRadius1 }); bloomList.AddElement(new GuiSliderFloatText(defaultStyle, 0, 8, 1, "MIP0 Strength: ") { SliderField = typeof(GameSettings).GetField("g_BloomStrength1"), SliderValue = GameSettings.g_BloomStrength1 }); bloomList.AddElement(new GuiSliderFloatText(defaultStyle, 0, 8, 1, "MIP1 Radius: ") { SliderField = typeof(GameSettings).GetField("g_BloomRadius2"), SliderValue = GameSettings.g_BloomRadius2 }); bloomList.AddElement(new GuiSliderFloatText(defaultStyle, 0, 8, 1, "MIP1 Strength: ") { SliderField = typeof(GameSettings).GetField("g_BloomStrength2"), SliderValue = GameSettings.g_BloomStrength2 }); bloomList.AddElement(new GuiSliderFloatText(defaultStyle, 0, 8, 1, "MIP2 Radius: ") { SliderField = typeof(GameSettings).GetField("g_BloomRadius3"), SliderValue = GameSettings.g_BloomRadius3 }); bloomList.AddElement(new GuiSliderFloatText(defaultStyle, 0, 8, 1, "MIP2 Strength: ") { SliderField = typeof(GameSettings).GetField("g_BloomStrength3"), SliderValue = GameSettings.g_BloomStrength3 }); bloomList.AddElement(new GuiSliderFloatText(defaultStyle, 0, 8, 1, "MIP3 Radius: ") { SliderField = typeof(GameSettings).GetField("g_BloomRadius4"), SliderValue = GameSettings.g_BloomRadius4 }); bloomList.AddElement(new GuiSliderFloatText(defaultStyle, 0, 8, 1, "MIP3 Strength: ") { SliderField = typeof(GameSettings).GetField("g_BloomStrength4"), SliderValue = GameSettings.g_BloomStrength4 }); bloomList.AddElement(new GuiSliderFloatText(defaultStyle, 0, 8, 1, "MIP4 Radius: ") { SliderField = typeof(GameSettings).GetField("g_BloomRadius5"), SliderValue = GameSettings.g_BloomRadius5 }); bloomList.AddElement(new GuiSliderFloatText(defaultStyle, 0, 8, 1, "MIP4 Strength: ") { SliderField = typeof(GameSettings).GetField("g_BloomStrength5"), SliderValue = GameSettings.g_BloomStrength5 }); _rightSideList.Alignment = GUIStyle.GUIAlignment.TopRight; }
public void Initialize(ScreenManager screenManager, ParticlePhysicsRenderer renderer) { _renderer = renderer; _screenManager = screenManager; screenCanvas = new GUICanvas(Vector2.Zero, new Vector2(GameSettings.g_ScreenWidth, GameSettings.g_ScreenHeight), 0, GUIStyle.GUIAlignment.None); GUIStyle style = new GUIStyle(new Vector2(200, 35), GUIRenderer.MonospaceFont, Color.Gray, Color.White, Color.White, GUIStyle.GUIAlignment.None, GUIStyle.TextAlignment.Left, GUIStyle.TextAlignment.Center, Vector2.Zero, screenCanvas.Dimensions); var baseList = new GuiListToggle(Vector2.Zero, new Vector2(200, 30), 0, GUIStyle.GUIAlignment.TopRight, screenCanvas.Dimensions); screenCanvas.AddElement(baseList); baseList.AddElement(new GUITextBlockButton(style, "return") { ButtonObject = this, ButtonMethod = this.GetType().GetMethod("MainMenu") }); GuiTextBlockLoadDialog textureLoader; baseList.AddElement(textureLoader = new GuiTextBlockLoadDialog(style, "image: ", _guiContentLoader, GuiTextBlockLoadDialog.ContentType.Texture2D) ); baseList.AddElement(new GuiSliderFloatText(style, 0, 1, 2, "K: ") { SliderObject = renderer, SliderField = renderer.GetType().GetField("SpringConstant"), SliderValue = (float)renderer.GetType().GetField("SpringConstant").GetValue(renderer) }); baseList.AddElement(new GuiSliderFloatText(style, 0, 1, 2, "Dampening: ") { SliderObject = renderer, SliderField = renderer.GetType().GetField("DampeningConstant"), SliderValue = (float)renderer.GetType().GetField("DampeningConstant").GetValue(renderer) }); baseList.AddElement(new GuiSliderIntText(style, 1, 10, 1, "Scale: ") { SliderObject = renderer, SliderField = renderer.GetType().GetField("TestInt"), SliderValue = (int)renderer.GetType().GetField("TestInt").GetValue(renderer) }); //baseList.AddElement(new GuiSliderFloatText(Vector2.Zero, new Vector2(200, 55), new Vector2(200, 20), 0, 1, "test", GUIRenderer.MonospaceFont, Color.Gray, Color.White) //{ // SliderObject = renderer, // SliderField = renderer.GetType().GetField("TestFloat"), // SliderValue = (float)renderer.GetType().GetField("TestFloat").GetValue(renderer) //}); //baseList.AddElement(_sizeBlock = new GUITextBlock(Vector2.Zero, new Vector2(200, 25), "Intensity: ", GUIRenderer.MonospaceFont, Color.Gray, Color.White)); //baseList.AddElement(new GuiSliderFloat(Vector2.Zero, new Vector2(200, 35), 2, 20, Color.Gray, Color.White) //{ // SliderObject = renderer, // SliderField = typeof(DefaultRenderer).GetField("BokehSize"), // SliderValue = (float)typeof(DefaultRenderer).GetField("BokehSize").GetValue(renderer) //}); renderer._backgroundTextureLoader = textureLoader; baseList.ParentResized(screenCanvas.Dimensions); }
public void Initialize(MainLogic mainLogic) { defaultStyle = new GUIStyle( dimensionsStyle: new Vector2(200, 25), textFontStyle: GUIRenderer.MonospaceFont, blockColorStyle: Color.Gray, textColorStyle: Color.White, sliderColorStyle: Color.Black, guiAlignmentStyle: GUIStyle.GUIAlignment.None, textAlignmentStyle: GUIStyle.TextAlignment.Left, textButtonAlignmentStyle: GUIStyle.TextAlignment.Center, textBorderStyle: new Vector2(10, 1), parentDimensionsStyle: new Vector2(GameSettings.g_ScreenWidth, GameSettings.g_ScreenHeight)); screenCanvas = new GUICanvas(Vector2.Zero, new Vector2(GameSettings.g_ScreenWidth, GameSettings.g_ScreenHeight)); GUIList animationList = new GUIList(Vector2.Zero, new Vector2(200, 70), 0, GUIStyle.GUIAlignment.BottomLeft, screenCanvas.Dimensions); animationList.AddElement(new GUITextBlockButton(defaultStyle, "play animation") { ButtonObject = this, ButtonMethod = GetType().GetMethod("PlayAnimation"), }); animationList.AddElement(new GUITextBlockToggle(defaultStyle, "Update Animation") { ToggleField = typeof(GameSettings).GetField("m_updateAnimation"), Toggle = (bool)typeof(GameSettings).GetField("m_updateAnimation").GetValue(null) }); screenCanvas.AddElement(animationList); // MAIN LIST ON THE RIGHT baseList = new GuiListToggleScroll(new Vector2(-20, 0), new Vector2(200, 30), 0, GUIStyle.GUIAlignment.TopRight, screenCanvas.Dimensions); screenCanvas.AddElement(baseList); baseList.AddElement(new GUITextBlockToggle(defaultStyle, "debug info") { ToggleField = typeof(GameSettings).GetField("ui_debug"), Toggle = (bool)typeof(GameSettings).GetField("ui_debug").GetValue(null) }); //Size of the model baseList.AddElement(_sizeBlock = new GUITextBlock(defaultStyle, "Size: " + GameSettings.m_size) { Dimensions = new Vector2(200, 25) }); baseList.AddElement(new GuiSliderFloat(defaultStyle, -2, 4) { SliderField = typeof(GameSettings).GetField("m_size"), SliderValue = (float)typeof(GameSettings).GetField("m_size").GetValue(null) }); //Basic default orientation buttons, these have slightly different sizes than "default" baseList.AddElement(new GUITextBlockButton(defaultStyle, "Center Model") { ButtonObject = mainLogic, ButtonMethod = mainLogic.GetType().GetMethod("CenterModel"), }); baseList.AddElement(new GUITextBlockToggle(defaultStyle, "Orientation: Y") { ToggleField = typeof(GameSettings).GetField("m_orientationy"), Toggle = (bool)typeof(GameSettings).GetField("m_orientationy").GetValue(null), }); baseList.AddElement(new GUITextBlockToggle(defaultStyle, "Linear Lighting") { ToggleField = typeof(GameSettings).GetField("r_UseLinear"), Toggle = (bool)typeof(GameSettings).GetField("r_UseLinear").GetValue(null), }); //Main model loader and other loaders GuiTextBlockLoadDialog modelLoader; baseList.AddElement(modelLoader = new GuiTextBlockLoadDialog(defaultStyle, "Model:", _guiContentLoader, GuiTextBlockLoadDialog.ContentType.Model) ); mainLogic.modelLoader = modelLoader; baseList.AddElement(new GUITextBlock(Vector2.Zero, new Vector2(200, 25), "Textures", GUIRenderer.MonospaceFont, Color.DimGray, Color.White, GUIStyle.TextAlignment.Center)); GuiListToggle textureList = new GuiListToggle(Vector2.Zero, new Vector2(200, 30), 0, GUIStyle.GUIAlignment.None, screenCanvas.Dimensions); { GuiTextBlockLoadDialog albedoLoader; textureList.AddElement( albedoLoader = new GuiTextBlockLoadDialog(defaultStyle, "Albedo:", _guiContentLoader, GuiTextBlockLoadDialog.ContentType.Texture2D)); mainLogic.albedoLoader = albedoLoader; GuiTextBlockLoadDialog normalLoader; textureList.AddElement( normalLoader = new GuiTextBlockLoadDialog(defaultStyle, "Normal:", _guiContentLoader, GuiTextBlockLoadDialog.ContentType.Texture2D)); mainLogic.normalLoader = normalLoader; GuiTextBlockLoadDialog roughnessLoader; textureList.AddElement( roughnessLoader = new GuiTextBlockLoadDialog(defaultStyle, "Roughness:", _guiContentLoader, GuiTextBlockLoadDialog.ContentType.Texture2D)); mainLogic.roughnessLoader = roughnessLoader; GuiTextBlockLoadDialog metallicLoader; textureList.AddElement( metallicLoader = new GuiTextBlockLoadDialog(defaultStyle, "Metallic:", _guiContentLoader, GuiTextBlockLoadDialog.ContentType.Texture2D)); mainLogic.metallicLoader = metallicLoader; GuiTextBlockLoadDialog bumpLoader; textureList.AddElement( bumpLoader = new GuiTextBlockLoadDialog(defaultStyle, "Heightmap:", _guiContentLoader, GuiTextBlockLoadDialog.ContentType.Texture2D)); mainLogic.bumpLoader = bumpLoader; } baseList.AddElement(textureList); textureList.IsToggled = false; baseList.AddElement(new GUITextBlock(Vector2.Zero, new Vector2(200, 25), "Default Values", GUIRenderer.MonospaceFont, Color.DimGray, Color.White, GUIStyle.TextAlignment.Center)); GuiListToggle colorList = new GuiListToggle(Vector2.Zero, new Vector2(200, 30), 0, GUIStyle.GUIAlignment.None, screenCanvas.Dimensions); { colorList.AddElement(new GUIColorPicker(defaultStyle) { ReferenceField = typeof(GameSettings).GetField("bgColor"), ReferenceObject = (Color)typeof(GameSettings).GetField("bgColor").GetValue(null) }); colorList.AddElement( _roughnessBlock = new GUITextBlock(Vector2.Zero, new Vector2(200, 25), "Roughness: " + GameSettings.m_roughness, GUIRenderer.MonospaceFont, Color.Gray, Color.White)); colorList.AddElement(new GuiSliderFloat(Vector2.Zero, new Vector2(200, 25), 0, 1, Color.Gray, Color.Black) { SliderField = typeof(GameSettings).GetField("m_roughness"), SliderValue = (float)typeof(GameSettings).GetField("m_roughness").GetValue(null) }); colorList.AddElement( _metallicBlock = new GUITextBlock(Vector2.Zero, new Vector2(200, 25), "Metallic: " + GameSettings.m_metallic, GUIRenderer.MonospaceFont, Color.Gray, Color.White)); colorList.AddElement(new GuiSliderFloat(Vector2.Zero, new Vector2(200, 25), 0, 1, Color.Gray, Color.Black) { SliderField = typeof(GameSettings).GetField("m_metallic"), SliderValue = (float)typeof(GameSettings).GetField("m_metallic").GetValue(null) }); } colorList.IsToggled = false; baseList.AddElement(colorList); baseList.AddElement(new GUITextBlock(Vector2.Zero, new Vector2(200, 25), "Bump Mapping", GUIRenderer.MonospaceFont, Color.DimGray, Color.White, GUIStyle.TextAlignment.Center)); GuiListToggle parallaxList = new GuiListToggle(Vector2.Zero, new Vector2(200, 30), 0, GUIStyle.GUIAlignment.None, screenCanvas.Dimensions); { parallaxList.AddElement(new GUITextBlockToggle(Vector2.Zero, new Vector2(200, 40), "Parallax OcclusionMapping", GUIRenderer.MonospaceFont, Color.Gray, Color.White) { ToggleField = typeof(GameSettings).GetField("r_UsePOM"), Toggle = (bool)typeof(GameSettings).GetField("r_UsePOM").GetValue(null) }); parallaxList.AddElement(new GUITextBlockToggle(Vector2.Zero, new Vector2(200, 25), "POM Cutoff", GUIRenderer.MonospaceFont, Color.Gray, Color.White) { ToggleField = typeof(GameSettings).GetField("r_POMCutoff"), Toggle = (bool)typeof(GameSettings).GetField("r_POMCutoff").GetValue(null) }); parallaxList.AddElement( _pomBlock = new GUITextBlock(Vector2.Zero, new Vector2(200, 25), "Bump Scale: " + GameSettings.pomScale, GUIRenderer.MonospaceFont, Color.Gray, Color.White)); parallaxList.AddElement(new GuiSliderFloat(Vector2.Zero, new Vector2(200, 25), -0.7f, 0.7f, Color.Gray, Color.Black) { SliderField = typeof(GameSettings).GetField("pomScale"), SliderValue = (float)typeof(GameSettings).GetField("pomScale").GetValue(null) }); parallaxList.AddElement( _pomQualityBlock = new GUITextBlock(Vector2.Zero, new Vector2(200, 25), "POM Quality: " + GameSettings.r_POMQuality, GUIRenderer.MonospaceFont, Color.Gray, Color.White)); parallaxList.AddElement(new GuiSliderFloat(Vector2.Zero, new Vector2(200, 25), 0.5f, 3, Color.Gray, Color.Black) { SliderField = typeof(GameSettings).GetField("r_POMQuality"), SliderValue = (float)typeof(GameSettings).GetField("r_POMQuality").GetValue(null) }); } parallaxList.IsToggled = false; baseList.AddElement(parallaxList); //AO baseList.AddElement(new GUITextBlock(Vector2.Zero, new Vector2(200, 25), "Ambient Occlusion", GUIRenderer.MonospaceFont, Color.DimGray, Color.White, GUIStyle.TextAlignment.Center)); GuiListToggle aoList = new GuiListToggle(Vector2.Zero, new Vector2(200, 30), 0, GUIStyle.GUIAlignment.None, screenCanvas.Dimensions); { aoList.AddElement(new GUITextBlockToggle(Vector2.Zero, new Vector2(200, 25), "Enable AO", GUIRenderer.MonospaceFont, Color.Gray, Color.White) { ToggleField = typeof(GameSettings).GetField("ao_Enable"), Toggle = (bool)typeof(GameSettings).GetField("ao_Enable").GetValue(null) }); aoList.AddElement( _aoRadiiBlock = new GUITextBlock(Vector2.Zero, new Vector2(200, 25), "AO Radius: " + GameSettings.ao_Radii, GUIRenderer.MonospaceFont, Color.Gray, Color.White)); aoList.AddElement(new GuiSliderFloat(Vector2.Zero, new Vector2(200, 25), 0, 8, Color.Gray, Color.Black) { SliderField = typeof(GameSettings).GetField("ao_Radii"), SliderValue = (float)typeof(GameSettings).GetField("ao_Radii").GetValue(null) }); aoList.AddElement( _aoSamplesBlock = new GUITextBlock(Vector2.Zero, new Vector2(200, 25), "AO Samples ppx: " + GameSettings.ao_Samples, GUIRenderer.MonospaceFont, Color.Gray, Color.White)); aoList.AddElement(new GuiSliderInt(Vector2.Zero, new Vector2(200, 25), 0, 64, 2, Color.Gray, Color.Black) { SliderField = typeof(GameSettings).GetField("ao_Samples"), SliderValue = (int)typeof(GameSettings).GetField("ao_Samples").GetValue(null) }); aoList.AddElement( _aoStrengthBlock = new GUITextBlock(Vector2.Zero, new Vector2(200, 25), "AO Strength: " + GameSettings.ao_Strength, GUIRenderer.MonospaceFont, Color.Gray, Color.White)); aoList.AddElement(new GuiSliderFloat(Vector2.Zero, new Vector2(200, 25), 0, 4, Color.Gray, Color.Black) { SliderField = typeof(GameSettings).GetField("ao_Strength"), SliderValue = (float)typeof(GameSettings).GetField("ao_Strength").GetValue(null) }); aoList.AddElement(new GUITextBlockToggle(Vector2.Zero, new Vector2(200, 25), "Blur AO", GUIRenderer.MonospaceFont, Color.Gray, Color.White) { ToggleField = typeof(GameSettings).GetField("ao_UseBlur"), Toggle = (bool)typeof(GameSettings).GetField("ao_UseBlur").GetValue(null) }); aoList.AddElement(new GUITextBlockToggle(Vector2.Zero, new Vector2(200, 25), "Half resolution", GUIRenderer.MonospaceFont, Color.Gray, Color.White) { ToggleField = typeof(GameSettings).GetField("ao_HalfRes"), Toggle = (bool)typeof(GameSettings).GetField("ao_HalfRes").GetValue(null) }); } aoList.IsToggled = false; baseList.AddElement(aoList); UpdateResolution(); }