Class BufferObject

java.lang.Object
com.jme3.util.NativeObject
com.jme3.shader.bufferobject.BufferObject
All Implemented Interfaces:
Savable, Cloneable
Direct Known Subclasses:
StructStd140BufferObject

public class BufferObject extends NativeObject implements Savable
A generic memory buffer that can be divided in logical regions
  • Field Details Link icon

  • Constructor Details Link icon

    • BufferObject Link icon

      public BufferObject()
    • BufferObject Link icon

      protected BufferObject(int id)
  • Method Details Link icon

    • setUpdateNeeded Link icon

      public final void setUpdateNeeded()
      Internal use only. Indicates that the object has changed and its state needs to be updated. Mark all the regions as dirty.
      Overrides:
      setUpdateNeeded in class NativeObject
    • setUpdateNeeded Link icon

      public void setUpdateNeeded(boolean dirtyAll)
      Indicates that the object has changed and its state needs to be updated.
      Parameters:
      dirtyAll - mark all regions for update
    • getBinding Link icon

      public int getBinding()
      Get binding point
      Returns:
      the binding point
    • initializeEmpty Link icon

      public void initializeEmpty(int length)
      Initialize an empty buffer object of the given length
      Parameters:
      length - expected length of the buffer object
    • setData Link icon

      public void setData(ByteBuffer data)
      Transfer remaining bytes of passed buffer to the internal buffer of this buffer object
      Parameters:
      data - ByteBuffer containing the data to pass
    • getData Link icon

      public ByteBuffer getData()
      Rewind and return buffer data
      Returns:
    • getDirtyRegions Link icon

      public DirtyRegionsIterator getDirtyRegions()
      Get dirty regions
      Returns:
      Helper object to iterate through dirty regions
    • unsetRegions Link icon

      public void unsetRegions()
      Reset layour definition
    • setRegions Link icon

      public void setRegions(List<BufferRegion> lr)
      Add a region at the end of the layout
      Parameters:
      lr -
    • getRegion Link icon

      public BufferRegion getRegion(int i)
      Return all the regions of this layout
      Returns:
      ordered list of regions
    • markAllRegionsDirty Link icon

      public void markAllRegionsDirty()
      Mark all regions as dirty
    • resetObject Link icon

      public void resetObject()
      Description copied from class: NativeObject
      Called when the GL context is restarted to reset all IDs. Prevents "white textures" on display restart.
      Specified by:
      resetObject in class NativeObject
    • deleteNativeBuffers Link icon

      protected void deleteNativeBuffers()
      Description copied from class: NativeObject
      Deletes any associated native buffers. This is necessary because it is unlikely that native buffers will be garbage collected naturally (due to how GC works), therefore the collection must be handled manually. Only implementations that manage native buffers need to override this method. Note that the behavior that occurs when a deleted native buffer is used is not defined, therefore this method is protected
      Overrides:
      deleteNativeBuffers in class NativeObject
    • deleteObject Link icon

      public void deleteObject(Object rendererObject)
      Description copied from class: NativeObject
      Deletes the GL object from the GPU when it is no longer used. Called automatically by the GL object manager.
      Specified by:
      deleteObject in class NativeObject
      Parameters:
      rendererObject - The renderer to be used to delete the object
    • createDestructableClone Link icon

      public NativeObject createDestructableClone()
      Description copied from class: NativeObject
      Creates a shallow clone of this GL Object. The deleteObject method should be functional for this object.
      Specified by:
      createDestructableClone in class NativeObject
      Returns:
      a new instance
    • getUniqueId Link icon

      public long getUniqueId()
      Description copied from class: NativeObject
      Returns a unique ID for this NativeObject. No other NativeObject shall have the same ID.
      Specified by:
      getUniqueId in class NativeObject
      Returns:
      unique ID for this NativeObject.
    • setBinding Link icon

      public void setBinding(int binding)
      Set binding point
      Parameters:
      binding - binding point
    • getWeakRef Link icon

      public WeakReference<BufferObject> getWeakRef()
      Description copied from class: NativeObject
      Acquire a weak reference to this NativeObject.
      Overrides:
      getWeakRef in class NativeObject
      Returns:
      a weak reference (possibly a pre-existing one)
    • getAccessHint Link icon

      public BufferObject.AccessHint getAccessHint()
    • setAccessHint Link icon

      public void setAccessHint(BufferObject.AccessHint accessHint)
      Set AccessHint to hint the renderer on how to access this data.
      Parameters:
      natureHint -
    • getNatureHint Link icon

      public BufferObject.NatureHint getNatureHint()
    • setNatureHint Link icon

      public void setNatureHint(BufferObject.NatureHint natureHint)
      Set NatureHint to hint the renderer on how to use this data.
      Parameters:
      natureHint -
    • write Link icon

      public void write(JmeExporter ex) throws IOException
      Specified by:
      write in interface Savable
      Throws:
      IOException
    • read Link icon

      public void read(JmeImporter im) throws IOException
      Specified by:
      read in interface Savable
      Throws:
      IOException
    • clone Link icon

      public BufferObject clone()
      Description copied from class: NativeObject
      This should create a deep clone. For a shallow clone, use createDestructableClone().
      Overrides:
      clone in class NativeObject
    • toString Link icon

      public String toString()
      Overrides:
      toString in class NativeObject
    • getName Link icon

      public String getName()
      Get name of the buffer object
      Returns:
      the name of this buffer object, can be null
    • setName Link icon

      public void setName(String name)
      Set name for debugging purposes
      Parameters:
      name - the name of this buffer object