Skip to content

Instantly share code, notes, and snippets.

@baobao
Last active December 12, 2018 07:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save baobao/1ee09e0696017d21e9d646c7a6785e3e to your computer and use it in GitHub Desktop.
Save baobao/1ee09e0696017d21e9d646c7a6785e3e to your computer and use it in GitHub Desktop.
// 底面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;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment