# Class PrefabBufferGeometry

#### Hierarchy

- BufferGeometry
  - PrefabBufferGeometry

- Defined in lib/plugins/thirdParty/prefabBufferGeometry.ts:3

##### Index

### Constructors

constructor

### Properties

isPrefabBufferGeometry
prefabCount
prefabGeometry
prefabVertexCount

### Methods

bufferIndices
bufferNormals
bufferPositions
bufferUvs
createAttribute
setPrefabData

## Constructors

### constructor

- new PrefabBufferGeometry(
  prefab: Geometry | BufferGeometry,
  count: number,
  ): PrefabBufferGeometry

  A BufferGeometry where a 'prefab' geometry is repeated a number of times.

  #### Parameters

  - prefab: Geometry | BufferGeometry

    The Geometry instance to repeat.

  - count: number

    The number of times to repeat the geometry.

  #### Returns PrefabBufferGeometry

  Overrides BufferGeometry.constructor

  - Defined in lib/plugins/thirdParty/prefabBufferGeometry.ts:14

## Properties

### isPrefabBufferGeometry

isPrefabBufferGeometry: boolean

- Defined in lib/plugins/thirdParty/prefabBufferGeometry.ts:5

### prefabCount

prefabCount: number

- Defined in lib/plugins/thirdParty/prefabBufferGeometry.ts:6

### prefabGeometry

prefabGeometry: Geometry | BufferGeometry

- Defined in lib/plugins/thirdParty/prefabBufferGeometry.ts:4

### prefabVertexCount

prefabVertexCount: number

- Defined in lib/plugins/thirdParty/prefabBufferGeometry.ts:7

## Methods

### bufferIndices

- bufferIndices(): void

  #### Returns void

  - Defined in lib/plugins/thirdParty/prefabBufferGeometry.ts:45

### bufferNormals

- bufferNormals(): void

  #### Returns void

  - Defined in lib/plugins/thirdParty/prefabBufferGeometry.ts:152

### bufferPositions

- bufferPositions(): void

  #### Returns void

  - Defined in lib/plugins/thirdParty/prefabBufferGeometry.ts:85

### bufferUvs

- bufferUvs(): void

  #### Returns void

  - Defined in lib/plugins/thirdParty/prefabBufferGeometry.ts:114

### createAttribute

- createAttribute(
  name: string,
  itemSize: number,
  factory?: (data: any[], index: number, prefabCount: number) => void,
  ): BufferAttribute

  Creates a BufferAttribute on this geometry instance.

  #### Parameters

  - name: string

    Name of the attribute.

  - itemSize: number

    Number of floats per vertex (typically 1, 2, 3 or 4).

  - `Optional` factory: (data: any[], index: number, prefabCount: number) => void

    Function that will be called for each prefab upon creation. Accepts 3 arguments: data[], index and prefabCount. Calls setPrefabData.

  #### Returns BufferAttribute

  - Defined in lib/plugins/thirdParty/prefabBufferGeometry.ts:204

### setPrefabData

- setPrefabData(
  attribute: string | BufferAttribute,
  prefabIndex: number,
  data: any[],
  ): void

  Sets data for all vertices of a prefab at a given index. Usually called in a loop.

  #### Parameters

  - attribute: string | BufferAttribute

    The attribute or attribute name where the data is to be stored.

  - prefabIndex: number

    Index of the prefab in the buffer geometry.

  - data: any[]

    Array of data. Length should be equal to item size of the attribute.

  #### Returns void

  - Defined in lib/plugins/thirdParty/prefabBufferGeometry.ts:230