We've been working pretty hard at getting our "home grown" versions of things to work with Java3D 1.3.1.
I've gotten the DeviceProperty thing below to work, and it actually looks really neat.
However, it is part of a bigger package (called Jabiru), and we're having some trouble with another part of it, so we can't release the stuff yet...
The problem is in our original MenuBehavior class. This class extends ViewPlatformBehavior (so that we can have multiple ViewPlatformBehaviors available via a Text3D menu), and is composed at runtime as a result of configuration file inputs.
With previous versions of Java3D, we had to create a new ViewPlatform for every configuration file (with ViewPlatformBehaviors) so that we could use the multiple ViewPlatformBehaviors. This no longer works. So we are trying to pass through the original "parent" ViewPlatform to the MenuBehavior, which calls a new ConfigContainer constructor (made by us) so that all ViewPlatformBehaviors get added to the *same* ViewPlatform.
When a NewViewPlatform is specified in the master Configuration file, it is instantiated as a ConfigViewPlatform. The consequent MenuBehavior gets added nicely to this instance. Then, through a method in the MenuBehavior, called "AccessibleViewPlatformBehaviors" we pass in the original ViewPlatform, the subsequent configuration filename for the "slave" ViewPlatformBehaviors (ie: wand, save, exit) and a String specifying the name to put in the 3D menu.
The problem is this: The ViewPlatform reference passed to this argument as: (ViewPlatform vp) is actually a ViewingPlatform, and even when we do a "getViewPlatform()" on this parameter in MenuBehavior, it is a *different* instance than the one originally created.
We have tried casting this argument, thinking the above version might be instantiating a new ViewPlatform, so that the cast looks like:
( (ViewPlatform) vp) ...
But this is taken by the system as a Syntax error. Removing all ViewPlatform casting etc so that we only have vp as the argument results in it being a String, and not a reference to the ViewPlatform.
We are at a loss as to how this could be happening, as well as how to get around it.
Thank you for whatever you can come up with,
Julie Stromer
Mark Hood wrote:
Date: Mon, 17 May 2004 11:47:06 -0600 From: Julie Stromer <[EMAIL PROTECTED]>I'm creating a new input device by implementing the InputDevice interface, and am creating my Universe through the Configuration file that is fed into ConfiguredUniverse. [...] There is no documentaiton anywhere that indicates how to implement a method that will be properly processed... Has anyone ever done this before and know how to do it?Hi Julie, Have you read the configuration file documentation? You can find a pointer to it in the overview for the ConfiguredUniverse class documentation. There is also a description of the facilities you need in the ConfigContainer class documentation (ConfigContainer is public in J3D 1.3.1). You need to implement a method in your InputDevice, say "Components", that takes Object[] as a parameter: public void Components(Object[] c). Then in the configuration file you pass the Canvas3D to the Components() method using the DeviceProperty command and the Canvas3D built-in: (DeviceProperty <id> Components (Canvas3D <wid>)) Where <id> is the name of your input device, and <wid> is the name of the window or screen. The Components() method of your InputDevice then gets a array of length 1 containing the instance of Canvas3D used by the named window or screen. To make sure it will work, try using just the latest stuff from J3D 1.3.1, and not a mixture of home-grown and released stuff -- I know that you folks in U. Calgary have a lot of customized versions of the public classes. In the com.sun.j3d.input package there is also an example implementation of a mouse-driven InputDevice that can be set up from a configuration file to get the canvas of the screen it's running on. Let me know if you need the source code for this package. If the doc and the example programs don't help, I can try to answer any specific questions you have. -- Mark Hood =========================================================================== 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".