A3DObject, SceneObject, Entity — Aspose.3D TypeScript API Reference
Pacchetto: @aspose/3d (v24.12.0)
Queste tre classi costituiscono la base della @aspose/3d gerarchia delle classi. Ogni oggetto pubblico nella libreria estende infine A3DObject, che fornisce il nome e il sistema di proprietà dinamiche. SceneObject aggiunge il tracciamento dell’appartenenza alla scena. Entity è la base per tutti gli oggetti che possono essere collegati a un Node come sua entità primaria (mesh, telecamere, luci, ecc.).
import { A3DObject, SceneObject, Entity } from '@aspose/3d';A3DObject
La classe base radice per tutti i @aspose/3d oggetti. Implementa INamedObject.
export class A3DObject implements INamedObjectProperties
new A3DObject(name?: string)Properties
| Properties | Properties | Properties | Properties |
|---|---|---|---|
name | string | lettura/scrittura | Nome leggibile dall’uomo. Predefinito a ''. |
properties | PropertyCollection | lettura | Raccolta di proprietà dinamiche. Itera con for...of oppure interroga per nome. |
Properties
findProperty(propertyName)
Restituisci il Property con il nome specificato, o null se assente.
findProperty(propertyName: string): Property | nullgetProperty(property)
Restituisci il valore di una proprietà denominata, o null se la proprietà non esiste.
getProperty(property: string): anysetProperty(property, value)
Imposta il valore di una proprietà nominata. La crea se non esiste già.
setProperty(property: string, value: any): voidremoveProperty(property)
Rimuovi una proprietà nominata o un Property istanza dalla collezione.
removeProperty(property: string | Property): booleantoString()
Properties "ClassName(name)".
Properties
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
Properties A3DObject con un riferimento al proprietario Scene.
export class SceneObject extends A3DObjectProperties
A3DObject → SceneObject
Proprietà aggiuntiva
| Properties | Properties | Properties | Properties |
|---|---|---|---|
scene | `Scene | null` | lettura/scrittura |
Properties
import { Scene } from '@aspose/3d';
const scene = new Scene();
const node = scene.rootNode.createChildNode('child');
console.log(node.scene === scene); // true
Properties
Base astratta per tutti gli oggetti che possono essere collegati a un Node come sua entità scena primaria. Le sottoclassi includono Mesh, Camera, Light, e tipi di geometria.
export class Entity extends SceneObjectProperties
A3DObject → SceneObject → Entity
Properties
| Properties | Properties | Properties | Properties |
|---|---|---|---|
parentNode | `Node | undefined` | lettura/scrittura |
parentNodes | Node[] | lettura | Tutti i nodi genitori che fanno riferimento a questa entità (copia sola lettura). Nella maggior parte delle scene un’entità ha esattamente un genitore. |
excluded | boolean | lettura/scrittura | Properties true, l’entità è esclusa dalla resa e dall’esportazione. Il valore predefinito è false. |
Properties
getBoundingBox()
Restituisce l’axis-aligned bounding box per questa entità. Lancia un’eccezione nella classe base; implementato dalle sottoclassi concrete come Mesh.
getBoundingBox(): BoundingBoxgetEntityRendererKey()
Restituisce una renderer key che identifica il percorso di rendering per questo tipo di entità. Lancia un’eccezione nella classe base; usata internamente.
Properties
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;