Lens Scripting API

    Class Camera

    Renders SceneObjects to one or more Render Target textures.

    A Camera will only render a SceneObject if its render layer is enabled on the Camera.

    Hierarchy (View Summary, Expand)

    Index

    Constructors

    Properties

    aspect: number

    The aspect ratio of the camera (width/height).

    clearColor: vec4

    When enableClearColor is true and inputTexture is null, this color is used to clear this Camera's renderTarget before drawing to it.

    colorRenderTargets: ColorRenderTarget[]

    Returns an array of Color Render Targets. The first color render target is always available.

    depthBufferMode: DepthBufferMode

    Determines the way depth is handled on this Camera. Changing this can help sort objects at different distance ranges.

    depthStencilRenderTarget: DepthStencilRenderTarget

    Descriptor of depth/stencil textures and clear options.

    devicePropertyUsage: DeviceProperty

    Controls which Camera settings will be overridden by physical device properties. For example, this can be used to override the fov property to match the device camera's actual field of view.

    enableClearColor: boolean

    If enabled, this Camera will clear the color on its renderTarget before drawing to it. inputTexture will be used to clear it unless it is null, in which case clearColor is used instead.

    enableClearDepth: boolean

    If enabled, this Camera will clear the depth buffer on its renderTarget before drawing to it.

    enabled: boolean

    If disabled, the Component will stop enacting its behavior.

    far: number

    The distance of the far clipping plane.

    fov: number

    The Camera's field of view in radians.

    inputTexture: Texture

    When enableClearColor is true, this texture is used to clear this Camera's renderTarget before drawing. If this texture is null, clearColor will be used instead.

    isPhysical: boolean

    If true, the camera FOV will be overridden to match the device's physical camera FOV.

    maskTexture: Texture

    A texture controlling which parts of the output texture the camera will draw to. The "red" value of each pixel determines how strongly the camera will draw to that part of the image. For example, a completely black section will cause the camera to not draw there at all. A completely white (or red) section will cause the camera to draw normally. Colors in between, like gray, will be semitransparent.

    near: number

    The distance of the near clipping plane.

    rayTracing: any

    Toggles ray tracing for the camera. When true, ray tracing is enabled.

    renderLayer: LayerSet

    Controls the set of layers this Camera will render.

    renderOrder: number

    The sorting order the Camera renders in. Every frame, Cameras render in ascending order determined by their renderOrder properties.

    renderTarget: Texture

    The RenderTarget this Camera will draw to.

    renderTargetCubemapFace: CubemapFace

    Sets which face of the cubemap this camera will render to.

    sceneObject: SceneObject

    The scene object this component is on.

    size: number

    The orthographic size of the camera.

    supportedColorRenderTargetCount: number

    Returns a number of hardware supported render targets. The max number is 4. If the device doesnt support Multiple Render Targets this property equals 1.

    type: Type

    Controls which type of rendering the camera uses.

    uniqueIdentifier: string

    Methods

    • Adds layer id to the list of layers the Camera will render.

      Parameters

      • id: number

      Returns void

    • Returns whether rendering layer id is enabled for the Camera.

      Parameters

      • id: number

      Returns boolean

    • Return true if the device supports stencil operations and render to depth texture.

      Returns boolean

    • Destroys the component.

      Returns void

    • Returns a list of 32 numbers, one for every render layer. Values will either be 0 or 1, 0 meaning the Camera won't render the layer and 1 meaning it will.

      Returns number[]

    • For orthographic cameras, returns the camera size as (width, height).

      Returns vec2

    • Returns the number of possible render target bindings to the camera.

      Returns number

    • Returns the name of this object's type.

      Returns string

    • Returns true if the object matches or derives from the passed in type.

      Parameters

      • type: string

      Returns boolean

    • Returns true if this object is the same as other. Useful for checking if two references point to the same thing.

      Parameters

      Returns boolean

    • Returns true if a sphere with the specified world space center position and radius is visible within the camera frustum, false otherwise.

      Parameters

      • center: vec3
      • radius: number

      Returns boolean

    • Converts a world space position to a raw screen space position. The screen space position will be returned as a vec3 with x,y representing normalized screen space, and z representing a raw depth value not directly convertible to world units. This returned value will mostly be useful for passing into unproject().

      Parameters

      • worldSpacePoint: vec3

      Returns vec3

    • Removes layer id from the list of layers the Camera will render.

      Parameters

      • id: number

      Returns void

    • Converts a screen space position to a world space position, given an absolute depth. The screen space position should be provided as a vec2 in the range ([0-1], [0-1]), (0,0) being the top-left of the screen and (1,1) being the bottom-right. The returned world space position will be the point absoluteDepth units away from the Camera's near plane at the point specified in screen space.

      Parameters

      • normalizedScreenSpacePoint: vec2
      • absoluteDepth: number

      Returns vec3

    • Converts a raw screen space position to a world space position. clipSpacePoint should be a vec3 returned from a previous project() call, since the z value represents a raw depth value not directly convertible to world units.

      Parameters

      • clipSpacePoint: vec3

      Returns vec3

    • Converts the world space position worldSpacePoint to a screen space position. Screen positions are represented in the range ([0-1], [0-1]), (0,0) being the top-left of the screen and (1,1) being the bottom-right.

      Parameters

      • worldSpacePoint: vec3

      Returns vec2

    MMNEPVFCICPMFPCPTTAAATR