microsoft / DirectXTK12

The DirectX Tool Kit (aka DirectXTK12) is a collection of helper classes for writing DirectX 12 code in C++
https://walbourn.github.io/directx-tool-kit-for-directx-12/
MIT License
1.45k stars 369 forks source link

Add helper methods for SimpleMath, DirectXHelper, and WICTextureLoader #140

Closed Jimbobicus closed 1 year ago

Jimbobicus commented 1 year ago

Thanks for all your hard work on this project!

I have added some left-hand matrix creation methods to the SimpleMath::Matrix class.

I also added UAV and RTV creation for textures, along with SRV and UAV creation for buffer resources.

Finally I added a couple methods to the WIC texture loading for creating a texture array from a list of file names.

Jimbobicus commented 1 year ago

@microsoft-github-policy-service agree

walbourn commented 1 year ago

Thank you for taking the time to contribute to DirectX Tool Kit!

A few notes on this PR:

  1. SimpleMath Matix methods are by design RH only. It is intended to replicate the XNA Game Studio math library which also was RH only. The SimpleMath types are trivially interoperable with DirectXMath, so per the wiki you can just use the LH matrix construction functions in DirectXMath directly.

  2. The WICTextureLoader functionality for array textures is interesting, but I'm not sure I understand the scenario. Generally for complex textures like texture arrays, you should do additional processing and probably Block Compression to keep their memory footprint down. The DirectXTex texassemble tool supports a number of these operations and you can then combine the output with texconv to do compression. The resulting DDS can be simply loaded with the DDSTextureLoader. Why in particular do you want to build up an array texture at runtime from generic images?

  3. The additional creation helpers are interesting. I'll provide some additional feedback in a code review, but I'm happy to merge those functions and address the feedback for you.

walbourn commented 1 year ago

Merged the DirectXHelpers updates with my feedback included:

https://github.com/microsoft/DirectXTK12/commit/01b3224de1ea471d7d5ca6876cf2118f1f510c72

Also updated the test suite to validate these:

https://github.com/walbourn/directxtk12test/commit/87343af9b60772831f02d422ade2b1b4de60d382

Updated the documentation:

https://github.com/microsoft/DirectXTK12/wiki/DirectXHelpers#view-helpers

walbourn commented 1 year ago

For the SimpleMath LH scenario, I've updated the docs with a bit more detail to make it clear which function to use. The C++ ctors and conversion operators take care of everything else for you when mixing Vector3 and Matrix types.

https://github.com/Microsoft/DirectXTK/wiki/SimpleMath#coordinate-systems

Jimbobicus commented 1 year ago

Thanks for the merge!

My comments on your notes:

  1. Apparently I should have been more thorough in my reading of the documentation.

  2. Loading the texture arrays was my attempt to do things the hard way. Again, a lack of reading documentation.

  3. I'm glad I had something useful to contribute. 😀