MCPcopy
hub / github.com/CesiumGS/cesium / initialize

Function initialize

packages/engine/Source/Scene/BatchTableHierarchy.js:62–155  ·  view source on GitHub ↗

* Parse the batch table hierarchy from the * 3DTILES_batch_table_hierarchy extension. * * @param {BatchTableHierarchy} hierarchy The hierarchy instance * @param {object} hierarchyJson The JSON of the extension * @param {Uint8Array} [binaryBody] The binary body of the batch table fo

(hierarchy, hierarchyJson, binaryBody)

Source from the content-addressed store, hash-verified

60 * @private
61 */
62function initialize(hierarchy, hierarchyJson, binaryBody) {
63 let i;
64 let classId;
65 let binaryAccessor;
66
67 const instancesLength = hierarchyJson.instancesLength;
68 const classes = hierarchyJson.classes;
69 let classIds = hierarchyJson.classIds;
70 let parentCounts = hierarchyJson.parentCounts;
71 let parentIds = hierarchyJson.parentIds;
72 let parentIdsLength = instancesLength;
73 let byteLength = 0;
74
75 if (defined(classIds.byteOffset)) {
76 classIds.componentType =
77 classIds.componentType ?? ComponentDatatype.UNSIGNED_SHORT;
78 classIds.type = AttributeType.SCALAR;
79 binaryAccessor = getBinaryAccessor(classIds);
80 classIds = binaryAccessor.createArrayBufferView(
81 binaryBody.buffer,
82 binaryBody.byteOffset + classIds.byteOffset,
83 instancesLength,
84 );
85 byteLength += classIds.byteLength;
86 }
87
88 let parentIndexes;
89 if (defined(parentCounts)) {
90 if (defined(parentCounts.byteOffset)) {
91 parentCounts.componentType =
92 parentCounts.componentType ?? ComponentDatatype.UNSIGNED_SHORT;
93 parentCounts.type = AttributeType.SCALAR;
94 binaryAccessor = getBinaryAccessor(parentCounts);
95 parentCounts = binaryAccessor.createArrayBufferView(
96 binaryBody.buffer,
97 binaryBody.byteOffset + parentCounts.byteOffset,
98 instancesLength,
99 );
100 byteLength += parentCounts.byteLength;
101 }
102 parentIndexes = new Uint16Array(instancesLength);
103 parentIdsLength = 0;
104 for (i = 0; i < instancesLength; ++i) {
105 parentIndexes[i] = parentIdsLength;
106 parentIdsLength += parentCounts[i];
107 }
108
109 byteLength += parentIndexes.byteLength;
110 }
111
112 if (defined(parentIds) && defined(parentIds.byteOffset)) {
113 parentIds.componentType =
114 parentIds.componentType ?? ComponentDatatype.UNSIGNED_SHORT;
115 parentIds.type = AttributeType.SCALAR;
116 binaryAccessor = getBinaryAccessor(parentIds);
117 parentIds = binaryAccessor.createArrayBufferView(
118 binaryBody.buffer,
119 binaryBody.byteOffset + parentIds.byteOffset,

Callers 1

BatchTableHierarchyFunction · 0.70

Calls 4

getBinaryAccessorFunction · 0.85
definedFunction · 0.50
combineFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…