} // AddControls /// <summary> /// Creates the configuration controls of this asset. /// </summary> public static void AddControls(Plane asset, Window owner, bool assetCreation) { GroupBox groupGeneral = CommonControls.Group("General", owner); var widthTextBox = CommonControls.TextBox("Width", groupGeneral, asset.Width.ToString(), asset, "Width"); var heightTextBox = CommonControls.TextBox("Height", groupGeneral, asset.Height.ToString(), asset, "Height"); groupGeneral.AdjustHeightFromChildren(); } // AddControls
/// <summary> /// Creates the configuration controls of this asset. /// </summary> public static void AddControls(AmbientLight asset, Window owner, ComboBox comboBoxResource) { GroupBox groupGeneral = CommonControls.Group("General", owner); var intensity = CommonControls.SliderNumericFloat("Intensity", groupGeneral, asset.Intensity, true, true, 0, 10, asset, "Intensity"); var color = CommonControls.SliderColor("Color", groupGeneral, asset.Color, asset, "Color"); var ambientOcclusion = CommonControls.AssetSelector<AmbientOcclusion>("Ambient Occlusion", owner, asset, "AmbientOcclusion"); groupGeneral.AdjustHeightFromChildren(); } // AddControls
} // AddControls /// <summary> /// Creates the configuration controls of this asset. /// </summary> public static void AddControls(Cone asset, Window owner, bool assetCreation) { GroupBox groupGeneral = CommonControls.Group("General", owner); var radiusTextBox = CommonControls.TextBox("Radius", groupGeneral, asset.Radius.ToString(), asset, "Radius"); var lengthTextBox = CommonControls.TextBox("Length", groupGeneral, asset.Length.ToString(), asset, "Length"); var slicesTextBox = CommonControls.TextBox("Slices", groupGeneral, asset.Slices.ToString(), asset, "Slices"); groupGeneral.AdjustHeightFromChildren(); } // AddControls
/// <summary> /// Creates the configuration controls of this asset. /// </summary> public static void AddControls(Shadow asset, Window owner, ComboBox comboBoxResource) { GroupBox groupGeneral = CommonControls.Group("General", owner); // Enabled CheckBox enabled = CommonControls.CheckBox("Enabled", groupGeneral, asset.Enabled, asset, "Enabled"); // Depth Bias var depthBias = CommonControls.SliderNumericFloat("Depth Bias", groupGeneral, asset.DepthBias, false, false, 0, 0.1f, asset, "DepthBias"); // Enabled enabled.CheckedChanged += delegate { depthBias.Enabled = asset.Enabled; }; groupGeneral.AdjustHeightFromChildren(); } // AddControls
/// <summary> /// Creates the configuration controls of this asset. /// </summary> public static void AddControls(Constant asset, Window owner) { #region Diffuse GroupBox groupDiffuse = CommonControls.Group("Diffuse", owner); // Diffuse Color var sliderDiffuseColor = CommonControls.SliderColor("Diffuse Color", groupDiffuse, asset.DiffuseColor, asset, "DiffuseColor"); // Diffuse Texture var assetSelectorDiffuseTexture = CommonControls.AssetSelector<Texture>("Diffuse Texture", groupDiffuse, asset, "DiffuseTexture"); groupDiffuse.AdjustHeightFromChildren(); #endregion } // AddControls
/// <summary> /// Creates the configuration controls of this asset. /// </summary> public static void AddControls(LookupTable asset, Window owner, ComboBox comboBoxResource) { // In asset creation I need to look on the CurrentCreatedAsset property to have the last asset. // I can't use CurrentCreatedAsset in edit mode. // However I can use asset for creation (maybe in a disposed state but don't worry) and edit mode, // and only update the values when I know that CurrentCreatedAsset changes. #region Group Image var groupImage = CommonControls.Group("Image", owner); AssetContentManager userContentManager = AssetContentManager.CurrentContentManager; AssetContentManager.CurrentContentManager = UserInterfaceManager.UserInterfaceContentManager; var imageBoxImage = CommonControls.ImageBox(LookupTable.LookupTableToTexture(asset), groupImage); AssetContentManager.CurrentContentManager = userContentManager; groupImage.AdjustHeightFromChildren(); #endregion #region Group Properties GroupBox groupProperties = CommonControls.Group("Properties", owner); var sizeTextBox = CommonControls.TextBox("Size", groupProperties, asset.Size.ToString()); sizeTextBox.Enabled = false; groupProperties.AdjustHeightFromChildren(); #endregion // If it is asset creation time. if (comboBoxResource != null) { comboBoxResource.ItemIndexChanged += delegate { imageBoxImage.Texture.Dispose(); userContentManager = AssetContentManager.CurrentContentManager; AssetContentManager.CurrentContentManager = UserInterfaceManager.UserInterfaceContentManager; imageBoxImage.Texture = LookupTable.LookupTableToTexture((LookupTable)AssetWindow.CurrentCreatedAsset); AssetContentManager.CurrentContentManager = userContentManager; sizeTextBox.Text = ((LookupTable)AssetWindow.CurrentCreatedAsset).Size.ToString(); }; // If the user creates the asset (press the create button) then update the changeable properties. owner.Closed += delegate { imageBoxImage.Texture.Dispose(); }; } } // AddControls
/// <summary> /// Creates the configuration controls of this asset. /// </summary> public static void AddControls(HorizonBasedAmbientOcclusion asset, Window owner, ComboBox comboBoxResource) { GroupBox groupGeneral = CommonControls.Group("General", owner); #region Quality var quality = CommonControls.ComboBox("Quality", groupGeneral); // Add textures name quality.Items.Add("Low"); quality.Items.Add("Middle"); quality.Items.Add("High"); // Events quality.ItemIndexChanged += delegate { switch (quality.ItemIndex) { case 0: asset.Quality = HorizonBasedAmbientOcclusion.QualityType.LowQuality; break; case 1: asset.Quality = HorizonBasedAmbientOcclusion.QualityType.MiddleQuality; break; case 2: asset.Quality = HorizonBasedAmbientOcclusion.QualityType.HighQuality; break; } }; quality.Draw += delegate { if (quality.ListBoxVisible) return; switch (asset.Quality) { case HorizonBasedAmbientOcclusion.QualityType.LowQuality : quality.ItemIndex = 0; break; case HorizonBasedAmbientOcclusion.QualityType.MiddleQuality : quality.ItemIndex = 1; break; case HorizonBasedAmbientOcclusion.QualityType.HighQuality : quality.ItemIndex = 2; break; } }; #endregion var numberSteps = CommonControls.SliderNumericInt("Number Steps", groupGeneral, asset.NumberSteps, false, true, 0, 36, asset, "NumberSteps"); var numberDirections = CommonControls.SliderNumericInt("Number Directions", groupGeneral, asset.NumberDirections, false, true, 0, 36, asset, "NumberDirections"); var contrast = CommonControls.SliderNumericFloat("Contrast", groupGeneral, asset.Contrast, true, true, 0, 2, asset, "Contrast"); var lineAttenuation = CommonControls.SliderNumericFloat("LineAttenuation", groupGeneral, asset.LineAttenuation, false, false, 0, 2, asset, "LineAttenuation"); var radius = CommonControls.SliderNumericFloat("Radius", groupGeneral, asset.Radius, false, false, 0, 0.5f, asset, "Radius"); var angleBias = CommonControls.SliderNumericFloat("AngleBias", groupGeneral, asset.AngleBias, false, false, 0, 90, asset, "AngleBias"); groupGeneral.AdjustHeightFromChildren(); } // AddControls
/// <summary> /// Creates the configuration controls of this asset. /// </summary> public static void AddControls(CarPaint asset, Window owner) { #region Diffuse GroupBox groupDiffuse = CommonControls.Group("Diffuse", owner); // Base Paint Color var sliderBasePaintColor = CommonControls.SliderColor("Base Paint Color", groupDiffuse, asset.BasePaintColor, asset, "BasePaintColor"); // Second Base Paint Color var sliderSecondBasePaintColor = CommonControls.SliderColor("Second Base Paint Color", groupDiffuse, asset.SecondBasePaintColor, asset, "SecondBasePaintColor"); // Flake Layer Color 1 var sliderFlakeLayerColor1 = CommonControls.SliderColor("Third Base Paint Color", groupDiffuse, asset.ThirdBasePaintColor, asset, "ThirdBasePaintColor"); groupDiffuse.AdjustHeightFromChildren(); #endregion #region Specular GroupBox groupSpecular = CommonControls.Group("Specular", owner); CheckBox checkBoxSpecularPowerFromTexture = null; // Specular Intensity var sliderSpecularIntensity = CommonControls.SliderNumericFloat("Specular Intensity", groupSpecular, asset.SpecularIntensity, false, true, 0, 2, asset, "SpecularIntensity"); // Specular Power var sliderSpecularPower = CommonControls.SliderNumericFloat("Specular Power", groupSpecular, asset.SpecularPower, true, true, 0, 100, asset, "SpecularPower"); sliderSpecularPower.Draw += delegate { sliderSpecularPower.Enabled = !checkBoxSpecularPowerFromTexture.Enabled || (checkBoxSpecularPowerFromTexture.Enabled && !checkBoxSpecularPowerFromTexture.Checked); }; // Specular Texture var assetSelectorSpecularTexture = CommonControls.AssetSelector<Texture>("Specular Texture", groupSpecular, asset, "SpecularTexture"); assetSelectorSpecularTexture.ItemIndexChanged += delegate { checkBoxSpecularPowerFromTexture.Enabled = asset.SpecularTexture != null; }; // Specular Texture Power Enabled checkBoxSpecularPowerFromTexture = CommonControls.CheckBox("Use specular power from Texture", groupSpecular, asset.SpecularPowerFromTexture, asset, "SpecularPowerFromTexture", "Indicates if the specular power will be read from the texture (the alpha channel of the specular texture) or from the specular power property."); // Reflection Texture var assetSelectorReflectionTexture = CommonControls.AssetSelector<TextureCube>("Reflection Texture", groupSpecular, asset, "ReflectionTexture"); groupSpecular.AdjustHeightFromChildren(); #endregion #region Normals GroupBox groupNormals = CommonControls.Group("Normals", owner); // Normal Texture var assetSelectorNormalTexture = CommonControls.AssetSelector<Texture>("Normal Texture", groupNormals, asset, "NormalTexture"); groupNormals.AdjustHeightFromChildren(); #endregion #region Flakes var groupFlakes = CommonControls.Group("Flakes", owner); // Flakes Color var sliderFlakesColor = CommonControls.SliderColor("Flake Color", groupFlakes, asset.FlakesColor, asset, "FlakesColor"); // Flakes Scale var sliderFlakesScale = CommonControls.SliderNumericFloat("Flakes Scale", groupFlakes, asset.FlakesScale, true, true, 0, 500, asset, "FlakesScale"); // Flakes Exponent var sliderFlakesExponent = CommonControls.SliderNumericFloat("Flakes Exponent", groupFlakes, asset.FlakesExponent, true, true, 0, 500, asset, "FlakesExponent"); // Flake Perturbation var sliderFlakePerturbation = CommonControls.SliderNumericFloat("Flake Perturbation", groupFlakes, asset.MicroflakePerturbation, false, false, -1, 1, asset, "MicroflakePerturbation"); // Flake Perturbation A var sliderFlakePerturbationA = CommonControls.SliderNumericFloat("Flake Perturbation A", groupFlakes, asset.MicroflakePerturbationA, false, false, 0, 1, asset, "MicroflakePerturbationA"); // Normal Perturbation var sliderNormalPerturbation = CommonControls.SliderNumericFloat("Normal Perturbation", groupFlakes, asset.NormalPerturbation, false, false, -1, 1, asset, "NormalPerturbation"); groupFlakes.AdjustHeightFromChildren(); #endregion } // AddControls
/// <summary> /// Creates the configuration controls of this asset. /// </summary> public static void AddControls(Texture asset, Window owner, ComboBox comboBoxResource) { // In asset creation I need to look on the CurrentCreatedAsset property to have the last asset. // I can't use CurrentCreatedAsset in edit mode. // However I can use asset for creation (maybe in a disposed state but don't worry) and edit mode, // and only update the values when I know that CurrentCreatedAsset changes. #region Group Image var groupImage = CommonControls.Group("Image", owner); var imageBoxImage = CommonControls.ImageBox(asset, groupImage); groupImage.AdjustHeightFromChildren(); #endregion #region Group Properties GroupBox groupProperties = CommonControls.Group("Properties", owner); var widthTextBox = CommonControls.TextBox("Width", groupProperties, asset.Width.ToString()); widthTextBox.Enabled = false; var heightTextBox = CommonControls.TextBox("Height", groupProperties, asset.Height.ToString()); heightTextBox.Enabled = false; #region Prefered Sampler State var comboBoxPreferredSamplerState = CommonControls.ComboBox("Prefered Sampler State", groupProperties); comboBoxPreferredSamplerState.Items.Add("AnisotropicClamp"); comboBoxPreferredSamplerState.Items.Add("AnisotropicWrap"); comboBoxPreferredSamplerState.Items.Add("LinearClamp"); comboBoxPreferredSamplerState.Items.Add("LinearWrap"); comboBoxPreferredSamplerState.Items.Add("PointClamp"); comboBoxPreferredSamplerState.Items.Add("PointWrap"); comboBoxPreferredSamplerState.ItemIndexChanged += delegate { asset.PreferredSamplerState = GetSamplerState(comboBoxPreferredSamplerState.ItemIndex); }; comboBoxPreferredSamplerState.Draw += delegate { if (comboBoxPreferredSamplerState.ListBoxVisible) return; // Identify current index if (asset.PreferredSamplerState == SamplerState.AnisotropicClamp) comboBoxPreferredSamplerState.ItemIndex = 0; else if (asset.PreferredSamplerState == SamplerState.AnisotropicWrap) comboBoxPreferredSamplerState.ItemIndex = 1; else if (asset.PreferredSamplerState == SamplerState.LinearClamp) comboBoxPreferredSamplerState.ItemIndex = 2; else if (asset.PreferredSamplerState == SamplerState.LinearWrap) comboBoxPreferredSamplerState.ItemIndex = 3; else if (asset.PreferredSamplerState == SamplerState.PointClamp) comboBoxPreferredSamplerState.ItemIndex = 4; else if (asset.PreferredSamplerState == SamplerState.PointWrap) comboBoxPreferredSamplerState.ItemIndex = 5; else { if (customSamplerState == null) { comboBoxPreferredSamplerState.Items.Add("Custom"); customSamplerState = asset.PreferredSamplerState; } comboBoxPreferredSamplerState.ItemIndex = 6; } }; #endregion groupProperties.AdjustHeightFromChildren(); #endregion // If it is asset creation time. if (comboBoxResource != null) { comboBoxResource.ItemIndexChanged += delegate { // Update properties if the resource changes. imageBoxImage.Texture = ((Texture)AssetWindow.CurrentCreatedAsset); widthTextBox.Text = ((Texture)AssetWindow.CurrentCreatedAsset).Width.ToString(); heightTextBox.Text = ((Texture)AssetWindow.CurrentCreatedAsset).Height.ToString(); }; // If the user creates the asset (pressed the create button) then update the changeable properties. owner.Closed += delegate { if (owner.ModalResult != ModalResult.Cancel) ((Texture)AssetWindow.CurrentCreatedAsset).PreferredSamplerState = GetSamplerState(comboBoxPreferredSamplerState.ItemIndex); }; } } // AddControls
/// <summary> /// Creates the configuration controls of this asset. /// </summary> public static void AddControls(BlinnPhong asset, Window owner) { #region Diffuse GroupBox groupDiffuse = CommonControls.Group("Diffuse", owner); // Diffuse Color var sliderDiffuseColor = CommonControls.SliderColor("Diffuse Color", groupDiffuse, asset.DiffuseColor, asset, "DiffuseColor"); // Diffuse Texture var assetSelectorDiffuseTexture = CommonControls.AssetSelector<Texture>("Diffuse Texture", groupDiffuse, asset, "DiffuseTexture"); groupDiffuse.AdjustHeightFromChildren(); #endregion #region Specular GroupBox groupSpecular = CommonControls.Group("Specular", owner); CheckBox checkBoxSpecularPowerFromTexture = null; // Specular Intensity var sliderSpecularIntensity = CommonControls.SliderNumericFloat("Specular Intensity", groupSpecular, asset.SpecularIntensity, false, true, 0, 2, asset, "SpecularIntensity"); // Specular Power var sliderSpecularPower = CommonControls.SliderNumericFloat("Specular Power", groupSpecular, asset.SpecularPower, true, true, 0, 100, asset, "SpecularPower"); sliderSpecularPower.Draw += delegate { sliderSpecularPower.Enabled = !checkBoxSpecularPowerFromTexture.Enabled || (checkBoxSpecularPowerFromTexture.Enabled && !checkBoxSpecularPowerFromTexture.Checked); }; // Specular Texture var assetSelectorSpecularTexture = CommonControls.AssetSelector<Texture>("Specular Texture", groupSpecular, asset, "SpecularTexture"); assetSelectorSpecularTexture.ItemIndexChanged += delegate { checkBoxSpecularPowerFromTexture.Enabled = asset.SpecularTexture != null; }; // Specular Texture Power Enabled checkBoxSpecularPowerFromTexture = CommonControls.CheckBox("Use specular power from Texture", groupSpecular, asset.SpecularPowerFromTexture, asset, "SpecularPowerFromTexture", "Indicates if the specular power will be read from the texture (the alpha channel of the specular texture) or from the specular power property."); // Reflection Texture var assetSelectorReflectionTexture = CommonControls.AssetSelector<TextureCube>("Reflection Texture", groupSpecular, asset, "ReflectionTexture"); groupSpecular.AdjustHeightFromChildren(); #endregion #region Normals GroupBox groupNormals = CommonControls.Group("Normals", owner); // Normal Texture var assetSelectorNormalTexture = CommonControls.AssetSelector<Texture>("Normal Texture", groupNormals, asset, "NormalTexture"); // Parallax Enabled CheckBox checkBoxParallaxEnabled = CommonControls.CheckBox("Enabled", groupNormals, asset.ParallaxEnabled, asset, "ParallaxEnabled"); // Parallax Threshold var sliderParallaxLodThreshold = CommonControls.SliderNumericInt("Parallax LOD Threshold", groupNormals, asset.ParallaxLodThreshold, false, false, 0, 10, asset, "ParallaxLodThreshold"); // Parallax Minimum Number Samples var sliderParallaxMinimumNumberSamples = CommonControls.SliderNumericInt("Parallax Minimum Number Samples", groupNormals, asset.ParallaxMinimumNumberSamples, false, false, 0, 50, asset, "ParallaxMinimumNumberSamples"); // Parallax Maximum Number Samples var sliderParallaxMaximumNumberSamples = CommonControls.SliderNumericInt("Parallax Maximum Number Samples", groupNormals, asset.ParallaxMaximumNumberSamples, false, false, 0, 500, asset, "ParallaxMaximumNumberSamples"); // Parallax Maximum Number Samples var sliderParallaxHeightMapScale = CommonControls.SliderNumericFloat("Parallax Height Map Scale", groupNormals, asset.ParallaxHeightMapScale, false, false, 0, 1, asset, "ParallaxHeightMapScale"); checkBoxParallaxEnabled.CheckedChanged += delegate { asset.ParallaxEnabled = checkBoxParallaxEnabled.Checked; sliderParallaxLodThreshold.Enabled = asset.ParallaxEnabled; sliderParallaxMinimumNumberSamples.Enabled = asset.ParallaxEnabled; sliderParallaxMaximumNumberSamples.Enabled = asset.ParallaxEnabled; sliderParallaxHeightMapScale.Enabled = asset.ParallaxEnabled; }; assetSelectorNormalTexture.Draw += delegate { if (asset.NormalTexture == null) checkBoxParallaxEnabled.Enabled = false; }; groupNormals.AdjustHeightFromChildren(); #endregion } // AddControls
/// <summary> /// Creates the configuration controls of this asset. /// </summary> public static void AddControls(PostProcess asset, Window owner, ComboBox comboBoxResource) { #region Group Lens Exposure GroupBox groupToneMapping = CommonControls.Group("Tone Mapping", owner); // Lens Exposure var sliderLensExposure = CommonControls.SliderNumericFloat("Lens Exposure", groupToneMapping, asset.ToneMapping.LensExposure, true, true, -10, 10, asset.ToneMapping, "LensExposure"); // Auto Exposure Enabled CheckBox checkBoxAutoExposureEnabled = CommonControls.CheckBox("Auto Exposure Enabled", groupToneMapping, asset.ToneMapping.AutoExposureEnabled, asset.ToneMapping, "AutoExposureEnabled"); // Auto Exposure Adaptation Time Multiplier var sliderAutoExposureAdaptationTimeMultiplier = CommonControls.SliderNumericFloat("Adaptation Time Multiplier", groupToneMapping, asset.ToneMapping.AutoExposureAdaptationTimeMultiplier, false, true, 0, 10, asset.ToneMapping, "AutoExposureAdaptationTimeMultiplier"); // Auto Exposure Luminance Low Threshold var sliderAutoExposureLuminanceLowThreshold = CommonControls.SliderNumericFloat("Luminance Low Threshold", groupToneMapping, asset.ToneMapping.AutoExposureLuminanceLowThreshold, false, true, 0, 0.5f, asset.ToneMapping, "AutoExposureLuminanceLowThreshold"); // Auto Exposure Luminance High Threshold var sliderAutoExposureLuminanceHighThreshold = CommonControls.SliderNumericFloat("Luminance High Threshold", groupToneMapping, asset.ToneMapping.AutoExposureLuminanceHighThreshold, false, true, 0.5f, 20f, asset.ToneMapping, "AutoExposureLuminanceHighThreshold"); // Auto Exposure Enabled checkBoxAutoExposureEnabled.CheckedChanged += delegate { sliderLensExposure.Enabled = !asset.ToneMapping.AutoExposureEnabled; sliderAutoExposureAdaptationTimeMultiplier.Enabled = asset.ToneMapping.AutoExposureEnabled; sliderAutoExposureLuminanceLowThreshold.Enabled = asset.ToneMapping.AutoExposureEnabled; sliderAutoExposureLuminanceHighThreshold.Enabled = asset.ToneMapping.AutoExposureEnabled; }; #region Tone Mapping Curve ComboBox comboBoxToneMappingCurve = CommonControls.ComboBox("Tone Mapping Curve", groupToneMapping); comboBoxToneMappingCurve.Items.AddRange(new[] { "Filmic ALU", "Filmic Uncharted 2", "Duiker", "Reinhard", "Reinhard Modified", "Exponential", "Logarithmic", "Drago Logarithmic" }); comboBoxToneMappingCurve.ItemIndex = (int)asset.ToneMapping.ToneMappingFunction; comboBoxToneMappingCurve.ItemIndexChanged += delegate { asset.ToneMapping.ToneMappingFunction = (ToneMapping.ToneMappingFunctionEnumerate)comboBoxToneMappingCurve.ItemIndex; }; comboBoxToneMappingCurve.Draw += delegate { if (comboBoxToneMappingCurve.ListBoxVisible) return; comboBoxToneMappingCurve.ItemIndex = (int)asset.ToneMapping.ToneMappingFunction; }; #endregion // White Level var sliderWhiteLevel = CommonControls.SliderNumericFloat("White Level", groupToneMapping, asset.ToneMapping.ToneMappingWhiteLevel, false, true, 0f, 50f, asset.ToneMapping, "ToneMappingWhiteLevel"); // Luminance Saturation var sliderLuminanceSaturation = CommonControls.SliderNumericFloat("Luminance Saturation", groupToneMapping, asset.ToneMapping.ToneMappingLuminanceSaturation, false, true, 0f, 2f, asset.ToneMapping, "ToneMappingLuminanceSaturation"); // Drago Bias var sliderDragoBias = CommonControls.SliderNumericFloat("Drago Bias", groupToneMapping, asset.ToneMapping.DragoBias, false, true, 0f, 1f, asset.ToneMapping, "DragoBias"); // Shoulder Strength var sliderShoulderStrength = CommonControls.SliderNumericFloat("Shoulder Strength", groupToneMapping, asset.ToneMapping.Uncharted2ShoulderStrength, false, true, 0f, 1f, asset.ToneMapping, "Uncharted2ShoulderStrength"); // Linear Strength var sliderLinearStrength = CommonControls.SliderNumericFloat("Linear Strength", groupToneMapping, asset.ToneMapping.Uncharted2LinearStrength, false, true, 0f, 1f, asset.ToneMapping, "Uncharted2LinearStrength"); // Linear Angle var sliderLinearAngle = CommonControls.SliderNumericFloat("Linear Angle", groupToneMapping, asset.ToneMapping.Uncharted2LinearAngle, false, true, 0f, 3f, asset.ToneMapping, "Uncharted2LinearAngle"); // Toe Strength var sliderToeStrength = CommonControls.SliderNumericFloat("Toe Strength", groupToneMapping, asset.ToneMapping.Uncharted2ToeStrength, false, true, 0f, 1f, asset.ToneMapping, "Uncharted2ToeStrength"); // Toe Numerator var sliderToeNumerator = CommonControls.SliderNumericFloat("Toe Numerator", groupToneMapping, asset.ToneMapping.Uncharted2ToeNumerator, false, true, 0f, 0.1f, asset.ToneMapping, "Uncharted2ToeNumerator"); // Toe Denominator var sliderToeDenominator = CommonControls.SliderNumericFloat("Toe Denominator", groupToneMapping, asset.ToneMapping.Uncharted2ToeDenominator, false, true, 0f, 1f, asset.ToneMapping, "Uncharted2ToeDenominator"); // Linear White var sliderLinearWhite = CommonControls.SliderNumericFloat("Linear White", groupToneMapping, asset.ToneMapping.Uncharted2LinearWhite, false, true, 0f, 40f, asset.ToneMapping, "Uncharted2LinearWhite"); #region Sliders enabled? comboBoxToneMappingCurve.ItemIndexChanged += delegate { sliderWhiteLevel.Enabled = false; sliderLuminanceSaturation.Enabled = false; sliderDragoBias.Enabled = false; sliderShoulderStrength.Enabled = false; sliderLinearStrength.Enabled = false; sliderLinearAngle.Enabled = false; sliderToeStrength.Enabled = false; sliderToeNumerator.Enabled = false; sliderToeDenominator.Enabled = false; sliderLinearWhite.Enabled = false; if (asset.ToneMapping.ToneMappingFunction == ToneMapping.ToneMappingFunctionEnumerate.DragoLogarithmic) { sliderWhiteLevel.Enabled = true; sliderLuminanceSaturation.Enabled = true; sliderDragoBias.Enabled = true; } else if (asset.ToneMapping.ToneMappingFunction == ToneMapping.ToneMappingFunctionEnumerate.Exponential) { sliderWhiteLevel.Enabled = true; sliderLuminanceSaturation.Enabled = true; } else if (asset.ToneMapping.ToneMappingFunction == ToneMapping.ToneMappingFunctionEnumerate.FilmicUncharted2) { sliderShoulderStrength.Enabled = true; sliderLinearStrength.Enabled = true; sliderLinearAngle.Enabled = true; sliderToeStrength.Enabled = true; sliderToeNumerator.Enabled = true; sliderToeDenominator.Enabled = true; sliderLinearWhite.Enabled = true; } else if (asset.ToneMapping.ToneMappingFunction == ToneMapping.ToneMappingFunctionEnumerate.Logarithmic) { sliderWhiteLevel.Enabled = true; sliderLuminanceSaturation.Enabled = true; } else if (asset.ToneMapping.ToneMappingFunction == ToneMapping.ToneMappingFunctionEnumerate.Reinhard) { sliderLuminanceSaturation.Enabled = true; } else if (asset.ToneMapping.ToneMappingFunction == ToneMapping.ToneMappingFunctionEnumerate.ReinhardModified) { sliderWhiteLevel.Enabled = true; sliderLuminanceSaturation.Enabled = true; } }; #endregion groupToneMapping.AdjustHeightFromChildren(); #endregion #region Group Bloom GroupBox groupBloom = CommonControls.Group("Bloom", owner); // Enabled CheckBox checkBoxBloomEnabled = CommonControls.CheckBox("Enabled", groupBloom, asset.Bloom.Enabled, asset.Bloom, "Enabled", "The effect produces fringes (or feathers) of light around very bright objects in an image."); // Scale var sliderBloomScale = CommonControls.SliderNumericFloat("Scale", groupBloom, asset.Bloom.Scale, false, true, 0, 2, asset.Bloom, "Scale"); // Threshold var sliderBloomThreshold = CommonControls.SliderNumericFloat("Threshold", groupBloom, asset.Bloom.Threshold, false, true, 0, 10, asset.Bloom, "Threshold"); // Enabled checkBoxBloomEnabled.CheckedChanged += delegate { sliderBloomScale.Enabled = asset.Bloom.Enabled; sliderBloomThreshold.Enabled = asset.Bloom.Enabled; }; groupBloom.AdjustHeightFromChildren(); #endregion #region Group MLAA GroupBox groupMlaa = CommonControls.Group("MLAA", owner); // Enabled CheckBox checkBoxMlaaEnabled = CommonControls.CheckBox("Enabled", groupMlaa, asset.MLAA.Enabled, asset.MLAA, "Enabled", "Enables Morphological Antialiasing."); #region Edge Detection var comboBoxEdgeDetection = CommonControls.ComboBox("Edge Detection Type", groupMlaa, "Color: uses the color information. Good for texture and geometry aliasing. Depth: uses the depth buffer. Great for geometry aliasing. Both: the two at the same time. A little more costly with slightly better results."); // Add textures name comboBoxEdgeDetection.Items.Add("Both"); comboBoxEdgeDetection.Items.Add("Color"); comboBoxEdgeDetection.Items.Add("Depth"); // Events comboBoxEdgeDetection.ItemIndexChanged += delegate { switch (comboBoxEdgeDetection.ItemIndex) { case 0: asset.MLAA.EdgeDetection = MLAA.EdgeDetectionType.Both; break; case 1: asset.MLAA.EdgeDetection = MLAA.EdgeDetectionType.Color; break; case 2: asset.MLAA.EdgeDetection = MLAA.EdgeDetectionType.Depth; break; } }; comboBoxEdgeDetection.Draw += delegate { if (comboBoxEdgeDetection.ListBoxVisible) return; switch (asset.MLAA.EdgeDetection) { case MLAA.EdgeDetectionType.Both: comboBoxEdgeDetection.ItemIndex = 0; break; case MLAA.EdgeDetectionType.Color: comboBoxEdgeDetection.ItemIndex = 1; break; case MLAA.EdgeDetectionType.Depth: comboBoxEdgeDetection.ItemIndex = 2; break; } }; #endregion // Threshold Color var sliderMlaaColorThreshold = CommonControls.SliderNumericFloat("Color Threshold", groupMlaa, asset.MLAA.ThresholdColor, false, false, 0, 0.5f, asset.MLAA, "ThresholdColor"); // Threshold Depth var sliderMlaaDepthThreshold = CommonControls.SliderNumericFloat("Depth Threshold", groupMlaa, asset.MLAA.ThresholdDepth, false, false, 0, 0.5f, asset.MLAA, "ThresholdDepth"); checkBoxMlaaEnabled.CheckedChanged += delegate { comboBoxEdgeDetection.Enabled = asset.MLAA.Enabled; sliderMlaaColorThreshold.Enabled = asset.MLAA.Enabled; sliderMlaaDepthThreshold.Enabled = asset.MLAA.Enabled; }; groupMlaa.AdjustHeightFromChildren(); #endregion #region Group Film Grain GroupBox groupFilmGrain = CommonControls.Group("Film Grain", owner); // Enabled CheckBox checkBoxFilmGrainEnabled = CommonControls.CheckBox("Enabled", groupFilmGrain, asset.FilmGrain.Enabled, asset.FilmGrain, "Enabled", "Is the random optical texture of processed photographic film."); // Strength var sliderFilmgrainStrength = CommonControls.SliderNumericFloat("Strength", groupFilmGrain, asset.FilmGrain.Strength, false, true, 0, 0.5f, asset.FilmGrain, "Strength"); // Random Noise Strength var sliderFilmGrainRandomNoiseStrength = CommonControls.SliderNumericFloat("Random Noise Strength", groupFilmGrain, asset.FilmGrain.RandomNoiseStrength, false, false, 0, 5, asset.FilmGrain, "RandomNoiseStrength"); // Accentuate Dark Noise Power var sliderFilmGrainAccentuateDarkNoisePower = CommonControls.SliderNumericFloat("Accentuate Dark Noise Power", groupFilmGrain, asset.FilmGrain.AccentuateDarkNoisePower, false, false, 0, 10, asset.FilmGrain, "AccentuateDarkNoisePower"); checkBoxFilmGrainEnabled.CheckedChanged += delegate { sliderFilmgrainStrength.Enabled = asset.FilmGrain.Enabled; sliderFilmGrainRandomNoiseStrength.Enabled = asset.FilmGrain.Enabled; sliderFilmGrainAccentuateDarkNoisePower.Enabled = asset.FilmGrain.Enabled; }; groupFilmGrain.AdjustHeightFromChildren(); #endregion #region Group Adjust Levels GroupBox groupAdjustLevels = CommonControls.Group("Adjust Levels", owner); // Enabled CheckBox checkBoxAdjustLevelsEnabled = CommonControls.CheckBox("Enabled", groupAdjustLevels, asset.AdjustLevels.Enabled, asset.AdjustLevels, "Enabled", "Adjust color levels just like Photoshop."); // Input Black var sliderAdjustLevelsInputBlack = CommonControls.SliderNumericFloat("Input Black", groupAdjustLevels, asset.AdjustLevels.InputBlack, false, false, 0, 0.9f, asset.AdjustLevels, "InputBlack"); // Input White var sliderAdjustLevelsInputWhite = CommonControls.SliderNumericFloat("Input White", groupAdjustLevels, asset.AdjustLevels.InputWhite, false, false, 0.1f, 1f, asset.AdjustLevels, "InputWhite"); // Input Gamma var sliderAdjustLevelsInputGamma = CommonControls.SliderNumericFloat("Input Gamma", groupAdjustLevels, asset.AdjustLevels.InputGamma, false, false, 0.01f, 9.99f, asset.AdjustLevels, "InputGamma"); // Output Black var sliderAdjustLevelsOutputBlack = CommonControls.SliderNumericFloat("Output Black", groupAdjustLevels, asset.AdjustLevels.OutputBlack, false, false, 0, 1, asset.AdjustLevels, "OutputBlack"); // Output White var sliderAdjustLevelsOutputWhite = CommonControls.SliderNumericFloat("Output White", groupAdjustLevels, asset.AdjustLevels.OutputWhite, false, false, 0, 1, asset.AdjustLevels, "OutputWhite"); checkBoxAdjustLevelsEnabled.CheckedChanged += delegate { sliderAdjustLevelsInputBlack.Enabled = asset.AdjustLevels.Enabled; sliderAdjustLevelsInputWhite.Enabled = asset.AdjustLevels.Enabled; sliderAdjustLevelsInputGamma.Enabled = asset.AdjustLevels.Enabled; sliderAdjustLevelsOutputBlack.Enabled = asset.AdjustLevels.Enabled; sliderAdjustLevelsOutputWhite.Enabled = asset.AdjustLevels.Enabled; }; groupAdjustLevels.AdjustHeightFromChildren(); #endregion #region Group Color Correction GroupBox groupColorCorrection = CommonControls.Group("Color Correction", owner); // Enabled CheckBox checkBoxColorCorrectionEnabled = CommonControls.CheckBox("Enabled", groupColorCorrection, asset.ColorCorrection.Enabled, asset.ColorCorrection, "Enabled"); // First Lookup Table var assetCreatorFirstLookupTable = CommonControls.AssetSelector<LookupTable>("First Lookup Table", groupColorCorrection, asset.ColorCorrection, "FirstLookupTable"); // Second Lookup Table var assetCreatorSecondLookupTable = CommonControls.AssetSelector<LookupTable>("Second Lookup Table", groupColorCorrection, asset.ColorCorrection, "SecondLookupTable"); assetCreatorSecondLookupTable.Draw += delegate { assetCreatorSecondLookupTable.Enabled = asset.ColorCorrection.FirstLookupTable != null && checkBoxColorCorrectionEnabled.Checked; }; // Lerp Original Color Amount var sliderLerpOriginalColorAmount = CommonControls.SliderNumericFloat("Lerp Original Color", groupColorCorrection, asset.ColorCorrection.LerpOriginalColorAmount, false, false, 0, 1, asset.ColorCorrection, "LerpOriginalColorAmount"); sliderLerpOriginalColorAmount.Draw += delegate { sliderLerpOriginalColorAmount.Enabled = asset.ColorCorrection.FirstLookupTable != null && checkBoxColorCorrectionEnabled.Checked; }; // Lerp Lookup Tables Amount var sliderLerpLookupTablesAmount = CommonControls.SliderNumericFloat("Lerp Lookup Tables", groupColorCorrection, asset.ColorCorrection.LerpLookupTablesAmount, false, false, 0, 1, asset.ColorCorrection, "LerpLookupTablesAmount"); sliderLerpLookupTablesAmount.Draw += delegate { sliderLerpLookupTablesAmount.Enabled = asset.ColorCorrection.SecondLookupTable != null && asset.ColorCorrection.FirstLookupTable != null && checkBoxColorCorrectionEnabled.Checked; }; checkBoxColorCorrectionEnabled.CheckedChanged += delegate { assetCreatorFirstLookupTable.Enabled = asset.ColorCorrection.Enabled; }; groupColorCorrection.AdjustHeightFromChildren(); #endregion } // AddControls