Содержание
The DirectXMesh library does not include file I/O operations for reading or writing geometry, and is focused on processing memory buffers of indices and vertices. The primary reason for this design decision is that there are numerous geometry formats all of which have various pros and cons, and it is extremely difficult to write a policy-neutral, generally useful mesh library that presumes specific formats are in use.
There are a number of geometry container formats that are in common use with Direct3D:
Autodesk FBX
The Autodesk FBX file format is an interchange format for 3D assets. It is extremely useful as a source file format, but makes a poor runtime format as it's far too heavy-weight. The most common use of the FBX SDK is to create exporters that extract the needed data and writing to the a custom runtime format.
CMO
Compiled Mesh Object (CMO) is a simple runtime format that is supported by the Visual Studio content pipeline (introduced in VS 2012). This support provides the ability for Visual Studio to build a CMO from an Autodesk FBX, Collada DAE, or Wavefront OBJ file.
CMO is supported as a runtime format for DirectXTK's Model class.
Visual Studio Starter Kit (VSD3DStarter.h)
Visual Studio content pipeline
DirectX Tool Kit (ModelLoadCMO.cpp)
To aid in debugging, here is a simple console program for dumping out the content of a CMO in a human-readable form.
Collada DAE
Collada DAE is a interchange format for 3D assets that is useful as a source format, but makes a poor choice as a runtime format.
glTF
GL Transmission Format 2.0 is an open source 3D asset format that consist of a JSON text file and binary blob files. It's gaining adoption in game engines due to the fact that it natively uses a Physically Based Rendering (PBR) shader model.
SDKMesh
The SDKMesh format is a sample runtime format that was created for Direct3D 10 as a replacement for the legacy X File format for use in the DirectX SDK samples.
SDKMESH is supported as a runtime format by DXUT's CDXUTSDKMesh loader class and DirectXTK's Model class.
SDKMESH v2 was introduced for use with the DirectX Tool Kit for DX11 / DX12 to support PBR materials definitions instead of traditional diffuse/specular materials.
To aid in debugging, here is a simple console program for dumping out the content of a SDKMESH/SDKMESH_ANIM file in a human-readable form.
See SDKMESH
VBO
Vertex Buffer Object (VBO) is an extremely simple mesh format originally defined by the Windows 8.0 Resource Loading sample.
VBO is supported as a runtime format for DirectXTK's Model class.
To aid in debugging, here is a simple console program for dumping out the content of a VBO in a human-readable form.
See VBO
Wavefront OBJ
Alias Wavefront OBJ is a text-based geometry format. It's simple format makes it simple to parse, and is useful as a simple source file format. The parsing costs make it a poor choice for a runtime format.
The Visual Studio content pipeline supports this as a source format for creating CMO files.
Example Code
See the Utilities folder in the distribution.
X File
The X file format refers to files with the .x file name extension. X files were introduced with DirectX 2.0. A binary version of this format was subsequently released with DirectX 3.0, which is also described in this documentation. DirectX 6.0 introduced interfaces and methods that enable reading from and writing to .x files. Support was maintained through Direct3D 9, but was deprecated for Direct3D 10 and later.
The XFile APIs are only supported by the legacy DirectX SDK in the D3DX9 DLL.
The binary version of X files were intended as a runtime format, but the text version of X files have become a source file used by various community model libraries, and is supported by various freeware tools.
See Microsoft docs
For Use
- Universal Windows Platform apps
- Windows desktop apps
- Windows 11
- Windows 10
- Windows 8.1
- Windows 7 Service Pack 1
- Xbox One
- Xbox Series X|S
- Windows Subsystem for Linux
For Development
- Visual Studio 2022
- Visual Studio 2019 (16.11)
- clang/LLVM v12 - v18
- GCC 10.5, 11.4, 12.3
- MinGW 12.2, 13.2
- CMake 3.20
Related Projects
DirectX Tool Kit for DirectX 11
DirectX Tool Kit for DirectX 12
Tools
See also
All content and source code for this package are subject to the terms of the MIT License.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.