Addition : Re: perfly fly vs. trackball

New Message Reply Date view Thread view Subject view Author view

Michael Boccara (boccara++at++MIT.EDU)
Thu, 25 Jun 1998 18:17:44 -0700


Before any "cri au bug" :
This manoeuvre below supposes that the top-pfDCS transformation inducted by the
trackball, is equivalent to an invert chanView transformation. Which means that
the CS below the top-pfDCS is the base frame.
Thus this modification will bug with the Sky/Ground EarthSky model, which
supposes that the base frame (and the notion of horizon) is at the pfScene
level...
Just to say that this fly_to_trackball switching method (below) will be OK only
with a PFES_CLEAR pfEarthSky mode

Mike

Michael Boccara wrote:
>
> Ballard Andrews; (4/28/98) wrote:
> >
> > The eyepoint is preserved in perfly when switching to trackball
> > from fly mode, but not the other way around. How do you fix this
> > so that the viewMat is also preserved when switching from trackball
> > to fly - is this possible?
> >
> > b. andrews
> > =======================================================================
> > List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/
> > Submissions: info-performer++at++sgi.com
> > Admin. requests: info-performer-request++at++sgi.com
>
> You have to modify the bug in void pfiTDFXformer::selectModel(int)
>
> Make your own class :
>
> class myTDFXformer :: public pfiTDFXformer
> {
> public:
> virtual void selectModel(int _which);
> };
>
> void
> myTDFXformer::selectModel(int _which)
> {
> float n, f;
> if (xCurModelIndex == _which)
> return;
>
> if (_which > xModelList->getNum())
> {
> pfNotify(PFNFY_WARN, PFNFY_RESOURCE,
> "pfiTDFSelectXformerModel - index %d is more than number of models (%d)",
> _which, xModelList->getNum());
> return;
> }
>
> stop();
>
> // The Xformer transfers position changes between motion models.
> // The trackball is special because its matrix edits to the
> // scene DCS matrix must now
> // be applied in reverse to the current position.
>
> if (xCurModelIndex == PFITDF_TRACKBALL)
> {
>
> //#################################################
> // Here is the bug :
> /*
> pfMatrix mat;
> pfVec3 trans;
>
> xIx->getMat(mat);
> pfGetMatRowVec3(mat, 3, trans);
> PFSUB_VEC3(xMotionCoord.pos.xyz, xMotionCoord.pos.xyz, trans);
> // XXX compute new HPR based on rotations !!!
> xMotionCoord.makeMat();
> */
> //###################################################
> // You have to invert all the Trackball matrix
>
> pfMatrix TBmat;
> xIx->getMat(TBmat);
> TBmat.invertOrthoN(TBmat);
> xMotionCoord.setMat(xMotionCoord.mat * TBmat);
> xIx->setMat(pfIdentMat);
> if (xPosDCS)
> pfDCSMat(xPosDCS, pfIdentMat);
> //###############################
> // End of bug correction
>
> }
> xCurModelIndex = _which;
> xIx = (pfiInputXform *) xModelList->get(xCurModelIndex);
> /* init new model with position of old model */
> xIx->setCoord(&(xMotionCoord.pos));
> /* update current position motion parameters to match motion model */
> xIx->getMotionCoord(&(xMotionCoord));
>
> /* update collider with new model */
> xCollide->setCurMotionParams(&xMotionCoord.pos, &xMotionCoord.prevPos,
> xMotionCoord.speed);
> pfGetChanNearFar(xInputChan, &n, &f);
>
> if (xIx->isOfType(pfiInputXformTrackball::getClassType()))
> {
> xCollide->setMode(PFIC_RESPONSE, PFIC_RESPONSE_NONE);
> setCollision(PFUCOLLIDE_GROUND, 0.0f, NULL);
> setCollision(PFUCOLLIDE_OBJECT, 0.0f, NULL);
> }
> else if (xIx->isOfType(pfiInputXformDrive::getClassType()))
> {
> float dh = ((pfiInputXformDrive *)xIx)->getDriveHeight();
> xCollide->setMode(PFIC_RESPONSE, PFIC_RESPONSE_STOP);
> setCollision(PFUCOLLIDE_GROUND, dh, xNode);
> setCollision(PFUCOLLIDE_OBJECT, n * 2.0f, xNode);
> }
> else if (xIx->isOfType(pfiInputXformFly::getClassType()))
> {
> xCollide->setMode(PFIC_RESPONSE, PFIC_RESPONSE_BOUNCE);
> /* Do not terrain follow */
> setCollision(PFUCOLLIDE_GROUND, 0.0f, xNode);
> setCollision(PFUCOLLIDE_OBJECT, n * 2.0f, xNode);
> }
>
> }
>
> --
> ___________________________________________________________________
> Michael Boccara Massachussets Institute of Technology
> Research Laboratory of Electronics
> (617) 253 0005 Virtual Environment Technologies for Training

-- 
___________________________________________________________________
Michael Boccara     Massachussets Institute of Technology
                    Research Laboratory of Electronics
(617) 253 0005      Virtual Environment Technologies for Training
=======================================================================
List Archives, FAQ, FTP:  http://www.sgi.com/Technology/Performer/
            Submissions:  info-performer++at++sgi.com
        Admin. requests:  info-performer-request++at++sgi.com

New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:57:35 PDT

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