|
|
|
@ -405,15 +405,15 @@ namespace AZ
|
|
|
|
|
|
|
|
|
|
|
|
for (uint16_t ring = 0; ring < numRings - 2; ++ring)
|
|
|
|
for (uint16_t ring = 0; ring < numRings - 2; ++ring)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
uint16_t firstVertOfThisRing = 1 + ring * numSections;
|
|
|
|
uint16_t firstVertOfThisRing = static_cast<uint16_t>(1 + ring * numSections);
|
|
|
|
uint16_t firstVertOfNextRing = 1 + (ring + 1) * numSections;
|
|
|
|
uint16_t firstVertOfNextRing = static_cast<uint16_t>(1 + (ring + 1) * numSections);
|
|
|
|
for (uint16_t section = 0; section < numSections; ++section)
|
|
|
|
for (uint16_t section = 0; section < numSections; ++section)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
uint32_t nextSection = (section + 1) % numSections;
|
|
|
|
uint32_t nextSection = (section + 1) % numSections;
|
|
|
|
|
|
|
|
|
|
|
|
// line around ring
|
|
|
|
// line around ring
|
|
|
|
indices.push_back(firstVertOfThisRing + section);
|
|
|
|
indices.push_back(firstVertOfThisRing + section);
|
|
|
|
indices.push_back(firstVertOfThisRing + nextSection);
|
|
|
|
indices.push_back(static_cast<uint16_t>(firstVertOfThisRing + nextSection));
|
|
|
|
|
|
|
|
|
|
|
|
// line around section
|
|
|
|
// line around section
|
|
|
|
indices.push_back(firstVertOfThisRing + section);
|
|
|
|
indices.push_back(firstVertOfThisRing + section);
|
|
|
|
@ -423,15 +423,15 @@ namespace AZ
|
|
|
|
|
|
|
|
|
|
|
|
// build faces for end caps (to connect "inner" vertices with poles)
|
|
|
|
// build faces for end caps (to connect "inner" vertices with poles)
|
|
|
|
uint16_t firstPoleVert = 0;
|
|
|
|
uint16_t firstPoleVert = 0;
|
|
|
|
uint16_t firstVertOfFirstRing = 1 + (0) * numSections;
|
|
|
|
uint16_t firstVertOfFirstRing = static_cast<uint16_t>(1 + (0) * numSections);
|
|
|
|
for (uint16_t section = 0; section < numSections; ++section)
|
|
|
|
for (uint16_t section = 0; section < numSections; ++section)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
indices.push_back(firstPoleVert);
|
|
|
|
indices.push_back(firstPoleVert);
|
|
|
|
indices.push_back(firstVertOfFirstRing + section);
|
|
|
|
indices.push_back(firstVertOfFirstRing + section);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
uint16_t lastPoleVert = (numRings - 1) * numSections + 1;
|
|
|
|
uint16_t lastPoleVert = static_cast<uint16_t>((numRings - 1) * numSections + 1);
|
|
|
|
uint16_t firstVertOfLastRing = 1 + (numRings - 2) * numSections;
|
|
|
|
uint16_t firstVertOfLastRing = static_cast<uint16_t>(1 + (numRings - 2) * numSections);
|
|
|
|
for (uint16_t section = 0; section < numSections; ++section)
|
|
|
|
for (uint16_t section = 0; section < numSections; ++section)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
indices.push_back(firstVertOfLastRing + section);
|
|
|
|
indices.push_back(firstVertOfLastRing + section);
|
|
|
|
@ -457,13 +457,13 @@ namespace AZ
|
|
|
|
for (uint32_t section = 0; section < numSections; ++section)
|
|
|
|
for (uint32_t section = 0; section < numSections; ++section)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
uint32_t nextSection = (section + 1) % numSections;
|
|
|
|
uint32_t nextSection = (section + 1) % numSections;
|
|
|
|
indices.push_back((uint16_t)firstVertOfThisRing + nextSection);
|
|
|
|
indices.push_back(static_cast<uint16_t>(firstVertOfThisRing + nextSection));
|
|
|
|
indices.push_back((uint16_t)firstVertOfThisRing + section);
|
|
|
|
indices.push_back(static_cast<uint16_t>(firstVertOfThisRing + section));
|
|
|
|
indices.push_back((uint16_t)firstVertOfNextRing + nextSection);
|
|
|
|
indices.push_back(static_cast<uint16_t>(firstVertOfNextRing + nextSection));
|
|
|
|
|
|
|
|
|
|
|
|
indices.push_back((uint16_t)firstVertOfNextRing + section);
|
|
|
|
indices.push_back(static_cast<uint16_t>(firstVertOfNextRing + section));
|
|
|
|
indices.push_back((uint16_t)firstVertOfNextRing + nextSection);
|
|
|
|
indices.push_back(static_cast<uint16_t>(firstVertOfNextRing + nextSection));
|
|
|
|
indices.push_back((uint16_t)firstVertOfThisRing + section);
|
|
|
|
indices.push_back(static_cast<uint16_t>(firstVertOfThisRing + section));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -473,9 +473,9 @@ namespace AZ
|
|
|
|
for (uint32_t section = 0; section < numSections; ++section)
|
|
|
|
for (uint32_t section = 0; section < numSections; ++section)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
uint32_t nextSection = (section + 1) % numSections;
|
|
|
|
uint32_t nextSection = (section + 1) % numSections;
|
|
|
|
indices.push_back((uint16_t)firstVertOfFirstRing + section);
|
|
|
|
indices.push_back(static_cast<uint16_t>(firstVertOfFirstRing + section));
|
|
|
|
indices.push_back((uint16_t)firstVertOfFirstRing + nextSection);
|
|
|
|
indices.push_back(static_cast<uint16_t>(firstVertOfFirstRing + nextSection));
|
|
|
|
indices.push_back((uint16_t)firstPoleVert);
|
|
|
|
indices.push_back(static_cast<uint16_t>(firstPoleVert));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
uint32_t lastPoleVert = (numRings - 1) * numSections + 1;
|
|
|
|
uint32_t lastPoleVert = (numRings - 1) * numSections + 1;
|
|
|
|
@ -483,9 +483,9 @@ namespace AZ
|
|
|
|
for (uint32_t section = 0; section < numSections; ++section)
|
|
|
|
for (uint32_t section = 0; section < numSections; ++section)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
uint32_t nextSection = (section + 1) % numSections;
|
|
|
|
uint32_t nextSection = (section + 1) % numSections;
|
|
|
|
indices.push_back((uint16_t)firstVertOfLastRing + nextSection);
|
|
|
|
indices.push_back(static_cast<uint16_t>(firstVertOfLastRing + nextSection));
|
|
|
|
indices.push_back((uint16_t)firstVertOfLastRing + section);
|
|
|
|
indices.push_back(static_cast<uint16_t>(firstVertOfLastRing + section));
|
|
|
|
indices.push_back((uint16_t)lastPoleVert);
|
|
|
|
indices.push_back(static_cast<uint16_t>(lastPoleVert));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -637,12 +637,12 @@ namespace AZ
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Line from center of disk to outer edge
|
|
|
|
// Line from center of disk to outer edge
|
|
|
|
meshData.m_lineIndices.push_back(centerIndex);
|
|
|
|
meshData.m_lineIndices.push_back(centerIndex);
|
|
|
|
meshData.m_lineIndices.push_back(firstSection + section);
|
|
|
|
meshData.m_lineIndices.push_back(static_cast<uint16_t>(firstSection + section));
|
|
|
|
|
|
|
|
|
|
|
|
// Line from outer edge to next edge
|
|
|
|
// Line from outer edge to next edge
|
|
|
|
meshData.m_lineIndices.push_back(firstSection + section);
|
|
|
|
meshData.m_lineIndices.push_back(static_cast<uint16_t>(firstSection + section));
|
|
|
|
uint32_t nextSection = (section + 1) % numSections;
|
|
|
|
uint32_t nextSection = (section + 1) % numSections;
|
|
|
|
meshData.m_lineIndices.push_back(firstSection + nextSection);
|
|
|
|
meshData.m_lineIndices.push_back(static_cast<uint16_t>(firstSection + nextSection));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Create triangle indices
|
|
|
|
// Create triangle indices
|
|
|
|
@ -652,13 +652,13 @@ namespace AZ
|
|
|
|
meshData.m_triangleIndices.push_back(centerIndex);
|
|
|
|
meshData.m_triangleIndices.push_back(centerIndex);
|
|
|
|
if (isUp)
|
|
|
|
if (isUp)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
meshData.m_triangleIndices.push_back(firstSection + nextSection);
|
|
|
|
meshData.m_triangleIndices.push_back(static_cast<uint16_t>(firstSection + nextSection));
|
|
|
|
meshData.m_triangleIndices.push_back(firstSection + section);
|
|
|
|
meshData.m_triangleIndices.push_back(static_cast<uint16_t>(firstSection + section));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
meshData.m_triangleIndices.push_back(firstSection + section);
|
|
|
|
meshData.m_triangleIndices.push_back(static_cast<uint16_t>(firstSection + section));
|
|
|
|
meshData.m_triangleIndices.push_back(firstSection + nextSection);
|
|
|
|
meshData.m_triangleIndices.push_back(static_cast<uint16_t>(firstSection + nextSection));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -776,7 +776,7 @@ namespace AZ
|
|
|
|
normals.push_back(AuxGeomNormal(0.0f, 1.0f, 0.0f));
|
|
|
|
normals.push_back(AuxGeomNormal(0.0f, 1.0f, 0.0f));
|
|
|
|
|
|
|
|
|
|
|
|
// vertex indexes for start of the cone sides and for the cone point
|
|
|
|
// vertex indexes for start of the cone sides and for the cone point
|
|
|
|
uint16_t indexOfSidesStart = numSections + 1;
|
|
|
|
uint16_t indexOfSidesStart = static_cast<uint16_t>(numSections + 1);
|
|
|
|
uint32_t indexOfConePoint = indexOfSidesStart + numRings * numSections;
|
|
|
|
uint32_t indexOfConePoint = indexOfSidesStart + numRings * numSections;
|
|
|
|
|
|
|
|
|
|
|
|
// indices for points
|
|
|
|
// indices for points
|
|
|
|
@ -795,8 +795,8 @@ namespace AZ
|
|
|
|
// build lines between already completed cap for each section
|
|
|
|
// build lines between already completed cap for each section
|
|
|
|
for (uint16_t section = 0; section < numSections; ++section)
|
|
|
|
for (uint16_t section = 0; section < numSections; ++section)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
indices.push_back(indexOfSidesStart + numRings * section);
|
|
|
|
indices.push_back(static_cast<uint16_t>(indexOfSidesStart + numRings * section));
|
|
|
|
indices.push_back(indexOfConePoint);
|
|
|
|
indices.push_back(static_cast<uint16_t>(indexOfConePoint));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -812,19 +812,19 @@ namespace AZ
|
|
|
|
// faces from end cap to close to point
|
|
|
|
// faces from end cap to close to point
|
|
|
|
for (uint32_t ring = 0; ring < numRings - 1; ++ring)
|
|
|
|
for (uint32_t ring = 0; ring < numRings - 1; ++ring)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
indices.push_back(indexOfSidesStart + numRings * nextSection + ring + 1);
|
|
|
|
indices.push_back(static_cast<uint16_t>(indexOfSidesStart + numRings * nextSection + ring + 1));
|
|
|
|
indices.push_back(indexOfSidesStart + numRings * nextSection + ring);
|
|
|
|
indices.push_back(static_cast<uint16_t>(indexOfSidesStart + numRings * nextSection + ring));
|
|
|
|
indices.push_back(indexOfSidesStart + numRings * section + ring);
|
|
|
|
indices.push_back(static_cast<uint16_t>(indexOfSidesStart + numRings * section + ring));
|
|
|
|
|
|
|
|
|
|
|
|
indices.push_back(indexOfSidesStart + numRings * section + ring);
|
|
|
|
indices.push_back(static_cast<uint16_t>(indexOfSidesStart + numRings * section + ring));
|
|
|
|
indices.push_back(indexOfSidesStart + numRings * section + ring + 1);
|
|
|
|
indices.push_back(static_cast<uint16_t>(indexOfSidesStart + numRings * section + ring + 1));
|
|
|
|
indices.push_back(indexOfSidesStart + numRings * nextSection + ring + 1);
|
|
|
|
indices.push_back(static_cast<uint16_t>(indexOfSidesStart + numRings * nextSection + ring + 1));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// faces for point (from last ring of verts to point)
|
|
|
|
// faces for point (from last ring of verts to point)
|
|
|
|
indices.push_back(indexOfConePoint);
|
|
|
|
indices.push_back(static_cast<uint16_t>(indexOfConePoint));
|
|
|
|
indices.push_back(indexOfSidesStart + numRings * nextSection + numRings - 1);
|
|
|
|
indices.push_back(static_cast<uint16_t>(indexOfSidesStart + numRings * nextSection + numRings - 1));
|
|
|
|
indices.push_back(indexOfSidesStart + numRings * section + numRings - 1);
|
|
|
|
indices.push_back(static_cast<uint16_t>(indexOfSidesStart + numRings * section + numRings - 1));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -912,7 +912,7 @@ namespace AZ
|
|
|
|
//uint16_t indexOfBottomStart = 1;
|
|
|
|
//uint16_t indexOfBottomStart = 1;
|
|
|
|
//uint16_t indexOfTopCenter = numSections + 1;
|
|
|
|
//uint16_t indexOfTopCenter = numSections + 1;
|
|
|
|
//uint16_t indexOfTopStart = numSections + 2;
|
|
|
|
//uint16_t indexOfTopStart = numSections + 2;
|
|
|
|
uint16_t indexOfSidesStart = 2 * numSections + 2;
|
|
|
|
uint16_t indexOfSidesStart = static_cast<uint16_t>(2 * numSections + 2);
|
|
|
|
|
|
|
|
|
|
|
|
// build point indices
|
|
|
|
// build point indices
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|