阅读(2755) (1)

three.js PLYExporter

2022-12-26 14:55:02 更新

PLY 的出口商。

PLY(多边形或斯坦福三角格式)是一种文件格式,用于以密集格式高效交付和加载简单的静态 3D 内容。支持二进制和 ascii 格式。 PLY 可以存储顶点位置、颜色、法线和 uv 坐标。没有保存纹理或纹理参考。

代码示例

// Instantiate an exporter
const exporter = new PLYExporter();

// Parse the input and generate the ply output
const data = exporter.parse( scene, options );
downloadFile( data );

构造函数

PLYExporter()

创建一个新的 PLYExporter。

方法

.parse ( input : Object3D, onDone : Function, options : Object ) : Object

input — Object3D
onCompleted — 将在导出完成时调用。参数将是生成的 ply ascii 或二进制 ArrayBuffer。

options — 导出选项

  • excludeAttributes - array. 从导出的 PLY 文件中明确排除哪些属性。有效值为“color”、“normal”、“uv”和“index”。如果排除三角形索引,则导出点云。默认为空数组。
  • binary - bool. 以二进制格式导出,返回一个 ArrayBuffer。默认为假。

从输入对象生成层文件数据作为字符串或 ArrayBuffer(ascii 或二进制)输出。返回的数据与传递到“onCompleted”函数的数据相同。如果对象由多个子项和几何体组成,它们将合并到文件中的单个网格中。

源码

examples/jsm/exporters/PLYExporter.js