/// <summary>Let the mesh know it's about to undergo a layout routine. /// <see cref="PowerUI.Renderman.Layout"/>.</summary> public void PrepareForLayout() { // Release the buffers back to the pool: MeshDataBufferPool.Return(FirstBuffer, LastBuffer); // Clear values: FirstBuffer = null; LastBuffer = null; FullBufferCount = 0; CurrentBufferBlocks = 0; BlockCount = 0; }
/// <summary>Gets the next vertex buffer.</summary> public void NextBuffer() { // Get it: BlockBuffer buffer = MeshDataBufferPool.GetBuffer(); buffer.Mesh = this; if (Normals != null) { buffer.RequireNormals(); } if (UV3 != null) { buffer.RequireUV3(); } // Clear count: CurrentBufferBlocks = 0; if (FirstBuffer == null) { // Only one: buffer.Previous = null; buffer.Offset = 0; buffer.BlocksBefore = 0; FirstBuffer = LastBuffer = buffer; } else { // Filled one: FullBufferCount++; buffer.Offset = FullBufferCount * MeshDataBufferPool.VertexBufferSize; buffer.BlocksBefore = FullBufferCount * MeshDataBufferPool.BlockCount; // Add to end: buffer.Previous = LastBuffer; LastBuffer.Next = buffer; LastBuffer = buffer; } }