import ClayNode, { ClayNodeOpts } from './Node'; import Light from './Light'; import Camera from './Camera'; import BoundingBox from './math/BoundingBox'; import * as mat4 from './glmatrix/mat4'; import type Renderable from './Renderable'; import type Material from './Material'; import Skybox from './Skybox'; import { GeneralMaterialUniformObject } from './Material'; export declare class RenderList { opaque: Renderable[]; transparent: Renderable[]; private _opaqueCount; private _transparentCount; startCount(): void; add(object: Renderable, isTransparent?: boolean): void; endCount(): void; } interface SceneOpts extends ClayNodeOpts { /** * Global material of scene */ material?: Material; } interface Scene extends SceneOpts { } declare class Scene extends ClayNode { lights: Light[]; /** * Scene bounding box in view space. * Used when camera needs to adujst the near and far plane automatically * so that the view frustum contains the visible objects as tightly as possible. * Notice: * It is updated after rendering (in the step of frustum culling passingly). So may be not so accurate, but saves a lot of calculation */ viewBoundingBoxLastFrame: BoundingBox; shadowUniforms: Record; skybox?: Skybox; private _cameraList; private _lightUniforms; private _previousLightNumber; private _lightNumber; private _lightProgramKeys; private _nodeRepository; private _renderLists; constructor(opts?: Partial); addToScene(node: ClayNode): void; removeFromScene(node: ClayNode): void; /** * Set main camera of the scene. * @param {claygl.Camera} camera */ setMainCamera(camera: Camera): void; /** * Get main camera of the scene. */ getMainCamera(): Camera<"perspective" | "orthographic">; getLights(): Light[]; updateLights(): void; /** * Clone a node and it's children, including mesh, camera, light, etc. * Unlike using `Node#clone`. It will clone skeleton and remap the joints. Material will also be cloned. * */ cloneNode(node: T): T; /** * Traverse the scene and add the renderable object to the render list. * It needs camera for the frustum culling. * * @param {clay.Camera} camera * @param {boolean} updateSceneBoundingBox * @return {clay.Scene.RenderList} */ updateRenderList(camera: Camera, updateSceneBoundingBox?: boolean): RenderList; /** * Get render list. Used after {@link clay.Scene#updateRenderList} * @param {clay.Camera} camera * @return {clay.Scene.RenderList} */ getRenderList(camera: Camera): RenderList | undefined; _doUpdateRenderList(parent: ClayNode, camera: Camera, sceneMaterialTransparent: boolean, renderList: RenderList, updateSceneBoundingBox?: boolean): void; /** * If an scene object is culled by camera frustum * * Object can be a renderable or a light * * @param {clay.Node} object * @param {clay.Camera} camera * @param {Array.} worldViewMat represented with array * @param {Array.} projectionMat represented with array */ isFrustumCulled(object: Renderable, camera: Camera, worldViewMat: mat4.Mat4Array): boolean; _updateLightUniforms(): void; getLightGroups(): string[]; getNumberChangedLightGroups(): string[]; private _isLightNumberChanged; getLightsNumbers(lightGroup: number): Record; getProgramKey(lightGroup: number): string; getLightUniforms(lightGroup: number): Record[]; /** * Dispose self, clear all the scene objects * But resources of gl like texuture, shader will not be disposed. * Mostly you should use disposeScene method in Renderer to do dispose. */ dispose(): void; } export default Scene;