Builder/Builder/Common/plyfile.c
/******************************************************************************
Describe what the "other" properties are that are to be stored, and where
they are in an element.
******************************************************************************/
Describe what the "other" properties are that are to be stored, and where
they are in an element.
Describe what the " other " properties are that are to be stored and where they are in an element .
void ply_describe_other_properties(
  PlyFile *plyfile,
  PlyOtherProp *other,
  int offset
)
{
  int i;
  PlyElement *elem;
  PlyProperty *prop;
  elem = find_element (plyfile, other->name);
  if (elem == NULL) {
    fprintf(stderr, "ply_describe_other_properties: can't find element '%s'\n",
            other->name);
    return;
  }
  if (elem->nprops == 0) {
    elem->props = (PlyProperty **)
                  myalloc (sizeof (PlyProperty *) * other->nprops);
    elem->store_prop = (char *) myalloc (sizeof (char) * other->nprops);
    elem->nprops = 0;
  }
  else {
    int newsize;
    newsize = elem->nprops + other->nprops;
    elem->props = (PlyProperty **)
                  realloc (elem->props, sizeof (PlyProperty *) * newsize);
    elem->store_prop = (char *)
                  realloc (elem->store_prop, sizeof (char) * newsize);
  }
  for (i = 0; i < other->nprops; i++) {
    prop = (PlyProperty *) myalloc (sizeof (PlyProperty));
    copy_property (prop, other->props[i]);
    elem->props[elem->nprops] = prop;
    elem->store_prop[elem->nprops] = OTHER_PROP;
    elem->nprops++;
  }
  elem->other_size = other->size;
  elem->other_offset = offset;
}
void ply_describe_other_properties ( PlyFile * plyfile , PlyOtherProp * other , int offset ) { int i ; PlyElement * elem ; PlyProperty * prop ; elem = find_element ( plyfile , other -> name ) ; if ( elem == NULL ) { fprintf ( stderr , " \n " , other -> name ) ; return ; } if ( elem -> nprops == 0 ) { elem -> props = ( PlyProperty * * ) myalloc ( sizeof ( PlyProperty * ) * other -> nprops ) ; elem -> store_prop = ( char * ) myalloc ( sizeof ( char ) * other -> nprops ) ; elem -> nprops = 0 ; } else { int newsize ; newsize = elem -> nprops + other -> nprops ; elem -> props = ( PlyProperty * * ) realloc ( elem -> props , sizeof ( PlyProperty * ) * newsize ) ; elem -> store_prop = ( char * ) realloc ( elem -> store_prop , sizeof ( char ) * newsize ) ; } for ( i = 0 ; i < other -> nprops ; i ++ ) { prop = ( PlyProperty * ) myalloc ( sizeof ( PlyProperty ) ) ; copy_property ( prop , other -> props [ i ] ) ; elem -> props [ elem -> nprops ] = prop ; elem -> store_prop [ elem -> nprops ] = OTHER_PROP ; elem -> nprops ++ ; } elem -> other_size = other -> size ; elem -> other_offset = offset ; }
Describe what the "other" properties are that are to be stored, and where
they are in an element.
Describe what the " other " properties are that are to be stored and where they are in an element .
/* look for appropriate element */ /* create room for other properties */ /* copy the other properties */ /* save other info about other properties */