Webgl buffer / add utility getSize function
Saves checking whether the buffer was initialized with an array already
This commit is contained in:
@@ -95,6 +95,7 @@ class WebGLArrayBuffer {
|
||||
}
|
||||
|
||||
/**
|
||||
* Will return null if the buffer was not initialized
|
||||
* @return {Float32Array|Uint32Array} Array.
|
||||
*/
|
||||
getArray() {
|
||||
@@ -107,6 +108,14 @@ class WebGLArrayBuffer {
|
||||
getUsage() {
|
||||
return this.usage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Will return 0 if the buffer is not initialized
|
||||
* @return {number} Array size
|
||||
*/
|
||||
getSize() {
|
||||
return this.array ? this.array.length : 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user