提交 16615e66 编写于 作者: G Gary Oberbrunner

GLTFExporter: prefix all geom attributes except official ones

According to the spec, all custom vertex attributes must start with _.
上级 129a8744
......@@ -1165,6 +1165,30 @@ THREE.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+$/,
];
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
}
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.
先完成此消息的编辑!
想要评论请 注册