Skip to content

Commit

Permalink
Merge pull request #1238 from tmarti/add-type-annotations
Browse files Browse the repository at this point in the history
chore: JSDoc types for `uniquifyPositions` and `rebucketPositions`
  • Loading branch information
xeolabs authored Nov 16, 2023
2 parents 6eae278 + 5801875 commit ec4cfb4
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 ec4cfb4

Please sign in to comment.