protected void FillBuffer()
{
unsafe
{
// Transfer vertices and normals
float* vIdx = (float*)( vertexBuffer.Lock( BufferLocking.Discard ) );
int elemsize = 1 * 3; // position only
int planesize = 4 * elemsize; // four vertices per plane
for ( int x = 0; x < count; x++ )
{
Vector3 ax, ay, az;
things[ x ].ToAxes( out ax, out ay, out az );
Vector3 pos = az * radius; // scale to radius
ax *= qSize;
ay *= qSize;
Vector3 pos1 = pos - ax - ay;
Vector3 pos2 = pos + ax - ay;
Vector3 pos3 = pos + ax + ay;
Vector3 pos4 = pos - ax + ay;
vIdx[ x * planesize + 0 * elemsize + 0 ] = pos1.x;
vIdx[ x * planesize + 0 * elemsize + 1 ] = pos1.y;
vIdx[ x * planesize + 0 * elemsize + 2 ] = pos1.z;
vIdx[ x * planesize + 1 * elemsize + 0 ] = pos2.x;
vIdx[ x * planesize + 1 * elemsize + 1 ] = pos2.y;
vIdx[ x * planesize + 1 * elemsize + 2 ] = pos2.z;
vIdx[ x * planesize + 2 * elemsize + 0 ] = pos3.x;
vIdx[ x * planesize + 2 * elemsize + 1 ] = pos3.y;
vIdx[ x * planesize + 2 * elemsize + 2 ] = pos3.z;
vIdx[ x * planesize + 3 * elemsize + 0 ] = pos4.x;
vIdx[ x * planesize + 3 * elemsize + 1 ] = pos4.y;
vIdx[ x * planesize + 3 * elemsize + 2 ] = pos4.z;
}
vertexBuffer.Unlock();
}
}