Example #1
0
        protected override void InitializeCore()
        {
            base.InitializeCore();

            sprite3DBatch = new Sprite3DBatch(Context.GraphicsDevice);

            var blendDesc = new BlendStateDescription(Blend.SourceAlpha, Blend.One)
            {
                RenderTarget0 =
                {
                    BlendEnable        = true,
                    ColorBlendFunction = BlendFunction.ReverseSubtract,
                    AlphaBlendFunction = BlendFunction.ReverseSubtract
                }
            };

            SubBlendState = blendDesc;

            blendDesc = new BlendStateDescription(Blend.DestinationColor, Blend.InverseSourceAlpha)
            {
                RenderTarget0 =
                {
                    BlendEnable        = true,
                    ColorBlendFunction = BlendFunction.Add,
                    AlphaSourceBlend   = Blend.Zero,
                    AlphaBlendFunction = BlendFunction.Add
                }
            };
            MultBlendState = blendDesc;
        }
Example #2
0
        protected override void Destroy()
        {
            sprite3DBatch?.Dispose();
            sprite3DBatch = null;

            base.Destroy();
        }
Example #3
0
        protected override void InitializeCore()
        {
            base.InitializeCore();

            sprite3DBatch = new Sprite3DBatch(Context.GraphicsDevice);

            var blendDesc = new BlendStateDescription(Blend.SourceAlpha, Blend.One)
            {
                RenderTarget0 =
                {
                    BlendEnable = true,
                    ColorBlendFunction = BlendFunction.ReverseSubtract,
                    AlphaBlendFunction = BlendFunction.ReverseSubtract
                }
            };
            SubBlendState = blendDesc;

            blendDesc = new BlendStateDescription(Blend.DestinationColor, Blend.InverseSourceAlpha)
            {
                RenderTarget0 =
                {
                    BlendEnable = true,
                    ColorBlendFunction = BlendFunction.Add,
                    AlphaSourceBlend = Blend.Zero,
                    AlphaBlendFunction = BlendFunction.Add
                }
            };
            MultBlendState = blendDesc;
        }
Example #4
0
        protected override async Task LoadContent()
        {
            await base.LoadContent();

            batch = new Sprite3DBatch(GraphicsDevice);
            sphere = Asset.Load<Texture>("Sphere");
            rotatedImages = Asset.Load<SpriteSheet>("RotatedImages");
            rasterizerState = RasterizerState.New(GraphicsDevice, new RasterizerStateDescription(CullMode.None));
        }
Example #5
0
        protected override async Task LoadContent()
        {
            await base.LoadContent();

            batch           = new Sprite3DBatch(GraphicsDevice);
            sphere          = Content.Load <Texture>("Sphere");
            rotatedImages   = Content.Load <SpriteSheet>("RotatedImages");
            rasterizerState = new RasterizerStateDescription(CullMode.None);
        }
        protected override void InitializeCore()
        {
            base.InitializeCore();

            sprite3DBatch = new Sprite3DBatch(Context.GraphicsDevice);

            var blendDesc = new BlendStateDescription(Blend.SourceAlpha, Blend.One);
            blendDesc.RenderTargets[0].BlendEnable = true;
            blendDesc.RenderTargets[0].ColorBlendFunction = BlendFunction.ReverseSubtract;
            blendDesc.RenderTargets[0].AlphaBlendFunction = BlendFunction.ReverseSubtract;
            SubBlendState = BlendState.New(Context.GraphicsDevice, blendDesc).DisposeBy(Context.GraphicsDevice);
            SubBlendState.Name = "Subtraction";

            blendDesc = new BlendStateDescription(Blend.DestinationColor, Blend.InverseSourceAlpha);
            blendDesc.RenderTargets[0].BlendEnable = true;
            blendDesc.RenderTargets[0].ColorBlendFunction = BlendFunction.Add;
            blendDesc.RenderTargets[0].AlphaSourceBlend = Blend.Zero;
            blendDesc.RenderTargets[0].AlphaBlendFunction = BlendFunction.Add;
            MultBlendState = BlendState.New(Context.GraphicsDevice, blendDesc).DisposeBy(Context.GraphicsDevice);
            MultBlendState.Name = "Multiplication";
        }
