Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature Request ? Make Vectors POD #19

Open
Algo-ryth-mix opened this issue Jul 18, 2018 · 2 comments
Open

feature Request ? Make Vectors POD #19

Algo-ryth-mix opened this issue Jul 18, 2018 · 2 comments

Comments

@Algo-ryth-mix
Copy link

In order to allow the Vertecies to be uploaded to the GPU without side-effects directly it would be beneficial to make Vector3 and Vector2 POD types.

eg.: instead of:

struct Vector2
{
[...]
		// Bool Equals Operator Overload
		bool operator==(const Vector2& other) const
		{
			return (this->X == other.X && this->Y == other.Y);
		}
[...]
     float x,y,z;
};

like this:

struct Vector2
{
     float x,y,z;
};

inline bool operator==(const Vector2& lhs,const Vector2& rhs)
{
	return (lhs.X == rhs.X && lhs.Y == rhs.Y);
}

Although a little more complicated, it allows the compiler to more efficiently pack the data and thus one could directly generate vertexArrays by using offsetof()

@Bly7
Copy link
Owner

Bly7 commented Jul 18, 2018

Thanks for the request. I'll definitely look into it.

@Algo-ryth-mix
Copy link
Author

Algo-ryth-mix commented Jul 18, 2018

I have a version how this could look in my local fork Algo-ryth-mix@f338a0e, im not too good at the whole github thing tho so maybe you can help out with that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants