-
Notifications
You must be signed in to change notification settings - Fork 303
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf(3dtiles): fix loading time overhead due to internal structures p…
…re-filling BREAKING CHANGES: * C3DTFeature constructor parameters changed from (tileId, batchId, groups, info, userData, object3d) to (tileId, batchId, groups, userData, object3d) * C3DTilesLayer.findBatchTable() is not exposed in the API anymore
- Loading branch information
Showing
6 changed files
with
146 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import assert from 'assert'; | ||
import C3DTBatchTableHierarchyExtension from 'Core/3DTiles/C3DTBatchTableHierarchyExtension'; | ||
|
||
const batchTableHierarchyJSON = { | ||
classes: [ | ||
{ | ||
name: 'Wall', | ||
length: 6, | ||
instances: { | ||
color: ['white', 'red', 'yellow', 'gray', 'brown', 'black'], | ||
}, | ||
}, | ||
{ | ||
name: 'Building', | ||
length: 3, | ||
instances: { | ||
name: ['unit29', 'unit20', 'unit93'], | ||
address: ['100 Main St', '102 Main St', '104 Main St'], | ||
}, | ||
}, | ||
{ | ||
name: 'Owner', | ||
length: 3, | ||
instances: { | ||
type: ['city', 'resident', 'commercial'], | ||
id: [1120, 1250, 6445], | ||
}, | ||
}, | ||
], | ||
instancesLength: 12, | ||
classIds: [0, 0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 2], | ||
parentCounts: [1, 3, 2, 1, 1, 1, 1, 1, 1, 0, 0, 0], | ||
parentIds: [6, 6, 10, 11, 7, 11, 7, 8, 8, 10, 10, 9], | ||
}; | ||
|
||
const batchTableHierarchy = new C3DTBatchTableHierarchyExtension(batchTableHierarchyJSON); | ||
|
||
describe('3D Tiles batch table hierarchy extension', function () { | ||
it('Should get info for a given id', function () { | ||
const expectedInfo = { | ||
Wall: { | ||
color: 'white', | ||
}, | ||
Building: { | ||
name: 'unit29', | ||
address: '100 Main St', | ||
}, | ||
Owner: { | ||
type: 'resident', | ||
id: 1250, | ||
}, | ||
}; | ||
const info = batchTableHierarchy.getInfoById(0); | ||
assert.deepStrictEqual(info, expectedInfo); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import assert from 'assert'; | ||
import * as THREE from 'three'; | ||
import C3DTFeature from 'Core/3DTiles/C3DTFeature'; | ||
import C3DTBatchTable from 'Core/3DTiles/C3DTBatchTable'; | ||
import { obj2ArrayBuff } from './utils'; | ||
|
||
|
||
describe('3D tiles feature', () => { | ||
const obj = new THREE.Object3D(); | ||
const batchTableJson = { | ||
id: [12, 158], | ||
height: [13, 22], | ||
}; | ||
const batchTableBuffer = obj2ArrayBuff(batchTableJson); | ||
obj.batchTable = new C3DTBatchTable(batchTableBuffer, batchTableBuffer.byteLength, 0, 2, {}); | ||
const feature = new C3DTFeature(1, 1, { start: 0, count: 6 }, {}, obj); | ||
|
||
it('Get batch table info for feature batch id', function () { | ||
const expectedInfo = { | ||
batchTable: { | ||
id: 158, | ||
height: 22, | ||
}, | ||
}; | ||
const info = feature.getInfo(); | ||
assert.deepStrictEqual(info, expectedInfo); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters