示例#1
0
		public AnnularRing(IContentManager contentManager, float innerRadius, float outerRadius, int slices)
		{
			ContentManager = contentManager;
			_geometry = ContentManager.CreateAssetPart<Geometry>();
			InnerRadius = innerRadius;
			OuterRadius = outerRadius;
			Slices = slices;

			PrepareVertices();
			PrepareFaces();
		}
示例#2
0
文件: SceneTests.cs 项目: Conn/Balder
        public void GettingObjectAtCenterOfScreenWithSingleObjectAtCenterOfSceneShouldReturnTheObject()
        {
            var viewport = new Viewport {Width = 640, Height = 480};
            var scene = new Scene();
            var camera = new Camera(viewport) {Position = {Z = -10}};
            camera.Update();

            var node = new Geometry
                       	{
                       		BoundingSphere = new BoundingSphere(Vector.Zero, 10f)
                       	};
            scene.AddNode(node);

            var nodeAtCoordinate = scene.GetNodeAtScreenCoordinate(viewport, viewport.Width / 2, viewport.Height / 2);
            Assert.That(nodeAtCoordinate, Is.Not.Null);
            Assert.That(nodeAtCoordinate, Is.EqualTo(node));
        }
示例#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
            };
        }
示例#4
0
        private void HandleObjectSelection()
        {
            switch (ObjectComboBox.SelectedIndex)
            {
                case 0:
                    {
                        _selectedNode = Teapot;

                        Teapot.IsVisible = true;
                        Box.IsVisible = false;
                    }
                    break;
                case 1:
                    {
                        _selectedNode = Box;

                        Teapot.IsVisible = false;
                        Box.IsVisible = true;
                    }
                    break;
            }
        }
示例#5
0
        private void HandleObjectSelection()
        {
            switch (ObjectComboBox.SelectedIndex)
            {
                case 0:
                    {
                        _selectedNode = _teapot;

                        _teapot.IsVisible = true;
                        _box.IsVisible = false;
                        _cylinder.IsVisible = false;
                        _ring.IsVisible = false;
                    }
                    break;
                case 1:
                    {
                        _selectedNode = _box;

                        _teapot.IsVisible = false;
                        _box.IsVisible = true;
                        _cylinder.IsVisible = false;
                        _ring.IsVisible = false;
                    }
                    break;
                case 2:
                    {
                        _selectedNode = _cylinder;

                        _teapot.IsVisible = false;
                        _box.IsVisible = false;
                        _cylinder.IsVisible = true;
                        _ring.IsVisible = false;
                    }
                    break;
                case 3:
                    {
                        _selectedNode = _ring;

                        _teapot.IsVisible = false;
                        _box.IsVisible = false;
                        _cylinder.IsVisible = false;
                        _ring.IsVisible = true;
                    }
                    break;
            }
        }