public bool Equals(IShaderParameters other)
 {
     return(other != null &&
            other is TextShaderParameters otherTextShaderParameters &&
            otherTextShaderParameters.FontSize == FontSize &&
            otherTextShaderParameters.FontScale == FontScale);
 }
 public bool Equals(IShaderParameters other)
 {
     return(other != null &&
            other is FontMTSDFShaderParameters otherFontMTSDFShaderParameters &&
            otherFontMTSDFShaderParameters.PixelDistanceRange == PixelDistanceRange &&
            otherFontMTSDFShaderParameters.FontBaseSize == FontBaseSize &&
            otherFontMTSDFShaderParameters.FontSize == FontSize &&
            otherFontMTSDFShaderParameters.FontScale == FontScale);
 }
 public void Set(VertexPositionColorTexture[] vertexData, int[] indexData, bool isHollow, Shader shader, IShaderParameters shaderParameters, Texture texture)
 {
     VertexData       = vertexData;
     IndexData        = indexData;
     IsHollow         = isHollow;
     Shader           = shader;
     ShaderParameters = shaderParameters;
     Texture          = texture;
 }
        protected BaseShaderHandle(IShaderParameters parameters, IShaderDefinition <TShader> definition)
        {
            Transform                = parameters.Transform;
            Format                   = parameters.Format;
            SizeIndex                = parameters.SizeIndex;
            Arguments                = new ArgumentList(parameters.Arguments);
            LinearSampling           = parameters.LinearSampling;
            PerTextureLinearSampling = parameters.PerTextureLinearSampling;

            m_Definition = definition;
        }
Exemple #5
0
        public Mesh(IShaderParameters shaderParameters, float[] vertices, int[] indices)
        {
            if (shaderParameters == null || vertices == null || indices == null)
            {
                return;
            }

            this.ShaderParameters = shaderParameters;
            this.NumIndices       = indices.Length;

            this.VertexBufferObject = GL.GenBuffer();
            GL.BindBuffer(BufferTarget.ArrayBuffer, this.VertexBufferObject);
            GL.BufferData(BufferTarget.ArrayBuffer, vertices.Length * 4, vertices, BufferUsageHint.StaticDraw);

            this.IndexBufferObject = GL.GenBuffer();
            GL.BindBuffer(BufferTarget.ElementArrayBuffer, this.IndexBufferObject);
            GL.BufferData(BufferTarget.ElementArrayBuffer, indices.Length * 4, indices, BufferUsageHint.StaticDraw);

            this.VertexArrayObject = shaderParameters.CreateVertexArrayObject();
        }
Exemple #6
0
        protected override void Draw(
            Vector2 position,
            float rotation,
            Vector2 scale,
            ImageFlip flip,
            Color color,
            Vector2 scroll,
            Shader shader,
            IShaderParameters shaderParameters,
            Vector2 origin,
            float layerDepth
        ) {
            if (_vertices == null
             || _vertices.Length == 0
             || _indices == null
             || _indices.Length == 0
            ) {
                return;
            }

            Renderer.DrawVertices(
                texture:            Texture,
                vertexData:         _vertices,
                minVertexIndex:     0,
                verticesLength:     _vertices.Length,
                indices:            _indices,
                minIndex:           0,
                primitivesCount:    _triangleCount,
                isHollow:           false,
                position:           position,
                rotation:           rotation,
                scale:              scale,
                color:              new Color(color, (color.A / 255f) * Opacity),
                origin:             origin,
                scroll:             scroll,
                shader:             shader,
                shaderParameters:   shaderParameters,
                layerDepth:         layerDepth
            );
        }
 public Shader11Handle(IShaderParameters parameters, IShaderDefinition <IShader11> definition)
     : base(parameters, definition)
 {
 }
