提交 5a41bcd6 编写于 作者: G Gary Oberbrunner

GLTFExporter: Address review comments: simplify code, fix style

Also include jsm version (auto-converted)
上级 16615e66
......@@ -1167,26 +1167,12 @@ THREE.GLTFExporter.prototype = {
// Prefix all geometry attributes except the ones specifically
// listed in the spec; non-spec attributes are considered custom.
var validVertexAttributes = [
/^POSITION$/,
/^NORMAL$/,
/^TANGENT$/,
/^TEXCOORD_\d+$/,
/^COLOR_\d+$/,
/^JOINTS_\d+$/,
/^WEIGHTS_\d+$/,
];
var isValidAttribute = false;
for (var i = 0; i < validVertexAttributes.length; i++) {
if (validVertexAttributes[i].test(attributeName)) {
isValidAttribute = true;
break;
}
}
if (!isValidAttribute) {
console.log(`Prefixing ${attributeName}`)
attributeName = '_' + attributeName
var validVertexAttributes =
/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/;
if ( ! validVertexAttributes.test( attributeName ) ) {
attributeName = '_' + attributeName;
}
if ( cachedData.attributes.has( attribute ) ) {
......
......@@ -1188,6 +1188,16 @@ GLTFExporter.prototype = {
var attribute = geometry.attributes[ attributeName ];
attributeName = nameConversion[ attributeName ] || attributeName.toUpperCase();
// Prefix all geometry attributes except the ones specifically
// listed in the spec; non-spec attributes are considered custom.
var validVertexAttributes =
/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/;
if ( ! validVertexAttributes.test( attributeName ) ) {
attributeName = '_' + attributeName;
}
if ( cachedData.attributes.has( attribute ) ) {
attributes[ attributeName ] = cachedData.attributes.get( attribute );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册