sharpdx / SharpDX

SharpDX GitHub Repository
http://sharpdx.org
MIT License
1.68k stars 641 forks source link

Why are D3DX9 functions implemented but not publicly exposed? #1066

Closed MainMemory closed 5 years ago

MainMemory commented 5 years ago

I'm trying to convert a project from Managed DirectX to SharpDX so that I can upgrade from .NET 3.5 to .NET 4.7, but I made extensive use of Mesh objects for rendering and mouse picking, and the SharpDX Mesh class has no equivalent Mesh constructor, and it lacks the Box, Sphere, and FromStream functions. After thorough searching, it appears that at least some of the functions I need are implemented, in the internal D3DX9 class in Functions.cs. If you have the functions implemented, why not make them available? It looks like D3D10's version of the Mesh class is much more full-featured, but I know pretty much nothing about shader programming, so that's not really an option for me.

xoofx commented 5 years ago

Because it required lots of manual handling of marshalling and I didn't have any interest in D3D9(X) API.

MainMemory commented 5 years ago

Why even bother implementing D3D9 at all then?

xoofx commented 5 years ago

Because WPF was built on D3D9 and interop with D3D10/D3D11 was required. At that time also, it was a proof of concept for the automatic codegen to check that even the older D3D9 API could be mostly mapped to C# automatically... mostly because, many parts (like Mesh) was not possible without annotating the existing C/C++ headers or rewriting the codegen manually. I did a bit of that at the beginning but as I was not really going to use D3D9 anyway, I didn't continue further into every corners of the D3D9X API

MainMemory commented 5 years ago

I guess I'll just have to make my own Mesh class for now.

SergeyBaryshev commented 5 years ago

Maybe its too late... MainMemory, you can get those private functions via Reflection and Invoke those methods. In the right hands they will work with your own code.

MainMemory commented 5 years ago

@SergeyBaryshev Yeah, we've already implemented workarounds for all the issues, aside from some texture issues, which should be fixed/fixable when one of our group upgrades the whole thing to D3D11.