Beispiel #1
0
        public void TextureAtlas_LoadsAndRendersCorrectly_FromPreprocessedAsset()
        {
            var sbatch = default(SpriteBatch);
            var atlas  = default(TextureAtlas);

            var result = GivenAnUltravioletApplication()
                         .WithContent(content =>
            {
                sbatch = SpriteBatch.Create();

                var atlasAssetPath = CreateMachineSpecificAssetCopy(content, "Sprites/Textures/ExplosionAtlasXml_Preprocessed.xml");
                if (!content.Preprocess <TextureAtlas>(atlasAssetPath, false))
                {
                    Assert.Fail("Failed to preprocess asset.");
                }

                atlas = content.Load <TextureAtlas>(atlasAssetPath + ".uvc");
            })
                         .Render(uv =>
            {
                uv.GetGraphics().Clear(Color.CornflowerBlue);

                sbatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);

                var cx = 0;
                var cy = 0;

                for (int y = 0; y < 3; y++)
                {
                    for (int x = 0; x < 5; x++)
                    {
                        sbatch.Draw(atlas, new Vector2(cx, cy), atlas[$"Explosion_{(y * 5) + x + 1:D2}"], Color.White);
                        cx = cx + 100;
                    }
                    cx = 0;
                    cy = cy + 100;
                }

                sbatch.End();
            });

            TheResultingImage(result)
            .ShouldMatch(@"Resources/Expected/Graphics/TextureAtlas_LoadsAndRendersCorrectly_FromPreprocessedAsset.png");
        }
        public void SpriteFont_LoadsAndRendersCorrectly_FromPreprocessedAsset()
        {
            var spriteBatch = default(SpriteBatch);
            var spriteFont  = default(SpriteFont);

            var result = GivenAnUltravioletApplication()
                         .WithContent(content =>
            {
                spriteBatch = SpriteBatch.Create();

                var fontAssetPath = CreateMachineSpecificAssetCopy(content, "Fonts/Arial16Xml_Preprocessed");
                if (!content.Preprocess <SpriteFont>(fontAssetPath))
                {
                    Assert.Fail("Failed to preprocess asset.");
                }

                spriteFont = content.Load <SpriteFont>(fontAssetPath + ".uvc");
            })
                         .Render(uv =>
            {
                var cx = 0;
                var cy = 0;

                spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);

                spriteBatch.DrawString(spriteFont.Regular, "Hello, world!", new Vector2(cx, cy), Color.White);
                cy += spriteFont.Regular.LineSpacing;

                spriteBatch.DrawString(spriteFont.Bold, "Hello, world!", new Vector2(cx, cy), Color.White);
                cy += spriteFont.Bold.LineSpacing;

                spriteBatch.DrawString(spriteFont.Italic, "Hello, world!", new Vector2(cx, cy), Color.White);
                cy += spriteFont.Italic.LineSpacing;

                spriteBatch.DrawString(spriteFont.BoldItalic, "Hello, world!", new Vector2(cx, cy), Color.White);
                cy += spriteFont.BoldItalic.LineSpacing;

                spriteBatch.End();
            });

            TheResultingImage(result)
            .ShouldMatch(@"Resources/Expected/Graphics/Graphics2D/SpriteFont_LoadsAndRendersCorrectly_FromPreprocessedAsset.png");
        }
