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

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



Hi all,

Oh my gawd!!! I can't believe I got this wrong!
I make a total retraction of what I said about eventIn and eventOut not being available inside PROTOs without a Script mediating.

A big thankyou to Brian Hay for putting me right here.

After Brian stated so certainly that it could actually be done I tried what he said. I was absolutely sure it illegal syntax. It is hard to describe how utterly astonished I was to see it work! Wonderful! I'm rapt to see I was so wrong (and a bit embarrassed too).

Here are the two examples I used to prove it to myself:

-----snip------

#VRML V2.0 utf8

PROTO timer[
   eventOut SFTime now
] {
   DEF ticker TimeSensor {
   	loop TRUE
   	time IS now
   }
}


Shape { geometry DEF readout Text { string "-" } }

DEF clock timer{}

DEF convert Script {
	eventIn SFTime time
	eventOut MFString str
	url "javascript:
		function time(now) {
			str[0]=now;
		}
	"
}

ROUTE clock.now TO convert.time
ROUTE convert.str TO readout.string

-----snip------

#VRML V2.0 utf8

PROTO bkg [
	eventIn SFBool thisSky
] {
	Background {
		skyAngle [ 1.07 1.45 1.52 1.57 ]
		skyColor [
			0.40 0.00 0.00
			0.80 0.00 0.00
			0.80 0.70 0.45
			0.80 0.75 0.60
			0.80 0.80 0.80
		]
		groundAngle [ 1.07 1.45 1.52 1.57 ]
		groundColor [
			0.20 0.50 0.00
			0.30 0.60 0.20
			0.40 0.70 0.30
			0.60 0.80 0.60
			0.80 0.80 0.80
		]
		set_bind IS thisSky
	}
}
#--------------

Background {
	skyAngle [ 1.07 1.45 1.52 1.57 ]
	skyColor [
		0.00 0.00 0.40
		0.00 0.00 0.80
		0.45 0.70 0.80
		0.60 0.75 0.80
		0.80 0.80 0.80
	]
	groundAngle [ 1.07 1.45 1.52 1.57 ]
	groundColor [
		0.20 0.50 0.00
		0.30 0.60 0.20
		0.40 0.70 0.30
		0.60 0.80 0.60
		0.80 0.80 0.80
	]
}

DEF redSky bkg{}

Group{
	children[
		DEF click TouchSensor{}
		Shape {
			geometry Box{}
		}
	]
}

ROUTE click.isActive TO redSky.thisSky

-----snip------


-- ---------=---------=---------=---------=---------=---------=------ A life! Cool! Where can I download one of those from? ---------=---------=---------=---------=---------=---------=------ http://werple.net.au/~miriam My live Journal page http://www.livejournal.com/users/miriam_e/ ------------------------------------------------------------------------- for list subscription/unsubscription, go to http://www.web3d.org/cgi-bin/public_list_signup/lwgate/listsavail.html