Class Light

Package: @aspose/3d (v24.12.0)

Light is an Entity that can be attached to a Node to add a light source to the scene. The light type is set via the lightType property. Because Light extends Camera in the source, it inherits all camera properties (nearPlane, farPlane, aspect, etc.) from the underlying FBX data model — those properties are not meaningful for lighting and can be ignored in standard usage.

export class Light extends Camera

Inheritance

A3DObject ← SceneObject ← Entity ← Camera ← Light

Examples

Add a point light to a scene.

import { Scene, Node } from '@aspose/3d';
import { Light } from '@aspose/3d';

const scene = new Scene();
scene.open('model.obj');

const lightNode = scene.rootNode.createChildNode('sun');
const light = new Light('sun', 'DIRECTIONAL');
lightNode.entity = light;

// Position the light node above the scene
lightNode.transform.setTranslation(0, 10, 0);

scene.save('lit-model.fbx');
console.log(`Light type: ${light.lightType}`);
// Light type: DIRECTIONAL

Properties

PropertyTypeDefaultDescription
namestring''The name of this light, used to identify it in the scene graph.
lightTypestring'POINT'The kind of light. Accepted values match the LightType enumeration: 'POINT', 'DIRECTIONAL', or 'SPOT'.

The following properties are inherited from Camera and are available on Light objects in the type system, though they are relevant only when the node is used as a camera:

Inherited PropertyTypeDescription
nearPlanenumberNear clip distance (camera use).
farPlanenumberFar clip distance (camera use).
aspectnumberAspect ratio (camera use).

Notes

  • Light is constructed with new Light(name?, lightType?). Both parameters are optional; the default light type is 'POINT'.
  • The lightType string values are uppercase and match LightType enumeration names: 'POINT', 'DIRECTIONAL', 'SPOT'.
  • Shadow casting, color, intensity, and falloff properties found in full-featured 3D engines are not exposed as direct TypeScript properties in this version of the library. These values may be present in the loaded data as generic Property objects accessible via getProperty().