PerspectiveCamera Class

Module: Cameras

Perspective camera, used for 3D scenes with objects getting smaller as they get away from the camera.

Based on PerspectiveCamera, original documentation available at https:// threejs.org/docs/index.html#Reference/Cameras/PerspectiveCamera.

Methods

destroy

()

Destroy camera object and remove it from the scene.

render

(
  • renderer
  • scene
)

Render a scene using this camera and the internal EffectComposer.

Parameters:

  • renderer WebGLRenderer

    WebGL renderer to use.

  • scene Scene

    Scene to be rendered.

resize

(
  • x
  • y
  • viewport
)

Resize this camera, should be called every time after resizing the screen.

Updates the viewport, rendering composer and the camera projection matrix.

Parameters:

  • x Number

    Width of the screen.

  • y Number

    Height of the screen.

  • viewport Viewport

    Viewport that encapsulates the viewport of the camera.

setupRenderer

(
  • renderer
)

Prepare the renderer to render the frame using the camera settings.

Should be called before the render() method to setup clear configuration and viewport.

Parameters:

  • renderer WebGLRenderer

    WebGL renderer to configure.

updateProjectionMatrix

()

Update camera projection matrix.

Should be called after chaging projection parameters.

Properties

aspect

Number

Camera aspect ratio X/Y.

Default: 1.0

clearColor

Boolean

Clear screen color flag.

Default: false

clearDepth

Boolean

Clear depth flag.

Default: false

clearDepth

Boolean

Clear stencil buffer flag.

Default: false

composer

EffectComposer

Effect composed of this camera. Is used to render the scene to the screen and apply effects.

It is inialized with a RenderPass attached to it.

fov

Number

Camera field of view in degrees.

Default: 50

order

Number

Camera draw order preference.

If more than one camera has the same order value the draw order is undefined for those cameras.

Default: 0

viewport

Viewport

Camera viewport indicates where the image is drawn on the screen.

zoom

Number

Camera zoom.

Default: 1.0