Storing a matrix ? (using matrix expressions ?)

Hi,

Is there a way to store a matrix directly, as an attribute or in a chop ?
It seems I have to use explodematrix() to grab the matrix components, but in that case everything gets calculated once for each component ?

I wanted to emulate the “rotate to normal” of the copy sop with hardware instancing, and thus use the mlookat(), translate, rotate function to build the matrices and send them to the shader.

But maybe it would be faster to send the normal and up vector to the shader directly and build the matrix there.

Still curious about the matrix expressions though.
Thanks a lot

Vincent

For those interested, I got it to work in the shader code with the following to build the matrix :

mat4 lookAtMat() {

vec3 translate = texelFetchBuffer(translateBuf, gl_InstanceID).xyz;
vec3 normal = texelFetchBuffer(normalBuf, gl_InstanceID).xyz;


vec3 forward = normalize(-normal);
vec3 nup = normalize(up);
vec3 side = normalize(cross (forward,nup));

nup = normalize(cross(side,forward));

mat4 lookAtMat;

lookAtMat[0] = vec4(side,0.0);
lookAtMat[1] = vec4(nup,0.0);
lookAtMat[2] = vec4(-forward,0.0);
lookAtMat[3] = vec4(translate,1.0);



return lookAtMat;

}