Exemple #8
0
        protected override void Draw(Vector2 position, float rotation, Vector2 scale, ImageFlip flip, Color color, Vector2 scroll, Shader shader, IShaderParameters shaderParameters, Vector2 origin, float layerDepth)
        {
            if (Font == null || Data == null)
            {
                return;
            }

            if (shaderParameters == ShaderParameters)
            {
                if (ShaderParameters == null)
                {
                    if (Font.ShaderParameters != null)
                    {
                        shaderParameters = ShaderParameters = new TextShaderParameters(Font)
                        {
                            FontResolutionScale = FontResolutionScale,
                        };
                    }
                }
                else if (ShaderParameters is TextShaderParameters textShaderParameters)
                {
                    if (textShaderParameters.Font != Font)
                    {
                        textShaderParameters.Font = Font;
                    }

                    textShaderParameters.FontResolutionScale = FontResolutionScale;
                }
            }

            Renderer.DrawString(
                Font,
                Data,
                StartIndex,
                EndIndex < 0 ? (Data.GlyphCount + EndIndex + 1) : (EndIndex - StartIndex + 1),
                new Rectangle(position, UnscaledSize),
                rotation,
                scale,
                flip,
                color * Opacity,
                origin,
                scroll,
                shader ?? Font.Shader,
                shaderParameters,
                layerDepth
                );
        }
Exemple #9
0
        public void DrawHollowPolygon(Polygon polygon, Vector2 position, Color color, float rotation, Vector2 scale, Vector2 origin, Vector2 scroll, Shader shader, IShaderParameters shaderParameters, float layerDepth = 1f)
        {
            if (Batch.BatchMode == BatchMode.Immediate)
            {
                PrepareBeforeRender();
                Batch.DrawHollowPolygon(polygon, position, color, rotation, scale, origin, scroll, shader, shaderParameters, layerDepth);
                AfterRender();
                return;
            }

            Batch.DrawHollowPolygon(polygon, position, color, rotation, scale, origin, scroll, shader, shaderParameters, layerDepth);
        }
Exemple #10
0
 public void Bind(Matrix4 model, Matrix4 view, Matrix4 projection, IShaderParameters parameters)
 {
     this.Bind(model, view, projection, (parameters as T) !);
 }
 protected override void Draw(Vector2 position, float rotation, Vector2 scale, ImageFlip flip, Color color, Vector2 scroll, Shader shader, IShaderParameters shaderParameters, Vector2 origin, float layerDepth)
 {
     if (Filled)
     {
         Renderer.DrawFilledRectangle(
             position,
             Size,
             new Color(color, (color.A / 255f) * Opacity),
             rotation,
             scale,
             origin,
             scroll,
             shader,
             shaderParameters,
             layerDepth
             );
     }
     else
     {
         Renderer.DrawHollowRectangle(
             position,
             Size,
             new Color(color, (color.A / 255f) * Opacity),
             rotation,
             scale,
             origin,
             scroll,
             shader,
             shaderParameters,
             layerDepth
             );
     }
 }
Exemple #12
0
        public void DrawHollowCircle(Vector2 center, float radius, Color color, float scale, Vector2 origin, Vector2 scroll, Shader shader, IShaderParameters shaderParameters, int segments = 0, float layerDepth = 1f)
        {
            if (Batch.BatchMode == BatchMode.Immediate)
            {
                PrepareBeforeRender();
                Batch.DrawHollowCircle(center, radius, color, scale, origin, scroll, shader, shaderParameters, segments, layerDepth);
                AfterRender();
                return;
            }

            Batch.DrawHollowCircle(center, radius, color, scale, origin, scroll, shader, shaderParameters, segments, layerDepth);
        }
