Exemplo n.º 1
0
        private SpriteVisual SetupStageSide(StageSide side)
        {
            SpriteVisual     visual  = _compositor.CreateSpriteVisual();
            Vector3          offset  = Vector3.Zero;
            Vector2          size    = Vector2.Zero;
            CompositionBrush brush   = null;
            string           comment = string.Empty;

            switch (side)
            {
            case StageSide.Backdrop:
                offset  = new Vector3(_stageWidth / 2, _stageBackdropHeight / 2, -1 * _stageFloorDepth);
                size    = new Vector2(_stageWidth, _stageBackdropHeight);
                brush   = _compositor.CreateSurfaceBrush(_surfaceFactory.CreateUriSurface(new Uri(BackgropImage), new Size(_stageWidth, _stageBackdropHeight)).Surface);
                comment = "Backdrop";
                break;

            case StageSide.Floor:
                offset  = new Vector3(_stageWidth / 2, _stageBackdropHeight * 1.5f, -1 * _stageFloorDepth);
                size    = new Vector2(_stageWidth, _stageFloorDepth);
                brush   = _compositor.CreateSurfaceBrush(_surfaceFactory.CreateUriSurface(new Uri(FloorImage), new Size(_stageWidth, _stageFloorDepth)).Surface);
                comment = "Floor";
                visual.RotationAngleInDegrees = 90f;
                visual.RotationAxis           = _rotationAxisX;
                break;
            }

            visual.Offset  = offset;
            visual.Size    = size;
            visual.Brush   = brush;
            visual.Comment = comment;

            _stageContainer.Children.InsertAtTop(visual);
            return(visual);
        }
        private void SetupSkyboxSide(ref SpriteVisual side, Vector3 offset, Uri image, string comment)
        {
            side            = _compositor.CreateSpriteVisual();
            side.BorderMode = CompositionBorderMode.Hard;
            side.Size       = new Vector2(_skyboxSize, _skyboxSize);
            side.Offset     = offset;
            side.Brush      = _compositor.CreateSurfaceBrush(_surfaceFactory.CreateUriSurface(image).Surface);
            side.Comment    = comment;

            _skyboxContainer.Children.InsertAtTop(side);
        }
Exemplo n.º 3
0
        private SpriteVisual SetupSkyboxSide(SkyboxSide side)
        {
            SpriteVisual          visual     = _compositor.CreateSpriteVisual();
            CompositionBorderMode borderMode = CompositionBorderMode.Hard;
            Vector2 size    = new Vector2(_skyboxSize, _skyboxSize);
            Vector3 offset  = Vector3.Zero;
            string  image   = _defaultImage;
            string  comment = string.Empty;

            switch (side)
            {
            case SkyboxSide.Top:
                offset  = new Vector3(0, 0, _skyboxSize);
                image   = TopImage;
                comment = "SkyboxTop";
                visual.RotationAngleInDegrees = -90;
                visual.RotationAxis           = _rotationAxisX;
                break;

            case SkyboxSide.Bottom:
                offset  = new Vector3(0, _skyboxSize, 0);
                image   = BottomImage;
                comment = "SkyboxBottom";
                visual.RotationAngleInDegrees = 90;
                visual.RotationAxis           = _rotationAxisX;
                break;

            case SkyboxSide.Left:
                offset  = new Vector3(0, 0, _skyboxSize);
                image   = LeftImage;
                comment = "SkyboxLeft";
                visual.RotationAngleInDegrees = 90;
                visual.RotationAxis           = _rotationAxisY;
                break;

            case SkyboxSide.Right:
                offset  = new Vector3(_skyboxSize, 0, 0);
                image   = RightImage;
                comment = "SkyboxRight";
                visual.RotationAngleInDegrees = -90;
                visual.RotationAxis           = _rotationAxisY;
                break;

            case SkyboxSide.Front:
                offset  = new Vector3(0, 0, 0);
                image   = FrontImage;
                comment = "SkyboxFront";
                break;

            case SkyboxSide.Back:
                offset  = new Vector3(0, 0, _skyboxSize);
                image   = BackImage;
                comment = "SkyboxBack";
                break;
            }

            visual.BorderMode = borderMode;
            visual.Size       = size;
            visual.Offset     = offset;
            visual.Brush      = _compositor.CreateSurfaceBrush(_surfaceFactory.CreateUriSurface(new Uri(image)).Surface);
            visual.Comment    = comment;

            _skyboxContainer.Children.InsertAtTop(visual);
            return(visual);
        }