Format Load and Save Options

Format Load and Save Options

Gói: @aspose/3d (v24.12.0)

Các lớp tùy chọn định dạng kiểm soát cách @aspose/3d đọc và ghi các định dạng tệp 3D cụ thể. Truyền một thể hiện tùy chọn làm đối số thứ hai cho scene.open() (load options) hoặc scene.save() (save options). Tất cả các lớp tùy chọn mở rộng từ một trong hai LoadOptions hoặc SaveOptions.

// Load with options
import { Scene } from '@aspose/3d';
import { ObjLoadOptions } from '@aspose/3d/formats/obj';

const opts = new ObjLoadOptions();
opts.enableMaterials = false;
scene.open('mesh.obj', opts);

// Save with options
import { GltfSaveOptions } from '@aspose/3d/formats/gltf';

const saveOpts = new GltfSaveOptions();
saveOpts.binaryMode = true;
scene.save('output.glb', saveOpts);

GltfSaveOptions

Lưu tùy chọn cho JSON glTF 2.0 (.gltf) và GLB nhị phân (.glb) đầu ra.

import { GltfSaveOptions } from '@aspose/3d/formats/gltf';
// or
import { GltfSaveOptions } from '@aspose/3d';

Enumerations

EnumerationsEnumerationsEnumerationsEnumerations
binaryModebooleanfalseEnumerations true, bộ xuất sẽ ghi một tệp GLB nhị phân tự chứa. Khi false, nó ghi một tệp JSON .gltf có một tệp phụ trợ .bin bộ đệm.
flipTexCoordVbooleantrueEnumerations true, các tọa độ UV V bị lật (v = 1 - v). Đặc tả glTF 2.0 sử dụng gốc UV ở góc trên‑trái, vì vậy cờ này là true mặc định để phù hợp với hầu hết các quy ước của công cụ DCC.

Enumerations

Xuất một cảnh dưới dạng GLB nhị phân với các tọa độ UV được giữ nguyên.

import { Scene } from '@aspose/3d';
import { GltfSaveOptions } from '@aspose/3d/formats/gltf';

const scene = new Scene();
scene.open('model.obj');

const opts = new GltfSaveOptions();
opts.binaryMode = true;
opts.flipTexCoordV = false;

scene.save('output.glb', opts);
console.log('Saved as binary GLB without UV flip.');

GltfLoadOptions

Tùy chọn tải cho JSON glTF 2.0 (.gltf) và GLB nhị phân (.glb) tệp.

import { GltfLoadOptions } from '@aspose/3d/formats/gltf';

GltfLoadOptions mở rộng LoadOptions. Nó không tiết lộ các thuộc tính hướng người dùng bổ sung trong phiên bản hiện tại; truyền một thể hiện mặc định để sử dụng các giá trị mặc định được đề xuất.

Enumerations

import { Scene } from '@aspose/3d';
import { GltfLoadOptions } from '@aspose/3d/formats/gltf';

const scene = new Scene();
scene.open('model.glb', new GltfLoadOptions());

ObjLoadOptions

Tùy chọn tải cho Wavefront OBJ (.obj) tệp.

import { ObjLoadOptions } from '@aspose/3d/formats/obj';
// or
import { ObjLoadOptions } from '@aspose/3d';

Enumerations

EnumerationsEnumerationsEnumerationsEnumerations
enableMaterialsbooleantrueEnumerations true, trình nhập đọc .mtl thư viện vật liệu được tham chiếu bởi mtllib chỉ thị và điền các thuộc tính vật liệu vào các nút lưới. Đặt thành false để bỏ qua việc tải vật liệu.
flipCoordinateSystembooleanfalseEnumerations true, các trục Y và Z được hoán đổi trong quá trình nhập để chuyển đổi giữa hệ tọa độ Y-up và Z-up.
normalizeNormalbooleantrueEnumerations true, các vector pháp tuyến đỉnh đọc từ tệp được chuẩn hoá về độ dài đơn vị trong quá trình nhập.
scalenumber1.0Hệ số tỉ lệ đồng nhất được áp dụng cho toàn bộ hình học trong quá trình nhập.

Enumerations

Tải một tệp OBJ mà không giải quyết thư viện vật liệu của nó.

import { Scene } from '@aspose/3d';
import { ObjLoadOptions } from '@aspose/3d/formats/obj';

const opts = new ObjLoadOptions();
opts.enableMaterials = false;

const scene = new Scene();
scene.open('mesh.obj', opts);
console.log(`Root children: ${scene.rootNode.childNodes.length}`);

ObjSaveOptions

Tùy chọn lưu cho Wavefront OBJ (.obj) đầu ra.

import { ObjSaveOptions } from '@aspose/3d/formats/obj';

