PDA

View Full Version : camera position



giuseppe500
08-04-2011, 03:43 AM
hello.
I'm working on a webgl project.
I have this function


CalcMatrix: function () {
this.LoadPerspectiveMatrix();
//alert(this.m_left + "_" + this.m_right + "_" + this.m_bottom + "_" + this.m_top + "_" + this.m_zNear + "_" + this.m_zFar);
this.m_MVmatrix = mat4.ortho(this.m_left, this.m_right, this.m_bottom, this.m_top, this.m_zNear, this.m_zFar);

mat4.multiply(this.m_MVmatrix, this.m_CurrentRotationMatrix);

// mat4.multiply(this.GetWorldMatrix(), this.GetViewMatrix(), this.m_MVmatrix);

this.m_InvMatrix = mat3.create();
mat4.toInverseMat3(this.m_MVmatrix, this.m_InvMatrix);
mat3.transpose(this.m_InvMatrix);
this.m_render.UpdateFromCamera(this);
}

that i using to calculate the matrixes
this:
[CODE]
this.m_InvMatrix = mat3.create();
mat4.toInverseMat3(this.m_MVmatrix, this.m_InvMatrix);
mat3.transpose(this.m_InvMatrix);
[CODE]

returns the inverse view matrix.
is possible to get the camera position from it?

thanks.