Exemple #13
0
        protected override void Draw(Vector2 position, float rotation, Vector2 scale, ImageFlip flip, Color color, Vector2 scroll, Shader shader, IShaderParameters shaderParameters, Vector2 origin, float layerDepth)
        {
            if (DestinationRegion.IsEmpty)
            {
                Renderer.Draw(
                    Texture,
                    position,
                    SourceRegion.Position + ClippingRegion,
                    rotation,
                    scale,
                    flip,
                    new Color(color, (color.A / 255f) * Opacity),
                    origin,
                    scroll,
                    shader,
                    shaderParameters,
                    layerDepth
                    );
                return;
            }

            Renderer.Draw(
                Texture,
                new Rectangle(position, DestinationRegion.Size * scale),
                SourceRegion.Position + ClippingRegion,
                rotation,
                flip,
                new Color(color, (color.A / 255f) * Opacity),
                origin,
                scroll,
                shader,
                shaderParameters,
                layerDepth
                );
        }
        protected override void Draw(Vector2 position, float rotation, Vector2 scale, ImageFlip flip, Color color, Vector2 scroll, Shader shader, IShaderParameters shaderParameters, Vector2 origin, float layerDepth)
        {
            if (_arcFill <= 0.001f)
            {
                return;
            }

            Renderer.DrawVertices(
                _vertices,
                minVertexIndex: 0,
                verticesLength: _vertices.Length,
                indices: _indices,
                minIndex: 0,
                primitivesCount: Math.EqualsEstimate(_arcFill, 1f) ? Segments : (int)Math.Round(_arcFill * Segments),
                isHollow: !Filled,
                position: position,
                rotation: rotation,
                scale: scale,
                color: new Color(color, (color.A / 255f) * Opacity),
                origin: origin,
                scroll: scroll,
                shader: shader,
                shaderParameters: shaderParameters,
                layerDepth: layerDepth
                );
        }
Exemple #15
0
        public void DrawVertices(VertexPositionColor[] vertexData, int minVertexIndex, int verticesLength, int[] indices, int minIndex, int primitivesCount, bool isHollow, Vector2 position, float rotation, Vector2 scale, Color color, Vector2 origin, Vector2 scroll, Shader shader, IShaderParameters shaderParameters, float layerDepth = 1f)
        {
            if (Batch.BatchMode == BatchMode.Immediate)
            {
                PrepareBeforeRender();
                Batch.DrawVertices(vertexData, minVertexIndex, verticesLength, indices, minIndex, primitivesCount, isHollow, position, rotation, scale, color, origin, scroll, shader, shaderParameters, layerDepth);
                AfterRender();
                return;
            }

            Batch.DrawVertices(vertexData, minVertexIndex, verticesLength, indices, minIndex, primitivesCount, isHollow, position, rotation, scale, color, origin, scroll, shader, shaderParameters, layerDepth);
        }
