提交 3b1a002d 编写于 作者: M Mr.doob

OBJLoader: Added support to vertex/normal pattern (so Walt loads).

上级 87b146f0
......@@ -46,7 +46,7 @@ THREE.OBJLoader.prototype.parse = function ( data, callback ) {
}
// faces
// faces: vertex/uv/normal
pattern = /f ([\d]+)\/([\d]+)\/([\d]+) ([\d]+)\/([\d]+)\/([\d]+) ([\d]+)\/([\d]+)\/([\d]+)/g;
......@@ -57,6 +57,17 @@ THREE.OBJLoader.prototype.parse = function ( data, callback ) {
}
// faces: vertex/normal
pattern = /f ([\d]+)\/\/([\d]+) ([\d]+)\/\/([\d]+) ([\d]+)\/\/([\d]+)/g;
while ( ( result = pattern.exec( data ) ) != null ) {
var face = new THREE.Face3( parseInt( result[ 1 ] ) - 1, parseInt( result[ 3 ] ) - 1, parseInt( result[ 5 ] ) - 1 );
geometry.faces.push( face );
}
geometry.computeCentroids();
callback( geometry );
......
......@@ -64,9 +64,10 @@
scene.add( camera );
var loader = new THREE.OBJLoader();
loader.load( "obj/female02/female02.obj", function ( geometry ) {
loader.load( "obj/male02/male02.obj", function ( geometry ) {
var mesh = new THREE.Mesh( geometry, new THREE.MeshBasicMaterial( { wireframe: true } ) );
mesh.position.y = - 80;
scene.add( mesh );
} );
......@@ -83,8 +84,8 @@
function onDocumentMouseMove( event ) {
mouseX = ( event.clientX - windowHalfX );
mouseY = ( event.clientY - windowHalfY );
mouseX = ( event.clientX - windowHalfX ) / 2;
mouseY = ( event.clientY - windowHalfY ) / 2;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册