Felix Shung (shung++at++ernie.arc.nasa.gov)
Thu, 19 May 94 16:26:53 -0700
Nevertheless, I am having problem that the scene shown in side window is
partially overlapped with the center window even though the offset rotation
angle is exactly what it should be.( defined in pfChanViewOffsets)
I rewrite the code with "pfChanFov" and kept every thing else the same,
the scenes of 3 windows matched perfectly this time. I check the
FOV created by "pfMakePerspFrust" and it is the same as what I used
in "pfChanFOV". The eye location, the content of the scene shown in the
center window, and the offset angle are the same in both cases.
What can go wrong? Do I have to treat the "pfMakePerspFrust" differently
than "pfChanFOV" even, at this moment, no off-axis projection is really
happening?
Felix
The following is the part of my code:
/* initialization */
/* allocate space for the 3 viewing frustrum of the 3 channels */
Shared->fr_chan1 = pfNewFrust(NULL);
Shared->fr_chan2 = pfNewFrust(NULL);
Shared->fr_chan3 = pfNewFrust(NULL);
/* center window */
Center = pfNewChan(Pipe);
pfAllocChanData(Center, sizeof(PassData));
pfChanCullFunc(Center, CullFunc);
pfChanDrawFunc(Center, DrawFunc);
pfChanViewport(Center, 0.f, 1.f, 0.66406250f, 0.99609375f);
pfChanScene(Center, scene);
pfChanESky(Center, eSky);
pfChanNearFar(Center, Output->near, Output->far);
pfMakePerspFrust(Shared->fr_chan1, Shared->off_proj.original_win.l,
Shared->off_proj.original_win.r,
Shared->off_proj.original_win.b,
Shared->off_proj.original_win.t);
pfFrustNearFar (Shared->fr_chan1, Shared->off_proj.original_win.near,
Shared->off_proj.original_win.far);
/* left window */
Left = pfNewChan(Pipe);
pfAllocChanData(Left, sizeof(PassData));
pfChanCullFunc(Left, CullFunc);
pfChanDrawFunc(Left, DrawFunc2);
pfChanViewport(Left, .0f, 1.f, 0.0f, 0.33203125f);
pfChanScene(Left, scene);
pfChanESky(Left, eSky);
pfChanNearFar(Left, Output->near, Output->far);
pfMakePerspFrust(fr_chan1, l,r, b, t);
pfFrustNearFar ( near, far);
/* right window */
Right = pfNewChan(Pipe);
pfAllocChanData(Right, sizeof(PassData));
pfChanCullFunc(Right, CullFunc);
pfChanDrawFunc(Right, DrawFunc2);
pfChanViewport(Right, 0.0f, 1.f, 0.33203125f, 0.66406250f);
pfChanESky(Right, eSky);
pfMakePerspFrust(fr_chan3, l, r, b, t);
pfFrustNearFar (fr_chan3, near, far);
pfAttachChan(Center, Left);
pfAttachChan(Center, Right);
/* Not sharing FOV and not sharing Near & Far clipping */
share = pfGetChanShare(Center);
pfChanShare(Center, (share & ~PFCHAN_FOV) & ~PFCHAN_NEARFAR);
/* real time loop */
while(!terminate){
/* include the head movement */
offaxis_realtime(pol_x, pol_y, pol_z, pol_azi, pol_ele, pol_rol);
/* redefine the l,r, b, t, near, far for 3 windows based on new */
/* head movement */
creating structure updated_win information......
/* CENTER window, center */
pfFrustNearFar (fr_chan1, new_near_center, new_far_center);
pfMakePerspFrust(fr_chan1, Shared->off_proj.updated_win[1].l,
Shared->off_proj.updated_win[1].r,
Shared->off_proj.updated_win[1].b,
Shared->off_proj.updated_win[1].t);
/* include the head movement for the new eye point*/
actual_viewpoint.xyz[0] =old_viewpoint.xyz[0] +
Shared->head_trans_in_meter[0];
actual_viewpoint.xyz[1] =old_viewpoint.xyz[1] +
Shared->head_trans_in_meter[1];
actual_viewpoint.xyz[2] =old_viewpoint.xyz[2] +
Shared->head_trans_in_meter[2];
pfChanView(Center, actual_viewpoint.xyz, Output->viewpoint.hpr);
pfGetFrustFOV(fr_chan1, &hfov, &vfov);
pfGetFrustEye(fr_chan1, eye);
/* LEFT window */
pfFrustNearFar (fr_chan2,
Shared->off_proj.updated_win[0].near,
Shared->off_proj.updated_win[0].far);
pfMakePerspFrust(fr_chan2,
Shared->off_proj.updated_win[0].l,
Shared->off_proj.updated_win[0].r,
Shared->off_proj.updated_win[0].b,
Shared->off_proj.updated_win[0].t);
pfApplyFrust(fr_chan2);
pfChanView(Left, actual_viewpoint.xyz, Output->viewpoint.hpr);
pfChanViewOffsets(Left, chan2_xyz, chan2_hpr);
/* RIGHT window */
pfFrustNearFar (fr_chan3,
Shared->off_proj.updated_win[2].near,
Shared->off_proj.updated_win[2].far);
pfMakePerspFrust(fr_chan3,
Shared->off_proj.updated_win[2].l,
Shared->off_proj.updated_win[2].r,
Shared->off_proj.updated_win[2].b,
Shared->off_proj.updated_win[2].t);
pfApplyFrust(fr_chan3);
pfChanView(Right, actual_viewpoint.xyz, Output->viewpoint.hpr);
pfChanViewOffsets(Right, chan3_xyz, chan3_hpr);
/* start frame processing */
pfFrame();
}
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:50:17 PDT