Ejemplo n.º 1
0
        /// <summary>Let the mesh know that UV3 is required.</summary>
        public void RequireUV3()
        {
            if (UV3 != null)
            {
                return;
            }

            UV3 = new FixedSizeBuffer <Vector2>(4, false);

            BlockBuffer buff = FirstBuffer;

            while (buff != null)
            {
                buff.RequireUV3();
                buff = buff.Next;
            }
        }
Ejemplo n.º 2
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;
            }
        }