예제 #1
0
        public SwapTextureSetD3D(IntPtr swapTextureSetPtr)

        {
            SwapTextureSet = (SharpOVR.SwapTextureSet)Marshal.PtrToStructure(swapTextureSetPtr, typeof(SharpOVR.SwapTextureSet));

            // Allocate the list of managed textures.
            Textures = new D3D11TextureData[SwapTextureSet.TextureCount];

            // The size of the OVR.D3D11.D3D11TextureData is defined as a C++ union between the
            // OVR.Texture and the OVR.D3D11.D3D11TextureData type. As the OVR.Texture is larger
            // than the size of the OVR.D3D11.D3D11TextureData, the size of the OVR.Texture is
            // used to determine the unmanaged size of the OVR.D3D11.D3D11TextureData.
            int textureSize = Marshal.SizeOf(typeof(Texture));

            for (int textureIndex = 0; textureIndex < SwapTextureSet.TextureCount; textureIndex++)
            {
                // Copy the contents of the unmanaged texture to the list of managed textures.
                Textures[textureIndex] = (D3D11TextureData)Marshal.PtrToStructure(SwapTextureSet.Textures + textureSize * textureIndex, typeof(D3D11TextureData));
            }
        }
예제 #2
0
        public SwapTextureSetD3D(IntPtr swapTextureSetPtr)
        {
            SwapTextureSet = (SharpOVR.SwapTextureSet)Marshal.PtrToStructure(swapTextureSetPtr, typeof(SharpOVR.SwapTextureSet));

            // Allocate the list of managed textures.
            Textures = new D3D11TextureData[SwapTextureSet.TextureCount];

            // The size of the OVR.D3D11.D3D11TextureData is defined as a C++ union between the
            // OVR.Texture and the OVR.D3D11.D3D11TextureData type. As the OVR.Texture is larger
            // than the size of the OVR.D3D11.D3D11TextureData, the size of the OVR.Texture is
            // used to determine the unmanaged size of the OVR.D3D11.D3D11TextureData.
            int textureSize = Marshal.SizeOf(typeof(Texture));

            for (int textureIndex = 0; textureIndex < SwapTextureSet.TextureCount; textureIndex++)
            {
                // Copy the contents of the unmanaged texture to the list of managed textures.
                Textures[textureIndex] = (D3D11TextureData)Marshal.PtrToStructure(SwapTextureSet.Textures + textureSize * textureIndex, typeof(D3D11TextureData));
            }
        }