Пример #1
0
        private void list_Materials_Changed(object sender, SelectionChangedEventArgs e)
        {
            Hub.mainWindow.viewModel.materialId = list_Materials.SelectedIndex;

            if (Hub.mainWindow.viewModel.materialId > -1)
            {
                Hub.window_model.chromeBrowser.ExecuteScriptAsync("selectMaterial", Hub.mainWindow.viewModel.materialId);

                var mat = Hub.mainWindow.viewModel.Item.Materials[Hub.mainWindow.viewModel.materialId];
                Hub.mainWindow.viewModel.material = mat;
                UpdateBindings();

                SolidColorBrush b = new SolidColorBrush();
                b.Color = Colors.OrangeRed;

                var diffuseColor  = new ColorWpf().FromRgb(Convert.ToByte(mat.color[0] * 255), Convert.ToByte(mat.color[1] * 255), Convert.ToByte(mat.color[2] * 255));
                var specularColor = new ColorWpf().FromRgb(Convert.ToByte(mat.specularColor[0] * 255), Convert.ToByte(mat.specularColor[1] * 255), Convert.ToByte(mat.specularColor[2] * 255));

                Hub.window_material.map.Background             = b;
                Hub.window_material.normalMap.Background       = b;
                Hub.window_material.roughnessMap.Background    = b;
                Hub.window_material.displacementMap.Background = b;
                Hub.window_material.metalnessMap.Background    = b;

                materialPanel.Visibility = Visibility.Visible;

                Hub.window_material.Show();
            }
            else
            {
                materialPanel.Visibility = Visibility.Hidden;

                //Hub.window_material.Hide();
            }
        }
Пример #2
0
        public MainWindow()
        {
            Hub.mainWindow = this;
            InitializeComponent();
            Hub.window_material = new Window_material();
            Hub.window_model    = new Window_model();

            Hub.window_model.Show();
            Hub.window_material.Show();

            manager = new ScriptManager(new Window[] { Hub.mainWindow, Hub.window_material, Hub.window_model });

            modelDataView.Visibility = Visibility.Hidden;
            SetBindings();

            var col = new ColorWpf().FromHsv(0, 1, 1);
        }
Пример #3
0
 public static float[] ToArray(ColorWpf color)
 {
     return(new float[4] {
         Convert.ToSingle(color.R) / 255f, Convert.ToSingle(color.G) / 255f, Convert.ToSingle(color.B) / 255f, 1
     });
 }