Пример #1
0
// Flushes out a queue of interpolation commands
void Mesher::flush_queue()
{
    Vec3f low[MIN_VOLUME];
    Vec3f high[MIN_VOLUME];

    // Go through the list, saving a list of vertex pairs on which
    // interpolation should be run into low and high.
    unsigned count=0;
    for (auto c : queue)
    {
        if (c.cmd == InterpolateCommand::INTERPOLATE)
        {
            low[count] = c.v0;
            high[count] = c.v1;
            count++;
        }
    }

    if (count)
        eval_zero_crossings(low, high, count);

    // Next, go through and actually load vertices
    // (either directly or from the cache)
    count = 0;
    for (auto c : queue)
    {
        if (c.cmd == InterpolateCommand::INTERPOLATE)
        {
            push_vert(ex[count], ey[count], ez[count]);
            count++;
        }
        else if (c.cmd == InterpolateCommand::CACHED)
        {
            unsigned i = c.cached;
            push_vert(ex[i], ey[i], ez[i]);
        }
        else if (c.cmd == InterpolateCommand::END_OF_VOXEL)
        {
            if (detect_edges)
            {
                // Clear voxel_end
                // (it will be reset when the next triangle is pushed)
                voxel_end = triangles.end();

                // Then, iterate until no more features are found in
                // the current voxel.
                while (voxel_start != voxel_end &&
                       voxel_start != triangles.end())
                {
                    check_feature();
                }

                // Clear voxel_start
                // (it will be reset when the next triangle is pushed)
                voxel_start = triangles.end();
            }
        }
    }
    queue.clear();
}
Пример #2
0
static void CALLBACK vertexCallback(void *vertex_data)
{
  GLdouble *verts=(GLdouble *)vertex_data;
  push_vert(Field(*prim,kind), verts[0], verts[1], verts[2]);
}