Re: Model and View matrices

New Message Reply Date view Thread view Subject view Author view

From: Don Burns (don_burns++at++peru.engr.sgi.com)
Date: 02/14/2000 08:19:46


On Feb 13, 8:25pm, Satheesh Ganapathi Subramanian wrote:
> Subject: Model and View matrices
> Hi Performers,
>
> Is there a way I can obtain the current Modeling and Viewing matrices
> separately using Performer?
>
> Thanks,
> Satheesh
>
> -----------------------------------------------------------------------
> List Archives, FAQ, FTP: http://www.sgi.com/software/performer/
> Submissions: info-performer++at++sgi.com
> Admin. requests: info-performer-request++at++sgi.com
>-- End of excerpt from Satheesh Ganapathi Subramanian

I'll assume you typoed and meant Projection matrix and Modelview matrix. If in
 a callback in which a pfTraverser is given:

    pfChannel *chan = trav->getChan();
    pfFrustum frust;
    chan->getBaseFrust( &frust );
    pfMatrix projMat;
    frust.getGLProjMat( projMat );

//projMat is your projection matrix.

    pfMatrix viewMat;
    chan->getViewMat( viewMat );
    viewMat.invertAff( viewMat );

    pfMatrix modelMat;
    modelMat.makeRot( -90, 1, 0, 0 );
    modelMat.preMult( viewMat );

// You now have the "bare" model view matrix in modelMat.
// Premultiply the accumulated transforms up to this point
// in the scene graph traversal (stored in trav)

    pfMatrix accumulated_tx;
    trav->getMat( accumulated_tx );
    modelMat.preMult( accumulated_tx );

// voila'

-don


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Mon Feb 14 2000 - 08:20:11 PST

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.