Class Spatial

    • Field Detail

      • ms_pkCullingModeMap

        private static java.util.HashMap<java.lang.Integer,​Spatial.CullingMode> ms_pkCullingModeMap
        Map culling mode to type integer value.
      • World

        public Transformation World
        World transforms. In some situations you might need to set the world transform directly and bypass the Spatial::Update() mechanism. If World is set directly, the WorldIsCurrent flag should be set to true. For example, inverse kinematic controllers and skin controllers need this capability.
      • WorldIsCurrent

        public boolean WorldIsCurrent
        Set when World transform is set directly.
      • WorldBound

        public BoundingVolume WorldBound
        World bound access. In some situations you might want to set the world bound directly and bypass the Spatial::UpdateGS() mechanism. If WorldBound is set directly, the WorldBoundIsCurrent flag should be set to true.
      • WorldBoundIsCurrent

        public boolean WorldBoundIsCurrent
        If WorldBound is set directly, the WorldBoundIsCurrent flag should be set to true.
      • m_pkParent

        protected Spatial m_pkParent
        support for hierarchical scene graph
      • m_kGlobalStates

        protected java.util.Vector<GlobalState> m_kGlobalStates
        global render state
      • m_kLights

        protected java.util.Vector<GraphicsObject> m_kLights
        light state
      • m_kEffects

        protected java.util.Vector<Effect> m_kEffects
        Effect state. If the effect is attached to a Geometry object, it applies to that object alone. If the effect is attached to a Node object, it applies to all Geometry objects in the subtree rooted at the Node.
      • m_iStartEffect

        protected int m_iStartEffect
        Normally, all effects are applied to an object. To allow overriding some of the effects, a starting index may be specified by the application. This is useful for complex effects, where the current effects must be ignored and another effect is used instead. Without this mechanism, you would have to detach and save the current effects, attach the desired effect, draw, detach the desired effect, and reattach the old effects. With this mechanism, you attach the desired effect, set the starting index to that of the desired effect, draw, reset the starting index to zero, and detach the desired effect.
    • Constructor Detail

      • Spatial

        public Spatial()
        Default constructor.
    • Method Detail

      • AttachEffect

        public void AttachEffect​(Effect pkEffect)
        Attach a new effect.
        Parameters:
        pkEffect - the effect to attach.
      • AttachGlobalState

        public void AttachGlobalState​(GlobalState pkState)
        Attach the input global state to this object.
        Parameters:
        pkState - state to attach.
      • AttachLight

        public void AttachLight​(Light pkLight)
        Attach the input light.
        Parameters:
        pkLight - the light to attach.
      • DetachAllEffects

        public void DetachAllEffects()
        Detach all effects.
      • DetachAllGlobalStates

        public void DetachAllGlobalStates()
        Detach all global states.
      • DetachAllLights

        public void DetachAllLights()
        Detach all lights.
      • DetachEffect

        public void DetachEffect​(Effect pkEffect)
        Detach the specified effect.
        Parameters:
        pkEffect - the effect to detach.
      • DetachGlobalState

        public void DetachGlobalState​(GlobalState.StateType eType)
        Detach the global state specified by the input type.
        Parameters:
        eType - type of global state to detach.
      • DetachLight

        public void DetachLight​(Light pkLight)
        Detach the input light.
        Parameters:
        pkLight - the light to detach.
      • GetAllObjectsByName

        public void GetAllObjectsByName​(java.lang.String rkName,
                                        java.util.Vector<GraphicsObject> rkObjects)
        Writes all GraphicsObjects with the name that matches the input parameter, rkName into the Vector parameter rkObjects.
        Specified by:
        GetAllObjectsByName in interface NameIdInterface
        Overrides:
        GetAllObjectsByName in class GraphicsObject
        Parameters:
        rkName - the name of the objects to return.
        rkObjects - a Vector of all objects with the matching name.
      • GetDiskUsed

        public int GetDiskUsed​(StreamVersion rkVersion)
        Returns the size of this object and it's children on disk for the current StreamVersion parameter.
        Specified by:
        GetDiskUsed in interface StreamInterface
        Overrides:
        GetDiskUsed in class GraphicsObject
        Parameters:
        rkVersion - the current version of the Stream file being created.
        Returns:
        the size of this object on disk.
      • GetEffect

        public Effect GetEffect​(int i)
        Get the effect at index.
        Parameters:
        i - index of the effect to return.
        Returns:
        the effect at index i.
      • GetEffectQuantity

        public int GetEffectQuantity()
        Get the number of attached effects.
        Returns:
        the number of attached effects.
      • GetGlobalState

        public GlobalState GetGlobalState​(GlobalState.StateType eType)
        Get global state by type.
        Parameters:
        eType - type of GlobalState to get.
        Returns:
        global state for the input type.
      • GetGlobalState

        public GlobalState GetGlobalState​(int i)
        Get global state at position i.
        Parameters:
        i - position of GlobalState to get.
        Returns:
        global state at position i.
      • GetGlobalStateQuantity

        public int GetGlobalStateQuantity()
        global state size
        Returns:
        global state size
      • GetLight

        public Light GetLight​(int i)
        Return the light specified by the input index.
        Parameters:
        i - the index of the light to return.
        Returns:
        the light at index i.
      • GetLightQuantity

        public int GetLightQuantity()
        light state. Return the number of attached lights.
        Returns:
        the number of attached lights.
      • GetObjectByID

        public GraphicsObject GetObjectByID​(int uiID)
        Returns the GraphicsObject with the ID that matches the input parameter, uiID.
        Specified by:
        GetObjectByID in interface NameIdInterface
        Overrides:
        GetObjectByID in class GraphicsObject
        Parameters:
        uiID - the ID of the object to return.
        Returns:
        the GraphicsObject that matches the input name.
      • GetObjectByName

        public GraphicsObject GetObjectByName​(java.lang.String rkName)
        Returns the GraphicsObject with the name that matches the input parameter, rkName.
        Specified by:
        GetObjectByName in interface NameIdInterface
        Overrides:
        GetObjectByName in class GraphicsObject
        Parameters:
        rkName - the name of the object to return.
        Returns:
        the GraphicsObject that matches the input name.
      • GetParent

        public Spatial GetParent()
        Return parent node.
        Returns:
        parent.
      • GetStartEffect

        public int GetStartEffect()
        Get the start effect index.
        Returns:
        the start effect index.
      • Link

        public void Link​(Stream rkStream,
                         Stream.Link pkLink)
        Copies this objects children objects from the input Stream's HashTable, based on the LinkID of the child stored in the pkLink parameter.
        Specified by:
        Link in interface StreamInterface
        Overrides:
        Link in class GraphicsObject
        Parameters:
        rkStream - the Stream where the child objects are stored.
        pkLink - the Link class from which the child object IDs are read.
      • Load

        public void Load​(Stream rkStream,
                         Stream.Link pkLink)
        Loads this object from the input parameter rkStream, using the input Stream.Link to store the IDs of children objects of this object for linking after all objects are loaded from the Stream.
        Specified by:
        Load in interface StreamInterface
        Overrides:
        Load in class GraphicsObject
        Parameters:
        rkStream - the Stream from which this object is being read.
        pkLink - the Link class for storing the IDs of this object's children objects.
      • OnGetVisibleSet

        public void OnGetVisibleSet​(Culler rkCuller,
                                    boolean bNoCull)
        Culling callback.
        Parameters:
        rkCuller - Culler object.
        bNoCull - when true set to no-cull.
      • Register

        public boolean Register​(Stream rkStream)
        Registers this object with the input Stream parameter. All objects streamed to disk are registered with the Stream so that a unique list of objects is maintained.
        Specified by:
        Register in interface StreamInterface
        Overrides:
        Register in class GraphicsObject
        Parameters:
        rkStream - the Stream where the child objects are stored.
        Returns:
        true if this object is registered, false if the object has already been registered.
      • Save

        public void Save​(Stream rkStream)
        Write this object and all it's children to the Stream.
        Specified by:
        Save in interface StreamInterface
        Overrides:
        Save in class GraphicsObject
        Parameters:
        rkStream - the Stream where the child objects are stored.
      • SaveStrings

        public StringTree SaveStrings​(java.lang.String acTitle)
        Write this object into a StringTree for the scene-graph visualization.
        Specified by:
        SaveStrings in interface StreamInterface
        Overrides:
        SaveStrings in class GraphicsObject
        Parameters:
        acTitle - the header for this object in the StringTree.
        Returns:
        StringTree containing a String-based representation of this object and it's children.
      • SetParent

        public void SetParent​(Spatial pkParent)
        Parent access (Node calls this during attach/detach of children)
        Parameters:
        pkParent - set parent.
      • SetStartEffect

        public void SetStartEffect​(int i)
        Set the start effect to the specified index.
        Parameters:
        i - the index of the start effect.
      • UpdateBS

        public void UpdateBS()
        Update of geometric state and controllers. The UpdateBS function just computes the world bounding volumes on an upward pass. This is useful if model data changes, causing the model and world bounds to change, but no transformations need recomputing.
      • UpdateGS

        public void UpdateGS()
        Update of geometric state and controllers. The UpdateGS function computes world transformations on the downward pass and world bounding volumes on the upward pass.
      • UpdateGS

        public void UpdateGS​(double dAppTime,
                             boolean bInitiator)
        Update of geometric state and controllers. The UpdateGS function computes world transformations on the downward pass and world bounding volumes on the upward pass.
        Parameters:
        dAppTime - animation time step from application.
        bInitiator - when true propagate bound to root.
      • UpdateRS

        public void UpdateRS()
        Update render state.
      • UpdateRS

        public void UpdateRS​(java.util.Vector<java.util.Vector<GlobalState>> akGStack,
                             java.util.Vector<Light> pkLStack)
        update of render state
        Parameters:
        akGStack - global states.
        akLStack - lights.
      • GetVisibleSet

        protected abstract void GetVisibleSet​(Culler rkCuller,
                                              boolean bNoCull)
        Get visible set.
        Parameters:
        rkCuller - Culler
        bNoCull - when true set to no-cull.
      • PopState

        protected void PopState​(java.util.Vector<java.util.Vector<GlobalState>> akGStack,
                                java.util.Vector<Light> pkLStack)
        Pop state from current render state stack.
        Parameters:
        akGStack - global states.
        akLStack - lights.
      • PropagateBoundToRoot

        protected void PropagateBoundToRoot()
        Propagate bound to root.
      • PropagateStateFromRoot

        protected void PropagateStateFromRoot​(java.util.Vector<java.util.Vector<GlobalState>> akGStack,
                                              java.util.Vector<Light> pkLStack)
        render state updates
        Parameters:
        akGStack - global states.
        akLStack - lights.
      • PushState

        protected void PushState​(java.util.Vector<java.util.Vector<GlobalState>> akGStack,
                                 java.util.Vector<Light> pkLStack)
        Push state onto current render state stack.
        Parameters:
        akGStack - global states.
        akLStack - lights.
      • UpdateState

        protected abstract void UpdateState​(java.util.Vector<java.util.Vector<GlobalState>> akGStack,
                                            java.util.Vector<Light> pkLStack)
        Update state.
        Parameters:
        akGStack - global states.
        akLStack - lights.
      • UpdateWorldBound

        protected abstract void UpdateWorldBound()
        Update world bound.
      • UpdateWorldData

        protected void UpdateWorldData​(double dAppTime)
        geometric updates
        Parameters:
        dAppTime - animation time step from application.