View Full Version : Access glm::vec3 component by argument?

07-29-2013, 01:51 PM
Is there a way to access one component of a glm vector by argument?


bool greaterThan( const glm::vec3& lhs, const glm::vec3& rhs, const Axis axis )
return lhs.component( axis ) > rhs.component( axis );

Alfonse Reinheart
07-29-2013, 02:48 PM
Yes. You use [] with an integer. As in `lhs[axis]`, where `axis` is an integer.