ygVolUtil derived from none

Author: Dave Pape
Revision: 11/01/01

**** Parsing a message to create a volume ****

***** GeoSet creation ****

static pfGeoSet * makeBoxWireGeoset(ygBox * box)
    {
    pfGeoSet *gset = new pfGeoSet;
    pfVec3 * verts = (pfVec3 *) pfMalloc(8 * sizeof(pfVec3),pfGetSharedArena());
    int *lengths = (int *) pfMalloc(8 * sizeof(int),pfGetSharedArena());
    ushort *ilist_v = (ushort *) pfMalloc(24 * sizeof(ushort),pfGetSharedArena());
    pfVec4 *color = (pfVec4 *) pfMalloc(sizeof(pfVec4),pfGetSharedArena());
    ushort *ilist_c = (ushort *) pfMalloc(1 * sizeof(ushort),pfGetSharedArena());
    gset->setPrimType(PFGS_LINESTRIPS);
    gset->setNumPrims(8);
    lengths[0] = 10;
    lengths[1] = 2;
    lengths[2] = 2;
    lengths[3] = 2;
    lengths[4] = 2;
    lengths[5] = 2;
    lengths[6] = 2;
    lengths[7] = 2;
    gset->setPrimLengths(lengths);
    verts[0] = box->min;
    verts[1][0] = box->max[0];  verts[1][1] = box->min[1];
      verts[1][2] = box->min[2];
    verts[2][0] = box->max[0];  verts[2][1] = box->max[1];
      verts[2][2] = box->min[2];
    verts[3][0] = box->min[0];  verts[3][1] = box->max[1];
      verts[3][2] = box->min[2];
    verts[4][0] = box->min[0];  verts[4][1] = box->min[1];
      verts[4][2] = box->max[2];
    verts[5][0] = box->max[0];  verts[5][1] = box->min[1];
      verts[5][2] = box->max[2];
    verts[6] = box->max;
    verts[7][0] = box->min[0];  verts[7][1] = box->max[1];
      verts[7][2] = box->max[2];
    ilist_v[0] = 0;   ilist_v[1] = 1;   ilist_v[2] = 2;   ilist_v[3] = 3;
      ilist_v[4] = 0;   ilist_v[5] = 4;   ilist_v[6] = 5;   ilist_v[7] = 6;
      ilist_v[8] = 7;   ilist_v[9] = 4;
    ilist_v[10] = 1;   ilist_v[11] = 5;
    ilist_v[12] = 2;   ilist_v[13] = 6;
    ilist_v[14] = 3;   ilist_v[15] = 7;
    ilist_v[16] = 4;   ilist_v[17] = 1;
    ilist_v[18] = 5;   ilist_v[19] = 2;
    ilist_v[20] = 6;   ilist_v[21] = 3;
    ilist_v[22] = 7;   ilist_v[23] = 0;
    gset->setAttr(PFGS_COORD3, PFGS_PER_VERTEX, verts, ilist_v);
    color->set(1,1,1,1);
    ilist_c[0] = 0;
    gset->setAttr(PFGS_COLOR4, PFGS_OVERALL, color, ilist_c);
    gset->setLineWidth(1.0);
    gset->setGState(new pfGeoState);
    return gset;
    }

    Comments