Format Load and Save Options
Pachet: @aspose/3d (v24.12.0)
Clasele de opțiuni de format controlează cum @aspose/3d citește și scrie formate de fișiere 3D specifice. Transmite o instanță de opțiuni ca al doilea argument pentru scene.open() (opțiuni de încărcare) sau scene.save() (opțiuni de salvare). Toate clasele de opțiuni extind fie LoadOptions sau 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
Opțiuni de salvare pentru glTF 2.0 JSON (.gltf) și GLB binar (.glb) de ieșire.
import { GltfSaveOptions } from '@aspose/3d/formats/gltf';
// or
import { GltfSaveOptions } from '@aspose/3d';ColladaSaveOptions
| ColladaSaveOptions | ColladaSaveOptions | ColladaSaveOptions | ColladaSaveOptions |
|---|---|---|---|
binaryMode | boolean | false | ColladaSaveOptions true, exportatorul scrie un fișier binar GLB autonom. Când false, scrie un JSON .gltf fișier cu un companion .bin buffer. |
flipTexCoordV | boolean | true | ColladaSaveOptions true, coordonatele UV V sunt inversate (v = 1 - v). Specificația glTF 2.0 folosește un originea UV în partea stânga-sus, astfel că acest flag este true implicit pentru a se potrivi cu majoritatea convențiilor instrumentelor DCC. |
ColladaSaveOptions
Exportă o scenă ca GLB binar cu coordonatele UV păstrate așa cum sunt.
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
Opțiuni de încărcare pentru JSON glTF 2.0 (.gltf) și GLB binar (.glb) fișiere.
import { GltfLoadOptions } from '@aspose/3d/formats/gltf';GltfLoadOptions extinde LoadOptions. Nu expune proprietăți suplimentare vizibile utilizatorului în versiunea curentă; transmite o instanță implicită pentru a folosi valorile recomandate.
ColladaSaveOptions
import { Scene } from '@aspose/3d';
import { GltfLoadOptions } from '@aspose/3d/formats/gltf';
const scene = new Scene();
scene.open('model.glb', new GltfLoadOptions());ObjLoadOptions
Încarcă opțiuni pentru Wavefront OBJ (.obj) fișiere.
import { ObjLoadOptions } from '@aspose/3d/formats/obj';
// or
import { ObjLoadOptions } from '@aspose/3d';ColladaSaveOptions
| ColladaSaveOptions | ColladaSaveOptions | ColladaSaveOptions | ColladaSaveOptions |
|---|---|---|---|
enableMaterials | boolean | true | ColladaSaveOptions true, importatorul citește .mtl biblioteca de materiale referențiată de mtllib directivă și completează proprietățile materialului pe nodurile rețelei. Setează la false pentru a omite încărcarea materialului. |
flipCoordinateSystem | boolean | false | ColladaSaveOptions true, axele Y și Z sunt inversate în timpul importului pentru a converti între sistemele de coordonate Y-up și Z-up. |
normalizeNormal | boolean | true | ColladaSaveOptions true, normele vârfurilor citite din fișier sunt normalizate la lungime unitară în timpul importului. |
scale | number | 1.0 | Factor de scară uniform aplicat tuturor geometriei în timpul importului. |
ColladaSaveOptions
Încarcă un fișier OBJ fără a rezolva biblioteca sa de materiale.
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
Salvează opțiuni pentru Wavefront OBJ (.obj) ieșire.
import { ObjSaveOptions } from '@aspose/3d/formats/obj';Notă: Export OBJ (canExport: false) nu este complet suportat în această versiune a bibliotecii. Încercarea de a salva în OBJ poate genera o eroare de operație nesuportată.
ColladaSaveOptions
| ColladaSaveOptions | ColladaSaveOptions | ColladaSaveOptions | ColladaSaveOptions |
|---|---|---|---|
enableMaterials | boolean | true | ColladaSaveOptions true, un companion .mtl fișierul de bibliotecă de materiale este scris alături de .obj ieșire. |
pointCloud | boolean | false | ColladaSaveOptions true, geometria este exportată ca un nor de puncte (doar vârfuri, fără definiții de fețe). |
verbose | boolean | false | ColladaSaveOptions true, comentarii diagnostice suplimentare sunt incluse în ieșirea OBJ. |
serializeW | boolean | false | ColladaSaveOptions true, componenta W a coordonatelor omogene ale vârfurilor este scrisă în fișier. |
flipCoordinateSystem | boolean | false | ColladaSaveOptions true, axele Y și Z sunt inversate în timpul exportului. |
applyUnitScale | boolean | false | ColladaSaveOptions true, scara unității scenei este aplicată la toate coordonatele geometriei în timpul exportului. |
StlSaveOptions
Opțiuni de salvare pentru STL (.stl) de ieșire.
import { StlSaveOptions } from '@aspose/3d/formats/stl';
// or
import { StlSaveOptions } from '@aspose/3d';ColladaSaveOptions
| ColladaSaveOptions | ColladaSaveOptions | ColladaSaveOptions | ColladaSaveOptions |
|---|---|---|---|
binaryMode | boolean | false | ColladaSaveOptions true, ieșirea este scrisă ca STL binar (compact, nefiind lizibil de către om). Când false, se scrie STL ASCII. |
flipCoordinateSystem | boolean | false | ColladaSaveOptions true, axele Y și Z sunt inversate în timpul exportului. |
scale | number | 1.0 | Factor de scară uniform aplicat la toată geometria în timpul exportului. |
ColladaSaveOptions
Salvează o rețea ca STL binar.
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
Opțiuni de încărcare pentru STL (.stl) fișiere. Atât STL ASCII, cât și STL binar sunt suportate automat; nicio proprietate nu controlează detectarea.
import { StlLoadOptions } from '@aspose/3d/formats/stl';StlLoadOptions extinde LoadOptions și nu expune proprietăți suplimentare vizibile utilizatorului în versiunea curentă.
FbxSaveOptions
Opțiuni de salvare pentru FBX (.fbx) ieșire.
import { FbxSaveOptions } from '@aspose/3d/formats/fbx';
// or
import { FbxSaveOptions } from '@aspose/3d';ColladaSaveOptions
| ColladaSaveOptions | ColladaSaveOptions | ColladaSaveOptions | ColladaSaveOptions |
|---|---|---|---|
embedTextures | boolean | false | ColladaSaveOptions true, imaginile de textură referențiate sunt încorporate în arhiva binară FBX. Când false, căile de textură sunt scrise ca referințe externe. |
ColladaSaveOptions
Exportă un fișier FBX cu toate texturile încorporate.
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
Opțiuni de încărcare pentru FBX (.fbx) fișiere. Suportă atât FBX binar, cât și ASCII.
import { FbxLoadOptions } from '@aspose/3d/formats/fbx';FbxLoadOptions extinde LoadOptions și nu expune proprietăți suplimentare vizibile utilizatorului în versiunea curentă.
Clase de bază
LoadOptions
Clasă de bază pentru toate obiectele de opțiuni de încărcare.
import { LoadOptions } from '@aspose/3d';Transmite un LoadOptions instanță a subclasei către scene.open(filePath, options) sau scene.openFromBuffer(buffer, options).
SaveOptions
Clasă de bază pentru toate obiectele de opțiuni de salvare.
import { SaveOptions } from '@aspose/3d';Transmite o SaveOptions instanță a subclasei către scene.save(filePath, options).