Mat4 * vec3

I would like to do mat4 * vec3.
I guess I have a few options like

vec3 myvector;

myvector = vec3(mymatrix * vec4(myvector, 0.0));

Do you think this is wasteful?
It might compile to

MOV r0, myvector;
MOV r0.w, 0.0;
DP4 myvector.x, mymatrix[0], r0;
DP4 myvector.y, mymatrix[1], r0;
DP4 myvector.z, mymatrix[2], r0;

I would like to cast mymatrix to a mat3 instead. I want the upper left 3x3.

GLSL Syntax validator says
ERROR: 0:9: ‘constructor’ : constructing matrix from matrix (reserved)
ERROR: 1 compilation errors. No code generated.

if I do

myvector = mat3(mymatrix) * myvector;

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.