void ValidateVertexCount()

in GLTFSDK/Source/Validation.cpp [100:151]


    void ValidateVertexCount(const MeshMode mode, const size_t count, const std::string& type)
    {
        switch (mode)
        {
        case MESH_POINTS:
            break;

        case MESH_LINES:
            if (count < 2)
            {
                throw ValidationException(type + " count must be at least 2.");
            }

            if (count % 2 != 0)
            {
                throw ValidationException(type + " count for MESH_LINES must be a multiple of 2.");
            }
            break;

        case MESH_LINE_LOOP:
        case MESH_LINE_STRIP:
            if (count < 2)
            {
                throw ValidationException(type + " count must be at least 2.");
            }
            break;

        case MESH_TRIANGLES:
            if (count < 3)
            {
                throw ValidationException(type + " count must be at least 3.");
            }

            if (count % 3 != 0)
            {
                throw ValidationException(type + " count for MESH_TRIANGLES must be a multiple of 3.");
            }
            break;

        case MESH_TRIANGLE_FAN:
        case MESH_TRIANGLE_STRIP:
            if (count < 3)
            {
                throw ValidationException(type + " count must be at least 3.");
            }
            break;

        default:
            throw ValidationException(type + " invalid mesh mode for validation " + std::to_string(mode));
            break;
        }
    }