DirectXTK.NET
1.0.1
dotnet add package DirectXTK.NET --version 1.0.1
NuGet\Install-Package DirectXTK.NET -Version 1.0.1
<PackageReference Include="DirectXTK.NET" Version="1.0.1" />
paket add DirectXTK.NET --version 1.0.1
#r "nuget: DirectXTK.NET, 1.0.1"
// Install DirectXTK.NET as a Cake Addin #addin nuget:?package=DirectXTK.NET&version=1.0.1 // Install DirectXTK.NET as a Cake Tool #tool nuget:?package=DirectXTK.NET&version=1.0.1
DirectXTK.NET
DirectXTK.NET is a .NET wrapper for the DirectX Tool Kit, built using C++/CLI for Silk.NET and DirectX 11.
Features
Currently only methods are wrapped that allow you to quickly load textures for your Silk.NET DirectX 11 project:
- Texture Creation with WICTextureLoader: Load textures from files and obtain shader resource views.
- Texture Creation with DDSTextureLoader: Load textures from *.dds files and obtain shader resource views.
- Texture Saving: Save textures to DDS or WIC formats.
Usage
To use DirectXTK.NET, follow these steps:
- Install via NuGet: Add the package to your project using the .NET CLI:
Or, search fordotnet add package DirectXTK.NET
DirectXTK.NET
in the NuGet Package Manager in Visual Studio. - Initialize DirectX: Create and initialize a DirectX 11 device and context using Silk.NET.
- Use the package: Use the
WICTextureHelper
class to create and save textures or theDDSTextureHelper
class to load.dds
textures.
Example
A simple example that shows how to create and save a texture with DirectXTK.NET:
Loading with WICTextureHelper:
WICTextureHelper.CreateTextureFromFile(device, @"Resources\stone.dds", texture.GetAddressOf(), textureSrv.GetAddressOf());
Loading with DDSTextureHelper:
DDSTextureHelper.CreateDDSTextureFromFile(device, devCtx, @"Resources\sky.dds", 0, Usage.Immutable, (uint)BindFlag.ShaderResource, 0, ResourceMiscFlag.Texturecube, DDSLoaderFlag.Default, texture.GetAddressOf(), textureSrv.GetAddressOf(), DDSAlphaMode.Unknown);
Saving with WICTextureHelper:
WICTextureHelper.SaveWICTextureToFile(devCtx, texture, @"Resources\stone_out.png", ContainerFormat.Png, PixelFormat.Format32bppBGRA, true);
The sample can also be found in the repository under DirectXTKSample.
Development
Feature requests are welcome!
If you have specific feature requests or need additional methods, feel free to open an issue.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net8.0
- Silk.NET.Direct3D11 (>= 2.20.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.1 | 89 | 12/8/2024 |