Skip to content

Commit

Permalink
Add JSDoc type annotations to uniquifyPositions and `rebucketPositi…
Browse files Browse the repository at this point in the history
…ons`
  • Loading branch information
tmarti committed Nov 16, 2023
1 parent 6eae278 commit 5801875
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ function setMaxNumberOfPositions(maxPositions) {
* in order to calculate the mapping between original indices and unique
* indices.
*
* @param {*} mesh The input mesh to process, with `positionsCompressed`, `indices` and `edgeIndices` keys.
* @param {{positionsCompressed: number[],indices: number[], edgeIndices: number[]}} mesh The input mesh to process, with `positionsCompressed`, `indices` and `edgeIndices` keys.
*
* @returns An array with 3 elements: 0 => the uniquified positionsCompressed; 1 and 2 => the remapped edges and edgeIndices arrays
* @returns {[Uint16Array, UInt32Array, UInt32Array]} An array with 3 elements: 0 => the uniquified positionsCompressed; 1 and 2 => the remapped edges and edgeIndices arrays
*/
export function uniquifyPositions(mesh) {
const _positions = mesh.positionsCompressed;
Expand Down
7 changes: 7 additions & 0 deletions src/viewer/scene/model/dtx/triangles/rebucketPositions.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@ function preSortEdgeIndices(edgeIndices) {
return sortedEdgeIndices;
}

/**
* @param {{positionsCompressed: number[], indices: number[], edgeIndices: number[]}} mesh
* @param {number} bitsPerBucket
* @param {boolean} checkResult
*
* @returns {{positionsCompressed: number[], indices: number[], edgeIndices: number[]}[]}
*/
function rebucketPositions(mesh, bitsPerBucket, checkResult = false) {
const positionsCompressed = (mesh.positionsCompressed || []);
const indices = preSortIndices(mesh.indices || [], bitsPerBucket);
Expand Down

0 comments on commit 5801875

Please sign in to comment.