Skip to main content

RenderingSurfaceBase

@3dverse/livelink v0.8.10


@3dverse/livelink / RenderingSurfaceBase

Class: abstract RenderingSurfaceBase

Defined in: livelink.js/sources/rendering/surfaces/RenderingSurfaceBase.ts:23

Abstract class for rendering surfaces.

A rendering surface represents the final destination of the rendered frame.

It is usually backed by an HTML Canvas or an OffscreenCanvas.

It can be split into multiple viewports, each with its own camera and render target. The rendering surface if responsible for holding the viewports and their configurations.

It is finally responsible for drawing the portions of the final frame to its backing element.

Extends

  • EventTarget

Extended by

Constructors

new RenderingSurfaceBase()

new RenderingSurfaceBase(): RenderingSurfaceBase

Defined in: node_modules/typescript/lib/lib.dom.d.ts:8320

Returns

RenderingSurfaceBase

Inherited from

EventTarget.constructor

Properties

viewports

readonly viewports: Viewport[] = []

Defined in: livelink.js/sources/rendering/surfaces/RenderingSurfaceBase.ts:27

List of viewports bound to the current surface.


offset

offset: Vec2

Defined in: livelink.js/sources/rendering/surfaces/RenderingSurfaceBase.ts:32

Offset of the surface relative to the remote rendering surface.

Accessors

width

Get Signature

get abstract width(): number

Defined in: livelink.js/sources/rendering/surfaces/RenderingSurfaceBase.ts:37

Width of the surface.

Returns

number


height

Get Signature

get abstract height(): number

Defined in: livelink.js/sources/rendering/surfaces/RenderingSurfaceBase.ts:42

Height of the surface.

Returns

number

Methods

getBoundingRect()

abstract getBoundingRect(): Rect

Defined in: livelink.js/sources/rendering/surfaces/RenderingSurfaceBase.ts:47

Returns the bounding rectangle of the surface.

Returns

Rect


drawFrame()

abstract drawFrame(params): void

Defined in: livelink.js/sources/rendering/surfaces/RenderingSurfaceBase.ts:56

Draws the portions of the frame associated with the viewports to the backing element.

Parameters

params
frame

OffscreenCanvas | VideoFrame

The frame to draw.

meta_data

FrameMetaData

The metadata associated with the frame.

Returns

void


addViewport()

addViewport(params): void

Defined in: livelink.js/sources/rendering/surfaces/RenderingSurfaceBase.ts:67

Adds a viewport to the current surface.

Note that the viewport knows which section of the surface it should draw to using its Viewport.relative_rect property.

Parameters

params
viewport

Viewport

The viewport to add.

Returns

void


removeViewport()

removeViewport(params): void

Defined in: livelink.js/sources/rendering/surfaces/RenderingSurfaceBase.ts:77

Removes a viewport from the current surface.

Parameters

params
viewport

Viewport

The viewport to remove.

Returns

void


release()

release(): void

Defined in: livelink.js/sources/rendering/surfaces/RenderingSurfaceBase.ts:87

Releases the resources associated with the current surface.

Returns

void


isValid()

isValid(): boolean

Defined in: livelink.js/sources/rendering/surfaces/RenderingSurfaceBase.ts:97

Returns whether the current surface is valid.

Returns

boolean


addEventListener()

addEventListener(type, callback, options?): void

Defined in: node_modules/typescript/lib/lib.dom.d.ts:8303

Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.

The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.

When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.

When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.

When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.

If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.

The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.

MDN Reference

Parameters

type

string

callback

null | EventListenerOrEventListenerObject

options?

boolean | AddEventListenerOptions

Returns

void

Inherited from

EventTarget.addEventListener


dispatchEvent()

dispatchEvent(event): boolean

Defined in: node_modules/typescript/lib/lib.dom.d.ts:8309

Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise.

MDN Reference

Parameters

event

Event

Returns

boolean

Inherited from

EventTarget.dispatchEvent


removeEventListener()

removeEventListener(type, callback, options?): void

Defined in: node_modules/typescript/lib/lib.dom.d.ts:8315

Removes the event listener in target's event listener list with the same type, callback, and options.

MDN Reference

Parameters

type

string

callback

null | EventListenerOrEventListenerObject

options?

boolean | EventListenerOptions

Returns

void

Inherited from

EventTarget.removeEventListener