examples/FBXLoader.js
function ( reader, version ) {

			var node = {};

			// The first three data sizes depends on version.
			var endOffset = ( version >= 7500 ) ? reader.getUint64() : reader.getUint32();
			var numProperties = ( version >= 7500 ) ? reader.getUint64() : reader.getUint32();

			// note: do not remove this even if you get a linter warning as it moves the buffer forward
			var propertyListLen = ( version >= 7500 ) ? reader.getUint64() : reader.getUint32();

			var nameLen = reader.getUint8();
			var name = reader.getString( nameLen );

			// Regards this node as NULL-record if endOffset is zero
			if ( endOffset === 0 ) return null;

			var propertyList = [];

			for ( var i = 0; i < numProperties; i ++ ) {

				propertyList.push( this.parseProperty( reader ) );

			}

			// Regards the first three elements in propertyList as id, attrName, and attrType
			var id = propertyList.length > 0 ? propertyList[ 0 ] : '';
			var attrName = propertyList.length > 1 ? propertyList[ 1 ] : '';
			var attrType = propertyList.length > 2 ? propertyList[ 2 ] : '';

			// check if this node represents just a single property
			// like (name, 0) set or (name2, [0, 1, 2]) set of {name: 0, name2: [0, 1, 2]}
			node.singleProperty = ( numProperties === 1 && reader.getOffset() === endOffset ) ? true : false;

			while ( endOffset > reader.getOffset() ) {

				var subNode = this.parseNode( reader, version );

				if ( subNode !== null ) this.parseSubNode( name, node, subNode );

			}

			node.propertyList = propertyList; // raw property list used by parent

			if ( typeof id === 'number' ) node.id = id;
			if ( attrName !== '' ) node.attrName = attrName;
			if ( attrType !== '' ) node.attrType = attrType;
			if ( name !== '' ) node.name = name;

			return node;

		}
function ( reader, version ) {

			var node = {};

			// The first three data sizes depends on version.
			var endOffset = ( version >= 7500 ) ? reader.getUint64() : reader.getUint32();
			var numProperties = ( version >= 7500 ) ? reader.getUint64() : reader.getUint32();

			// note: do not remove this even if you get a linter warning as it moves the buffer forward
			var propertyListLen = ( version >= 7500 ) ? reader.getUint64() : reader.getUint32();

			var nameLen = reader.getUint8();
			var name = reader.getString( nameLen );

			// Regards this node as NULL-record if endOffset is zero
			if ( endOffset === 0 ) return null;

			var propertyList = [];

			for ( var i = 0; i < numProperties; i ++ ) {

				propertyList.push( this.parseProperty( reader ) );

			}

			// Regards the first three elements in propertyList as id, attrName, and attrType
			var id = propertyList.length > 0 ? propertyList[ 0 ] : '';
			var attrName = propertyList.length > 1 ? propertyList[ 1 ] : '';
			var attrType = propertyList.length > 2 ? propertyList[ 2 ] : '';

			// check if this node represents just a single property
			// like (name, 0) set or (name2, [0, 1, 2]) set of {name: 0, name2: [0, 1, 2]}
			node.singleProperty = ( numProperties === 1 && reader.getOffset() === endOffset ) ? true : false;

			while ( endOffset > reader.getOffset() ) {

				var subNode = this.parseNode( reader, version );

				if ( subNode !== null ) this.parseSubNode( name, node, subNode );

			}

			node.propertyList = propertyList; // raw property list used by parent

			if ( typeof id === 'number' ) node.id = id;
			if ( attrName !== '' ) node.attrName = attrName;
			if ( attrType !== '' ) node.attrType = attrType;
			if ( name !== '' ) node.name = name;

			return node;

		}
function ( reader , version ) { var node = { } ; // The first three data sizes depends on version. var endOffset = ( version >= 7500 ) ? reader . getUint64 ( ) : reader . getUint32 ( ) ; var numProperties = ( version >= 7500 ) ? reader . getUint64 ( ) : reader . getUint32 ( ) ; // note: do not remove this even if you get a linter warning as it moves the buffer forward var propertyListLen = ( version >= 7500 ) ? reader . getUint64 ( ) : reader . getUint32 ( ) ; var nameLen = reader . getUint8 ( ) ; var name = reader . getString ( nameLen ) ; // Regards this node as NULL-record if endOffset is zero if ( endOffset === 0 ) return null ; var propertyList = [ ] ; for ( var i = 0 ; i < numProperties ; i ++ ) { propertyList . push ( this . parseProperty ( reader ) ) ; } // Regards the first three elements in propertyList as id, attrName, and attrType var id = propertyList . length > 0 ? propertyList [ 0 ] : '' ; var attrName = propertyList . length > 1 ? propertyList [ 1 ] : '' ; var attrType = propertyList . length > 2 ? propertyList [ 2 ] : '' ; // check if this node represents just a single property // like (name, 0) set or (name2, [0, 1, 2]) set of {name: 0, name2: [0, 1, 2]} node . singleProperty = ( numProperties === 1 && reader . getOffset ( ) === endOffset ) ? true : false ; while ( endOffset > reader . getOffset ( ) ) { var subNode = this . parseNode ( reader , version ) ; if ( subNode !== null ) this . parseSubNode ( name , node , subNode ) ; } node . propertyList = propertyList ; // raw property list used by parent if ( typeof id === 'number' ) node . id = id ; if ( attrName !== '' ) node . attrName = attrName ; if ( attrType !== '' ) node . attrType = attrType ; if ( name !== '' ) node . name = name ; return node ; }
recursively parse nodes until the end of the file is reached
recursively parse nodes until the end of the file is reached