public override void RecreateControls(bool constructor) { base.RecreateControls(constructor); m_currentPosition = -m_size.Value / 2.0f + new Vector2(0.02f, 0.10f); m_currentPosition.Y += 0.01f; m_scale = 0.7f; AddCaption("Render Model FX", Color.Yellow.ToVector4()); AddShareFocusHint(); //if (MySession.ControlledObject == null) //return; AddButton(new StringBuilder("Reload textures"), delegate { VRageRender.MyRenderProxy.ReloadTextures(); }); //Line line = new Line(MySector.MainCamera.Position, MySector.MainCamera.Position + MySector.MainCamera.ForwardVector * 10); //var res = MyEntities.GetIntersectionWithLine(ref line, null, null); //if (!res.HasValue) // return; ////MyModel model = MySession.ControlledObject.ModelLod0; //m_model = res.Value.Entity.ModelLod0; m_modelsCombo = AddCombo(); var modelList = MyModels.LoadedModels.Values.ToList(); if (modelList.Count == 0) return; for (int i = 0; i < modelList.Count; i++) { var model = modelList[i]; m_modelsCombo.AddItem((int)i, new StringBuilder(System.IO.Path.GetFileNameWithoutExtension(model.AssetName))); } m_modelsCombo.SelectItemByIndex(m_currentModelSelectedItem); m_modelsCombo.ItemSelected += new MyGuiControlCombobox.ItemSelectedDelegate(modelsCombo_OnSelect); m_model = modelList[m_currentModelSelectedItem]; if (m_model == null) return; m_meshesCombo = AddCombo(); for (int i = 0; i < m_model.GetMeshList().Count; i++) { var mesh = m_model.GetMeshList()[i]; m_meshesCombo.AddItem((int)i, new StringBuilder(mesh.Material.Name)); } m_meshesCombo.SelectItemByIndex(m_currentSelectedMeshItem); m_meshesCombo.ItemSelected += new MyGuiControlCombobox.ItemSelectedDelegate(meshesCombo_OnSelect); if (MySector.MainCamera != null) { m_voxelsCombo = AddCombo(); m_voxelsCombo.AddItem(-1, new StringBuilder("None")); int i = 0; foreach (var voxelMaterial in MyDefinitionManager.Static.GetVoxelMaterialDefinitions()) { m_voxelsCombo.AddItem(i++, new StringBuilder(voxelMaterial.Id.SubtypeName)); } m_voxelsCombo.SelectItemByIndex(m_currentSelectedVoxelItem + 1); m_voxelsCombo.ItemSelected += new MyGuiControlCombobox.ItemSelectedDelegate(voxelsCombo_OnSelect); } var selectedMesh = m_model.GetMeshList()[m_currentSelectedMeshItem]; var selectedMaterial = selectedMesh.Material; m_diffuseColor = AddColor(new StringBuilder("Diffuse"), selectedMaterial, MemberHelper.GetMember(() => selectedMaterial.DiffuseColor)); m_specularIntensity = AddSlider("Specular intensity", selectedMaterial.SpecularIntensity, 0, 32, null); m_specularPower = AddSlider("Specular power", selectedMaterial.SpecularPower, 0, 128, null); }
public override void RecreateControls(bool constructor) { base.RecreateControls(constructor); BackgroundColor = new Vector4(1f, 1f, 1f, 0.5f); m_currentPosition = -m_size.Value / 2.0f + new Vector2(0.02f, 0.13f); AddCaption("Voxel materials", Color.Yellow.ToVector4()); AddShareFocusHint(); m_materialsCombo = AddCombo(); var defList = MyDefinitionManager.Static.GetVoxelMaterialDefinitions().OrderBy(x => x.Id.SubtypeName).ToList(); foreach (var material in defList) { m_materialsCombo.AddItem(material.Index, new StringBuilder(material.Id.SubtypeName)); } m_materialsCombo.ItemSelected += materialsCombo_OnSelect; m_currentPosition.Y += 0.01f; m_sliderInitialScale = AddSlider("Initial scale", 0, 1f, 100f, null); m_sliderScaleMultiplier = AddSlider("Scale multiplier", 0, 1f, 100f, null); m_sliderInitialDistance = AddSlider("Initial distance", 0, 1f, 100f, null); m_sliderDistanceMultiplier = AddSlider("Distance multiplier", 0, 1f, 100f, null); m_sliderFar1Distance = AddSlider("Far1 distance", 0, 0f, 20000f, null); m_sliderFar1Scale = AddSlider("Far1 scale", 0, 1f, 50000f, null); m_sliderFar2Distance = AddSlider("Far2 distance", 0, 0f, 20000f, null); m_sliderFar2Scale = AddSlider("Far2 scale", 0, 1f, 50000f, null); m_sliderFar3Distance = AddSlider("Far3 distance", 0, 0f, 40000f, null); m_sliderFar3Scale = AddSlider("Far3 scale", 0, 1f, 50000f, null); m_sliderExtScale = AddSlider("Detail scale (/1000)", 0, 0.01f, 1f, null); m_materialsCombo.SelectItemByIndex(0); m_colorFar3 = AddColor(new StringBuilder("Far3 color"), m_selectedVoxelMaterial, MemberHelper.GetMember(() => m_selectedVoxelMaterial.Far3Color)); m_colorFar3.SetColor(m_selectedVoxelMaterial.Far3Color); m_currentPosition.Y += 0.01f; AddButton(new StringBuilder("Reload definition"), OnReloadDefinition); }