Hello,

huiliang yang wrote:
I have a question about computeLocalToWorldMatrix in camera class.
First, since the openscenegraph use row matrix instead column matrix like opengl, I thought the default matrix multiply should be post multiply so that :
      V' = M*V  (opengl premultiply) chanage to
      V' = VT*MT   ( osg post multiply)
Ok
but looks like the camera still use pre_multiply as default, but the _viewmatrix define in camera class is apparently is a row matrix MT.
How do you get to this statement, which section of the code do you refer to?

It also depends on your definition of 'pre-multiply'. If you say VT*MT is "post multiply" (as you do above), then this implies that you actually mean "MT post-multiplies VT". This is turn also means that "VT pre-multiplies MT". So it depends from which operand you look at it how you describe the operation.

Second, even as the default pre_multiply, then let's say:
     V' = M*V  if (_transformOrder==PRE_MULTIPLY)
then its inverse should be
     V = M-1* V' ,
why in function computeWorldToLocalMatrix
Which class? You say "V", which implies a vector usually, but, for example, Camera::computeWorldToLocalMatrix works on a matrix as input. If you indeed refer to Camera::computeWorldToLocalMatrix() then I would say that that method does the inverse operation of computeLocalToWorldMatrix(). Assuming _referenceFrame==RELATIVE_RF and _transformOrder==PRE_MULTIPLY then the method computeLocalToWorldMatrix pre-multiplies its argument "matrix" with "_viewMatrix". I.e.

 matrix.preMult(_viewMatrix);

actually does

 matrix = _viewMatrix * matrix;

Method computeWorldToLocalMatrix() does the inverse of this operation, so instead of pre-multiplying with _viewMatrix it post-multiplies with the inverse of _viewMatrix (the comments also say this).

Regards,
Paul

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to