コード例 #1
0
        public async Task Render_SimpleObject_D2D_Texture()
        {
            await TestUtilities.InitializeWithGraphicsAsync();

            using (var solidBrush = new SolidBrushResource(Color4.Gray))
                using (var textFormat = new TextFormatResource("Arial", 36))
                    using (var textBrush = new SolidBrushResource(Color4.RedColor))
                        using (var memRenderTarget = new MemoryRenderTarget(1024, 1024))
                        {
                            memRenderTarget.ClearColor = Color4.CornflowerBlue;

                            // Get and configure the camera
                            var camera = (PerspectiveCamera3D)memRenderTarget.Camera;
                            camera.Position = new Vector3(0f, 5f, -7f);
                            camera.Target   = new Vector3(0f, 0f, 0f);
                            camera.UpdateCamera();

                            // 2D rendering is made here
                            var d2dDrawingLayer = new Custom2DDrawingLayer(graphics =>
                            {
                                var d2dRectangle = new RectangleF(10, 10, 236, 236);
                                graphics.Clear(Color4.LightBlue);
                                graphics.FillRoundedRectangle(
                                    d2dRectangle, 30, 30,
                                    solidBrush);

                                d2dRectangle.Inflate(-10, -10);
                                graphics.DrawText("Hello Direct2D!", textFormat, d2dRectangle, textBrush);
                            });

                            // Define scene
                            await memRenderTarget.Scene.ManipulateSceneAsync(manipulator =>
                            {
                                var resD2DTexture = manipulator.AddResource(
                                    _ => new Direct2DTextureResource(d2dDrawingLayer, 256, 256));
                                var resD2DMaterial = manipulator.AddStandardMaterialResource(resD2DTexture);
                                var geoResource    = manipulator.AddResource(
                                    _ => new GeometryResource(new CubeGeometryFactory()));

                                var newMesh           = manipulator.AddMeshObject(geoResource, resD2DMaterial);
                                newMesh.RotationEuler = new Vector3(0f, EngineMath.RAD_90DEG / 2f, 0f);
                                newMesh.Scaling       = new Vector3(2f, 2f, 2f);
                            });

                            await memRenderTarget.AwaitRenderAsync();

                            // Take screenshot
                            var screenshot = await memRenderTarget.RenderLoop.GetScreenshotGdiAsync();

                            //TestUtilities.DumpToDesktop(screenshot, "Blub.png");

                            // Calculate and check difference
                            var isNearEqual = BitmapComparison.IsNearEqual(
                                screenshot, TestUtilities.LoadBitmapFromResource("Drawing2D", "SimpleObject_D2DTexture.png"));
                            Assert.IsTrue(isNearEqual, "Difference to reference image is to big!");
                        }

            // Finishing checks
            Assert.IsTrue(GraphicsCore.Current.MainLoop !.RegisteredRenderLoopCount == 0, "RenderLoops where not disposed correctly!");
        }
コード例 #2
0
ファイル: Scene.cs プロジェクト: RolandKoenig/SeeingSharp2
        /// <summary>
        /// Removes the given drawing layer.
        /// </summary>
        /// <param name="drawingLayer">The drawing layer.</param>
        internal void RemoveDrawingLayer(Custom2DDrawingLayer drawingLayer)
        {
            drawingLayer.EnsureNotNull(nameof(drawingLayer));

            while (_drawing2DLayers.Remove(drawingLayer))
            {
            }
        }
コード例 #3
0
ファイル: Scene.cs プロジェクト: RolandKoenig/SeeingSharp2
        /// <summary>
        /// Adds the given drawing layer.
        /// </summary>
        /// <param name="drawingLayer">The drawing layer.</param>
        internal void AddDrawingLayer(Custom2DDrawingLayer drawingLayer)
        {
            drawingLayer.EnsureNotNull(nameof(drawingLayer));

            if (!_drawing2DLayers.Contains(drawingLayer))
            {
                _drawing2DLayers.Add(drawingLayer);
            }
        }
