Scene

Inheritance: java.lang.Object, com.aspose.threed.A3DObject, com.aspose.threed.SceneObject

public class Scene extends SceneObject

A scene is a top-level object that contains the nodes, geometries, materials, textures, animation, poses, sub-scenes and etc. Scene can have sub-scenes, acts as multiple-document support in files like collada/blender/fbx Node hierarchy can be accessed through com.aspose.threed.Scene#getRootNode com.aspose.threed.Scene#getLibrary is used to keep a reference of unattached objects during serialization(like meta data or custom objects) so it can be used as a library.

Constructors

Constructor Description
Scene() Initializes a new instance of the com.aspose.threed.Scene class.
Scene(Entity entity) Initializes a new instance of the com.aspose.threed.Scene class with an entity attached to a new node.
Scene(Scene parentScene, String name) Initializes a new instance of the com.aspose.threed.Scene class as a sub-scene.
Scene(String fileName) Initializes a new instance of the com.aspose.threed.Scene class and open the file immediately.

Fields

Field Description
VERSION

Methods

Method Description
getSubScenes() Gets all sub-scenes
getLibrary() Objects that not directly used in scene hierarchy can be defined in Library.
getAnimationClips() Gets all com.aspose.threed.AnimationClip defined in the scene.
getCurrentAnimationClip() Gets the active com.aspose.threed.AnimationClip
setCurrentAnimationClip(AnimationClip value) Sets the active com.aspose.threed.AnimationClip
getAnimationClip(String name) Gets a named com.aspose.threed.AnimationClip
getAssetInfo() Gets the top-level asset information
setAssetInfo(AssetInfo value) Sets the top-level asset information
getPoses() Gets all com.aspose.threed.Pose used in this scene.
getRootNode() Gets the root node of the scene.
clear() Clears the scene content and restores the default settings.
createAnimationClip(String name) A shorthand function to create and register the com.aspose.threed.AnimationClip The first com.aspose.threed.AnimationClip will be assigned to the com.aspose.threed.Scene#getCurrentAnimationClip
open(Stream stream, FileFormat format, Cancellation cancellationToken) Opens the scene from given stream using specified file format.
open(Stream stream, FileFormat format) Opens the scene from given stream using specified file format.
open(Stream stream, LoadOptions options, Cancellation cancellationToken) Opens the scene from given stream using specified IO config.
open(Stream stream, LoadOptions options) Opens the scene from given stream using specified IO config.
open(Stream stream) Opens the scene from given stream
open(Stream stream, Cancellation cancellationToken) Opens the scene from given stream
open(String fileName, FileFormat format, Cancellation cancellationToken) Opens the scene from given path using specified file format.
open(String fileName, FileFormat format) Opens the scene from given path using specified file format.
open(String fileName, LoadOptions options) Opens the scene from given path using specified file format.
open(String fileName, LoadOptions options, Cancellation cancellationToken) Opens the scene from given path using specified file format.
open(String fileName) Opens the scene from given path
open(String fileName, Cancellation cancellationToken) Opens the scene from given path
fromStream(Stream stream, FileFormat format, Cancellation cancellationToken) Opens the scene from given stream using specified file format.
fromStream(Stream stream, FileFormat format) Opens the scene from given stream using specified file format.
fromStream(Stream stream, LoadOptions options, Cancellation cancellationToken) Opens the scene from given stream using specified IO config.
fromStream(Stream stream, LoadOptions options) Opens the scene from given stream using specified IO config.
fromStream(Stream stream, Cancellation cancellationToken) Opens the scene from given stream
fromStream(Stream stream) Opens the scene from given stream
fromFile(String fileName, FileFormat format, Cancellation cancellationToken) Opens the scene from given path using specified file format.
fromFile(String fileName, FileFormat format) Opens the scene from given path using specified file format.
fromFile(String fileName, LoadOptions options, Cancellation cancellationToken) Opens the scene from given path using specified file format.
fromFile(String fileName, LoadOptions options) Opens the scene from given path using specified file format.
fromFile(String fileName) Opens the scene from given path
fromFile(String fileName, Cancellation cancellationToken) Opens the scene from given path
save(Stream stream, FileFormat format) Saves the scene to stream using specified file format.
save(Stream stream, FileFormat format, Cancellation cancellationToken) Saves the scene to stream using specified file format.
save(Stream stream, SaveOptions options) Saves the scene to stream using specified file format.
save(Stream stream, SaveOptions options, Cancellation cancellationToken) Saves the scene to stream using specified file format.
save(String fileName) Saves the scene to specified path using specified file format.
save(String fileName, FileFormat format) Saves the scene to specified path using specified file format.
save(String fileName, FileFormat format, Cancellation cancellationToken) Saves the scene to specified path using specified file format.
save(String fileName, SaveOptions options) Saves the scene to specified path using specified file format.
save(String fileName, SaveOptions options, Cancellation cancellationToken) Saves the scene to specified path using specified file format.
render(Camera camera, String fileName) Render the scene into external file from given camera’s perspective.
render(Camera camera, String fileName, Dimension size, String format) Render the scene into external file from given camera’s perspective.
render(Camera camera, String fileName, Dimension size, String format, ImageRenderOptions options) Render the scene into external file from given camera’s perspective.
render(Camera camera, BufferedImage bitmap) Render the scene into bitmap from given camera’s perspective.
render(Camera camera, BufferedImage bitmap, ImageRenderOptions options) Render the scene into bitmap from given camera’s perspective.

