public Sample1App() { SetPlatform(new PlatformDX12(), new DisplayMetrics(20, 20, 800, 600, "Sample1-Dx12", ColorFormat.RGB)); Create = Global.Creator; MpGe.Texture.Texture2DBase tex = null; Platform.Init = () => { Create = Global.Creator; Draw = Create.CreateDraw2D(); tex = Create.LoadTexture("Data/Tex/tex1.png"); Console.WriteLine("Init App"); }; Platform.Update = () => { Console.WriteLine("Update"); }; var x = 20; Platform.Draw = () => { //x = x + Draw.RectTex(-0.2f, -0.2f, 0.4f, 0.4f, tex); // Draw.Rect(400, 400, 300, 300); }; }
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(); }