dot big bang

Developer API
Menu

Class CameraComponent

All
  • Public
  • Public/Protected
  • All

Hierarchy

Index

Constructors

constructor

Properties

far

far: number

Distance from the camera to the far-plane of the camera frustum, in world units.

fov

fov: number

The vertical field of view of the camera. This is the angle, in degrees, between the top and bottom planes of the camera Frustum.

Readonly id

id: string

The 36-character identifier string of the Component. The id is unique within the Entity is belongs to. Currently, the same id may be used by another Component on a different Entity.

near

near: number

Distance from the camera to the near-plane of the camera frustum, in world units.

Readonly type

The type of the Component.

Accessors

entity

  • Gets the Entity the Component is part of. This throws an exception if the Component is not in an Entity. Use the isInEntity property to test for that.

    Returns Entity

game

  • Gets the Game the Component is part of (via the Entity it belongs to). This throws an exception if the Component is not in the game. Use the isInGame property to test for that.

    Returns Game<{ saveData: SaveData<any, any> }>

isInEntity

  • get isInEntity(): boolean
  • Returns true if the Component is part of an Entity.

    Returns boolean

isInGame

  • get isInGame(): boolean
  • Returns true if the Component is part of the Game (via the Entity it belongs to).

    Returns boolean

Methods

clipSpaceToWorld

  • Converts a point expressed in clip space into world 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

    • clipSpacePoint: Vector3

      The clip space point to convert to world space.

    • Optional optionalTarget: Vector3

      When provided, return the world space point into this Vector3 instead of allocating one.

    Returns Vector3

getProjectionMatrix

  • Returns the projection matrix of this camera. Applying this matrix to a point expressed in camera local space (aka "view" or "eye" space), converts it to a point in 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. Note that applying it, here, means using Vector3.applyProjection() to perform the perspective divide, not just applyMatrix4().

    Parameters

    • Optional optionalTarget: Matrix4

      When provided, return the projection matrix into this Matrix4 rather than allocate one.

    Returns Matrix4

worldToClipSpace

  • Converts a point expressed in world space 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

    • worldPoint: Vector3

      The world point to convert to clip space.

    • Optional optionalTarget: Vector3

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

    Returns Vector3