[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [www-vrml] [xVRML] new screen snapshots and the future



Miriam English wrote:
Hi Jeff,

Regarding PROTOs, you might like to consider this:

One of the problems with VRML (I still haven't come to grips with X3D yet, so can't comment on it) is the fact that events are implied in all nodes except Scripts. This means that if you want to send events in or out of PROTOs you are forced to use Scripts in there to mediate. This is not too bad (though clumsy) if the events are rare like mouse clicks or similar, but if the PROTO has to send or receive large streams of data (like time from a TimeSensor or position from a ProximitySensor) then having to pipe everything through a Script makes large, complex worlds almost impossible.

The way to accomplish this is to IS/connect prototype fields directly
to node fields inside your prototype. Then the input and output events of the prototype interface econnect directly to nodes inside your prototype body.


A nice thing about this is that ROUTEs and intermediate Scripts are avoided
completely, at least for handling prototype inputs/outputs.  Another nice
thing is that precisely naming fields (similarly or identically) makes
the logic consistent inside & out.

This feature works identically in VRML97 and X3D.

Prototype and example use showing an extended CylinderSensor that can orienting around any axis:

http://www.web3d.org/x3d/content/examples/course/index.html#ArbitraryAxisCylinderSensorPrototype
http://www.web3d.org/x3d/content/examples/course/index.html#ArbitraryAxisCylinderSensorExamples

This problem can be eliminated by making events explicit in the nodes that send or receive them.

TouchSensor {isActive TO lite.on}

This feature, and variations of it, were considered in X3D design for quite a while but eventually not accepted as an extension to the language.

This also has the side-effect of clarifying code tremendously and eliminating one of VRML's most bizarre features, ROUTEs.

Of course ROUTEs are essential to most event passing, that is the primary mechanism used in X3D/VRML scene graphs.

Other possible event-passing mechanisms:
- providing nodes as reference fields to Scripts, allowing direct manipulation
- new X3D feature: IMPORT/EXPORT to enable passing events into and out of
Inline nodes to/from parent nodes.


Finally, to help with figuring out where ROUTEs are connecting into and
out of nodes, the X3dToXhtml.xslt pretty printer puts hyperlinked comments
into the styled output. This lets you see at a glance where your nodes
are connected by ROUTEs, and click on the ROUTE information to go to the ROUTE itself. Similarly, the ROUTEs are hyperlinked to then jump to see
the other node if desired.


For example, the key excerpt from pretty-printed prototype definition
in the example above:

<!-- RotatedCylinderSensor ROUTE: [from rotation_changed to CylinderSensorRotationTransform.set_rotation ] -->
<CylinderSensor DEF='RotatedCylinderSensor' description='Click and drag to rotate'>
<IS>
<connect nodeField='autoOffset' protoField='autoOffset'/>
<connect nodeField='diskAngle' protoField='diskAngle'/>
<connect nodeField='enabled' protoField='enabled'/>
<connect nodeField='minAngle' protoField='minAngle'/>
<connect nodeField='maxAngle' protoField='maxAngle'/>
<connect nodeField='offset' protoField='offset'/>
<connect nodeField='isActive' protoField='isActive'/>
<connect nodeField='rotation_changed' protoField='rotation_changed'/>
<connect nodeField='trackPoint_changed' protoField='trackPoint_changed'/>
</IS>
</CylinderSensor>


and in autotranslated VRML97:

     DEF RotatedCylinderSensor CylinderSensor {
	# description "Click and drag to rotate"
	diskAngle 0.26179167
	autoOffset IS autoOffset
	diskAngle IS diskAngle
	enabled IS enabled
	minAngle IS minAngle
	maxAngle IS maxAngle
	offset IS offset
	isActive IS isActive
	rotation_changed IS rotation_changed
	trackPoint_changed IS trackPoint_changed
     }

all the best, Don
--
Don Brutzman  Naval Postgraduate School, Code USW/Br       work +1.831.656.2149
             MOVES Institute, Monterey CA 93943-5000 USA  fax  +1.831.656.7599
Virtual worlds/underwater robots/X3D/XMSF     http://web.nps.navy.mil/~brutzman
-------------------------------------------------------------------------
for list subscription/unsubscription,
go to http://www.web3d.org/cgi-bin/public_list_signup/lwgate/listsavail.html