[API reference](https://jsprismarine.dev/api/index.md) / [@jsprismarine/native-worldgen](https://jsprismarine.dev/api/@jsprismarine/native-worldgen/index.md) / [NativeWorldgen](https://jsprismarine.dev/api/@jsprismarine/native-worldgen/NativeWorldgen/index.md) / NativeSurface

# Class: NativeSurface

Defined in: [NativeWorldgen.ts:764](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/native-worldgen/src/NativeWorldgen.ts#L764)

A surface pass program in native memory, made by [NativeWorldgen.createSurface](https://jsprismarine.dev/api/@jsprismarine/native-worldgen/NativeWorldgen/classes/NativeWorldgen.md#createsurface).

## Properties

### programs

> `readonly` **programs**: readonly [`NativeDensityProgram`](https://jsprismarine.dev/api/@jsprismarine/native-worldgen/NativeWorldgen/classes/NativeDensityProgram.md)[]

Defined in: [NativeWorldgen.ts:768](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/native-worldgen/src/NativeWorldgen.ts#L768)

The density programs its veins run, held so they live as long as it does.

## Methods

### chunk()

> **chunk**(`frame`, `columns`, `blocks`, `biomes`, `verdicts`, `out`, `fallbacks`): `number`

Defined in: [NativeWorldgen.ts:792](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/native-worldgen/src/NativeWorldgen.ts#L792)

Runs the surface pass over one chunk; `jwg_surface_chunk` in the C header lays out each buffer.

#### Parameters

##### frame

`Int32Array`

##### columns

`Float64Array`

##### blocks

`Uint8Array`

##### biomes

`Int32Array`

##### verdicts

`Uint8Array`

##### out

`Int32Array`

##### fallbacks

`Int32Array`

#### Returns

`number`

How many fallback entries it wrote.

#### Throws

After [destroy](#destroy).

***

### destroy()

> **destroy**(): `void`

Defined in: [NativeWorldgen.ts:806](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/native-worldgen/src/NativeWorldgen.ts#L806)

Frees the program's native memory. Later calls throw. Its density programs stay alive.

#### Returns

`void`
