three.js ColladaExporter

2023-02-16 17:51 更新

Collada 的出口商。

Collada 是一種文件格式,用于以 xml 格式穩(wěn)健地表示場景、材料、動畫和其他 3D 內(nèi)容。此導出器僅支持導出幾何體、材質(zhì)、紋理和場景層次結構。

代碼示例

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

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

構造函數(shù)

ColladaExporter()

創(chuàng)建一個新的 ColladaExporter。

方法

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

input — 要導出的 Object3D

onCompleted — 將在導出完成時調(diào)用。選修的。該函數(shù)立即返回相同的數(shù)據(jù)。

options — 導出選項

  • version - string. 要導出哪個版本的 Collada。選項是“1.4.1”或“1.5.0”。默認為“1.4.1”。
  • author - string. 要包含在作者字段中的名稱。默認情況下排除作者字段。
  • textureDirectory - string. 保存紋理的 Collada 文件的相對目錄。

使用 Collada 文件和紋理數(shù)據(jù)生成對象。該對象從函數(shù)返回并傳遞給“onCompleted”回調(diào)。

{
	// Collada file content
	data: "",

	// List of referenced textures
	textures: [{

		// File directory, name, and extension of the texture data
		directory: "",
		name: "",
		ext: "",

		// The texture data and original texture object
		data: [],
		original: <THREE.Texture>
	}, ...]
}

源碼

examples/jsm/exporters/ColladaExporter.js


以上內(nèi)容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號