(options)
| 170 | stats.elementsCount++ |
| 171 | |
| 172 | function reglElements (options) { |
| 173 | if (!options) { |
| 174 | buffer() |
| 175 | elements.primType = GL_TRIANGLES |
| 176 | elements.vertCount = 0 |
| 177 | elements.type = GL_UNSIGNED_BYTE |
| 178 | } else if (typeof options === 'number') { |
| 179 | buffer(options) |
| 180 | elements.primType = GL_TRIANGLES |
| 181 | elements.vertCount = options | 0 |
| 182 | elements.type = GL_UNSIGNED_BYTE |
| 183 | } else { |
| 184 | var data = null |
| 185 | var usage = GL_STATIC_DRAW |
| 186 | var primType = -1 |
| 187 | var vertCount = -1 |
| 188 | var byteLength = 0 |
| 189 | var dtype = 0 |
| 190 | if (Array.isArray(options) || |
| 191 | isTypedArray(options) || |
| 192 | isNDArrayLike(options)) { |
| 193 | data = options |
| 194 | } else { |
| 195 | check.type(options, 'object', 'invalid arguments for elements') |
| 196 | if ('data' in options) { |
| 197 | data = options.data |
| 198 | check( |
| 199 | Array.isArray(data) || |
| 200 | isTypedArray(data) || |
| 201 | isNDArrayLike(data), |
| 202 | 'invalid data for element buffer') |
| 203 | } |
| 204 | if ('usage' in options) { |
| 205 | check.parameter( |
| 206 | options.usage, |
| 207 | usageTypes, |
| 208 | 'invalid element buffer usage') |
| 209 | usage = usageTypes[options.usage] |
| 210 | } |
| 211 | if ('primitive' in options) { |
| 212 | check.parameter( |
| 213 | options.primitive, |
| 214 | primTypes, |
| 215 | 'invalid element buffer primitive') |
| 216 | primType = primTypes[options.primitive] |
| 217 | } |
| 218 | if ('count' in options) { |
| 219 | check( |
| 220 | typeof options.count === 'number' && options.count >= 0, |
| 221 | 'invalid vertex count for elements') |
| 222 | vertCount = options.count | 0 |
| 223 | } |
| 224 | if ('type' in options) { |
| 225 | check.parameter( |
| 226 | options.type, |
| 227 | elementTypes, |
| 228 | 'invalid buffer type') |
| 229 | dtype = elementTypes[options.type] |
no test coverage detected
searching dependent graphs…