John Stewart wrote:
>
> Hello all;
>
> I am probably 99% of the way to getting Vnet to work with Linux.
>
> Can someone tell me how *exactly* objects are added to a local
> scene? I add the proto, and I add the Avatar, but nothing is
> displayed.
>
> Is there a document anywhere that describes the internals???
>
> (I am rolling my own EAI implementation, and am adding a lot of
> code and bug-fixes to the FreeWRL Browser, and I am not really
> competent on VRML... if I knew how things were supposed to work,
> I'd have a better chance of getting it right!)
>
> Thanks;
>
> John Stewart
> [EMAIL PROTECTED]
quick and dirty from my notes:
handshake:
client -> server [nickname:UTF avatar_url:UTF] # not normal msg format
server -> client [user_oid:int] # single int, your oid
server -> client (oid, attribute, value)* # all triplets in world
server -> except (oid, ADD_OBJECT, avatar_url)
server -> except (oid, POSITION, <pos>) # initial position?
server -> except (oid, ORIENTATION, <ori>) # initial orientation?
server -> except (oid, SCALE, <scale>) # initial scale?
server -> except (oid, NAME, <name>) # nickname (why MF?)
server -> except (oid, USER_INFO, <name>) # nickname (again?)
server -> except (oid, MESSAGE, "[<nickname(oid)> has connected]")
where "except" means the server sends the message to all the clients
except the one that sent the message to the server in the first place, and
server -> client means the message just gets sent back to the original
client. these notes are old and not very reliable to begin with, so you're
on your own as far as correctness goes...
the message to notice here is "ADD_OBJECT". messages are handled
in Dispatcher::onNetInput(). onNetInput uses EAISceneInterface::createObject
which in turn just returns a new EAIObject. The EAIObject constructor
constructs the proto template that wraps all the avatars and makes a note
of the avatar_url. Now it gets a little tricky. EAIObject retains the avatar_url
and an event pointer to where the actual avatar vrml will _later_ be added, but
returns from its constructor with just the proto wrapper actually instantiated.
This proto wrapper is added by onNetInput to the scene immediately using
EAISceneInterface::addObject(), but it's not until a few lines later that
EAIObject::load() is called. EAIObject>::load is the code that actually does
the createVrmlFromURL() call. remember: createVrmlFromURL is _asynchronous_ so
the actual avatar vrml gets added "sometime in the future" after this call
is made. when it does happen, the EAIObject::onLoaded() callback gets called, and
the avatar vrml is scanned for behaviours.
so, how _exactly_ objects are loaded is pretty complex, and the loading
process itself is spread out over time with some tricky ordering.
a couple of other things: a) liquid reality already runs this stuff on linux,
and is (still?) available from stephen's web site. b) i hacked up an interface
to vnet for my late lamented java baded vrml browser, and it pretty much worked
on linux. c) forest world is hell on browsers, i suggest it only as an "advanced"
test case d) sfw's "test world" is good to start with, and suprisingly, townsquare
is pretty easy as well. e) vnet doesn't do anything too funky with the eai, so if
you can grab event objects and createVrmlFromString/URL works, you should be
set...
good luck!
-cks