Re: [info-performer] Trackball resetPivot()

New Message Reply Date view Thread view Subject view Author view

From: Paolo Farinelli (paolo++at++sgi.com)
Date: 02/13/2003 18:21:10


  Hello Rémy,
 
As you pointed out, the current implementation of pfvmTrackball does not
automatically reset its pivot.
 
You will have to manually press the space-bar key to reset both view
position and pivot, or <shift> spacebar to reset pivot and camera
orientation
without changing camera position.

Automatic resetting of pfvmTrackball's pivot will be implemented in a
future release. In the meantime, if you want, you can implement it yourself
by recompiling the source code in:
%PFROOT%\src\pguide\libpfv\viewer\modules\pfvmTrackball
(see our WIN32 Developer Release Notes document for instructions)
 
I can sugest the following simple modification:
 
In file pfvmTrackball.h, inside the declaration of the pfvmTrackball class,
include:
 
void enterWorld(){
   view->autoPos();
   resetPivot();
}

In file pfvmTrackball.C, inside method pfvmTrackball::construct, add:

    bindCallback(PFV_CB_ENTER_WORLD);
 
If (in addition to the above modifications) you ensure that your
pfvmTrackball module is scoped to a view, the enterWorld method will be
called whenever such view enters a new world (including frame 0), and will
reset view position through view->autoPos, and then place trackball pivot
at the center of the scene's bounding box.
 
In order to scope your pfvmTrackball module to a view, you will need to
modify your configuration file, as shown below:
 
<?xml version="1.0" ?>
<viewer>
 
<view>
  <name>view0</name>
<view>

<Module>
  <class>pfvmLoader</class>
  <data>
    <model>
        <filename>earth.pfb</filename>
    </model>
  </data>
</Module>

<Module>
  <class>pfvmTrackball</class>
  <scope>view,view0</scope>
</Module>

</viewer>
 
Note that in future, we are planning to implement an auto-scope
mechanism that will allow modules to scope themselves to view0 or world0
by default. The pfvmTrackball module, for example, would automatically
scope itself to view0. This would make the above changes to your original
configuration file un-necessary.
 
Hope this helps.
Let me know if you come across other libpfv-related issues.
 
ciao,
Paolo

Rémy Deslignes wrote:

> Hi,
>
> I have a strange feeling about the pfvmTrackball :
>
> I use it with the following config scene :
>
> <?xml version="1.0" ?>
>
> <viewer>
>
> <Module>
> <class>pfvmLoader</class>
> <data>
> <model>
> <filename>earth.pfb</filename>
> </model>
> </data>
> </Module>
>
> <Module>
> <class>pfvmTrackball</class>
> </Module>
> </viewer>
>
> But , once loaded, my trackball is not centered at the center of the
> earth ( which is , of course, a sphere ) ...
> As the trackball should perform a resetPivot() ( which " will update
> eye orientation so that view vector points towards the center of
> scene's bounding box, and lastly, will adjust pivot distance such that
> pivot is placed exactly at the center of scene's bounds." ( dixit the
> man pages ) ) , is there a reason why my sphere is not centered ?
>
> I'm using PF 3.0 on a (windows) box.
>
> PfThanks() for any PfHelp*
>
> Rémy
>
>
> -----------------------------------------------------------------------
> List Archives, Info, FAQ: http://www.sgi.com/software/performer/
> Open Development Project: http://oss.sgi.com/projects/performer/
> Submissions: info-performer++at++sgi.com
> Admin. requests: info-performer-request++at++sgi.com
> -----------------------------------------------------------------------
>
>

-- 
Paolo Farinelli                                           paolo++at++sgi.com
Member of Technical Staff, OpenGL Performer              1-650-933-1808
Silicon Graphics        1600 Amphitheatre Pkwy, Mountain View, CA 94043


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Thu Feb 13 2003 - 18:21:19 PST

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