dot big bang

Developer API
Menu

Class Renderer

All
  • Public
  • Public/Protected
  • All

Hierarchy

  • Renderer

Index

Properties

Readonly background

background: Background

The Background object controls what color(s) to use as background of the rendered image. This is used to define the sky color in open environments.

Readonly fog

fog: Fog

The Fog effect, when enabled, causes 3D objects far in the distance to be rendered as single-color silhouettes.

Readonly lights

lights: Lights

The Lights object contains the settings for both the ambient and directional lights in the 3D scene.

Readonly postProcess

postProcess: PostProcess

The PostProcess object contains all the settings for the different image filter effects that can be applied at the end of the rendering pipeline (vignetting, bloom, etc...)

Methods

canvasToClipSpace

  • Converts a point in canvas space (i.e in CSS pixels from the top-left corner) into clip space. The clip space represents the volume of the camera frustum as a cube within which coordinates go from -1 to 1. Anything outside is not visible and gets discarded or "clipped" at render time, hence the name.

    Parameters

    • canvasPoint: Vector2

      The canvas point, in CSS pixels from the top-left corner of the canvas, to convert to clip space.

    • Optional clipSpaceZ: number

      If provided, set the z coordinate of the returned clip space point to this value. If not, 0 is used. A value of -1 puts the point on the near plane while 1 puts it on the far one. With a perspective camera, 0 isn't half-way between near and far as this is not a linear relationship (0 will actually be closer to the near plane than the far one as this is where most of the precision lies).

    • Optional optionalTarget: Vector3

      When provided, the clip space point is returned into this Vector3 instead of allocating one.

    Returns Vector3

clipSpaceToCanvas

  • Converts a point expressed in clip space into canvas space (i.e. in CSS pixels from the top-left corner). The clip space represents the volume of the camera frustum as a cube within which coordinates go from -1 to 1. Anything outside is not visible and gets discarded or "clipped" at render time, hence the name. The clip space point can either be a Vector2 or Vector3 as the z coordinate doesn't matter. That's because all clip space points with the same x and z (but different z) appear at the same 2D canvas position. Note that clip space points (Vector3) with coordinates outside the [-1, 1] range are not technically visible on the canvas, but will still be returned here.

    Parameters

    • clipSpacePoint: Vector3 | Vector2

      The clip space point to convert to canvas space.

    • Optional optionalTarget: Vector2

      When provided, the canvas point is returned into this Vector2 instead of allocating one.

    Returns Vector2

getCanvasSize

  • Returns the size of the 3D canvas in CSS pixels.

    Parameters

    • Optional optionalTarget: Vector2

      When provided, the size is returned into this Vector2 instead of allocating one.

    Returns Vector2