Exemplo n.º 1
0
        public override void RectTex(float x, float y, float w, float h, MpGe.Texture.Texture2DBase tex)
        {
            var t2 = tex as Texture.Texture2D;

            //     vb.commandList = FXSimple2D.commandList;
            //vb2.commandList = FXSimple2D.commandList;

            verts = new[]
            {
                new Vertex()
                {
                    Position = new Vector3(x, y, 0.0f), UV = new Vector2(0.0f, 0.0f)
                },
                new Vertex()
                {
                    Position = new Vector3(x + w, y, 0.0f), UV = new Vector2(1.0f, 0)
                },
                new Vertex()
                {
                    Position = new Vector3(x + w, y + h, 0.0f), UV = new Vector2(1.0f, 1.0f)
                },
                new Vertex()
                {
                    Position = new Vector3(x, y + h, 0.0f), UV = new Vector2(0, 1)
                }
            };



            vb = new Buffer.VertexBufferDX12(verts, indices, 0, 0);



            //t2.SetHeap();


            FXTextured2D._descriptorHeaps = new[] { FXTextured2D._cbvHeap };

            //            FXSimple2D.BeginRen();

            Effect.Simple2DConst s2 = new Effect.Simple2DConst
            {
                Proj = SharpDX.Matrix.OrthoOffCenterLH(0, 800, 600, 0, 0, 1)
            };

            // FXSimple2D.cbuf.CopyData(0, ref s2);
            FXTextured2D.cbuf.CopyData(0, ref s2);
            DXGlobal.Display.DrawBuffer(vb, FXTextured2D);
            //      DXGlobal.Display.DrawBuffer(vb2,FXSimple2D);

            //          FXSimple2D.EndRen();
        }
Exemplo n.º 2
0
        public override void Rect(float x, float y, float w, float h)
        {
            vb.commandList = FXSimple2D.commandList;
            //vb2.commandList = FXSimple2D.commandList;

            verts = new[]
            {
                new Vertex()
                {
                    Position = new Vector3(x, y, 0.0f), UV = new Vector2(0.0f, 0.0f)
                },
                new Vertex()
                {
                    Position = new Vector3(x + w, y, 0.0f), UV = new Vector2(1.0f, 0)
                },
                new Vertex()
                {
                    Position = new Vector3(x + w, y + h, 0.0f), UV = new Vector2(1.0f, 1.0f)
                },
                new Vertex()
                {
                    Position = new Vector3(x, y + h, 0.0f), UV = new Vector2(0, 1)
                }
            };



            vb = new Buffer.VertexBufferDX12(verts, indices, 0, 0);


            FXSimple2D.BeginRen();

            Effect.Simple2DConst s2 = new Effect.Simple2DConst
            {
                Proj = SharpDX.Matrix.OrthoOffCenterLH(0, 800, 600, 0, 0, 1)
            };

            FXSimple2D.cbuf.CopyData(0, ref s2);

            DXGlobal.Display.DrawBuffer(vb, FXSimple2D);
            //      DXGlobal.Display.DrawBuffer(vb2,FXSimple2D);

            FXSimple2D.EndRen();

            Console.WriteLine("Drawing!");
        }