Class IndexBuffer

    • Field Detail

      • m_iIQuantity

        protected int m_iIQuantity
        Number of int elements.
      • m_aiIndex

        protected int[] m_aiIndex
        Index data array.
      • m_kIBufferData

        private java.nio.IntBuffer m_kIBufferData
      • m_iOffset

        protected int m_iOffset
        Index offset.
      • m_bDataChanged

        private boolean m_bDataChanged
    • Constructor Detail

      • IndexBuffer

        public IndexBuffer()
        streaming support
      • IndexBuffer

        public IndexBuffer​(IndexBuffer pkIBuffer)
        Copy constructor.
        Parameters:
        pkIBuffer - the IndexBuffer to copy into this.
      • IndexBuffer

        public IndexBuffer​(int iIQuantity)
        Create an IndexBuffer with the input number of indices.
        Parameters:
        iIQuantity - the number of int elements.
      • IndexBuffer

        public IndexBuffer​(int iIQuantity,
                           int[] aiIndex)
        Create an IndexBuffer with the input number of indices and connectivity array.
        Parameters:
        iIQuantity - the number of int elements.
        aiIndex - connectivity array.
      • IndexBuffer

        public IndexBuffer​(int[] aiIndex)
        Create an IndexBuffer with the connectivity array.
        Parameters:
        aiIndex - connectivity array.
      • IndexBuffer

        public IndexBuffer​(int[] aiIndex,
                           int iSize)
    • Method Detail

      • dispose

        public void dispose()
        Delete memory.
        Overrides:
        dispose in class Spatial
      • GetData

        public final int[] GetData()
        Direct access to the index buffer data. The quantity is the number of int elements. The number of bytes for the entire index buffer is GetIndexQuantity()*sizeof(int).
        Returns:
        index data array.
      • GetBufferData

        public final java.nio.IntBuffer GetBufferData()
      • 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 Spatial
        Parameters:
        rkVersion - the current version of the Stream file being created.
        Returns:
        the size of this object on disk.
      • GetIndexQuantity

        public final int GetIndexQuantity()
        Direct access to the index buffer data. The quantity is the number of int elements. The number of bytes for the entire index buffer is GetIndexQuantity()*sizeof(int).
        Returns:
        number of int elements.
      • GetOffset

        public final int GetOffset()
        The offset into the indices is used by the renderer for drawing. The ability to set this is useful when multiple geometric primitives share an index buffer, each primitive using a continguous set of indices. In this case, SetIndexQuantity and SetOffset will be called dynamically during the application for each such geometric primitive.
        Returns:
        index offset.
      • IsDataChanged

        public boolean IsDataChanged()
      • DataChanged

        public void DataChanged​(boolean bChanged)
      • 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 Spatial
        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 Spatial
        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.
      • 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 Spatial
        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 Spatial
        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 Spatial
        Parameters:
        acTitle - the header for this object in the StringTree.
        Returns:
        StringTree containing a String-based representation of this object and it's children.
      • SetIndexQuantity

        public final void SetIndexQuantity​(int iIQuantity)
        An application might want to vary the "active quantity" of indices. Use this function to do so. It does not change the data storage, only the m_iQuantity member. The caller is responsible for saving the full quantity of indices and resetting this when finished with the index buffer. The caller also should not pass in a quantity that is larger than the original full quantity.
        Parameters:
        iIQuantity - number of int elements.
      • SetOffset

        public void SetOffset​(int iOffset)
        The offset into the indices is used by the renderer for drawing. The ability to set this is useful when multiple geometric primitives share an index buffer, each primitive using a continguous set of indices. In this case, SetIndexQuantity and SetOffset will be called dynamically during the application for each such geometric primitive.
        Parameters:
        iOffset - index offset.
      • writeObject

        private void writeObject​(java.io.ObjectOutputStream out)
                          throws java.io.IOException
        Throws:
        java.io.IOException
      • readObject

        private void readObject​(java.io.ObjectInputStream in)
                         throws java.io.IOException,
                                java.lang.ClassNotFoundException
        Throws:
        java.io.IOException
        java.lang.ClassNotFoundException