agentleFS
MicrosoftKnown publishermicrosoft/DirectXMesh/skills/directxmesh-usage/SKILL.md

directxmesh-usage

Skill860 starsChanged 4 months agoMITView on GitHub

Guide for integrating the DirectXMesh geometry processing library into a C++ project.

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
  1. Very specific:

    Use directxmesh_desktop_win10 for Win32 desktop applications or directxmesh_uwp for UWP apps.

    line 66
  2. Very specific:

    Add the appropriate .vcxproj from the DirectXMesh/ folder to your solution and add a project reference.

    line 70
  3. Very specific:

    All functions reside in the DirectX namespace.

    line 81

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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.

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 directxmesh

Features: 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: uniqueVertexIB from ComputeMeshlets is a packed buffer of uint16_t or uint32_t indices (matching the original IB format). Reinterpret-cast it to the appropriate type for ComputeCullData.

Error Handling

  • Most functions return HRESULT. Check with SUCCEEDED(hr) or FAILED(hr).
  • Functions marked noexcept never throw; they return E_OUTOFMEMORY or E_INVALIDARG on failure.
  • Functions using std::vector or std::function may 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.md in 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

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.