codecamp

three.js PLYExporter

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


three.js GLTFExporter
three.js LookupTable
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

参考

核心 / BufferAttributes

渲染器 / WebXR

开发者参考

WebGL渲染器

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }