Skip to content

Commit 49f6e0c

Browse files
committed
update readme for npm usage
1 parent 61031fb commit 49f6e0c

4 files changed

Lines changed: 34 additions & 51 deletions

File tree

NODEUSAGE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Using as module in node.
22

33
Install package from npm.
4+
45
```
56
npm install obj23dtiles
67
```

README.md

Lines changed: 15 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# objTo3d-tiles
2-
Node command line tool convert obj model file to 3D Tiles, based on [obj2gltf](https://github.com/AnalyticalGraphicsInc/obj2gltf).
2+
Node command line tool and module convert obj model file to 3D Tiles, based on [obj2gltf](https://github.com/AnalyticalGraphicsInc/obj2gltf).
33

44
[Online Demonstration](https://princessgod.github.io/plc/batchedTileset.html)
55

@@ -10,37 +10,26 @@ Node command line tool convert obj model file to 3D Tiles, based on [obj2gltf](h
1010
>Please use Cesium after v1.37, cause this 3d tile use glTF2.0.
1111
1212
## Getting Start
13-
Clone this repository to local.
14-
15-
```
16-
git clone https://github.com/PrincessGod/objTo3d-tiles.git
17-
```
18-
19-
Navigate in the repository folder.
20-
21-
```
22-
cd objTo3d-tiles
23-
```
2413

2514
Make sure you have [Node](https://nodejs.org/en/) installed, and then
2615

2716
```
28-
npm install
17+
npm install -g obj23dtiles
2918
```
3019

3120
### Basic Usage
3221

3322
* Convert `.obj` to `.gltf`
3423

3524
```
36-
node ./bin/obj23dtiles.js -i ./bin/barrel/barrel.obj
25+
obj23dtiles -i ./bin/barrel/barrel.obj
3726
// Export barrel.gltf at obj folder.
3827
```
3928

4029
* Convert `.obj` to `.glb`
4130

4231
```
43-
node ./bin/obj23dtiles.js -i ./bin/barrel/barrel.obj -b
32+
obj23dtiles -i ./bin/barrel/barrel.obj -b
4433
// Export barrel.glb at obj folder.
4534
```
4635

@@ -57,35 +46,35 @@ node ./bin/obj23dtiles.js -i ./bin/barrel/barrel.obj -b
5746
* Convert `.obj` to `.b3dm` with default [BatchTable](https://github.com/AnalyticalGraphicsInc/3d-tiles/blob/master/TileFormats/BatchTable/README.md), which have `batchId` and `name` property, and `name` is model's name.
5847

5948
```
60-
node ./bin/obj23dtiles.js -i ./bin/barrel/barrel.obj --b3dm
49+
obj23dtiles -i ./bin/barrel/barrel.obj --b3dm
6150
// Export barrel.b3dm at obj folder.
6251
```
6352

6453
* Convert `.obj` to `.b3dm` with default [BatchTable](https://github.com/AnalyticalGraphicsInc/3d-tiles/blob/master/TileFormats/BatchTable/README.md) and export default BatchTable (a JSON file). Maybe get information for custom BatchTable.
6554

6655
```
67-
node ./bin/obj23dtiles.js -i ./bin/barrel/barrel.obj --b3dm --outputBatchTable
56+
obj23dtiles -i ./bin/barrel/barrel.obj --b3dm --outputBatchTable
6857
// Export barrel.b3dm and barrel_batchTable.json at obj folder.
6958
```
7059

7160
* Convert `.obj` to `.b3dm` with custom [BatchTable](https://github.com/AnalyticalGraphicsInc/3d-tiles/blob/master/TileFormats/BatchTable/README.md).
7261

7362
```
74-
node ./bin/obj23dtiles.js -i ./bin/barrel/barrel.obj -c ./bin/barrel/customBatchTbale.json --b3dm
63+
obj23dtiles -i ./bin/barrel/barrel.obj -c ./bin/barrel/customBatchTable.json --b3dm
7564
// Export barrel.b3dm with custom batch table at obj folder.
7665
```
7766

7867
* Convert `.obj` to `.i3dm` width [FeatureTable](https://github.com/AnalyticalGraphicsInc/3d-tiles/blob/master/TileFormats/Instanced3DModel/README.md#feature-table).
7968

8069
```
81-
node ./bin/obj23dtiles.js -i ./bin/barrel/barrel.obj -f ./bin/barrel/customFeatureTable.json --i3dm
70+
obj23dtiles -i ./bin/barrel/barrel.obj -f ./bin/barrel/customFeatureTable.json --i3dm
8271
// Export barrel.i3dm at obj folder.
8372
```
8473

8574
* Convert `.obj` to `.i3dm` with [FeatureTable](https://github.com/AnalyticalGraphicsInc/3d-tiles/blob/master/TileFormats/Instanced3DModel/README.md#feature-table) and [BatchTable](https://github.com/AnalyticalGraphicsInc/3d-tiles/blob/master/TileFormats/Instanced3DModel/README.md#batch-table).
8675

8776
```
88-
node ./bin/obj23dtiles.js -i ./bin/barrel/barrel.obj -f ./bin/barrel/customFeatureTable.json
77+
obj23dtiles -i ./bin/barrel/barrel.obj -f ./bin/barrel/customFeatureTable.json
8978
-c ./bin/barrel/customI3dmBatchTable.json --i3dm
9079
// Export barrel.i3dm with BatchTable at obj folder.
9180
```
@@ -97,30 +86,30 @@ FeatureTable support following parameters : `position`, `orientation`, `scale`.
9786
* Create a single tileset with `.b3dm` tile.
9887

9988
```
100-
node ./bin/obj23dtiles.js -i ./bin/barrel/barrel.obj --tileset
89+
obj23dtiles -i ./bin/barrel/barrel.obj --tileset
10190
// Export ./Batchedbarrel folder at obj folder which is a tileset.
10291
```
10392

10493
* Create a single tileset with `.b3dm` tile and custom tileset options, custom BatchTable.
10594

10695
```
107-
node ./bin/obj23dtiles.js -i ./bin/barrel/barrel.obj --tileset
108-
-p ./bin/barrel/customTilesetOptions.json -c ./bin/barrel/customBatchTbale.json
96+
obj23dtiles -i ./bin/barrel/barrel.obj --tileset
97+
-p ./bin/barrel/customTilesetOptions.json -c ./bin/barrel/customBatchTable.json
10998
// Export ./Batchedbarrel folder at obj folder which is a tileset with custom tileset options.
11099
```
111100

112101
* Create a single tileset with `.i3dm` tile.
113102

114103
```
115-
node ./bin/obj23dtiles.js -i ./bin/barrel/barrel.obj --tileset --i3dm
104+
obj23dtiles -i ./bin/barrel/barrel.obj --tileset --i3dm
116105
-f ./bin/barrel/customFeatureTable.json
117106
// Export ./Instancedbarrel folder at obj folder which is a tileset.
118107
```
119108

120109
* Create a single tileset with `.i3dm` tile and custom tileset options, custom BatchTable.
121110

122111
```
123-
node ./bin/obj23dtiles.js -i ./bin/barrel/barrel.obj --tileset --i3dm
112+
obj23dtiles -i ./bin/barrel/barrel.obj --tileset --i3dm
124113
-f ./bin/barrel/customFeatureTable.json -p ./bin/barrel/customTilesetOptions.json
125114
-c ./bin/barrel/customI3dmBatchTable.json
126115
// Export ./Instancedbarrel folder at obj folder which is a tileset.
@@ -148,7 +137,7 @@ Here are different bounding volumes.
148137
You can combine tilesets into one `tileset.json` as external tileset.
149138

150139
```
151-
node ./bin/obj23dtiles.js combine -i ./your/tilesets/folder/
140+
obj23dtiles combine -i ./bin/barrel/output
152141
```
153142

154143
## Using as node module

README_CN.md

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,37 +8,26 @@
88
>请使用 Cesium v1.37 或以后版本, 因为这里的 3D Tiles 使用 glTF2.0 。
99
1010
## 开始使用
11-
将此仓库克隆到本地。
12-
13-
```
14-
git clone https://github.com/PrincessGod/objTo3d-tiles.git
15-
```
16-
17-
导航到仓库所在文件夹。
18-
19-
```
20-
cd objTo3d-tiles
21-
```
2211

2312
确保已经安装 [Node](https://nodejs.org/en/) , 然后
2413

2514
```
26-
npm install
15+
npm install obj23dtiles
2716
```
2817

2918
### 基本用法
3019

3120
* 转换 `.obj``.gltf`
3221

3322
```
34-
node ./bin/obj23dtiles.js -i ./bin/barrel/barrel.obj
23+
obj23dtiles -i ./bin/barrel/barrel.obj
3524
// 在模型目录导出 barrel.gltf
3625
```
3726

3827
* 转换 `.obj``.glb`
3928

4029
```
41-
node ./bin/obj23dtiles.js -i ./bin/barrel/barrel.obj -b
30+
obj23dtiles -i ./bin/barrel/barrel.obj -b
4231
// 在模型目录导出 barrel.glb
4332
```
4433

@@ -55,35 +44,35 @@ node ./bin/obj23dtiles.js -i ./bin/barrel/barrel.obj -b
5544
* 转换 `.obj``.b3dm` 同时带有基础的[属性表](https://github.com/AnalyticalGraphicsInc/3d-tiles/blob/master/TileFormats/BatchTable/README.md), 包含 `batchId``name` 属性, `name` 就是模型建模时的名字。
5645

5746
```
58-
node ./bin/obj23dtiles.js -i ./bin/barrel/barrel.obj --b3dm
47+
obj23dtiles -i ./bin/barrel/barrel.obj --b3dm
5948
// 在模型目录导出 barrel.b3dm
6049
```
6150

6251
* 转换 `.obj``.b3dm`,同时导出默认的[属性表](https://github.com/AnalyticalGraphicsInc/3d-tiles/blob/master/TileFormats/BatchTable/README.md) (一个 JSON 文件)。可以从这个表中获取相关信息以便制作自定义属性表。
6352

6453
```
65-
node ./bin/obj23dtiles.js -i ./bin/barrel/barrel.obj --b3dm --outputBatchTable
54+
obj23dtiles -i ./bin/barrel/barrel.obj --b3dm --outputBatchTable
6655
// 在模型目录导出 barrel.b3dm 和 barrel_batchTable.json
6756
```
6857

6958
* 转换 `.obj``.b3dm`,使用自定义[属性表](https://github.com/AnalyticalGraphicsInc/3d-tiles/blob/master/TileFormats/BatchTable/README.md)。属性和模型对应关系靠 `batchId` 进行连接。
7059

7160
```
72-
node ./bin/obj23dtiles.js -i ./bin/barrel/barrel.obj -c ./bin/barrel/customBatchTbale.json --b3dm
61+
obj23dtiles -i ./bin/barrel/barrel.obj -c ./bin/barrel/customBatchTable.json --b3dm
7362
// 在模型目录导出 barrel.b3dm
7463
```
7564

7665
* 转换 `.obj``.i3dm`,使用自定义[要素表](https://github.com/AnalyticalGraphicsInc/3d-tiles/blob/master/TileFormats/Instanced3DModel/README.md#feature-table)
7766

7867
```
79-
node ./bin/obj23dtiles.js -i ./bin/barrel/barrel.obj -f ./bin/barrel/customFeatureTable.json --i3dm
68+
obj23dtiles -i ./bin/barrel/barrel.obj -f ./bin/barrel/customFeatureTable.json --i3dm
8069
// 在模型目录导出 barrel.i3dm
8170
```
8271

8372
* 转换 `.obj``.i3dm`,使用自定义[要素表](https://github.com/AnalyticalGraphicsInc/3d-tiles/blob/master/TileFormats/Instanced3DModel/README.md#feature-table)[属性表](https://github.com/AnalyticalGraphicsInc/3d-tiles/blob/master/TileFormats/Instanced3DModel/README.md#batch-table)
8473

8574
```
86-
node ./bin/obj23dtiles.js -i ./bin/barrel/barrel.obj -f ./bin/barrel/customFeatureTable.json
75+
obj23dtiles -i ./bin/barrel/barrel.obj -f ./bin/barrel/customFeatureTable.json
8776
-c ./bin/barrel/customI3dmBatchTable.json --i3dm
8877
// 在模型目录导出 barrel.i3dm
8978
```
@@ -96,30 +85,30 @@ node ./bin/obj23dtiles.js -i ./bin/barrel/barrel.obj -f ./bin/barrel/customFeatu
9685
* 创建一个 `.b3dm` 瓦片。
9786

9887
```
99-
node ./bin/obj23dtiles.js -i ./bin/barrel/barrel.obj --tileset
88+
obj23dtiles -i ./bin/barrel/barrel.obj --tileset
10089
// 在模型目录导出 Batchedbarrel 文件夹
10190
```
10291

10392
* 创建一个 `.b3dm` 瓦片,并自定义瓦片参数和属性表。
10493

10594
```
106-
node ./bin/obj23dtiles.js -i ./bin/barrel/barrel.obj --tileset
107-
-p ./bin/barrel/customTilesetOptions.json -c ./bin/barrel/customBatchTbale.json
95+
obj23dtiles -i ./bin/barrel/barrel.obj --tileset
96+
-p ./bin/barrel/customTilesetOptions.json -c ./bin/barrel/customBatchTable.json
10897
// 在模型目录导出 Batchedbarrel 文件夹
10998
```
11099

111100
* 创建一个 `.i3dm` 瓦片。
112101

113102
```
114-
node ./bin/obj23dtiles.js -i ./bin/barrel/barrel.obj --tileset --i3dm
103+
obj23dtiles -i ./bin/barrel/barrel.obj --tileset --i3dm
115104
-f ./bin/barrel/customFeatureTable.json
116105
// 在模型目录导出 Instancedbarrel 文件夹
117106
```
118107

119108
* 创建一个 `.i3dm` 瓦片,并自定义瓦片参数和属性表。
120109

121110
```
122-
node ./bin/obj23dtiles.js -i ./bin/barrel/barrel.obj --tileset --i3dm
111+
obj23dtiles -i ./bin/barrel/barrel.obj --tileset --i3dm
123112
-f ./bin/barrel/customFeatureTable.json -p ./bin/barrel/customTilesetOptions.json
124113
-c ./bin/barrel/customI3dmBatchTable.json
125114
// 在模型目录导出 Instancedbarrel 文件夹
@@ -145,7 +134,7 @@ node ./bin/obj23dtiles.js -i ./bin/barrel/barrel.obj --tileset --i3dm
145134
你可以将多个瓦片捆绑为一个瓦片,每个瓦片作为外置瓦片集合到一个 `tileset.json` 中。
146135

147136
```
148-
node ./bin/obj23dtiles.js combine -i ./your/tilesets/folder/
137+
obj23dtiles combine -i ./bin/barrel/output/
149138
```
150139

151140
## 作为 Node 模块使用

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
"3d-tiles",
1717
"cesium"
1818
],
19+
"preferGlobal": true,
20+
"bin": {
21+
"obj23dtiles" : "bin/obj23dtiles.js"
22+
},
1923
"author": "princessgod",
2024
"license": "ISC",
2125
"bugs": {

0 commit comments

Comments
 (0)