void MakeFace(int dir, float faceScale, Vector3 facePos) { vertices.AddRange(CubeMeshData.faceVertices(dir, faceScale, facePos)); int vCount = vertices.Count; triangles.Add(vCount - 4); triangles.Add(vCount - 4 + 1); triangles.Add(vCount - 4 + 2); triangles.Add(vCount - 4); triangles.Add(vCount - 4 + 2); triangles.Add(vCount - 4 + 3); }
public static void MakeFace(int dir, float faceScale, Vector3 facePos) { vertices.AddRange(CubeMeshData.faceVertices(dir, faceScale, facePos)); //add this range of vertices to the vertices list int vertCount = vertices.Count; //the initial number of vertices is 4 so subtract 4 from the vertex count //the clockwise direction to build the mesh triangles is 0,1,2 (one triangle of the quad face) and 0,2,3 (second triangle of face) triangles.Add(vertCount - 4 + 0); triangles.Add(vertCount - 4 + 1); triangles.Add(vertCount - 4 + 2); triangles.Add(vertCount - 4 + 0); triangles.Add(vertCount - 4 + 2); triangles.Add(vertCount - 4 + 3); }
void MakeFace(int dir, float scale, Vector3 pos) { vertices.AddRange(CubeMeshData.faceVertices(dir, scale, pos)); // print (dir); int vCount = vertices.Count; // print (vCount); triangles.Add(vCount - 4 + 0); triangles.Add(vCount - 4 + 1); triangles.Add(vCount - 4 + 2); triangles.Add(vCount - 4 + 0); triangles.Add(vCount - 4 + 2); triangles.Add(vCount - 4 + 3); // triangles.Add (vCount -4); // triangles.Add (vCount -4 + 1); // triangles.Add (vCount -4 + 2); // triangles.Add (vCount -4); // triangles.Add (vCount -4 + 2); // triangles.Add (vCount -4 + 3); }
void MakeFace(Direction dir, float faceScale, Vector3 facePos, int cubeType) { vertices.AddRange(CubeMeshData.faceVertices(dir, faceScale, facePos)); UVs.Add(VoxelTextureAtlas.getUVs(cubeType, 0)); UVs.Add(VoxelTextureAtlas.getUVs(cubeType, 1)); UVs.Add(VoxelTextureAtlas.getUVs(cubeType, 2)); UVs.Add(VoxelTextureAtlas.getUVs(cubeType, 3)); int vCount = vertices.Count; // Indices Structure // 3--2 // | | // 0--1 triangles.Add(vCount - 4); triangles.Add(vCount - 4 + 1); triangles.Add(vCount - 4 + 2); triangles.Add(vCount - 4); triangles.Add(vCount - 4 + 2); triangles.Add(vCount - 4 + 3); }
//MakeFace - Draws faces void MakeFace(Direction dir, float faceScale, Vector3 facePos, int type, int meshNum) { meshList[meshNum].AddFace(CubeMeshData.faceVertices(dir, faceScale, facePos), (int)dir); //adds face in voxelmesh object. }