コード例 #1
0
    void MakeFace(int faceDir, float faceScale, Vector3 facePos)
    {
        vertices.AddRange(CubeMeshData.faceVerteices(faceDir, faceScale, facePos));

        int vCount = vertices.Count;// == 4

        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);
    }
コード例 #2
0
ファイル: VoxelRender.cs プロジェクト: earlquadra8/Sandbox-01
    void MakeFace(FaceDirection faceDir, float faceScale, Vector3 facePos)
    {
        vertices.AddRange(CubeMeshData.faceVerteices(faceDir, faceScale, facePos));// get the cooked vertices of faces

        int vCount = vertices.Count;

        // put the triangle order in a sequence; triangles = {0, 1, 2, 0, 2, 3, 4, 5, 6, 4, 6, 7...}
        triangles.Add(vCount - 4 + 0); // 0 relative pos of a face   0- -3
        triangles.Add(vCount - 4 + 1); // 1 relative pos of a face   |   |
        triangles.Add(vCount - 4 + 2); // 2 relative pos of a face   1- -2
        triangles.Add(vCount - 4 + 0); // 0 relative pos of a face
        triangles.Add(vCount - 4 + 2); // 2 relative pos of a face
        triangles.Add(vCount - 4 + 3); // 3 relative pos of a face
    }