Package com.jme3.shader.bufferobject
Class BufferObject
java.lang.Object
com.jme3.util.NativeObject
com.jme3.shader.bufferobject.BufferObject
- Direct Known Subclasses:
StructStd140BufferObject
A generic memory buffer that can be divided in logical regions
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Hint to suggest the renderer how to access this bufferstatic enum
Hint to suggest the renderer how the data should be used -
Field Summary
Modifier and TypeFieldDescriptionprotected ByteBuffer
protected DirtyRegionsIterator
protected ArrayList<BufferRegion>
Fields inherited from class com.jme3.util.NativeObject
handleRef, id, INVALID_ID, objectManager, OBJTYPE_AUDIOBUFFER, OBJTYPE_AUDIOSTREAM, OBJTYPE_BO, OBJTYPE_FILTER, OBJTYPE_FRAMEBUFFER, OBJTYPE_SHADER, OBJTYPE_SHADERSOURCE, OBJTYPE_TEXTURE, OBJTYPE_VERTEXBUFFER, updateNeeded
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionclone()
This should create a deep clone.Creates a shallow clone of this GL Object.protected void
Deletes any associated nativebuffers
.void
deleteObject
(Object rendererObject) Deletes the GL object from the GPU when it is no longer used.int
Get binding pointgetData()
Rewind and return buffer dataGet dirty regionsgetName()
Get name of the buffer objectgetRegion
(int i) Return all the regions of this layoutlong
Returns a unique ID for this NativeObject.Acquire a weak reference to this NativeObject.void
initializeEmpty
(int length) Initialize an empty buffer object of the given lengthvoid
Mark all regions as dirtyvoid
read
(JmeImporter im) void
Called when the GL context is restarted to reset all IDs.void
setAccessHint
(BufferObject.AccessHint accessHint) Set AccessHint to hint the renderer on how to access this data.void
setBinding
(int binding) Set binding pointvoid
setData
(ByteBuffer data) Transfer remaining bytes of passed buffer to the internal buffer of this buffer objectvoid
Set name for debugging purposesvoid
setNatureHint
(BufferObject.NatureHint natureHint) Set NatureHint to hint the renderer on how to use this data.void
setRegions
(List<BufferRegion> lr) Add a region at the end of the layoutfinal void
Internal use only.void
setUpdateNeeded
(boolean dirtyAll) Indicates that the object has changed and its state needs to be updated.toString()
void
Reset layour definitionvoid
write
(JmeExporter ex) Methods inherited from class com.jme3.util.NativeObject
clearUpdateNeeded, dispose, getId, isUpdateNeeded, setId
-
Field Details
-
dirtyRegionsIterator
-
data
-
regions
-
-
Constructor Details
-
BufferObject
public BufferObject() -
BufferObject
protected BufferObject(int id)
-
-
Method Details
-
setUpdateNeeded
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 classNativeObject
-
setUpdateNeeded
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
public int getBinding()Get binding point- Returns:
- the binding point
-
initializeEmpty
public void initializeEmpty(int length) Initialize an empty buffer object of the given length- Parameters:
length
- expected length of the buffer object
-
setData
Transfer remaining bytes of passed buffer to the internal buffer of this buffer object- Parameters:
data
- ByteBuffer containing the data to pass
-
getData
Rewind and return buffer data- Returns:
-
getDirtyRegions
Get dirty regions- Returns:
- Helper object to iterate through dirty regions
-
unsetRegions
public void unsetRegions()Reset layour definition -
setRegions
Add a region at the end of the layout- Parameters:
lr
-
-
getRegion
Return all the regions of this layout- Returns:
- ordered list of regions
-
markAllRegionsDirty
public void markAllRegionsDirty()Mark all regions as dirty -
resetObject
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 classNativeObject
-
deleteNativeBuffers
protected void deleteNativeBuffers()Description copied from class:NativeObject
Deletes any associated nativebuffers
. 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 classNativeObject
-
deleteObject
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 classNativeObject
- Parameters:
rendererObject
- The renderer to be used to delete the object
-
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 classNativeObject
- Returns:
- a new instance
-
getUniqueId
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 classNativeObject
- Returns:
- unique ID for this NativeObject.
-
setBinding
public void setBinding(int binding) Set binding point- Parameters:
binding
- binding point
-
getWeakRef
Description copied from class:NativeObject
Acquire a weak reference to this NativeObject.- Overrides:
getWeakRef
in classNativeObject
- Returns:
- a weak reference (possibly a pre-existing one)
-
getAccessHint
-
setAccessHint
Set AccessHint to hint the renderer on how to access this data.- Parameters:
natureHint
-
-
getNatureHint
-
setNatureHint
Set NatureHint to hint the renderer on how to use this data.- Parameters:
natureHint
-
-
write
- Specified by:
write
in interfaceSavable
- Throws:
IOException
-
read
- Specified by:
read
in interfaceSavable
- Throws:
IOException
-
clone
Description copied from class:NativeObject
This should create a deep clone. For a shallow clone, use createDestructableClone().- Overrides:
clone
in classNativeObject
-
toString
- Overrides:
toString
in classNativeObject
-
getName
Get name of the buffer object- Returns:
- the name of this buffer object, can be null
-
setName
Set name for debugging purposes- Parameters:
name
- the name of this buffer object
-