On Tue, 13 Aug 2002, Dipl. Ing. Paul Szawlowski wrote:

> check out the code I wrote from the j3d.org site well hidden in the
> org.j3d.device.input.spaceball pakage. It contains classes to use the
> mouse via the InputDevice interface as well as code for doing orbits
> around a fixed point, normal 6D navigation, includes addtional keyboard
> support (buttons) and takes a given local coordinates system into
> account (e.g. the ViewPlatform local coordiante system).
>
> regards
> Paul
>

Indeed, this is what we've done :-)

Now, the exact same application can be used either in the CAVE or on a
standard screen.  There's a bit of a kludge, since I have to register the
AWT Component with the MouseInputDevice explicitly in the application.

i.e.
        // u is the configured universe object
        Viewer[] viewers = u.getViewers();
        for(int j = 0; j < viewers.length; j++){
          for(java.util.Enumeration e = 
viewers[j].getPhysicalEnvironment().getAllInputDevices();
              e.hasMoreElements();){
            InputDevice device = (InputDevice) e.nextElement();
            if (device != null && device instanceof 
org.j3d.device.input.spaceball.MouseInputDevice ) {
               for(int i = 0; i < canvases.length; i++){
                 ((org.j3d.device.input.spaceball.MouseInputDevice) 
device).attachToComponent(canvases[i]);
               }
            }
          }
        }

If the MouseInputDevice can be handed a view or PhysicalEnvironment and
find the Components itself it'd be completely transparent to the
application what input device is used [hint hint Paul :-)].

For those who are interested in how ConfiguredUniverse can be used to do
this...

***************************************************************
In configuration file for ConfiguredUniverse for single screen:

(NewDevice mouse org.j3d.device.input.spaceball.MouseInputDevice)
(NewSensor valuator2d mouse 0)

// Register the input devices defined in this file
(NewPhysicalEnvironment SCREEN)
(PhysicalEnvironmentAttribute SCREEN InputDevice mouse)
(ViewAttribute  view0  PhysicalEnvironment  SCREEN)

(NewViewPlatformBehavior vpb WandViewBehavior)
(ViewPlatformBehaviorProperty vpb Sensor2D valuator2d)
(ViewPlatformBehaviorProperty vpb ReadAction2D None)
(ViewPlatformBehaviorProperty vpb ButtonAction2D 0 Rotation)
(ViewPlatformBehaviorProperty vpb ButtonAction2D 1 Translation)
(ViewPlatformBehaviorProperty vpb ButtonAction2D 2 Scale)

(NewViewPlatform vp)
(ViewPlatformAttribute vp ViewPlatformBehavior vpb)

***********************************************************************
In configuration file for CAVE trackd is used with same behaviour code:

// Paul's JNI interface to trackd API
(NewDevice      trackd VRCOTrackdInputDevice)

// Create logical names for the available sensors in the specified input
// devices.  The last argument is the sensor's index in the input device.
(NewSensor head       trackd 0)
(NewSensor wand       trackd 1)
(NewSensor controller trackd 2)

// Create a view platform behavior.
//
(NewViewPlatformBehavior vpb WandViewBehavior)

// Set properties specific to WandViewBehavior
//
(ViewPlatformBehaviorProperty vpb Sensor2D controller)
// Thumb X-Y accelerator
(ViewPlatformBehaviorProperty vpb ReadAction2D Rotation)
// 6 degrees of freedom tracked joystick
(ViewPlatformBehaviorProperty vpb Sensor6D wand)
// Trigger, hold to "skewer" the scene
(ViewPlatformBehaviorProperty vpb ButtonAction6D 0 GrabView)
// Left thumb button, move on vector corresponding to wand position
(ViewPlatformBehaviorProperty vpb ButtonAction6D 1 TranslateForward)
// Right thumb button
(ViewPlatformBehaviorProperty vpb ButtonAction6D 2 TranslateBackward)


----------------------------------------------------
Purgamentum init, exit purgamentum

Paul Gordon
Research Associate
University of Calgary

> Paul Gordon wrote:
>
> > I concur, Configured Universe definiely makes life a lot easier for us VR
> > users.  Now if we can only get people to write their applications using
> > InputDevice instead of mice explicitly... :-)
> >
> > ----------------------------------------------------
> > Purgamentum init, exit purgamentum
> >
> > Paul Gordon
> > Research Associate
> > University of Calgary
> >
> > On Tue, 13 Aug 2002, Richard Smith - Systems Engineer - Melbourne wrote:
> >
> >
> >>Although heading off on a slight tangent, ConfiguredUniverse could also be
> >>looked at for a source of ideas, rather than SimpleUniverse.  [Just thinking
> >>forward to deploying in mulithead environments...]
> >>
> >>============================================================================
> >>   ,-_|\   Richard Smith - SE Melbourne
> >>  /     \  Sun Microsystems Australia         Phone : +61 3 9869 6200
> >>[EMAIL PROTECTED]                        Direct : +61 3 9869 6224
> >>  \_,-._/  476 St Kilda Road                    Fax : +61 3 9869 6290
> >>       v   Melbourne Vic 3004 Australia
> >>===========================================================================
> >>
> >>===========================================================================
> >>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> >>of the message "signoff JAVA3D-INTEREST".  For general help, send email to
> >>[EMAIL PROTECTED] and include in the body of the message "help".
> >>
> >>
> >
> > ===========================================================================
> > To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> > of the message "signoff JAVA3D-INTEREST".  For general help, send email to
> > [EMAIL PROTECTED] and include in the body of the message "help".
> >
> >
>
> ===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff JAVA3D-INTEREST".  For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
>

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to