Exemple #16
0
        public void Set(Texture texture, VertexPositionColorTexture[] vertexData, Vector2 position, float rotation, Vector2 scale, ImageFlip flip, Color color, Vector2 origin, Vector2 scroll, Shader shader, IShaderParameters shaderParameters, float layerDepth = 1f)
        {
            Texture          = texture;
            Shader           = shader;
            ShaderParameters = shaderParameters;

            Vector2 topLeft     = (-origin + new Vector2(vertexData[0].Position.X, vertexData[0].Position.Y)) * scale,
                    topRight    = (-origin + new Vector2(vertexData[1].Position.X, vertexData[1].Position.Y)) * scale,
                    bottomRight = (-origin + new Vector2(vertexData[2].Position.X, vertexData[2].Position.Y)) * scale,
                    bottomLeft  = (-origin + new Vector2(vertexData[3].Position.X, vertexData[3].Position.Y)) * scale;

            if (rotation != 0)
            {
                float cos = Math.Cos(rotation),
                      sin = Math.Sin(rotation);

                topLeft     = new Vector2(topLeft.X * cos - topLeft.Y * sin, topLeft.X * sin + topLeft.Y * cos);
                topRight    = new Vector2(topRight.X * cos - topRight.Y * sin, topRight.X * sin + topRight.Y * cos);
                bottomRight = new Vector2(bottomRight.X * cos - bottomRight.Y * sin, bottomRight.X * sin + bottomRight.Y * cos);
                bottomLeft  = new Vector2(bottomLeft.X * cos - bottomLeft.Y * sin, bottomLeft.X * sin + bottomLeft.Y * cos);
            }

            VertexData[0] = new VertexPositionColorTexture(
                new Vector3(position + topLeft, layerDepth + vertexData[0].Position.Z),
                new Color(vertexData[0].Color) * color,
                vertexData[0].TextureCoordinate
                );

            VertexData[1] = new VertexPositionColorTexture(
                new Vector3(position + topRight, layerDepth + vertexData[1].Position.Z),
                new Color(vertexData[1].Color) * color,
                vertexData[1].TextureCoordinate
                );

            VertexData[2] = new VertexPositionColorTexture(
                new Vector3(position + bottomRight, layerDepth + vertexData[2].Position.Z),
                new Color(vertexData[2].Color) * color,
                vertexData[2].TextureCoordinate
                );

            VertexData[3] = new VertexPositionColorTexture(
                new Vector3(position + bottomLeft, layerDepth + vertexData[3].Position.Z),
                new Color(vertexData[3].Color) * color,
                vertexData[3].TextureCoordinate
                );

            if ((flip & ImageFlip.Horizontal) != ImageFlip.None)
            {
                Microsoft.Xna.Framework.Vector2 texCoord = VertexData[1].TextureCoordinate;
                VertexData[1].TextureCoordinate = VertexData[0].TextureCoordinate;
                VertexData[0].TextureCoordinate = texCoord;

                texCoord = VertexData[2].TextureCoordinate;
                VertexData[2].TextureCoordinate = VertexData[3].TextureCoordinate;
                VertexData[3].TextureCoordinate = texCoord;
            }

            if ((flip & ImageFlip.Vertical) != ImageFlip.None)
            {
                Microsoft.Xna.Framework.Vector2 texCoord = VertexData[2].TextureCoordinate;
                VertexData[2].TextureCoordinate = VertexData[1].TextureCoordinate;
                VertexData[1].TextureCoordinate = texCoord;

                texCoord = VertexData[3].TextureCoordinate;
                VertexData[3].TextureCoordinate = VertexData[0].TextureCoordinate;
                VertexData[0].TextureCoordinate = texCoord;
            }
        }
