Scene
Phương pháp
Methods Scene class trong Aspose.3D đóng vai trò là container gốc cho nội dung 3D, quản lý các đối tượng cấp cao nhất và cho phép quản lý quan hệ cha/con cho cấu trúc phân cấp cảnh. Nó cung cấp quyền truy cập vào các nút gốc và các cảnh phụ, tạo thành điểm vào để tải, xây dựng và lưu các cảnh 3D.
using Aspose.ThreeD;
// Create an empty scene
var scene = new Scene();
// Access the root node
Node root = scene.RootNode;Phương pháp
Methods Scene class có thể được khởi tạo mà không có đối số nào để tạo một cảnh trống.
using Aspose.ThreeD;
// Empty scene
var scene = new Scene();
// Set name via property
scene.Name = "myScene";
// Access the root node
Node root = scene.RootNode;Phương pháp
| Name | Type | Access | Description |
|---|---|---|---|
SubScenes | IList<Scene> | Read | Gets the sub scenes. |
Library | IList<A3DObject> | Read | Gets the library. |
AnimationClips | IList<AnimationClip> | Read | Gets the animation clips. |
CurrentAnimationClip | AnimationClip? | Read/Write | Gets or sets the current animation clip. |
AssetInfo | AssetInfo? | Read/Write | Gets or sets the asset info. |
Poses | ICollection<Pose> | Read | Gets the poses. |
RootNode | Node | Read | Gets the root node. |
Scene | Scene | Read | Gets the scene. |
Name | string | Read/Write | Gets or sets the name. |
Properties | PropertyCollection | Read | Gets the properties. |
Phương pháp
| Signature | Description |
|---|---|
Scene() | |
Scene(entity: Entity) | |
Scene(parentScene: Scene, name: string) | |
GetAnimationClip(name: string) | Gets a named AnimationClip |
Clear() | Clears the scene content and restores the default settings. |
CreateAnimationClip(name: string) | A shorthand function to create and register the The first AnimationClip will be assigned to the |
Open(stream: Stream, format: FileFormat, cancellationToken: CancellationToken) | Opens the scene from given stream using specified file format. |
Open(stream: Stream, options: LoadOptions, cancellationToken: CancellationToken) | Opens the scene from given stream using specified file format. |
Open(stream: Stream) | Opens the scene from given stream using specified file format. |
Open(stream: Stream, cancellationToken: CancellationToken) | Opens the scene from given stream using specified file format. |
Open(stream: Stream, fileName: string) | Opens the scene from given stream using specified file format. |
Open(stream: Stream, fileName: string, cancellationToken: CancellationToken) | Opens the scene from given stream using specified file format. |
Open(stream: Stream, options: LoadOptions) | Opens the scene from given stream using specified file format. |
Open(fileName: string, format: FileFormat, cancellationToken: CancellationToken) | Opens the scene from given stream using specified file format. |
Open(fileName: string, options: LoadOptions) | Opens the scene from given stream using specified file format. |
Open(fileName: string, options: LoadOptions, cancellationToken: CancellationToken) | Opens the scene from given stream using specified file format. |
Open(fileName: string) | Opens the scene from given stream using specified file format. |
Open(fileName: string, format: FileFormat) | Opens the scene from given stream using specified file format. |
Open(fileName: string, cancellationToken: CancellationToken) | Opens the scene from given stream using specified file format. |
FromStream(stream: Stream, format: FileFormat, cancellationToken: CancellationToken) | Opens the scene from given stream using specified file format. |
FromStream(stream: Stream, options: LoadOptions, cancellationToken: CancellationToken) | Opens the scene from given stream using specified file format. |
FromStream(stream: Stream, cancellationToken: CancellationToken) | Opens the scene from given stream using specified file format. |
FromFile(fileName: string, format: FileFormat, cancellationToken: CancellationToken) | Opens the scene from given path using specified file format. |
FromFile(fileName: string, options: LoadOptions, cancellationToken: CancellationToken) | Opens the scene from given path using specified file format. |
FromFile(fileName: string) | Opens the scene from given path using specified file format. |
FromFile(fileName: string, cancellationToken: CancellationToken) | Opens the scene from given path using specified file format. |
Save(stream: Stream, format: FileFormat) | Saves the scene to stream using specified file format. |
Save(stream: Stream, format: FileFormat, cancellationToken: CancellationToken) | Saves the scene to stream using specified file format. |
Save(stream: Stream, options: SaveOptions) | Saves the scene to stream using specified file format. |
Save(stream: Stream, options: SaveOptions, cancellationToken: CancellationToken) | Saves the scene to stream using specified file format. |
Save(fileName: string, format: FileFormat, cancellationToken: CancellationToken) | Saves the scene to stream using specified file format. |
Save(fileName: string) | Saves the scene to stream using specified file format. |
Save(fileName: string, format: FileFormat) | Saves the scene to stream using specified file format. |
Save(fileName: string, options: SaveOptions) | Saves the scene to stream using specified file format. |
Save(fileName: string, options: SaveOptions, cancellationToken: CancellationToken) | Saves the scene to stream using specified file format. |
Render(camera: Entities.Camera, fileName: string) | Not implemented in the FOSS edition — throws at runtime. Render the scene into external file from given camera’s perspective. The default output size is 1024x768 and output format is png |
Render(camera: Entities.Camera, fileName: string, size: Vector2, format: string) | Not implemented in the FOSS edition — throws at runtime. Render the scene into external file from given camera’s perspective. The default output size is 1024x768 and output format is png |
Render(camera: Entities.Camera, fileName: string, size: Vector2, format: string, options: ImageRenderOptions) | Not implemented in the FOSS edition — throws at runtime. Render the scene into external file from given camera’s perspective. The default output size is 1024x768 and output format is png |
Render(camera: Entities.Camera, bitmap: object) | Not implemented in the FOSS edition — throws at runtime. \u003C/summary> |
Render(camera: Entities.Camera, bitmap: object, options: ImageRenderOptions) | Not implemented in the FOSS edition — throws at runtime. \u003C/summary> |
SceneObject(name: string) | |
A3DObject() | |
RemoveProperty(property: Property) | Removes a dynamic property. |
GetProperty(property: string) | Get the value of specified property |
SetProperty(property: string, value: object?) | Sets the value of specified property |
FindProperty(propertyName: string) | Finds the property. It can be a dynamic property (Created by CreateDynamicProperty/SetProperty) or native property(Identified by its name) |
Phương pháp
Tạo một cảnh, thêm một nút hộp, và lưu dưới dạng GLB:
using Aspose.ThreeD;
using Aspose.ThreeD.Entities;
using Aspose.ThreeD.Formats;
// Create scene with a box primitive
var scene = new Scene();
var box = new Box(2, 2, 2);
var node = scene.RootNode.CreateChildNode("BoxNode", box);
// Save as GLB (format inferred from .glb extension)
scene.Save("box.glb");