Skip to content

Instantly share code, notes, and snippets.

@baobao
Last active December 5, 2018 00:53
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/6c159dd8b9388b1cb37ef49310e2d007 to your computer and use it in GitHub Desktop.
Save baobao/6c159dd8b9388b1cb37ef49310e2d007 to your computer and use it in GitHub Desktop.
// divideX*3・・・分割数分の三角形を作成するために、三角形に必要な頂点数3を乗算する
for (int i = 0; i < divideX * 3; i++)
{
if (i % 3 == 0)
{
// 天面の出っ張り
indices[cnt++] = 0;
}
else if (i % 3 == 1)
{
indices[cnt++] = 1 + offsetIndex;
}
else if (i % 3 == 2)
{
var index = 2 + offsetIndex++;
// ループさせるためにindices[1]を使う
index = index > divideX ? indices[1] : index;
indices[cnt++] = index;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment