示例#1
0
        public void Render(int tileType, int x, int y, int z)
        {
            // Assign the mesh data to be processed
            meshInfo = meshLookup[tileType];

            // Calculate the texture coordinates for this block based on its location within the area
            textureOffsetY = -(Tile.Size.Y / Area.Size.Y);
            textureBox.Min.X = (x / (float)Area.Size.X) * textureScale.X;
            textureBox.Min.Y = ((y / (float)Area.Size.Y) + textureOffsetY) * textureScale.Y;
            textureBox.Min.Z = (z / (float)Area.Size.Z) * textureScale.X;
            textureBox.Max.X = ((x + 1) / (float)Area.Size.X) * textureScale.X;
            textureBox.Max.Y = (((y - 1) / (float)Area.Size.Y) + textureOffsetY) * textureScale.Y;
            textureBox.Max.Z = ((z + 1) / (float)Area.Size.Z) * textureScale.X;

            y++;

            // Render all visible sides
            if (buildInfo.TileVisibleSides[(int)TileSide.Top])
            {
                AddTop(x, y, z);
            }

            if (buildInfo.TileVisibleSides[(int)TileSide.Bottom])
            {
                AddBottom(x, y, z);
            }

            if (buildInfo.TileVisibleSides[(int)TileSide.Left])
            {
                AddLeft(x, y, z);
            }

            if (buildInfo.TileVisibleSides[(int)TileSide.Right])
            {
                AddRight(x, y, z);
            }

            if (buildInfo.TileVisibleSides[(int)TileSide.Front])
            {
                AddFront(x, y, z);
            }

            if (buildInfo.TileVisibleSides[(int)TileSide.Back])
            {
                AddBack(x, y, z);
            }
        }
示例#2
0
 public void Initialize(ref AreaModelBuildInfo buildInfo, ref TerrainMeshBuildInfo[] meshLookup)
 {
     this.buildInfo = buildInfo;
     this.meshLookup = meshLookup;
 }