Arkkodan / DreamVsDream

GNU General Public License v3.0
4 stars 0 forks source link

Suggestion: Replace util::Vector and util::Vectorf with glm library #2

Closed Arkkodan closed 3 years ago

Arkkodan commented 3 years ago

OpenGL Mathematics (glm) provides a fairly simple but extensive interface in C++ for the kind of math used in GLSL.

Adding this library may provide glm::vec replacements for vectors in the namespace and make it easier to migrate current GL code from the "fixed function pipeline" to "modern OpenGL."

Arkkodan commented 3 years ago

I'm currently in the middle of migrating to modern OpenGL with shaders. I'm taking small steps at a time, first converting the existing shader vertex and fragment program for rendering fighters into GLSL 330 core.

One issue involves replacing the matrix calls to fixed function into uniforms, in particular, making the mat4 object for the MVP matrix. I will try to add glm as needed to simplify calculations.

Arkkodan commented 3 years ago

I've successfully moved all raw draw calls into shader programs I modified and wrote. It's not in a very clean state and there is obvious room for improvement, but at this point, I am satisfied with the current behavior. That is, I have migrated into modern OpenGL without disrupting the original render.

It turns out I did not need glm yet. In the future, I may want to add it to simplify calculations. I will merge this with develop and close this issue but add a "help wanted" label to remind myself to add glm should I need to do so.

Arkkodan commented 3 years ago

I have added glm and made some changes to the logic inside Dream vs. Dream. All util::Vector objects have been replaced by glm::ivec2 and all util::Vectorf objects have been replaced by glm::vec2. Obviously, more could be done inside the graphics and rendering logic to clean up.