예제 #1
0
        protected override async Task LoadContent()
        {
            await base.LoadContent();

            var cube = Asset.Load<Entity>("cube");
            cube.Transform.Scale = new Vector3(10000);
            cube.Transform.Position = new Vector3(0, 0, 10);
            Scene.AddChild(cube);

            var imageElement = new ImageElement { Source = new UIImage(Asset.Load<Texture>("uv")) };
            var imageEntity = new Entity { new UIComponent { RootElement = imageElement, IsFullScreen = false, VirtualResolution = new Vector3(150) } };
            imageEntity.Transform.Position = new Vector3(-500, 0, 0);
            Scene.AddChild(imageEntity);

            var imageEntity2 = new Entity { new UIComponent { RootElement = imageElement, IsFullScreen = false, VirtualResolution = new Vector3(200) } };
            imageEntity2.Transform.Position = new Vector3(0, 250, 0);
            Scene.AddChild(imageEntity2);

            var imageEntity3 = new Entity { new UIComponent { RootElement = imageElement, IsFullScreen = false, VirtualResolution = new Vector3(250) } };
            imageEntity3.Transform.Position = new Vector3(0, 0, -500);
            Scene.AddChild(imageEntity3);
            
            // setup the camera
            var camera = new TestCamera { Yaw = MathUtil.Pi/4, Pitch = MathUtil.Pi/4, Position = new Vector3(500, 500, 500), MoveSpeed = 100 };
            camera.SetTarget(cube, true);
            CameraComponent = camera.Camera;
            Script.Add(camera);
        }
예제 #2
0
        protected override async Task LoadContent()
        {
            await base.LoadContent();

            var cube = new Entity {
                new ModelComponent {
                    Model = Asset.Load <Model>("cube Model")
                }
            };

            cube.Transform.Scale    = new Vector3(10000);
            cube.Transform.Position = new Vector3(0, 0, 10);
            Scene.AddChild(cube);

            var imageElement = new ImageElement {
                Source = new Sprite(Asset.Load <Texture>("uv"))
            };
            var imageEntity = new Entity {
                new UIComponent {
                    RootElement = imageElement, IsFullScreen = false, VirtualResolution = new Vector3(150)
                }
            };

            imageEntity.Transform.Position = new Vector3(-500, 0, 0);
            Scene.AddChild(imageEntity);

            var imageEntity2 = new Entity {
                new UIComponent {
                    RootElement = imageElement, IsFullScreen = false, VirtualResolution = new Vector3(200)
                }
            };

            imageEntity2.Transform.Position = new Vector3(0, 250, 0);
            Scene.AddChild(imageEntity2);

            var imageEntity3 = new Entity {
                new UIComponent {
                    RootElement = imageElement, IsFullScreen = false, VirtualResolution = new Vector3(250)
                }
            };

            imageEntity3.Transform.Position = new Vector3(0, 0, -500);
            Scene.AddChild(imageEntity3);

            // setup the camera
            var camera = new TestCamera {
                Yaw = MathUtil.Pi / 4, Pitch = MathUtil.Pi / 4, Position = new Vector3(500, 500, 500), MoveSpeed = 100
            };

            camera.SetTarget(cube, true);
            CameraComponent = camera.Camera;
            Script.Add(camera);
        }
