Paket: @aspose/3d (v24.12.0) Sprache: TypeScript / Node.js 18+ Lizenz: MIT
@aspose/3d ist eine MIT-lizenzierte Bibliothek zum Lesen, Erstellen und Exportieren von 3D‑Szenen in Node.js. Sie wird mit vollständigen TypeScript‑Typdefinitionen, einer einzigen Laufzeitabhängigkeit («<SEG_7»> ), und unterstützt sieben gängige 3D‑Dateiformate. Alle Ein‑/Ausgaben sind synchron. Es werden keine nativen Add‑Ons benötigt.xmldom), und unterstützt sieben gängige 3D‑Dateiformate. Alle Ein‑/Ausgaben sind synchron. Es werden keine nativen Add‑Ons benötigt.
Properties
Properties tsconfig.json Einstellungen für die korrekte Auflösung von Unterpfaden:
Die Klasse Shape stellt interne Methoden zur Arbeit mit Platzhaltern bereit:
Properties
Der Wurzelcontainer für eine 3D‑Szene. Alle Inhalte; Knoten, Geometrie, Materialien und Animationen; werden in einem Baum gespeichert, dessen Wurzel bei scene.rootNode.Verwenden Sie open() / openFromBuffer() um eine Datei zu laden und save() / saveToBuffer() zu exportieren.
| Properties | Properties | Properties |
|---|
rootNode | Node | Wurzel des Szenengraphen |
assetInfo | AssetInfo | Dateimetadaten (Ersteller, Einheiten, Koordinatensystem) |
animationClips | AnimationClip[] | Alle Animationsclips in der Szene |
open(path, opts?) | (string, LoadOptions?) → void | Lade eine Datei von der Festplatte |
openFromBuffer(buf, opts?) | (Buffer, LoadOptions?) → void | Lade aus dem In-Memory-Puffer |
save(path, opts?) | (string, SaveOptions?) → void | Speichere auf die Festplatte (Format wird aus der Erweiterung abgeleitet) |
saveToBuffer(ext, opts?) | (string, SaveOptions?) → Buffer | Speichere in den In-Memory-Puffer |
createAnimationClip(name) | (string) → AnimationClip | Erstelle und registriere einen neuen Animationsclip |
Properties
Ein benannter Baumknoten im Szenengraphen. Knoten tragen optional ein Entity (Mesh, Kamera, Licht) und ein Transform die den Knoten relativ zu seinem Elternteil positioniert.
| Properties | Properties | Properties |
|---|
name | string | Knotenname |
childNodes | Node[] | Direkte Kindknoten |
entity | `Entity | null` |
transform | Transform | Lokale Translation, Rotation, Skalierung |
materials | Material[] | Dem Knoten zugewiesene Materialien |
createChildNode(name) | (string) → Node | Kindknoten hinzufügen |
getChildNode(name) | `(string) → Node | null` |
Properties
Polygonnetz; der primäre Geometrietyp. Erweitert Geometry.
| Properties | Properties | Properties |
|---|
controlPoints | Vector4[] | Scheitelpunktpositionen (w=1 für Positionen) |
polygonCount | number | Anzahl der Polygone |
createPolygon(indices) | (number[]) → void | Polygon hinzufügen (Dreieck oder Viereck) |
getElement(type) | `(VertexElementType) → VertexElement | null` |
createElement(type) | (VertexElementType) → VertexElement | Vertex-Element erstellen |
Properties
Lokale Transformation, die auf einen Knoten angewendet wird.
| Properties | Properties | Properties |
|---|
translation | Vector3 | Lokale Position |
eulerAngles | Vector3 | Euler-Rotation in Grad (XYZ-Reihenfolge) |
rotation | Quaternion | Rotation als Quaternion |
scaling | Vector3 | Lokale Skalierung |
Materialklassen
| Properties | Properties | Wichtige Eigenschaften |
|---|
LambertMaterial | Diffuse + Umgebungsbeleuchtung | diffuseColor, ambientColor, transparency |
PhongMaterial | Fügt zu Lambert spekulare + emittierende Komponenten hinzu | specularColor, shininess, emissiveColor |
PbrMaterial | Physikbasiert für glTF 2.0 | albedo, metallicFactor, roughnessFactor, emissiveColor |
Mathematikklassen
| Properties | Properties |
|---|
Vector3 | 3-component double-precision vector (x, y, z) |
Vector4 | 4-component vector for homogeneous math (x, y, z, w) |
FVector3 | Single-precision-Variante, die in Vertex-Daten verwendet wird |
Matrix4 | 4×4 transformation matrix; multiply, invert, decompose |
Quaternion | Rotations-Quaternion; fromEulerAngle, toEulerAngles, slerp |
BoundingBox | Achsenorientierte Bounding-Box; minimum, maximum, center, size, merge |
Animationsklassen
| Properties | Properties |
|---|
AnimationClip | Benannter Clip; enthält AnimationNode Liste; zugegriffen über scene.animationClips |
AnimationNode | Bindet einen Clip an einen benannten Szenenknoten; enthält AnimationChannel Liste |
AnimationChannel | Zielt auf eine einzelne Eigenschaft (z. B. Translation X); hält ein KeyframeSequence |
KeyframeSequence | Geordnete Liste von KeyFrame Objekten mit interpolation und extrapolation |
KeyFrame | Einzelnes Zeit/Wert-Paar |
Properties
| Properties | Properties | Properties |
|---|
VertexElementType | NORMAL, UV, VERTEX_COLOR, BINORMAL, TANGENT | Vertex-Element-Semantik |
MappingMode | CONTROL_POINT, POLYGON_VERTEX, POLYGON, ALL_SAME | Wie Daten auf Geometrie abgebildet werden |
ReferenceMode | DIRECT, INDEX, INDEX_TO_DIRECT | Indexierungsstrategie für Vertex-Element-Daten |
Interpolation | CONSTANT, LINEAR, BEZIER | Keyframe-Interpolation |
Extrapolation | CONSTANT, GRADIENT, CYCLE, CYCLE_RELATIVE, OSCILLATE | Verhalten außerhalb des Keyframe-Bereichs |
Formatmodule
Format‑spezifische Optionsklassen werden aus Sub‑Pfad‑Modulen exportiert. Importieren Sie sie separat:
OBJ-Modul (@aspose/3d/formats/obj)
| Properties | Schlüsseloptionen |
|---|
ObjLoadOptions | enableMaterials, flipCoordinateSystem, scale, normalizeNormal |
glTF/GLB-Modul (@aspose/3d/formats/gltf)
| Properties | Schlüsseloptionen |
|---|
GltfSaveOptions | binaryMode (true → .glb), flipTexCoordV |
GltfFormat | GltfFormat.getInstance():Formatinstanz für scene.save() |
STL-Modul (@aspose/3d/formats/stl)
| Properties | Schlüsseloptionen |
|---|
StlLoadOptions | N/A |
StlSaveOptions | binaryMode (false → ASCII, true → binär) |
FBX-Modul (@aspose/3d/formats/fbx)
| Properties | Schlüsseloptionen |
|---|
FbxLoadOptions | N/A |
FbxSaveOptions | embedTextures |
Unterstützte Formate
| Properties | Properties | Properties | Properties |
|---|
| Properties | .obj | Properties | Properties |
| glTF 2.0 | .gltf | Properties | Properties |
| Properties | .glb | Properties | Properties |
| STL | .stl | Properties | Properties |
| FBX | .fbx | Nein* | Nein* |
| COLLADA | .dae | Properties | Properties |
| 3MF | .3mf | Properties | Properties |
Kurzreferenzbeispiel
Siehe auch