Scene()

public Scene()

Initializes a new instance of the com.aspose.threed.Scene class.

Scene(Entity entity)

public Scene(Entity entity)

Initializes a new instance of the com.aspose.threed.Scene class with an entity attached to a new node.

Parameters:

Parameter Type Description
entity Entity The initial entity that attached to the scene

Scene(Scene parentScene, String name)

public Scene(Scene parentScene, String name)

Initializes a new instance of the com.aspose.threed.Scene class as a sub-scene.

Parameters:

Parameter Type Description
parentScene Scene The parent scene.
name java.lang.String Scene’s name.

Scene(String fileName)

public Scene(String fileName)

Initializes a new instance of the com.aspose.threed.Scene class and open the file immediately. This is an obsoleted constructor, please use com.aspose.threed.Scene.

Parameters:

Parameter Type Description
fileName java.lang.String File’s name to open.

VERSION

public static final String VERSION

getSubScenes()

public List<Scene> getSubScenes()

Gets all sub-scenes

Returns: java.util.List<com.aspose.threed.Scene>

getLibrary()

public List<A3DObject> getLibrary()

Objects that not directly used in scene hierarchy can be defined in Library. This is useful when you’re using sub-scenes and put reusable components under sub-scenes.

Returns: java.util.List<com.aspose.threed.A3DObject>

getAnimationClips()

public List<AnimationClip> getAnimationClips()

Gets all com.aspose.threed.AnimationClip defined in the scene.

Returns: java.util.List<com.aspose.threed.AnimationClip>

getCurrentAnimationClip()

public AnimationClip getCurrentAnimationClip()

Gets the active com.aspose.threed.AnimationClip

Returns: AnimationClip

setCurrentAnimationClip(AnimationClip value)

public void setCurrentAnimationClip(AnimationClip value)

Sets the active com.aspose.threed.AnimationClip

Parameters:

Parameter Type Description
value AnimationClip New value

getAnimationClip(String name)

public AnimationClip getAnimationClip(String name)

Gets a named com.aspose.threed.AnimationClip

Parameters:

Parameter Type Description
name java.lang.String The com.aspose.threed.AnimationClip’s name to look up

Returns: AnimationClip - Returned AnimationClip

getAssetInfo()

public AssetInfo getAssetInfo()

Gets the top-level asset information

Returns: AssetInfo

setAssetInfo(AssetInfo value)

public void setAssetInfo(AssetInfo value)

Sets the top-level asset information

Parameters:

Parameter Type Description
value AssetInfo New value

getPoses()

public Collection<Pose> getPoses()

Gets all com.aspose.threed.Pose used in this scene.

Returns: java.util.Collection<com.aspose.threed.Pose>

getRootNode()

public Node getRootNode()

Gets the root node of the scene.

Returns: Node

clear()

public void clear()

Clears the scene content and restores the default settings.

createAnimationClip(String name)

