A3DObject / SceneObject / Entity

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 INamedObject

Properties

new A3DObject(name?: string)

Properties

PropertiesPropertiesPropertiesProperties
namestringlettura/scritturaNome leggibile dall’uomo. Predefinito a ''.
propertiesPropertyCollectionletturaRaccolta 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 | null

getProperty(property)

Restituisci il valore di una proprietà denominata, o null se la proprietà non esiste.

getProperty(property: string): any

setProperty(property, value)

Imposta il valore di una proprietà nominata. La crea se non esiste già.

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

removeProperty(property)

Rimuovi una proprietà nominata o un Property istanza dalla collezione.

removeProperty(property: string | Property): boolean

toString()

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 A3DObject

Properties

A3DObjectSceneObject

Proprietà aggiuntiva

PropertiesPropertiesPropertiesProperties
scene`Scenenull`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 SceneObject

Properties

A3DObjectSceneObjectEntity

Properties

PropertiesPropertiesPropertiesProperties
parentNode`Nodeundefined`lettura/scrittura
parentNodesNode[]letturaTutti i nodi genitori che fanno riferimento a questa entità (copia sola lettura). Nella maggior parte delle scene un’entità ha esattamente un genitore.
excludedbooleanlettura/scritturaProperties 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(): BoundingBox

getEntityRendererKey()

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;

Vedi anche

 Italiano