Scene
Example
Example Scene class in Aspose.3D služi kao koreni kontejner za 3D sadržaj, upravlja objektima najvišeg nivoa i omogućava upravljanje odnosima roditelj/dete u hijerarhiji scene. Pruža pristup korenskim čvorovima i podscenama, čineći ulaznu tačku za učitavanje, konstruisanje i čuvanje 3D scena.
using Aspose.ThreeD;
// Create an empty scene
var scene = new Scene();
// Access the root node
Node root = scene.RootNode;Example
Example Scene class se može instancirati bez argumenata kako bi se kreirala prazna scena.
using Aspose.ThreeD;
// Empty scene
var scene = new Scene();
// Set name via property
scene.Name = "myScene";
// Access the root node
Node root = scene.RootNode;Example
| 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. |
Example
| 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) |
Example
Kreirajte scenu, dodajte čvor kutije i sačuvajte u 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");