Beispiel #3
0
        protected override void OnLoadingContent()
        {
            this.content = ContentManager.Create("Content");
            LoadContentManifests();

            this.spriteFont         = this.content.Load <SpriteFont>(GlobalFontID.SegoeUI);
            this.spriteBatch        = SpriteBatch.Create();
            this.textRenderer       = new TextRenderer();
            this.textLayoutCommands = new TextLayoutCommandStream();

            for (int i = 0; i < this.soundEffectPlayers.Length; i++)
            {
                this.soundEffectPlayers[i] = SoundEffectPlayer.Create();
            }

            this.soundEffect = this.content.Load <SoundEffect>(GlobalSoundEffectID.Explosion);

            base.OnLoadingContent();
        }
        public void DynamicTextureAtlas_IsConstructedCorrectly()
        {
            var sbatch  = default(SpriteBatch);
            var atlas   = default(DynamicTextureAtlas);
            var surface = default(Surface2D);

            var result = GivenAnUltravioletApplication()
                         .WithContent(content =>
            {
                sbatch = SpriteBatch.Create();

                atlas = DynamicTextureAtlas.Create(512, 512, 8);

                surface = content.Load <Surface2D>("Surfaces/bear");
                TheResultingValue(BlitSurfaceToDynamicTextureAtlas(atlas, surface)).ShouldBe(true);

                surface = content.Load <Surface2D>("Surfaces/frog");
                TheResultingValue(BlitSurfaceToDynamicTextureAtlas(atlas, surface)).ShouldBe(true);

                surface = content.Load <Surface2D>("Surfaces/pig");
                TheResultingValue(BlitSurfaceToDynamicTextureAtlas(atlas, surface)).ShouldBe(true);

                surface = content.Load <Surface2D>("Surfaces/panda");
                TheResultingValue(BlitSurfaceToDynamicTextureAtlas(atlas, surface)).ShouldBe(true);

                surface = content.Load <Surface2D>("Surfaces/dog");
                TheResultingValue(BlitSurfaceToDynamicTextureAtlas(atlas, surface)).ShouldBe(true);

                surface = content.Load <Surface2D>("Surfaces/walrus");
                TheResultingValue(BlitSurfaceToDynamicTextureAtlas(atlas, surface)).ShouldBe(true);
            })
                         .Render(uv =>
            {
                uv.GetGraphics().Clear(Color.CornflowerBlue);

                sbatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend);
                sbatch.Draw(atlas, Vector2.Zero, Color.White);
                sbatch.End();
            });

            TheResultingImage(result)
            .ShouldMatch(@"Resources/Expected/Graphics/DynamicTextureAtlas_IsConstructedCorrectly.png");
        }
Beispiel #5
0
        protected override void OnLoadingContent()
        {
            this.content = ContentManager.Create("Content");
            LoadContentManifests(content);
            LoadLocalizationDatabases(content);

            this.spriteFont         = this.content.Load <SpriteFont>(GlobalFontID.SegoeUI);
            this.spriteBatch        = SpriteBatch.Create();
            this.stringBuffer       = new StringBuilder();
            this.stringFormatter    = new StringFormatter();
            this.textRenderer       = new TextRenderer();
            this.textLayoutCommands = new TextLayoutCommandStream();

            this.song       = this.content.Load <Song>(GlobalSongID.DeepHaze);
            this.songPlayer = SongPlayer.Create();
            this.songPlayer.Play(this.song);

            base.OnLoadingContent();
        }
Beispiel #6
0
        protected override void OnLoadingContent()
        {
            this.content = ContentManager.Create("Content");
            LoadContentManifests();

            this.spriteBatch = SpriteBatch.Create();

            // A render target is composed of one or more render buffers. Each render buffer represents a particular
            // output channel from a pixel shader, such as color or depth.
            this.rbufferColor = Texture2D.CreateRenderBuffer(RenderBufferFormat.Color, 256, 256);
            this.rbufferDepth = Texture2D.CreateRenderBuffer(RenderBufferFormat.Depth16, 256, 256);
            this.rtarget      = RenderTarget2D.Create(256, 256);

            // Render buffers must be explicitly attached to a render target before they can be used.
            this.rtarget.Attach(this.rbufferColor);
            this.rtarget.Attach(this.rbufferDepth);

            base.OnLoadingContent();
        }
Beispiel #7
0
        public void Sprite_LoadsAndRendersCorrectly_FromJson()
        {
            var spriteBatch = default(SpriteBatch);
            var sprite      = default(Sprite);

            var result = GivenAnUltravioletApplication()
                         .WithContent(content =>
            {
                spriteBatch = SpriteBatch.Create();
                sprite      = content.Load <Sprite>("Sprites/ExplosionJson");
            })
                         .Render(uv =>
            {
                spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);

                var animation = sprite["Explosion"];
                var cx        = 50;
                var cy        = 50;

                for (int y = 0; y < 5; y++)
                {
                    for (int x = 0; x < 5; x++)
                    {
                        var ix = (y * 5) + x;
                        if (ix >= animation.Frames.Count)
                        {
                            break;
                        }

                        var frame = animation.Frames[ix];
                        spriteBatch.DrawFrame(frame, new Rectangle(cx, cy, frame.Width, frame.Height), Color.White, 0f);
                        cx = cx + 100;
                    }
                    cx = 50;
                    cy = cy + 100;
                }
                spriteBatch.End();
            });

            TheResultingImage(result)
            .ShouldMatch(@"Resources/Expected/Graphics/Graphics2D/Sprite_LoadsAndRendersCorrectly_FromJson.png");
        }
