Render shapes

    A grid of dirt with blocks on it
    Examples of different render shapes
    Most tiles render as a cube, but this is only one of 15 shapes that can be rendered by default, here is the complete list of every shape along with it's ID (which is returned from the tiles getRenderShape method):
    - 0: Block, a cube, for example: dirt
    - 1: Cross, a flat texture crossed, for example: saplings
    - 2: Torch, a possibly angled rectangle
    - 3: Fire (not rendered), returned by FireTile::getRenderShape for future use
    - 4: Water, any liquid
    - 6: Row, like cross but doubled, for example: crops
    - 7: Door, a smooshed rectangle
    - 8: Ladder, a flat texture along a wall
    - 10: Stairs, layered rectangles
    - 11: Fence, a pole with two possible arms per side
    - 13: Cactus, a cube with smaller sides and a possibly smaller top
    - 14: Bed, a very short cube
    - 18: Thin fence, a thin version of fence, for example: glass panes
    - 19: Stem, like cross but diagonal
    - 21: Fence gate, a thin floating rectangle
    By default, anything not on this list won't get rendered, using -1 to denote that it shouldn't be rendered is standard. The shape of a tile isn't necessarily the size and positions.

    Custom Shapes[edit | edit source]

    There are a few types of custom shapes, ones made of a single rectangle, ones made of many rectangles, and ones made of many polygons (which may or may not be rectangles).

    Single Rectangle[edit | edit source]

    A single rectangle is the easiest, all that is needed is to call Tile::setShape on the tile, this is how slabs work.

    Multiple Rectangles[edit | edit source]

    To make a shape out of multiple rectangles, the TileRenderer::tesselateInWorld function must be changed. This function has many helper functions for different shapes, which can be seen in, however in minecraft-pi many of these helper functions are inlined, or partially inlined. Then Tile::setShape can be called in-between TileRenderer::tesselateBlockInWorld calls, this is how stairs and fences work.

    Polygons[edit | edit source]

    This is the hardest method to make custom shapes, it also requires changing TileRenderer::tesselateInWorld. using Tesselator draw the vertexes for the shape, every four vertexes will become a polygon so be sure that the number of calls is divisible by four or it will leak into other shapes and ruin them. A simple square can be drawn like this:
    Tesselator::vertex(Tesselator::instance, x,     y, z);
    Tesselator::vertex(Tesselator::instance, x + 1, y, z);
    Tesselator::vertex(Tesselator::instance, x + 1, y, z + 1);
    Tesselator::vertex(Tesselator::instance, x,     y, z + 1);
    Do note that this will only be visible from under the block.