/**
 *
 * @param {THREE.BufferGeometry} geometry
 * @returns {number}
 */
export function compute_geometry_polycount(geometry) {
    const index = geometry.getIndex();

    if (index !== null) {
        return index.count / 3;
    }

    const position_attribute = geometry.getAttribute('position');

    if (position_attribute !== undefined) {
        return position_attribute.count / 3;
    }

    // no valid way to discern polycount, assume 0
    return 0;
}
