@kognifai/cogsengine
    Preparing search index...

    Class CameraComponent

    Defines a camera. Cameras are used by the renderer to perform culling and rendering of the scene.

    Hierarchy (View Summary)

    Index

    Constructors

    • Internal: Component constructor

      Parameters

      • type: string

        type of the component. Ex. "TransformComponent"

      • entity: Entity

        Owning entity. Entity only passed when wrapping existing entity.

      Returns CameraComponent

    Properties

    clientFlags: number

    Application defined, camera specific flags passed to shaders.

    discardThreshold: number

    Discard objects occupying less pixels than threshold. Set to zero to disable.

    enableClippingPlaneAdjustment: boolean

    If automatic adjustment of the clipping planes should be performed to fit as much of the scene as possible.

    environment: Entity

    Environment to use for rendering.

    exposure: number

    Exposure factor for HDR rendering.

    farDistance: number

    Distance to the far plane, given in scene units. Only used if enableClippingPlaneAdjustment is false.

    farPlaneLimit: number

    Largest value allowed to adjust far plane to.

    fieldOfView: number

    Vertical field of view, given in radians.

    Camera behavior flags.

    focalDistance: number

    Focal distance of the camera, given in scene units.

    isTyped: boolean

    Internal flag set if component is a Cogs Core component.

    keepThreshold: number
    layerMask: RenderLayers

    Layer mask used to determine which RenderComponent instances should be visible in this cameras viewport. The layer mask is combined with the layer of the component, and combined with the component visibility to determine if any rendering should take place.

    lightingMask: LightingLayers

    Lighting mask used to determine which lights are active for the current viewport. The layer mask is combined with the lighting layer of any light components, and of any rendering tasks lighting layer mask.

    nearDistance: number

    Distance to the near plane, given in scene units. Only used if enableClippingPlaneAdjustment is false.

    nearPlaneLimit: number

    Smallest value allowed to adjust near plane to.

    orthoHeight: number

    Height of the viewport in scene units when using orthographic projection. The width of the projection is determined by the aspect ratio given by viewportSize.

    projectionMode: ProjectionMode

    The projection mode to use for the camera.

    renderPipeline: string

    Render pipeline to apply when rendering to texture. Defaults to the built-in forward rendering pipeline.

    renderPipelineOptions: string[]

    Extra options passed when creating the render pipeline,.

    renderTexture: TextureResource

    The render texture to output the rendered scene from the camera to.

    stackOrder: number

    Specifies the ordering of cameras when rendering to the same render target, lower numbers render before higher numberrs.

    subsetMax: vec2

    Subset of the frustum to view (for only rendering a subset of the view covered by the viewport), range [0,1].

    subsetMin: vec2

    Subset of the frustum to view (for only rendering a subset of the view covered by the viewport), range [0,1].

    viewportOrigin: vec2

    Origin of the viewport covered by this instance, given in screen units from the lower left.

    viewportSize: vec2

    Size of the viewport covered by this instance, given in pixels.

    Accessors

    • get entity(): Entity

      Gets the optional owning entity

      Returns Entity

    • set entity(entity: Entity): void

      Internal: set owning entity.

      Parameters

      Returns void

    • get name(): string

      Component name == type. For compatibility

      Returns string

    • get projectionMatrix(): mat4

      Gets calculated projection matrix for this camera. Cogs.js custom field

      Returns mat4

    • get type(): string

      Gets the type of the component. Ex. "TransformComponent", "SceneComponent" etc.

      Returns string

    • get viewMatrix(): mat4

      Gets calculated view matrix for this camera. Cogs.js custom field

      Returns mat4

    Methods

    • Internal: Creates a new component of the given type (name). Component is wrapped when adding to an entity.

      Parameters

      • type: string

        Type of the component. Ex. "TransformComponent"

      Returns Component

      Created Cogs.js component.

    • Internal: Creates a new component being wrapped as an existing member of the entity

      Parameters

      • type: string

        Type of the component. Ex. "TransformComponent"

      • entity: Entity

        The owning entity

      Returns Component

      Created Cogs.js component.