public override void Draw(Graphics graphics) { camera.Use(graphics); { Tests.Draw(graphics); testmaterial.SetPass(0); graphics.SetModelToWorldMatrix(testtransform.GetLocalToWorldMatrix()); graphics.DrawMesh(testmesh); shapesMaterial.SetPass(0); graphics.SetModelToWorldMatrix(Matrix4.identity); for (int i = 0; i < rays.Count; ++i) { Shapes.DrawLine(rays[i].position, rays[i].GetPoint(100), new Color(1, 0, 0, 0.5f)); } testmaterial.SetPass(0); // ??? graphics.SetModelToWorldMatrix(testtransformbillboard.GetLocalToWorldMatrix()); graphics.DrawTexture(billboard, new IntRect(new Vector2i(-billboard.GetWidth() / 2, 0), billboard.GetSize())); shapesMaterial.SetPass(0); graphics.SetModelToWorldMatrix(Matrix4.identity); //Shapes.DrawSphere(testtransformbillboard.GetPosition(), 0.1f, Color.green); } hudCamera.Use(graphics); { shapesMaterial.SetPass(0); Shapes.DrawRectangle((camera.WorldToScreenPixel(Vector2f.zero) / hudCamera.GetZoom()) - new Vector2f(5, 5), 10, 10, Color.blue); graphics.DrawTexture(proceduralTexture, new IntRect(Vector2i.zero, Math.Round(proceduralTexture.GetSize() * 0.125f))); } }
public override void Draw() { camera.Use(); { // grid draw shapesMaterial.Use(); Core.graphics.DrawMesh(gridMesh); // model test draw testmaterial.Use(); Core.graphics.SetModelToWorldMatrix(testtransform.GetLocalToWorldMatrix()); Core.graphics.DrawMesh(testmesh); // model test bounding box draw shapesMaterial.Use(); Core.graphics.SetWireframe(true); Models.DrawCube(testmesh.boundingBox, Color.red); Core.graphics.SetWireframe(false); // ray test draw shapesMaterial.Use(); Core.graphics.SetModelToWorldMatrix(Matrix4.identity); for (int i = 0; i < rays.Count; ++i) { Shapes.DrawLine(rays[i].position, rays[i].GetPoint(100), new Color(1, 0, 0, 0.5f)); } // model draw test //shapesMaterial.Use(); //Core.graphics.SetModelToWorldMatrix(Matrix4.identity); //Models.DrawCylinder(new Vector3f(10, 1, 10), 5f, 5f, 8f, 32, Color.green); //Core.graphics.SetWireframe(true); //Models.DrawCylinder(new Vector3f(10, 1, 10), 5f, 5f, 8f, 32, Color.maroon); //Core.graphics.SetWireframe(false); // billboard draw (note: last because is transparent object) spritesMaterial.Set("_MainTex", billboard); spritesMaterial.Use(); Core.graphics.SetModelToWorldMatrix(testtransformbillboard.GetLocalToWorldMatrix()); Sprites.DrawQuad(billboard.GetSize(), new IntRect(new Vector2i(-billboard.GetWidth() / 2, 0), billboard.GetSize())); } hudCamera.Use(); { // square indicator test draw shapesMaterial.Use(); Shapes.DrawRectangle((camera.WorldToScreenPixel(Vector2f.zero) / hudCamera.GetZoom()) - new Vector2f(5, 5), 10, 10, Color.blue); // procedural texture draw spritesMaterial.Set("_MainTex", proceduralTexture); spritesMaterial.Use(); Sprites.DrawQuad(proceduralTexture.GetSize(), new IntRect(Vector2i.zero, Math.Round(proceduralTexture.GetSize() * 0.125f))); } }