Braden McDaniel <br...@en...> wrote:
> vr...@he... wrote:
>> Hi Braden,
>>
>> thanks for the fast response.
>>
>> Braden McDaniel <br...@en...> wrote:
>>
>> vector<node_ptr> nodes = myBrowser->create_vrml_from_stream(nodeStream);
>>
>> viewpoint_node* viewpointPtr = node_cast<viewpoint_node*>(nodes[0].get());
>
> At this point you have a viewpoint_node, but it's not part of any
> scene. node::initialize needs to be called for it to be added to a
> scene.
That is what I was already assumed, but I couldn't give it a try, because I
don't know how to access the current scene, as it is private. Please give me a
hint.
> Changing nodes after they're created involves sending them events.
> You need to get the event_listener corresponding to the eventIn
> you're interested in and call
> field_value_listener<FieldValue>::process_event. Note that there are
> typedefs for the field_value_listener instances you might be
> interested in, so you can do something like this:
>
> sfvec3f_listener & listener =
> dynamic_cast<sfvec3f_listener &>(
> viewpointPtr->event_listener("set_position"));
> listener.process_event(new_pos, time);
>
> "time" you probably want to get from browser::current_time.
Thanks this works very well and does exact what I wanted it to, but this
doesn?t work with the default viewpoint, so if I want to make changes I has
to create viepoint first. That's why I need to access the scene now, as
mentioned above.
> Oh, if you're using the CVS version, the first part of the above is a
> bit tidier:
>
> sfvec3f_listener & listener =
> viewpointPtr->event_listener<sfvec3f>("set_position");
You're right this looks much tidier and nicer, but at the moment I
think I'll go on using the last release version.
> I can provide more exposition if necessary. However, I'm inclined to
> drop useful hints as I tend to be interested in seeing how well the
> API explains itself.
Thanks for all the support so far! It helps me to understand how
openVrml works.
>>> PS: The openvrml-develop mailing list permits posting only by
>>> subscribers in order to curb spam. Please subscribe to the list if you
>>> intend to continue posting.
>>
>> Just used the wrong email address, Sorry for that!
>
> Perhaps you have discovered this already; but it is possible to
> subscribe multiple e-mail addresses and disable mail delivery to all
> but one of them (using the MailMan Web interface).
Oh thanks I really didn't know that.
[x] subscribe multiple e-mail addresses
Cheers
Joerg
|