@@ -5,8 +5,11 @@ var obj2gltf = require('./obj2gltf');
55var obj2B3dm = require ( './obj2B3dm' ) ;
66var obj2I3dm = require ( './obj2I3dm' ) ;
77var obj2Tileset = require ( './obj2Tileset' ) ;
8+ var combine = require ( './combineTileset' ) ;
89
910module . exports = obj23dtiles ;
11+ obj23dtiles . combine = combine ;
12+
1013function obj23dtiles ( objPath , outputPath , options ) {
1114 console . time ( 'Total' ) ;
1215
@@ -18,6 +21,12 @@ function obj23dtiles(objPath, outputPath, options) {
1821 if ( typeof options . tilesetOptions === 'string' ) {
1922 options . tilesetOptions = fsExtra . readJsonSync ( options . tilesetOptions ) ;
2023 }
24+ if ( typeof options . customBatchTable === 'string' ) {
25+ options . customBatchTable = fsExtra . readJsonSync ( options . customBatchTable ) ;
26+ }
27+ if ( typeof options . customFeatureTable === 'string' ) {
28+ options . customFeatureTable = fsExtra . readJsonSync ( options . customFeatureTable ) ;
29+ }
2130
2231 obj2Tileset ( objPath , outputPath , options )
2332 . then ( function ( result ) {
@@ -43,25 +52,16 @@ function obj23dtiles(objPath, outputPath, options) {
4352 console . timeEnd ( 'Total' ) ;
4453 } )
4554 . catch ( function ( error ) {
46- console . log ( error . message ) ;
55+ console . log ( error . message || error ) ;
4756 process . exit ( 1 ) ;
4857 } ) ;
4958 } else if ( options . i3dm ) {
5059 options . binary = true ;
5160 options . batchId = false ;
52- if ( typeof options . tilesetOptions === 'string' ) {
53- options . tilesetOptions = fsExtra . readJsonSync ( options . tilesetOptions ) ;
54- }
5561 if ( ! options . customFeatureTable ) {
5662 console . log ( 'Convert to i3dm need a custom FeatureTable.' ) ;
5763 process . exit ( 1 ) ;
5864 }
59- if ( typeof options . customFeatureTable === 'string' ) {
60- options . customFeatureTable = fsExtra . readJsonSync ( options . customFeatureTable ) ;
61- }
62- if ( options . customBatchTable && typeof options . customBatchTable === 'string' ) {
63- options . customBatchTable = fsExtra . readJsonSync ( options . customBatchTable ) ;
64- }
6565
6666 obj2Tileset ( objPath , outputPath , options )
6767 . then ( function ( result ) {
@@ -87,7 +87,7 @@ function obj23dtiles(objPath, outputPath, options) {
8787 console . timeEnd ( 'Total' ) ;
8888 } )
8989 . catch ( function ( error ) {
90- console . log ( error . message ) ;
90+ console . log ( error . message || error ) ;
9191 process . exit ( 1 ) ;
9292 } ) ;
9393 }
@@ -112,7 +112,7 @@ function obj23dtiles(objPath, outputPath, options) {
112112 console . timeEnd ( 'Total' ) ;
113113 } )
114114 . catch ( function ( error ) {
115- console . log ( error . message ) ;
115+ console . log ( error . message || error ) ;
116116 process . exit ( 1 ) ;
117117 } ) ;
118118 }
@@ -123,12 +123,6 @@ function obj23dtiles(objPath, outputPath, options) {
123123 console . log ( 'Convert to i3dm need a custom FeatureTable.' ) ;
124124 process . exit ( 1 ) ;
125125 }
126- if ( typeof options . customFeatureTable === 'string' ) {
127- options . customFeatureTable = fsExtra . readJsonSync ( options . customFeatureTable ) ;
128- }
129- if ( options . customBatchTable && typeof options . customBatchTable === 'string' ) {
130- options . customBatchTable = fsExtra . readJsonSync ( options . customBatchTable ) ;
131- }
132126 obj2I3dm ( objPath , options )
133127 . then ( function ( result ) {
134128 var i3dm = result . i3dm ;
@@ -146,7 +140,7 @@ function obj23dtiles(objPath, outputPath, options) {
146140 console . timeEnd ( 'Total' ) ;
147141 } )
148142 . catch ( function ( error ) {
149- console . log ( error . message ) ;
143+ console . log ( error . message || error ) ;
150144 process . exit ( 1 ) ;
151145 } ) ;
152146 }
@@ -167,7 +161,7 @@ function obj23dtiles(objPath, outputPath, options) {
167161 console . timeEnd ( 'Total' ) ;
168162 } )
169163 . catch ( function ( error ) {
170- console . log ( error . message ) ;
164+ console . log ( error . message || error ) ;
171165 process . exit ( 1 ) ;
172166 } ) ;
173167 }
0 commit comments