public void CacheFaces(int textureIndex, float size) { blockFaces = new BlockFace[6]; count = 6; for (int i = 0; i < 6; i++) { blockFaces [i] = new BlockFace((FaceDirection)i, textureIndex, size); } }
public void CacheFaces(bool[] faces, int textureIndex, FaceLight[][] faceLights, FaceDirection[] shadedEdges) //public void CacheFaces(bool[] faces, int textureIndex) { if (faces.Length != 6) throw new ArgumentException("faces.Length should be 6 in this order back, front, top, bottom, left, right", "faces"); if (faceLights.Length != 6) throw new ArgumentException("faceLights.Length should be 6 in this order back, front, top, bottom, left, right", "faceLights"); blockFaces = new BlockFace[6]; count = 0; for (int i = 0; i < 6; i++) { if (faces [i]) { blockFaces [i] = new BlockFace((FaceDirection)i, textureIndex, faceLights [i], shadedEdges); count++; } else blockFaces [i] = null; } }
protected void AddFace(BlockFace blockFace, Vector3[] vertices, Vector3[] normals, Color32[] colors32, int[] triangles, Vector2[] uv, ref int indexVertices, ref int indexTriangles, ref int indexUv) { // Log.Add("AddFace"); var faceVertices = blockFace.vertices; var faceNormals = blockFace.normals; var faceColors32 = blockFace.colors32; var faceTriangles = blockFace.triangles; var faceUV = blockFace.uv; int indexVerticesBegin = indexVertices; var v = pos.GetVector3(); for (int i = 0; i < faceVertices.Length; i++) { vertices [indexVertices] = faceVertices [i] + v; normals [indexVertices] = faceNormals [i]; colors32 [indexVertices] = faceColors32 [i]; indexVertices++; } for (int i = 0; i < faceTriangles.Length; i++) { triangles [indexTriangles++] = indexVerticesBegin + faceTriangles [i]; } for (int i = 0; i < faceUV.Length; i++) { uv [indexUv++] = faceUV [i]; } }