microsoft / DirectXMesh

DirectXMesh geometry processing library
https://walbourn.github.io/directxmesh/
MIT License
786 stars 152 forks source link

Meshconvert support for importing X files #8

Open walbourn opened 9 years ago

walbourn commented 9 years ago

The original DirectX SDK tool meshconvert imported from legacy .X files and produced .sdkmesh files.

The meshconvert sample currently supports importing from Wavefront OBJ and VBO files, and can export VBO, CMO, and SDKMESH.

Ideally it would also support importing from legacy .X format files as well.

This would either require an extensive parser implementation or simply using the legacy DirectX SDK / DirectSetup deployed D3DX9_43 DLL if it is present.

AraHaan commented 7 years ago

What about converting text based .X files to binary based ones for importing to things like a game that only reads and accepts binary based ones? I know of a game that uses the Direct X 9.0c stuff and so yeah I have to sadly target that version of the format as well. So, having an option to export the newer format .X files to the legacy 9.0c format could be beneficial as well to me and probably others as well.

AraHaan commented 7 years ago

Also if I even knew the proper code I needed for that version of direct X as I never used the code side version of Direct X before nor even understand the obfuscated docs on it. I would make an simple command line tool to save binary .x model files to text, binary to binary compressed, binary compressed ro binary, binary to text, binary compressed to text, or even text to binary compressed. Such conversion is great for things like converting modified game model files that only export the data to text so that way you can convert it to a form the game can read and not go and say things like "An important file was corrupted. Please repair the game using the launcher." All because the saved model data is not in the right form. Hence the reason for the converter in the first place.

AraHaan commented 7 years ago

Maybe what I am searching for is something that can compile or convert the text based versions to something more runtime based. And also a way to also convert them back when needed.

walbourn commented 3 years ago

https://github.com/TheLegendOfMataNui/SAGESharp/blob/master/SAGESharp/XFile.cs

walbourn commented 3 years ago

Thanks to Microsoft.DXSDK.D3DX, I'm taking a look at this in this branch. This NuGet package resolves dependencies on the legacy DirectX SDK and the legacy DirectX End User Runtime with a simple side-by-side deployment license.

Note my implementation is using the XFile API directly (which is hosted in the D3DX9 DLL) rather than using D3DX9's Mesh class as an intermediary.