@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.
60 lines (59 loc) • 2.4 kB
TypeScript
import { Behaviour } from "./Component.js";
import { Renderer } from "./Renderer.js";
/**
* Defines a single LOD level with its transition distance and associated renderers.
* Used by {@link LODGroup} to configure level of detail switching.
*/
export declare class LODModel {
/** Screen height ratio (0-1) at which this LOD becomes active */
screenRelativeTransitionHeight: number;
/** Distance from camera at which this LOD becomes active */
distance: number;
/** Renderers to show at this LOD level */
renderers: Renderer[];
}
/**
* LODGroup manages multiple levels of detail for optimized rendering.
* Objects switch between different detail levels based on distance from camera.
*
* LOD levels are defined in {@link LODModel} objects, each specifying:
* - The distance at which that level becomes active
* - The {@link Renderer} components to show at that level
*
* This is useful for performance optimization - showing high-detail models up close
* and lower-detail versions at distance where the difference isn't visible.
*
* **Progressive Loading:**
* For automatic texture/mesh LOD streaming, see the `@needle-tools/gltf-progressive` package
* which provides progressive loading capabilities independent of this component.
*
* **Debug options:**
* - `?debuglods` - Log LOD switching information
* - `?nolods` - Disable LOD system entirely
*
* @summary Level of Detail Group for optimizing rendering
* @category Rendering
* @group Components
* @see {@link LODModel} for configuring individual LOD levels
* @see {@link Renderer} for the renderers controlled by LOD
* @see {@link LODsManager} for programmatic control of progressive LODs
* @link https://npmjs.com/package/@needle-tools/gltf-progressive
*/
export declare class LODGroup extends Behaviour {
/** Array of LOD level configurations */
readonly lodModels: LODModel[];
private _lods;
private _settings;
private _lodsHandler?;
start(): void;
onAfterRender(): void;
private onAddLodLevel;
private _distanceFactor;
/**
* Adjusts all LOD transition distances by a multiplier.
* Values > 1 push LOD transitions further away (higher quality at distance).
* Values < 1 bring transitions closer (better performance).
* @param factor Multiplier to apply to all LOD distances
*/
distanceFactor(factor: number): void;
}