ScreenRenderTarget

Render Target that render to screen (canvas).

Constructor

new ScreenRenderTarget(view)

Create a new ScreenRenderTarget.

Parameters:
NameTypeDescription
viewHTMLCanvasElement

The canvas element which the Render Target rendered to.

Extends

Members

clearColor :boolean

Whether to clear the color buffer before rendering to this render target.

Type:
  • boolean
Default Value
  • true

clearDepth :boolean

Whether to clear the depth buffer before rendering to this render target.

Type:
  • boolean
Default Value
  • true

clearStencil :boolean

Whether to clear the stencil buffer before rendering to this render target.

Type:
  • boolean
Default Value
  • true

colorClearValue :Color4

Clear color value.

Type:

depthClearValue :number

Clear depth value.

Type:
  • number
Default Value
  • 1

height :number

The height of the render target.

Type:
  • number

(readonly) isRenderTarget :boolean

This flag can be used for type testing.

Type:
  • boolean
Default Value
  • true

(readonly) isScreenRenderTarget :boolean

This flag can be used for type testing.

Type:
  • boolean
Default Value
  • true

occlusionQuerySet :QuerySet|null

A querySet that will store the occlusion query results. If null, occlusion queries are disabled.

Type:
Default Value
  • null

stencilClearValue :number

Clear stencil value.

Type:
  • number
Default Value
  • 0

timestampWrites :object

An array of objects defining where and when timestamp query values will be written.

Type:
  • object
Properties
NameTypeDescription
querySetQuerySet | null

A timestamp querySet. If null, timestamp queries are disabled.

beginningOfPassWriteIndexnumber

A number specifying the query index in querySet where the timestamp at the beginning of the render pass will be written.

endOfPassWriteIndexnumber

A number specifying the query index in querySet where the timestamp at the end of the render pass will be written.

view :HTMLCanvasElement

The canvas element which the Render Target rendered to.

Type:
  • HTMLCanvasElement

width :number

The width of the render target.

Type:
  • number

Methods

addEventListener(type, listener)

Adds a listener to an event type.

Parameters:
NameTypeDescription
typestring

The type of event to listen to.

listenerfunction

The function that gets called when the event is fired.

dispatchEvent(event)

Fire an event.

Parameters:
NameTypeDescription
eventobject

The event that gets fired.

dispose()

Dispatches a dispose event.

removeEventListener(type, listener)

Removes a listener from an event type.

Parameters:
NameTypeDescription
typestring

The type of the listener that gets removed.

listenerfunction

The listener function that gets removed.

resize(width, height)

Resizes the render target to the specified dimensions. This method will set the width and height properties of the canvas.

Parameters:
NameTypeDescription
widthnumber

The width of the render target.

heightnumber

The height of the render target.

setClear(coloropt, depthopt, stencilopt) → {RenderTargetBase}

Sets the clear state.

Parameters:
NameTypeAttributesDescription
colorboolean<optional>

Whether to clear the color buffer.

depthboolean<optional>

Whether to clear the depth buffer.

stencilboolean<optional>

Whether to clear the stencil buffer.

Returns:

A reference to this render target.

Type: 
RenderTargetBase

setColorClearValue(r, g, b, a) → {RenderTargetBase}

Sets the clear values.

Parameters:
NameTypeDescription
rnumber

Red channel value between 0.0 and 1.0.

gnumber

Green channel value between 0.0 and 1.0.

bnumber

Blue channel value between 0.0 and 1.0.

anumber

Alpha channel value between 0.0 and 1.0.

Returns:

A reference to this render target.

Type: 
RenderTargetBase

setDepthClearValue(depth) → {RenderTargetBase}

Sets the clear depth value.

Parameters:
NameTypeDescription
depthnumber

The depth value.

Returns:

A reference to this render target.

Type: 
RenderTargetBase

setOcclusionQuerySet(querySet) → {RenderTargetBase}

Sets the occlusion query set.

Parameters:
NameTypeDescription
querySetQuerySet | null

The occlusion query set. If null, occlusion queries are disabled.

Returns:

A reference to this render target.

Type: 
RenderTargetBase

setStencilClearValue(stencil) → {RenderTargetBase}

Sets the clear stencil value.

Parameters:
NameTypeDescription
stencilnumber

The stencil value.

Returns:

A reference to this render target.

Type: 
RenderTargetBase

setTimestampWrites(querySet, beginIndexopt, endIndexopt) → {RenderTargetBase}

Sets the timestamp query set and the query indices.

Parameters:
NameTypeAttributesDefaultDescription
querySetQuerySet | null

The timestamp query set. If null, timestamp queries are disabled.

beginIndexnumber<optional>
0

The query index in querySet where the timestamp at the beginning of the render pass will be written.

endIndexnumber<optional>
1

The query index in querySet where the timestamp at the end of the render pass will be written.

Returns:

A reference to this render target.

Type: 
RenderTargetBase