private static void BuildFace(CubeFace face, Cube cube, BlockDirection direction, Vector3 position, MeshData mesh) { List <int> indices = mesh.GetIndices(cube.GetAtlasID()); Rect texCoord = cube.GetFace(face, direction); int iFace = (int)face; BuildUtils.AddFaceIndices(mesh.vertices.Count, indices); BuildUtils.AddVertices(mesh.vertices, vertices[iFace], position); mesh.normals.AddRange(normals[iFace]); BuildUtils.AddFaceUV(texCoord, mesh.uv); }
private static void BuildCross(Vector3 localPos, Vector3i worldPos, MeshData mesh) { Cross cross = (Cross)Map.Instance.GetBlock(worldPos).block; int atlas = cross.GetAtlasID(); BuildUtils.AddIndices(mesh.GetIndices(atlas), indices, mesh.vertices.Count); BuildUtils.AddVertices(mesh.vertices, vertices, localPos); mesh.normals.AddRange(normals); Rect uvRect = cross.GetFace(); List <Vector2> texCoords = mesh.uv; BuildUtils.AddFaceUV(uvRect, texCoords); BuildUtils.AddFaceUV(uvRect, texCoords); }