import { IGeometryMetadata } from "./schema" ; import { PackFileReader } from "../common/packfile-reader" ; generator param { Buffer } buffer returns { Iterable < IGeometryMetadata > } export function * parseGeometries ( buffer ) { const pfr = new PackFileReader ( buffer ) ; for ( let i = 0 , len = pfr . numEntries ( ) ; i < len ; i ++ ) { const entry = pfr . seekEntry ( i ) ; console . assert ( entry ) ; console . assert ( entry . version >= 3 ) ; const fragType = pfr . getUint8 ( ) ; pfr . seek ( pfr . offset + 24 ) ; const primCount = pfr . getUint16 ( ) ; const packID = parseInt ( pfr . getString ( pfr . getVarint ( ) ) ) ; const entityID = pfr . getVarint ( ) ; yield { fragType , primCount , packID , entityID } ; } }