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 CameraInheritance
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
| Property | Type | Default | Description |
|---|---|---|---|
name | string | '' | The name of this light, used to identify it in the scene graph. |
lightType | string | '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 Property | Type | Description |
|---|---|---|
nearPlane | number | Near clip distance (camera use). |
farPlane | number | Far clip distance (camera use). |
aspect | number | Aspect ratio (camera use). |
Notes
Lightis constructed withnew Light(name?, lightType?). Both parameters are optional; the default light type is'POINT'.- The
lightTypestring values are uppercase and matchLightTypeenumeration 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
Propertyobjects accessible viagetProperty().