Class Scene

パッケージ: @aspose/3d (v24.12.0)

Scene は 3D シーン グラフのルート コンテナです @aspose/3d. ノード階層、メタデータ、アニメーションクリップを保持し、3D ファイルの読み込みと保存のための主要な I/O インターフェースを提供します。.

export class Scene extends SceneObject

BoundingBoxExtent

A3DObject ← SceneObject ← Scene

BoundingBoxExtent

OBJ ファイルを読み込み、シーン グラフのルートにある子ノードの数を出力します。.

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

const scene = new Scene();
scene.open('model.obj');

function countNodes(node: any): number {
  let total = 1;
  for (const child of node.childNodes) {
    total += countNodes(child);
  }
  return total;
}

const nodeCount = countNodes(scene.rootNode);
console.log(`Total nodes in scene: ${nodeCount}`);

BoundingBoxExtent

BoundingBoxExtentBoundingBoxExtentBoundingBoxExtent
rootNodeNodeシーン グラフのルート ノードです。すべてのジオメトリ、ライト、カメラ、およびその他のオブジェクトはこのノードの下に接続されます。.
assetInfoAssetInfoアセットに関するメタデータで、作成者、作成時刻、単位情報、座標系などが含まれます。.
animationClipsAnimationClip[]シーンで定義されたアニメーションクリップのコレクションです。各クリップはノードとそのプロパティのアニメーション カーブを含みます。.
subScenesScene[]このシーンに埋め込まれたサブシーンです。シーン階層をサポートする FBX などのフォーマットで使用されます。. 注: このプロパティは現在の API では確認されておらず、利用できない可能性があります。.

BoundingBoxExtent

open(fileOrStream, options?)

ファイルパスまたは a から 3D ファイルをロードします Buffer シーンにロードし、既存のコンテンツをすべて置き換えます。.

open(fileOrStream: string | Buffer, options?: LoadOptions): void

BoundingBoxExtent

fileOrStream string | Buffer

ソースファイルへのパス、または a Buffer 生のファイルデータを含むもの。.

options LoadOptions (オプション)

フォーマット固有のロードオプション。Pass undefined デフォルトを使用するには.

BoundingBoxExtent

void

BoundingBoxExtent

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

const scene = new Scene();
scene.open('input.fbx');
console.log(`Loaded scene with root node: ${scene.rootNode.name}`);

openFromBuffer(buffer, options?)

in-memory から 3D ファイルをロードします Buffer.。ファイルデータがすでにメモリに読み込まれている場合の、推奨されるオーバーロードです。.

openFromBuffer(buffer: Buffer, options?: LoadOptions): void

BoundingBoxExtent

buffer Buffer

Node.js Buffer 完全なファイル内容を含む。.

options LoadOptions (オプション)

フォーマット固有のロードオプション。.

BoundingBoxExtent

void

BoundingBoxExtent

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

const data = readFileSync('model.glb');
const scene = new Scene();
scene.openFromBuffer(data);
console.log(`Animation clips: ${scene.animationClips.length}`);

save(fileOrStream, formatOrOptions?, options?)

シーンをファイルに保存します。形式はファイル拡張子から推測されますが、フォーマット固有の SaveOptions インスタンス(または FileFormat シングルトン)を第2引数として渡すことができます。.

save(fileOrStream: string, formatOrOptions?: FileFormat | SaveOptions, options?: SaveOptions): void

BoundingBoxExtent

fileOrStream string

出力先ファイルパス。拡張子が出力形式を決定します(例:., .glb → GLB, .gltf → glTF JSON、, .stl → STL).

formatOrOptions FileFormat | SaveOptions (任意)

フォーマットシングルトン(例,., GltfFormat.getInstance()) SaveOptions サブクラス。.

options SaveOptions (任意)

フォーマット固有の保存オプションは、 FileFormat が2番目の引数として渡された場合。.

BoundingBoxExtent

void

BoundingBoxExtent

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

const scene = new Scene();
scene.open('input.obj');

// Format inferred from extension
scene.save('output.glb');
console.log('Scene saved as GLB.');

createAnimationClip(name)

新しい名前付きアニメーションクリップを作成し、シーンの animationClips コレクション。.

createAnimationClip(name: string): AnimationClip

BoundingBoxExtent

name string

Vector2 と Vector4 — @aspose/3d で UV 座標および同次座標に使用される、倍精度の 2 成分および 4 成分ベクトル.

BoundingBoxExtent

AnimationClip

新しく作成された AnimationClip インスタンス。.

BoundingBoxExtent

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

const scene = new Scene();
const clip = scene.createAnimationClip('WalkCycle');
console.log(`Created clip: ${clip.name}`);
console.log(`Total clips: ${scene.animationClips.length}`);
 日本語