# Class GeometryMemoryBlock

Represents a memory block for storing geometry data. That is vertices, normals and indices.

##### Index

### Constructors

constructor

### Accessors

byteSize

### Methods

getVertexData
has
importPackedVertexData
importPackedVertexDataV2
readEdgeIndices
releaseV2MeshSources
releaseV2MeshSourcesFor
removeVertexData
reset

## Constructors

### constructor

- new GeometryMemoryBlock(): GeometryMemoryBlock

  #### Returns GeometryMemoryBlock

## Accessors

### byteSize

- get byteSize(): number

  Gets the size of the memory block in bytes.

  #### Returns number

  The size of the memory block in bytes.

## Methods

### getVertexData

- getVertexData(
  meshDescriptor: BimProductMeshDescriptor,
  ): undefined | BimVertexData

  Retrieves the vertex data for a given BimProductMeshDescriptor.

  #### Parameters

  - meshDescriptor: BimProductMeshDescriptor

    The BimProductMeshDescriptor object.

  #### Returns undefined | BimVertexData

  The BimVertexData associated with the given mesh descriptor. `undefined` if the mesh descriptor is not found.

### has

- has(meshDescriptor: BimProductMeshDescriptor): boolean

  Checks if the given BimProductMeshDescriptor exists in the geometry memory block.

  #### Parameters

  - meshDescriptor: BimProductMeshDescriptor

    The BimProductMeshDescriptor to check.

  #### Returns boolean

  `true` if the BimProductMeshDescriptor exists, `false` otherwise.

### importPackedVertexData

- importPackedVertexData(
  reader: BimVertexDataReader,
  meshDescriptors: (undefined | BimProductMeshDescriptor)[],
  ): Promise<void>

  Imports packed vertex data into the geometry memory block.

  #### Parameters

  - reader: BimVertexDataReader

    The BimVertexDataReader used to read the vertex data.

  - meshDescriptors: (undefined | BimProductMeshDescriptor)[]

    The mesh descriptors containing information about the vertex data in BimVertexDataReader. Mesh descriptors that are already imported are ignored (so we never store duplicated data).

  #### Returns Promise<void>

  A Promise that resolves when the vertex data is imported.

### importPackedVertexDataV2

- importPackedVertexDataV2(
  fileReader: T8gdReader,
  meshDescriptors: (undefined | BimProductMeshDescriptor)[],
  ): Promise<void>

  Imports packed vertex data from V2 (.t8gd) format into the geometry memory block.

  #### Parameters

  - fileReader: T8gdReader

    The T8gdReader for file-level operations (hash lookup).

  - meshDescriptors: (undefined | BimProductMeshDescriptor)[]

    The mesh descriptors containing information about which meshes to load. Mesh descriptors that are already imported are ignored (so we never store duplicated data).

  #### Returns Promise<void>

  A Promise that resolves when the vertex data is imported.

### readEdgeIndices

- readEdgeIndices(hash: string): undefined | TypedArray

  Lazily reads edge indices for a mesh from the retained V2 geometry buffer. Returns undefined if the mesh has no edges or was not loaded via V2 format.

  #### Parameters

  - hash: string

  #### Returns undefined | TypedArray

### releaseV2MeshSources

- releaseV2MeshSources(): void

  Releases retained V2 geometry buffers used for lazy edge reads. Call after all edges have been read to free the underlying ArrayBuffer memory.

  #### Returns void

### releaseV2MeshSourcesFor

- releaseV2MeshSourcesFor(hashes: ReadonlySet<string>): void

  Releases V2 geometry buffer references for a specific set of mesh hashes only. Use this when several loader elements share one repository: each element should release only the meshes it consumed so concurrent peers can still resolve their edges.

  #### Parameters

  - hashes: ReadonlySet<string>

  #### Returns void

### removeVertexData

- removeVertexData(hash: string): boolean

  Removes a cached vertex data entry by hash so it can be re-imported with better data. The old data remains allocated in the parent MemoryBlock buffer but becomes unreachable through the cache. This only happens during initial loading when welded geometry replaces unwelded geometry for the same hash, so the leaked allocations are bounded and small relative to the total geometry budget. Compacting the MemoryBlock is not worth the cost.

  #### Parameters

  - hash: string

  #### Returns boolean

### reset

- reset(): void

  Resets the GeometryMemoryBlock freeing all the used memory. It is safe to call importPackedVertexData after calling this method.

  #### Returns void