baobao
12/5/2018 - 1:41 AM

球底面部分のコード

// 底面Index
offsetIndex = vertices.Length - 1 - divideX;
// 1周したときのループIndex
var loopIndex = offsetIndex;

for (int i = divideX * 3 - 1; i >= 0; i--)
{
    if (i % 3 == 0)
    {
        // 底面の先頂点
        indices[cnt++] = vertices.Length - 1;
        offsetIndex++;
    }
    else if (i % 3 == 1)
    {
        indices[cnt++] = offsetIndex;
    }
    else if (i % 3 == 2)
    {
        var value = 1 + offsetIndex;
        if (value >= vertices.Length - 1)
        {
            value = loopIndex;
        }

        indices[cnt++] = value;
    }
}