Exemple #17
0
        public void Draw(Texture texture, Vector2 position, Rectangle?sourceRectangle, float rotation, Vector2 scale, ImageFlip flip, Color color, Vector2 origin, Vector2 scroll, Shader shader, IShaderParameters shaderParameters, float layerDepth = 1f)
        {
            if (!IsBatching)
            {
                throw new System.InvalidOperationException("Begin() must be called before any Draw() operation.");
            }

            ref SpriteBatchItem batchItem = ref GetBatchItem(AutoHandleAlphaBlendedSprites && color.A < byte.MaxValue);
Exemple #18
0
        public void Set(Texture texture, Vector2 position, Rectangle?sourceRectangle, float rotation, Vector2 scale, ImageFlip flip, Color color, Vector2 origin, Vector2 scroll, Shader shader, IShaderParameters shaderParameters, float layerDepth = 1f)
        {
            if (!sourceRectangle.HasValue)
            {
                sourceRectangle = new Rectangle(texture.Size);
            }

            Rectangle destinationRectagle = new Rectangle(position, sourceRectangle.Value.Size);

            Set(texture, destinationRectagle, sourceRectangle, rotation, scale, flip, color, origin, scroll, shader, shaderParameters, layerDepth);
        }
Exemple #19
0
        public void Set(Texture texture, Rectangle destinationRectangle, Rectangle?sourceRectangle, float rotation, Vector2 scale, ImageFlip flip, Color color, Vector2 origin, Vector2 scroll, Shader shader, IShaderParameters shaderParameters, float layerDepth = 1f)
        {
            Texture          = texture;
            Shader           = shader;
            ShaderParameters = shaderParameters;

            if (!sourceRectangle.HasValue)
            {
                sourceRectangle = new Rectangle(texture.Size);
            }

            Vector2 topLeft     = -origin * scale,
                    topRight    = (-origin + new Vector2(destinationRectangle.Width, 0f)) * scale,
                    bottomRight = (-origin + destinationRectangle.Size) * scale,
                    bottomLeft  = (-origin + new Vector2(0f, destinationRectangle.Height)) * scale;

            if (rotation != 0)
            {
                float cos = Math.Cos(rotation),
                      sin = Math.Sin(rotation);

                topLeft     = new Vector2(topLeft.X * cos - topLeft.Y * sin, topLeft.X * sin + topLeft.Y * cos);
                topRight    = new Vector2(topRight.X * cos - topRight.Y * sin, topRight.X * sin + topRight.Y * cos);
                bottomRight = new Vector2(bottomRight.X * cos - bottomRight.Y * sin, bottomRight.X * sin + bottomRight.Y * cos);
                bottomLeft  = new Vector2(bottomLeft.X * cos - bottomLeft.Y * sin, bottomLeft.X * sin + bottomLeft.Y * cos);
            }

            VertexData[0] = new VertexPositionColorTexture(
                new Vector3(destinationRectangle.TopLeft + topLeft, layerDepth),
                color,
                new Microsoft.Xna.Framework.Vector2(sourceRectangle.Value.Left / texture.Width, sourceRectangle.Value.Top / texture.Height)
                );

            VertexData[1] = new VertexPositionColorTexture(
                new Vector3(destinationRectangle.TopLeft + topRight, layerDepth),
                color,
                new Microsoft.Xna.Framework.Vector2(sourceRectangle.Value.Right / texture.Width, sourceRectangle.Value.Top / texture.Height)
                );

            VertexData[2] = new VertexPositionColorTexture(
                new Vector3(destinationRectangle.TopLeft + bottomRight, layerDepth),
                color,
                new Microsoft.Xna.Framework.Vector2(sourceRectangle.Value.Right / texture.Width, sourceRectangle.Value.Bottom / texture.Height)
                );

            VertexData[3] = new VertexPositionColorTexture(
                new Vector3(destinationRectangle.TopLeft + bottomLeft, layerDepth),
                color,
                new Microsoft.Xna.Framework.Vector2(sourceRectangle.Value.Left / texture.Width, sourceRectangle.Value.Bottom / texture.Height)
                );

            if ((flip & ImageFlip.Horizontal) != ImageFlip.None)
            {
                Microsoft.Xna.Framework.Vector2 texCoord = VertexData[1].TextureCoordinate;
                VertexData[1].TextureCoordinate = VertexData[0].TextureCoordinate;
                VertexData[0].TextureCoordinate = texCoord;

                texCoord = VertexData[2].TextureCoordinate;
                VertexData[2].TextureCoordinate = VertexData[3].TextureCoordinate;
                VertexData[3].TextureCoordinate = texCoord;
            }

            if ((flip & ImageFlip.Vertical) != ImageFlip.None)
            {
                Microsoft.Xna.Framework.Vector2 texCoord = VertexData[2].TextureCoordinate;
                VertexData[2].TextureCoordinate = VertexData[1].TextureCoordinate;
                VertexData[1].TextureCoordinate = texCoord;

                texCoord = VertexData[3].TextureCoordinate;
                VertexData[3].TextureCoordinate = VertexData[0].TextureCoordinate;
                VertexData[0].TextureCoordinate = texCoord;
            }
        }
Exemple #20
0
        protected override void Draw(Vector2 position, float rotation, Vector2 scale, ImageFlip flip, Color color, Vector2 scroll, Shader shader, IShaderParameters shaderParameters, Vector2 origin, float layerDepth)
        {
            if (FrameCount > 0)
            {
                Rectangle frameDestination = _frames[CurrentFrameIndex].Destination;
                if (frameDestination.Position != Vector2.Zero)
                {
                    origin += frameDestination.Position;
                }
            }

            base.Draw(position, rotation, scale, flip, color, scroll, shader, shaderParameters, origin, layerDepth);
        }
Exemple #21
0
 public void DrawHollowCircle(Circle circle, Color color, float scale, Vector2 origin, Vector2 scroll, Shader shader, IShaderParameters shaderParameters, int segments = 0, float layerDepth = 1f)
 {
     DrawHollowCircle(circle.Center, circle.Radius, color, scale, origin, scroll, shader, shaderParameters, segments, layerDepth);
 }
Exemple #22
0
 public void DrawHollowRectangle(Rectangle rectangle, Color color, float rotation, Vector2 scale, Vector2 origin, Vector2 scroll, Shader shader, IShaderParameters shaderParameters, float layerDepth = 1f)
 {
     DrawHollowRectangle(rectangle.Position, rectangle.Size, color, rotation, scale, origin, scroll, shader, shaderParameters, layerDepth);
 }
 protected GenericShaderHandle(IShaderParameters parameters, IShaderDefinition <TShader> definition)
     : base(parameters, definition)
 {
 }
Exemple #24
0
        protected override void Draw(Vector2 position, float rotation, Vector2 scale, ImageFlip flip, Color color, Vector2 scroll, Shader shader, IShaderParameters shaderParameters, Vector2 origin, float layerDepth)
        {
            if (Columns == 0 || Rows == 0 || TileSize.Area == 0)
            {
                return;
            }

            BasicShader bs = Game.Instance.BasicShader;

            // transformations
            bs.World = Microsoft.Xna.Framework.Matrix.CreateScale(scale.X, scale.Y, 1f)
                       * Microsoft.Xna.Framework.Matrix.CreateTranslation(-origin.X, -origin.Y, 0f)
                       * Microsoft.Xna.Framework.Matrix.CreateRotationZ(Math.ToRadians(rotation))
                       * Microsoft.Xna.Framework.Matrix.CreateTranslation(position.X, position.Y, 0f)
                       * Renderer.World;

            bs.View       = Renderer.View;
            bs.Projection = Renderer.Projection;

            // material
            bs.SetMaterial(color, Opacity);

            GraphicsDevice device = Game.Instance.GraphicsDevice;

            // texture
            bs.TextureEnabled = false;

            shaderParameters?.ApplyParameters(shader);

            // we need to manually update every GraphicsDevice states here
            device.BlendState        = Renderer.Batch.BlendState;
            device.SamplerStates[0]  = Renderer.Batch.SamplerState;
            device.DepthStencilState = Renderer.Batch.DepthStencilState;
            device.RasterizerState   = Renderer.Batch.RasterizerState;

            // grid
            foreach (object pass in bs)
            {
                device.Indices = _indexBuffer;
                device.SetVertexBuffer(_vertexBuffer);
                device.DrawIndexedPrimitives(PrimitiveType.LineList, 0, 0, _vertexBuffer.VertexCount, 0, Columns - 1 + (Rows - 1));
            }

            // borders
            if (_useBorderColor)
            {
                bs.SetMaterial(BorderColor, Opacity);
            }

            shaderParameters?.ApplyParameters(shader);

            // we need to manually update every GraphicsDevice states here
            device.BlendState        = Renderer.Batch.BlendState;
            device.SamplerStates[0]  = Renderer.Batch.SamplerState;
            device.DepthStencilState = Renderer.Batch.DepthStencilState;
            device.RasterizerState   = Renderer.Batch.RasterizerState;

            foreach (object pass in bs)
            {
                device.Indices = _indexBuffer;
                device.SetVertexBuffer(_vertexBuffer);
                device.DrawIndexedPrimitives(PrimitiveType.LineList, _usingVerticesCount - 4, 0, _vertexBuffer.VertexCount, _usingIndicesCount - 8, 4);
            }

            bs.ResetParameters();
        }
Exemple #25
0
        protected override void Draw(Vector2 position, float rotation, Vector2 scale, ImageFlip flip, Color color, Vector2 scroll, Shader shader, IShaderParameters shaderParameters, Vector2 origin, float layerDepth)
        {
            if (CurrentTrack != null && CurrentTrack.FramesDestinations != null)
            {
                // frame destination works like a guide to where render at local space
                // 'frameDestination.position' should be interpreted as 'origin'
                ref Rectangle frameDestination = ref CurrentTrack.CurrentFrameDestination;

                if (frameDestination.Position != Vector2.Zero)
                {
                    // frame region defines the crop rectangle at it's texture
                    ref Rectangle frameRegion = ref CurrentTrack.CurrentFrameRegion;

                    if (FlippedHorizontally)
                    {
                        if (FlippedVertically)
                        {
                            float rightSideSpacing  = frameDestination.Width - frameRegion.Width + frameDestination.X,
                                  bottomSideSpacing = frameDestination.Height - frameRegion.Height + frameDestination.Y;

                            origin = new Vector2(
                                (frameRegion.Width - origin.X) - rightSideSpacing,
                                (frameRegion.Height - origin.Y) - bottomSideSpacing
                                );
                        }
                        else
                        {
                            float rightSideSpacing = frameDestination.Width - frameRegion.Width + frameDestination.X;

                            origin = new Vector2(
                                (frameRegion.Width - origin.X) - rightSideSpacing,
                                origin.Y + frameDestination.Y
                                );
                        }
                    }
                    else if (FlippedVertically)
                    {
                        float bottomSideSpacing = frameDestination.Height - frameRegion.Height + frameDestination.Y;

                        origin = new Vector2(
                            origin.X + frameDestination.X,
                            (frameRegion.Height - origin.Y) - bottomSideSpacing
                            );
                    }
                    else
                    {
                        origin += frameDestination.Position;
                    }
                }
 protected override void Draw(Vector2 position, float rotation, Vector2 scale, ImageFlip flip, Color color, Vector2 scroll, Shader shader, IShaderParameters shaderParameters, Vector2 origin, float layerDepth)
 {
     Renderer.DrawVertices(
         _vertices,
         minVertexIndex: 0,
         verticesLength: _vertices.Length,
         indices: _indices,
         minIndex: 0,
         primitivesCount: 2 * Segments,
         isHollow: false,
         position: position,
         rotation: rotation,
         scale: scale,
         color: new Color(color, (color.A / 255f) * Opacity),
         origin: origin,
         scroll: scroll,
         shader: shader,
         shaderParameters: shaderParameters,
         layerDepth: layerDepth
         );
 }
 protected override void Draw(Vector2 position, float rotation, Vector2 scale, ImageFlip flip, Color color, Vector2 scroll, Shader shader, IShaderParameters shaderParameters, Vector2 origin, float layerDepth)
 {
     Renderer.DrawLines(
         Points,
         position,
         new Color(color, (color.A / 255f) * Opacity),
         rotation,
         scale,
         origin,
         scroll,
         shader,
         shaderParameters,
         cyclic: false,
         layerDepth: layerDepth
         );
 }
Exemple #28
0
 protected abstract void Draw(Vector2 position, float rotation, Vector2 scale, ImageFlip flip, Color color, Vector2 scroll, Shader shader, IShaderParameters shaderParameters, Vector2 origin, float layerDepth);
 protected override void Draw(Vector2 position, float rotation, Vector2 scale, ImageFlip flip, Color color, Vector2 scroll, Shader shader, IShaderParameters shaderParameters, Vector2 origin, float layerDepth)
 {
     Graphic.Render(
         Graphic.Position + position,
         Graphic.Rotation + rotation,
         Graphic.Scale * scale,
         Graphic.Flipped ^ flip,
         Graphic.Color * color * Opacity,
         Graphic.Scroll * scroll,
         shader,
         Graphic.Layer + ConvertLayerDepthToLayer(layerDepth)
         );
 }
Exemple #30
0
        public void DrawFilledRectangle(Vector2 position, Size size, Color color, float rotation, Vector2 scale, Vector2 origin, Vector2 scroll, Shader shader, IShaderParameters shaderParameters, float layerDepth = 1f)
        {
            if (Batch.BatchMode == BatchMode.Immediate)
            {
                PrepareBeforeRender();
                Batch.DrawFilledRectangle(position, size, color, rotation, scale, origin, scroll, shader, shaderParameters, layerDepth);
                AfterRender();
                return;
            }

            Batch.DrawFilledRectangle(position, size, color, rotation, scale, origin, scroll, shader, shaderParameters, layerDepth);
        }