コード例 #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Direct2DSingleRenderTextureResource"/> class.
        /// </summary>
        /// <param name="drawingLayer">The drawing layer.</param>
        /// <param name="height">The width of the generated texture.</param>
        /// <param name="width">The height of the generated texture.</param>
        public Direct2DSingleRenderTextureResource(Custom2DDrawingLayer drawingLayer, int width, int height)
        {
            drawingLayer.EnsureNotNull(nameof(drawingLayer));
            width.EnsurePositive(nameof(width));
            height.EnsurePositive(nameof(height));

            m_drawingLayer = drawingLayer;
            m_width        = width;
            m_height       = height;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="Direct2DOneTimeRenderTextureResource"/> class.
        /// </summary>
        /// <param name="drawingLayer">The drawing layer.</param>
        /// <param name="height">The width of the generated texture.</param>
        /// <param name="width">The height of the generated texture.</param>
        public Direct2DOneTimeRenderTextureResource(Custom2DDrawingLayer drawingLayer, int width, int height)
        {
            drawingLayer.EnsureNotNull(nameof(drawingLayer));
            width.EnsurePositiveOrZero(nameof(width));
            height.EnsurePositiveOrZero(nameof(height));

            _drawingLayer = drawingLayer;
            _width        = width;
            _height       = height;
        }
コード例 #6
0
        public override async Task OnStartupAsync(RenderLoop mainRenderLoop, SampleSettings settings)
        {
            mainRenderLoop.EnsureNotNull(nameof(mainRenderLoop));

            var castedSettings = settings as Direct2DTextureSampleSettings ?? new Direct2DTextureSampleSettings();

            // 2D rendering is made here
            _solidBrush = new SolidBrushResource(Color4.Gray);
            _textFormat = new TextFormatResource("Arial", 36);
            _textBrush  = new SolidBrushResource(Color4.RedColor);

            var d2DDrawingLayer = new Custom2DDrawingLayer(graphics =>
            {
                var d2DRectangle = new RectangleF(10, 10, 236, 236);
                graphics.Clear(Color4.LightBlue);
                graphics.FillRoundedRectangle(
                    d2DRectangle, 30, 30,
                    _solidBrush);

                d2DRectangle.Inflate(-10, -10);
                graphics.DrawText(
                    castedSettings.DisplayText,
                    _textFormat, d2DRectangle, _textBrush);
            });

            // Build 3D scene
            await mainRenderLoop.Scene.ManipulateSceneAsync(manipulator =>
            {
                // Create floor
                this.BuildStandardFloor(
                    manipulator, Scene.DEFAULT_LAYER_NAME);

                // Define Direct2D texture resource
                var resD2DTexture = manipulator.AddResource(
                    _ => new Direct2DTextureResource(d2DDrawingLayer, 256, 256));
                var resD2DMaterial = manipulator.AddStandardMaterialResource(resD2DTexture, enableShaderGeneratedBorder: true);

                // Create cube geometry resource
                var resGeometry = manipulator.AddResource(
                    _ => new GeometryResource(new CubeGeometryFactory()));

                // Create cube object
                var cubeMesh   = new Mesh(resGeometry, resD2DMaterial);
                cubeMesh.Color = Color4.GreenColor;
                cubeMesh.YPos  = 0.5f;
                cubeMesh.BuildAnimationSequence()
                .RotateEulerAnglesTo(new Vector3(0f, EngineMath.RAD_180DEG, 0f), TimeSpan.FromSeconds(2.0))
                .WaitFinished()
                .RotateEulerAnglesTo(new Vector3(0f, EngineMath.RAD_360DEG, 0f), TimeSpan.FromSeconds(2.0))
                .WaitFinished()
                .CallAction(() => cubeMesh.RotationEuler = Vector3.Zero)
                .ApplyAndRewind();
                manipulator.AddObject(cubeMesh);
            });
        }
コード例 #7
0
        /// <summary>
        /// Removes the given drawing layer.
        /// </summary>
        /// <param name="drawingLayer">The drawing layer.</param>
        public void RemoveDrawingLayer(Custom2DDrawingLayer drawingLayer)
        {
            CheckValid();

            m_owner.RemoveDrawingLayer(drawingLayer);
        }
コード例 #8
0
        /// <summary>
        /// Adds the given drawing layer.
        /// </summary>
        /// <param name="drawingLayer">The drawing layer.</param>
        public void AddDrawingLayer(Custom2DDrawingLayer drawingLayer)
        {
            CheckValid();

            m_owner.AddDrawingLayer(drawingLayer);
        }
コード例 #9
0
        public async Task MemoryRenderTarget_2DInitError()
        {
            await UnitTestHelper.InitializeWithGrahicsAsync();

            GDI.Bitmap screenshot = null;
            using (UnitTestHelper.FailTestOnInternalExceptions())
                using (GraphicsCore.AutomatedTest_NewTestEnviornment())
                    using (GraphicsCore.AutomatedTest_ForceD2DInitError())
                    {
                        GraphicsCore.Initialize();
                        Assert.True(GraphicsCore.IsInitialized);
                        Assert.False(GraphicsCore.Current.DefaultDevice.Supports2D);

                        using (SolidBrushResource solidBrush = new SolidBrushResource(Color4.Gray))
                            using (TextFormatResource textFormat = new TextFormatResource("Arial", 36))
                                using (SolidBrushResource textBrush = new SolidBrushResource(Color4.RedColor))
                                    using (MemoryRenderTarget memRenderTarget = new MemoryRenderTarget(1024, 1024))
                                    {
                                        memRenderTarget.ClearColor = Color4.CornflowerBlue;

                                        // Get and configure the camera
                                        PerspectiveCamera3D camera = memRenderTarget.Camera as PerspectiveCamera3D;
                                        camera.Position = new Vector3(0f, 5f, -7f);
                                        camera.Target   = new Vector3(0f, 0f, 0f);
                                        camera.UpdateCamera();

                                        // 2D rendering is made here
                                        Custom2DDrawingLayer d2dDrawingLayer = new Custom2DDrawingLayer((graphics) =>
                                        {
                                            RectangleF d2dRectangle = new RectangleF(10, 10, 236, 236);
                                            graphics.Clear(Color4.LightBlue);
                                            graphics.FillRoundedRectangle(
                                                d2dRectangle, 30, 30,
                                                solidBrush);

                                            d2dRectangle.Inflate(-10, -10);
                                            graphics.DrawText("Hello Direct2D!", textFormat, d2dRectangle, textBrush);
                                        });

                                        // Define scene
                                        await memRenderTarget.Scene.ManipulateSceneAsync((manipulator) =>
                                        {
                                            var resD2DTexture = manipulator.AddResource <Direct2DTextureResource>(
                                                () => new Direct2DTextureResource(d2dDrawingLayer, 256, 256));
                                            var resD2DMaterial = manipulator.AddSimpleColoredMaterial(resD2DTexture);
                                            var geoResource    = manipulator.AddResource <GeometryResource>(
                                                () => new GeometryResource(new PalletType(
                                                                               palletMaterial: NamedOrGenericKey.Empty,
                                                                               contentMaterial: resD2DMaterial)));

                                            GenericObject newObject = manipulator.AddGeneric(geoResource);
                                            newObject.RotationEuler = new Vector3(0f, EngineMath.RAD_90DEG / 2f, 0f);
                                            newObject.Scaling       = new Vector3(2f, 2f, 2f);
                                        });

                                        // Take screenshot
                                        await memRenderTarget.AwaitRenderAsync();

                                        screenshot = await memRenderTarget.RenderLoop.GetScreenshotGdiAsync();

                                        //screenshot.DumpToDesktop("Blub.png");
                                    }
                    }

            // Calculate and check difference
            Assert.NotNull(screenshot);
            bool isNearEqual = BitmapComparison.IsNearEqual(
                screenshot, Properties.Resources.ReferenceImage_SimpleObject);

            Assert.True(isNearEqual, "Difference to reference image is to big!");
        }
コード例 #10
0
        public override async Task OnStartupAsync(RenderLoop mainRenderLoop, SampleSettings settings)
        {
            mainRenderLoop.EnsureNotNull(nameof(mainRenderLoop));

            // Whole animation takes x milliseconds
            const float ANIMATION_MILLIS = 3000f;

            // 2D rendering is made here
            _solidBrush        = new SolidBrushResource(Color4.Gray);
            _animatedRectBrush = new SolidBrushResource(Color4.RedColor);

            var d2DDrawingLayer = new Custom2DDrawingLayer(graphics =>
            {
                // Draw the background
                var d2DRectangle = new RectangleF(10, 10, 236, 236);
                graphics.Clear(Color4.LightBlue);
                graphics.FillRoundedRectangle(
                    d2DRectangle, 30, 30,
                    _solidBrush);

                // Recalculate current location of the red rectangle on each frame
                var currentLocation = (float)(DateTime.UtcNow - DateTime.UtcNow.Date).TotalMilliseconds % ANIMATION_MILLIS / ANIMATION_MILLIS;
                var rectPos         = this.GetAnimationLocation(currentLocation, 165f, 165f);
                graphics.FillRectangle(
                    new RectangleF(
                        20f + rectPos.x,
                        20f + rectPos.y,
                        50f, 50f),
                    _animatedRectBrush);
            });

            // Build 3D scene
            await mainRenderLoop.Scene.ManipulateSceneAsync(manipulator =>
            {
                // Create floor
                this.BuildStandardFloor(
                    manipulator, Scene.DEFAULT_LAYER_NAME);

                // Define Direct2D texture resource
                var resD2DTexture = manipulator.AddResource(
                    _ => new Direct2DTextureResource(d2DDrawingLayer, 256, 256));
                var resD2DMaterial = manipulator.AddStandardMaterialResource(resD2DTexture);

                // Create cube geometry resource
                var resGeometry = manipulator.AddResource(
                    _ => new GeometryResource(new CubeGeometryFactory()));

                // Create cube object
                var cubeMesh   = new Mesh(resGeometry, resD2DMaterial);
                cubeMesh.Color = Color4.GreenColor;
                cubeMesh.YPos  = 0.5f;
                cubeMesh.BuildAnimationSequence()
                .RotateEulerAnglesTo(new Vector3(0f, EngineMath.RAD_180DEG, 0f), TimeSpan.FromSeconds(2.0))
                .WaitFinished()
                .RotateEulerAnglesTo(new Vector3(0f, EngineMath.RAD_360DEG, 0f), TimeSpan.FromSeconds(2.0))
                .WaitFinished()
                .CallAction(() => cubeMesh.RotationEuler = Vector3.Zero)
                .ApplyAndRewind();
                manipulator.AddObject(cubeMesh);
            });
        }
コード例 #11
0
        public async Task MemoryRenderTarget_2DInitError()
        {
            await TestUtilities.InitializeWithGraphicsAsync();

            // Ensure that any async disposal is  done before we create a new GraphicsCore
            await GraphicsCore.Current.MainLoop !.WaitForNextPassedLoopAsync();
            await GraphicsCore.Current.MainLoop !.WaitForNextPassedLoopAsync();

            GDI.Bitmap?screenshot = null;
            using (TestUtilities.FailTestOnInternalExceptions())
                using (GraphicsCore.AutomatedTest_NewTestEnvironment())
                {
                    await GraphicsCore.Loader
                    .ConfigureLoading(settings => settings.ThrowD2DInitDeviceError = true)
                    .LoadAsync();

                    Assert.IsTrue(GraphicsCore.IsLoaded);
                    Assert.IsFalse(GraphicsCore.Current.DefaultDevice !.Supports2D);

                    using (var solidBrush = new SolidBrushResource(Color4.Gray))
                        using (var textFormat = new TextFormatResource("Arial", 36))
                            using (var textBrush = new SolidBrushResource(Color4.RedColor))

                                using (var memRenderTarget = new MemoryRenderTarget(1024, 1024))
                                {
                                    memRenderTarget.ClearColor = Color4.CornflowerBlue;

                                    // Get and configure the camera
                                    var camera = (PerspectiveCamera3D)memRenderTarget.Camera;
                                    camera.Position = new Vector3(0f, 5f, -7f);
                                    camera.Target   = new Vector3(0f, 0f, 0f);
                                    camera.UpdateCamera();

                                    // 2D rendering is made here
                                    var d2dDrawingLayer = new Custom2DDrawingLayer(graphics =>
                                    {
                                        var d2dRectangle = new GDI.RectangleF(10, 10, 236, 236);
                                        graphics.Clear(Color4.LightBlue);
                                        graphics.FillRoundedRectangle(
                                            d2dRectangle, 30, 30,
                                            solidBrush);

                                        d2dRectangle.Inflate(-10, -10);
                                        graphics.DrawText("Hello Direct2D!", textFormat, d2dRectangle, textBrush);
                                    });

                                    // Define scene
                                    await memRenderTarget.Scene.ManipulateSceneAsync(manipulator =>
                                    {
                                        var resD2DTexture = manipulator.AddResource(
                                            _ => new Direct2DTextureResource(d2dDrawingLayer, 256, 256));
                                        var resD2DMaterial = manipulator.AddStandardMaterialResource(resD2DTexture);
                                        var resGeometry    = manipulator.AddResource(
                                            _ => new GeometryResource(new CubeGeometryFactory()));

                                        var newMesh           = manipulator.AddMeshObject(resGeometry, resD2DMaterial);
                                        newMesh.RotationEuler = new Vector3(0f, EngineMath.RAD_90DEG / 2f, 0f);
                                        newMesh.Scaling       = new Vector3(2f, 2f, 2f);
                                    });

                                    // Take screenshot
                                    await memRenderTarget.AwaitRenderAsync();

                                    screenshot = await memRenderTarget.RenderLoop.GetScreenshotGdiAsync();

                                    // TestUtilities.DumpToDesktop(screenshot, "Blub.png");
                                }
                }

            // Calculate and check difference
            Assert.IsNotNull(screenshot);
            var isNearEqual = BitmapComparison.IsNearEqual(
                screenshot, TestUtilities.LoadBitmapFromResource("ErrorHandling", "SimpleObject.png"));

            Assert.IsTrue(isNearEqual, "Difference to reference image is to big!");
        }
コード例 #12
0
        /// <summary>
        /// Removes the given drawing layer.
        /// </summary>
        /// <param name="drawingLayer">The drawing layer.</param>
        public void RemoveDrawingLayer(Custom2DDrawingLayer drawingLayer)
        {
            this.CheckValid();

            this.Owner.RemoveDrawingLayer(drawingLayer);
        }
コード例 #13
0
        /// <summary>
        /// Adds the given drawing layer.
        /// </summary>
        /// <param name="drawingLayer">The drawing layer.</param>
        public void AddDrawingLayer(Custom2DDrawingLayer drawingLayer)
        {
            this.CheckValid();

            this.Owner.AddDrawingLayer(drawingLayer);
        }
コード例 #14
0
        /// <summary>
        /// Called when the sample has to startup.
        /// </summary>
        /// <param name="targetRenderLoop">The target render loop.</param>
        public override async Task OnStartupAsync(RenderLoop targetRenderLoop)
        {
            targetRenderLoop.EnsureNotNull(nameof(targetRenderLoop));

            // Build dummy scene
            Scene        scene  = targetRenderLoop.Scene;
            Camera3DBase camera = targetRenderLoop.Camera as Camera3DBase;

            // 2D rendering is made here
            m_solidBrush = new SolidBrushResource(Color4.Gray);
            m_textFormat = new TextFormatResource("Arial", 36);
            m_textBrush  = new SolidBrushResource(Color4.RedColor);
            Custom2DDrawingLayer d2dDrawingLayer = new Custom2DDrawingLayer((graphics) =>
            {
                RectangleF d2dRectangle = new RectangleF(10, 10, 236, 236);
                graphics.Clear(Color4.LightBlue);
                graphics.FillRoundedRectangle(
                    d2dRectangle, 30, 30,
                    m_solidBrush);

                d2dRectangle.Inflate(-10, -10);
                graphics.DrawText("Hello Direct2D!", m_textFormat, d2dRectangle, m_textBrush);
            });

            // Build 3D scene
            await targetRenderLoop.Scene.ManipulateSceneAsync((manipulator) =>
            {
                // Create floor
                SampleSceneBuilder.BuildStandardFloor(
                    manipulator, Scene.DEFAULT_LAYER_NAME);

                // Define Direct2D texture resource
                var resD2DTexture = manipulator.AddResource <Direct2DTextureResource>(
                    () => new Direct2DTextureResource(d2dDrawingLayer, 256, 256));
                var resD2DMaterial = manipulator.AddSimpleColoredMaterial(resD2DTexture);

                // Create pallet geometry resource
                PalletType pType      = new PalletType();
                pType.PalletMaterial  = NamedOrGenericKey.Empty;
                pType.ContentMaterial = resD2DMaterial;
                var resPalletGeometry = manipulator.AddResource <GeometryResource>(
                    () => new GeometryResource(pType));

                // Create pallet object
                GenericObject palletObject = manipulator.AddGeneric(resPalletGeometry);
                palletObject.Color         = Color4.GreenColor;
                palletObject.EnableShaderGeneratedBorder();
                palletObject.BuildAnimationSequence()
                .RotateEulerAnglesTo(new Vector3(0f, EngineMath.RAD_180DEG, 0f), TimeSpan.FromSeconds(2.0))
                .WaitFinished()
                .RotateEulerAnglesTo(new Vector3(0f, EngineMath.RAD_360DEG, 0f), TimeSpan.FromSeconds(2.0))
                .WaitFinished()
                .CallAction(() => palletObject.RotationEuler = Vector3.Zero)
                .ApplyAndRewind();
            });

            // Configure camera
            camera.Position = new Vector3(2f, 2f, 2f);
            camera.Target   = new Vector3(0f, 0.5f, 0f);
            camera.UpdateCamera();
        }
コード例 #15
0
        /// <summary>
        /// Called when the sample has to startup.
        /// </summary>
        /// <param name="targetRenderLoop">The target render loop.</param>
        public override async Task OnStartupAsync(RenderLoop targetRenderLoop)
        {
            targetRenderLoop.EnsureNotNull(nameof(targetRenderLoop));

            // Build dummy scene
            Scene        scene  = targetRenderLoop.Scene;
            Camera3DBase camera = targetRenderLoop.Camera as Camera3DBase;

            // Create all objects for animation
            List <Vector2> starLocations = new List <Vector2>();

            m_starBitmap = new StandardBitmapResource(
                new AssemblyResourceLink(
                    typeof(SeeingSharpSampleResources),
                    "Bitmaps.StarColored_128x128.png"));
            m_borderBrush = new SolidBrushResource(Color4.SteelBlue);
            Random starCreateRandomizer = new Random();

            // 2D rendering is made here
            Custom2DDrawingLayer d2dDrawingLayer = new Custom2DDrawingLayer((graphics) =>
            {
                // Draw background
                RectangleF d2dRectangle = new RectangleF(10, 10, 236, 236);
                graphics.Clear(Color4.LightBlue);

                // Dynamically create new stars
                if ((starLocations.Count < 50) &&
                    (starCreateRandomizer.Next(0, 100) <= 70))
                {
                    starLocations.Add(new Vector2(
                                          (float)starCreateRandomizer.Next(0, 256),
                                          -32f));
                }

                // Update and draw all stars
                for (int loopStar = 0; loopStar < starLocations.Count; loopStar++)
                {
                    Vector2 actLocation = starLocations[loopStar];
                    if (actLocation.Y > 270f)
                    {
                        starLocations.RemoveAt(loopStar);
                        loopStar--;
                        continue;
                    }

                    actLocation.Y           = actLocation.Y + 4f;
                    starLocations[loopStar] = actLocation;

                    graphics.DrawBitmap(
                        m_starBitmap,
                        new RectangleF(
                            actLocation.X - 16f, actLocation.Y - 16f,
                            32f, 32f),
                        0.6f,
                        BitmapInterpolationMode.Linear);
                }

                // Draw a simple border
                graphics.DrawRectangle(graphics.ScreenBounds, m_borderBrush, 2f);
            });

            // Build 3D scene
            await targetRenderLoop.Scene.ManipulateSceneAsync((manipulator) =>
            {
                // Create floor
                SampleSceneBuilder.BuildStandardFloor(
                    manipulator, Scene.DEFAULT_LAYER_NAME);

                // Define Direct2D texture resource
                var resD2DTexture = manipulator.AddResource <Direct2DTextureResource>(
                    () => new Direct2DTextureResource(d2dDrawingLayer, 256, 256));
                var resD2DMaterial = manipulator.AddSimpleColoredMaterial(resD2DTexture);

                // Create pallet geometry resource
                PalletType pType      = new PalletType();
                pType.PalletMaterial  = NamedOrGenericKey.Empty;
                pType.ContentMaterial = resD2DMaterial;
                var resPalletGeometry = manipulator.AddResource <GeometryResource>(
                    () => new GeometryResource(pType));

                // Create pallet object
                GenericObject palletObject = manipulator.AddGeneric(resPalletGeometry);
                palletObject.Color         = Color4.GreenColor;
                palletObject.EnableShaderGeneratedBorder();
                palletObject.BuildAnimationSequence()
                .RotateEulerAnglesTo(new Vector3(0f, EngineMath.RAD_180DEG, 0f), TimeSpan.FromSeconds(2.0))
                .WaitFinished()
                .RotateEulerAnglesTo(new Vector3(0f, EngineMath.RAD_360DEG, 0f), TimeSpan.FromSeconds(2.0))
                .WaitFinished()
                .CallAction(() => palletObject.RotationEuler = Vector3.Zero)
                .ApplyAndRewind();
            });

            // Configure camera
            camera.Position = new Vector3(2f, 2f, 2f);
            camera.Target   = new Vector3(0f, 0.5f, 0f);
            camera.UpdateCamera();
        }