public void SetCellUV(BorderCell cell, float u1, float v1, float u2, float v2) {
int cellIndex = (int)cell;
// no choice but to lock/unlock each time here, locking only what we want to modify
HardwareVertexBuffer buffer =
renderOp2.vertexData.vertexBufferBinding.GetBuffer(TEXCOORDS);
// can't use discard, or it will discard the whole buffer, wiping out the positions too
IntPtr data = buffer.Lock(
cellIndex * 8 * Marshal.SizeOf(typeof(float)),
Marshal.SizeOf(typeof(float)) * 8,
BufferLocking.Normal);
int index = 0;
unsafe {
float* texPtr = (float*)data.ToPointer();
texPtr[index++] = u1; texPtr[index++] = v1;
texPtr[index++] = u1; texPtr[index++] = v2;
texPtr[index++] = u2; texPtr[index++] = v1;
texPtr[index++] = u2; texPtr[index++] = v2;
}
buffer.Unlock();
}