HelixToolkit.Nex.Wpf
1.2.0
dotnet add package HelixToolkit.Nex.Wpf --version 1.2.0
NuGet\Install-Package HelixToolkit.Nex.Wpf -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.Wpf" 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.Wpf" Version="1.2.0" />
<PackageReference Include="HelixToolkit.Nex.Wpf" />
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.Wpf --version 1.2.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: HelixToolkit.Nex.Wpf, 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.Wpf@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.Wpf&version=1.2.0
#tool nuget:?package=HelixToolkit.Nex.Wpf&version=1.2.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
# HelixToolkit.Nex.Wpf
HelixToolkit.Nex.Wpf is a package designed to integrate the HelixToolkit.Nex 3D graphics engine with Windows Presentation Foundation (WPF) applications. It provides a seamless way to render 3D content within WPF applications using the Vulkan API, leveraging Direct3D9 for interop with WPF's D3DImage.
## Overview
HelixToolkit.Nex.Wpf bridges the gap between the HelixToolkit.Nex engine and WPF, allowing developers to embed high-performance 3D graphics into their WPF applications. The package utilizes Direct3D9 for creating shared textures that can be used as back buffers in WPF, and Vulkan for rendering. This setup enables efficient rendering and resource sharing between the graphics engine and the WPF UI.
Key concepts include:
- **D3D9 and Vulkan Interop**: Uses Direct3D9 to create shared textures for WPF's D3DImage, which are then imported into Vulkan for rendering.
- **Viewport Management**: Provides a `HelixViewport` control for hosting 3D content, supporting multiple viewports sharing a single engine instance.
- **Dependency Properties**: Simplifies the creation and management of dependency properties within WPF.
## Key Types
| Type | Description |
|--------------------------|-----------------------------------------------------------------------------|
| `D3D9DeviceManager` | Manages the D3D9 context and device for WPF D3DImage interop. |
| `HelixProperty` | Provides static methods to register dependency properties and attached properties. |
| `HelixViewport` | A WPF control that hosts the HelixToolkit.Nex 3D engine output. |
## Usage Examples
### Creating a HelixViewport
```csharp
var viewport = new HelixViewport();
// Handle viewport events and rendering logic
Registering a Dependency Property
public static readonly DependencyProperty MyProperty = HelixProperty.Register<MyControl, int>(
"MyProperty",
0,
isTwoWayBinding: true
);
Managing D3D9 Device
using (var deviceManager = new D3D9DeviceManager())
{
var context = deviceManager.Context;
var device = deviceManager.Device;
// Use context and device for rendering operations
}
Architecture Notes
- Design Patterns: The package employs the Factory pattern for creating shared textures and importing them into Vulkan. It also uses the Observer pattern for event handling in the
HelixViewport. - Dependencies: Relies on the Vortice.Direct3D9 library for Direct3D9 operations and the HelixToolkit.Nex engine for Vulkan rendering.
- Interop Strategy: Utilizes VK_KHR_external_memory_win32 for sharing textures between Direct3D9 and Vulkan, ensuring efficient resource management and rendering performance.
Recent Changes
- Platform Support Update: The project now conditionally targets
net8.0-windowsfor Windows platforms andnet8.0for Linux platforms, reflecting improved cross-platform compatibility. - HelixViewport Rendering Update: The
Rendermethod now requires the imported texture handle as a parameter to ensure the correct texture is used during rendering. This change improves the clarity and correctness of the rendering process by explicitly passing the texture handle. - Configuration Management: Added explicit configuration management with
DebugandReleaseconfigurations to streamline build processes. - Gamma Correction: Enabled gamma correction in the
HelixViewportby default to improve color accuracy in rendered scenes. - Resource Management: Added
EnsureSizemethod inHelixViewportto handle dynamic resizing of resources, ensuring the viewport adapts to size changes efficiently. - Event Handling Update: Removed the
BeforeRenderevent fromHelixViewportto streamline the rendering process and reduce complexity. - D3DImage Management: Improved D3DImage locking and unlocking logic to ensure thread safety and rendering correctness.
- Project Reference Update: Added a project reference to
HelixToolkit.Nex.Interopto facilitate shared resource management across different platform targets.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0-windows7.0 is compatible. net9.0-windows 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-windows7.0
- HelixToolkit.Nex.Engine (>= 1.2.0)
- HelixToolkit.Nex.Interop (>= 1.2.0)
- HelixToolkit.Nex.Interop.DirectX (>= 1.2.0)
- Vortice.Direct3D9 (>= 3.6.2)
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.2.0 | 97 | 7/17/2026 |