# Class GpuSelectables

Methods and properties related to gpu picking. Basically "given a rendered pixel what object does that pixel represent".

#### Implements

- Selectables

##### Index

### Constructors

constructor

### Properties

debugOptions
meshes
defaultGpuPickTextureSize

### Methods

attach
clear
detach
getAndUpdatePickCamera
getVisiblesInSight
idOf
pick

## Constructors

### constructor

- new GpuSelectables(scene: Scene, _materials: Materials): GpuSelectables

  #### Parameters

  - scene: Scene
  - _materials: Materials

  #### Returns GpuSelectables

## Properties

### debugOptions

debugOptions: GpuPickDebugOptions = ...

### `Readonly` meshes

meshes: Map<string, Mesh> = ...

BabylonJS meshes containing the merged IFC product meshes.

### `Static` `Readonly` defaultGpuPickTextureSize

defaultGpuPickTextureSize: 16

## Methods

### attach

- attach(meshOrIcon: Mesh | Icon, o?: AttachOption): number

  Attach a babylonJs Mesh so it becomes available for gpu picking. That means that it may be returned in a pick operation.

  #### Parameters

  - meshOrIcon: Mesh | Icon
  - `Optional` o: AttachOption

  #### Returns number

  Number of remaning meshes it is possible to attach.

  Implementation of Selectables.attach

### clear

- clear(): void

  #### Returns void

### detach

- detach(meshOrIcon: Mesh | Icon): boolean

  Detach a babylonJs Mesh or Icon, that was previously attached using attach from gpu picking.

  #### Parameters

  - meshOrIcon: Mesh | Icon

  #### Returns boolean

  `true` if detach was succesful.

  Implementation of Selectables.detach

### getAndUpdatePickCamera

- getAndUpdatePickCamera(
  rayOrScreenCoordinate: Intersection | Ray | CanvasPosition,
  ): TargetCamera

  #### Parameters

  - rayOrScreenCoordinate: Intersection | Ray | CanvasPosition

  #### Returns TargetCamera

### getVisiblesInSight

- getVisiblesInSight(o?: GetVisibleInSightOptions): VisibleSelectable[]

  Renders objects to a texture and checks which objects are in sight from given camera.

  #### Parameters

  - `Optional` o: GetVisibleInSightOptions

    Options.

  #### Returns VisibleSelectable[]

  Implementation of Selectables.getVisiblesInSight

- getVisiblesInSight(
  inSightCamera?: Camera,
  textureSizePow2?: number,
  isDistanceCullingEnabled?: boolean,
  ): VisibleSelectable[]

  Renders objects to a texture and checks which objects are in sight from given camera.

  #### Parameters

  - `Optional` inSightCamera: Camera

    Camera to represent the view to check for visible objects. If not specified then current Scene.activeCamera is used

  - `Optional` textureSizePow2: number

    The resolution of texture to be used for in sight detection. (Smaller might miss object ending up smaller than a pixel.)

  - `Optional` isDistanceCullingEnabled: boolean

    Whether to enable distance culling or not.

  #### Returns VisibleSelectable[]

  Implementation of Selectables.getVisiblesInSight

### idOf

- idOf(meshOrIcon: Mesh | Icon): number

  Get unique "pick" id of mesh or icon. It is only valid as long as the item has been registered with attach. It will be 0 if not attached.

  #### Parameters

  - meshOrIcon: Mesh | Icon

    mesh or icon to get id for.

  #### Returns number

  0 if not attached, otherwise unique "pick" id.

  Implementation of Selectables.idOf

### pick

- pick(o: PickOption): PickResult

  Performs an intersection test in the world (finds objects below a specific screen coordinate or that intersect a ray).

  #### Parameters

  - o: PickOption

    Options to use for pick operation.

  #### Returns PickResult

  Intersection information.

  Implementation of Selectables.pick

- pick(
  picker: TargetCamera,
  textureSizePow2?: number,
  doIntersectionTestOnGeometry?: boolean,
  saveRenderedGpuPickingSceneTexture?: boolean,
  ): PickResult

  Performs an intersection test in the world (find objects below a specific camera or screen coordinate, or that intersect a ray).

  #### Parameters

  - picker: TargetCamera

    TargetCamera or PickOption..

  - `Optional` textureSizePow2: number

    texture size (defaults to 16x16) used when rendering the world during pick operation.

  - `Optional` doIntersectionTestOnGeometry: boolean

    `true` to perform exact intersection on intersected object (exact coordinate etc). This is computationally expensive.

  - `Optional` saveRenderedGpuPickingSceneTexture: boolean

    `true` to save the rendering texture of the pick operation. Mostly useful for debugging.

  #### Returns PickResult

  Implementation of Selectables.pick