I\'m writing a matrix 3x3 class in c++.
glm::mat3 provides access to matrix data through the [][] operator
syntax.
e.g. myMatrix[0][0] = 1.0f;
There is no [][]
operator. The way GLM does it is by returning a vec3&
from the first []
. vec3
has its own []
operator overload. So it's two separate operator[]
s on two separate classes.
This is also how GLSL works. The first []
gets the column as a vector. The second takes the vector and gets the value from it.