VRML Beans Proposal
Dmitri Kondratiev
[email protected]
Created : 2/5/97
Last Modified : 2/13/97
Location : http://aldan.paragraph.com/VrmlBeans/vrmlbean.htm
In this document I am trying to evaluate how the advantages of Java Beans architecture can be
used in VRML2.0 builder tools. The goal is to create reusable VRML components with behavior which properties can be easily manipulated and customized in
VRML2.0 builder tools. These reusable 3D components I call "VRML Beans",
don't know if somebody has already used this term.
I am working on the prototype now for JDK1.02 using Liquid Reality Toolkit
from DimensionX, which is the best implementation of VRML/Java package I
know about.
I plan to publish on net all VRML Beans prototype sources and architecture
documentation soon. Next in this message goes some very preliminary outline
of VRML Beans, in fact some ideas I would be very much interested to get any
comments on from everybody interested in the VRML Beans idea.
VRML bean is a 3D object with well defined visual properties and behaviors.
The main idea behind VRML bean architecture is to provide for reusable VRML
components that can be manipulated visually in a builder tool. Such tools
should allow create Java applets/applications with VRML-based GUI from VRML
bean components.
VRML bean framework is based on Java Beans - Sun software component model
for Java.
VRML bean should contain all necessary tools to modify its 3D appearance and
behavior visually. This requirement is essential for VRML bean architecture.
To make visual operation possible, VRML bean provides user with bean's own
VRML-based 3D GUI. This GUI presents to the user standard VRML2.0 scene, as
VRML browser does. Scene consists of VRML nodes which appearance and
behavior can be customized by the user in the builder tool. To customize
VRML bean user performes actions on scene nodes by clicking, dragging or
passing over them. The results of user modifications are immediately shown
in the scene. User can navigate the scene the same way as in VRML browser,
which allows to see the modified bean appearance and behavior right away,
without any recompilation or VRML file reloading.
All scene customization is done by VRML2.0 script node. Along with visual
modification/editing of the GUI scene, VRML bean provides general mechanism
that makes it a VRML Event Source for other Java beans. Any bean can
register as a listener for VRML events with VRML Bean. This allows, for
example, to display the changes of VRML node position values while user
drags the node across the scene, in a dialog window, that some other bean
creates.
To register for VRML Events, listener should provide distinct interfaces
derived from VRMLEventListener interface for each VRMLEvent type.
VRMLEventListener in turn inherits from java.util.EventListener.
- VRMLEventListener classes are interested in a particular set of VRML
events, generated by nodes in VRML bean GUI.
- The scene state associated with an VRML event notification is encapsulated
in an VRMLEvent state object that inherits from java.util.EventObject and
which is passed as the sole argument to the event method.
- Bean identifies itself as VRML event source by defining registration
methods that conform to a Java Bean specific design pattern and accept
references to instances of particular VRMLEventListener interfaces.
- Information associated with a particular VRML event notification is
encapsulated in VRMLEvent state object that is a subclass of
java.util.EventObject.
VRMLEvent class contains as a member vrml.Event class, dfined in VRML2.0
Java Scripting Reference and provides the same access methods that
vrml.Event does :
- public String getName()
- public double getTimeStamp()
- public ConstField getValue()
- public String toString()
VRML Bean internal state is defined by VRML node field values and event
routing information that VRML file contains. To store its state VRML Bean can use different schemes :
- VRML bean can use automatic Java serialization mechanism to
store its state for VRML Bean Builder tools to use.
- VRML bean can encapsulate APIs to access some multi-user technology on the net. In this case such bean
can have properties which values are shared among users on the net. To serialize/deserialize such properties VRML bean can use APIs to multi-user technology it contains.
- VRML bean can store its properties directly in vrml template files, which makes possible to view these files in VRML browsers that don't support Java scripting.
Future versions of Java Bean API will provide an
"externalization" stream mechanism which VRML Bean may use as a uniform way
to store its state.
VRML Beans are stored in JAR files.
Each VRML Bean JAR file includes the following entries :
- A set of classes to provide behavior and customization algorithm for the
VRML Bean. These entries will include Script node classes and interface
adaptor classes. E.g. "foo/bah/MyCustomizerScript.class".
- VRML template file with 3D scene (GUI) bean provides.
I think that discussing examples of VRML Beans may help to evaluate their
use in different applications. Next I try to give some examples illustrating
the use of VRML Beans in VRML worlds using Living Worlds API for multi-user
communications.
Providing VRML Beans the ability to communicate with distributed worlds on
the net by means of multi-user API, such as Living Worlds, gives the
following possibilities :
- Multi-user VRML Bean can encapsulate an object which state is shared among
the users of the world;
- Multi-user VRML Bean properties can be divided in two separate domains :
- local properties - customized by each user locally;
- shared properties which user may not be able to customize directly.
These shared properties may be modified by multi-user world provider in
on-line mode right in time when user installs new bean in his system. For
example, this feature may be used by VR world provider to upgrade its bean
content.
- Multi-user VRML Bean can serialize/desirialize its state remotely on some
server. Thus new, customized instances of VRML Beans can be used by other
users of the VR world.
These features make Multi-user VRML Beans a really "live" reusable component.
1) User buys some VRML Bean components from Advanced VRML Component Store.
He gets a floppy containing beans in JAR file. This includes ParaGraph
NetWriter white board and "WebTV Set" component.
User can install NetWriter white board in his virtual living room to
communicate with others in handwritten messages and drawings on the net.
NetWriter board is VRML Bean which appearance (size, orientation in the
room) and drawing properties (pallet, drawing style) user can customize.
Having NetWriter board "installed" in virtual room user can start
communicating with server that provides NetWriter service.
To communicate with server NetWriter VRML Bean uses the central concept of
"SharedObjects" that Living Worlds API is built on. NetWriter board is an
object which state is shared among users on the net.
WebTV Set vrml bean is a virtual programmable WEB television set, ready to
use in user virtual living room. From user point of view WebTV Set consists
of TV screen and control panel vrml models allowing to view and tune WebTV
channels. User can assign numbers to the channel buttons on the panel or
attach cool 3D pictograms to them. Having this WebTV Set installed and tuned
, user gets the latest Web news on his favorite channels.
To communicate with the server that provides these channels, WebTV VRML Bean
may use Living Worlds Information Exchange API. In this example the
following types of information exchange would be used :
- text strings for channel list, that user makes his selection from
- streams for actual news feeds coming from remote server to user TV Screen.
2) To utilize the new NetWriter and WebTV Set components user needs to add
them to his virtual living room environment. This can be done "manually" by
user or by means of VRML Bean Builder, which doesn't exist yet.
Before explaining how VRML Beans can be added to user virtual living room,
we need to examine properties of these beans. NetWriter and WebTV beans
exhibit both local and multi-user shared properties :
- Local properties are those that each user can customize locally such as
appearance(color, size, orientation,..) and local behavior (selected
channel set, drawing properties).
- Multi-user shared properties are those that are set by some multi-user
content provider (a list of channels to select from, a number of users that
can simultaneously write on a white board). These properties can change in
time and user has no direct way to control them. Living Worlds provides API
for VRML beans to set/query such shared properties.
NetWriter and WebTV Set vrml beans are contained in JAR files with the same
basic components differing only by bean content. It is important to
understand that VRML Beans may also contain other beans, such as those
providing 2D GUI used to convey user selections to classes actually
performing customization.
So, for example, NetWriter white board VRML Bean will include :
- vrml file with Living Worlds nodes to provide access to world specific
multi-user technology (MUTech) :
- white board SharedObject node instance that contains white board 3D
model and exposes its state and behavior interfaces to multi-user technology
classes;
- Pilot node attached to white board SharedObject which allows the user to
control white board;
- vrml files with white board crayon models, ..etc;
- Design-time classes allowing user to customize NetWriter appearance and
drawing properties;
- GUI classes allowing user to select from available list of NetWriter
properties and modify them;
- Run-time script classes, MUTech classes;
WebTV VRML Bean may include :
- vrml file with Living Worlds Information Exchange nodes used by WebTV
screen and its control panel;
- vrml files with 3D channel pictograms;
- Design-time classes allowing user to customize TV screen and control panel
appearance as well as to program channels ;
- GUI classes allowing user to select from available list of channels and
other WebTV properties and chage them;
- Run-time script classes, MUTech classes;
These classes address the following goals :
These classes perform actual VRML Bean
behavior when user communicates with the world by means of Java-enabled
browser.
- "manually" with the help of VRML Browser supporting JDK1.1 API for
scripting. User first "runs" VRML Bean in design-time mode in the browser.
To do so, user unjars bean and publishes its contents to some place
accessible by the browser. All Script nodes are initially set to work with
design-time script classes, which allow user to customize the bean. The last
thing that customization script do, when user has done all desired
modifications, is switching Script nodes to run-time classes. Thus a new
customized instance of the bean is ready to run in the browser.
- with VRML Bean builder the process is mostly the same. Builder is a
browser which understands "bean" MIME type on its input and can manipulate
several beans at once, the same way as non-VRML bean builder is supposed to
do.