Light Object Facade (LightObject)

Published Updated
Detailed specification of the LightObject facade in the Aircada SDK, providing programmatic access to point, ambient, directional, spot, and area light configurations.

The LightObject represents a physical light emitter or ambient lighting component in the 3D scene (type: 'LIGHT'). It extends the base ISceneObject interface and exposes properties to configure optical properties, spatial lighting falloffs, and shadow-mapping buffers.

Developers declare relationships to LightObject instances using the @SceneObjectProperty() decorator. Once hydrated, Operators can dynamically turn lights on/off, alter color temperatures, adjust spot cones, and configure shadow rendering parameters.

Controlling Light Emission with Action Inputs#

Example illustrating using action inputs to trigger light emission states.

Example showing how to hide a Spotlight facade to disable its light emission.

typescript
// Turn off the ambient or spotlight emitter dynamically
this.spotlight.hide();
Calling hide() on spotlight emitter to stop emission dynamically.

Light Helper Interaction Events and Teardown#

Example illustrating how to bind click events to LightObjects to toggle intensity, and cleanly unsubscribe using the Dispose pattern.

Example showing how to subscribe to click events on a LightObject helper to toggle intensity and dispose listeners correctly.

LightingToggle.ts (typescript)
import { Setup, Dispose, Operator, SceneObjectProperty, LightObject } from "@aircada/spec";
import { SceneObjects } from "../registry/scene.registry";

@Operator({
    name: "Lighting Interactive Toggle",
    type: "LIGHTING_INTERACTIVE_TOGGLE"
})
export class LightingToggle {
    // Direct 3D mesh reference: matches an actual object in the 3D scene configured and referenced in the auto-generated scene.registry file.
    @SceneObjectProperty()
    spotlight: LightObject = SceneObjects.SPOTLIGHT_1;

    private unsubscribeToClick?: () => void;

    @Setup()
    setup() {
        // Attach click listener and save unsubscribe callback
        this.unsubscribeToClick = this.spotlight.onClick.addListener(() => {
            console.log("Light icon clicked! Toggling intensity...");
            this.spotlight.lightIntensity = this.spotlight.lightIntensity === 0 ? 15.0 : 0;
        });
    }

    @Dispose()
    dispose() {
        // Prevent memory leaks by cleaning up the listener
        this.unsubscribeToClick?.();
    }
}
Operator class toggling spotlight intensity on click and unsubscribing in dispose.

Declaring and Targeting LightObject Properties#

Example showing how to declare and target a LightObject property inside an Operator.

Example showing how to declare a LightObject and turn it on in setup.

LightingController.ts (typescript)
import { Setup, Operator, SceneObjectProperty, LightObject } from "@aircada/spec";
import { SceneObjects } from "../registry/scene.registry";

@Operator({
    name: "Lighting Controller",
    type: "LIGHTING_CONTROLLER"
})
export class LightingController {
    // Direct 3D mesh reference: matches an actual object in the 3D scene configured and referenced in the auto-generated scene.registry file.
    @SceneObjectProperty()
    spotlight: LightObject = SceneObjects.SPOTLIGHT_1;

    @Setup()
    setup() {
        // Turn on spotlight initially
        this.spotlight.show();
    }
}
Operator class declaring spotlight property as a LightObject and calling show().

Dynamic Lighting and Shadow Property Mutation#

Example demonstrating how to change light colors, decay thresholds, and custom spot cones dynamically.

Example showing how to configure amber alert mode on a Spotlight.

typescript
// Set to dynamic amber alert mode spotlight
this.spotlight.lightColor = "#FF8800";
this.spotlight.lightIntensity = 18.0;
this.spotlight.spotlightAngle = 0.4;
this.spotlight.spotlightFeather = 0.8; // Very soft boundaries
Modifying lightColor, lightIntensity, spotlightAngle, and spotlightFeather on LightObject.

LightObject Action Inputs and State Toggles#

Control methods exposed as inputs on LightObject instances to handle visibility and update properties.

Inputs represent imperative commands that can be called on LightObject facades:

Available Inputs:

  • show(): Enables the light emitter (turns the light ON).
  • hide(): Disables the light emitter (turns the light OFF).
  • dataInput(payload: DataBlock[]): Streams dynamic data blocks to drive visual colors or intensity levels.
  • show(): Turns on light emission.
  • hide(): Turns off light emission (zeroes out output energy).
  • dataInput(payload): Dynamic pipeline data intake.

LightObject Event Outputs and Helper Clicks#

Asynchronous event channels capturing click interactions on light helpers.

Outputs allow Operators to subscribe to reactive runtime events dispatched by the LightObject:

Available Outputs:

  • onClick: AirEvent<void>: Fired once upon completing a click interaction on the light helper body.
  • whileHeld: AirEvent<void>: Dispatched continuously every tick while the user maintains an active select on the helper body.
  • onRelease: AirEvent<void>: Dispatched when a click, select, or hold gesture is ended.
  • dataOutput: AirEvent<DataBlock[]>: Emits custom pipeline values downstream to other nodes.
  • onClick: Pointer click trigger on the light helper icon.
  • whileHeld: Pointer hold interaction stream.
  • onRelease: Hold ended trigger.
  • dataOutput: Custom pipeline event emitter for transferring serializable states.

LightObject Direct Illumination Properties#

Optical properties, spot controls, and shadow-mapping buffers available directly on LightObject instances.

A LightObject exposes direct physical properties to manage lighting characteristics and shadow projections in real time.

Optical & Emitter Properties:

  • lightType: Defines the light simulation. Values: POINT, AMBIENT, DIRECTIONAL, SPOTLIGHT, RECT_AREA_LIGHT.
  • lightColor: Hex string or normalized RGBA array defining the emitter color.
  • lightIntensity: Lumens intensity factor (FLOAT, Range: 0.01 to 25).
  • lightDecay: Decay attenuation rate over distance (FLOAT, Range: 0 to 10).
  • lightDistance: Maximum physical throw threshold before decay fully zero out (FLOAT, Range: 0 to 1000).

Spotlight Specifics:

  • spotlightAngle: Spotlight cone throw width (FLOAT, Range: 0 to 1).
  • spotlightFeather: Softness blending along the cone boundary (FLOAT, Range: 0 to 1).

Shadow Mapping Specifics:

  • useGlobalShadowSettings: Locks shadow-mapping variables to scene-wide defaults.
  • castShadows: Enables the emitter to cast shadows from objects intersecting its throw paths.
  • shadowMapSize: Resolution width/height of the shadow depth map buffer. Options: 512, 768, 1024.
  • shadowAreaSize: Bounds scaling for directional lights (FLOAT, Range: 0 to 100).
  • shadowRadius / Blur / Bias: Softness and depth offsets to optimize shadows and prevent artifact banding.

Helpers:

  • showLightHelperInViewMode: Renders visual cones and throw guides in view modes.
  • lightHelperOpacity: Opacity of the visual throw guidelines (FLOAT, Range: 0 to 1).
  • lightType: Enum defining physical light simulation characteristics.
  • lightIntensity: Relative output strength of the light emitter.
  • castShadows: Toggles shadow-map calculation for this specific light.
  • lightColor: Supports dynamic RGB array or HEX string values.

LightObject Transform Facade and Positioning#

Overview of the child transform facade hosted by LightObject instances.

Every LightObject hosts a sub-facade to delegate spatial coordinates: