Ejemplo n.º 1
0
 public HardwareBufferLockGuard(HardwareBuffer p, uint offset, uint length, HardwareBuffer.LockOptions options) : this(OgrePINVOKE.new_HardwareBufferLockGuard__SWIG_2(HardwareBuffer.getCPtr(p), offset, length, (int)options), true)
 {
     if (OgrePINVOKE.SWIGPendingException.Pending)
     {
         throw OgrePINVOKE.SWIGPendingException.Retrieve();
     }
 }
Ejemplo n.º 2
0
 public virtual void copyData(HardwareBuffer srcBuffer)
 {
     OgrePINVOKE.HardwareBuffer_copyData__SWIG_2(swigCPtr, HardwareBuffer.getCPtr(srcBuffer));
     if (OgrePINVOKE.SWIGPendingException.Pending)
     {
         throw OgrePINVOKE.SWIGPendingException.Retrieve();
     }
 }
Ejemplo n.º 3
0
 public virtual void copyData(HardwareBuffer srcBuffer, uint srcOffset, uint dstOffset, uint length)
 {
     OgrePINVOKE.HardwareBuffer_copyData__SWIG_1(swigCPtr, HardwareBuffer.getCPtr(srcBuffer), srcOffset, dstOffset, length);
     if (OgrePINVOKE.SWIGPendingException.Pending)
     {
         throw OgrePINVOKE.SWIGPendingException.Retrieve();
     }
 }
 public void copyData(HardwareBuffer srcBuffer, uint srcOffset, uint dstOffset, uint length, bool discardWholeBuffer)
 {
     OgrePINVOKE.HardwareVertexBufferPtr_copyData__SWIG_0(swigCPtr, HardwareBuffer.getCPtr(srcBuffer), srcOffset, dstOffset, length, discardWholeBuffer);
     if (OgrePINVOKE.SWIGPendingException.Pending)
     {
         throw OgrePINVOKE.SWIGPendingException.Retrieve();
     }
 }
 public override void licenseExpired(HardwareBuffer buffer)
 {
     OgrePINVOKE.TempBlendedBufferInfo_licenseExpired(swigCPtr, HardwareBuffer.getCPtr(buffer));
     if (OgrePINVOKE.SWIGPendingException.Pending)
     {
         throw OgrePINVOKE.SWIGPendingException.Retrieve();
     }
 }
Ejemplo n.º 6
0
 public void lock_(HardwareBuffer p, uint offset, uint length, HardwareBuffer.LockOptions options)
 {
     OgrePINVOKE.HardwareBufferLockGuard_lock___SWIG_1(swigCPtr, HardwareBuffer.getCPtr(p), offset, length, (int)options);
     if (OgrePINVOKE.SWIGPendingException.Pending)
     {
         throw OgrePINVOKE.SWIGPendingException.Retrieve();
     }
 }
 public virtual void licenseExpired(HardwareBuffer buffer)
 {
     OgrePINVOKE.HardwareBufferLicensee_licenseExpired(swigCPtr, HardwareBuffer.getCPtr(buffer));
     if (OgrePINVOKE.SWIGPendingException.Pending)
     {
         throw OgrePINVOKE.SWIGPendingException.Retrieve();
     }
 }
Ejemplo n.º 8
0
        public HardwareBuffer __deref__()
        {
            global::System.IntPtr cPtr = OgrePINVOKE.HardwareBufferPtr___deref__(swigCPtr);
            HardwareBuffer        ret  = (cPtr == global::System.IntPtr.Zero) ? null : new HardwareBuffer(cPtr, false);

            if (OgrePINVOKE.SWIGPendingException.Pending)
            {
                throw OgrePINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Ejemplo n.º 9
0
        unsafe public static void CalculateAplha(Texture texture)
        {
            if (texture == null)
            {
                return;
            }

            if (texture.Format == PixelFormat.PF_X8R8G8B8)
            {
                return;
            }
            if (texture.Format != PixelFormat.PF_A8R8G8B8)
            {
                throw new ArgumentException("Currently only ARGB textures allowed.");
            }

            HardwareBuffer buffer = texture.GetBuffer();
            var            data   = (uint *)buffer.Lock(HardwareBuffer.LockOptions.HBL_DISCARD);

            try
            {
                var size   = sizeof(uint);
                var width  = texture.Width;
                var height = texture.Height;
                var pitch  = (width / size) * size + ((width % size) > 0 ? size : 0);

                for (var y = 0; y < height; ++y)
                {
                    for (var x = 0; x < width; ++x)
                    {
                        var pixel = data[pitch * y + x];
                        var r     = (byte)((pixel & 0x00FF0000) >> 16);
                        var g     = (byte)((pixel & 0x0000FF00) >> 8);
                        var b     = (byte)(pixel & 0x000000FF);
                        var a     = (r + g + b) / 3;

                        pixel = (uint)((a << 24) + (r << 16) + (g << 8) + b);
                        data[pitch * y + x] = pixel;
                    }
                }
            }
            finally
            {
                buffer.Unlock();
            }
        }
Ejemplo n.º 10
0
 public virtual void CreateIndexBuffer(uint triaglecount,
     HardwareIndexBuffer.IndexType itype,
     HardwareBuffer.Usage usage,
     bool useShadowBuffer)
 {
     mvbuf.Unlock();
     mTriagleCount = triaglecount;
     mIndexType = itype;
     mSubMesh.vertexData.vertexBufferBinding.SetBinding(0, mvbuf);
     mSubMesh.indexData.indexCount = mTriagleCount * 3;
     HardwareIndexBufferSharedPtr ibuf = HardwareBufferManager.Singleton
         .CreateIndexBuffer(mIndexType, mTriagleCount * 3, usage, useShadowBuffer);
     mSubMesh.indexData.indexBuffer = ibuf;
     unsafe
     {
         pIBuffStart = ibuf.Lock(HardwareBuffer.LockOptions.HBL_DISCARD);
         pIBuffLastPos = pIBuffStart;
     }
 }
Ejemplo n.º 11
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(HardwareBuffer obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
Ejemplo n.º 12
0
 public virtual void CreateIndexBuffer(uint triaglecount,
     HardwareIndexBuffer.IndexType itype,
     HardwareBuffer.Usage usage)
 {
     CreateIndexBuffer(triaglecount, itype, usage, false);
 }
Ejemplo n.º 13
0
 public virtual void CreateVertexBuffer(uint numVerts, HardwareBuffer.Usage usage, bool useShadowBuffer)
 {
     mVertexSize = offset;
     mNumVerts = numVerts;
     mvbuf = HardwareBufferManager.Singleton.CreateVertexBuffer(
             mVertexSize, mNumVerts, usage, useShadowBuffer);
     unsafe
     {
         pVBuffStart = mvbuf.Lock(HardwareBuffer.LockOptions.HBL_DISCARD);
     }
 }
Ejemplo n.º 14
0
 public virtual void CreateVertexBuffer(HardwareBuffer.Usage usage)
 {
     CreateVertexBuffer(mSubMesh.vertexData.vertexCount, usage, false);
 }
Ejemplo n.º 15
0
 public virtual void CreateIndexBufferForTriStrip(uint indexcount,
     HardwareIndexBuffer.IndexType itype,
     HardwareBuffer.Usage usage)
 {
     mvbuf.Unlock();
     mTriagleCount = 0;
     mIndexType = itype;
     mSubMesh.vertexData.vertexBufferBinding.SetBinding(0, mvbuf);
     mSubMesh.indexData.indexCount = indexcount;
     HardwareIndexBufferSharedPtr ibuf = HardwareBufferManager.Singleton
         .CreateIndexBuffer(mIndexType, indexcount, usage, false);
     mSubMesh.indexData.indexBuffer = ibuf;
     mSubMesh.operationType = RenderOperation.OperationTypes.OT_TRIANGLE_STRIP;
     unsafe
     {
         pIBuffStart = ibuf.Lock(HardwareBuffer.LockOptions.HBL_DISCARD);
         pIBuffLastPos = pIBuffStart;
     }
 }
Ejemplo n.º 16
0
 public virtual void CreateVertexBuffer(uint numVerts, HardwareBuffer.Usage usage)
 {
     CreateVertexBuffer(numVerts, usage, false);
 }