core.Class.QuadRenderer - MONOGRID/gainmap-js GitHub Wiki

@monogrid/gainmap-js / core / QuadRenderer

Class: QuadRenderer<TType, TMaterial>

Utility class used for rendering a texture with a material

Type Parameters

TType extends TextureDataType

TMaterial extends Material

Constructors

new QuadRenderer()

new QuadRenderer<TType, TMaterial>(options): QuadRenderer<TType, TMaterial>

Constructs a new QuadRenderer

Parameters

options: QuadRendererOptions<TType, TMaterial>

Parameters for this QuadRenderer

Returns

QuadRenderer<TType, TMaterial>

Defined in

src/core/QuadRenderer.ts:165

Accessors

colorSpace

get colorSpace(): ColorSpace

Returns

ColorSpace

Defined in

src/core/QuadRenderer.ts:408


height

get height(): number

Height of the texture

set height(value): void

Parameters

value: number

Returns

number

Defined in

src/core/QuadRenderer.ts:378


material

get material(): TMaterial

The Material used.

Returns

TMaterial

Defined in

src/core/QuadRenderer.ts:403


renderTarget

get renderTarget(): WebGLRenderTarget<Texture>

The WebGLRenderTarget used.

set renderTarget(value): void

Parameters

value: WebGLRenderTarget<Texture>

Returns

WebGLRenderTarget<Texture>

Defined in

src/core/QuadRenderer.ts:392


renderer

get renderer(): WebGLRenderer

The renderer used

Returns

WebGLRenderer

Defined in

src/core/QuadRenderer.ts:387


type

get type(): TType

Returns

TType

Defined in

src/core/QuadRenderer.ts:407


width

get width(): number

Width of the texture

set width(value): void

Parameters

value: number

Returns

number

Defined in

src/core/QuadRenderer.ts:369

Methods

dispose()

dispose(disposeRenderTarget?): void

Will dispose of all assets used by this renderer.

Parameters

disposeRenderTarget?: boolean

will dispose of the renderTarget which will not be usable later set this to true if you passed the renderTarget.texture to a PMREMGenerator or are otherwise done with it.

Returns

void

Examples

const loader = new HDRJPGLoader(renderer)
const result = await loader.loadAsync('gainmap.jpeg')
const mesh = new Mesh(geometry, new MeshBasicMaterial({ map: result.renderTarget.texture }) )
// DO NOT dispose the renderTarget here,
// it is used directly in the material
result.dispose()
const loader = new HDRJPGLoader(renderer)
const pmremGenerator = new PMREMGenerator( renderer );
const result = await loader.loadAsync('gainmap.jpeg')
const envMap = pmremGenerator.fromEquirectangular(result.renderTarget.texture)
const mesh = new Mesh(geometry, new MeshStandardMaterial({ envMap }) )
// renderTarget can be disposed here
// because it was used to generate a PMREM texture
result.dispose(true)

Defined in

src/core/QuadRenderer.ts:344


disposeOnDemandRenderer()

disposeOnDemandRenderer(): void

If using a disposable renderer, it will dispose it.

Returns

void

Defined in

src/core/QuadRenderer.ts:306


render()

render(): void

Renders the input texture using the specified material

Returns

void

Defined in

src/core/QuadRenderer.ts:248


toArray()

toArray(): TextureDataTypeToBufferType<TType>

Obtains a Buffer containing the rendered texture.

Returns

TextureDataTypeToBufferType<TType>

a TypedArray containing RGBA values from this renderer

Throws

Error if the browser cannot read pixels from this RenderTarget type.

Defined in

src/core/QuadRenderer.ts:265


toDataTexture()

toDataTexture(options?): DataTexture

Performs a readPixel operation in the renderTarget and returns a DataTexture containing the read data

Parameters

options?: QuadRendererTextureOptions

options

Returns

DataTexture

Defined in

src/core/QuadRenderer.ts:279


instantiateRenderer()

static instantiateRenderer(): WebGLRenderer

Instantiates a temporary renderer

Returns

WebGLRenderer

Defined in

src/core/QuadRenderer.ts:235

⚠️ **GitHub.com Fallback** ⚠️