Re: pfMakeLookat???

New Message Reply Date view Thread view Subject view Author view

Bernard Leclerc (bleclerc++at++cae.ca)
Thu, 25 Apr 1996 20:12:12 -0400


Bonjour Elena,

> I'll like to know if there is any kind of function in Performer -lib- C++
> to manage the point of view,( by changing its angles (h,p,r) or the angles
> and the position or the position only), in order to follow all the time a
> pfDCS's translation. Giving the pfDCS's translation, the camera has to be
> all the time looking at the objet.

A few weeks ago, I faced a similar problem. I wanted to be able to attach the
viewpoint to any pfNode. I solved the problem by creating a new class derived
from pfChannel. Here is an excerpt from the class definition:

        class pfuChannel : public pfChannel
        {
        public:
                void attachView(pfNode*);
                void detachNode();
        private:
                pfNode* viewpoint;
        }

The function pfuChannel::attachView() attaches a special vpNode to the pfNode
passed as argument. This vpNode has a app() function that gets called during
the pfAppFrame() traversal. At that moment, the vpNode has access to the
current transformation matrix (pfTraverser::getMat) which is used to set the
channel viewpoint position (pfChannel::setViewMat).

To implement a pfMakeLookAt() function, just attach the viewpoint to the node
and use pfChannel::setViewOffsets() to move the viewpoint outside the node.

It works well and smoothly.

I can't give you the actual implementation details since this class has been
developped specifically for a contract... and I haven't had time to make it
public yet... ;)

However Elena, I invite you to get in touch with me directly if you need more
info on the subject. I'll be glad to help you.

Bonne chance...

--
      ___/      |        ___/	Bernard Leclerc		e-mail: bleclerc++at++cae.ca
     /        / |       /	Systems Engineer	voice: +1 514 341 2000
    /        /  |      __/	CAE Electronics Ltd.		extension 2275
   /        /   |     /		8585 Cote De Liesse	fax:   +1 514 340 5496
  /        ____ |    /		P.O. Box 1800
_____/   _/    _|  _____/	Saint-Laurent, Quebec, Canada, H4L-4X4

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:52:46 PDT

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