Class Scene

  • All Implemented Interfaces:
    INamedObject

    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 getRootNode() 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 the Scene class.
      Scene​(Entity entity)
      Initializes a new instance of the Scene class with an entity attached to a new node.
      Scene​(Scene parentScene, java.lang.String name)
      Initializes a new instance of the Scene class as a sub-scene.
      Scene​(java.lang.String fileName)
      Deprecated.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      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 the AnimationClip The first AnimationClip will be assigned to the getCurrentAnimationClip()
      static Scene fromFile​(java.lang.String fileName)
      Opens the scene from given path
      static Scene fromFile​(java.lang.String fileName, Cancellation cancellationToken)
      Opens the scene from given path
      static Scene fromFile​(java.lang.String fileName, FileFormat format)
      Opens the scene from given path using specified file format.
      static Scene fromFile​(java.lang.String fileName, FileFormat format, Cancellation cancellationToken)
      Opens the scene from given path using specified file format.
      static Scene fromFile​(java.lang.String fileName, LoadOptions options)
      Opens the scene from given path using specified file format.
      static Scene fromFile​(java.lang.String fileName, LoadOptions options, Cancellation cancellationToken)
      Opens the scene from given path using specified file format.
      static Scene fromStream​(com.aspose.threed.Stream stream)
      Opens the scene from given stream
      static Scene fromStream​(com.aspose.threed.Stream stream, Cancellation cancellationToken)
      Opens the scene from given stream
      static Scene fromStream​(com.aspose.threed.Stream stream, FileFormat format)
      Opens the scene from given stream using specified file format.
      static Scene fromStream​(com.aspose.threed.Stream stream, FileFormat format, Cancellation cancellationToken)
      Opens the scene from given stream using specified file format.
      static Scene fromStream​(com.aspose.threed.Stream stream, LoadOptions options)
      Opens the scene from given stream using specified IO config.
      static Scene fromStream​(com.aspose.threed.Stream stream, LoadOptions options, Cancellation cancellationToken)
      Opens the scene from given stream using specified IO config.
      AnimationClip getAnimationClip​(java.lang.String name)
      Gets a named AnimationClip
      java.util.List<AnimationClip> getAnimationClips()
      Gets all AnimationClip defined in the scene.
      AssetInfo getAssetInfo()
      Gets the top-level asset information
      AnimationClip getCurrentAnimationClip()
      Gets the active AnimationClip
      java.util.List<A3DObject> getLibrary()
      Objects that not directly used in scene hierarchy can be defined in Library.
      java.util.Collection<Pose> getPoses()
      Gets all Pose used in this scene.
      Node getRootNode()
      Gets the root node of the scene.
      java.util.List<Scene> getSubScenes()
      Gets all sub-scenes
      void open​(com.aspose.threed.Stream stream)
      Opens the scene from given stream
      void open​(com.aspose.threed.Stream stream, Cancellation cancellationToken)
      Opens the scene from given stream
      void open​(com.aspose.threed.Stream stream, FileFormat format)
      Opens the scene from given stream using specified file format.
      void open​(com.aspose.threed.Stream stream, FileFormat format, Cancellation cancellationToken)
      Opens the scene from given stream using specified file format.
      void open​(com.aspose.threed.Stream stream, LoadOptions options)
      Opens the scene from given stream using specified IO config.
      void open​(com.aspose.threed.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 path
      void open​(java.lang.String fileName, Cancellation cancellationToken)
      Opens the scene from given path
      void 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 format
      void 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)
      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)
      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.threed.Stream stream, FileFormat format)
      Saves the scene to stream using specified file format.
      void save​(com.aspose.threed.Stream stream, FileFormat format, Cancellation cancellationToken)
      Saves the scene to stream using specified file format.
      void save​(com.aspose.threed.Stream stream, SaveOptions options)
      Saves the scene to stream using specified file format.
      void save​(com.aspose.threed.Stream stream, SaveOptions options, Cancellation cancellationToken)
      Saves the scene to stream using specified file format.
      void save​(java.lang.String fileName)
      Saves the scene to specified path 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 information
      void setCurrentAnimationClip​(AnimationClip value)
      Sets the active AnimationClip
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Scene

        public Scene()
        Initializes a new instance of the Scene class.
      • Scene

        public Scene​(Entity entity)
        Initializes a new instance of the Scene class with an entity attached to a new node.
        Parameters:
        entity - The initial entity that attached to the scene
      • Scene

        public Scene​(Scene parentScene,
                     java.lang.String name)
        Initializes a new instance of the Scene class as a sub-scene.
        Parameters:
        parentScene - The parent scene.
        name - Scene's name.
      • Scene

        @Deprecated
        public Scene​(java.lang.String fileName)
              throws java.io.IOException
        Deprecated.
        Initializes a new instance of the Scene class and open the file immediately. This is an obsoleted constructor, please use Scene.
        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.
      • setCurrentAnimationClip

        public void setCurrentAnimationClip​(AnimationClip value)
        Sets the active AnimationClip
        Parameters:
        value - New value
      • getAnimationClip

        public AnimationClip getAnimationClip​(java.lang.String name)
        Gets a named AnimationClip
        Parameters:
        name - The AnimationClip'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
      • getPoses

        public java.util.Collection<Pose> getPoses()
        Gets all Pose used in this scene.
      • getRootNode

        public Node getRootNode()
        Gets the root node of the scene.
      • clear

        public void clear()
        Clears the scene content and restores the default settings.
      • 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.threed.Stream stream,
                         FileFormat format,
                         Cancellation cancellationToken)
                  throws java.io.IOException
        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:
        java.io.IOException
      • open

        public void open​(com.aspose.threed.Stream stream,
                         FileFormat format)
                  throws java.io.IOException
        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:
        java.io.IOException
      • open

        public void open​(com.aspose.threed.Stream stream,
                         LoadOptions options,
                         Cancellation cancellationToken)
                  throws java.io.IOException
        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:
        java.io.IOException
      • open

        public void open​(com.aspose.threed.Stream stream,
                         LoadOptions options)
                  throws java.io.IOException
        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:
        java.io.IOException
      • open

        public void open​(com.aspose.threed.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​(com.aspose.threed.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​(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)
                  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,
                         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)
                  throws java.io.IOException
        Opens the scene from given path
        Parameters:
        fileName - File name.
        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
      • fromStream

        public static Scene fromStream​(com.aspose.threed.Stream stream,
                                       FileFormat format,
                                       Cancellation cancellationToken)
                                throws java.io.IOException
        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:
        java.io.IOException
      • fromStream

        public static Scene fromStream​(com.aspose.threed.Stream stream,
                                       FileFormat format)
                                throws java.io.IOException
        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:
        java.io.IOException
      • fromStream

        public static Scene fromStream​(com.aspose.threed.Stream stream,
                                       LoadOptions options,
                                       Cancellation cancellationToken)
                                throws java.io.IOException
        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:
        java.io.IOException
      • fromStream

        public static Scene fromStream​(com.aspose.threed.Stream stream,
                                       LoadOptions options)
                                throws java.io.IOException
        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:
        java.io.IOException
      • fromStream

        public static Scene fromStream​(com.aspose.threed.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
      • fromStream

        public static Scene fromStream​(com.aspose.threed.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
      • fromFile

        public static Scene fromFile​(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
      • fromFile

        public static Scene fromFile​(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
      • fromFile

        public static Scene fromFile​(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
      • fromFile

        public static Scene fromFile​(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
      • fromFile

        public static Scene fromFile​(java.lang.String fileName)
                              throws java.io.IOException
        Opens the scene from given path
        Parameters:
        fileName - File name.
        Throws:
        java.io.IOException
      • fromFile

        public static Scene fromFile​(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
      • save

        public void save​(com.aspose.threed.Stream stream,
                         FileFormat format)
                  throws java.io.IOException
        Saves the scene to stream using specified file format.
        Parameters:
        stream - Input stream, user is responsible for closing the stream.
        format - Format.
        Throws:
        java.io.IOException
      • save

        public void save​(com.aspose.threed.Stream stream,
                         FileFormat format,
                         Cancellation cancellationToken)
                  throws java.io.IOException
        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:
        java.io.IOException
      • save

        public void save​(com.aspose.threed.Stream stream,
                         SaveOptions options)
                  throws java.io.IOException
        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:
        java.io.IOException
      • save

        public void save​(com.aspose.threed.Stream stream,
                         SaveOptions options,
                         Cancellation cancellationToken)
                  throws java.io.IOException
        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:
        java.io.IOException
      • save

        public void save​(java.lang.String fileName)
                  throws java.io.IOException
        Saves the scene to specified path using specified file format.
        Parameters:
        fileName - File name.
        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,
                         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,
                         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
      • 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
      • render

        public void render​(Camera camera,
                           java.lang.String fileName)
                    throws java.io.IOException
        Render the scene into external file from given camera's perspective. The default output size is 1024x768 and output format is png
        Parameters:
        camera - From which camera's perspective to render the scene
        fileName - The file name of output file
        Throws:
        java.io.IOException
      • 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 scene
        fileName - The file name of output file
        size - The size of final rendered image
        format - 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 scene
        fileName - The file name of output file
        size - The size of final rendered image
        format - The image format of the output file
        options - 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 scene
        bitmap - 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 scene
        bitmap - Target of the rendered result
        options - The option to customize some internal settings.
        Throws:
        java.io.IOException