Understanding the matrix

The osg::Matrix is a basic OSG data type which needs not be managed by smart pointers. It supports an interface for 4x4 matrix transformations, such as translate, rotate, scale, and projection operations. It can be set explicitly:

osg::Matrix mat( 1.0f, 0.0f, 0.0f, 0.0f,
                 0.0f, 1.0f, 0.0f, 0.0f,
                 0.0f, 0.0f, 1.0f, 0.0f,
                 0.0f, 0.0f, 0.0f, 1.0f ); // Just an identity matrix

Other methods and operators include:

  1. The public methods postMult() and operator*() post multiply the current matrix object with an input matrix or vector parameter. And the method preMult() performs pre-multiplications.
  2. The makeTranslate(), makeRotate(), and makeScale() methods reset the current matrix and create a 4x4 translation, rotation, or scale matrix. ...

Get OpenSceneGraph 3.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.