Content


NTL
Core
CStorePrimitiveMatrix

CStorePrimitiveMatrix


This helper class provides shorter alternative for saving and restoring active primitive matrix in renderer.

Instead of using code like below

Mat4f *old_matrix_ptr{ renderer->ActivePrimitiveMatrix }, old_matrix;
if (old_matrix_ptr)
{
    old_matrix = *old_matrix_ptr;
    old_matrix_ptr = &old_matrix;
}
...
// Change active primitive matrix in renderer 
...
renderer->ActivatePrimitiveMatrix(old_matrix_ptr);

you may shorten it to the following one.

CStorePrimitiveMatrix store{ renderer };
...
// Change active block in renderer 
...
class CStorePrimitiveMatrix final
{
public:
    CStorePrimitiveMatrix(IRenderer *renderer);
    ~CStorePrimitiveMatrix();
};
Namespace: nitisa
Include: Nitisa/Render/StorePrimitiveMatrix.h