Hi,
You can do the actions you mention (change colours, alter transformations
for squashing and stetching) with VRML scripting.
It really depends on how you want these changes to be activated. If
the action is self containted in the VRML model (for instance simple
animations and triggering actions off timers) all you need to do is write
the VRML scripts as if you were doing a normal VRML animation. There
should be loads of tutorials on the web to help you.
If you want the ARToolKit to trigger the animations, for instance by
manipulating the markers, it's going to be a more complicated. I was doing
this a while ago, and from what I remember, you need to change the ARVRML
library slightly so that you can start up VRML scripts from your ARToolKit
application.
This code is a bit old, and I'm not sure if it will still work. You should
add this type of function to the vrml97.cpp file. When you call this from
your artoolkit application, the function should will look for the script
node in that VRML file and fire the event using the queueEvent method.
The eventIn argument is the name of the Script method in the VRML Script
node. In the example below for instance, it should be "Test".
void fireSFStringEvent(int i, char * stringIn, char * eventIn, int objectnum) {
VrmlNode * myNode = (* (*(*viewer[i]->vrmlScene).getRoot()).toGroup()).child(0);
double timestamp = theSystem->time();
VrmlSFString * myValue = new VrmlSFString(stringIn);
viewer[i]->vrmlScene->queueEvent(timestamp, myValue, myNode, eventIn);
}
The VRML script would look something like:
DEF script Script {
directOutput TRUE
mustEvaluate TRUE
eventIn SFString Test
url["javascript:
function Test(stuff) {
print (stuff)
}
"]
}
I think thats how it worked, at least! Has anyone else done this kind of
thing? Did you do it like I did or is there a better way?
Hope this has helped,
Patrick Sinclair
On Wed, 13 Nov 2002, Rodney Berry wrote:
> Hi all,
>
> I want to make some changes to VRML models in real time without loading
> in a new one. at the moment, we are loading in a different models to
> show changes in characteristics/states in the display.
>
> for example, I want to make a model flash when the system receives a
> certain input (in this case midi note triggers) I figure that it should
> be possible to temporarily increment all three rgb color values to get a
> sudden brightening.
>
> I'd also like to stretch and squash models and whatever other ways I can
> mess with them without having a ridiculous number of alternate versions
> of the one model loaded in the backgroung (grinding my display to a halt)
>
> anyone been doing this kind of thing?
>
> Rodney
>
>
|