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

Support non texture.sampler specified glTF file #11262

Merged
merged 2 commits into from
Apr 30, 2017

Conversation

takahirox
Copy link
Collaborator

This PR fixes #11260 by accepting non texture.sampler specified glTF file.

@@ -1430,16 +1430,12 @@ THREE.GLTF2Loader = ( function () {

_texture.type = texture.type !== undefined ? WEBGL_TEXTURE_DATATYPES[ texture.type ] : THREE.UnsignedByteType;

if ( texture.sampler !== undefined ) {
var sampler = texture.sampler === undefined ? {} : json.samplers[ texture.sampler ];
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about...

var sampler = json.samplers[ texture.sampler ];
if ( sampler === undefined ) sampler = {};

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

json.samplers is optional.
So, how about this?

var samplers = json.samplers || {};
var sampler = samplers[ texture.sampler ] || {};

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍

@takahirox
Copy link
Collaborator Author

Updated!

@mrdoob mrdoob merged commit ad7a207 into mrdoob:dev Apr 30, 2017
@mrdoob
Copy link
Owner

mrdoob commented Apr 30, 2017

Thanks!

@takahirox takahirox deleted the FixGLTF2Loader branch April 30, 2017 14:02
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 this pull request may close these issues.

Latest spec glTF 2.0 Model are not displayed properly
2 participants