Giter Site home page Giter Site logo

Comments (7)

sbarisic avatar sbarisic commented on May 12, 2024 1

The order of the matrix elements should match OpenGL as far as i know, for anything else it would be enough to just transpose them before doing calculations.

Another way to make this less painful is to add an implicit cast to/from System.Numerics vectors.

from raylib-cs.

ChrisDill avatar ChrisDill commented on May 12, 2024 1

@sbarisic There is now a numerics branch for this feature. I discussed it with @9ParsonsB and we decided that keeping this feature compatible is not possible so it is being tested as a breaking change. So far Vector2, Vector3 and Vector4 have been replaced.

Matrix4x4 has a different layout but transposing the matrix works for going from the numerics layout to the raymath and vice versa.

from raylib-cs.

ChrisDill avatar ChrisDill commented on May 12, 2024

@sbarisic That sounds interesting though I don't plan to change the vector and matrix types at the moment. Ideally a feature like this would be optional for those who want it.

from raylib-cs.

ChrisDill avatar ChrisDill commented on May 12, 2024

I have looked into this feature but I am currently unsure on the best way to proceed.
I tried to use System.Numerics in a test project to see how what users need to do to switch to it.

  1. Add using System.Numerics in every file that uses these types.

  2. Change fields like .x, .y, .z etc to .X, .Y, .Z etc.

This is a pain to do especially in a larger project so I looked to see if there was a easier way to make this a optional/non breaking change.

The only possible solution I found is to wrap the System.Numerics types in my own types and provide properties for access. This "might" work but I feel that defeats the idea of it as you need to convert/access the type manually when using external code that uses System.Numerics.

Another possible concern is with the Matrix. I need to look into the ordering of the fields to see if conflicts with how the raylib Matrix works. I do not think it makes sense to add System.Numerics only for Vector types but not Matrices as that will just make things more confusing for new users.

from raylib-cs.

sbarisic avatar sbarisic commented on May 12, 2024

It would be possible to create a wrapper over System.Numerics types and use implicit casts to automatically return internal type, but that pretty much defeats the purpose and makes it slower.

from raylib-cs.

9ParsonsB avatar 9ParsonsB commented on May 12, 2024

@ChrisDill I Wouldn't too much about adding/chaning usings in every file - I believe VS can do it now for you anyway.

from raylib-cs.

matej-zajacik avatar matej-zajacik commented on May 12, 2024

I'm undecided on the switch to the standard System.Numerics types (not sure of the benefits), but as far as breaking changes go, that shouldn't be a problem, should you decide to make the switch. It takes just minutes, maybe tens of minutes to adjust a project.

from raylib-cs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.