Renee Strong (renee++at++pat.mdc.com)
Wed, 17 Nov 93 12:27:41 CST
Here's the code:
extern OBJ *cur_camera;
extern pfChannel *cur_channel;
extern pfPipe *cur_pipe;
extern pfScene *scene;
void
change_cams()
{
pfMatrix pos_rot, matrix;
pfMatrix mat;
pfCoord view;
pfDCS *dcs;
CAMERA *camera;
camera = cur_camera->type_data.camera;
cur_channel = camera->perf_cam_data;
dcs = cur_camera->perf_node;
pfChanNearFar(cur_channel, camera->near, camera->far);
pfChanFOV(cur_channel, camera->FOV, -1.0f);
pfGetDCSMatrix(dcs, pos_rot);
/*
* put in pan and tilt
*/
pfSetVec3(view.hpr, -camera->pan, 0.0, -camera->tilt);
pfSetVec3(view.xyz, 0.0, 0.0, 0.0);
pfMakeCoordMat(matrix, &view);
pfPreMultMat(pos_rot, matrix);
/*
* rotate -90 in x because performer is off by 90 degrees in x from gl
*/
pfSetVec3(view.hpr, 0.0, -90.0, 0.0);
pfSetVec3(view.xyz, 0.0, 0.0, 0.0);
pfMakeCoordMat(matrix, &view);
pfPreMultMat(pos_rot, matrix);
/*
* put on all the preceding trans and rots
*/
do
{
dcs = (pfDCS *)pfGetParent(dcs, 0);
pfGetDCSMatrix(dcs, mat);
pfPreMultMat(pos_rot, mat);
} while (dcs != root_node->perf_node);
pfChanViewMat(cur_channel, pos_rot);
pfChanScene(cur_channel, scene);
}
Thanks,
Renee Strong
renee++at++pat.mdc.com
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:50:06 PDT