Beispiel #1
0
        public void PushQuad(Texture2D texture, RectangleF uvRectNormalized, RectangleF targetRectangle, Matrix transformMatrix, Color color)
        {
            var spriteData = new VertexBufferManager.VertexPositionColorTexture4();

            spriteData.Position0 = Vector3.Transform(new Vector3(targetRectangle.Left, targetRectangle.Top, 0), transformMatrix);
            spriteData.Position1 = Vector3.Transform(new Vector3(targetRectangle.Right, targetRectangle.Top, 0), transformMatrix);
            spriteData.Position2 = Vector3.Transform(new Vector3(targetRectangle.Right, targetRectangle.Bottom, 0), transformMatrix);
            spriteData.Position3 = Vector3.Transform(new Vector3(targetRectangle.Left, targetRectangle.Bottom, 0), transformMatrix);

            spriteData.TextureCoordinate0 = new Vector2(uvRectNormalized.X, uvRectNormalized.Y);
            spriteData.TextureCoordinate1 = new Vector2(uvRectNormalized.Max.X, uvRectNormalized.Y);
            spriteData.TextureCoordinate2 = new Vector2(uvRectNormalized.Max.X, uvRectNormalized.Max.Y);
            spriteData.TextureCoordinate3 = new Vector2(uvRectNormalized.X, uvRectNormalized.Max.Y);

            spriteData.Color0 = color;
            spriteData.Color1 = color;
            spriteData.Color2 = color;
            spriteData.Color3 = color;

            _vertexBufferManager.PushSprite(spriteData, texture);
        }
Beispiel #2
0
        public void PushQuad(Texture2D texture, RectangleF uvRectNormalized, Vector2 leftTop, Vector2 rightTop, Vector2 rightBottom, Vector2 leftBottom, Color color)
        {
            var spriteData = new VertexBufferManager.VertexPositionColorTexture4();

            spriteData.Position0 = new Vector3(leftTop, 0);
            spriteData.Position1 = new Vector3(rightTop, 0);
            spriteData.Position2 = new Vector3(rightBottom, 0);
            spriteData.Position3 = new Vector3(leftBottom, 0);

            spriteData.TextureCoordinate0 = new Vector2(uvRectNormalized.X, uvRectNormalized.Y);
            spriteData.TextureCoordinate1 = new Vector2(uvRectNormalized.Max.X, uvRectNormalized.Y);
            spriteData.TextureCoordinate2 = new Vector2(uvRectNormalized.Max.X, uvRectNormalized.Max.Y);
            spriteData.TextureCoordinate3 = new Vector2(uvRectNormalized.X, uvRectNormalized.Max.Y);

            spriteData.Color0 = color;
            spriteData.Color1 = color;
            spriteData.Color2 = color;
            spriteData.Color3 = color;

            _vertexBufferManager.PushSprite(spriteData, texture);
        }