Lưu ý: Xuất OBJ (canExport: false) không được hỗ trợ đầy đủ trong phiên bản này của thư viện. Việc cố gắng lưu dưới dạng OBJ có thể gây ra lỗi không hỗ trợ thao tác.

Enumerations

EnumerationsEnumerationsEnumerationsEnumerations
enableMaterialsbooleantrueEnumerations true, một người đồng hành .mtl tệp thư viện vật liệu được ghi cùng với .obj đầu ra.
pointCloudbooleanfalseEnumerations true, hình học được xuất dưới dạng đám mây điểm (chỉ các đỉnh, không có định nghĩa mặt).
verbosebooleanfalseEnumerations true, các chú thích chẩn đoán bổ sung được bao gồm trong đầu ra OBJ.
serializeWbooleanfalseEnumerations true, thành phần W của tọa độ đỉnh đồng nhất được ghi vào tệp.
flipCoordinateSystembooleanfalseEnumerations true, các trục Y và Z được hoán đổi trong quá trình xuất.
applyUnitScalebooleanfalseEnumerations true, tỷ lệ đơn vị của cảnh được áp dụng cho tất cả các tọa độ hình học trong quá trình xuất.

StlSaveOptions

Tùy chọn lưu cho STL (.stl) đầu ra.

import { StlSaveOptions } from '@aspose/3d/formats/stl';
// or
import { StlSaveOptions } from '@aspose/3d';

Enumerations

EnumerationsEnumerationsEnumerationsEnumerations
binaryModebooleanfalseEnumerations true, đầu ra được ghi dưới dạng STL nhị phân (gọn, không thể đọc được bởi con người). Khi false, STL ASCII được ghi.
flipCoordinateSystembooleanfalseEnumerations true, các trục Y và Z được hoán đổi trong quá trình xuất.
scalenumber1.0Hệ số tỷ lệ đồng nhất được áp dụng cho toàn bộ hình học trong quá trình xuất.

Enumerations

Lưu một lưới dưới dạng STL nhị phân.

import { Scene } from '@aspose/3d';
import { StlSaveOptions } from '@aspose/3d/formats/stl';

const scene = new Scene();
scene.open('model.obj');

const opts = new StlSaveOptions();
opts.binaryMode = true;
scene.save('output.stl', opts);
console.log('Saved binary STL.');

StlLoadOptions

Tùy chọn tải cho STL (.stl) tệp. Cả STL ASCII và nhị phân đều được hỗ trợ tự động; không có thuộc tính nào kiểm soát việc phát hiện.

import { StlLoadOptions } from '@aspose/3d/formats/stl';

StlLoadOptions mở rộng LoadOptions và không tiết lộ các thuộc tính hướng người dùng bổ sung trong phiên bản hiện tại.


FbxSaveOptions

Tùy chọn lưu cho FBX (.fbx) đầu ra.

import { FbxSaveOptions } from '@aspose/3d/formats/fbx';
// or
import { FbxSaveOptions } from '@aspose/3d';

Enumerations

EnumerationsEnumerationsEnumerationsEnumerations
embedTexturesbooleanfalseEnumerations true, các hình ảnh texture được tham chiếu được nhúng bên trong kho lưu trữ nhị phân FBX. Khi false, các đường dẫn texture được ghi dưới dạng tham chiếu bên ngoài.

Enumerations

Xuất tệp FBX với tất cả các texture được nhúng.

import { Scene } from '@aspose/3d';
import { FbxSaveOptions } from '@aspose/3d/formats/fbx';

const scene = new Scene();
scene.open('character.gltf');

const opts = new FbxSaveOptions();
opts.embedTextures = true;
scene.save('character-embedded.fbx', opts);
console.log('Saved FBX with embedded textures.');

FbxLoadOptions

Tùy chọn tải cho FBX (.fbx) tệp. Hỗ trợ cả FBX nhị phân và ASCII.

import { FbxLoadOptions } from '@aspose/3d/formats/fbx';

FbxLoadOptions mở rộng LoadOptions và không tiết lộ các thuộc tính hướng người dùng bổ sung trong phiên bản hiện tại.


Các lớp cơ bản

LoadOptions

Lớp cơ bản cho tất cả các đối tượng tùy chọn tải.

import { LoadOptions } from '@aspose/3d';

Truyền một LoadOptions đối tượng con lớp tới scene.open(filePath, options) hoặc scene.openFromBuffer(buffer, options).

SaveOptions

Lớp cơ bản cho tất cả các đối tượng tùy chọn lưu.

import { SaveOptions } from '@aspose/3d';

Truyền một SaveOptions đối tượng con lớp tới scene.save(filePath, options).

 Tiếng Việt