Class Scene
패키지: @aspose/3d (v24.12.0)
Scene은 3D 씬 그래프의 루트 컨테이너입니다. @aspose/3d. 노드 계층 구조, 메타데이터 및 애니메이션 클립을 보유하며, 3D 파일을 로드하고 저장하기 위한 기본 I/O 인터페이스를 제공합니다.
export class Scene extends SceneObjectColladaSaveOptions
A3DObject ← SceneObject ← Scene
ColladaSaveOptions
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}`);ColladaSaveOptions
| ColladaSaveOptions | ColladaSaveOptions | ColladaSaveOptions |
|---|---|---|
rootNode | Node | 씬 그래프의 루트 노드입니다. 모든 기하학, 조명, 카메라 및 기타 객체가 이 노드 아래에 연결됩니다. |
assetInfo | AssetInfo | 자산에 대한 메타데이터로, 제작자, 생성 시간, 단위 정보 및 좌표계가 포함됩니다. |
animationClips | AnimationClip[] | 씬에 정의된 애니메이션 클립의 컬렉션입니다. 각 클립은 노드와 해당 속성에 대한 애니메이션 커브를 포함합니다. |
subScenes | Scene[] | 이 씬에 포함된 서브 씬입니다. 씬 계층 구조를 지원하는 FBX와 같은 포맷에서 사용됩니다. 참고: 이 속성은 현재 API 표면에서 확인되지 않았으며 사용 가능하지 않을 수 있습니다. |
ColladaSaveOptions
open(fileOrStream, options?)
파일 경로 또는 Buffer 씬에 로드하여 기존 콘텐츠를 교체합니다.
open(fileOrStream: string | Buffer, options?: LoadOptions): voidColladaSaveOptions
fileOrStream string | Buffer
소스 파일 경로 또는 Buffer 원시 파일 데이터를 포함하는.
options LoadOptions (옵션)
포맷별 로드 옵션. Pass undefined 기본값을 사용하려면.
ColladaSaveOptions
void
ColladaSaveOptions
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?)
메모리 내에서 3D 파일을 로드합니다 Buffer. 파일 데이터가 이미 메모리로 읽혀진 경우 선호되는 오버로드입니다.
openFromBuffer(buffer: Buffer, options?: LoadOptions): voidColladaSaveOptions
buffer Buffer
Node.js Buffer 전체 파일 내용을 포함합니다.
options LoadOptions (옵션)
포맷별 로드 옵션.
ColladaSaveOptions
void
ColladaSaveOptions
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 싱글톤) 을 두 번째 인수로 전달합니다.
save(fileOrStream: string, formatOrOptions?: FileFormat | SaveOptions, options?: SaveOptions): voidColladaSaveOptions
fileOrStream string
대상 파일 경로입니다. 확장자는 출력 형식을 결정합니다(예,., .glb → GLB, .gltf → glTF JSON, .stl → STL).
formatOrOptions FileFormat | SaveOptions (옵션)
형식 싱글톤 중 하나(예,., GltfFormat.getInstance()) SaveOptions 서브클래스.
options SaveOptions (옵션)
특정 형식에 대한 저장 옵션 when a FileFormat 두 번째 인수로 전달될 때.
ColladaSaveOptions
void
ColladaSaveOptions
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): AnimationClipColladaSaveOptions
name string
Vector2 및 Vector4 — @aspose/3d에서 UV 좌표와 동차 위치에 사용되는 2·4 구성 요소의 배정밀도 벡터.
ColladaSaveOptions
AnimationClip
새로 생성된 AnimationClip 인스턴스.
ColladaSaveOptions
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}`);