Presenting top view in the second channel

New Message Reply Date view Thread view Subject view Author view

girish prabhu (prabhu++at++eng.buffalo.edu)
Sat, 1 Oct 1994 16:13:20 -0400


I am using the perfly code to develop a driving simulator. I have two
 channels, one to show the out-of-the-window view, and the other one to
display the map (ie. top view of the terrain).. This is what I do.. but
somehow the topview channel shows a view of the scene at some
angle, which does not seem to depend upon the pfChanViewOffsets()..

Can somebody tell me what goes wrong here?

/* Initialize Viewing Channel(s) */
void
InitChannel(void)
{
    int i;
    pfFrameStats *frameStats;
    pfChannel *chan;
    pfVec3 xyz, hpr;
    float fov;

        /* Create all channels on the same pipe */
    for (i=0; i< NumChans; i++)
       Chan[i] = pfNewChan(pfGetPipe(0));
   

          /* Master channel is source for keyboard and mouse input */
    ViewState->masterChan = Chan[0];

    /* Attach channel to master channel to form a channel group. */

    pfAttachChan(ViewState->masterChan, Chan[1]);

                       /** Offset the Chan[1] to top view +850 up **/
            
   pfSetVec3(xyz, ViewState->xyz[PF_X], ViewState->xyz[PF_Y], 850.0f);
   pfSetVec3(hpr, ViewState->hpr[PF_H], -90.0f, ViewState->hpr[PF_R]);

   pfChanViewOffsets(Chan[1], xyz, hpr);
   pfChanViewport(Chan[1], 0.68f, 1.0f, 0.0f, 0.4f);

    chan = ViewState->masterChan;

    /* Set the callback routines for the pfChannel */
    pfChanCullFunc(chan, CullFunc);
    pfChanDrawFunc(chan, DrawFunc);

    /* Attach the visual database to the channel */
    pfChanScene(chan, ViewState->scene);

    /* Attach the EarthSky model to the channel */
    pfChanESky(chan, ViewState->eSky);

    /* Initialize the near and far clipping planes */
    pfChanNearFar(chan, ViewState->near, ViewState->far);

    /* Vertical FOV is matched to window aspect ratio. */
    pfChanAutoAspect(chan, PFFRUST_CALC_VERT);
    pfMakeSimpleFrust(chan, fov);

    /* Initialize the viewing position and direction */
    pfChanView(chan, ViewState->initView.xyz, ViewState->initView.hpr);

.....

.......
}


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:50:34 PDT

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