# Interface TextureObject

Represents a single object (hence a single pixel) in the GPU picking texture. Should be created by calling to Materials.createGpuTextureObject instead of using constructor directly.

interface TextureObject {
id: number;
get color(): Color4;
assignGpuPickingMaterial(mesh: Mesh): void;
assignUVKind(mesh: Mesh): void;
buildGpuPickable(mesh: Mesh): void;
dispose(): void;
}

##### Index

### Properties

id

### Accessors

color

### Methods

assignGpuPickingMaterial
assignUVKind
buildGpuPickable
dispose

## Properties

### `Readonly` id

id: number

Unique object identifier (represents location in GPU picking texture).

## Accessors

### color

- get color(): Color4

  Gets the color of the texture object (pixel).

  #### Returns Color4

## Methods

### assignGpuPickingMaterial

- assignGpuPickingMaterial(mesh: Mesh): void

  Replaces the material on the mesh with a GPU picking material. Combined with a call to assignUVKind this will ensure that the mesh is rendered with a unique color.

  #### Parameters

  - mesh: Mesh

    Mesh to relace material on.

  #### Returns void

### assignUVKind

- assignUVKind(mesh: Mesh): void

  Replaces the UV coordiates on the specified mesh. Combined with a call to assignGpuPickingMaterial this will make sure that the mesh is rendered with a unique color.

  #### Parameters

  - mesh: Mesh

    Mesh to replace UV coordinates on.

  #### Returns void

### buildGpuPickable

- buildGpuPickable(mesh: Mesh): void

  Replaces both material and UV coordinates on the specified mesh. Ensures that the mesh is rendered with a unique color.

  #### Parameters

  - mesh: Mesh

    Mesh to render with a unique color.

  #### Returns void

### dispose

- dispose(): void

  Releases the resource that ensures that this TextureObject has a unique color. This makes it possible to create new TextureObject that represents this resource. This does not mean that any mesh that was modified by assignUVKind, assignGpuPickingMaterial or buildGpuPickable is restored in any way. They will still have the same UV coordinates and material. It is up to the caller to ensure that the mesh gets other values if needed. Same thing as calling Materials.deleteGpuTextureObject(this).

  #### Returns void