Re: pfiXformer usage with points of interest

New Message Reply Date view Thread view Subject view Author view

m b (m_boc++at++hotmail.com)
Fri, 10 Dec 1999 09:30:24 GMT


When you give ShuttleGeo as the node around which you want your pfiTrackball
to spin, it'll take the center of ShuttleGeo's bounding sphere as the spin
center, but... in local coodinate system ! Therefore it'll spin around
(0,0,0) or something like that.
The big lack of pfiTrackball is that it does not take into account the
accumulated matrix at the node's level based on the scene graph and on
parent [D|S]CS's, so that pfiTrackball is only adapted to rotations around
the scene's center.
You have to provide modifications inside the class pfiInputXformTrackball
itself, or find an appropriate callback, in order to traverse the scenegraph
upwards from your node of interest until the scene root, and accumulate all
the SCS or DCS's matrices you'll find.
It'll be a bit more difficult if you want to spin around a moving node,
because you'll have to make this upwards traversal at each frame, let's say
in the pfiTrackball::update() function. What I did is put an APP-callback
onto the node of interest, and record at each frame the matrix brought by
the pfTraverser callback data class.

Good luck,
Mike

-------------
Hi Performers,

has anyone any used the pfiXformer in trackball mode to spin around
different "points of interest" in a scene? I'm trying to extend the way
it's used in perfly which centers on the whole scene and spins around
its geometric centre. What I want is to toggle between various points of
interest and have the trackball center on just specific nodes in my
scene so I can view them from varies angles controlled by the mouse. It
would seem that pfiXformer could do this.

Do I need another DCS other than ViewState->sceneDCS as in perfly?
What calls do I need to make to the pfiXformer class to set a given node
up as spin center?

What I've tried so far is:

static void
toggleXformer(void)
{
    static int oIdx = 0;

    oIdx = (oIdx + 1) % 2;

    /* Centre on given node */
    switch (oIdx) {
            case 0:
            ViewState->xformer->setNode(EarthDCS);
            ViewState->xformer->setResetCoord(&ViewState->initView);
            printf("earth frame\n");
            break;
            case 1:
            ViewState->xformer->setNode(ShuttleGeo);
            ViewState->xformer->setResetCoord(&InitShuttleView);
            printf("shuttle frame\n");
            break;
    }

    /* Reset Xformer position */
    ViewState->xformer->resetPosition();
    ViewState->xformer->getMat(ViewState->viewMat);
    ViewState->masterChan->setViewMat(ViewState->viewMat);
}

But it's still rotating around the scene center and not my node
(ShuttleGeo).

I've found pfiXformer and associated classes are not very well
documented and tricky to use so can anyone help me?

Regards, Simon
________________________________________________________________________

Simon Mills
Silicon Worlds S.A.
c/o Modelling & Simulation Section (TOS-EMM) Tel: +31 (0)71 565 3725
European Space Agency (ESA/ESTEC) Fax: +31 (0)71 565 5419
Postbus 299, 2200AG Noordwijk e-mail: simon++at++wgs.estec.esa.nl
The Netherlands http://www.estec.esa.nl/wmwww/EMM

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Fri Dec 10 1999 - 01:30:38 PST

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