* @brief Encode the current triangle, and make sure it is recognized as a triangle. * * This method will rotate indices in tri if needed in order to avoid tri to be considered * part of the previous ngon. This method is to be used whenever you want to emit a real triangle, * and make sure it is seen as a triangle. * * @param tri Triangle to enc
| 112 | * @param tri Triangle to encode. |
| 113 | */ |
| 114 | void ngonEncodeTriangle(aiFace * tri) { |
| 115 | ai_assert(tri->mNumIndices == 3); |
| 116 | |
| 117 | // Rotate indices in new triangle to avoid ngon encoding false ngons |
| 118 | // Otherwise, the new triangle would be considered part of the previous NGON. |
| 119 | if (isConsideredSameAsLastNgon(tri)) { |
| 120 | std::swap(tri->mIndices[0], tri->mIndices[2]); |
| 121 | std::swap(tri->mIndices[1], tri->mIndices[2]); |
| 122 | } |
| 123 | |
| 124 | mLastNGONFirstIndex = tri->mIndices[0]; |
| 125 | } |
| 126 | |
| 127 | /** |
| 128 | * @brief Encode a quad (2 triangles) in ngon encoding, and make sure they are seen as a single ngon. |