@needle-tools/gltf-progressive 3.4.0-rc → 4.0.0-alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,33 +0,0 @@
1
- type NEEDLE_progressive_model_LOD = {
2
- /** path */
3
- path: string;
4
- hash?: string;
5
- };
6
- /** Base NEEDLE_progressive extension format. */
7
- export type NEEDLE_progressive_ext = {
8
- /** id of the asset the lods belong to */
9
- guid: string;
10
- /** available lod level */
11
- lods: Array<NEEDLE_progressive_model_LOD>;
12
- };
13
- /** Texture LOD extension */
14
- export type NEEDLE_ext_progressive_texture = NEEDLE_progressive_ext & {
15
- lods: Array<NEEDLE_progressive_model_LOD & {
16
- width: number;
17
- height: number;
18
- }>;
19
- };
20
- /** Mesh LOD extension */
21
- export type NEEDLE_ext_progressive_mesh = NEEDLE_progressive_ext & {
22
- lods: Array<NEEDLE_progressive_model_LOD & {
23
- indexCount: number;
24
- vertexCount: number;
25
- /** Density per primitive */
26
- densities: number[] | undefined;
27
- /** @deprecated Use densities with the primitive index */
28
- density: number;
29
- }>;
30
- /** @deprecated Removed */
31
- density: number;
32
- };
33
- export {};
@@ -1 +0,0 @@
1
- export {};
package/lib/index.d.ts DELETED
@@ -1,22 +0,0 @@
1
- export { version as VERSION } from "./version.js";
2
- export * from "./extension.js";
3
- export * from "./plugins/index.js";
4
- export { LODsManager, type LOD_Results } from "./lods.manager.js";
5
- export { setDracoDecoderLocation, setKTX2TranscoderLocation, createLoaders, addDracoAndKTX2Loaders, configureLoader } from "./loaders.js";
6
- export { getRaycastMesh, registerRaycastMesh, useRaycastMeshes } from "./utils.js";
7
- import { WebGLRenderer } from "three";
8
- import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader.js";
9
- import { SmartLoadingHints } from "./loaders.js";
10
- declare type UseNeedleGLTFProgressiveOptions = {
11
- /**
12
- * When set to true the LODs manager will automatically be enabled
13
- */
14
- enableLODsManager?: boolean;
15
- /**
16
- * Smart loading hints can be used by needle infrastructure to deliver assets optimized for a specific usecase.
17
- */
18
- hints?: Omit<SmartLoadingHints, "progressive">;
19
- };
20
- /** @deprecated Use `useNeedleProgressive(loader, renderer)` - this method will be removed in gltf-progressive 4 */
21
- export declare function useNeedleProgressive(url: string, renderer: WebGLRenderer, loader: GLTFLoader, opts?: UseNeedleGLTFProgressiveOptions): any;
22
- export declare function useNeedleProgressive(loader: GLTFLoader, renderer: WebGLRenderer, opts?: UseNeedleGLTFProgressiveOptions): any;
package/lib/index.js DELETED
@@ -1,87 +0,0 @@
1
- export { version as VERSION } from "./version.js";
2
- export * from "./extension.js";
3
- export * from "./plugins/index.js";
4
- export { LODsManager } from "./lods.manager.js";
5
- export { setDracoDecoderLocation, setKTX2TranscoderLocation, createLoaders, addDracoAndKTX2Loaders, configureLoader } from "./loaders.js";
6
- export { getRaycastMesh, registerRaycastMesh, useRaycastMeshes } from "./utils.js";
7
- import { addDracoAndKTX2Loaders, configureLoader, createLoaders } from "./loaders.js";
8
- import { NEEDLE_progressive } from "./extension.js";
9
- import { LODsManager } from "./lods.manager.js";
10
- /** Use this function to enable progressive loading of gltf models.
11
- * @param url The url of the gltf model.
12
- * @param renderer The renderer of the scene.
13
- * @param loader The gltf loader.
14
- * @param opts Options.
15
- * @returns The LODsManager instance.
16
- *
17
- * @example Usage with vanilla three.js:
18
- * ```ts
19
- * const url = 'https://yourdomain.com/yourmodel.glb'
20
- * const loader = new GLTFLoader()
21
- * useNeedleProgressive(url, renderer, loader)
22
- * ```
23
- *
24
- * @example Usage with react-three-fiber:
25
- * ```ts
26
- * const url = 'https://yourdomain.com/yourmodel.glb'
27
- * const { scene } = useGLTF(url, false, false, (loader) => {
28
- * useNeedleGLTFProgressive(url, gl, loader)
29
- * })
30
- * return <primitive object={scene} />
31
- * ```
32
- */
33
- export function useNeedleProgressive(...args) {
34
- let url;
35
- let renderer;
36
- let loader;
37
- let opts;
38
- switch (args.length) {
39
- case 2:
40
- [loader, renderer] = args;
41
- opts = {};
42
- break;
43
- case 3:
44
- [loader, renderer, opts] = args;
45
- break;
46
- case 4: // legacy
47
- [url, renderer, loader, opts] = args;
48
- break;
49
- default:
50
- throw new Error("Invalid arguments");
51
- }
52
- createLoaders(renderer);
53
- addDracoAndKTX2Loaders(loader);
54
- configureLoader(loader, {
55
- progressive: true,
56
- ...opts?.hints,
57
- });
58
- loader.register(p => new NEEDLE_progressive(p));
59
- const lod = LODsManager.get(renderer);
60
- if (opts?.enableLODsManager !== false) {
61
- lod.enable();
62
- }
63
- return lod;
64
- }
65
- /** Modelviewer */
66
- import { patchModelViewer } from "./plugins/modelviewer.js";
67
- patchModelViewer();
68
- import { getRaycastMesh, isSSR, useRaycastMeshes } from "./utils.js";
69
- if (!isSSR) {
70
- const global = {
71
- gltfProgressive: {
72
- useNeedleProgressive,
73
- LODsManager,
74
- configureLoader,
75
- getRaycastMesh,
76
- useRaycastMeshes,
77
- }
78
- };
79
- if (!globalThis["Needle"]) {
80
- globalThis["Needle"] = global;
81
- }
82
- else {
83
- for (const key in global) {
84
- globalThis["Needle"][key] = global[key];
85
- }
86
- }
87
- }
package/lib/loaders.d.ts DELETED
@@ -1,48 +0,0 @@
1
- import { WebGLRenderer } from 'three';
2
- import { DRACOLoader } from 'three/examples/jsm/loaders/DRACOLoader.js';
3
- import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
4
- import { KTX2Loader } from 'three/examples/jsm/loaders/KTX2Loader.js';
5
- /**
6
- * Return the current loader configuration.
7
- * These paths can be changed using `setDracoDecoderLocation` and `setKTX2TranscoderLocation`.
8
- */
9
- export declare const GET_LOADER_LOCATION_CONFIG: () => {
10
- dracoDecoderPath: string;
11
- ktx2TranscoderPath: string;
12
- };
13
- /**
14
- * Set the location of the Draco decoder. If a draco loader has already been created, it will be updated.
15
- * @default 'https://www.gstatic.com/draco/versioned/decoders/1.5.7/'
16
- */
17
- export declare function setDracoDecoderLocation(location: string): void;
18
- /**
19
- * Set the location of the KTX2 transcoder. If a KTX2 loader has already been created, it will be updated.
20
- * @default 'https://www.gstatic.com/basis-universal/versioned/2021-04-15-ba1c3e4/'
21
- */
22
- export declare function setKTX2TranscoderLocation(location: string): void;
23
- /**
24
- * Create loaders/decoders for Draco, KTX2 and Meshopt to be used with GLTFLoader.
25
- * @param renderer - Provide a renderer to detect KTX2 support.
26
- * @returns The loaders/decoders.
27
- */
28
- export declare function createLoaders(renderer: WebGLRenderer | null): {
29
- dracoLoader: DRACOLoader;
30
- ktx2Loader: KTX2Loader;
31
- meshoptDecoder: {
32
- supported: boolean;
33
- ready: Promise<void>;
34
- decodeVertexBuffer: (target: Uint8Array, count: number, size: number, source: Uint8Array, filter?: string) => void;
35
- decodeIndexBuffer: (target: Uint8Array, count: number, size: number, source: Uint8Array) => void;
36
- decodeIndexSequence: (target: Uint8Array, count: number, size: number, source: Uint8Array) => void;
37
- decodeGltfBuffer: (target: Uint8Array, count: number, size: number, source: Uint8Array, mode: string, filter?: string) => void;
38
- };
39
- };
40
- export declare function addDracoAndKTX2Loaders(loader: GLTFLoader): void;
41
- /**
42
- * Smart loading hints can be used by needle infrastructure to deliver assets optimized for a specific usecase.
43
- */
44
- export type SmartLoadingHints = {
45
- progressive?: boolean;
46
- usecase?: "product";
47
- };
48
- export declare function configureLoader(loader: GLTFLoader, opts: SmartLoadingHints): void;
package/lib/loaders.js DELETED
@@ -1,161 +0,0 @@
1
- import { MeshoptDecoder } from 'three/examples/jsm/libs/meshopt_decoder.module.js';
2
- import { DRACOLoader } from 'three/examples/jsm/loaders/DRACOLoader.js';
3
- import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
4
- import { KTX2Loader } from 'three/examples/jsm/loaders/KTX2Loader.js';
5
- let DEFAULT_DRACO_DECODER_LOCATION = 'https://www.gstatic.com/draco/versioned/decoders/1.5.7/';
6
- let DEFAULT_KTX2_TRANSCODER_LOCATION = "https://cdn.needle.tools/static/three/0.179.1/basis2/"; // 'https://www.gstatic.com/basis-universal/versioned/2021-04-15-ba1c3e4/';
7
- const defaultDraco = DEFAULT_DRACO_DECODER_LOCATION;
8
- const defaultKTX2 = DEFAULT_KTX2_TRANSCODER_LOCATION;
9
- // #region Online check
10
- const _remoteDracoDecoderUrl = new URL(DEFAULT_DRACO_DECODER_LOCATION + "draco_decoder.js");
11
- // if (typeof window !== "undefined") {
12
- // if (!window.navigator.onLine) {
13
- // // check if the default values have been changed by the user.
14
- // // If they didnt change / the default paths are not reachable, fall back to local versions
15
- // if (DEFAULT_DRACO_DECODER_LOCATION === defaultDraco)
16
- // DEFAULT_DRACO_DECODER_LOCATION = "./include/draco/";
17
- // if (DEFAULT_KTX2_TRANSCODER_LOCATION === defaultKTX2)
18
- // DEFAULT_KTX2_TRANSCODER_LOCATION = "./include/ktx2/";
19
- // }
20
- // prepareLoaders();
21
- // }
22
- // Avoid cache busting - if we don't do this chrome will clear the fully cached file (potentially)
23
- _remoteDracoDecoderUrl.searchParams.append("range", "true");
24
- fetch(_remoteDracoDecoderUrl, {
25
- method: "GET",
26
- headers: {
27
- "Range": "bytes=0-1"
28
- }
29
- })
30
- .catch(_ => {
31
- console.debug(`Failed to fetch remote Draco decoder from ${DEFAULT_DRACO_DECODER_LOCATION} (offline: ${(typeof navigator !== "undefined") ? navigator.onLine : "unknown"})`);
32
- // check if the default values have been changed by the user.
33
- // If they didnt change / the default paths are not reachable, fall back to local versions
34
- if (DEFAULT_DRACO_DECODER_LOCATION === defaultDraco) {
35
- setDracoDecoderLocation("./include/draco/");
36
- }
37
- if (DEFAULT_KTX2_TRANSCODER_LOCATION === defaultKTX2) {
38
- setKTX2TranscoderLocation("./include/ktx2/");
39
- }
40
- })
41
- .finally(() => {
42
- prepareLoaders();
43
- });
44
- // #region Loader Configuration
45
- /**
46
- * Return the current loader configuration.
47
- * These paths can be changed using `setDracoDecoderLocation` and `setKTX2TranscoderLocation`.
48
- */
49
- export const GET_LOADER_LOCATION_CONFIG = () => ({
50
- dracoDecoderPath: DEFAULT_DRACO_DECODER_LOCATION,
51
- ktx2TranscoderPath: DEFAULT_KTX2_TRANSCODER_LOCATION
52
- });
53
- /**
54
- * Set the location of the Draco decoder. If a draco loader has already been created, it will be updated.
55
- * @default 'https://www.gstatic.com/draco/versioned/decoders/1.5.7/'
56
- */
57
- export function setDracoDecoderLocation(location) {
58
- DEFAULT_DRACO_DECODER_LOCATION = location;
59
- if (dracoLoader && dracoLoader[$dracoDecoderPath] != DEFAULT_DRACO_DECODER_LOCATION) {
60
- console.debug("Updating Draco decoder path to " + location);
61
- dracoLoader[$dracoDecoderPath] = DEFAULT_DRACO_DECODER_LOCATION;
62
- dracoLoader.setDecoderPath(DEFAULT_DRACO_DECODER_LOCATION);
63
- dracoLoader.preload();
64
- }
65
- else {
66
- console.debug("Setting Draco decoder path to " + location);
67
- }
68
- }
69
- /**
70
- * Set the location of the KTX2 transcoder. If a KTX2 loader has already been created, it will be updated.
71
- * @default 'https://www.gstatic.com/basis-universal/versioned/2021-04-15-ba1c3e4/'
72
- */
73
- export function setKTX2TranscoderLocation(location) {
74
- DEFAULT_KTX2_TRANSCODER_LOCATION = location;
75
- // if set from <needle-engine>
76
- if (ktx2Loader && ktx2Loader.transcoderPath != DEFAULT_KTX2_TRANSCODER_LOCATION) {
77
- console.debug("Updating KTX2 transcoder path to " + location);
78
- ktx2Loader.setTranscoderPath(DEFAULT_KTX2_TRANSCODER_LOCATION);
79
- ktx2Loader.init();
80
- }
81
- else {
82
- console.debug("Setting KTX2 transcoder path to " + location);
83
- }
84
- }
85
- /**
86
- * Create loaders/decoders for Draco, KTX2 and Meshopt to be used with GLTFLoader.
87
- * @param renderer - Provide a renderer to detect KTX2 support.
88
- * @returns The loaders/decoders.
89
- */
90
- export function createLoaders(renderer) {
91
- prepareLoaders();
92
- if (renderer) {
93
- ktx2Loader.detectSupport(renderer);
94
- }
95
- else if (renderer !== null)
96
- console.warn("No renderer provided to detect ktx2 support - loading KTX2 textures might fail");
97
- return { dracoLoader, ktx2Loader, meshoptDecoder };
98
- }
99
- export function addDracoAndKTX2Loaders(loader) {
100
- if (!loader.dracoLoader)
101
- loader.setDRACOLoader(dracoLoader);
102
- if (!loader.ktx2Loader)
103
- loader.setKTX2Loader(ktx2Loader);
104
- if (!loader.meshoptDecoder)
105
- loader.setMeshoptDecoder(meshoptDecoder);
106
- }
107
- // #region internal
108
- const $dracoDecoderPath = Symbol("dracoDecoderPath");
109
- let dracoLoader;
110
- let meshoptDecoder;
111
- let ktx2Loader;
112
- /** Used to create and load loaders */
113
- function prepareLoaders() {
114
- if (!dracoLoader) {
115
- dracoLoader = new DRACOLoader();
116
- dracoLoader[$dracoDecoderPath] = DEFAULT_DRACO_DECODER_LOCATION;
117
- dracoLoader.setDecoderPath(DEFAULT_DRACO_DECODER_LOCATION);
118
- dracoLoader.setDecoderConfig({ type: 'js' });
119
- dracoLoader.preload();
120
- }
121
- if (!ktx2Loader) {
122
- ktx2Loader = new KTX2Loader();
123
- ktx2Loader.setTranscoderPath(DEFAULT_KTX2_TRANSCODER_LOCATION);
124
- ktx2Loader.init();
125
- }
126
- if (!meshoptDecoder) {
127
- meshoptDecoder = MeshoptDecoder;
128
- }
129
- }
130
- const gltfLoaderConfigurations = new WeakMap();
131
- export function configureLoader(loader, opts) {
132
- let config = gltfLoaderConfigurations.get(loader);
133
- if (config) {
134
- config = Object.assign(config, opts);
135
- }
136
- else {
137
- config = opts;
138
- }
139
- gltfLoaderConfigurations.set(loader, config);
140
- }
141
- const originalLoadFunction = GLTFLoader.prototype.load;
142
- function onLoad(...args) {
143
- const config = gltfLoaderConfigurations.get(this);
144
- let url_str = args[0];
145
- const url = new URL(url_str, window.location.href);
146
- if (url.hostname.endsWith("needle.tools")) {
147
- const progressive = config?.progressive !== undefined ? config.progressive : true;
148
- const usecase = config?.usecase ? config.usecase : "default";
149
- if (progressive) {
150
- this.requestHeader["Accept"] = `*/*;progressive=allowed;usecase=${usecase}`;
151
- }
152
- else {
153
- this.requestHeader["Accept"] = `*/*;usecase=${usecase}`;
154
- }
155
- url_str = url.toString();
156
- }
157
- args[0] = url_str;
158
- const res = originalLoadFunction?.call(this, ...args);
159
- return res;
160
- }
161
- GLTFLoader.prototype.load = onLoad;
@@ -1,4 +0,0 @@
1
- import { Material } from "three";
2
- export declare const debug: string | boolean;
3
- export declare let debug_OverrideLodLevel: number;
4
- export declare function applyDebugSettings(material: Material | Array<Material>): void;
package/lib/lods.debug.js DELETED
@@ -1,43 +0,0 @@
1
- import { getParam } from "./utils.internal.js";
2
- export const debug = getParam("debugprogressive");
3
- let debug_RenderWireframe = undefined;
4
- export let debug_OverrideLodLevel = -1; // -1 is automatic
5
- if (debug) {
6
- let maxLevel = 6;
7
- function debugToggleProgressive() {
8
- debug_OverrideLodLevel += 1;
9
- if (debug_OverrideLodLevel >= maxLevel) {
10
- debug_OverrideLodLevel = -1;
11
- }
12
- console.log(`Toggle LOD level [${debug_OverrideLodLevel}]`);
13
- }
14
- window.addEventListener("keyup", evt => {
15
- if (evt.key === "p")
16
- debugToggleProgressive();
17
- if (evt.key === "w") {
18
- debug_RenderWireframe = !debug_RenderWireframe;
19
- console.log(`Toggle wireframe [${debug_RenderWireframe}]`);
20
- }
21
- const pressedNumber = parseInt(evt.key);
22
- if (!isNaN(pressedNumber) && pressedNumber >= 0) {
23
- debug_OverrideLodLevel = pressedNumber;
24
- console.log(`Set LOD level to [${debug_OverrideLodLevel}]`);
25
- }
26
- });
27
- }
28
- export function applyDebugSettings(material) {
29
- if (!debug)
30
- return;
31
- if (debug_RenderWireframe !== undefined) {
32
- if (Array.isArray(material)) {
33
- for (const mat of material) {
34
- applyDebugSettings(mat);
35
- }
36
- }
37
- else if (material) {
38
- if ("wireframe" in material) {
39
- material.wireframe = debug_RenderWireframe === true;
40
- }
41
- }
42
- }
43
- }
@@ -1,165 +0,0 @@
1
- import { Camera, Material, Object3D, Scene, Texture, Vector3, WebGLRenderer } from "three";
2
- import { NEEDLE_progressive_plugin } from "./plugins/plugin.js";
3
- import { PromiseGroupOptions } from "./lods.promise.js";
4
- export type LODManagerContext = {
5
- engine: "three" | "needle-engine" | "model-viewer" | "react-three-fiber" | "unknown";
6
- };
7
- export declare type LOD_Results = {
8
- mesh_lod: number;
9
- texture_lod: number;
10
- };
11
- declare type LODChangedEventListener = (args: {
12
- type: "mesh" | "texture";
13
- level: number;
14
- object: Object3D | Material | Texture;
15
- }) => void;
16
- /**
17
- * The LODsManager class is responsible for managing the LODs and progressive assets in the scene. It will automatically update the LODs based on the camera position, screen coverage and mesh density of the objects.
18
- * It must be enabled by calling the `enable` method.
19
- *
20
- * Instead of using the LODs manager directly you can also call `useNeedleProgressive` to enable progressive loading for a GLTFLoader
21
- *
22
- * ### Plugins
23
- * Use {@link LODsManager.addPlugin} to add a plugin to the LODsManager. A plugin can be used to hook into the LOD update process and modify the LOD levels or perform other actions.
24
- *
25
- * @example Adding a LODsManager to a Three.js scene:
26
- * ```ts
27
- * import { LODsManager } from "@needle-tools/gltf-progressive";
28
- * import { WebGLRenderer, Scene, Camera, Mesh } from "three";
29
- *
30
- * const renderer = new WebGLRenderer();
31
- * const lodsManager = LODsManager.get(renderer);
32
- * lodsManager.enable();
33
- * ```
34
- *
35
- * @example Using the LODsManager with a GLTFLoader:
36
- * ```ts
37
- * import { useNeedleProgressive } from "@needle-tools/gltf-progressive";
38
- * import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader.js";
39
- *
40
- * const url = 'https://yourdomain.com/yourmodel.glb';
41
- * const loader = new GLTFLoader();
42
- * const lodsManager = useNeedleProgressive(url, renderer, loader);
43
- * ```
44
- */
45
- export declare class LODsManager {
46
- #private;
47
- /**
48
- * Assign a function to draw debug lines for the LODs. This function will be called with the start and end position of the line and the color of the line when the `debugprogressive` query parameter is set.
49
- */
50
- static debugDrawLine?: (a: Vector3, b: Vector3, color: number) => void;
51
- /** @internal */
52
- static getObjectLODState(object: Object3D): LOD_state | undefined;
53
- static addPlugin(plugin: NEEDLE_progressive_plugin): void;
54
- static removePlugin(plugin: NEEDLE_progressive_plugin): void;
55
- /**
56
- * Gets the LODsManager for the given renderer. If the LODsManager does not exist yet, it will be created.
57
- * @param renderer The renderer to get the LODsManager for.
58
- * @returns The LODsManager instance.
59
- */
60
- static get(renderer: WebGLRenderer, context?: LODManagerContext): LODsManager;
61
- readonly renderer: WebGLRenderer;
62
- private readonly context;
63
- private readonly projectionScreenMatrix;
64
- /** @deprecated use static `LODsManager.addPlugin()` method. This getter will be removed in later versions */
65
- get plugins(): NEEDLE_progressive_plugin[];
66
- /**
67
- * Force override the LOD level for all objects (meshes + textures) rendered in the scene
68
- * @default undefined automatically calculate LOD level
69
- */
70
- overrideLodLevel: undefined | number;
71
- /**
72
- * The target triangle density is the desired max amount of triangles on screen when the mesh is filling the screen.
73
- * @default 200_000
74
- */
75
- targetTriangleDensity: number;
76
- /**
77
- * The interval in frames to automatically update the bounds of skinned meshes.
78
- * Set to 0 or a negative value to disable automatic bounds updates.
79
- * @default 30
80
- */
81
- skinnedMeshAutoUpdateBoundsInterval: number;
82
- /**
83
- * The update interval in frames. If set to 0, the LODs will be updated every frame. If set to 2, the LODs will be updated every second frame, etc.
84
- * @default "auto"
85
- */
86
- updateInterval: "auto" | number;
87
- /**
88
- * If set to true, the LODsManager will not update the LODs.
89
- * @default false
90
- */
91
- pause: boolean;
92
- /**
93
- * When set to true the LODsManager will not update the LODs. This can be used to manually update the LODs using the `update` method.
94
- * Otherwise the LODs will be updated automatically when the renderer renders the scene.
95
- * @default false
96
- */
97
- manual: boolean;
98
- private readonly _newPromiseGroups;
99
- private _promiseGroupIds;
100
- /**
101
- * Call to await LODs loading during the next render cycle.
102
- */
103
- awaitLoading(opts?: PromiseGroupOptions): Promise<{
104
- cancelled: boolean;
105
- awaited_count: number;
106
- resolved_count: number;
107
- }>;
108
- private _postprocessPromiseGroups;
109
- private readonly _lodchangedlisteners;
110
- addEventListener(evt: "changed", listener: LODChangedEventListener): void;
111
- removeEventListener(evt: "changed", listener: LODChangedEventListener): void;
112
- private constructor();
113
- private _fpsBuffer;
114
- /**
115
- * Enable the LODsManager. This will replace the render method of the renderer with a method that updates the LODs.
116
- */
117
- enable(): void;
118
- disable(): void;
119
- update(scene: Scene, camera: Camera): void;
120
- private onAfterRender;
121
- /**
122
- * Update LODs in a scene
123
- */
124
- private internalUpdate;
125
- /** Update the LOD levels for the renderer. */
126
- private updateLODs;
127
- /** Load progressive textures for the given material
128
- * @param material the material to load the textures for
129
- * @param level the LOD level to load. Level 0 is the best quality, higher levels are lower quality
130
- * @returns Promise with true if the LOD was loaded, false if not
131
- */
132
- private loadProgressiveTextures;
133
- /** Load progressive meshes for the given mesh
134
- * @param mesh the mesh to load the LOD for
135
- * @param index the index of the mesh if it's part of a group
136
- * @param level the LOD level to load. Level 0 is the best quality, higher levels are lower quality
137
- * @returns Promise with true if the LOD was loaded, false if not
138
- */
139
- private loadProgressiveMeshes;
140
- private readonly _sphere;
141
- private readonly _tempBox;
142
- private readonly _tempBox2;
143
- private readonly tempMatrix;
144
- private readonly _tempWorldPosition;
145
- private readonly _tempBoxSize;
146
- private readonly _tempBox2Size;
147
- private static corner0;
148
- private static corner1;
149
- private static corner2;
150
- private static corner3;
151
- private static readonly _tempPtInside;
152
- private static isInside;
153
- private static skinnedMeshBoundsFrameOffsetCounter;
154
- private static $skinnedMeshBoundsOffset;
155
- private calculateLodLevel;
156
- }
157
- declare class LOD_state {
158
- frames: number;
159
- lastLodLevel_Mesh: number;
160
- lastLodLevel_Texture: number;
161
- lastScreenCoverage: number;
162
- readonly lastScreenspaceVolume: Vector3;
163
- lastCentrality: number;
164
- }
165
- export {};