directxmesh-usage
Skill860 starsChanged 4 months agoMITView on GitHub
Guide for integrating the DirectXMesh geometry processing library into a C++ project.
In this repository3 other files it gives its agents.
- .github/copilot-instructions.mdCopilot instructions
- Release ProcessSkill
- mesh-converterSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 0 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 66
Use directxmesh_desktop_win10 for Win32 desktop applications or directxmesh_uwp for UWP apps.
- Very specific: line 70
Add the appropriate .vcxproj from the DirectXMesh/ folder to your solution and add a project reference.
- Very specific: line 81
All functions reside in the DirectX namespace.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
DirectXMesh Usage Guide
This skill provides guidance for integrating the DirectXMesh geometry processing library into a C++ project.
When to Use
Invoke this skill when:
- Adding DirectXMesh as a dependency to a new or existing project.
- Writing code that processes mesh geometry (normals, tangents, optimization, meshlets).
- Needing to understand the typical DirectXMesh processing pipeline.
Overview
DirectXMesh is a geometry processing library for Direct3D 11 and Direct3D 12 applications. It provides support for loading and saving mesh data, and performing various geometry processing operations including normal and tangent computation, adjacency generation, and mesh optimization.
- Repository: https://github.com/microsoft/DirectXMesh
- Documentation: https://github.com/microsoft/DirectXMesh/wiki
- NuGet Packages:
directxmesh_desktop_win10,directxmesh_uwp - vcpkg Port:
directxmesh
Integration Methods
vcpkg manifest-mode (Recommended)
In your vcpkg.json file, add the following:
{
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json",
"dependencies": [
"directxmesh"
]
}vcpkg (classic)
vcpkg install directxmeshFeatures: dx12 (DirectX 12 input layout support), tools (command-line tools). Triplets: x64-windows, x64-linux, arm64-windows, etc.
For DLL usage (x64-windows default triplet), define DIRECTX_MESH_IMPORT in your consuming project. For static library usage, use -static-md triplet variants.
CMakeLists.txt:
find_package(directxmesh CONFIG REQUIRED)
target_link_libraries(${PROJECT_NAME} PRIVATE Microsoft::DirectXMesh)NuGet
Use directxmesh_desktop_win10 for Win32 desktop applications or directxmesh_uwp for UWP apps.
Project Reference
Add the appropriate .vcxproj from the DirectXMesh/ folder to your solution and add a project reference. Add the DirectXMesh directory to your Additional Include Directories.
Header Usage
#include <d3d12.h> // or <d3d11_1.h> — include BEFORE DirectXMesh.h
#include "DirectXMesh.h"
using namespace DirectX;All functions reside in the DirectX namespace. Most functions have overloads for both 16-bit and 32-bit index buffers.
Typical Processing Pipeline
flowchart TD
A[Load geometry\npositions, indices, texcoords] --> B
B[GenerateAdjacencyAndPointReps] -->|adjacency, pointRep| C
C[Validate\noptional diagnostics] --> D
D[Clean\nfix bowties, degenerate triangles] -->|dupVerts| E
E[ComputeNormals / ComputeTangentFrame] --> F
F[AttributeSort] -->|faceRemap| G
G[OptimizeFaces] -->|faceRemap| H
H[ReorderIB\napply face remap] --> I
I[OptimizeVertices] -->|vertexRemap| J
J[FinalizeIB + FinalizeVB\napply vertex remap and dupVerts] --> K
K[CompactVB\noptional, remove trailing unused vertices] --> L
L[ComputeMeshlets] -->|"meshlets, uniqueVertexIB (uint8_t), primitiveIndices"| M
M[ComputeCullData\nfor mesh shader GPU culling]Note:
uniqueVertexIBfromComputeMeshletsis a packed buffer ofuint16_toruint32_tindices (matching the original IB format). Reinterpret-cast it to the appropriate type forComputeCullData.
Error Handling
- Most functions return
HRESULT. Check withSUCCEEDED(hr)orFAILED(hr). - Functions marked
noexceptnever throw; they returnE_OUTOFMEMORYorE_INVALIDARGon failure. - Functions using
std::vectororstd::functionmay throw on allocation failure
Key References
- Public API header:
DirectXMesh/DirectXMesh.h— read this for exact signatures and SAL annotations. - API overview table: See
reference/overview.mdin this skill folder. - Wiki documentation: https://github.com/microsoft/DirectXMesh/wiki
- Utility headers:
Utilities/WaveFrontReader.h(OBJ file loading),Utilities/FlexibleVertexFormat.h(legacy FVF conversion).
Platform Notes
- Windows desktop (Win8.1+), UWP, Xbox (GDK), and Linux are supported.
- Non-Windows builds require the DirectX-Headers package and define
USING_DIRECTX_HEADERS. - The library requires C++17 to build but the public API is C++11 compatible.
Further Reading
- Getting Started
- DirectXMesh Wiki
- API Reference
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

