Error in shader that says that x is not a member of mat4

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By jakhh8

Im writing a shader where i need to use the world normal of an object ad i have read that i can calculate that by multiplying NORMAL by the x, y and z components of INV_CAMERA_MATRIX.x, .y and .z but it throws this error:
Invalid member for mat4 expression: .x

It says the error is from line 3

void vertex()
{
	vec4 invcamx = INV_CAMERA_MATRIX.x; // The error is here
	vec4 invcamy = INV_CAMERA_MATRIX.y;
	vec4 invcamz = INV_CAMERA_MATRIX.z;
	vec4 invcamw = INV_CAMERA_MATRIX.w;

	mat3 invcam = mat3(invcamx.xyz, invcamy.xyz, invcamz.xyz);

	worldNormal = NORMAL * invcam;
}
:bust_in_silhouette: Reply From: njamster

“For matrices, use m[row][column] indexing syntax to access each scalar, or m[idx] for access a vector by row index. For example, for accessing y position of object in mat4 you must use m3 syntax.” (Source)