port from perforce
This commit is contained in:
82
aiwaz/Aiwaz.Contracts/ITexture.cs
Normal file
82
aiwaz/Aiwaz.Contracts/ITexture.cs
Normal file
@@ -0,0 +1,82 @@
|
||||
using SlimDX.Direct3D10;
|
||||
namespace Aiwaz.Contracts
|
||||
{
|
||||
public struct LockedTextureData
|
||||
{
|
||||
public byte[] Data;
|
||||
public int RowPitch;
|
||||
};
|
||||
|
||||
public class TextureInitialData
|
||||
{
|
||||
public TextureInitialData(byte[] Data, int Pitch)
|
||||
{
|
||||
this.Data = Data;
|
||||
this.Pitch = Pitch;
|
||||
}
|
||||
|
||||
public byte[] Data;
|
||||
public int Pitch;
|
||||
};
|
||||
|
||||
public struct CreateTextureDescriptor
|
||||
{
|
||||
public int Width;
|
||||
public int Height;
|
||||
public int Elements;
|
||||
public int MipLevels;
|
||||
public SlimDX.DXGI.Format Format;
|
||||
public ResourceUsage AccessType;
|
||||
public TextureInitialData InitialData;
|
||||
|
||||
public static CreateTextureDescriptor AsSingleTexture(int Width, int Height, SlimDX.DXGI.Format Format, int MipLevels)
|
||||
{
|
||||
return AsSingleTexture(Width, Height, Format, MipLevels, null, ResourceUsage.Default);
|
||||
}
|
||||
|
||||
public static CreateTextureDescriptor AsSingleTexture(int Width, int Height, SlimDX.DXGI.Format Format, int MipLevels, TextureInitialData InitialData, ResourceUsage AccessType)
|
||||
{
|
||||
CreateTextureDescriptor Desc = new CreateTextureDescriptor();
|
||||
|
||||
Desc.Width = Width;
|
||||
Desc.Height = Height;
|
||||
Desc.Elements = 0;
|
||||
Desc.Format = Format;
|
||||
Desc.AccessType = AccessType;
|
||||
Desc.InitialData = InitialData;
|
||||
Desc.MipLevels = MipLevels;
|
||||
|
||||
return Desc;
|
||||
}
|
||||
|
||||
public static CreateTextureDescriptor AsArrayTexture(int Width, int Height, int Elements, SlimDX.DXGI.Format Format, int MipLevels, TextureInitialData InitialData)
|
||||
{
|
||||
CreateTextureDescriptor Desc = new CreateTextureDescriptor();
|
||||
|
||||
Desc.Width = Width;
|
||||
Desc.Height = Height;
|
||||
Desc.Elements = Elements;
|
||||
Desc.Format = Format;
|
||||
Desc.AccessType = ResourceUsage.Default;
|
||||
Desc.InitialData = InitialData;
|
||||
Desc.MipLevels = MipLevels;
|
||||
|
||||
return Desc;
|
||||
}
|
||||
};
|
||||
|
||||
public interface ITexture
|
||||
{
|
||||
string BindingName { get; set; }
|
||||
int TextureWidth { get; }
|
||||
int TextureHeight { get; }
|
||||
int TextureArraySize { get; }
|
||||
SlimDX.DXGI.Format TextureFormat { get; }
|
||||
ShaderResourceView ResourceView { get; }
|
||||
Texture2D Texture2D { get; }
|
||||
|
||||
SlimDX.DataRectangle MapTextureBuffer(MapMode mode);
|
||||
SlimDX.DataRectangle MapTextureBuffer(MapMode mode, int arrayElement);
|
||||
void UnmapTextureBuffer();
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user