Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

XNA namespace build option #6

Closed
wants to merge 2 commits into
from

Conversation

Projects
None yet
3 participants

Hi Michael,

Can you tell me if you plan to accept my fork changes that implement a XNA namespace replacement option.
This is useful for projects that use the XNA math but want' to be cross platform ( Mono).

Thanks,

Sérgio

XTZGZoReX and others added some commits Jan 22, 2011

Owner

mhutch commented Jun 22, 2011

The goal of Mono.GameMath is to be a source-compatible superset of the XNA maths classes. Since it's source-compatible, not binary-compatible, any code that uses it will have to be recompiled, so it IMO would make more sense to put the namespace #ifdefs in the consuming code. If you're looking for binary compatibility, I'd suggest MonoGame or MonoXNA.

Your other changes would be very useful though, so if you can separate them into smaller patches I'd love to review and integrate them. Can you confirm that you haven't looked at decompiled XNA source code?

For me being source compatible implies that the consuming code doesn't need to be adapted. So I think the #ifs are useful in the implementing code.

And since his SmoothStep function is a separate commit you should be able to integrate it separately.

I share the same opinion of CodeInChaos to be truly source compatible the consuming code shouldn't be changed. My test case for the MonoGameMath library was using it in JibLibX library. It wasn't feasible to change all the JigLibX to use the new namespace.

Regarding the code it was based on the MonoGame, MonoXNA, and the Axiom Math library.

mhutch commented on d01c717 Jun 25, 2011

  1. If I read this correctly, it seems to be just the addition of a Clamp, and factoring out of a Lerp. Since those are both trivial functions and the JIT does a poor job of inlining, I'd prefer to have them inlined here (in particular, a clamp should be little more than two x86 instructions - Max and Min are intrinsics).

  2. The Clamp change should be made to all the other SmoothStep functions too.

Owner

mhutch commented Jun 25, 2011

You're technically correct, but the other problem with changing the namespace is that it requires having an alternative version of all of the assemblies. So "Mono.GameMath" is still not truly source-compatible, but "MonoGameMath (XNA-namespaced variant)" is. I'll accept the defines, but instead of adding configurations I'd prefer to have a separate library project called Mono.GameMath.XnaCompat (it can simply Mono.GameMath and override some properties). I can do that part if you want.

Regarding SmoothStep, I commented directly on that commit. Regarding the other code, I would prefer if any that was sourced from other places had a comment attributing the source and stating the license.

I think an alternate version of the library that's used for XNA compatibility is a good idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment