Constructor
new OffscreenRenderTarget(width, height)
Create a new OffscreenRenderTarget.
Name | Type | Description |
---|---|---|
width | number | The width of the render target. |
height | number | The height of the render target. |
Extends
Members
activeCubeFace :number
An alias for OffscreenRenderTarget#activeLayer. Specifically represents the currently rendered cube face (0-5) when using cube textures.
- number
activeLayer :number
The active layer index for rendering. For cube render targets, this represents the active cube face.
- number
- Default Value
- 0
activeMipmapLevel :number
The active mipmap level for rendering. Not supported in WebGL1.
- number
- Default Value
- 0
clearColor :boolean
Whether to clear the color buffer before rendering to this render target.
- boolean
- Overrides
- Default Value
- true
clearDepth :boolean
Whether to clear the depth buffer before rendering to this render target.
- boolean
- Overrides
- Default Value
- true
clearStencil :boolean
Whether to clear the stencil buffer before rendering to this render target.
- boolean
- Overrides
- Default Value
- true
colorClearValue :Color4
Clear color value.
- Overrides
depthClearValue :number
Clear depth value.
- number
- Overrides
- Default Value
- 1
height :number
The height of the render target.
- number
- Overrides
(readonly) isOffscreenRenderTarget :boolean
This flag can be used for type testing.
- boolean
- Default Value
- true
(readonly) isRenderTarget :boolean
This flag can be used for type testing.
- boolean
- Overrides
- Default Value
- true
occlusionQuerySet :QuerySet|null
A querySet that will store the occlusion query results. If null, occlusion queries are disabled.
- QuerySet |
null
- Overrides
- Default Value
- null
stencilClearValue :number
Clear stencil value.
- number
- Overrides
- Default Value
- 0
texture :TextureBase|null
The main texture attachment which is the first color attachment.
- TextureBase |
null
timestampWrites :object
An array of objects defining where and when timestamp query values will be written.
- object
Name | Type | Description |
---|---|---|
querySet | QuerySet | | A timestamp querySet. If null, timestamp queries are disabled. |
beginningOfPassWriteIndex | number | A number specifying the query index in querySet where the timestamp at the beginning of the render pass will be written. |
endOfPassWriteIndex | number | A number specifying the query index in querySet where the timestamp at the end of the render pass will be written. |
- Overrides
width :number
The width of the render target.
- number
- Overrides
Methods
addEventListener(type, listener)
Adds a listener to an event type.
Name | Type | Description |
---|---|---|
type | string | The type of event to listen to. |
listener | function | The function that gets called when the event is fired. |
- Overrides
attach(target, attachmentopt) → {OffscreenRenderTarget}
Attach a texture(RTT) or renderbuffer to the framebuffer. Notice: For now, dynamic Attachment during rendering is not supported.
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
target | TextureBase | | The texture or renderbuffer to attach. | ||
attachment | ATTACHMENT | <optional> | ATTACHMENT.COLOR_ATTACHMENT0 | The attachment point. |
Self for chaining.
- Type:
- OffscreenRenderTarget
detach(attachmentopt) → {OffscreenRenderTarget}
Detach a texture(RTT) or renderbuffer.
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
attachment | ATTACHMENT | <optional> | ATTACHMENT.COLOR_ATTACHMENT0 | The attachment point to detach. |
Self for chaining.
- Type:
- OffscreenRenderTarget
dispatchEvent(event)
Fire an event.
Name | Type | Description |
---|---|---|
event | object | The event that gets fired. |
- Overrides
dispose(disposeAttachmentsopt)
Dispose the render target.
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
disposeAttachments | boolean | <optional> | true | Whether to dispose attachments as well. |
- Overrides
getAttachment(attachmentopt) → {TextureBase|RenderBuffer|null}
Get the attached attachment at the specified attachment point.
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
attachment | ATTACHMENT | <optional> | ATTACHMENT.COLOR_ATTACHMENT0 | The attachment point. |
The attached texture or renderbuffer.
- Type:
- TextureBase |
RenderBuffer | null
removeEventListener(type, listener)
Removes a listener from an event type.
Name | Type | Description |
---|---|---|
type | string | The type of the listener that gets removed. |
listener | function | The listener function that gets removed. |
- Overrides
resize(width, height, depthopt)
Resize the render target to the specified dimensions. This will resize all attached attachments.
Name | Type | Attributes | Description |
---|---|---|---|
width | number | The new width of the render target. | |
height | number | The new height of the render target. | |
depth | number | <optional> | DEPRECATED: Depth parameter is no longer used. Individual textures manage their own depth dimensions. |
- Overrides
setClear(coloropt, depthopt, stencilopt) → {RenderTargetBase}
Sets the clear state.
Name | Type | Attributes | Description |
---|---|---|---|
color | boolean | <optional> | Whether to clear the color buffer. |
depth | boolean | <optional> | Whether to clear the depth buffer. |
stencil | boolean | <optional> | Whether to clear the stencil buffer. |
- Overrides
A reference to this render target.
- Type:
- RenderTargetBase
setColorClearValue(r, g, b, a) → {RenderTargetBase}
Sets the clear values.
Name | Type | Description |
---|---|---|
r | number | Red channel value between 0.0 and 1.0. |
g | number | Green channel value between 0.0 and 1.0. |
b | number | Blue channel value between 0.0 and 1.0. |
a | number | Alpha channel value between 0.0 and 1.0. |
- Overrides
A reference to this render target.
- Type:
- RenderTargetBase
setDepthClearValue(depth) → {RenderTargetBase}
Sets the clear depth value.
Name | Type | Description |
---|---|---|
depth | number | The depth value. |
- Overrides
A reference to this render target.
- Type:
- RenderTargetBase
setOcclusionQuerySet(querySet) → {RenderTargetBase}
Sets the occlusion query set.
Name | Type | Description |
---|---|---|
querySet | QuerySet | | The occlusion query set. If null, occlusion queries are disabled. |
A reference to this render target.
- Type:
- RenderTargetBase
setStencilClearValue(stencil) → {RenderTargetBase}
Sets the clear stencil value.
Name | Type | Description |
---|---|---|
stencil | number | The stencil value. |
A reference to this render target.
- Type:
- RenderTargetBase
setTimestampWrites(querySet, beginIndexopt, endIndexopt) → {RenderTargetBase}
Sets the timestamp query set and the query indices.
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
querySet | QuerySet | | The timestamp query set. If null, timestamp queries are disabled. | ||
beginIndex | number | <optional> | 0 | The query index in querySet where the timestamp at the beginning of the render pass will be written. |
endIndex | number | <optional> | 1 | The query index in querySet where the timestamp at the end of the render pass will be written. |
- Overrides
A reference to this render target.
- Type:
- RenderTargetBase
(static) create2D(width, height) → {OffscreenRenderTarget}
Create a simple offscreen render target with a color texture and a depth-stencil renderbuffer.
Name | Type | Description |
---|---|---|
width | number | The width of the render target. |
height | number | The height of the render target. |
The created offscreen render target.
- Type:
- OffscreenRenderTarget
(static) create2DArray(width, height, depth) → {OffscreenRenderTarget}
Create a simple offscreen render target with a 2D array color texture. Note: No depth-stencil attachment is created by default.
Name | Type | Description |
---|---|---|
width | number | The width of the render target. |
height | number | The height of the render target. |
depth | number | The depth of the 2D array texture (number of layers). |
The created offscreen render target.
- Type:
- OffscreenRenderTarget
(static) create3D(width, height, depth) → {OffscreenRenderTarget}
Create a simple offscreen render target with a 3D color texture. Note: No depth-stencil attachment is created by default.
Name | Type | Description |
---|---|---|
width | number | The width of the render target. |
height | number | The height of the render target. |
depth | number | The depth of the 3D texture. |
The created offscreen render target.
- Type:
- OffscreenRenderTarget
(static) createCube(width, height) → {OffscreenRenderTarget}
Create a simple offscreen render target with a cube color texture and a depth-stencil renderbuffer.
Name | Type | Description |
---|---|---|
width | number | The width of the render target. |
height | number | The height of the render target. |
The created offscreen render target.
- Type:
- OffscreenRenderTarget