提交 4b9a508a 编写于 作者: M Mugen87

3MFLoader: Better handle face colors.

上级 d9acb846
......@@ -937,31 +937,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 ] );
}
......
......@@ -960,31 +960,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.
先完成此消息的编辑!
想要评论请 注册