Beispiel #8
0
        /// <summary>
        /// Called when the application is loading content.
        /// </summary>
        protected override void OnLoadingContent()
        {
            this.content = ContentManager.Create("Content");

            LoadLocalizationDatabases();
            LoadInputBindings();
            LoadContentManifests();
            LoadCursors();

            this.spriteBatch = SpriteBatch.Create();
            this.spriteFont  = this.content.Load <SpriteFont>(GlobalFontID.SegoeUI);

            this.textRenderer  = new TextRenderer();
            this.textFormatter = new StringFormatter();
            this.textBuffer    = new StringBuilder();

            GC.Collect(2);

            base.OnLoadingContent();
        }
Beispiel #9
0
        public void SpriteBatch_CanRenderSimpleStrings()
        {
            var spriteBatch = default(SpriteBatch);
            var spriteFont  = default(SpriteFont);

            var result = GivenAnUltravioletApplication()
                         .WithContent(content =>
            {
                spriteBatch = SpriteBatch.Create();
                spriteFont  = content.Load <SpriteFont>("Fonts/SegoeUI");
            })
                         .Render(uv =>
            {
                spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
                spriteBatch.DrawString(spriteFont.Regular, "Hello, world!", Vector2.Zero, Color.White);
                spriteBatch.End();
            });

            TheResultingImage(result).ShouldMatch(@"Resources/Expected/Graphics/Graphics2D/SpriteBatch_CanRenderSimpleStrings.png");
        }
Beispiel #10
0
        protected override void OnLoadingContent()
        {
            this.content = ContentManager.Create("Content");
            LoadContentManifests();

            this.spriteFont  = this.content.Load <SpriteFont>(GlobalFontID.SegoeUI);
            this.spriteBatch = SpriteBatch.Create();

            this.textRenderer = new TextRenderer();
            this.textBlock    = new ScrollingTextBlock(textRenderer, spriteFont,
                                                       "Lorem ipsum dolor sit amet,|delay| consectetur adipiscing elit. |delay:200|" +
                                                       "|speed:5|Donec |speed:1|commodo|speed:5| massa in odio dapibus blandit. |delay:200|" +
                                                       "|speed|Etiam quis auctor magna. |delay:200|Mauris varius lacus eu vulputate pretium. |delay:200|" +
                                                       "|speed:100|Cras a turpis id enim luctus laoreet. |delay:200|" +
                                                       "|speed|Praesent sed faucibus nunc,|delay| in vestibulum libero. |delay:200|" +
                                                       "Sed vitae bibendum ex. |delay:200|" +
                                                       "Etiam vel aliquet ipsum,|delay| sit amet scelerisque est.", 256, 256);

            base.OnLoadingContent();
        }
        public void SpriteBatch_CanBlendColorsCorrectly(ColorEncoding encoding)
        {
            var spriteBatch = default(SpriteBatch);
            var blendBg     = default(Texture2D);
            var blendFg     = default(Texture2D);

            var result = GivenAnUltravioletApplication()
                         .WithConfiguration(config =>
            {
                if (encoding == ColorEncoding.Srgb)
                {
                    config.SrgbBuffersEnabled           = true;
                    config.SrgbDefaultForTexture2D      = true;
                    config.SrgbDefaultForRenderBuffer2D = true;
                }
            })
                         .WithContent(content =>
            {
                spriteBatch = SpriteBatch.Create();
                blendBg     = content.Load <Texture2D>("Textures/ColorBlendBg");
                blendFg     = content.Load <Texture2D>("Textures/ColorBlendFg");
            })
                         .Render(uv =>
            {
                spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend);
                spriteBatch.Draw(blendBg, Vector2.Zero, Color.White);
                spriteBatch.Draw(blendFg, Vector2.Zero, Color.White);
                spriteBatch.End();
            });

            if (encoding == ColorEncoding.Linear)
            {
                TheResultingImage(result)
                .ShouldMatch(@"Resources/Expected/Graphics/Graphics2D/SpriteBatch_CanBlendColorsCorrectly.png");
            }
            else
            {
                TheResultingImage(result)
                .ShouldMatch(@"Resources/Expected/Graphics/Graphics2D/SpriteBatch_CanBlendColorsCorrectly(sRGB).png");
            }
        }
        public void SpriteBatch_CorrectlyRendersEastAsianCharacters(FontKind fontKind)
        {
            var spriteBatch = default(SpriteBatch);
            var spriteFont  = default(UltravioletFont);

            var result = GivenAnUltravioletApplication()
                         .WithPlugin(fontKind == FontKind.FreeType2 ? new FreeTypeFontPlugin() : null)
                         .WithContent(content =>
            {
                spriteBatch = SpriteBatch.Create();
                spriteFont  = content.Load <UltravioletFont>(fontKind == FontKind.SpriteFont ?
                                                             "Fonts/MSGothic16" : "Fonts/NotoSansCJKjp-Regular");
            })
                         .Render(uv =>
            {
                spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);

                // From the Japanese Wikipedia article "日本"
                spriteBatch.DrawString(spriteFont.Regular,
                                       "日本国(にっぽんこく、にほんこく)、または日本\n" +
                                       "(にっぽん、にほん)は、東アジアに位置する日本\n" +
                                       "列島(北海道・本州・四国・九州の主要四島および\n" +
                                       "それに付随する島々)及び、南西諸島・小笠原諸島\n" +
                                       "などの諸島嶼から成る島国である。日本語が事実上\n" +
                                       "の公用語として使用されている。首都は事実上東京\n" +
                                       "都とされている。", Vector2.Zero, Color.White);

                spriteBatch.End();
            });

            if (fontKind == FontKind.SpriteFont)
            {
                TheResultingImage(result)
                .ShouldMatch(@"Resources/Expected/Graphics/Graphics2D/SpriteBatch_CorrectlyRendersEastAsianCharacters.png");
            }
            else
            {
                TheResultingImage(result)
                .ShouldMatch(@"Resources/Expected/Graphics/Graphics2D/SpriteBatch_CorrectlyRendersEastAsianCharacters(FreeType2).png");
            }
        }
