HelixToolkit.Nex.Textures
1.2.0
dotnet add package HelixToolkit.Nex.Textures --version 1.2.0
NuGet\Install-Package HelixToolkit.Nex.Textures -Version 1.2.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="HelixToolkit.Nex.Textures" Version="1.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="HelixToolkit.Nex.Textures" Version="1.2.0" />
<PackageReference Include="HelixToolkit.Nex.Textures" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add HelixToolkit.Nex.Textures --version 1.2.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: HelixToolkit.Nex.Textures, 1.2.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package HelixToolkit.Nex.Textures@1.2.0
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=HelixToolkit.Nex.Textures&version=1.2.0
#tool nuget:?package=HelixToolkit.Nex.Textures&version=1.2.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
# HelixToolkit.Nex.Textures
The `HelixToolkit.Nex.Textures` package is a comprehensive suite for handling texture data within the HelixToolkit-Nex 3D graphics engine. It provides functionality for loading, manipulating, and saving various image formats, as well as creating GPU textures from CPU-side image data. This package is essential for developers working with textures in 3D graphics applications using the HelixToolkit-Nex engine.
## Overview
The `HelixToolkit.Nex.Textures` package is responsible for:
- Loading and saving image data in multiple formats (e.g., DDS, PNG, JPG).
- Managing pixel data with the `Image` class, which acts as a container for texture data.
- Providing utilities for creating GPU textures from images.
- Supporting operations like mipmap generation and texture dimension management.
- Offering a fluent API for combining multiple images into a single texture using the `OmrTextureCombiner`.
This package integrates seamlessly with the HelixToolkit-Nex engine, leveraging its ECS architecture and rendering capabilities to manage textures efficiently.
## Key Types
| Type | Description |
| -------------------- | -------------------------------------------------------------------------------- |
| `ChannelComponent` | Enum identifying a single color channel within a pixel. |
| `ChannelSource` | Abstract class describing the source of a channel value for texture combination. |
| `DDSCodec` | Internal static class for handling DDS image format encoding and decoding. |
| `IImageDecoder` | Interface for pluggable image decoders/encoders. |
| `Image` | Class representing a CPU-side container for pixel data. |
| `ImageDescription` | Struct describing the dimensions, format, and layout of a texture image. |
| `OmrTextureCombiner` | Class for combining multiple PBR source images into a single OMR texture. |
| `PitchCalculator` | Static utility for computing row pitch, slice pitch, and mipmap level counts. |
| `TextureCreator` | Static utility for creating GPU textures from CPU-side image data. |
## Usage Examples
### Loading and Saving Images
```csharp
// Load an image from a file
Image? image = Image.Load("texture.png");
// Save the image to a different format
if (image != null)
{
image.Save("texture.dds", ImageFileType.Dds);
}
Creating a GPU Texture
// Assume 'context' is a valid IContext instance
Image? image = Image.Load("texture.png");
if (image != null)
{
using (image)
{
TextureResource texture = TextureCreator.CreateTexture(context, image, generateMipmaps: true, "MyTexture");
}
}
Creating a GPU Texture Asynchronously
// Assume 'context' is a valid IContext instance
Image? image = Image.Load("texture.png");
if (image != null)
{
using (image)
{
var (result, texture, uploadHandle) = TextureCreator.CreateTextureAsyncWithResource(context, image, generateMipmaps: true, "MyTexture");
if (result == ResultCode.Ok)
{
// Use texture and await uploadHandle if needed
}
}
}
Combining Textures
var combiner = new OmrTextureCombiner()
.WithOcclusion("occlusion.png", ChannelComponent.R)
.WithMetallic("metallic.png", ChannelComponent.G)
.WithRoughnessFromGloss("gloss.png", ChannelComponent.B);
Image combinedImage = combiner.Combine();
combinedImage.Save("combined_omr.png", ImageFileType.Png);
Architecture Notes
- Design Patterns: The package uses a fluent builder pattern for the
OmrTextureCombinerto facilitate easy configuration of texture channels. - Dependencies: It relies on the
HelixToolkit.Nex.Graphicspackage for GPU texture creation and management. - Integration: The package is designed to work within the HelixToolkit-Nex engine's ECS architecture, allowing for efficient texture management and rendering.
- Performance: Utilizes GPU-based operations for efficient texture processing, including mipmap generation and texture uploads.
Build Configurations
The project now supports additional build configurations for Linux:
LinuxDebugLinuxRelease
These configurations allow for building and testing the package on Linux environments, expanding the versatility and deployment options for developers using the HelixToolkit-Nex engine.
| 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- HelixToolkit.Nex.Graphics (>= 1.2.0)
- SixLabors.ImageSharp (>= 3.1.12)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on HelixToolkit.Nex.Textures:
| Package | Downloads |
|---|---|
|
HelixToolkit.Nex.Repository
Package Description |
|
|
HelixToolkit.Nex.Material
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.2.0 | 277 | 7/17/2026 |