Right now i pass my light position to shader via vec3, then i calculate the:
vec3 vertexPos = vec3( m_View * m_Model * gl_Vertex );
vec3 n = normalize(vec3( m_View * m_Model * vec4(gl_Normal, 0.0)));
vec3 t = normalize(gl_NormalMatrix * gl_MultiTexCoord7.xyz);
vec3 b = cross(n, t) * gl_MultiTexCoord7.w;
mat3x3 tbnMatrix = mat3x3(t.x, b.x, n.x,
t.y, b.y, n.y,
t.z, b.z, n.z);
viewDir = tbnMatrix * -vertexPos;
lightDir=tbnMatrix*((gl_LightSource[0].position.xyz - vertexPos.xyz)/radius)
and pass what is required to fragment to lit the surface properly. Works great.
What i would like to do is to pass a light position as a mat4x4 - to have all my transformations in engine stored as matrices.
Of course i would need to forget about gl_LightSource[xxx] and put my own structure into shader, what i already have prepared.
I also have my lights positions stored in matrices, so all is really required is to rewrite the above to run calcs on mat4x4 instead of vec3.
The calculations are the thing here, is it possible to pass mat4x4 instead of vec3 for light position and have the calcs done?
If not, how can i achieve a vec3 out of a mat4x4 ?
Thanks!