예제 #3
0
        protected override async Task LoadContent()
        {
            await base.LoadContent();

            // setup the camera
            var camera = new TestCamera { Yaw = 0, Pitch = 0, Position = new Vector3(0, 0, 1000), MoveSpeed = 100 };
            CameraComponent = camera.Camera;
            Script.Add(camera);

            UIRoot.Transform.Rotation = Quaternion.RotationX(MathUtil.Pi / 3f);
            UIComponent.RootElement = new ImageElement { Source = new Sprite(Asset.Load<Texture>("uv"))};
            UIComponent.IsFullScreen = false;
            UIComponent.IsBillboard = false;
            UIComponent.VirtualResolution = new Vector3(200, 200, 100);

            var cube = new Entity { new ModelComponent { Model = Asset.Load<Model>("cube Model") } };
            cube.Transform.Scale = new Vector3(10000);
            cube.Transform.Position = new Vector3(0, 0, 10);
            Scene.AddChild(cube);
            
            var font = Asset.Load<SpriteFont>("CourierNew12");
            var textBlockZ0 = new TextBlock { Font = font, TextColor = Color.Black, TextSize = 20, Text = "At depth 0", VerticalAlignment = VerticalAlignment.Center, SynchronousCharacterGeneration = true, BackgroundColor = Color.Red };
            var entity1 = new Entity { new UIComponent { RootElement = textBlockZ0, IsFullScreen = false, IsBillboard = false, VirtualResolution = new Vector3(150) } };
            entity1.Transform.Position = new Vector3(-500, 0, 0);
            Scene.AddChild(entity1);

            var textBlockZ500 = new TextBlock { Font = font, TextColor = Color.Black, TextSize = 20, Text = "At depth 300", VerticalAlignment = VerticalAlignment.Center, SynchronousCharacterGeneration = true, BackgroundColor = Color.Red };
            var entity2 = new Entity { new UIComponent { RootElement = textBlockZ500, IsFullScreen = false, IsBillboard = false, VirtualResolution = new Vector3(150) } };
            entity2.Transform.Position = new Vector3(300, 0, 300);
            Scene.AddChild(entity2);

            var textBlockZM500 = new TextBlock { Font = font, TextColor = Color.Black, TextSize = 20, Text = "At depth -300", VerticalAlignment = VerticalAlignment.Center, SynchronousCharacterGeneration = true, BackgroundColor = Color.Red };
            var entity3 = new Entity { new UIComponent { RootElement = textBlockZM500, IsFullScreen = false, IsBillboard = false, VirtualResolution = new Vector3(150) } };
            entity3.Transform.Position = new Vector3(0, 300, -300);
            Scene.AddChild(entity3);

            elements.Add(entity1);
            elements.Add(entity2);
            elements.Add(entity3);
        }
예제 #4
0
        protected override async Task LoadContent()
        {
            await base.LoadContent();

            // setup the camera
            var camera = new TestCamera {
                Yaw = 0, Pitch = 0, Position = new Vector3(0, 0, 1000), MoveSpeed = 100
            };

            CameraComponent = camera.Camera;
            Script.Add(camera);

            UIRoot.Transform.Rotation = Quaternion.RotationX(MathUtil.Pi / 3f);
            UIComponent.RootElement   = new ImageElement {
                Source = new Sprite(Asset.Load <Texture>("uv"))
            };
            UIComponent.IsFullScreen      = false;
            UIComponent.IsBillboard       = false;
            UIComponent.VirtualResolution = new Vector3(200, 200, 100);

            var cube = new Entity {
                new ModelComponent {
                    Model = Asset.Load <Model>("cube Model")
                }
            };

            cube.Transform.Scale    = new Vector3(10000);
            cube.Transform.Position = new Vector3(0, 0, 10);
            Scene.AddChild(cube);

            var font        = Asset.Load <SpriteFont>("CourierNew12");
            var textBlockZ0 = new TextBlock {
                Font = font, TextColor = Color.Black, TextSize = 20, Text = "At depth 0", VerticalAlignment = VerticalAlignment.Center, SynchronousCharacterGeneration = true, BackgroundColor = Color.Red
            };
            var entity1 = new Entity {
                new UIComponent {
                    RootElement = textBlockZ0, IsFullScreen = false, IsBillboard = false, VirtualResolution = new Vector3(150)
                }
            };

            entity1.Transform.Position = new Vector3(-500, 0, 0);
            Scene.AddChild(entity1);

            var textBlockZ500 = new TextBlock {
                Font = font, TextColor = Color.Black, TextSize = 20, Text = "At depth 300", VerticalAlignment = VerticalAlignment.Center, SynchronousCharacterGeneration = true, BackgroundColor = Color.Red
            };
            var entity2 = new Entity {
                new UIComponent {
                    RootElement = textBlockZ500, IsFullScreen = false, IsBillboard = false, VirtualResolution = new Vector3(150)
                }
            };

            entity2.Transform.Position = new Vector3(300, 0, 300);
            Scene.AddChild(entity2);

            var textBlockZM500 = new TextBlock {
                Font = font, TextColor = Color.Black, TextSize = 20, Text = "At depth -300", VerticalAlignment = VerticalAlignment.Center, SynchronousCharacterGeneration = true, BackgroundColor = Color.Red
            };
            var entity3 = new Entity {
                new UIComponent {
                    RootElement = textBlockZM500, IsFullScreen = false, IsBillboard = false, VirtualResolution = new Vector3(150)
                }
            };

            entity3.Transform.Position = new Vector3(0, 300, -300);
            Scene.AddChild(entity3);

            elements.Add(entity1);
            elements.Add(entity2);
            elements.Add(entity3);
        }