| 11752 | geometry.computeBoundingSphere(); |
| 11753 | |
| 11754 | function parseModel( scale ) { |
| 11755 | |
| 11756 | function isBitSet( value, position ) { |
| 11757 | |
| 11758 | return value & ( 1 << position ); |
| 11759 | |
| 11760 | } |
| 11761 | |
| 11762 | var i, j, fi, |
| 11763 | |
| 11764 | offset, zLength, |
| 11765 | |
| 11766 | colorIndex, normalIndex, uvIndex, materialIndex, |
| 11767 | |
| 11768 | type, |
| 11769 | isQuad, |
| 11770 | hasMaterial, |
| 11771 | hasFaceVertexUv, |
| 11772 | hasFaceNormal, hasFaceVertexNormal, |
| 11773 | hasFaceColor, hasFaceVertexColor, |
| 11774 | |
| 11775 | vertex, face, faceA, faceB, color, hex, normal, |
| 11776 | |
| 11777 | uvLayer, uv, u, v, |
| 11778 | |
| 11779 | faces = json.faces, |
| 11780 | vertices = json.vertices, |
| 11781 | normals = json.normals, |
| 11782 | colors = json.colors, |
| 11783 | |
| 11784 | nUvLayers = 0; |
| 11785 | |
| 11786 | if ( json.uvs !== undefined ) { |
| 11787 | |
| 11788 | // disregard empty arrays |
| 11789 | |
| 11790 | for ( i = 0; i < json.uvs.length; i ++ ) { |
| 11791 | |
| 11792 | if ( json.uvs[ i ].length ) nUvLayers ++; |
| 11793 | |
| 11794 | } |
| 11795 | |
| 11796 | for ( i = 0; i < nUvLayers; i ++ ) { |
| 11797 | |
| 11798 | geometry.faceVertexUvs[ i ] = []; |
| 11799 | |
| 11800 | } |
| 11801 | |
| 11802 | } |
| 11803 | |
| 11804 | offset = 0; |
| 11805 | zLength = vertices.length; |
| 11806 | |
| 11807 | while ( offset < zLength ) { |
| 11808 | |
| 11809 | vertex = new THREE.Vector3(); |
| 11810 | |
| 11811 | vertex.x = vertices[ offset ++ ] * scale; |