Skip to content

Commit

Permalink
Fix padTo4Bytes issue by using our own function
Browse files Browse the repository at this point in the history
Do not use the (non-existant) loaders.gl function padTo4Bytes
as there is a padTo4Bytes defined locally.

Also fix the GLTFParser.getApplicationData() to delegate to
the glbParser if the local json dictionary is not defined.
  • Loading branch information
twojtasz committed Apr 25, 2022
1 parent 0e0b469 commit f397443
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion modules/io/src/gltf/glb-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.
/* eslint-disable camelcase, max-statements */
import {padTo4Bytes, copyToArray} from '@loaders.gl/loader-utils';
import {copyToArray} from '@loaders.gl/loader-utils';
import {isImage} from '@loaders.gl/images';
import {getAccessorTypeFromSize, getComponentTypeFromArray} from './gltf-utils/gltf-utils';
import {padTo4Bytes} from './memory-copy-utils';
import encodeGLBSync from './encode-glb';
import {packBinaryJson} from '../writers/xviz-pack-binary';

Expand Down
2 changes: 2 additions & 0 deletions modules/io/src/gltf/gltf-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ export class GLTFParser {
getApplicationData(key) {
if (this.json) {
return this.json[key];
} else if (this.glbParser) {
return this.glbParser.getApplicationData(key);
}

return null;
Expand Down
3 changes: 2 additions & 1 deletion modules/io/src/gltf/parse-glb.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
/* global TextDecoder */
/* eslint-disable camelcase, max-statements */
import '../common/text-encoding';
import {padTo4Bytes, assert} from '@loaders.gl/loader-utils';
import {assert} from '@loaders.gl/loader-utils';
import {padTo4Bytes} from './memory-copy-utils';

const MAGIC_glTF = 0x676c5446; // glTF in Big-Endian ASCII

Expand Down

0 comments on commit f397443

Please sign in to comment.