Load and Save Options

Load and Save Options — Aspose.3D FOSS for Java

Properties

Tất cả các thao tác nhập và xuất chấp nhận một đối tượng options object tùy chọn được suy ra từ LoadOptions hoặc SaveOptions. Gửi subclass thích hợp tới Scene.open() hoặc Scene.save() để kiểm soát hành vi đặc thù của định dạng.

Properties: com.aspose.threed

import com.aspose.threed.*;

LoadOptions

Lớp cơ sở cho tất cả các đối tượng load-option. Extends A3DObject.

PropertiesPropertiesPropertiesProperties
fileFormatFileFormatgetFileFormat()Định dạng mà cấu hình này liên kết (read-only)

SaveOptions

Lớp cơ sở cho tất cả các đối tượng save-option. Extends A3DObject.

PropertiesPropertiesPropertiesProperties
fileFormatFileFormatgetFileFormat()Định dạng mà cấu hình này liên kết tới (chỉ đọc)

ObjLoadOptions

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

import com.aspose.threed.*;

ObjLoadOptions opts = new ObjLoadOptions();
opts.setFlipCoordinateSystem(true);
opts.setScale(0.01);
Scene scene = new Scene();
scene.open("model.obj", opts);
PropertiesPropertiesPropertiesPropertiesPropertiesProperties
flipCoordinateSystembooleangetFlipCoordinateSystem()setFlipCoordinateSystem(boolean)falseĐảo ngược hệ tọa độ khi nhập
enableMaterialsbooleangetEnableMaterials()setEnableMaterials(boolean)trueTải tệp đi kèm .mtl tệp vật liệu
scaledoublegetScale()setScale(double)1.0Tỷ lệ đồng nhất được áp dụng cho tất cả hình học đã nhập
normalizeNormalbooleangetNormalizeNormal()setNormalizeNormal(boolean)trueChuẩn hoá các vectơ pháp tuyến đã nhập về độ dài đơn vị

ObjSaveOptions

Tùy chọn lưu cho các tệp Wavefront OBJ.

import com.aspose.threed.*;

ObjSaveOptions opts = new ObjSaveOptions();
opts.setEnableMaterials(false);
scene.save("output.obj", opts);
PropertiesPropertiesPropertiesPropertiesPropertiesProperties
applyUnitScalebooleangetApplyUnitScale()setApplyUnitScale(boolean)falseÁp dụng hệ số tỷ lệ đơn vị của cảnh cho các tọa độ đã xuất
pointCloudbooleangetPointCloud()setPointCloud(boolean)falseXuất chỉ các đỉnh (không có mặt đa giác)
verbosebooleangetVerbose()setVerbose(boolean)falseBao gồm các chú thích OBJ bổ sung trong đầu ra
serializeWbooleangetSerializeW()setSerializeW(boolean)falseGhi thành phần W của các điểm điều khiển
enableMaterialsbooleangetEnableMaterials()setEnableMaterials(boolean)trueGhi một .mtl tệp vật liệu và tham chiếu nó từ .obj
flipCoordinateSystembooleangetFlipCoordinateSystem()setFlipCoordinateSystem(boolean)falseĐảo hệ tọa độ khi xuất

GltfLoadOptions

Tùy chọn tải cho các tệp glTF 2.0 và GLB (.gltf, .glb).

import com.aspose.threed.*;

GltfLoadOptions opts = new GltfLoadOptions();
opts.setFlipCoordinateSystem(true);
Scene scene = new Scene();
scene.open("model.gltf", opts);
PropertiesPropertiesPropertiesPropertiesPropertiesProperties
flipCoordinateSystembooleangetFlipCoordinateSystem()setFlipCoordinateSystem(boolean)falseĐảo hệ tọa độ khi nhập
prettyPrintbooleangetPrettyPrint()setPrettyPrint(boolean)falseĐịnh dạng JSON đầu ra với thụt lề để dễ đọc

GltfSaveOptions

