Ejemplo n.º 1
0
        void Content_Loaded(object sender, System.Windows.RoutedEventArgs e)
        {
            _reflectionMapTexture = LoadTexture("/Balder.Silverlight.SampleBrowser;component/Samples/Materials/MaterialPicker/Assets/ReflectionMap.jpg");
            _visualStudioTexture = LoadTexture("/Balder.Silverlight.SampleBrowser;component/Samples/Materials/MaterialPicker/Assets/VisualStudio.png");
            _balderLogoTexture = LoadTexture("/Balder.Silverlight.SampleBrowser;component/Samples/Materials/MaterialPicker/Assets/BalderLogo.png");

            HandleSelection();
        }
Ejemplo n.º 2
0
        private void HandleTextureSelection()
        {
            switch( TextureComboBox.SelectedIndex )
            {
                case 0:
                    {
                        _selectedTexture = _reflectionMapTexture;
                    }
                    break;
                case 1:
                    {
                        _selectedTexture = _visualStudioTexture;
                    }
                    break;
                case 2:
                    {
                        _selectedTexture = _balderLogoTexture;
                    }
                    break;
            }

            if( null != _selectedMaterial.DiffuseMap )
            {
                _selectedMaterial.DiffuseMap = _selectedTexture;
            } else if( null != _selectedMaterial.ReflectionMap )
            {
                _selectedMaterial.ReflectionMap = _selectedTexture;
            }
        }
Ejemplo n.º 3
0
        private void Game_LoadContent(Game game)
        {
            _container = new Geometry();
            game.Scene.AddNode(_container);

            _teapot = game.ContentManager.Load<Mesh>("teapot.ASE");
            _container.Children.Add(_teapot);
            _teapot.IsVisible = false;

            _box = new Box {Dimension = new Coordinate(40, 40, 40)};
            _box.Position.Set(0,10,0);
            _container.Children.Add(_box);

            _cylinder = new Cylinder {Segments = 16, Size = 20, TopRadius = 20, BottomRadius = 40};
            _cylinder.Position.Set(0, 10, 0);
            _container.Children.Add(_cylinder);

            _ring = new Ring {Segments = 16, Size = 20, InnerRadius = 20, OuterRadius = 40};
            _ring.Position.Set(0, 10, 0);
            _container.Children.Add(_ring);

            _reflectionMapTexture = LoadTexture("/Balder.Silverlight.SampleBrowser;component/Samples/Programatic/Materials/Assets/ReflectionMap.jpg");
            _visualStudioTexture = LoadTexture("/Balder.Silverlight.SampleBrowser;component/Samples/Programatic/Materials/Assets/VisualStudio.png");
            _balderLogoTexture = LoadTexture("/Balder.Silverlight.SampleBrowser;component/Samples/Programatic/Materials/Assets/BalderLogo.png");

            _flatMaterial = new Material
            {
                Diffuse = Colors.Red,
                Shade = MaterialShade.Flat
            };
            _gouraudMaterial = new Material
            {
                Diffuse = Colors.Red,
                Shade = MaterialShade.Gouraud
            };
            _texturedMaterial = new Material
            {
                DiffuseMap = _reflectionMapTexture,
                Shade = MaterialShade.Flat,
            };
            _reflectionMaterial = new Material
            {
                ReflectionMap = _reflectionMapTexture,
                Shade = MaterialShade.Flat
            };
        }