Skip to content

Commit

Permalink
Merge pull request #11262 from takahirox/FixGLTF2Loader
Browse files Browse the repository at this point in the history
Support non texture.sampler specified glTF file
  • Loading branch information
mrdoob authored Apr 30, 2017
2 parents 61744c8 + 64637ea commit ad7a207
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions examples/js/loaders/GLTF2Loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -1430,16 +1430,13 @@ THREE.GLTF2Loader = ( function () {

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

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

var sampler = json.samplers[ texture.sampler ];

_texture.magFilter = WEBGL_FILTERS[ sampler.magFilter ] || THREE.LinearFilter;
_texture.minFilter = WEBGL_FILTERS[ sampler.minFilter ] || THREE.NearestMipMapLinearFilter;
_texture.wrapS = WEBGL_WRAPPINGS[ sampler.wrapS ] || THREE.RepeatWrapping;
_texture.wrapT = WEBGL_WRAPPINGS[ sampler.wrapT ] || THREE.RepeatWrapping;

}
_texture.magFilter = WEBGL_FILTERS[ sampler.magFilter ] || THREE.LinearFilter;
_texture.minFilter = WEBGL_FILTERS[ sampler.minFilter ] || THREE.NearestMipMapLinearFilter;
_texture.wrapS = WEBGL_WRAPPINGS[ sampler.wrapS ] || THREE.RepeatWrapping;
_texture.wrapT = WEBGL_WRAPPINGS[ sampler.wrapT ] || THREE.RepeatWrapping;

resolve( _texture );

Expand Down

0 comments on commit ad7a207

Please sign in to comment.