Skip to content

Commit 7a94570

Browse files
committed
chore: expose 3dtiles process methods.
1 parent b560005 commit 7a94570

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed

docs/config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@
108108
],
109109

110110
"3D Tiles": [
111+
"3dTilesProcessing",
111112
"C3DTileset",
112113
"C3DTBatchTable",
113114
"C3DTBoundingVolume",

src/Main.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,3 +96,4 @@ export { default as C3DTBatchTable } from './Core/3DTiles/C3DTBatchTable';
9696
export { default as C3DTExtensions } from './Core/3DTiles/C3DTExtensions';
9797
export { default as C3DTilesTypes } from './Core/3DTiles/C3DTilesTypes';
9898
export { default as C3DTBatchTableHierarchyExtension } from './Core/3DTiles/C3DTBatchTableHierarchyExtension';
99+
export { process3dTilesNode, $3dTilesCulling, $3dTilesSubdivisionControl } from 'Process/3dTilesProcessing';

src/Process/3dTilesProcessing.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import * as THREE from 'three';
22
import Extent from 'Core/Geographic/Extent';
33

4+
/** @module 3dTilesProcessing
5+
*/
6+
47
function requestNewTile(view, scheduler, geometryLayer, metadata, parent, redraw) {
58
const command = {
69
/* mandatory */
@@ -120,6 +123,15 @@ function _subdivideNodeSubstractive(context, layer, node) {
120123
}
121124
}
122125

126+
/**
127+
* Check if the node is visible in the camera.
128+
*
129+
* @param {C3DTilesLayer} layer node 3D tiles layer
130+
* @param {Camera} camera camera
131+
* @param {THREE.Object3D} node The 3d tile node to check.
132+
* @param {THREE.Matrix4} tileMatrixWorld The node matrix world
133+
* @return {boolean} return true if the node is visible
134+
*/
123135
export function $3dTilesCulling(layer, camera, node, tileMatrixWorld) {
124136
// For viewer Request Volume
125137
// https://github.com/AnalyticalGraphicsInc/3d-tiles-samples/tree/master/tilesets/TilesetWithRequestVolume
@@ -299,6 +311,16 @@ function markForDeletion(layer, elt) {
299311
}
300312
}
301313

314+
/**
315+
* This funcion builds the method to update 3d tiles node.
316+
*
317+
* The returned method checks the 3d tile visibility with `cullingTest` function.
318+
* It subdivises visible node if `subdivisionTest` return `true`.
319+
*
320+
* @param {Function} [cullingTest=$3dTilesCulling] The culling test method.
321+
* @param {Function} [subdivisionTest=$3dTilesSubdivisionControl] The subdivision test method.
322+
* @return {Function} { description_of_the_return_value }
323+
*/
302324
export function process3dTilesNode(cullingTest = $3dTilesCulling, subdivisionTest = $3dTilesSubdivisionControl) {
303325
return function _process3dTilesNodes(context, layer, node) {
304326
// early exit if parent's subdivision is in progress
@@ -338,6 +360,17 @@ export function process3dTilesNode(cullingTest = $3dTilesCulling, subdivisionTes
338360
};
339361
}
340362

363+
/**
364+
*
365+
*
366+
* the method returns true if the `node` should be subivised.
367+
*
368+
* @param {object} context The current context
369+
* @param {Camera} context.camera The current camera
370+
* @param {C3DTilesLayer} layer The 3d tile layer
371+
* @param {THREE.Object3D} node The 3d tile node
372+
* @return {boolean}
373+
*/
341374
export function $3dTilesSubdivisionControl(context, layer, node) {
342375
if (layer.tileset.tiles[node.tileId].children === undefined) {
343376
return false;
@@ -348,3 +381,5 @@ export function $3dTilesSubdivisionControl(context, layer, node) {
348381
const sse = computeNodeSSE(context.camera, node);
349382
return sse > layer.sseThreshold;
350383
}
384+
385+

0 commit comments

Comments
 (0)