Ejemplo n.º 1
0
        private unsafe int ReadIndexData(int indexOffset, uint vertexOffset, IndexData indexData)
        {
            // get index data
            HardwareIndexBufferSharedPtr indexBuf = indexData.indexBuffer;

            HardwareIndexBuffer.IndexType indexType = indexBuf.Type;
            uint *  pLong  = (uint *)(indexBuf.Lock(HardwareBuffer.LockOptions.HBL_READ_ONLY));
            ushort *pShort = (ushort *)pLong;

            for (uint i = 0; i < indexData.indexCount; i++)
            {
                if (indexType == HardwareIndexBuffer.IndexType.IT_32BIT)
                {
                    _indices[indexOffset] = pLong[i] + vertexOffset;
                }
                else
                {
                    _indices[indexOffset] = pShort[i] + vertexOffset;
                }

                indexOffset++;
            }

            indexBuf.Unlock();
            // SGD :2013/6/8 13:42:42
            // 说明:销毁指针引用  防止.NET回收
            indexBuf.Dispose();
            return(indexOffset);
        }
Ejemplo n.º 2
0
 // cant override? well mogre wont be able to manage it! ...
 public virtual void Dispose()
 {
     _ib.Dispose();
     _vb.Dispose();
 }