Avi Bar-Zeev (cyranose++at++realityprime.com)
Sun, 30 May 1999 14:37:37 -0700
I think there are two things to consider. First, Performer _does_
do the multiplication automatically. The matrices you normally
see stored in pfDCS's, however, are called 'local' or 'relative'
transformations. That is, they are always relative to their parent.
This is why you set their initial translations to +/- 0.50f in X
relative to to head (note: most eyes will have a Y and Z offset as
well).
When the parent (head) moves, any pfGeometry added to your 'left'
and 'right' nodes will indeed move, but if you read their matrix
values, they will remain unchanged. Why?
Because their transformations are still relative to the head. The
global or absolute world-space transformations are computed, but
they are not easily accessible using a pfDCS.
Now, you could get very complicated and try to find out the absolute
or global world-space transformation using some traversal callbacks
to read and cache the result of all the matrix combinations up to
that point, but I wouldn't bother.
Because the easier way to do this is to use channel offsets.
Indeed, some wise person thought to add the ability to have two
or more channels share a single viewing orientation, but yet be
offset from that orientation by a given amount, such as in the
case of left and right eyes in stereo viewing.
So I'd suggest looking up pfChannel offsets and attribute sharing
masks in the pfManPages and you'll be seeing in stereo again.
Good luck,
Avi
----- Original Message -----
From: Torbjörn Håkansson <torbjorn.hakansson++at++telia.com>
To: Info SGI Performer <info-performer++at++sgi.com>
Sent: Sunday, May 30, 1999 12:42 PM
Subject: problem with pfMatrix
> Hi all pf Users
>
> I have a problem with pfMatrix, I wonder why the Matrix's value don't
change when I rotate or translate the parent pfDCS, the parent pfDCS is
moved by input data from a sensor in a Flock of Birds, the child in my model
shall represent two eyes, I thought that performer did the matrix
multiplication automatically
>
> Thanks in advance !
>
>
> -------------------------------------------------------------------------
> Code example !!
>
>
> pfDCS *Head; // attached to Flock of Bird Sensor
> pfDCS *L_Eye;
> pfDCS *R_Eye;
>
> pfCoord CamSens;
> pfCoord HandSens;
> pfMatrix L_EyeMat ;
> pfMatrix R_EyeMat ;
>
>
> L_Eye = new pfDCS;
> R_Eye = new pfDCS;
> Head = new pfDCS;
>
> Head->addChild(L_Eye);
> Head->addChild(R_Eye);
>
>
> L_Eye->setTrans(-0.50f,0.0f,0.0f);
> R_Eye->setTrans(0.50f,0.0f,0.0f);
>
> float alfa = 0.0f
>
>
> while(exitFlag)
> {
> alfa++;
>
> getSensorData(); // my code to fetch FOB sensor data
>
> Head->setRot(0.50f*alfa,0.0f,0.0f);
>
> L_Eye->getMat ( L_EyeMat ); // why does this Matrix dont change value ?
> R_Eye->getMat ( R_EyeMat ); // why does this Matrix dont change value ?
>
> chan0->setViewMat( L_EyeMat );
> chan1->setViewMat( R_EyeMat );
>
> pfFrame();
>
> }
>
>
>
> ********************************************************************
> Torbjörn Håkansson
>
> URL: http://www.hbg.lth.se/~m96tha
> Mail : torbjorn.hakansson++at++telia.com
> Phone: +46-(0)40-320595
> ICQ: 281022
> ********************************************************************
>
>
>
> -----------------------------------------------------------------------
> List Archives, FAQ, FTP: http://www.sgi.com/software/performer/
> Submissions: info-performer++at++sgi.com
> Admin. requests: info-performer-request++at++sgi.com
>
This archive was generated by hypermail 2.0b2 on Sun May 30 1999 - 14:43:54 PDT