Beispiel #13
0
        protected override void OnLoadingContent()
        {
            this.content = ContentManager.Create("Content");
            LoadContentManifests();

            this.spriteBatch   = SpriteBatch.Create();
            this.textRenderer  = new TextRenderer();
            this.textFormatter = new StringFormatter();
            this.textBuffer    = new StringBuilder();

            var xbox360ControllerIcons = content.Load <Sprite>(GlobalSpriteID.Xbox360Controller);

            for (int i = 0; i < xbox360ControllerIcons.AnimationCount; i++)
            {
                this.textRenderer.LayoutEngine.RegisterIcon(
                    xbox360ControllerIcons[i].Name,
                    xbox360ControllerIcons[i], 32, 32);
            }

            base.OnLoadingContent();
        }
        public void Load(ContentManager content)
        {
            Contract.Require(content, nameof(content));

            this.SpriteBatch = SpriteBatch.Create();
            this.Font        = content.Load <UltravioletFont>(FontPath ?? "Fonts/Garamond");

            this.TextIcons = content.Load <Sprite>(IconPath ?? "Sprites/InterfaceIcons");

            this.TextParserResult = new TextParserTokenStream();
            this.TextParser       = new TextParser();
            this.TextParser.Parse(this.Text, this.TextParserResult, this.TextParserOptions);

            this.TextLayoutResult = new TextLayoutCommandStream();
            this.TextLayoutEngine = new TextLayoutEngine();
            this.TextLayoutEngine.RegisterIcon("test", this.TextIcons["test"]);

            this.TextRenderer = new TextRenderer();
            this.TextRenderer.RegisterIcon("test", this.TextIcons["test"]);

            this.BlankTexture = Texture2D.CreateTexture(1, 1);
            this.BlankTexture.SetData(new[] { Color.White });
        }
Beispiel #15
0
        public void TextureAtlas_LoadsAndRendersCorrectly_FromJson()
        {
            var sbatch = default(SpriteBatch);
            var atlas  = default(TextureAtlas);

            var result = GivenAnUltravioletApplication()
                         .WithContent(content =>
            {
                sbatch = SpriteBatch.Create();
                atlas  = content.Load <TextureAtlas>("Sprites/Textures/ExplosionAtlasJson");
            })
                         .Render(uv =>
            {
                uv.GetGraphics().Clear(Color.CornflowerBlue);

                sbatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);

                var cx = 0;
                var cy = 0;

                for (int y = 0; y < 3; y++)
                {
                    for (int x = 0; x < 5; x++)
                    {
                        sbatch.Draw(atlas, new Vector2(cx, cy), atlas[$"Explosion_{(y * 5) + x + 1:D2}"], Color.White);
                        cx = cx + 100;
                    }
                    cx = 0;
                    cy = cy + 100;
                }

                sbatch.End();
            });

            TheResultingImage(result)
            .ShouldMatch(@"Resources/Expected/Graphics/TextureAtlas_LoadsAndRendersCorrectly_FromJson.png");
        }
