Package com.ardor3d.scenegraph
Class ShortBufferData
- All Implemented Interfaces:
Savable
Simple data class storing a buffer of shorts
-
Nested Class Summary
Nested classes/interfaces inherited from class com.ardor3d.scenegraph.AbstractBufferData
AbstractBufferData.VBOAccessMode
-
Field Summary
Fields inherited from class com.ardor3d.scenegraph.AbstractBufferData
_buffer, _needsRefresh, _vboAccessMode, _vboIdCache
-
Constructor Summary
ConstructorDescriptionInstantiates a new ShortBufferData.ShortBufferData
(int size) Instantiates a new ShortBufferData with a buffer of the given size.ShortBufferData
(ShortBuffer buffer) Creates a new ShortBufferData. -
Method Summary
Modifier and TypeMethodDescriptionint
get()
int
get
(int index) Get the underlying nio buffer.int
Class
<? extends ShortBufferData> makeCopy()
put
(int value) Sets the value of this buffer at the current position, incrementing our position by 1 entry.void
put
(int[] array) Write the contents of the given int array into this IndexBufferData.void
put
(int[] array, int offset, int length) Write the contents of the given int array into this IndexBufferData.put
(int index, int value) Sets the value of this buffer at the given index.void
put
(IndexBufferData<?> buf) Write the contents of the given IndexBufferData into this one.void
read
(InputCapsule capsule) void
write
(OutputCapsule capsule) Methods inherited from class com.ardor3d.scenegraph.IndexBufferData
capacity, clear, flip, limit, limit, position, position, remaining, reset, rewind
Methods inherited from class com.ardor3d.scenegraph.AbstractBufferData
cleanAllVBOs, cleanAllVBOs, cleanExpiredVBOs, getBufferCapacity, getBufferLimit, getVboAccessMode, getVBOID, isNeedsRefresh, removeVBOID, setBuffer, setNeedsRefresh, setVboAccessMode, setVBOID
-
Constructor Details
-
ShortBufferData
public ShortBufferData()Instantiates a new ShortBufferData. -
ShortBufferData
public ShortBufferData(int size) Instantiates a new ShortBufferData with a buffer of the given size.- Parameters:
size
- the size
-
ShortBufferData
Creates a new ShortBufferData.- Parameters:
buffer
- Buffer holding the data. Must not be null.
-
-
Method Details
-
getClassTag
- Specified by:
getClassTag
in interfaceSavable
-
read
- Specified by:
read
in interfaceSavable
- Overrides:
read
in classAbstractBufferData<ShortBuffer>
- Throws:
IOException
-
write
- Specified by:
write
in interfaceSavable
- Overrides:
write
in classAbstractBufferData<ShortBuffer>
- Throws:
IOException
-
get
public int get()- Specified by:
get
in classIndexBufferData<ShortBuffer>
- Returns:
- the next value from this object, as an int, incrementing our position by 1 entry. Buffer types smaller than an int should return unsigned values.
-
get
public int get(int index) - Specified by:
get
in classIndexBufferData<ShortBuffer>
- Parameters:
index
- the absolute position to get our value from. This is in entries, not bytes, and is 0 based. So for a ShortBuffer, 2 would be the 3rd short from the beginning, etc.- Returns:
- the value from this object, as an int, at the given absolute entry position. Buffer types smaller than an int should return unsigned values.
-
put
Description copied from class:IndexBufferData
Sets the value of this buffer at the current position, incrementing our position by 1 entry.- Specified by:
put
in classIndexBufferData<ShortBuffer>
- Parameters:
value
- the value to place into this object at the current position.- Returns:
- this object, for chaining.
-
put
Description copied from class:IndexBufferData
Sets the value of this buffer at the given index.- Specified by:
put
in classIndexBufferData<ShortBuffer>
- Parameters:
index
- the absolute position to put our value at. This is in entries, not bytes, and is 0 based. So for a ShortBuffer, 2 would be the 3rd short from the beginning, etc.value
- the value to place into this object- Returns:
- this object, for chaining.
-
put
Description copied from class:IndexBufferData
Write the contents of the given IndexBufferData into this one. Note that data conversion is handled using the get/put methods in IndexBufferData.- Specified by:
put
in classIndexBufferData<ShortBuffer>
- Parameters:
buf
- the source buffer object.
-
put
public void put(int[] array) Description copied from class:IndexBufferData
Write the contents of the given int array into this IndexBufferData. Note that data conversion is handled using the get/put methods in IndexBufferData.- Specified by:
put
in classIndexBufferData<ShortBuffer>
- Parameters:
array
- the source int array.
-
put
public void put(int[] array, int offset, int length) Description copied from class:IndexBufferData
Write the contents of the given int array into this IndexBufferData. Note that data conversion is handled using the get/put methods in IndexBufferData.- Specified by:
put
in classIndexBufferData<ShortBuffer>
- Parameters:
array
- the source int array.offset
- the offsetlength
- the length
-
getByteCount
public int getByteCount()- Specified by:
getByteCount
in classAbstractBufferData<ShortBuffer>
- Returns:
- the number of bytes per entry in the buffer. For example, an IntBuffer would return 4.
-
getBuffer
Description copied from class:IndexBufferData
Get the underlying nio buffer.- Specified by:
getBuffer
in classIndexBufferData<ShortBuffer>
- Returns:
- the buffer
-
asIntBuffer
- Specified by:
asIntBuffer
in classIndexBufferData<ShortBuffer>
- Returns:
- a new, non-direct IntBuffer containing a snapshot of the contents of this buffer.
-
makeCopy
- Specified by:
makeCopy
in classIndexBufferData<ShortBuffer>
- Returns:
- a deep copy of this buffer data object
-