Webgl / Adapt the points renderer to use custom attributes

Now most attributes will be custom ones defined by the user of the renderer.
The hit detection is broken for now and still has to be fixed.
Also it is not possible anymore to give a texture to the renderer,
this will have to be fixed as well.
This commit is contained in:
Olivier Guyot
2019-09-24 23:24:49 +02:00
parent 076b674d6f
commit 2b36445ecc
6 changed files with 192 additions and 377 deletions

View File

@@ -45,20 +45,6 @@ export const DefaultUniform = {
OFFSET_ROTATION_MATRIX: 'u_offsetRotateMatrix'
};
/**
* Attribute names used in the default shaders: `POSITION`, `TEX_COORD`, `OPACITY`,
* `ROTATE_WITH_VIEW`, `OFFSETS` and `COLOR`
* @enum {string}
*/
export const DefaultAttrib = {
POSITION: 'a_position',
TEX_COORD: 'a_texCoord',
OPACITY: 'a_opacity',
ROTATE_WITH_VIEW: 'a_rotateWithView',
OFFSETS: 'a_offsets',
COLOR: 'a_color'
};
/**
* Attribute types, either `UNSIGNED_BYTE`, `UNSIGNED_SHORT`, `UNSIGNED_INT` or `FLOAT`
* Note: an attribute stored in a `Float32Array` should be of type `FLOAT`.
@@ -860,7 +846,7 @@ class WebGLHelper extends Disposable {
}
/**
* Compute a stride based on a list of attributes
* Compute a stride in bytes based on a list of attributes
* @param {Array<AttributeDescription>} attributes Ordered list of attributes
* @returns {number} Stride, ie amount of values for each vertex in the vertex buffer
* @api