mrdoob/three.js — pull request #3088 by zz85 (2013-02-17 14:49:39+00:00)
Title: Support custom BufferGeometry attributes in WebGLRenderer.

As discussed in #3017, adding custom attribute support to `BufferGeometry`.

This should also fix #3084

Some points about this custom attribues

1. You add a new item entry to `bufferGeometry.attributes`
eg.

```
bufferGeometry.attributes['hello'] = {
itemSize: 3,
array: new Float32Array( number * 3 ),
numItems: number * 3
}
```

2. You populate the FloatArray of course
3. You need to make sure your `Material` have that attribute, just like how Custom Attributes work for the usual geometry.

```
mesh.attributes.['hello'] = { type: 'c', value: null };
```

In the usual meshes, material attributes holds the data values, but BufferGeometry holds the Array here. WebGL Renderer still goes to the material attributes for creating attribute pointers, so passing a null value here should do.

More side notes
- want examples? Could add a `webgl_buffergeometry_custom_attributes`
- Not sure how updating would work
- This PR actually reduces 100 lines of code. Could make it go lower too
- Can port this to WebGLRenderer2