public AnimationClip createAnimationClip(String name)

A shorthand function to create and register the com.aspose.threed.AnimationClip The first com.aspose.threed.AnimationClip will be assigned to the com.aspose.threed.Scene#getCurrentAnimationClip

Parameters:

Parameter Type Description
name java.lang.String Animation clip’s name

Returns: AnimationClip

open(Stream stream, FileFormat format, Cancellation cancellationToken)

public void open(Stream stream, FileFormat format, Cancellation cancellationToken)

Opens the scene from given stream using specified file format.

Parameters:

Parameter Type Description
stream com.aspose.csporter.helpers.Stream Input stream, user is responsible for closing the stream.
format FileFormat File format.
cancellationToken Cancellation Cancellation token to the load task

open(Stream stream, FileFormat format)

public void open(Stream stream, FileFormat format)

Opens the scene from given stream using specified file format.

Parameters:

Parameter Type Description
stream com.aspose.csporter.helpers.Stream Input stream, user is responsible for closing the stream.
format FileFormat File format.

open(Stream stream, LoadOptions options, Cancellation cancellationToken)

public void open(Stream stream, LoadOptions options, Cancellation cancellationToken)

Opens the scene from given stream using specified IO config.

Parameters:

Parameter Type Description
stream com.aspose.csporter.helpers.Stream Input stream, user is responsible for closing the stream.
options LoadOptions More detailed configuration to open the stream.
cancellationToken Cancellation Cancellation token to the load task

open(Stream stream, LoadOptions options)

public void open(Stream stream, LoadOptions options)

Opens the scene from given stream using specified IO config.

Parameters:

Parameter Type Description
stream com.aspose.csporter.helpers.Stream Input stream, user is responsible for closing the stream.
options LoadOptions More detailed configuration to open the stream.

open(Stream stream)

public void open(Stream stream)

Opens the scene from given stream

Parameters:

Parameter Type Description
stream com.aspose.csporter.helpers.Stream Input stream, user is responsible for closing the stream.

open(Stream stream, Cancellation cancellationToken)

public void open(Stream stream, Cancellation cancellationToken)

Opens the scene from given stream

Parameters:

Parameter Type Description
stream com.aspose.csporter.helpers.Stream Input stream, user is responsible for closing the stream.
cancellationToken Cancellation Cancellation token to the load task

open(String fileName, FileFormat format, Cancellation cancellationToken)

public void open(String fileName, FileFormat format, Cancellation cancellationToken)

Opens the scene from given path using specified file format.

Parameters:

Parameter Type Description
fileName java.lang.String File name.
format FileFormat File format.
cancellationToken Cancellation Cancellation token to the load task

open(String fileName, FileFormat format)

public void open(String fileName, FileFormat format)

Opens the scene from given path using specified file format.

Parameters:

Parameter Type Description
fileName java.lang.String File name.
format FileFormat File format.

open(String fileName, LoadOptions options)

public void open(String fileName, LoadOptions options)

Opens the scene from given path using specified file format.

Parameters:

Parameter Type Description
fileName java.lang.String File name.
options LoadOptions More detailed configuration to open the stream.

open(String fileName, LoadOptions options, Cancellation cancellationToken)

public void open(String fileName, LoadOptions options, Cancellation cancellationToken)

Opens the scene from given path using specified file format.

Parameters:

Parameter Type Description
fileName java.lang.String File name.
options LoadOptions More detailed configuration to open the stream.
cancellationToken Cancellation Cancellation token to the load task

open(String fileName)

public void open(String fileName)

Opens the scene from given path

Parameters:

Parameter Type Description
fileName java.lang.String File name.

open(String fileName, Cancellation cancellationToken)

public void open(String fileName, Cancellation cancellationToken)

Opens the scene from given path

Parameters:

Parameter Type Description
fileName java.lang.String File name.
cancellationToken Cancellation Cancellation token to the load task

fromStream(Stream stream, FileFormat format, Cancellation cancellationToken)

public static Scene fromStream(Stream stream, FileFormat format, Cancellation cancellationToken)

Opens the scene from given stream using specified file format.

Parameters:

Parameter Type Description
stream com.aspose.csporter.helpers.Stream Input stream, user is responsible for closing the stream.
format FileFormat File format.
cancellationToken Cancellation Cancellation token to the load task

