public void Render(IVertexBuilder target, BlockRenderContext context, Int3 pos) { var current = context.Current[pos]; BlockData[] neighbors = { pos.X == Chunk.RowLast ? context.Neighbors[0][0, pos.Y, pos.Z] : context.Current[pos.X + 1, pos.Y, pos.Z], pos.X == 0 ? context.Neighbors[1][Chunk.RowLast, pos.Y, pos.Z] : context.Current[pos.X - 1, pos.Y, pos.Z], pos.Y == Chunk.RowLast ? context.Neighbors[2][pos.X, 0, pos.Z] : context.Current[pos.X, pos.Y + 1, pos.Z], pos.Y == 0 ? context.Neighbors[3][pos.X, Chunk.RowLast, pos.Z] : context.Current[pos.X, pos.Y - 1, pos.Z], pos.Z == Chunk.RowLast ? context.Neighbors[4][pos.X, pos.Y, 0] : context.Current[pos.X, pos.Y, pos.Z + 1], pos.Z == 0 ? context.Neighbors[5][pos.X, pos.Y, Chunk.RowLast] : context.Current[pos.X, pos.Y, pos.Z - 1] }; // Right Left Top Bottom Front Back for (uint i = 0; i < 6; ++i) { if (AdjacentTest(current, neighbors[i])) { target.Rect(pos, tex[i].Tex, i, 0, 15); } } }
public static void Render(IVertexBuilder target, int id, BlockRenderContext context, Int3 pos) { if (Renderers.Count > 0 && Renderers[id] != null) { Renderers[id].Render(target, context, pos); } }