未验证 提交 0d3d49ff 编写于 作者: M Michael Herzog 提交者: GitHub

Merge pull request #17859 from Mugen87/dev33

3MFLoader: Better handle face colors.
......@@ -981,31 +981,39 @@ THREE.ThreeMFLoader.prototype = Object.assign( Object.create( THREE.Loader.proto
var triangleProperty = triangleProperties[ i ];
positionData.push( vertices[ ( triangleProperty.v1 * 3 ) + 0 ] );
positionData.push( vertices[ ( triangleProperty.v1 * 3 ) + 1 ] );
positionData.push( vertices[ ( triangleProperty.v1 * 3 ) + 2 ] );
var v1 = triangleProperty.v1;
var v2 = triangleProperty.v2;
var v3 = triangleProperty.v3;
positionData.push( vertices[ ( triangleProperty.v2 * 3 ) + 0 ] );
positionData.push( vertices[ ( triangleProperty.v2 * 3 ) + 1 ] );
positionData.push( vertices[ ( triangleProperty.v2 * 3 ) + 2 ] );
positionData.push( vertices[ ( v1 * 3 ) + 0 ] );
positionData.push( vertices[ ( v1 * 3 ) + 1 ] );
positionData.push( vertices[ ( v1 * 3 ) + 2 ] );
positionData.push( vertices[ ( triangleProperty.v3 * 3 ) + 0 ] );
positionData.push( vertices[ ( triangleProperty.v3 * 3 ) + 1 ] );
positionData.push( vertices[ ( triangleProperty.v3 * 3 ) + 2 ] );
positionData.push( vertices[ ( v2 * 3 ) + 0 ] );
positionData.push( vertices[ ( v2 * 3 ) + 1 ] );
positionData.push( vertices[ ( v2 * 3 ) + 2 ] );
positionData.push( vertices[ ( v3 * 3 ) + 0 ] );
positionData.push( vertices[ ( v3 * 3 ) + 1 ] );
positionData.push( vertices[ ( v3 * 3 ) + 2 ] );
//
colorData.push( colors[ ( triangleProperty.p1 * 3 ) + 0 ] );
colorData.push( colors[ ( triangleProperty.p1 * 3 ) + 1 ] );
colorData.push( colors[ ( triangleProperty.p1 * 3 ) + 3 ] );
var p1 = triangleProperty.p1;
var p2 = triangleProperty.p2;
var p3 = triangleProperty.p3;
colorData.push( colors[ ( p1 * 3 ) + 0 ] );
colorData.push( colors[ ( p1 * 3 ) + 1 ] );
colorData.push( colors[ ( p1 * 3 ) + 3 ] );
colorData.push( colors[ ( triangleProperty.p2 * 3 ) + 0 ] );
colorData.push( colors[ ( triangleProperty.p2 * 3 ) + 1 ] );
colorData.push( colors[ ( triangleProperty.p2 * 3 ) + 2 ] );
colorData.push( colors[ ( ( p2 || p1 ) * 3 ) + 0 ] );
colorData.push( colors[ ( ( p2 || p1 ) * 3 ) + 1 ] );
colorData.push( colors[ ( ( p2 || p1 ) * 3 ) + 2 ] );
colorData.push( colors[ ( triangleProperty.p3 * 3 ) + 0 ] );
colorData.push( colors[ ( triangleProperty.p3 * 3 ) + 1 ] );
colorData.push( colors[ ( triangleProperty.p3 * 3 ) + 2 ] );
colorData.push( colors[ ( ( p3 || p1 ) * 3 ) + 0 ] );
colorData.push( colors[ ( ( p3 || p1 ) * 3 ) + 1 ] );
colorData.push( colors[ ( ( p3 || p1 ) * 3 ) + 2 ] );
}
......
......@@ -1004,31 +1004,39 @@ ThreeMFLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
var triangleProperty = triangleProperties[ i ];
positionData.push( vertices[ ( triangleProperty.v1 * 3 ) + 0 ] );
positionData.push( vertices[ ( triangleProperty.v1 * 3 ) + 1 ] );
positionData.push( vertices[ ( triangleProperty.v1 * 3 ) + 2 ] );
var v1 = triangleProperty.v1;
var v2 = triangleProperty.v2;
var v3 = triangleProperty.v3;
positionData.push( vertices[ ( triangleProperty.v2 * 3 ) + 0 ] );
positionData.push( vertices[ ( triangleProperty.v2 * 3 ) + 1 ] );
positionData.push( vertices[ ( triangleProperty.v2 * 3 ) + 2 ] );
positionData.push( vertices[ ( v1 * 3 ) + 0 ] );
positionData.push( vertices[ ( v1 * 3 ) + 1 ] );
positionData.push( vertices[ ( v1 * 3 ) + 2 ] );
positionData.push( vertices[ ( triangleProperty.v3 * 3 ) + 0 ] );
positionData.push( vertices[ ( triangleProperty.v3 * 3 ) + 1 ] );
positionData.push( vertices[ ( triangleProperty.v3 * 3 ) + 2 ] );
positionData.push( vertices[ ( v2 * 3 ) + 0 ] );
positionData.push( vertices[ ( v2 * 3 ) + 1 ] );
positionData.push( vertices[ ( v2 * 3 ) + 2 ] );
positionData.push( vertices[ ( v3 * 3 ) + 0 ] );
positionData.push( vertices[ ( v3 * 3 ) + 1 ] );
positionData.push( vertices[ ( v3 * 3 ) + 2 ] );
//
colorData.push( colors[ ( triangleProperty.p1 * 3 ) + 0 ] );
colorData.push( colors[ ( triangleProperty.p1 * 3 ) + 1 ] );
colorData.push( colors[ ( triangleProperty.p1 * 3 ) + 3 ] );
var p1 = triangleProperty.p1;
var p2 = triangleProperty.p2;
var p3 = triangleProperty.p3;
colorData.push( colors[ ( p1 * 3 ) + 0 ] );
colorData.push( colors[ ( p1 * 3 ) + 1 ] );
colorData.push( colors[ ( p1 * 3 ) + 3 ] );
colorData.push( colors[ ( triangleProperty.p2 * 3 ) + 0 ] );
colorData.push( colors[ ( triangleProperty.p2 * 3 ) + 1 ] );
colorData.push( colors[ ( triangleProperty.p2 * 3 ) + 2 ] );
colorData.push( colors[ ( ( p2 || p1 ) * 3 ) + 0 ] );
colorData.push( colors[ ( ( p2 || p1 ) * 3 ) + 1 ] );
colorData.push( colors[ ( ( p2 || p1 ) * 3 ) + 2 ] );
colorData.push( colors[ ( triangleProperty.p3 * 3 ) + 0 ] );
colorData.push( colors[ ( triangleProperty.p3 * 3 ) + 1 ] );
colorData.push( colors[ ( triangleProperty.p3 * 3 ) + 2 ] );
colorData.push( colors[ ( ( p3 || p1 ) * 3 ) + 0 ] );
colorData.push( colors[ ( ( p3 || p1 ) * 3 ) + 1 ] );
colorData.push( colors[ ( ( p3 || p1 ) * 3 ) + 2 ] );
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册