pex-renderer
pex-renderer copied to clipboard
Add custom attributeMap
Currently to add custom attribute you do the following which mixes data creation with ctx webgl commands.
const corners = [...]
const cornersBuffer = graph.ctx.vertexBuffer({ data: new Float32Array(1)})
graph.ctx.update(cornersBuffer, { data: new Float32Array(g.corners.flat() )})
g.attributes = {
aCorner: {
buffer: cornersBuffer,
divisor: 1
},
aCoords: {
buffer: coordsBuffer,
divisor: 1
}
}
Ideally sth like that would be possible and all buffers allocated for you in geometry system:
g.corners = [...]
g.customAttributesMap = {
aCorner: 'corners'
}
g.customInstancedAttributes: ['aCorner']
alternatively
g.corners = [...]
g.customAttributes = {
aCorner: {
attribute: 'corners',
divisor: 1
}
}