Screen to World matrix

On 01/08/2018 at 20:40, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   R19 
Platform:   Windows  ; Mac  ;  Mac OSX  ; 
Language(s) :     C++  ;


I'm using a library that needs the Viewport to World transform matrix.

I know BaseView::WS() can be used to convert such coordinate, but I can't find anywhere the Matrix used by it.

BaseView::GetMg() is clearly is the Camera matrix, not Screen, and since we have also CS() and SC(), there must be a missing matrix somewhere.


On 02/08/2018 at 03:47, xxxxxxxx wrote:

Hi rsodre, thanks for writing us.

With regard to your question, you can consider to use BaseView::GetMG() to get the view matrix as well the BaseDraw::GetViewMatrix(DRAW_GET_VIEWMATRIX_PROJECTION) to get the projection matrix. From this point on you are provided with all the bricks to construct your needed matrix.
Further details on view/projection/model matrix composition can be found here.

Best, Riccardo

On 02/08/2018 at 18:45, xxxxxxxx wrote:

Got it, thanks!