コード例 #1
0
        public static void CopyWriteTexture(SlimDX.Direct3D10.Texture3D texture, DataBox data, int TSize)
        {
            var copy = new SlimDX.Direct3D10.Texture3D(texture.Device, new SlimDX.Direct3D10.Texture3DDescription
            {
                BindFlags      = SlimDX.Direct3D10.BindFlags.None,
                CpuAccessFlags = SlimDX.Direct3D10.CpuAccessFlags.None,
                Format         = texture.Description.Format,
                Width          = texture.Description.Width,
                Height         = texture.Description.Height,
                MipLevels      = texture.Description.MipLevels,
                Usage          = SlimDX.Direct3D10.ResourceUsage.Default,
                OptionFlags    = SlimDX.Direct3D10.ResourceOptionFlags.None,
                Depth          = texture.Description.Depth
            }, data);

            texture.Device.CopyResource(copy, texture);
            copy.Dispose();
        }
コード例 #2
0
 public static T[,,] CopyReadTexture <T>(SlimDX.Direct3D10.Texture3D texture, int level) where T : struct
 {
     var copy = new SlimDX.Direct3D10.Texture3D(texture.Device, new SlimDX.Direct3D10.Texture3DDescription
     {
         BindFlags      = SlimDX.Direct3D10.BindFlags.None,
         CpuAccessFlags = SlimDX.Direct3D10.CpuAccessFlags.Read,
         Format         = texture.Description.Format,
         Width          = texture.Description.Width,
         Height         = texture.Description.Height,
         MipLevels      = texture.Description.MipLevels,
         Usage          = SlimDX.Direct3D10.ResourceUsage.Staging,
         OptionFlags    = SlimDX.Direct3D10.ResourceOptionFlags.None,
         Depth          = texture.Description.Depth
     });
     texture.Device.CopyResource(texture, copy);
     var d    = copy.Map(level, SlimDX.Direct3D10.MapMode.Read, SlimDX.Direct3D10.MapFlags.None);
     var sd   = copy.Description;
     var data = ReadTexture <T>(d, sd.Width, sd.Height, sd.Depth);
     copy.Unmap(level);
     copy.Dispose();
     return(data);
 }