الحزمة: @aspose/3d (v24.12.0) اللغة: TypeScript / Node.js 18+ الترخيص: MIT
@aspose/3d هي مكتبة مرخصة بموجب MIT لقراءة وبناء وتصدير المشاهد ثلاثية الأبعاد في Node.js. تأتي مع تعريفات نوع TypeScript كاملة، واعتماد تشغيل واحد ( «<SEG_7»> )، وتدعم سبعة صيغ ملفات ثلاثية الأبعاد رئيسية. جميع عمليات الإدخال/الإخراج متزامنة. لا يلزم أي إضافات أصلية.xmldom),.
Enumerations
Enumerations tsconfig.json إعدادات لتصحيح حل المسار الفرعي:
تمثل الفئتان Comment و CommentAuthor تعليقات الشرائح ومؤلفيها. تقوم بتنفيذ IComment و ICommentAuthor على التوالي.
Enumerations
الحاوية الجذرية لمشهد ثلاثي الأبعاد. جميع المحتويات؛ العقد، الهندسة، المواد، والرسوم المتحركة؛ تُخزن في شجرة جذورها في scene.rootNode. استخدم open() / openFromBuffer() لتحميل ملف و save() / saveToBuffer() للتصدير.
| Enumerations | Enumerations | Enumerations |
|---|
rootNode | Node | جذر مخطط المشهد |
assetInfo | AssetInfo | بيانات ملف التعريف (المُنشئ، الوحدات، نظام الإحداثيات) |
animationClips | AnimationClip[] | جميع مقاطع الرسوم المتحركة في المشهد |
open(path, opts?) | (string, LoadOptions?) → void | تحميل ملف من القرص |
openFromBuffer(buf, opts?) | (Buffer, LoadOptions?) → void | تحميل من المخزن المؤقت في الذاكرة |
save(path, opts?) | (string, SaveOptions?) → void | حفظ إلى القرص (يتم استنتاج الصيغة من الامتداد) |
saveToBuffer(ext, opts?) | (string, SaveOptions?) → Buffer | حفظ إلى المخزن المؤقت في الذاكرة |
createAnimationClip(name) | (string) → AnimationClip | إنشاء وتسجيل مقطع رسوم متحركة جديد |
Enumerations
عُقْدَة شجرة مسماة في رسم المشهد. العقد تحمل خيارًا اختياريًا Entity (mesh, camera, light) و Transform الذي يضع العقدة بالنسبة إلى العنصر الأب.
| Enumerations | Enumerations | Enumerations |
|---|
name | string | اسم العقدة |
childNodes | Node[] | العقد الفرعية المباشرة |
entity | `Entity | null` |
transform | Transform | الإزاحة المحلية، الدوران، المقياس |
materials | Material[] | المواد المعيّنة لهذه العقدة |
createChildNode(name) | (string) → Node | إضافة عقدة فرعية |
getChildNode(name) | `(string) → Node | null` |
Enumerations
شبكة مضلعات؛ نوع الهندسة الأساسي. يمتد Geometry.
| Enumerations | Enumerations | Enumerations |
|---|
controlPoints | Vector4[] | مواقع الرؤوس (w=1 للمواقع) |
polygonCount | number | عدد المضلعات |
createPolygon(indices) | (number[]) → void | إضافة مضلع (مثلث أو رباعي) |
getElement(type) | `(VertexElementType) → VertexElement | null` |
createElement(type) | (VertexElementType) → VertexElement | إنشاء عنصر رأس |
Enumerations
تحويل محلي يُطبق على عقدة.
| Enumerations | Enumerations | Enumerations |
|---|
translation | Vector3 | الموضع المحلي |
eulerAngles | Vector3 | دوران أويلر بالدرجات (ترتيب XYZ) |
rotation | Quaternion | الدوران ككواترنيون |
scaling | Vector3 | المقياس المحلي |
فئات المواد
| Enumerations | Enumerations | الخصائص الأساسية |
|---|
LambertMaterial | تظليل الانتشار + الإضاءة المحيطة | diffuseColor, ambientColor, transparency |
PhongMaterial | يضيف اللمعان + الانبعاث إلى لامبرت | specularColor, shininess, emissiveColor |
PbrMaterial | مستند إلى الفيزياء لـ glTF 2.0 | albedo, metallicFactor, roughnessFactor, emissiveColor |
فئات الرياضيات
| Enumerations | Enumerations |
|---|
Vector3 | 3-component double-precision vector (x, y, z) |
Vector4 | 4-component vector for homogeneous math (x, y, z, w) |
FVector3 | متغيّر بدقة مفردة يُستخدم في بيانات الرؤوس |
Matrix4 | 4×4 transformation matrix; multiply, invert, decompose |
Quaternion | كواترن الدوران; fromEulerAngle, toEulerAngles, slerp |
BoundingBox | صندوق احتواء محاذى للمحاور; minimum, maximum, center, size, merge |
فئات الرسوم المتحركة
| Enumerations | Enumerations |
|---|
AnimationClip | مقطع مسمى; يحتوي على AnimationNode قائمة; يتم الوصول إليها عبر scene.animationClips |
AnimationNode | يربط مقطعًا بعقدة مشهد مسماة; يحتوي على AnimationChannel قائمة |
AnimationChannel | يستهدف خاصية واحدة (مثل translation X)؛ يحتوي على KeyframeSequence |
KeyframeSequence | قائمة مرتبة من KeyFrame كائنات مع interpolation و extrapolation |
KeyFrame | زوج وقت/قيمة واحد |
Enumerations
| Enumerations | Enumerations | Enumerations |
|---|
VertexElementType | NORMAL, UV, VERTEX_COLOR, BINORMAL, TANGENT | دلالة عنصر القمة |
MappingMode | CONTROL_POINT, POLYGON_VERTEX, POLYGON, ALL_SAME | كيفية ربط البيانات بالهندسة |
ReferenceMode | DIRECT, INDEX, INDEX_TO_DIRECT | استراتيجية الفهرسة لبيانات عنصر القمة |
Interpolation | CONSTANT, LINEAR, BEZIER | استيفاء الإطارات المفتاحية |
Extrapolation | CONSTANT, GRADIENT, CYCLE, CYCLE_RELATIVE, OSCILLATE | السلوك خارج نطاق الإطارات المفتاحية |
وحدات الصيغ
فئات الخيارات الخاصة بكل صيغة يتم تصديرها من وحدات المسارات الفرعية. استوردها بشكل منفصل:
وحدة OBJ (@aspose/3d/formats/obj)
| Enumerations | الخيارات الرئيسية |
|---|
ObjLoadOptions | enableMaterials, flipCoordinateSystem, scale, normalizeNormal |
وحدة glTF/GLB (@aspose/3d/formats/gltf)
| Enumerations | الخيارات الرئيسية |
|---|
GltfSaveOptions | binaryMode (true → .glb)،, flipTexCoordV |
GltfFormat | GltfFormat.getInstance(): مثيل التنسيق لـ scene.save() |
وحدة STL (@aspose/3d/formats/stl)
| Enumerations | الخيارات الرئيسية |
|---|
StlLoadOptions | N/A |
StlSaveOptions | binaryMode (false → ASCII، true → binary) |
وحدة FBX (@aspose/3d/formats/fbx)
| Enumerations | الخيارات الرئيسية |
|---|
FbxLoadOptions | N/A |
FbxSaveOptions | embedTextures |
الصيغ المدعومة
| Enumerations | Enumerations | Enumerations | Enumerations |
|---|
| Enumerations | .obj | Enumerations | Enumerations |
| glTF 2.0 | .gltf | Enumerations | Enumerations |
| Enumerations | .glb | Enumerations | Enumerations |
| STL | .stl | Enumerations | Enumerations |
| FBX | .fbx | لا* | لا* |
| COLLADA | .dae | Enumerations | Enumerations |
| 3MF | .3mf | Enumerations | Enumerations |
مثال مرجعي سريع
انظر أيضًا