| 18621 | geometry.computeBoundingSphere(); |
| 18622 | |
| 18623 | function parseModel( scale ) { |
| 18624 | |
| 18625 | function isBitSet( value, position ) { |
| 18626 | |
| 18627 | return value & ( 1 << position ); |
| 18628 | |
| 18629 | } |
| 18630 | |
| 18631 | var i, j, fi, |
| 18632 | |
| 18633 | offset, zLength, |
| 18634 | |
| 18635 | colorIndex, normalIndex, uvIndex, materialIndex, |
| 18636 | |
| 18637 | type, |
| 18638 | isQuad, |
| 18639 | hasMaterial, |
| 18640 | hasFaceVertexUv, |
| 18641 | hasFaceNormal, hasFaceVertexNormal, |
| 18642 | hasFaceColor, hasFaceVertexColor, |
| 18643 | |
| 18644 | vertex, face, faceA, faceB, hex, normal, |
| 18645 | |
| 18646 | uvLayer, uv, u, v, |
| 18647 | |
| 18648 | faces = json.faces, |
| 18649 | vertices = json.vertices, |
| 18650 | normals = json.normals, |
| 18651 | colors = json.colors, |
| 18652 | |
| 18653 | nUvLayers = 0; |
| 18654 | |
| 18655 | if ( json.uvs !== undefined ) { |
| 18656 | |
| 18657 | // disregard empty arrays |
| 18658 | |
| 18659 | for ( i = 0; i < json.uvs.length; i ++ ) { |
| 18660 | |
| 18661 | if ( json.uvs[ i ].length ) nUvLayers ++; |
| 18662 | |
| 18663 | } |
| 18664 | |
| 18665 | for ( i = 0; i < nUvLayers; i ++ ) { |
| 18666 | |
| 18667 | geometry.faceVertexUvs[ i ] = []; |
| 18668 | |
| 18669 | } |
| 18670 | |
| 18671 | } |
| 18672 | |
| 18673 | offset = 0; |
| 18674 | zLength = vertices.length; |
| 18675 | |
| 18676 | while ( offset < zLength ) { |
| 18677 | |
| 18678 | vertex = new THREE.Vector3(); |
| 18679 | |
| 18680 | vertex.x = vertices[ offset ++ ] * scale; |