Returns: Scene

fromStream(Stream stream, FileFormat format)

public static Scene fromStream(Stream stream, FileFormat format)

Opens the scene from given stream using specified file format.

Parameters:

Parameter Type Description
stream com.aspose.csporter.helpers.Stream Input stream, user is responsible for closing the stream.
format FileFormat File format.

Returns: Scene

fromStream(Stream stream, LoadOptions options, Cancellation cancellationToken)

public static Scene fromStream(Stream stream, LoadOptions options, Cancellation cancellationToken)

Opens the scene from given stream using specified IO config.

Parameters:

Parameter Type Description
stream com.aspose.csporter.helpers.Stream Input stream, user is responsible for closing the stream.
options LoadOptions More detailed configuration to open the stream.
cancellationToken Cancellation Cancellation token to the load task

Returns: Scene

fromStream(Stream stream, LoadOptions options)

public static Scene fromStream(Stream stream, LoadOptions options)

Opens the scene from given stream using specified IO config.

Parameters:

Parameter Type Description
stream com.aspose.csporter.helpers.Stream Input stream, user is responsible for closing the stream.
options LoadOptions More detailed configuration to open the stream.

Returns: Scene

fromStream(Stream stream, Cancellation cancellationToken)

public static Scene fromStream(Stream stream, Cancellation cancellationToken)

Opens the scene from given stream

Parameters:

Parameter Type Description
stream com.aspose.csporter.helpers.Stream Input stream, user is responsible for closing the stream.
cancellationToken Cancellation Cancellation token to the load task

Returns: Scene

fromStream(Stream stream)

public static Scene fromStream(Stream stream)

Opens the scene from given stream

Parameters:

Parameter Type Description
stream com.aspose.csporter.helpers.Stream Input stream, user is responsible for closing the stream.

Returns: Scene

fromFile(String fileName, FileFormat format, Cancellation cancellationToken)

public static Scene fromFile(String fileName, FileFormat format, Cancellation cancellationToken)

Opens the scene from given path using specified file format.

Parameters:

Parameter Type Description
fileName java.lang.String File name.
format FileFormat File format.
cancellationToken Cancellation Cancellation token to the load task

Returns: Scene

fromFile(String fileName, FileFormat format)

public static Scene fromFile(String fileName, FileFormat format)

Opens the scene from given path using specified file format.

Parameters:

Parameter Type Description
fileName java.lang.String File name.
format FileFormat File format.

Returns: Scene

fromFile(String fileName, LoadOptions options, Cancellation cancellationToken)

public static Scene fromFile(String fileName, LoadOptions options, Cancellation cancellationToken)

Opens the scene from given path using specified file format.

Parameters:

Parameter Type Description
fileName java.lang.String File name.
options LoadOptions More detailed configuration to open the stream.
cancellationToken Cancellation Cancellation token to the load task

Returns: Scene

fromFile(String fileName, LoadOptions options)

public static Scene fromFile(String fileName, LoadOptions options)

Opens the scene from given path using specified file format.

Parameters:

Parameter Type Description
fileName java.lang.String File name.
options LoadOptions More detailed configuration to open the stream.

Returns: Scene

fromFile(String fileName)

public static Scene fromFile(String fileName)

Opens the scene from given path

Parameters:

Parameter Type Description
fileName java.lang.String File name.

Returns: Scene

fromFile(String fileName, Cancellation cancellationToken)

public static Scene fromFile(String fileName, Cancellation cancellationToken)

Opens the scene from given path

Parameters:

Parameter Type Description
fileName java.lang.String File name.
cancellationToken Cancellation Cancellation token to the load task

Returns: Scene

save(Stream stream, FileFormat format)

public void save(Stream stream, FileFormat format)

Saves the scene to stream using specified file format.

Parameters:

Parameter Type Description
stream com.aspose.csporter.helpers.Stream Input stream, user is responsible for closing the stream.
format FileFormat Format.

save(Stream stream, FileFormat format, Cancellation cancellationToken)

public void save(Stream stream, FileFormat format, Cancellation cancellationToken)

Saves the scene to stream using specified file format.

Parameters:

Parameter Type Description
stream com.aspose.csporter.helpers.Stream Input stream, user is responsible for closing the stream.
format FileFormat Format.
cancellationToken Cancellation Cancellation token to the save task

save(Stream stream, SaveOptions options)

public void save(Stream stream, SaveOptions options)

Saves the scene to stream using specified file format.

Parameters:

Parameter Type Description
stream com.aspose.csporter.helpers.Stream Input stream, user is responsible for closing the stream.
options SaveOptions More detailed configuration to save the stream.

save(Stream stream, SaveOptions options, Cancellation cancellationToken)

public void save(Stream stream, SaveOptions options, Cancellation cancellationToken)

Saves the scene to stream using specified file format.

Parameters:

Parameter Type Description
stream com.aspose.csporter.helpers.Stream Input stream, user is responsible for closing the stream.
options SaveOptions More detailed configuration to save the stream.
cancellationToken Cancellation Cancellation token to the save task

save(String fileName)

public void save(String fileName)

Saves the scene to specified path using specified file format.

Parameters:

Parameter Type Description
fileName java.lang.String File name.

save(String fileName, FileFormat format)

public void save(String fileName, FileFormat format)

Saves the scene to specified path using specified file format.

Parameters:

Parameter Type Description
fileName java.lang.String File name.
format FileFormat Format.

save(String fileName, FileFormat format, Cancellation cancellationToken)

public void save(String fileName, FileFormat format, Cancellation cancellationToken)

Saves the scene to specified path using specified file format.

Parameters:

Parameter Type Description
fileName java.lang.String File name.
format FileFormat Format.
cancellationToken Cancellation Cancellation token to the save task

save(String fileName, SaveOptions options)

public void save(String fileName, SaveOptions options)

Saves the scene to specified path using specified file format.

Parameters:

Parameter Type Description
fileName java.lang.String File name.
options SaveOptions More detailed configuration to save the stream.

save(String fileName, SaveOptions options, Cancellation cancellationToken)

public void save(String fileName, SaveOptions options, Cancellation cancellationToken)

Saves the scene to specified path using specified file format.

Parameters:

Parameter Type Description
fileName java.lang.String File name.
options SaveOptions More detailed configuration to save the stream.
cancellationToken Cancellation Cancellation token to the save task

render(Camera camera, String fileName)

public void render(Camera camera, String fileName)

Render the scene into external file from given camera’s perspective. The default output size is 1024x768 and output format is png

Parameters:

Parameter Type Description
camera Camera From which camera’s perspective to render the scene
fileName java.lang.String The file name of output file

render(Camera camera, String fileName, Dimension size, String format)

public void render(Camera camera, String fileName, Dimension size, String format)

Render the scene into external file from given camera’s perspective.

Parameters:

Parameter Type Description
camera Camera From which camera’s perspective to render the scene
fileName java.lang.String The file name of output file
size java.awt.Dimension The size of final rendered image
format java.lang.String The image format of the output file

render(Camera camera, String fileName, Dimension size, String format, ImageRenderOptions options)

public void render(Camera camera, String fileName, Dimension size, String format, ImageRenderOptions options)

Render the scene into external file from given camera’s perspective.

Parameters:

Parameter Type Description
camera Camera From which camera’s perspective to render the scene
fileName java.lang.String The file name of output file
size java.awt.Dimension The size of final rendered image
format java.lang.String The image format of the output file
options ImageRenderOptions The option to customize some internal settings.

render(Camera camera, BufferedImage bitmap)

public void render(Camera camera, BufferedImage bitmap)

Render the scene into bitmap from given camera’s perspective.

Parameters:

Parameter Type Description
camera Camera From which camera’s perspective to render the scene
bitmap java.awt.image.BufferedImage Target of the rendered result

render(Camera camera, BufferedImage bitmap, ImageRenderOptions options)

public void render(Camera camera, BufferedImage bitmap, ImageRenderOptions options)

Render the scene into bitmap from given camera’s perspective.

Parameters:

Parameter Type Description
camera Camera From which camera’s perspective to render the scene
bitmap java.awt.image.BufferedImage Target of the rendered result
options ImageRenderOptions The option to customize some internal settings.