提交 f70b609e 编写于 作者: M Mugen87

VRMLLoader: Make normal computation more robuste.

上级 e9420ca7
......@@ -1228,7 +1228,7 @@ THREE.VRMLLoader = ( function () {
function buildIndexedFaceSetNode( node ) {
var color, coord, normal, texCoord;
var ccw = true, solid = true, creaseAngle;
var ccw = true, solid = true, creaseAngle = 0;
var colorIndex, coordIndex, normalIndex, texCoordIndex;
var colorPerVertex = true, normalPerVertex = true;
......@@ -2161,7 +2161,13 @@ THREE.VRMLLoader = ( function () {
function weightedNormal( normals, vector, creaseAngle ) {
var normal = vector.clone();
var normal = new THREE.Vector3();
if ( creaseAngle === 0 ) {
normal.copy( vector );
} else {
for ( var i = 0, l = normals.length; i < l; i ++ ) {
......@@ -2173,6 +2179,8 @@ THREE.VRMLLoader = ( function () {
}
}
return normal.normalize();
}
......
......@@ -1262,7 +1262,7 @@ var VRMLLoader = ( function () {
function buildIndexedFaceSetNode( node ) {
var color, coord, normal, texCoord;
var ccw = true, solid = true, creaseAngle;
var ccw = true, solid = true, creaseAngle = 0;
var colorIndex, coordIndex, normalIndex, texCoordIndex;
var colorPerVertex = true, normalPerVertex = true;
......@@ -2195,7 +2195,13 @@ var VRMLLoader = ( function () {
function weightedNormal( normals, vector, creaseAngle ) {
var normal = vector.clone();
var normal = new Vector3();
if ( creaseAngle === 0 ) {
normal.copy( vector );
} else {
for ( var i = 0, l = normals.length; i < l; i ++ ) {
......@@ -2207,6 +2213,8 @@ var VRMLLoader = ( function () {
}
}
return normal.normalize();
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册