A3DObject / SceneObject / Entity

A3DObject, SceneObject, Entity — Aspose.3D TypeScript API Reference

חבילה: @aspose/3d (v24.12.0)

שלוש המחלקות האלה מהוות את הבסיס של @aspose/3d היררכיית המחלקות. כל אובייקט ציבורי בספרייה מרחיב בסופו של דבר A3DObject, המספקת את השם ומערכת תכונות דינמית. SceneObject מוסיפה מעקב אחר חברות בסצנה. Entity היא הבסיס לכל האובייקטים שניתן לצרף ל- Node כישות הראשית שלו (meshes, cameras, lights, etc.).

import { A3DObject, SceneObject, Entity } from '@aspose/3d';

A3DObject

מחלקת הבסיס השורשית לכל @aspose/3d אובייקטים. מיישמת INamedObject.

export class A3DObject implements INamedObject

new A3DObject(name?: string)

namestringקריאה/כתיבהשם קריא לבני אדם. ברירת המחדל היא ''.
propertiesPropertyCollectionקריאהאוסף תכונות דינמי. חזור עם for...of או שאילתה לפי שם.

findProperty(propertyName)

החזר את Property עם השם הנתון, או null אם חסר.

findProperty(propertyName: string): Property | null

getProperty(property)

החזר את ערך של נכס בשם, או null אם הנכס אינו קיים.

getProperty(property: string): any

setProperty(property, value)

מגדירה את הערך של מאפיין בשם. יוצרת אותו אם הוא עדיין לא קיים.

setProperty(property: string, value: any): void

removeProperty(property)

הסר נכס בשם או Property מופע מהאוסף.

removeProperty(property: string | Property): boolean

toString()

"ClassName(name)".

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

const scene = new Scene();
const node = scene.rootNode.createChildNode('my_node');

node.setProperty('exportLayer', 2);
console.log(node.getProperty('exportLayer'));   // 2

const prop = node.findProperty('name');
if (prop) {
  console.log(prop.value);       // my_node
  console.log(prop.valueType);   // string
}

for (const p of node.properties) {
  console.log(`${p.name} = ${p.value}`);
}

node.removeProperty('exportLayer');
console.log(node.getProperty('exportLayer'));   // null

SceneObject

A3DObject עם הפנייה לבעל Scene.

export class SceneObject extends A3DObject

A3DObjectSceneObject

מאפיין נוסף

scene`Scenenull`קריאה/כתיבה

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

const scene = new Scene();
const node = scene.rootNode.createChildNode('child');
console.log(node.scene === scene);   // true

בסיס מופשט לכל האובייקטים שניתן לצרף ל- Node כישות הסצנה הראשית שלו. תתי‑מחלקות כוללות Mesh, Camera, Light, וסוגי גיאומטריה.

export class Entity extends SceneObject

A3DObjectSceneObjectEntity

parentNode`Nodeundefined`קריאה/כתיבה
parentNodesNode[]קריאהכל צמתים הורים שמפנים לישות זו (עותק לקריאה בלבד). ברוב הסצנות לישות יש בדיוק הורה אחד.
excludedbooleanקריאה/כתיבה
true, הישות מוחרגת מהצגה וייצוא. ברירת המחדל היא false.

getBoundingBox()

מחזיר את תיבת הגבול המיושרת לציר עבור ישות זו. נזרק בשכבת הבסיס; מיושם על ידי תתי‑מחלקות קונקרטיות כגון Mesh.

getBoundingBox(): BoundingBox

getEntityRendererKey()

מחזיר מפתח רינדור שמזהה את נתיב הרינדור עבור סוג הישות הזה. נזרק חריגה במחלקה הבסיסית; משמש פנימית.

import { Scene, Mesh } from '@aspose/3d';

const scene = new Scene();
const mesh = new Mesh();

// Add control points and a polygon
// ...

const node = scene.rootNode.createChildNode('geo', mesh);

console.log(mesh.parentNode === node);    // true
console.log(mesh.excluded);              // false

// Exclude from next export
mesh.excluded = true;

ראה גם

 עברית