提交 4bf44d3d 编写于 作者: M Mr.doob 提交者: GitHub

Merge pull request #12017 from calrk/gltf-normal-scale

GLTFLoader - Adding support for normalScale as part of the normalTexture
......@@ -616,7 +616,7 @@ THREE.GLTFLoader = ( function () {
material.bumpScale = 1;
material.normalMap = params.normalMap === undefined ? null : params.normalMap;
material.normalScale = new THREE.Vector2( 1, 1 );
if ( params.normalScale ) material.normalScale = params.normalScale;
material.displacementMap = null;
material.displacementScale = 1;
......@@ -1619,6 +1619,13 @@ THREE.GLTFLoader = ( function () {
pending.push( parser.assignTexture( materialParams, 'normalMap', material.normalTexture.index ) );
materialParams.normalScale = new THREE.Vector2( 1, 1 );
if ( material.normalTexture.scale !== undefined ) {
materialParams.normalScale.set( material.normalTexture.scale, material.normalTexture.scale );
}
}
if ( material.occlusionTexture !== undefined ) {
......@@ -1679,7 +1686,7 @@ THREE.GLTFLoader = ( function () {
// Normal map textures use OpenGL conventions:
// https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#materialnormaltexture
_material.normalScale.x = -1;
_material.normalScale.x = -_material.normalScale.x;
if ( material.extras ) _material.userData = material.extras;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册