# StencilParameters

Class · category: Graphics

Source: https://github.com/playcanvas/engine/blob/f059dc005842f76e052cdf44d8370c8c7ec475ac/src/platform/graphics/stencil-parameters.js#L11

Holds stencil test settings.

## Constructors

### constructor

```ts
new StencilParameters(options?: any)
```

Create a new StencilParameters instance.

**Parameters**

- `options` (`any`, optional, default `{}`): Options object to configure the stencil parameters.

## Properties

### DEFAULT

```ts
static readonly DEFAULT: StencilParameters
```

A default stencil state.

## Accessors

### fail

```ts
get fail(): number
set fail(value: number)
```

Gets the operation to perform if stencil test is failed.

### func

```ts
get func(): number
set func(value: number)
```

Sets the comparison function that decides if the pixel should be written.

### readMask

```ts
get readMask(): number
set readMask(value: number)
```

Gets the mask applied to stencil buffer value and reference value before comparison.

### ref

```ts
get ref(): number
set ref(value: number)
```

Gets the stencil test reference value used in comparisons.

### writeMask

```ts
get writeMask(): number
set writeMask(value: number)
```

Gets the bit mask applied to the stencil value when written.

### zfail

```ts
get zfail(): number
set zfail(value: number)
```

Gets the operation to perform if depth test is failed.

### zpass

```ts
get zpass(): number
set zpass(value: number)
```

Gets the operation to perform if both stencil and depth test are passed.

## Methods

### clone

```ts
clone(): StencilParameters
```

Clone the stencil parameters.

**Returns** [`StencilParameters`](https://api.playcanvas.com/engine/classes/StencilParameters.md): A cloned StencilParameters object.

### copy

```ts
copy(rhs: StencilParameters): StencilParameters
```

Copies the contents of a source stencil parameters to this stencil parameters.

**Parameters**

- `rhs` ([`StencilParameters`](https://api.playcanvas.com/engine/classes/StencilParameters.md)): A stencil parameters to copy from.

**Returns** [`StencilParameters`](https://api.playcanvas.com/engine/classes/StencilParameters.md): Self for chaining.
