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()
In order to allow the Vertecies to be uploaded to the GPU without side-effects directly it would be beneficial to make
Vector3andVector2POD types.eg.: instead of:
like this:
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()