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
Nested ClassesModifier and TypeClassDescriptionstatic enumHint to suggest the renderer how to access this bufferstatic enumHint to suggest the renderer how the data should be used -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ByteBufferprotected DirtyRegionsIteratorprotected 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()This should create a deep clone.Creates a shallow clone of this GL Object.protected voidDeletes any associated nativebuffers.voiddeleteObject(Object rendererObject) Deletes the GL object from the GPU when it is no longer used.intGet binding pointgetData()Rewind and return buffer dataGet dirty regionsgetName()Get name of the buffer objectgetRegion(int i) Return all the regions of this layoutlongReturns a unique ID for this NativeObject.Acquire a weak reference to this NativeObject.voidinitializeEmpty(int length) Initialize an empty buffer object of the given lengthvoidMark all regions as dirtyvoidread(JmeImporter im) voidCalled when the GL context is restarted to reset all IDs.voidsetAccessHint(BufferObject.AccessHint accessHint) Set AccessHint to hint the renderer on how to access this data.voidsetBinding(int binding) Set binding pointvoidsetData(ByteBuffer data) Transfer remaining bytes of passed buffer to the internal buffer of this buffer objectvoidSet name for debugging purposesvoidsetNatureHint(BufferObject.NatureHint natureHint) Set NatureHint to hint the renderer on how to use this data.voidsetRegions(List<BufferRegion> lr) Add a region at the end of the layoutfinal voidInternal use only.voidsetUpdateNeeded(boolean dirtyAll) Indicates that the object has changed and its state needs to be updated.toString()voidReset layour definitionvoidwrite(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:
setUpdateNeededin 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:NativeObjectCalled when the GL context is restarted to reset all IDs. Prevents "white textures" on display restart.- Specified by:
resetObjectin classNativeObject
-
deleteNativeBuffers
protected void deleteNativeBuffers()Description copied from class:NativeObjectDeletes 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:
deleteNativeBuffersin classNativeObject
-
deleteObject
Description copied from class:NativeObjectDeletes the GL object from the GPU when it is no longer used. Called automatically by the GL object manager.- Specified by:
deleteObjectin classNativeObject- Parameters:
rendererObject- The renderer to be used to delete the object
-
createDestructableClone
Description copied from class:NativeObjectCreates a shallow clone of this GL Object. The deleteObject method should be functional for this object.- Specified by:
createDestructableClonein classNativeObject- Returns:
- a new instance
-
getUniqueId
public long getUniqueId()Description copied from class:NativeObjectReturns a unique ID for this NativeObject. No other NativeObject shall have the same ID.- Specified by:
getUniqueIdin 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:NativeObjectAcquire a weak reference to this NativeObject.- Overrides:
getWeakRefin 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:
writein interfaceSavable- Throws:
IOException
-
read
- Specified by:
readin interfaceSavable- Throws:
IOException
-
clone
Description copied from class:NativeObjectThis should create a deep clone. For a shallow clone, use createDestructableClone().- Overrides:
clonein classNativeObject
-
toString
- Overrides:
toStringin 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
-