Beispiel #16
0
        public void Surface2D_RendersCorrectly_WhenFlippedDuringBlit()
        {
            var sbatch        = default(SpriteBatch);
            var surfaceOutput = default(Surface2D);
            var surfaceInput  = default(Surface2D);
            var texture       = default(Texture2D);

            var result = GivenAnUltravioletApplication()
                         .WithContent(content =>
            {
                sbatch = SpriteBatch.Create();

                surfaceOutput = Surface2D.Create(128, 128);
                surfaceOutput.Clear(Color.Lime);

                surfaceInput = content.Load <Surface2D>("Surfaces/Test");
                surfaceInput.ProcessAlpha(true, null);
                surfaceInput.Blit(surfaceOutput, new Point2(0, 0), SurfaceFlipDirection.None);
                surfaceInput.Blit(surfaceOutput, new Point2(64, 0), SurfaceFlipDirection.Horizontal);
                surfaceInput.Blit(surfaceOutput, new Point2(0, 64), SurfaceFlipDirection.Vertical);

                texture = surfaceOutput.CreateTexture();
            })
                         .Render(uv =>
            {
                uv.GetGraphics().Clear(Color.CornflowerBlue);

                sbatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend);

                sbatch.Draw(texture, new RectangleF(0, 0, 128, 128), Color.White);

                sbatch.End();
            });

            TheResultingImage(result)
            .ShouldMatch(@"Resources/Expected/Graphics/Surface2D_RendersCorrectly_WhenFlippedDuringBlit.png");
        }
        public void SpriteFont_LoadsAndRendersCorrectly_FromJson()
        {
            var spriteBatch = default(SpriteBatch);
            var spriteFont  = default(SpriteFont);

            var result = GivenAnUltravioletApplication()
                         .WithContent(content =>
            {
                spriteBatch = SpriteBatch.Create();
                spriteFont  = content.Load <SpriteFont>("Fonts/Arial16Json");
            })
                         .Render(uv =>
            {
                var cx = 0;
                var cy = 0;

                spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);

                spriteBatch.DrawString(spriteFont.Regular, "Hello, world!", new Vector2(cx, cy), Color.White);
                cy += spriteFont.Regular.LineSpacing;

                spriteBatch.DrawString(spriteFont.Bold, "Hello, world!", new Vector2(cx, cy), Color.White);
                cy += spriteFont.Bold.LineSpacing;

                spriteBatch.DrawString(spriteFont.Italic, "Hello, world!", new Vector2(cx, cy), Color.White);
                cy += spriteFont.Italic.LineSpacing;

                spriteBatch.DrawString(spriteFont.BoldItalic, "Hello, world!", new Vector2(cx, cy), Color.White);
                cy += spriteFont.BoldItalic.LineSpacing;

                spriteBatch.End();
            });

            TheResultingImage(result)
            .ShouldMatch(@"Resources/Expected/Graphics/Graphics2D/SpriteFont_LoadsAndRendersCorrectly_FromJson.png");
        }
Beispiel #18
0
        protected override void OnLoadingContent()
        {
            this.content = ContentManager.Create("Content");
            LoadContentManifests();

            this.spriteFontGaramond = this.content.Load <SpriteFont>(GlobalFontID.Garamond);
            this.spriteFontSegoe    = this.content.Load <SpriteFont>(GlobalFontID.SegoeUI);
            this.spriteBatch        = SpriteBatch.Create();
            this.textRenderer       = new TextRenderer();

            this.textRenderer.LayoutEngine.RegisterFont("segoe", this.spriteFontSegoe);
            this.textRenderer.LayoutEngine.RegisterFont("garamond", this.spriteFontGaramond);

            this.textRenderer.LayoutEngine.RegisterStyle("preset1", new TextStyle(spriteFontGaramond, true, null, Color.Lime));
            this.textRenderer.LayoutEngine.RegisterStyle("preset2", new TextStyle(spriteFontSegoe, null, true, Color.Red));

            var spriteOK     = this.content.Load <Sprite>(GlobalSpriteID.OK);
            var spriteCancel = this.content.Load <Sprite>(GlobalSpriteID.Cancel);

            this.textRenderer.LayoutEngine.RegisterIcon("ok", spriteOK[0]);
            this.textRenderer.LayoutEngine.RegisterIcon("cancel", spriteCancel[0]);

            base.OnLoadingContent();
        }
        public void SpriteBatch_RendersSpecifiedSubstitutionGlyphForSpriteFont()
        {
            var spriteBatch = default(SpriteBatch);
            var spriteFont  = default(SpriteFont);

            var result = GivenAnUltravioletApplication()
                         .WithContent(content =>
            {
                spriteBatch = SpriteBatch.Create();
                spriteFont  = content.Load <SpriteFont>("Fonts/Arial16JsonSubstitution");
            })
                         .Render(uv =>
            {
                spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);

                spriteBatch.DrawString(spriteFont.Regular,
                                       "plus ça change, plus c'est la même chose", Vector2.Zero, Color.White);

                spriteBatch.End();
            });

            TheResultingImage(result)
            .ShouldMatch(@"Resources/Expected/Graphics/Graphics2D/SpriteBatch_RendersSpecifiedSubstitutionGlyphForSpriteFont.png");
        }
 public static void Initialize(UltravioletContext context)
 {
     _context     = context;
     _spriteBatch = SpriteBatch.Create();
 }
