Controls the rendering of a branch, using the given ComponentCamera, and the propagation of the rendered image from the offscreen renderbuffer to the target canvas through a series of Framing objects. The stages involved are in order of rendering Render.viewport -> Viewport.source -> Viewport.destination -> DOM-Canvas -> Client(CSS)

Authors

Jascha Karagöl, HFU, 2019 | Jirka Dell'Oro-Friedl, HFU, 2019-2022 | Jonas Plotzky, HFU, 2023

Link

https://github.com/hs-furtwangen/FUDGE/wiki/Viewport

Hierarchy (view full)

Constructors

Properties

adjustingCamera: boolean = true
adjustingFrames: boolean = true
camera: ComponentCamera = null
componentsPick: RecycableArray<ComponentPick> = ...
frameCanvasToDestination: FramingComplex = ...
frameClientToCanvas: FramingScaled = ...
frameDestinationToSource: FramingScaled = ...
frameSourceToRender: FramingScaled = ...
gizmosEnabled: boolean = false
gizmosFilter: {
    [_gizmo: string]: boolean;
} = ...

Type declaration

  • [_gizmo: string]: boolean
gizmosSelected: Node[]
name: string = "Viewport"
physicsDebugMode: PHYSICS_DEBUGMODE = PHYSICS_DEBUGMODE.NONE
rectDestination: Rectangle
rectSource: Rectangle

Accessors

  • get context(): CanvasRenderingContext2D
  • Retrieve the 2D-context attached to the destination canvas

    Returns CanvasRenderingContext2D

  • get hasFocus(): boolean
  • Returns true if this viewport currently has focus and thus receives keyboard events

    Returns boolean

Methods

  • Adjust all frames involved in the rendering process from the display area in the client up to the renderer canvas

    Returns void

  • Performs a pick on all ComponentPicks in the branch of this viewport using a ray from its camera through the client coordinates given in the event. Dispatches the event to all nodes hit.
    If PICK.CAMERA was chosen as the method to pick, a pick property gets added to the event, which holds the detailed information, but is overwritten for each node.

    Parameters

    • _event: PointerEvent

    Returns void

  • Draw this viewport displaying its branch. By default, the transforms in the branch are recalculated first. Pass false if calculation was already done for this frame

    Parameters

    • _prepareBranch: boolean = true

    Returns void

  • Connects the viewport to the given canvas to render the given branch to using the given camera-component, and names the viewport as given.

    Parameters

    Returns void

  • Returns a point on a projection surface in the hypothetical distance of 1 to the camera
    matching the given point on the client rectangle TODO: examine, if this should be a camera-method. Current implementation is for central-projection

    Parameters

    Returns Vector2

  • Returns a point in the client rectangle matching the given point in normed clipspace rectangle, which stretches from -1 to 1 in both dimensions, y pointing up

    Parameters

    Returns Vector2

  • Returns a point in the client rectangle matching the given point in normed clipspace rectangle, which stretches from -1 to 1 in both dimensions, y pointing up

    Parameters

    Returns Vector2

  • Adjusts all frames and the camera to fit the current size of the canvas. Prepares the branch for rendering.

    Parameters

    • _prepareBranch: boolean = true

    Returns void