3d-tiles-tools 中文文档教程
3D Tiles Tools
用于处理和转换 3D Tiles tilesets 的 Node.js 库和命令行工具。
Instructions
克隆此存储库并安装 Node.js。 从这个 repo 的根目录,运行:
npm install
Command line tools
gzip
Gzips 输入的 tileset。
node ./bin/3d-tiles-tools.js gzip ./specs/data/TilesetOfTilesets/ ./output/TilesetOfTilesets-gzipped/
node ./bin/3d-tiles-tools.js gzip -i ./specs/data/TilesetOfTilesets/ -o ./output/TilesetOfTilesets-gzipped/
Flag | Description | Required |
---|---|---|
-i , --input | Input directory of the tileset. | :whitecheckmark: Yes |
-o , --output | Output directory of the processed tileset. | No |
-t , --tilesOnly | Only gzip tiles. | No, default false |
-f , --force | Overwrite output directory if it exists. | No, default false |
ungzip
解压缩输入瓦片集。
node ./bin/3d-tiles-tools.js ungzip ./specs/data/TilesetOfTilesets/ ./output/TilesetOfTilesets-ungzipped/
node ./bin/3d-tiles-tools.js ungzip -i ./specs/data/TilesetOfTilesets/ -o ./output/TilesetOfTilesets-ungzipped/
Flag | Description | Required |
---|---|---|
-i , --input | Input directory of the tileset. | :whitecheckmark: Yes |
-o , --output | Output directory of the processed tileset. | No |
-f , --force | Overwrite output directory if it exists. | No, default false |
glbToB3dm
从具有空批处理表的 glb 创建 b3dm。 由于该工具不 处理整个 tileset,它不能与 Pipeline 工具一起使用。
node ./bin/3d-tiles-tools.js glbToB3dm ./specs/data/CesiumTexturedBox/CesiumTexturedBox.glb ./output/CesiumTexturedBox.b3dm
node ./bin/3d-tiles-tools.js glbToB3dm -i ./specs/data/CesiumTexturedBox/CesiumTexturedBox.glb -o ./output/CesiumTexturedBox.b3dm
Flag | Description | Required |
---|---|---|
-i , --input | Input path of the .glb | :whitecheckmark: Yes |
-o , --output | Output path of the resulting .b3dm | No |
-f , --force | Overwrite output file if it exists. | No, default false |
glbToI3dm
从 glb 创建一个 i3dm,在位置 [0, 0, 0]
有一个实例和一个空的批处理表。 由于该工具不 处理整个 tileset,它不能与 Pipeline 工具一起使用。
node ./bin/3d-tiles-tools.js glbToI3dm ./specs/data/CesiumTexturedBox/CesiumTexturedBox.glb ./output/CesiumTexturedBox.i3dm
node ./bin/3d-tiles-tools.js glbToI3dm -i ./specs/data/CesiumTexturedBox/CesiumTexturedBox.glb -o ./output/CesiumTexturedBox.i3dm
Flag | Description | Required |
---|---|---|
-i , --input | Input path of the .glb | :whitecheckmark: Yes |
-o , --output | Output path of the resulting .i3dm | No |
-f , --force | Overwrite output file if it exists. | No, default false |
b3dmToGlb
从 b3dm 创建一个 glb。 由于此工具不会处理整个图块集, 它不能与管道工具一起使用。
node ./bin/3d-tiles-tools.js b3dmToGlb -i ./specs/data/batchedWithBatchTableBinary.b3dm -o ./output/extracted.glb
Flag | Description | Required |
---|---|---|
-i , --input | Input path of the .b3dm | :whitecheckmark: Yes |
-o , --output | Output path of the resulting .glb | No |
-f , --force | Overwrite output file if it exists. | No, default false |
i3dmToGlb
从 i3dm 创建一个 glb。 由于此工具不会处理整个图块集, 它不能与管道工具一起使用。
node ./bin/3d-tiles-tools.js i3dmToGlb -i ./specs/data/instancedWithBatchTableBinary.i3dm -o ./output/extracted.glb
Flag | Description | Required |
---|---|---|
-i , --input | Input path of the .i3dm | :whitecheckmark: Yes |
-o , --output | Output path of the resulting .glb | No |
-f , --force | Overwrite output file if it exists. | No, default false |
cmptToGlb
从 cmpt 磁贴中提取 glb 模型。 如果找到多个模型,一个数字将附加到 输出文件名。 由于此工具不处理整个图块集,因此不能与管道工具一起使用。
node ./bin/3d-tiles-tools.js cmptToGlb -i ./specs/data/composite.cmpt -o ./output/extracted.glb
Flag | Description | Required |
---|---|---|
-i , --input | Input path of the .cmpt | :whitecheckmark: Yes |
-o , --output | Output path of the resulting .glb | No |
-f , --force | Overwrite output file if it exists. | No, default false |
optimizeB3dm
使用 gltf-pipeline 优化 b3dm。 由于该工具不 处理整个 tileset,它不能与 Pipeline 工具一起使用。
node ./bin/3d-tiles-tools.js optimizeB3dm -i ./specs/data/batchedWithBatchTableBinary.b3dm -o ./output/optimized.b3dm
量化浮点属性和 oct 编码法线
node ./bin/3d-tiles-tools.js optimizeB3dm -i ./specs/data/batchedWithBatchTableBinary.b3dm -o ./output/optimized.b3dm --options -q -n
Flag | Description | Required |
---|---|---|
-i , --input | Input path of the .b3dm | :whitecheckmark: Yes |
-o , --output | Output path of the resulting .b3dm | No |
-f , --force | Overwrite output file if it exists. | No, default false |
--options | All arguments past this flag are consumed by gltf-pipeline. | No |
要使用 tileset 纹理压缩,传递"texcomp
flags
node ./bin/3d-tiles-tools.js optimizeB3dm -i ./specs/data/Textured/batchedTextured.b3dm -o ./output/optimized.b3dm --options --texcomp.dxt1.enable --texcomp.dxt1.quality=5 --texcomp.etc1.enable
此示例优化了 b3dm 并将纹理压缩为 dxt1
和 etc1
格式。
optimizeI3dm
使用 gltf-pipeline 优化 i3dm。 由于此工具不处理整个图块集,因此不能与管道工具一起使用。
node ./bin/3d-tiles-tools.js optimizeI3dm -i ./specs/data/instancedWithBatchTableBinary.i3dm -o ./output/optimized.i3dm
量化浮点属性和 oct 编码法线
node ./bin/3d-tiles-tools.js optimizeI3dm -i ./specs/data/instancedWithBatchTableBinary.i3dm -o ./output/optimized.i3dm --options -q -n
Flag | Description | Required |
---|---|---|
-i , --input | Input path of the .i3dm | :whitecheckmark: Yes |
-o , --output | Output path of the resulting .i3dm | No |
-f , --force | Overwrite output file if it exists. | No, default false |
--options | All arguments past this flag are consumed by gltf-pipeline. | No |
要使用 tileset 纹理压缩,传递"texcomp
标志。
node ./bin/3d-tiles-tools.js optimizeI3dm -i ./specs/data/Textured/instancedTextured.i3dm -o ./output/optimized.i3dm --options --texcomp.dxt1.enable --texcomp.dxt1.quality=5 --texcomp.etc1.enable
此示例优化了 i3dm 并将纹理压缩为 dxt1
和 etc1
格式。
tilesetToDatabase
为 tileset 生成一个 sqlite 数据库。
此工具不能与管道工具一起使用。
每个图块都以 gzip 压缩格式存储在数据库中。 数据库中表格的规范不是最终的,请参阅 3d-tiles/#89。
node ./bin/3d-tiles-tools.js tilesetToDatabase ./specs/data/TilesetOfTilesets/ ./output/tileset.3dtiles
node ./bin/3d-tiles-tools.js tilesetToDatabase -i ./specs/data/TilesetOfTilesets/ -o ./output/tileset.3dtiles
Flag | Description | Required |
---|---|---|
-i , --input | Input directory of the tileset. | :whitecheckmark: Yes |
-o , --output | Output path of the resulting .3dtiles . | No |
-f , --force | Overwrite output file if it exists. | No, default false |
databaseToTileset
将 tileset 数据库解压到 tileset 文件夹。
此工具不能与管道工具一起使用。
每个图块都以 gzip 压缩格式存储在数据库中,并在解压缩时解压缩。 数据库中表格的规范不是最终的,请参阅 3d-tiles/#89。
node ./bin/3d-tiles-tools.js databaseToTileset ./specs/data/tileset.3dtiles ./output/Tileset
node ./bin/3d-tiles-tools.js databaseToTileset -i ./specs/data/tileset.3dtiles -o ./output/Tileset
Flag | Description | Required |
---|---|---|
-i , --input | Input .3dtiles database file. | :whitecheckmark: Yes |
-o , --output | Output directory of the unpacked tileset. | No |
-f , --force | Overwrite output directory if it exists. | No, default false |
Pipeline
node ./bin/3d-tiles-tools.js pipeline ./specs/data/pipeline.json
node ./bin/3d-tiles-tools.js pipeline -i ./specs/data/pipeline.json
Flag | Description | Required |
---|---|---|
-i , --input | Input pipeline JSON file. | :whitecheckmark: Yes |
-f , --force | Overwrite output directory if it exists. | No, default false |
执行包含输入目录、输出目录和要运行的阶段列表的管道 JSON 文件。 阶段可以是指定阶段名称的字符串,也可以是指定阶段名称和任何其他参数的对象。 阶段按列出的顺序执行。
此示例 pipeline.json
对输入图块进行 gzip 压缩并将其保存在给定的输出目录中。
{
"input": "Tileset/",
"output": "TilesetGzipped/",
"stages": ["gzip"]
}
此管道解压缩输入的图块集,然后压缩所有图块。 tileset.json 等文件未压缩。
{
"input": "Tileset/",
"output": "TilesetGzipped/",
"stages": [
"ungzip",
{
"name": "gzip",
"tilesOnly": true
}
]
}
Pipeline Stages
gzip
Gzip 压缩输入瓦片集。
Properties
Type | Description | Required | |
---|---|---|---|
tilesOnly | boolean | Only gzip tiles. | No, default: false |
ungzip
解压缩输入瓦片集。
Build Instructions
运行测试:
npm run test
要在整个代码库上运行 JSHint,请运行:
npm run jsHint
要在保存文件时自动运行 JSHint,请运行以下命令并在控制台窗口中保持打开状态:
npm run jsHint-watch
Running Test Coverage
Coverage 使用 伊斯坦布尔。 运行:
npm run coverage
有关完整的覆盖详细信息,请打开 coverage/lcov-report/index.html
。
测试和覆盖范围涵盖了 Node.js 模块; 它不包括命令行界面。
Generating Documentation
生成文档:
npm run jsDoc
文档将放置在 doc
文件夹中。
Debugging
- To debug the tests in Webstorm, open the Gulp tab, right click the
test
task, and clickDebug 'test'
. - To run a single test, change the test function from
it
tofit
.
3D Tiles Tools
Node.js library and command-line tools for processing and converting 3D Tiles tilesets.
Instructions
Clone this repo and install Node.js. From the root directory of this repo, run:
npm install
Command line tools
gzip
Gzips the input tileset.
node ./bin/3d-tiles-tools.js gzip ./specs/data/TilesetOfTilesets/ ./output/TilesetOfTilesets-gzipped/
node ./bin/3d-tiles-tools.js gzip -i ./specs/data/TilesetOfTilesets/ -o ./output/TilesetOfTilesets-gzipped/
Flag | Description | Required |
---|---|---|
-i , --input | Input directory of the tileset. | :whitecheckmark: Yes |
-o , --output | Output directory of the processed tileset. | No |
-t , --tilesOnly | Only gzip tiles. | No, default false |
-f , --force | Overwrite output directory if it exists. | No, default false |
ungzip
Ungzips the input tileset.
node ./bin/3d-tiles-tools.js ungzip ./specs/data/TilesetOfTilesets/ ./output/TilesetOfTilesets-ungzipped/
node ./bin/3d-tiles-tools.js ungzip -i ./specs/data/TilesetOfTilesets/ -o ./output/TilesetOfTilesets-ungzipped/
Flag | Description | Required |
---|---|---|
-i , --input | Input directory of the tileset. | :whitecheckmark: Yes |
-o , --output | Output directory of the processed tileset. | No |
-f , --force | Overwrite output directory if it exists. | No, default false |
glbToB3dm
Creates a b3dm from a glb with an empty batch table. Since this tool does not process an entire tileset, it cannot be used with the Pipeline tool.
node ./bin/3d-tiles-tools.js glbToB3dm ./specs/data/CesiumTexturedBox/CesiumTexturedBox.glb ./output/CesiumTexturedBox.b3dm
node ./bin/3d-tiles-tools.js glbToB3dm -i ./specs/data/CesiumTexturedBox/CesiumTexturedBox.glb -o ./output/CesiumTexturedBox.b3dm
Flag | Description | Required |
---|---|---|
-i , --input | Input path of the .glb | :whitecheckmark: Yes |
-o , --output | Output path of the resulting .b3dm | No |
-f , --force | Overwrite output file if it exists. | No, default false |
glbToI3dm
Creates a i3dm from a glb with a single instance at position [0, 0, 0]
and an empty batch table. Since this tool does not process an entire tileset, it cannot be used with the Pipeline tool.
node ./bin/3d-tiles-tools.js glbToI3dm ./specs/data/CesiumTexturedBox/CesiumTexturedBox.glb ./output/CesiumTexturedBox.i3dm
node ./bin/3d-tiles-tools.js glbToI3dm -i ./specs/data/CesiumTexturedBox/CesiumTexturedBox.glb -o ./output/CesiumTexturedBox.i3dm
Flag | Description | Required |
---|---|---|
-i , --input | Input path of the .glb | :whitecheckmark: Yes |
-o , --output | Output path of the resulting .i3dm | No |
-f , --force | Overwrite output file if it exists. | No, default false |
b3dmToGlb
Creates a glb from a b3dm. Since this tool does not process an entire tileset, it cannot be used with the Pipeline tool.
node ./bin/3d-tiles-tools.js b3dmToGlb -i ./specs/data/batchedWithBatchTableBinary.b3dm -o ./output/extracted.glb
Flag | Description | Required |
---|---|---|
-i , --input | Input path of the .b3dm | :whitecheckmark: Yes |
-o , --output | Output path of the resulting .glb | No |
-f , --force | Overwrite output file if it exists. | No, default false |
i3dmToGlb
Creates a glb from a i3dm. Since this tool does not process an entire tileset, it cannot be used with the Pipeline tool.
node ./bin/3d-tiles-tools.js i3dmToGlb -i ./specs/data/instancedWithBatchTableBinary.i3dm -o ./output/extracted.glb
Flag | Description | Required |
---|---|---|
-i , --input | Input path of the .i3dm | :whitecheckmark: Yes |
-o , --output | Output path of the resulting .glb | No |
-f , --force | Overwrite output file if it exists. | No, default false |
cmptToGlb
Extracts the glb models from a cmpt tile. If multiple models are found a number will be appended to the output file name. Since this tool does not process an entire tileset, it cannot be used with the Pipeline tool.
node ./bin/3d-tiles-tools.js cmptToGlb -i ./specs/data/composite.cmpt -o ./output/extracted.glb
Flag | Description | Required |
---|---|---|
-i , --input | Input path of the .cmpt | :whitecheckmark: Yes |
-o , --output | Output path of the resulting .glb | No |
-f , --force | Overwrite output file if it exists. | No, default false |
optimizeB3dm
Optimize a b3dm using gltf-pipeline. Since this tool does not process an entire tileset, it cannot be used with the Pipeline tool.
node ./bin/3d-tiles-tools.js optimizeB3dm -i ./specs/data/batchedWithBatchTableBinary.b3dm -o ./output/optimized.b3dm
Quantize floating-point attributes and oct-encode normals
node ./bin/3d-tiles-tools.js optimizeB3dm -i ./specs/data/batchedWithBatchTableBinary.b3dm -o ./output/optimized.b3dm --options -q -n
Flag | Description | Required |
---|---|---|
-i , --input | Input path of the .b3dm | :whitecheckmark: Yes |
-o , --output | Output path of the resulting .b3dm | No |
-f , --force | Overwrite output file if it exists. | No, default false |
--options | All arguments past this flag are consumed by gltf-pipeline. | No |
To use tileset texture compression, pass the texcomp
flags
node ./bin/3d-tiles-tools.js optimizeB3dm -i ./specs/data/Textured/batchedTextured.b3dm -o ./output/optimized.b3dm --options --texcomp.dxt1.enable --texcomp.dxt1.quality=5 --texcomp.etc1.enable
This example optimizes the b3dm and compresses the textures into dxt1
and etc1
formats.
optimizeI3dm
Optimize a i3dm using gltf-pipeline. Since this tool does not process an entire tileset, it cannot be used with the Pipeline tool.
node ./bin/3d-tiles-tools.js optimizeI3dm -i ./specs/data/instancedWithBatchTableBinary.i3dm -o ./output/optimized.i3dm
Quantize floating-point attributes and oct-encode normals
node ./bin/3d-tiles-tools.js optimizeI3dm -i ./specs/data/instancedWithBatchTableBinary.i3dm -o ./output/optimized.i3dm --options -q -n
Flag | Description | Required |
---|---|---|
-i , --input | Input path of the .i3dm | :whitecheckmark: Yes |
-o , --output | Output path of the resulting .i3dm | No |
-f , --force | Overwrite output file if it exists. | No, default false |
--options | All arguments past this flag are consumed by gltf-pipeline. | No |
To use tileset texture compression, pass the texcomp
flags.
node ./bin/3d-tiles-tools.js optimizeI3dm -i ./specs/data/Textured/instancedTextured.i3dm -o ./output/optimized.i3dm --options --texcomp.dxt1.enable --texcomp.dxt1.quality=5 --texcomp.etc1.enable
This example optimizes the i3dm and compresses the textures into dxt1
and etc1
formats.
tilesetToDatabase
Generates a sqlite database for a tileset.
This tool cannot be used with the Pipeline tool.
Each tile is stored gzipped in the database. The specification for the tables in the database is not final, see 3d-tiles/#89.
node ./bin/3d-tiles-tools.js tilesetToDatabase ./specs/data/TilesetOfTilesets/ ./output/tileset.3dtiles
node ./bin/3d-tiles-tools.js tilesetToDatabase -i ./specs/data/TilesetOfTilesets/ -o ./output/tileset.3dtiles
Flag | Description | Required |
---|---|---|
-i , --input | Input directory of the tileset. | :whitecheckmark: Yes |
-o , --output | Output path of the resulting .3dtiles . | No |
-f , --force | Overwrite output file if it exists. | No, default false |
databaseToTileset
Unpack a tileset database to a tileset folder.
This tool cannot be used with the Pipeline tool.
Each tile is stored gzipped in the database, and unzipped when unpacked. The specification for the tables in the database is not final, see 3d-tiles/#89.
node ./bin/3d-tiles-tools.js databaseToTileset ./specs/data/tileset.3dtiles ./output/Tileset
node ./bin/3d-tiles-tools.js databaseToTileset -i ./specs/data/tileset.3dtiles -o ./output/Tileset
Flag | Description | Required |
---|---|---|
-i , --input | Input .3dtiles database file. | :whitecheckmark: Yes |
-o , --output | Output directory of the unpacked tileset. | No |
-f , --force | Overwrite output directory if it exists. | No, default false |
Pipeline
node ./bin/3d-tiles-tools.js pipeline ./specs/data/pipeline.json
node ./bin/3d-tiles-tools.js pipeline -i ./specs/data/pipeline.json
Flag | Description | Required |
---|---|---|
-i , --input | Input pipeline JSON file. | :whitecheckmark: Yes |
-f , --force | Overwrite output directory if it exists. | No, default false |
Executes a pipeline JSON file containing an input directory, output directory, and list of stages to run. A stage can be a string specifying the stage name or an object specifying the stage name and any additional parameters. Stages are executed in the order listed.
This example pipeline.json
gzips the input tilest and saves it in the given output directory.
{
"input": "Tileset/",
"output": "TilesetGzipped/",
"stages": ["gzip"]
}
This pipeline uncompresses the input tileset and then compresses all the tiles. Files like tileset.json are left uncompressed.
{
"input": "Tileset/",
"output": "TilesetGzipped/",
"stages": [
"ungzip",
{
"name": "gzip",
"tilesOnly": true
}
]
}
Pipeline Stages
gzip
Gzips the input tileset.
Properties
Type | Description | Required | |
---|---|---|---|
tilesOnly | boolean | Only gzip tiles. | No, default: false |
ungzip
Ungzips the input tileset.
Build Instructions
Run the tests:
npm run test
To run JSHint on the entire codebase, run:
npm run jsHint
To run JSHint automatically when a file is saved, run the following and leave it open in a console window:
npm run jsHint-watch
Running Test Coverage
Coverage uses istanbul. Run:
npm run coverage
For complete coverage details, open coverage/lcov-report/index.html
.
The tests and coverage covers the Node.js module; it does not cover the command-line interface.
Generating Documentation
To generate the documentation:
npm run jsDoc
The documentation will be placed in the doc
folder.
Debugging
- To debug the tests in Webstorm, open the Gulp tab, right click the
test
task, and clickDebug 'test'
. - To run a single test, change the test function from
it
tofit
.
你可能也喜欢
- 5r1m-phonegap-plugin-barcodescanner 中文文档教程
- 6px 中文文档教程
- @1inch/permit-signed-approvals-utils 中文文档教程
- @1password/asset-fingerprint 中文文档教程
- @4c/selenium-sandbox 中文文档教程
- @8pattern/jcommand 中文文档教程
- @a-martynovich/janus-gateway 中文文档教程
- @a2software/formsy-react 中文文档教程
- @abp/ng.tenant-management.config 中文文档教程
- @abstraqt-dev/nameof 中文文档教程