Example #1
0
        private void cboMineral_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                if (!_initialized)
                {
                    return;
                }

                if (_mineralVisual != null)
                {
                    _viewport.Children.Remove(_mineralVisual);
                }

                MineralType mineralType = (MineralType)cboMineral.SelectedValue;

                // Create visual
                ModelVisual3D visual = new ModelVisual3D();
                visual.Content = Mineral.GetNewVisual(mineralType);
                //visual.Transform = new RotateTransform3D(new QuaternionRotation3D(Math3D.GetRandomRotation()));

                _mineralVisual = visual;
                _viewport.Children.Add(_mineralVisual);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), this.Title, MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Example #2
0
        private void RenderMineral()
        {
            ModelVisual3D visual = new ModelVisual3D();

            visual.Content   = Mineral.GetNewVisual(this.MineralType);
            _rotateTransform = new QuaternionRotation3D(Math3D.GetRandomRotation());
            visual.Transform = new RotateTransform3D(_rotateTransform);

            _viewport.Children.Add(visual);

            _camera.Position = (_camera.Position.ToVector().ToUnit() * 2.5d).ToPoint();
        }
Example #3
0
        private static Model3D GetModel_Shop(out BotShellColorsDNA backdropColors, double radius)
        {
            Model3DGroup retVal = new Model3DGroup();

            backdropColors = new BotShellColorsDNA();
            backdropColors.DiffuseDrift  = 0;
            backdropColors.EmissiveColor = "00000000";

            #region Plate

            backdropColors.InnerColorDiffuse = "554A3A";

            // Material
            MaterialGroup material = new MaterialGroup();
            material.Children.Add(new DiffuseMaterial(new SolidColorBrush(UtilityWPF.ColorFromHex(backdropColors.InnerColorDiffuse))));
            material.Children.Add(new SpecularMaterial(new SolidColorBrush(UtilityWPF.ColorFromHex("40958265")), 20d));

            // Geometry Model
            GeometryModel3D geometry = new GeometryModel3D();
            geometry.Material     = material;
            geometry.BackMaterial = material;

            geometry.Geometry = UtilityWPF.GetSphere_LatLon(6, radius, radius, radius * .1);

            retVal.Children.Add(geometry);

            #endregion

            #region Gold Mineral

            // Get gold's color
            backdropColors.Light = Mineral.GetSettingsForMineralType(MineralType.Gold).DiffuseColor.ToHex();

            // Get the model of a gold mineral
            Model3D model = Mineral.GetNewVisual(MineralType.Gold);

            // Figure out the scale
            Rect3D aabb     = model.Bounds;
            double halfSize = Math1D.Max(aabb.SizeX, aabb.SizeY, aabb.SizeZ) / 2d;

            double scale = (radius * .66d) / halfSize;
            model.Transform = new ScaleTransform3D(scale, scale, scale);

            retVal.Children.Add(model);

            #endregion

            return(retVal);
        }