Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to run the example application #737

Open
nadr0 opened this issue Aug 25, 2021 · 4 comments · May be fixed by #921
Open

Unable to run the example application #737

nadr0 opened this issue Aug 25, 2021 · 4 comments · May be fixed by #921
Assignees

Comments

@nadr0
Copy link

nadr0 commented Aug 25, 2021

I followed the steps in https://github.com/google/draco/tree/master/javascript/example and the one in the codelabs https://codelabs.developers.google.com/codelabs/draco-3d/index.html#5 but both of them result in the same error.

DRACOLoader.js:7 Uncaught TypeError: Class constructor ic cannot be invoked without 'new'
    at new THREE.DRACOLoader (DRACOLoader.js:7)
    at webgl_loader_draco.html:47
THREE.DRACOLoader @ DRACOLoader.js:7
(anonymous) @ webgl_loader_draco.html:47

In DRACOLoader.js

/**
 * @author Don McCurdy / https://www.donmccurdy.com
 */

THREE.DRACOLoader = function ( manager ) {

	THREE.Loader.call( this, manager ); // <--- this line fails with the error "Uncaught TypeError: Class constructor ic cannot be invoked without 'new'"

	this.decoderPath = '';
	this.decoderConfig = {};
	this.decoderBinary = null;
	this.decoderPending = null;

	this.workerLimit = 4;
	this.workerPool = [];
	this.workerNextTaskID = 1;
	this.workerSourceURL = '';

	this.defaultAttributeIDs = {
		position: 'POSITION',
		normal: 'NORMAL',
		color: 'COLOR',
		uv: 'TEX_COORD'
	};
	this.defaultAttributeTypes = {
		position: 'Float32Array',
		normal: 'Float32Array',
		color: 'Float32Array',
		uv: 'Float32Array'
	};

};

Is anyone able to run the example applications within this repository?

@dstoutamire
Copy link

@nadr0 It's not just you. I ran into the same issue. It looks like version skew but I wasn't able to understand enough to workaround.

@IanYet
Copy link

IanYet commented Sep 18, 2021

This change may fix your problem:
In DRACOLoader.js

- THREE.Loader.call( this, manager );
+ const that = new THREE.Loader(manager);
+ Object.assign(this, that);

@Carnageous
Copy link

@IanYet's answer fixed it for me. Is this repo accepting PRs for fixes? Issue probably occurred due to a THREE.js version missmatch, as it's not loaded with any specific version in the HTML files.

@malleshamdasari
Copy link

@IanYet thanks much, your answer fixed it. This should be merged in the repo!

@jokester jokester linked a pull request Aug 31, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants