提交 26ca3546 编写于 作者: M Mr.doob 提交者: GitHub

Merge pull request #11674 from Mugen87/dev2

BabylonLoader: Clean up
......@@ -76,29 +76,28 @@ THREE.BabylonLoader.prototype = {
var geometry = new THREE.BufferGeometry();
// indices
var indices = json.indices;
var positions = json.positions;
var normals = json.normals;
var uvs = json.uvs;
var indices = new Uint16Array( json.indices );
// indices
geometry.setIndex( new THREE.BufferAttribute( indices, 1 ) );
geometry.setIndex( indices );
// positions
var positions = new Float32Array( json.positions );
for ( var j = 2, jl = positions.length; j < jl; j += 3 ) {
positions[ j ] = - positions[ j ];
}
geometry.addAttribute( 'position', new THREE.BufferAttribute( positions, 3 ) );
geometry.addAttribute( 'position', new THREE.Float32BufferAttribute( positions, 3 ) );
// normals
if ( json.normals ) {
var normals = new Float32Array( json.normals );
if ( normals ) {
for ( var j = 2, jl = normals.length; j < jl; j += 3 ) {
......@@ -106,17 +105,15 @@ THREE.BabylonLoader.prototype = {
}
geometry.addAttribute( 'normal', new THREE.BufferAttribute( normals, 3 ) );
geometry.addAttribute( 'normal', new THREE.Float32BufferAttribute( normals, 3 ) );
}
// uvs
if ( json.uvs ) {
var uvs = new Float32Array( json.uvs );
if ( uvs ) {
geometry.addAttribute( 'uv', new THREE.BufferAttribute( uvs, 2 ) );
geometry.addAttribute( 'uv', new THREE.Float32BufferAttribute( uvs, 2 ) );
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册