Example #1
0
        public override void FillRect(RectangleF rect, Gradient color)
        {
            // defining our screen sized quad, note the Z value of 1f to place it in the background
            mFillRectVerts[0].Position = new Microsoft.DirectX.Vector3(rect.Left, rect.Top, 0f);
            mFillRectVerts[0].Color    = color.TopLeft.ToArgb();

            mFillRectVerts[1].Position = new Microsoft.DirectX.Vector3(rect.Right, rect.Top, 0f);
            mFillRectVerts[1].Color    = color.TopRight.ToArgb();

            mFillRectVerts[2].Position = new Microsoft.DirectX.Vector3(rect.Left, rect.Bottom, 0f);
            mFillRectVerts[2].Color    = color.BottomLeft.ToArgb();

            mFillRectVerts[3] = mFillRectVerts[1];
            //vert[3].Position = new Vector4(rect.Right, rect.Top, 0f, 1f);
            //vert[3].Color = clr;

            mFillRectVerts[4].Position = new Microsoft.DirectX.Vector3(rect.Right, rect.Bottom, 0f);
            mFillRectVerts[4].Color    = color.BottomRight.ToArgb();

            mFillRectVerts[5] = mFillRectVerts[2];
            //vert[5].Position = new Vector4(rect.Left, rect.Bottom, 0f, 1f);
            //vert[5].Color = clr;

            mDevice.DrawBuffer.Flush();

            mDevice.AlphaBlend = true;

            mDevice.SetDeviceStateTexture(null);
            mDevice.AlphaArgument1 = TextureArgument.Diffuse;

            mDevice.VertexFormat = CustomVertex.PositionColored.Format;
            mDevice.Device.DrawUserPrimitives(PrimitiveType.TriangleList, 2, mFillRectVerts);
        }
Example #2
0
        protected void DrawWithoutVBNoRotation(RectangleF srcRect, RectangleF destRect, bool alphaBlend)
        {
            mDevice.Interpolation = InterpolationHint;

            //CustomVertex.TransformedColoredTextured[] verts = new CustomVertex.TransformedColoredTextured[4];
            int startIndex = 0;

            AddRectToVB(mVerts, startIndex, srcRect, destRect);

            mDevice.SetDeviceStateTexture(mTexture.Value);
            mDevice.AlphaBlend = alphaBlend;

            mDevice.Device.VertexFormat = CustomVertex.PositionColoredTextured.Format;
            mDevice.Device.DrawUserPrimitives(PrimitiveType.TriangleStrip, 2, mVerts);
        }
Example #3
0
        public void Flush()
        {
            if (mVertPointer == 0)
            {
                return;
            }

            mDevice.SetDeviceStateTexture(mTexture);
            mDevice.AlphaBlend   = mAlphaBlend;
            mDevice.VertexFormat = PositionColorNormalTexture.Format;

            try
            {
                mDevice.Device.DrawIndexedUserPrimitives
                    (PrimitiveType.TriangleList, 0, mVertPointer,
                    mIndexPointer / 3, mIndices, true, mVerts);
            }
            catch { }

            mVertPointer  = 0;
            mIndexPointer = 0;
        }