Beispiel #21
0
        public void UltravioletGraphics_CanRender3DTextures_FromPreprocessedAsset()
        {
            var spriteBatch   = default(SpriteBatch);
            var spriteTexture = default(Texture2D);
            var spriteEffect  = default(Effect);
            var lutIdentity   = default(Texture3D);
            var lutShifted    = default(Texture3D);
            var lutPosterize  = default(Texture3D);

            var result = GivenAnUltravioletApplication()
                         .WithContent(content =>
            {
                spriteBatch   = SpriteBatch.Create();
                spriteTexture = content.Load <Texture2D>("Textures\\ColorGradingBackground");
                spriteEffect  = content.Load <Effect>("Effects\\ColorGradingEffect");

                var lutIdentityPath = CreateMachineSpecificAssetCopy(content, "Textures\\ColorGradingIdentity");
                if (!content.Preprocess <Texture3D>(lutIdentityPath))
                {
                    Assert.Fail("Failed to preprocess asset.");
                }

                var lutShiftedPath = CreateMachineSpecificAssetCopy(content, "Textures\\ColorGradingShifted");
                if (!content.Preprocess <Texture3D>(lutShiftedPath))
                {
                    Assert.Fail("Failed to preprocess asset.");
                }

                var lutPosterizePath = CreateMachineSpecificAssetCopy(content, "Textures\\ColorGradingPosterize");
                if (!content.Preprocess <Texture3D>(lutPosterizePath))
                {
                    Assert.Fail("Failed to preprocess asset.");
                }

                lutIdentity  = content.Load <Texture3D>(lutIdentityPath + ".uvc");
                lutShifted   = content.Load <Texture3D>(lutShiftedPath + ".uvc");
                lutPosterize = content.Load <Texture3D>(lutPosterizePath + ".uvc");
            })
                         .Render(uv =>
            {
                var gfx      = uv.GetGraphics();
                var window   = uv.GetPlatform().Windows.GetPrimary();
                var viewport = new Viewport(0, 0, window.Compositor.Width, window.Compositor.Height);

                gfx.SetSamplerState(1, SamplerState.PointClamp);

                spriteEffect.Parameters["ColorGradingLUT"].SetValue(lutIdentity);

                spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Opaque, SamplerState.PointClamp, null, null, spriteEffect);
                spriteBatch.Draw(spriteTexture, new RectangleF(0, 0, spriteTexture.Width, spriteTexture.Height), Color.White);
                spriteBatch.End();

                spriteEffect.Parameters["ColorGradingLUT"].SetValue(lutShifted);

                spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Opaque, SamplerState.PointClamp, null, null, spriteEffect);
                spriteBatch.Draw(spriteTexture, new RectangleF(viewport.Width / 3, 0, spriteTexture.Width, spriteTexture.Height), Color.White);
                spriteBatch.End();

                spriteEffect.Parameters["ColorGradingLUT"].SetValue(lutPosterize);

                spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Opaque, SamplerState.PointClamp, null, null, spriteEffect);
                spriteBatch.Draw(spriteTexture, new RectangleF(2 * viewport.Width / 3, 0, spriteTexture.Width, spriteTexture.Height), Color.White);
                spriteBatch.End();
            });

            TheResultingImage(result)
            .ShouldMatch(@"Resources/Expected/Graphics/UltravioletGraphics_CanRender3DTextures_FromPreprocessedAsset.png");
        }