UNPKG

@woosh/meep-engine

Version:

Pure JavaScript game engine. Fully featured and production ready.

96 lines (84 loc) 2.9 kB
import { passThrough } from "../../../../core/function/passThrough.js"; import { compare_three_objects } from "../../three/compare_three_objects.js"; import { IncrementalDeltaSet } from "../visibility/IncrementalDeltaSet.js"; import { RenderLayerState } from "./RenderLayerState.js"; export class RenderLayer { /** * * @type {RenderLayerState} */ state = new RenderLayerState(); /** * * @type {String|null} */ name = null; /** * Layer is managed externally, visibility will not be updated in the rendering engine * @deprecated * @type {boolean} */ managed = false; /** * * @type {function(*): Object3D} */ extractRenderable = passThrough; /** * @deprecated use CameraView's visible set instead * Contains visible elements across all views, if element is in at least one view - it will be here * @deprecated * @type {IncrementalDeltaSet<THREE.Object3D>} */ visibleSet = new IncrementalDeltaSet(compare_three_objects); /** * @deprecated * @returns {boolean} */ get visible() { return this.state.visible; } /** * @deprecated * @param {boolean} v */ set visible(v) { this.state.visible = v; } /** * Compute near and far clipping planes for a camera given a frustum. * Note: near plane is frustum.planes[4], far plane is frustum.planes[5] * @deprecated * @param {Frustum} frustum * @param {number} near * @param {number} far * @param {function(near:number, far:number)} callback * @param [thisArg] */ computeNearFarClippingPlanes(frustum, near, far, callback, thisArg) { throw new Error('deprecated'); } /** * @deprecated * @param {THREE.Object3D[]} destination * @param {number} destination_offset * @param {CameraView} view * @returns {number} Number of records added to destination */ buildVisibleSet(destination, destination_offset, view) { throw new Error('deprecated'); } /** * Expand a (near, far) depth range to cover this layer's content that * intersects a frustum. Driven by the camera's autoClip path; defaults to * a no-op for layers that don't own a BVH or don't participate in depth * fitting (e.g. screen-space overlays). * * Systems with a BVH wire this from their `startup` alongside * `buildVisibleSet` — typically using * {@link bvh_query_depth_range_in_frustum} against their own BVH. * * @type {((result:{near:number,far:number}, frustum:ArrayLike<number>, plane_normal_x:number, plane_normal_y:number, plane_normal_z:number, plane_constant:number) => void) | null} */ compute_depth_range = null; }