Re: Modifying GeoSet Geometry...

New Message Reply Date view Thread view Subject view Author view

John Rohlf (jrohlf++at++tubes)
Mon, 9 Jan 95 11:30:54 PST


>
>
> I am trying to modify the geomety (polygon vertices) of a pfGeoSet
> object and have not found a solution for doing this yet.
>
> I initially know of a several polygonal objects(say a pyramid and
> cube) and I want to create 100 clones of the original objects, but
> each having their geometry altered from the original model. For
> example, depending on a certain parameter, the height of one pyramid
> might be higher than another cloned pyramid. I have investigated the
> following two solutions with no success:
>
> 1) I create the object in Performer by first creating a new
> pfGeoSet and setting the geometry of the object using:
>
> pfGSetAttr(gset, PFGS_COORD3, PFGS_PER_VERTEX, poly_list, NULL);
>
> where poly_list is a list of my geometry. Next, I set this pfGeoSet
> to a new pfGeode. I create a pfGeoState and pfMaterial for this
> pfGeoSet and give color, etc. This solution worked fine, except that
> when the object gets rendered, it is flat shaded. It has no shading at
> all, just a solid color.
>
> Any suggestions?????

         
        For lighting, make sure your geoset has normals, and
        you've set up a pfLight, a pfLightModel, and you
        have enabled lighting with pfEnable(PFEN_LIGHTING).

> 2) I created master objects using i3dm and save the objects as sv format.
> When I use the sv loader, the objects are shaded correctly, but I
> cannot get access to their geometry. In order to make each cloned
> oject with its own geometry, I don't use pfClone, because, as I
> understand it, pfClone doesn't copy the object geometry. Therefore
> I use pfCopy for the objects pfGeoSet, pfGeoState, and pfMaterial.
> Once, the object has been completely copied, I querey the geometry
> list with:
>
> pfGetGSetAttrLists(gset, PFGS_COORDS3, (void**)poly_list, (ushort** i));
>
> The contents of poly_list is all zeros, not the geometry, yet when I
> querey the number of vertices and triangles in the pfGeoSet, the
> correct values get returned, I just a cannot get the old geomtry.

        pfCopy copies geoset arrays by reference rather than by value.
        I don't know why your list is all zeros but you'll need to
        clone the arrays yourself:

        newCoords = pfMalloc(pfGetMallocSize(poly_list),
                             pfGetMallocArena(poly_list));

        pfCopy(newCoords, poly_list);

        pfGSetAttr(cloneGSet, PFGS_COORD3, PFGS_PER_VERTEX,
                                        newCoords, NULL);

        Hopefully in the next release pfClone will handle geometry.


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:50:51 PDT

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