HomeWeb Components API Reference - v0.31.0
    Preparing search index...

    Class CameraComponentElement

    The CameraComponentElement interface provides properties and methods for manipulating <pc-camera> elements. The CameraComponentElement interface also inherits the properties and methods of the HTMLElement interface.

    Engine component: CameraComponent (camera).

    Hierarchy (View Summary)

    Index
    clearColor: Color

    The clear color of the camera.

    clearColorBuffer: boolean

    The clear color buffer of the camera.

    clearDepth: number

    The depth value the depth buffer is cleared to. Defaults to 1.

    clearDepthBuffer: boolean

    The clear depth buffer of the camera.

    clearStencilBuffer: boolean

    The clear stencil buffer of the camera.

    clipIntersection: boolean

    Whether the clipping planes of the camera clip only what is behind all of them, in place of what is behind any of them. Two planes then cut out a wedge, and three a corner. Defaults to false.

    clippingPlanes: Plane[]

    The planes, in world space, that clip everything the camera renders. They clip as a section view does: what is behind a plane, on the side its normal points away from, is not rendered. The planes do not clip shadows or screen space elements. Up to 8 planes are used. The planes are copied, so assign the array again to apply a change to one. Defaults to no planes.

    cullFaces: boolean

    The cull faces of the camera.

    farClip: number

    The far clip distance of the camera.

    flipFaces: boolean

    The flip faces of the camera.

    fov: number

    The field of view of the camera.

    frustumCulling: boolean

    The frustum culling of the camera.

    gamma: "linear" | "srgb"

    The gamma correction of the camera.

    horizontalFov: boolean

    Whether the camera's field of view (fov) is horizontal or vertical. Defaults to false, which is vertical.

    nearClip: number

    The near clip distance of the camera.

    orthoHeight: number

    The orthographic height of the camera.

    priority: number

    The priority of the camera.

    projection: "perspective" | "orthographic"

    The projection of the camera. Can be perspective or orthographic. Use orthoHeight to size an orthographic projection.

    projectionOffset: Vec2

    The offset of the projection window from the view direction. It gives an off-center (shift lens) projection, in half-frustum units: 0 1 moves the window up by half the frustum height. Keeping the camera level and shifting the window frames a tall subject with its verticals parallel. Applies to both projections and is ignored in XR. Defaults to 0 0.

    rect: Vec4

    The rect of the camera.

    sceneColorMap: boolean

    Whether the camera renders a copy of the scene's color for its materials to sample, which refractive materials - such as glTF materials with transmission - need to show what is behind them. The copy is made every frame, so leave it off unless a material uses it. A camera rendered through the cameraFrame script takes this from that script's rendering.sceneColorMap instead. Defaults to false.

    scissorRect: Vec4

    The scissor rect of the camera.

    tonemap: Tonemap

    The tone mapping of the camera. Can be none, linear, filmic, hejl, aces, aces2, neutral, agx or agx-punchy. Defaults to linear, which applies the scene exposure and nothing else; none skips the exposure too. agx gives a neutral, flat look that suits color grading, and agx-punchy raises its contrast and saturation.

    • get closestApp(): AppElement | null

      The nearest ancestor <pc-app> element, or null if this element has no <pc-app> ancestor. The search starts at the parent, so an element never resolves to itself.

      Returns AppElement | null

      The closest app element, or null.

    • get closestEntity(): EntityBaseElement | null

      The nearest ancestor element that fronts an entity — <pc-entity>, <pc-model> or <pc-node> — or null if this element has no such ancestor. The search starts at the parent, so an element never resolves to itself.

      Returns EntityBaseElement | null

      The closest entity-fronting element, or null.

    • get enabled(): boolean

      Gets the enabled state of the component.

      Returns boolean

      The enabled state of the component.

    • set enabled(value: boolean): void

      Sets the enabled state of the component.

      Parameters

      • value: boolean

        The enabled state of the component.

      Returns void

    • Called when the element is fully initialized and ready. Subclasses should call this when they're ready. Resolves the ready promise and dispatches a bubbling, composed ready event. Signals at most once per readiness cycle: a repeat call before _resetReady has re-armed the promise does nothing.

      Returns void

    • Returns the ready promise to its pending state. Subclasses should call this when the resource their readiness announced is torn down (typically from disconnectedCallback), so that a later re-initialization can signal readiness again. Does nothing while the promise is still pending — an in-flight waiter carries over to the next readiness cycle rather than being stranded on a promise nothing will ever resolve.

      Returns void

    • Returns the data the component is created with: the value of every attribute in the subclass's schema. Overridden by subclasses that cache their properties themselves, to supply those. The element's enabled state is not among them: the base class adds it when it creates the component.

      Returns object

      The initial component data.

    • Returns a promise that resolves with this element when it's ready. This is the low-level primitive underlying whenReady, which is the recommended way to wait for elements.

      Readiness tracks the element's current lifecycle: once a ready element is torn down (for example by removing it from the document), this returns a fresh promise that resolves when the element is next ready. A promise obtained earlier stays resolved — call this again after re-inserting an element rather than reusing a promise from before its removal.

      Returns Promise<CameraComponentElement>

      A promise that resolves with this element when it's ready.

    • Starts the camera in XR mode.

      Parameters

      • type: "immersive-ar" | "immersive-vr"

        The type of XR mode to start.

      • space: "bounded-floor" | "local" | "local-floor" | "unbounded" | "viewer"

        The space to start the camera in.

      Returns void