protected unsafe void UpdateColors()
{
// convert to API specific color values
int topColor = Root.Instance.ConvertColor( colorTop );
int bottomColor = Root.Instance.ConvertColor( colorBottom );
// get the seperate color buffer
HardwareVertexBuffer buffer =
renderOperation.vertexData.vertexBufferBinding.GetBuffer( COLOR_BINDING );
IntPtr data = buffer.Lock( BufferLocking.Discard );
int* colPtr = (int*)data.ToPointer();
int index = 0;
for ( int i = 0; i < allocSize; i++ )
{
// first tri (top, bottom, top);
colPtr[ index++ ] = topColor;
colPtr[ index++ ] = bottomColor;
colPtr[ index++ ] = topColor;
// second tri (top, bottom, bottom);
colPtr[ index++ ] = topColor;
colPtr[ index++ ] = bottomColor;
colPtr[ index++ ] = bottomColor;
}
// unlock this bad boy
buffer.Unlock();
}