diff --git a/build/three.js b/build/three.js index 79c9efeece5cc4db1aa7283611c5abe4756a5376..42143bceb8538c18a80ef9836c36e1dc0a8ace3e 100644 --- a/build/three.js +++ b/build/three.js @@ -46742,7 +46742,7 @@ this.box = box; - color = color || 0xffff00; + color = color || 0xffff00; var indices = new Uint16Array( [ 0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7 ] ); diff --git a/build/three.module.js b/build/three.module.js index 550e4f57df525be50b8fff231b21ee0b2b63da14..416fe951035a4567d4590a56f1f2f449ace28725 100644 --- a/build/three.module.js +++ b/build/three.module.js @@ -46736,7 +46736,7 @@ function Box3Helper( box, color ) { this.box = box; - color = color || 0xffff00; + color = color || 0xffff00; var indices = new Uint16Array( [ 0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7 ] ); diff --git a/examples/js/loaders/VRMLLoader.js b/examples/js/loaders/VRMLLoader.js index 98bd712602570dd3eb7e02e98475a25fd7685cc5..4c97474c310dd749785ff1ef6455b99458dde6b4 100644 --- a/examples/js/loaders/VRMLLoader.js +++ b/examples/js/loaders/VRMLLoader.js @@ -929,7 +929,7 @@ THREE.VRMLLoader = ( function () { var object; - if ( geometry ) { + if ( geometry && geometry.attributes.position ) { var type = geometry._type; @@ -1003,7 +1003,7 @@ THREE.VRMLLoader = ( function () { object = new THREE.Object3D(); - // if the geometry field is NULL the object is not drawn + // if the geometry field is NULL or no vertices are defined the object is not drawn object.visible = false; @@ -1353,6 +1353,14 @@ THREE.VRMLLoader = ( function () { } + if ( coordIndex === undefined ) { + + console.warn( 'THREE.VRMLLoader: Missing coordIndex.' ); + + return new THREE.BufferGeometry(); // handle VRML files with incomplete geometry definition + + } + var triangulatedCoordIndex = triangulateFaceIndex( coordIndex, ccw ); var positionAttribute; @@ -1364,7 +1372,7 @@ THREE.VRMLLoader = ( function () { if ( colorPerVertex === true ) { - if ( colorIndex.length > 0 ) { + if ( colorIndex && colorIndex.length > 0 ) { // if the colorIndex field is not empty, then it is used to choose colors for each vertex of the IndexedFaceSet. @@ -1381,7 +1389,7 @@ THREE.VRMLLoader = ( function () { } else { - if ( colorIndex.length > 0 ) { + if ( colorIndex && colorIndex.length > 0 ) { // if the colorIndex field is not empty, then they are used to choose one color for each face of the IndexedFaceSet @@ -1409,7 +1417,7 @@ THREE.VRMLLoader = ( function () { // consider vertex normals - if ( normalIndex.length > 0 ) { + if ( normalIndex && normalIndex.length > 0 ) { // if the normalIndex field is not empty, then it is used to choose normals for each vertex of the IndexedFaceSet. @@ -1428,7 +1436,7 @@ THREE.VRMLLoader = ( function () { // consider face normals - if ( normalIndex.length > 0 ) { + if ( normalIndex && normalIndex.length > 0 ) { // if the normalIndex field is not empty, then they are used to choose one normal for each face of the IndexedFaceSet @@ -1459,7 +1467,7 @@ THREE.VRMLLoader = ( function () { // texture coordinates are always defined on vertex level - if ( texCoordIndex.length > 0 ) { + if ( texCoordIndex && texCoordIndex.length > 0 ) { // if the texCoordIndex field is not empty, then it is used to choose texture coordinates for each vertex of the IndexedFaceSet. diff --git a/examples/jsm/loaders/VRMLLoader.js b/examples/jsm/loaders/VRMLLoader.js index 4e0397314a23b82ef104f0324b908fd6f49023a9..d746c8528478257320a1461448262899e3991656 100644 --- a/examples/jsm/loaders/VRMLLoader.js +++ b/examples/jsm/loaders/VRMLLoader.js @@ -963,7 +963,7 @@ var VRMLLoader = ( function () { var object; - if ( geometry ) { + if ( geometry && geometry.attributes.position ) { var type = geometry._type; @@ -1037,7 +1037,7 @@ var VRMLLoader = ( function () { object = new Object3D(); - // if the geometry field is NULL the object is not drawn + // if the geometry field is NULL or no vertices are defined the object is not drawn object.visible = false; @@ -1387,6 +1387,14 @@ var VRMLLoader = ( function () { } + if ( coordIndex === undefined ) { + + console.warn( 'THREE.VRMLLoader: Missing coordIndex.' ); + + return new BufferGeometry(); // handle VRML files with incomplete geometry definition + + } + var triangulatedCoordIndex = triangulateFaceIndex( coordIndex, ccw ); var positionAttribute; @@ -1398,7 +1406,7 @@ var VRMLLoader = ( function () { if ( colorPerVertex === true ) { - if ( colorIndex.length > 0 ) { + if ( colorIndex && colorIndex.length > 0 ) { // if the colorIndex field is not empty, then it is used to choose colors for each vertex of the IndexedFaceSet. @@ -1415,7 +1423,7 @@ var VRMLLoader = ( function () { } else { - if ( colorIndex.length > 0 ) { + if ( colorIndex && colorIndex.length > 0 ) { // if the colorIndex field is not empty, then they are used to choose one color for each face of the IndexedFaceSet @@ -1443,7 +1451,7 @@ var VRMLLoader = ( function () { // consider vertex normals - if ( normalIndex.length > 0 ) { + if ( normalIndex && normalIndex.length > 0 ) { // if the normalIndex field is not empty, then it is used to choose normals for each vertex of the IndexedFaceSet. @@ -1462,7 +1470,7 @@ var VRMLLoader = ( function () { // consider face normals - if ( normalIndex.length > 0 ) { + if ( normalIndex && normalIndex.length > 0 ) { // if the normalIndex field is not empty, then they are used to choose one normal for each face of the IndexedFaceSet @@ -1493,7 +1501,7 @@ var VRMLLoader = ( function () { // texture coordinates are always defined on vertex level - if ( texCoordIndex.length > 0 ) { + if ( texCoordIndex && texCoordIndex.length > 0 ) { // if the texCoordIndex field is not empty, then it is used to choose texture coordinates for each vertex of the IndexedFaceSet.