UNPKG

@needle-tools/engine

Version:

Needle Engine is a web-based runtime for 3D apps. It runs on your machine for development with great integrations into editors like Unity or Blender - and can be deployed onto any device! It is flexible, extensible and networking and XR are built-in.

72 lines (71 loc) 2.84 kB
import { LightProbe, Texture, Vector4, WebGLCubeRenderTarget } from "three"; import { AssetReference } from "./engine_addressables.js"; import { Context } from "./engine_setup.js"; import { type SourceIdentifier } from "./engine_types.js"; import { SceneLightSettings } from "./extensions/NEEDLE_lighting_settings.js"; /** @internal */ export declare type SphericalHarmonicsData = { array: number[]; texture: WebGLCubeRenderTarget | Texture; lightProbe?: LightProbe; }; /** @internal */ export declare enum AmbientMode { Skybox = 0, Trilight = 1, Flat = 3, Custom = 4 } /** @internal */ export declare enum DefaultReflectionMode { Skybox = 0, Custom = 1 } /** * The RendererData class is used to manage the lighting settings of a scene. * It is created and used within the Needle Engine Context. */ export declare class RendererData { private context; constructor(context: Context); private _currentLightSettingsId?; private _sceneLightSettings?; private preUpdate; private _timevec4; /** Time data used for custom shaders * x: time * y: sin(time) * z: cos(time) * w: deltaTime */ get timeVec4(): Vector4; /** the current environment intensity */ get environmentIntensity(): number; /** Get all currently registered scene light settings */ get sceneLightSettings(): IterableIterator<SceneLightSettings> | undefined; /** set the scene lighting from a specific scene. Will disable any previously enabled lighting settings */ enable(sourceId: SourceIdentifier | AssetReference): boolean; /** disable the lighting of a specific scene, will only have any effect if it is currently active */ disable(sourceId: SourceIdentifier | AssetReference): boolean; /** Disables the currently active scene lighting (if any), returns the id of the previously active lighting */ disableCurrent(): SourceIdentifier | null; /** @internal */ internalRegisterSceneLightSettings(sceneLightSettings: SceneLightSettings): void; /** @internal */ internalUnregisterSceneLightSettings(sceneLightSettings: SceneLightSettings): void; /** @internal */ internalRegisterReflection(sourceId: SourceIdentifier, reflectionTexture: Texture): void; /** @internal */ internalGetReflection(sourceId: SourceIdentifier): LightData | null | undefined; private __currentReflectionId; /** @internal */ internalEnableReflection(sourceId: SourceIdentifier): void; /** @internal */ internalDisableReflection(sourceId?: SourceIdentifier): void; private _lighting; } export declare class LightData { get Source(): Texture; private _source; constructor(_context: Context, tex: Texture, _ambientScale?: number); }