# OutlineRenderer

Class · category: Graphics

Source: https://github.com/playcanvas/engine/blob/b5b983982a9860d21e0c1dafb2f85f72e2c01afb/src/extras/renderers/outline-renderer.js#L108

Class responsible for rendering color outlines around objects in the scene.

## Constructors

### constructor

```ts
new OutlineRenderer(app: AppBase, renderingLayer?: Layer, priority?: number)
```

Create a new OutlineRenderer.

**Parameters**

- `app` ([`AppBase`](https://api.playcanvas.com/engine/classes/AppBase.md)): The application.
- `renderingLayer` ([`Layer`](https://api.playcanvas.com/engine/classes/Layer.md), optional): A layer used internally to render the outlines. If not
  provided, the renderer will use the 'Immediate' layer. This needs to be supplied only if the
  'Immediate' layer is not present in the scene.
- `priority` (`number`, optional, default `-1`): The priority of the camera rendering the outlines. Should be
  smaller value than the priority of the scene camera, to be updated first. Defaults to -1.

## Methods

### addEntity

```ts
addEntity(entity: Entity, color: Color, recursive?: boolean): void
```

Add an entity to the outline renderer.

**Parameters**

- `entity` ([`Entity`](https://api.playcanvas.com/engine/classes/Entity.md)): The entity to add. All MeshInstance of the entity and its
  descendants will be added.
- `color` ([`Color`](https://api.playcanvas.com/engine/classes/Color.md)): The color of the outline.
- `recursive` (`boolean`, optional, default `true`): Whether to add MeshInstances of the entity's descendants.
  Defaults to true.

### destroy

```ts
destroy(): void
```

Destroy the outline renderer and its resources.

### frameUpdate

```ts
frameUpdate(sceneCameraEntity: Entity, blendLayer: Layer, blendLayerTransparent: boolean): void
```

Update the outline renderer. Should be called once per frame.

**Parameters**

- `sceneCameraEntity` ([`Entity`](https://api.playcanvas.com/engine/classes/Entity.md)): The camera used to render the scene, which is used to provide
  the camera properties to the outline rendering camera.
- `blendLayer` ([`Layer`](https://api.playcanvas.com/engine/classes/Layer.md)): The layer in which the outlines should be rendered.
- `blendLayerTransparent` (`boolean`): Whether the blend layer is transparent.

### removeEntity

```ts
removeEntity(entity: Entity, recursive?: boolean): void
```

Remove an entity from the outline renderer.

**Parameters**

- `entity` ([`Entity`](https://api.playcanvas.com/engine/classes/Entity.md)): The entity to remove.
- `recursive` (`boolean`, optional, default `true`): Whether to add MeshInstances of the entity's descendants.
  Defaults to true.
