sharoz's picture

Add Vector[234]i structs

Project:The Open Toolkit library
Category:feature request

Per Fiddler's suggestion, the struct will be a minimal implementation like Vector[234]h.

The purpose for adding these structs is to make storing and passing shader uniforms consitent for ints and floats.


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture


It's mostly a matter of reducing duplication and simplifying maintenance. Keeping the documentation and code in sync is already a nightmare (fixes have to be kept in sync between Vector2, Vector3, Vector4, Vector2d, Vector3d, Vector4d, two overloads each) and I don't want to imagine how things would be with twice as many structures...

zahirtezcan's picture


I have pruned the multiply/divide/dot functionality, copied and expanded for 3/4 versions. Plus, i have attached a file named IntegerVectors which contains the no-operators version of the vectors

note: I need; equatable for generic equals functionality, ToString method for ease of debugging (VS parameter preview), GetHashCode for dictionary usage. So I kept them. I was not sure about static fields, but they were really nice for floating point versions by ease of initialization.

IntegerVectors.cs22.73 KB
Vector4ui.cs11.65 KB
Vector4i.cs13 KB
Vector3ui.cs10.9 KB
Vector3i.cs12.22 KB
Vector2ui.cs10.15 KB
Vector2i.cs11.43 KB