Skip to content

feature Request ? Make Vectors POD #19

@Algo-ryth-mix

Description

@Algo-ryth-mix

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()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions