Is there a way to access one component of a glm vector by argument?
Example:
bool greaterThan( const glm::vec3& lhs, const glm::vec3& rhs, const Axis axis )
{
return lhs.component( axis ) > rhs.component( axis );
}
Is there a way to access one component of a glm vector by argument?
Example:
bool greaterThan( const glm::vec3& lhs, const glm::vec3& rhs, const Axis axis )
{
return lhs.component( axis ) > rhs.component( axis );
}
Yes. You use [] with an integer. As in lhs[axis]
, where axis
is an integer.