Package com.aspose.threed
Class Scene
- java.lang.Object
-
- com.aspose.threed.A3DObject
-
- com.aspose.threed.Scene
-
public class Scene extends A3DObject
A scene is a top-level object that contains the nodes, geometries, materials, textures, animation, poses, sub-scenes and etcs. Scene can have sub-scenes, acts as multiple-document support in files like collada/blender/fbx Node hierarchy can be accessed throughgetRootNode()
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.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
VERSION
-
Constructor Summary
Constructors Constructor Description Scene()
Initializes a new instance of theScene
class.Scene(Scene parentScene, java.lang.String name)
Initializes a new instance of theScene
class as a sub-scene.Scene(java.lang.String fileName)
Initializes a new instance of theScene
class and open the file immediately.
-
Method Summary
Modifier and Type Method Description void
clear()
Clears the scene content and restores the default settings.AnimationClip
createAnimationClip(java.lang.String name)
A shorthand function to create and register theAnimationClip
The firstAnimationClip
will be assigned to thegetCurrentAnimationClip()
AnimationClip
getAnimationClip(java.lang.String name)
Gets a namedAnimationClip
java.util.List<AnimationClip>
getAnimationClips()
Gets allAnimationClip
defined in the scene.AssetInfo
getAssetInfo()
Gets the top-level asset informationAnimationClip
getCurrentAnimationClip()
Gets the activeAnimationClip
java.util.List<A3DObject>
getLibrary()
Objects that not directly used in scene hierarchy can be defined in Library.java.util.Collection<Pose>
getPoses()
Gets allPose
used in this scene.Node
getRootNode()
Gets the root node of the scene.java.util.List<Scene>
getSubScenes()
Gets all sub-scenesvoid
open(com.aspose.csporter.helpers.Stream stream)
Opens the scene from given streamvoid
open(com.aspose.csporter.helpers.Stream stream, Cancellation cancellationToken)
Opens the scene from given streamvoid
open(com.aspose.csporter.helpers.Stream stream, FileFormat format)
Opens the scene from given stream using specified file format.void
open(com.aspose.csporter.helpers.Stream stream, FileFormat format, Cancellation cancellationToken)
Opens the scene from given stream using specified file format.void
open(com.aspose.csporter.helpers.Stream stream, LoadOptions options)
Opens the scene from given stream using specified IO config.void
open(com.aspose.csporter.helpers.Stream stream, LoadOptions options, Cancellation cancellationToken)
Opens the scene from given stream using specified IO config.void
open(java.lang.String fileName)
Opens the scene from given pathvoid
open(java.lang.String fileName, Cancellation cancellationToken)
Opens the scene from given pathvoid
open(java.lang.String fileName, FileFormat format)
Opens the scene from given path using specified file format.void
open(java.lang.String fileName, FileFormat format, Cancellation cancellationToken)
Opens the scene from given path using specified file format.void
open(java.lang.String fileName, LoadOptions options)
Opens the scene from given path using specified file format.void
open(java.lang.String fileName, LoadOptions options, Cancellation cancellationToken)
Opens the scene from given path using specified file format.protected void
reloadSceneAs(FileFormat fmt)
Reload the scene in specified formatvoid
render(Camera camera, java.awt.image.BufferedImage bitmap)
Render the scene into bitmap from given camera's perspective.void
render(Camera camera, java.awt.image.BufferedImage bitmap, ImageRenderOptions options)
Render the scene into bitmap from given camera's perspective.void
render(Camera camera, java.lang.String fileName, java.awt.Dimension size, java.lang.String format)
Render the scene into external file from given camera's perspective.void
render(Camera camera, java.lang.String fileName, java.awt.Dimension size, java.lang.String format, ImageRenderOptions options)
Render the scene into external file from given camera's perspective.void
save(com.aspose.csporter.helpers.Stream stream, FileFormat format)
Saves the scene to stream using specified file format.void
save(com.aspose.csporter.helpers.Stream stream, FileFormat format, Cancellation cancellationToken)
Saves the scene to stream using specified file format.void
save(com.aspose.csporter.helpers.Stream stream, SaveOptions options)
Saves the scene to stream using specified file format.void
save(com.aspose.csporter.helpers.Stream stream, SaveOptions options, Cancellation cancellationToken)
Saves the scene to stream using specified file format.void
save(java.lang.String fileName, FileFormat format)
Saves the scene to specified path using specified file format.void
save(java.lang.String fileName, FileFormat format, Cancellation cancellationToken)
Saves the scene to specified path using specified file format.void
save(java.lang.String fileName, SaveOptions options)
Saves the scene to specified path using specified file format.void
save(java.lang.String fileName, SaveOptions options, Cancellation cancellationToken)
Saves the scene to specified path using specified file format.void
setAssetInfo(AssetInfo value)
Sets the top-level asset informationvoid
setCurrentAnimationClip(AnimationClip value)
Sets the activeAnimationClip
-
Methods inherited from class com.aspose.threed.A3DObject
findProperty, getName, getProperty, removeProperty, removeProperty, setName, setProperty
-
-
-
-
Field Detail
-
VERSION
public static final java.lang.String VERSION
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Scene
public Scene()
Initializes a new instance of theScene
class.
-
Scene
public Scene(Scene parentScene, java.lang.String name)
Initializes a new instance of theScene
class as a sub-scene.- Parameters:
parentScene
- The parent scene.name
- Scene's name.
-
Scene
public Scene(java.lang.String fileName) throws java.io.IOException
Initializes a new instance of theScene
class and open the file immediately.- Parameters:
fileName
- File's name to open.- Throws:
java.io.IOException
-
-
Method Detail
-
getSubScenes
public java.util.List<Scene> getSubScenes()
Gets all sub-scenes
-
getLibrary
public java.util.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.
-
getAnimationClips
public java.util.List<AnimationClip> getAnimationClips()
Gets allAnimationClip
defined in the scene.
-
getCurrentAnimationClip
public AnimationClip getCurrentAnimationClip()
Gets the activeAnimationClip
-
setCurrentAnimationClip
public void setCurrentAnimationClip(AnimationClip value)
Sets the activeAnimationClip
- Parameters:
value
- New value
-
getAnimationClip
public AnimationClip getAnimationClip(java.lang.String name)
Gets a namedAnimationClip
- Parameters:
name
- TheAnimationClip
's name to look up- Returns:
- Returned AnimationClip
-
getAssetInfo
public AssetInfo getAssetInfo()
Gets the top-level asset information
-
setAssetInfo
public void setAssetInfo(AssetInfo value)
Sets the top-level asset information- Parameters:
value
- New value
-
getRootNode
public Node getRootNode()
Gets the root node of the scene.
-
clear
public void clear()
Clears the scene content and restores the default settings.
-
createAnimationClip
public AnimationClip createAnimationClip(java.lang.String name)
A shorthand function to create and register theAnimationClip
The firstAnimationClip
will be assigned to thegetCurrentAnimationClip()
- Parameters:
name
- Animation clip's name
-
render
public void render(Camera camera, java.lang.String fileName, java.awt.Dimension size, java.lang.String format) throws java.io.IOException
Render the scene into external file from given camera's perspective.- Parameters:
camera
- From which camera's perspective to render the scenefileName
- The file name of output filesize
- The size of final rendered imageformat
- The image format of the output file- Throws:
java.io.IOException
-
render
public void render(Camera camera, java.lang.String fileName, java.awt.Dimension size, java.lang.String format, ImageRenderOptions options) throws java.io.IOException
Render the scene into external file from given camera's perspective.- Parameters:
camera
- From which camera's perspective to render the scenefileName
- The file name of output filesize
- The size of final rendered imageformat
- The image format of the output fileoptions
- The option to customize some internal settings.- Throws:
java.io.IOException
-
render
public void render(Camera camera, java.awt.image.BufferedImage bitmap) throws java.io.IOException
Render the scene into bitmap from given camera's perspective.- Parameters:
camera
- From which camera's perspective to render the scenebitmap
- Target of the rendered result- Throws:
java.io.IOException
-
render
public void render(Camera camera, java.awt.image.BufferedImage bitmap, ImageRenderOptions options) throws java.io.IOException
Render the scene into bitmap from given camera's perspective.- Parameters:
camera
- From which camera's perspective to render the scenebitmap
- Target of the rendered resultoptions
- The option to customize some internal settings.- Throws:
java.io.IOException
-
reloadSceneAs
protected void reloadSceneAs(FileFormat fmt) throws java.io.IOException
Reload the scene in specified format- Parameters:
fmt
-- Throws:
java.io.IOException
-
open
public void open(com.aspose.csporter.helpers.Stream stream, FileFormat format, Cancellation cancellationToken) throws ImportException
Opens the scene from given stream using specified file format.- Parameters:
stream
- Input stream, user is responsible for closing the stream.format
- File format.cancellationToken
- Cancellation token to the load task- Throws:
ImportException
-
open
public void open(com.aspose.csporter.helpers.Stream stream, FileFormat format) throws ImportException
Opens the scene from given stream using specified file format.- Parameters:
stream
- Input stream, user is responsible for closing the stream.format
- File format.- Throws:
ImportException
-
open
public void open(com.aspose.csporter.helpers.Stream stream, LoadOptions options, Cancellation cancellationToken) throws ImportException
Opens the scene from given stream using specified IO config.- Parameters:
stream
- Input stream, user is responsible for closing the stream.options
- More detailed configuration to open the stream.cancellationToken
- Cancellation token to the load task- Throws:
ImportException
-
open
public void open(com.aspose.csporter.helpers.Stream stream, LoadOptions options) throws ImportException
Opens the scene from given stream using specified IO config.- Parameters:
stream
- Input stream, user is responsible for closing the stream.options
- More detailed configuration to open the stream.- Throws:
ImportException
-
open
public void open(com.aspose.csporter.helpers.Stream stream, Cancellation cancellationToken) throws java.io.IOException
Opens the scene from given stream- Parameters:
stream
- Input stream, user is responsible for closing the stream.cancellationToken
- Cancellation token to the load task- Throws:
java.io.IOException
-
open
public void open(com.aspose.csporter.helpers.Stream stream) throws java.io.IOException
Opens the scene from given stream- Parameters:
stream
- Input stream, user is responsible for closing the stream.- Throws:
java.io.IOException
-
open
public void open(java.lang.String fileName, FileFormat format, Cancellation cancellationToken) throws java.io.IOException
Opens the scene from given path using specified file format.- Parameters:
fileName
- File name.format
- File format.cancellationToken
- Cancellation token to the load task- Throws:
java.io.IOException
-
open
public void open(java.lang.String fileName, FileFormat format) throws java.io.IOException
Opens the scene from given path using specified file format.- Parameters:
fileName
- File name.format
- File format.- Throws:
java.io.IOException
-
open
public void open(java.lang.String fileName, LoadOptions options, Cancellation cancellationToken) throws java.io.IOException
Opens the scene from given path using specified file format.- Parameters:
fileName
- File name.options
- More detailed configuration to open the stream.cancellationToken
- Cancellation token to the load task- Throws:
java.io.IOException
-
open
public void open(java.lang.String fileName, LoadOptions options) throws java.io.IOException
Opens the scene from given path using specified file format.- Parameters:
fileName
- File name.options
- More detailed configuration to open the stream.- Throws:
java.io.IOException
-
open
public void open(java.lang.String fileName, Cancellation cancellationToken) throws java.io.IOException
Opens the scene from given path- Parameters:
fileName
- File name.cancellationToken
- Cancellation token to the load task- Throws:
java.io.IOException
-
open
public void open(java.lang.String fileName) throws java.io.IOException
Opens the scene from given path- Parameters:
fileName
- File name.- Throws:
java.io.IOException
-
save
public void save(com.aspose.csporter.helpers.Stream stream, FileFormat format, Cancellation cancellationToken) throws ExportException
Saves the scene to stream using specified file format.- Parameters:
stream
- Input stream, user is responsible for closing the stream.format
- Format.cancellationToken
- Cancellation token to the save task- Throws:
ExportException
-
save
public void save(com.aspose.csporter.helpers.Stream stream, FileFormat format) throws ExportException
Saves the scene to stream using specified file format.- Parameters:
stream
- Input stream, user is responsible for closing the stream.format
- Format.- Throws:
ExportException
-
save
public void save(com.aspose.csporter.helpers.Stream stream, SaveOptions options, Cancellation cancellationToken) throws ExportException
Saves the scene to stream using specified file format.- Parameters:
stream
- Input stream, user is responsible for closing the stream.options
- More detailed configuration to save the stream.cancellationToken
- Cancellation token to the save task- Throws:
ExportException
-
save
public void save(com.aspose.csporter.helpers.Stream stream, SaveOptions options) throws ExportException
Saves the scene to stream using specified file format.- Parameters:
stream
- Input stream, user is responsible for closing the stream.options
- More detailed configuration to save the stream.- Throws:
ExportException
-
save
public void save(java.lang.String fileName, FileFormat format, Cancellation cancellationToken) throws java.io.IOException
Saves the scene to specified path using specified file format.- Parameters:
fileName
- File name.format
- Format.cancellationToken
- Cancellation token to the save task- Throws:
java.io.IOException
-
save
public void save(java.lang.String fileName, FileFormat format) throws java.io.IOException
Saves the scene to specified path using specified file format.- Parameters:
fileName
- File name.format
- Format.- Throws:
java.io.IOException
-
save
public void save(java.lang.String fileName, SaveOptions options, Cancellation cancellationToken) throws java.io.IOException
Saves the scene to specified path using specified file format.- Parameters:
fileName
- File name.options
- More detailed configuration to save the stream.cancellationToken
- Cancellation token to the save task- Throws:
java.io.IOException
-
save
public void save(java.lang.String fileName, SaveOptions options) throws java.io.IOException
Saves the scene to specified path using specified file format.- Parameters:
fileName
- File name.options
- More detailed configuration to save the stream.- Throws:
java.io.IOException
-
-