提交 fe8e1b88 编写于 作者: E Erik Kitson

Added option to ColladaLoader to recenter all Geometry so that they are...

Added option to ColladaLoader to recenter all Geometry so that they are centered around the local origin of their containing Mesh.
上级 cbccd87d
......@@ -488,6 +488,8 @@ THREE.GeometryUtils = {
geometry.computeBoundingBox();
return new THREE.Vector3( dx, dy, dz );
}
......
......@@ -28,6 +28,10 @@ THREE.ColladaLoader = function () {
var preferredShading = THREE.SmoothShading;
var options = {
// Force Geometry to always be centered at the local origin of the
// containing Mesh.
centerGeometry: false,
// Axis conversion is done for geometries, animations, and controllers.
// If we ever pull cameras or lights out of the COLLADA file, they'll
// need extra work.
......@@ -795,6 +799,14 @@ THREE.ColladaLoader = function () {
obj.useQuaternion = true;
obj.scale = props[ 2 ];
if ( options.centerGeometry && obj.geometry ) {
var delta = THREE.GeometryUtils.center( obj.geometry );
obj.quaternion.multiplyVector3( delta.multiplySelf( obj.scale ) );
obj.position.subSelf( delta );
}
for ( i = 0; i < node.nodes.length; i ++ ) {
obj.add( createSceneGraph( node.nodes[i], node ) );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册