Package com.jme3.shader
Class BufferObject
java.lang.Object
com.jme3.util.NativeObject
com.jme3.shader.BufferObject
- All Implemented Interfaces:
Cloneable
The base implementation of BO.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic enum -
Field Summary
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
ConstructorsConstructorDescriptionBufferObject(int binding) BufferObject(int binding, BufferObject.BufferType bufferType) BufferObject(int binding, BufferObject.Layout layout) BufferObject(int binding, BufferObject.Layout layout, BufferObject.BufferType bufferType) BufferObject(BufferObject.BufferType bufferType) BufferObject(BufferObject.Layout layout) -
Method Summary
Modifier and TypeMethodDescriptioncomputeData(int maxSize) Computes the current binary data of this BO.Creates a shallow clone of this GL Object.voiddeclareField(String name, VarType varType) Declares a filed in this BO.protected voidDeletes any associated nativebuffers.voiddeleteObject(Object rendererObject) Deletes the GL object from the GPU when it is no longer used.protected intestimate(float[] values) Estimates byte count to present the values on the GPU.protected intestimate(int[] values) Estimates byte count to present the values on the GPU.protected intestimateArray(Object value, int multiplier) Estimates byte count to present the value on the GPU.protected intestimateSize(BufferObjectField field) Estimates size of the field.intGet the binding number.Gets the buffer's type.<T> TgetFieldValue(String name) Gets the current value of the field by the name.longReturns a unique ID for this NativeObject.protected static VarTypegetVarTypeByValue(Object value) voidCalled when the GL context is restarted to reset all IDs.voidsetBufferType(BufferObject.BufferType bufferType) Sets the buffer's type.voidsetFieldValue(String name, Object value) Sets the value to the filed by the field's name.protected voidwrite(ByteBuffer data, float[] value) Writes the value to the data buffer.protected voidwrite(ByteBuffer data, float x, float y, float z) Writes the value to the data buffer.protected voidwrite(ByteBuffer data, float x, float y, float z, float w) Writes the value to the data buffer.protected voidwrite(ByteBuffer data, int[] value) Writes the value to the data buffer.protected voidwrite(ByteBuffer data, Matrix3f value) Writes the value to the data buffer.protected voidwrite(ByteBuffer data, Matrix4f value) Writes the value to the data buffer.protected voidwrite(ByteBuffer data, Vector2f value) Writes the value to the data buffer.protected voidwrite(ByteBuffer data, Vector3f value) Writes the value to the data buffer.protected voidwriteField(BufferObjectField field, ByteBuffer data) Writes the field to the data buffer.protected voidwriteMat3Array(ByteBuffer data, Object value) Writes the value to the data buffer.protected voidwriteMat4Array(ByteBuffer data, Object value) Writes the value to the data buffer.protected voidwriteVec2Array(ByteBuffer data, Object value) Writes the value to the data buffer.protected voidwriteVec3Array(ByteBuffer data, Object value) Writes the value to the data buffer.protected voidwriteVec4(ByteBuffer data, Object value) Writes the value to the data buffer.protected voidwriteVec4Array(ByteBuffer data, Object value) Writes the value to the data buffer.Methods inherited from class com.jme3.util.NativeObject
clearUpdateNeeded, clone, dispose, getId, getWeakRef, isUpdateNeeded, setId, setUpdateNeeded, toString
-
Constructor Details
-
BufferObject
-
BufferObject
-
BufferObject
-
BufferObject
-
BufferObject
-
BufferObject
public BufferObject(int binding) -
BufferObject
public BufferObject()
-
-
Method Details
-
getVarTypeByValue
-
declareField
Declares a filed in this BO.- Parameters:
name- the field's name.varType- the field's type.
-
getBufferType
Gets the buffer's type.- Returns:
- the buffer's type.
-
setBufferType
Sets the buffer's type.- Parameters:
bufferType- the buffer's type.
-
setFieldValue
Sets the value to the filed by the field's name.- Parameters:
name- the field's name.value- the value.
-
getFieldValue
Gets the current value of the field by the name.- Type Parameters:
T- the value's type.- Parameters:
name- the field name.- Returns:
- the current value.
-
getBinding
public int getBinding()Get the binding number.- Returns:
- the binding number.
-
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
-
computeData
Computes the current binary data of this BO.- Parameters:
maxSize- the max data size.- Returns:
- the current binary data of this BO.
-
estimateSize
Estimates size of the field.- Parameters:
field- the field.- Returns:
- the estimated size.
-
estimateArray
Estimates byte count to present the value on the GPU.- Parameters:
value- the value.multiplier- the multiplier.- Returns:
- the estimated byte count.
-
estimate
protected int estimate(float[] values) Estimates byte count to present the values on the GPU.- Parameters:
values- the values.- Returns:
- the estimated byte count.
-
estimate
protected int estimate(int[] values) Estimates byte count to present the values on the GPU.- Parameters:
values- the values.- Returns:
- the estimated byte count.
-
writeField
Writes the field to the data buffer.- Parameters:
field- the field.data- the data buffer.
-
writeMat3Array
Writes the value to the data buffer.- Parameters:
data- the data buffer.value- the value.
-
writeMat4Array
Writes the value to the data buffer.- Parameters:
data- the data buffer.value- the value.
-
writeVec4Array
Writes the value to the data buffer.- Parameters:
data- the data buffer.value- the value.
-
writeVec3Array
Writes the value to the data buffer.- Parameters:
data- the data buffer.value- the value.
-
writeVec2Array
Writes the value to the data buffer.- Parameters:
data- the data buffer.value- the value.
-
write
Writes the value to the data buffer.- Parameters:
data- the data buffer.value- the value.
-
write
Writes the value to the data buffer.- Parameters:
data- the data buffer.value- the value.
-
writeVec4
Writes the value to the data buffer.- Parameters:
data- the data buffer.value- the value.
-
write
Writes the value to the data buffer.- Parameters:
data- the data buffer.value- the value.
-
write
Writes the value to the data buffer.- Parameters:
data- the data buffer.x- the x value.y- the y value.z- the z value.
-
write
Writes the value to the data buffer.- Parameters:
data- the data buffer.x- the x value.y- the y value.z- the z value.w- the w value.
-
write
Writes the value to the data buffer.- Parameters:
data- the data buffer.value- the value.
-
write
Writes the value to the data buffer.- Parameters:
data- the data buffer.value- the value.
-
write
Writes the value to the data buffer.- Parameters:
data- the data buffer.value- the value.
-
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
-
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
-
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.
-