public void Process(IDrawContext context) { // draw static model foreach (var pair in m_staticModelBuffer) { pair.Value.Sort((a, b) => { return(a.Z < b.Z ? -1 : 1); }); // z sort (near object has priority to render) var key = pair.Key; context.BeginDrawInstance(key.Mesh, key.Material, DrawSystem.RenderMode.Opaque); foreach (var instance in pair.Value) { context.AddInstance(instance.Layout, Color4.White); } context.EndDrawInstance(); } m_staticModelBuffer.Clear(); }