Re: Rephrase: Objects in strings

New Message Reply Date view Thread view Subject view Author view

Mario Veraart (rioj7++at++fel.tno.nl)
Tue, 14 Apr 1998 12:41:34 +0200 (MET DST)


>
> > Performers,
> >
> > I have a couple of questions. I'll include the easy one first.
>
> Okay, I blew the easy question by not being clear.
>
> The gist of what I am looking for is not the ability to turn
> strings into Performer objects, but to turn the objects described
> by the strings into Performer objects.
>
> > In some Inventor programs I wrote a while back, I often included
> > ascii descriptions of simple objects directly in the executable,
> > stored as strings. The MakeObject() function then converted the
> > Ascii-Inventor format into a node/graph.
>
> For example (and I know I should have done this the first time),
> if I want to make an object that consists of four cubes arranged
> in a square in an alternating black and white sequence, I can
> describe it in Inventor's ascii forat as:
>
> static char *plumb_marker_str =
> "Separator {"
> " Material { }"
> " DEF plumb_translate Translation { }"
> " Translation { translation -0.5 -0.5 0.5 }"
> " Cube { width 1 height 1 depth 1 }"
> " Translation { translation 1 0 -1 }"
> " Cube { width 1 height 1 depth 1 }"
> " Material { diffuseColor 0 0 0 }"
> " Translation { translation 0 0 1 }"
> " Cube { width 1 height 1 depth 1 }"
> " Translation { translation -1 0 -1 }"
> " Cube { width 1 height 1 depth 1 }"
> "}";
>
> Now (in Inventor), if I want to make a node containing the
> object described by this string, I do the following:
>
> SoSeparator *in_graph;
> in_graph = MakeObject(plumb_marker_str);
> plumb_marker->addChild(in_graph);
>
> > I would like to be able to do this in Performer, but haven't
> > had any luck finding a similar function.
> >
> > Is there an easy way to do this?
> >
> > And, thinking for the future, will this be possible in OpenGL++,
> > or whatever will come out next? I thought it was a really handy
> > feature of Inventor.
>
> I hope this is a little clearer than my previous ambiguous phrasing.
>
> Thanks again,
> Bill

You can take a look at the Inventeor loader that comes with performer.
What it does is use Inventor to load the .iv file and then traverses
the inventor scene graph and converts it to Performer. So you can use
the inventor calls to set up a scene graph and use a function from the
performer-inventor loader to make it into a Performer tree.

Mario
=======================================================================
List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/
            Submissions: info-performer++at++sgi.com
        Admin. requests: info-performer-request++at++sgi.com


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:57:14 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.