Class SceneBase

  • All Implemented Interfaces:
    Scene

    public class SceneBase
    extends java.lang.Object
    implements Scene
    This class implements the Scene interface and extends it to incorporate utilities that could be used by loaders. There should be little need for future loaders to subclass this, or to implement Scene directly, as the functionality of a SceneBase is fairly straightforward. This class is responsible for both the storage and retrieval of data from the Scene. The storage methods (used only by Loader writers) are all of the add* routines. The retrieval methods (used primarily by Loader users) are all of the get* routines.
    • Constructor Summary

      Constructors 
      Constructor Description
      SceneBase()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addBackgroundNode​(Background background)
      Adds the given Background node to the list of backgrounds.
      void addBehaviorNode​(Behavior b)
      Adds the given behavior to a list of behaviors
      void addDescription​(java.lang.String descriptionString)
      Sets the text description of the scene to the passed in String.
      void addFogNode​(Fog fog)
      Adds the given Fog node to the list of fog nodes.
      void addHorizontalFOV​(float hfov)
      Adds the given field of view value to the list of field of view values.
      void addLightNode​(Light light)
      Adds the given Light node to the list of lights.
      void addNamedObject​(java.lang.String name, java.lang.Object object)
      Adds the given String/Object pair to the table of named objects.
      void addSoundNode​(Sound sound)
      Adds the given Sound node to the list of sounds.
      void addViewGroup​(TransformGroup tg)
      Adds the given group to the list of view groups.
      Background[] getBackgroundNodes()
      This method returns an array of all Background nodes defined in the file.
      Behavior[] getBehaviorNodes()
      This method returns a group containing all of the Behavior nodes in the scene.
      java.lang.String getDescription()
      This method returns the text description of the file.
      Fog[] getFogNodes()
      This method returns an array of all Fog nodes defined in the file.
      float[] getHorizontalFOVs()
      This method returns an array of floats that contains the horizontal field of view values for each corresponding entry in the array of view groups returned by the method getViewGroups.
      Light[] getLightNodes()
      This method returns an array of all Lights defined in the file.
      java.util.Hashtable getNamedObjects()
      This method returns a Hashtable which contains a list of all named objects in the file and their associated scene graph objects.
      BranchGroup getSceneGroup()
      This method returns the BranchGroup containing the overall scene loaded by the loader.
      Sound[] getSoundNodes()
      This method returns an array of all of the Sound nodes defined in the file.
      TransformGroup[] getViewGroups()
      This method returns an array of all View Groups defined in the file.
      void setSceneGroup​(BranchGroup scene)
      Sets the sceneGroup to be the group that is passed in.
      • Methods inherited from class java.lang.Object

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

      • SceneBase

        public SceneBase()
    • Method Detail

      • setSceneGroup

        public void setSceneGroup​(BranchGroup scene)
        Sets the sceneGroup to be the group that is passed in.
      • addViewGroup

        public void addViewGroup​(TransformGroup tg)
        Adds the given group to the list of view groups.
      • addHorizontalFOV

        public void addHorizontalFOV​(float hfov)
        Adds the given field of view value to the list of field of view values.
      • addBehaviorNode

        public void addBehaviorNode​(Behavior b)
        Adds the given behavior to a list of behaviors
      • addLightNode

        public void addLightNode​(Light light)
        Adds the given Light node to the list of lights.
      • addBackgroundNode

        public void addBackgroundNode​(Background background)
        Adds the given Background node to the list of backgrounds.
      • addSoundNode

        public void addSoundNode​(Sound sound)
        Adds the given Sound node to the list of sounds.
      • addFogNode

        public void addFogNode​(Fog fog)
        Adds the given Fog node to the list of fog nodes.
      • addDescription

        public void addDescription​(java.lang.String descriptionString)
        Sets the text description of the scene to the passed in String.
      • addNamedObject

        public void addNamedObject​(java.lang.String name,
                                   java.lang.Object object)
        Adds the given String/Object pair to the table of named objects.
      • getSceneGroup

        public BranchGroup getSceneGroup()
        This method returns the BranchGroup containing the overall scene loaded by the loader.
        Specified by:
        getSceneGroup in interface Scene
      • getViewGroups

        public TransformGroup[] getViewGroups()
        This method returns an array of all View Groups defined in the file. A View Group is defined as a TransformGroup which contains a ViewPlatform. The TransformGroup holds the position/orientation information for the given ViewPlatform and the ViewPlatform holds an view-specific information, such as Field of View.
        Specified by:
        getViewGroups in interface Scene
      • getHorizontalFOVs

        public float[] getHorizontalFOVs()
        This method returns an array of floats that contains the horizontal field of view values for each corresponding entry in the array of view groups returned by the method getViewGroups.
        Specified by:
        getHorizontalFOVs in interface Scene
      • getLightNodes

        public Light[] getLightNodes()
        This method returns an array of all Lights defined in the file.
        Specified by:
        getLightNodes in interface Scene
      • getNamedObjects

        public java.util.Hashtable getNamedObjects()
        This method returns a Hashtable which contains a list of all named objects in the file and their associated scene graph objects. The naming scheme for file objects is file-type dependent, but may include such names as the DEF names of Vrml or filenames of subjects (as in Lightwave 3D).
        Specified by:
        getNamedObjects in interface Scene
      • getBackgroundNodes

        public Background[] getBackgroundNodes()
        This method returns an array of all Background nodes defined in the file.
        Specified by:
        getBackgroundNodes in interface Scene
      • getFogNodes

        public Fog[] getFogNodes()
        This method returns an array of all Fog nodes defined in the file.
        Specified by:
        getFogNodes in interface Scene
      • getBehaviorNodes

        public Behavior[] getBehaviorNodes()
        This method returns a group containing all of the Behavior nodes in the scene.
        Specified by:
        getBehaviorNodes in interface Scene
      • getSoundNodes

        public Sound[] getSoundNodes()
        This method returns an array of all of the Sound nodes defined in the file.
        Specified by:
        getSoundNodes in interface Scene
      • getDescription

        public java.lang.String getDescription()
        This method returns the text description of the file. If no such description exists, this method should return null.
        Specified by:
        getDescription in interface Scene