Tùy chọn lưu cho đầu ra glTF 2.0 và GLB.

import com.aspose.threed.*;
import com.aspose.threed.FileContentType;

// Save as glTF JSON
GltfSaveOptions opts = new GltfSaveOptions();
scene.save("output.gltf", opts);

// Save as GLB (binary glTF)
GltfSaveOptions glbOpts = new GltfSaveOptions();
glbOpts.setContentType(FileContentType.BINARY);
scene.save("output.glb", glbOpts);
PropertiesPropertiesPropertiesPropertiesPropertiesProperties
contentTypeFileContentTypegetContentType()setContentType(FileContentType)FileContentType.ASCIIĐặt thành FileContentType.BINARY để tạo tệp GLB tự chứa; đặt thành FileContentType.ASCII cho JSON .gltf với bộ đệm bên ngoài
flipCoordinateSystembooleangetFlipCoordinateSystem()setFlipCoordinateSystem(boolean)falseĐảo hệ tọa độ khi xuất
prettyPrintbooleangetPrettyPrint()setPrettyPrint(boolean)falseĐịnh dạng JSON đầu ra với thụt lề để dễ đọc
bufferFilePrefixStringgetBufferFilePrefix()setBufferFilePrefix(String)nullTiền tố cho tên tệp bộ đệm bên ngoài
saveExtrasStringgetSaveExtras()setSaveExtras(String)nullDữ liệu extras tùy chỉnh để bao gồm trong đầu ra glTF

StlLoadOptions

Tùy chọn tải cho các tệp STL (.stl).

import com.aspose.threed.*;

StlLoadOptions opts = new StlLoadOptions();
opts.setFlipCoordinateSystem(true);
Scene scene = new Scene();
scene.open("part.stl", opts);
PropertiesPropertiesPropertiesPropertiesPropertiesProperties
flipCoordinateSystembooleangetFlipCoordinateSystem()setFlipCoordinateSystem(boolean)falseĐảo hệ tọa độ khi nhập
recalculateNormalbooleangetRecalculateNormal()setRecalculateNormal(boolean)falseTính lại các vector pháp tuyến từ hình học khi nhập
contentTypeFileContentTypegetContentType()setContentType(FileContentType)Gợi ý để phát hiện STL nhị phân so với ASCII

StlSaveOptions

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

import com.aspose.threed.*;

StlSaveOptions opts = new StlSaveOptions();
opts.setContentType(FileContentType.BINARY);
scene.save("output.stl", opts);
PropertiesPropertiesPropertiesPropertiesPropertiesProperties
flipCoordinateSystembooleangetFlipCoordinateSystem()setFlipCoordinateSystem(boolean)falseĐảo hệ tọa độ khi xuất
axisSystemAxisSystemgetAxisSystem()setAxisSystem(AxisSystem)Ghi đè hệ thống trục mục tiêu khi xuất
contentTypeFileContentTypegetContentType()setContentType(FileContentType)FileContentType.BINARYĐặt thành BINARY hoặc ASCII để kiểm soát định dạng đầu ra

FbxLoadOptions

Tải các tùy chọn cho tệp FBX (.fbx).

import com.aspose.threed.*;

FbxLoadOptions opts = new FbxLoadOptions();
opts.setFlipCoordinateSystem(true);
Scene scene = new Scene();
scene.open("animation.fbx", opts);
PropertiesPropertiesPropertiesPropertiesPropertiesProperties
flipCoordinateSystembooleangetFlipCoordinateSystem()setFlipCoordinateSystem(boolean)falseĐảo hệ tọa độ khi nhập

FbxSaveOptions

Lưu ý: Xuất FBX là không khả dụng trong phiên bản FOSS Java. FBX chỉ được hỗ trợ để nhập. The FbxSaveOptions Lớp tồn tại trong API nhưng sẽ gây ra lỗi nếu dùng để lưu. Thay vào đó, hãy sử dụng OBJ, STL, glTF hoặc GLB để xuất.


Xem thêm

 Tiếng Việt