HelixToolkit.Nex.Interop
1.2.0
dotnet add package HelixToolkit.Nex.Interop --version 1.2.0
NuGet\Install-Package HelixToolkit.Nex.Interop -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.Interop" 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.Interop" Version="1.2.0" />
<PackageReference Include="HelixToolkit.Nex.Interop" />
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.Interop --version 1.2.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: HelixToolkit.Nex.Interop, 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.Interop@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.Interop&version=1.2.0
#tool nuget:?package=HelixToolkit.Nex.Interop&version=1.2.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
# HelixToolkit.Nex.Interop
## Overview
`HelixToolkit.Nex.Interop` provides interoperability features for the HelixToolkit-Nex 3D graphics engine, particularly focusing on Vulkan and DirectX integration. This package includes utilities for importing textures and managing viewport interactions.
## Key Components
### IViewportClient
The `IViewportClient` interface provides per-frame data and updates for a `HelixViewport`. Implementations of this interface are set on the viewport's `ViewportClient` dependency property. The viewport calls `Update` each frame before rendering and reads `DataProvider` to obtain the scene data. If `DataProvider` returns `null`, the frame is skipped.
#### Properties
- `IRenderDataProvider? DataProvider`: Gets the render data provider for the current frame. Return `null` to skip the frame.
#### Methods
- `ICameraParamsProvider Update(RenderContext context, float deltaTime)`: Called once per frame before rendering. Use this to update the camera, tick animations, or perform any other per-frame work.
### ImportedVulkanTexture
The `ImportedVulkanTexture` class represents the result of importing a shared DirectX texture into Vulkan. It owns the `VkImage`, `VkDeviceMemory`, `VkImageView`, and `TextureHandle`.
#### Properties
- `TextureHandle Handle`: The texture handle registered in the engine's TexturesPool.
- `VkImage Image`: The imported `VkImage` backed by shared DirectX memory.
- `VkDeviceMemory Memory`: The `VkDeviceMemory` allocated via `ImportMemoryWin32HandleInfoKHR`.
- `VkImageView ImageView`: The `VkImageView` created for the imported image.
### ViewportMouseButton
The `ViewportMouseButton` enum identifies a mouse button for viewport camera interaction bindings. It is used to configure which button triggers rotate, pan, or zoom actions.
#### Enum Values
- `None`: No mouse button assigned; the action is disabled.
- `Left`: The left mouse button.
- `Middle`: The middle mouse button (wheel click).
- `Right`: The right mouse button.
### ViewportRenderingEventArgs
The `ViewportRenderingEventArgs` class provides read-only event arguments raised by `HelixViewport.BeforeRender` each frame. This event is a notification only — subscribers can use it for diagnostics, debug overlays, or other optional per-frame work.
#### Properties
- `RenderContext RenderContext`: The per-viewport render context (window size, camera, final output texture).
- `float DeltaTime`: Seconds elapsed since the previous frame.
### VulkanExternalMemoryImporter
The `VulkanExternalMemoryImporter` class provides functionality to import a shared DirectX texture handle into Vulkan as a `VkImage` using `VK_KHR_external_memory_win32`.
#### Methods
- `static ImportedVulkanTexture Import(IContext context, nint sharedHandle, VkExternalMemoryHandleTypeFlags handleType, VkFormat format, uint width, uint height)`: Imports a shared handle into Vulkan using `VK_KHR_external_memory_win32`. Creates a `VkImage` with `ExternalMemoryImageCreateInfo`, allocates memory with `ImportMemoryWin32HandleInfoKHR`, and wraps it as a `TextureHandle`.
## Usage Example
```csharp
public class MyViewportClient : IViewportClient
{
public IRenderDataProvider? DataProvider { get; private set; }
public ICameraParamsProvider Update(RenderContext context, float deltaTime)
{
// Update camera or animations here
return new MyCameraParamsProvider();
}
}
// Usage in a HelixViewport
var viewport = new HelixViewport();
viewport.ViewportClient = new MyViewportClient();
This example demonstrates how to implement the IViewportClient interface to provide custom per-frame updates and data to a HelixViewport.
| 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.Vulkan (>= 1.2.0)
- HelixToolkit.Nex.Rendering (>= 1.2.0)
NuGet packages (4)
Showing the top 4 NuGet packages that depend on HelixToolkit.Nex.Interop:
| Package | Downloads |
|---|---|
|
HelixToolkit.Nex.Interop.DirectX
Package Description |
|
|
HelixToolkit.Nex.Avalonia
Package Description |
|
|
HelixToolkit.Nex.WinUI
Package Description |
|
|
HelixToolkit.Nex.Wpf
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.2.0 | 145 | 7/17/2026 |