Billboards using LoadFlt

New Message Reply Date view Thread view Subject view Author view

Todd R Pravata (tpravata++at++rts.dseg.ti.com)
Wed, 28 Sep 94 13:19:03 CDT


> We are using LoadFlt and we have tried typecasting that to a
> pfBillboard - that didn't work. We also tried typecasting LoadFlt to
> a pfGeode and then extracting its pfGeoSet and inserting it into a
> pfBillboard, but we couldn't get the pfGeoSet.
>
> Any suggestions or examples would be appreciated.

Here's the code I am using to do the same thing (pretty straightforward).
I have not tried it with FLT format files.

/* FUNCTION
 *
 * find_geode
 *
 * DESCRIPTION
 *
 * Finds the first geode in the input DAG by recursively decending
 * to "leaf" nodes. Assumes that the DAG is built for a single
 * stamped model.
 *
 * RETURNS
 *
 * pointer to a Geode
 *
 * NOTES
 *
 * AUTHOR
 *
 * Todd Pravata, Texas Instruments, 6/94
 */

static pfGeode *find_geode(pfNode *node)
{
  long type;
  long num_children;
  pfGeode *geode;
  int i;

  type = pfGetType(node);

  if (type & PFCLASS_GROUP) {
    num_children = pfGetNumChildren(node);

    for (i = 0; i < num_children; ++i) {
      geode = find_geode(pfGetChild((pfGroup *)node, i));
      if (geode != NULL) return(geode);
    }
  }
  else if (type == PFTYPE_GEODE)
    return((pfGeode *)node);

  return(NULL);
}

/* FUNCTION
 *
 * add_stamp_geoset
 *
 * DESCRIPTION
 *
 * Add the geometry from the stamp (built from S1000 data) to the
 * input billboard. The billboard contains multiple Geosets each
 * with their own stamp geometry.
 *
 * RETURNS
 *
 * void
 *
 * NOTES
 *
 * AUTHOR
 *
 * Todd Pravata, Texas Instruments, 6/94
 */

static void add_stamp_geoset(pfBillboard *bboard, pfNode *stamp)
{
  pfGeode *geode;

  geode = find_geode(stamp);
  if (geode != NULL) {
    if (pfGetNumGSets(geode) != 1)
      fprintf(stderr, "pfS1K: Warning - geode has wrong number of geosets %d\n",
              pfGetNumGSets(geode));
    pfAddGSet((pfGeode *)bboard, pfGetGSet(geode, 0));
  }
  else
    fprintf(stderr, "pfS1K: cannot find geode for stamp\n");
}


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:33 PDT

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