Example #7
0
        protected override void InitializeCore()
        {
            base.InitializeCore();

            sprite3DBatch = new Sprite3DBatch(Context.GraphicsDevice);

            var blendDesc = new BlendStateDescription(Blend.SourceAlpha, Blend.One);

            blendDesc.RenderTargets[0].BlendEnable        = true;
            blendDesc.RenderTargets[0].ColorBlendFunction = BlendFunction.ReverseSubtract;
            blendDesc.RenderTargets[0].AlphaBlendFunction = BlendFunction.ReverseSubtract;
            SubBlendState      = BlendState.New(Context.GraphicsDevice, blendDesc).DisposeBy(Context.GraphicsDevice);
            SubBlendState.Name = "Subtraction";

            blendDesc = new BlendStateDescription(Blend.DestinationColor, Blend.InverseSourceAlpha);
            blendDesc.RenderTargets[0].BlendEnable        = true;
            blendDesc.RenderTargets[0].ColorBlendFunction = BlendFunction.Add;
            blendDesc.RenderTargets[0].AlphaSourceBlend   = Blend.Zero;
            blendDesc.RenderTargets[0].AlphaBlendFunction = BlendFunction.Add;
            MultBlendState      = BlendState.New(Context.GraphicsDevice, blendDesc).DisposeBy(Context.GraphicsDevice);
            MultBlendState.Name = "Multiplication";
        }
Example #8
0
        protected override void InitializeCore()
        {
            base.InitializeCore();

            sprite3DBatch = new Sprite3DBatch(RenderSystem.GraphicsDevice);
        }
Example #9
0
 public ThreadContext(GraphicsDevice device)
 {
     isSrgb      = device.ColorSpace == ColorSpace.Gamma;
     SpriteBatch = new Sprite3DBatch(device);
 }
Example #10
0
        protected override void InitializeCore()
        {
            base.InitializeCore();

            sprite3DBatch = new Sprite3DBatch(Context.GraphicsDevice);
        }
        protected override void InitializeCore()
        {
            base.InitializeCore();

            sprite3DBatch = new Sprite3DBatch(Context.GraphicsDevice);
        }
Example #12
0
 /// <summary>
 /// Draw a sprite in the 3D world using the provided 3D sprite batch, world matrix and color.
 /// </summary>
 /// <param name="sprite">The sprite</param>
 /// <param name="spriteBatch">The sprite batch used to draw the sprite.</param>
 /// <param name="worldMatrix">The world matrix of the sprite</param>
 /// <param name="color">The color to apply on the sprite</param>
 /// <remarks>This function must be called between the <see cref="SpriteBatch.Begin(SiliconStudio.Paradox.Graphics.SpriteSortMode,SiliconStudio.Paradox.Graphics.Effect)"/> 
 /// and <see cref="SpriteBatch.End()"/> calls of the provided <paramref name="spriteBatch"/></remarks>
 /// <exception cref="ArgumentException">The provided frame index is not valid.</exception>
 /// <exception cref="ArgumentOutOfRangeException">The provided spriteBatch is null</exception>
 public static void Draw3D(this Sprite sprite, Sprite3DBatch spriteBatch, ref Matrix worldMatrix, ref Color color)
 {
     spriteBatch.Draw(sprite.Texture, ref worldMatrix, ref sprite.RegionInternal, ref sprite.SizeInternal, ref color, sprite.Orientation);
 }
 public ThreadContext(GraphicsDevice device)
 {
     SpriteBatch = new Sprite3DBatch(device);
 }
 public ThreadContext(GraphicsDevice device)
 {
     SpriteBatch = new Sprite3DBatch(device);
 }
Example #15
0
        protected override void InitializeCore()
        {
            base.InitializeCore();

            sprite3DBatch = new Sprite3DBatch(RenderSystem.GraphicsDevice);
        }