UNPKG

@megavr/ecsy-babylon

Version:

babylon.js ecsy binding and helpers

47 lines (46 loc) 1.72 kB
import * as BABYLON from "@babylonjs/core"; import { Entity } from "ecsy"; import { SceneComponent, XYZProperties, ColorComponent, LightColorProperties } from "./types/index"; export declare enum LightTypes { Point = "Point", Directional = "Directional", Spot = "Spot", Hemispheric = "Hemispheric" } /** * @example * ``` * entity.addComponent(Light, { color: { diffuse: "#AAFFAA" } }); * entity.addComponent(Light, { type: LightTypes.Point, intensity: 2 }); * entity.addComponent(Light, { type: LightTypes.Directional, direction: { x: 0, y: 0, z: 1 } }); * entity.addComponent(Light, { type: LightTypes.Spot, direction: { x: 0, y: 0, z: 1 }, angle: 30, exponent: 2 }); * ``` */ export declare class Light implements SceneComponent, ColorComponent<LightColorProperties> { scene?: Entity; object: BABYLON.HemisphericLight | BABYLON.ShadowLight; /** @default "Hemispheric" */ type?: LightTypes; color?: LightColorProperties; /** * @see https://doc.babylonjs.com/api/classes/babylon.shadowlight#direction * @default 0,0,0 */ direction: XYZProperties; /** @see https://doc.babylonjs.com/api/classes/babylon.light#intensity */ intensity?: number; /** @see https://doc.babylonjs.com/api/classes/babylon.light#radius */ radius?: number; /** @see https://doc.babylonjs.com/api/classes/babylon.light#range */ range?: number; /** * @see https://doc.babylonjs.com/api/classes/babylon.spotlight#angle * @memberof Spot */ angle?: number; /** * @see https://doc.babylonjs.com/api/classes/babylon.spotlight#exponent * @memberof Spot */ exponent?: number; }