suggested (minor) revision in vtkVRMLExporter

pahsieh at usgs.gov pahsieh at usgs.gov
Tue May 23 01:35:45 EDT 2000


The current version (nightly 5/22/00) of vtkVRMLExporter doesn't work
for cell data because the exported vrml file lacks the line

    colorPerVertex FALSE

to indicate that colors should be assigned to faces instead of vertices.

I would suggest the following revision in the method WriteAnActor:

1. Define a local variable (after pntData is defined):

  int colorPerFace = (anActor->GetMapper()->GetScalarMode() ==
VTK_SCALAR_MODE_USE_CELL_DATA)
                     || (pntData->GetScalars() == NULL);


This indicates that colors should be assigned to faces if either the mapper
is set to use cell data, or if there are no scalar point data.

2. At the end of writing out polys, insert 4 lines as indicated below:

  // write out polys if any
  if (pd->GetNumberOfPolys() > 0)
  {

    ....

    fprintf(fp,"            ]\n");
    // ****Insert the following 4 lines****
    if (colorPerFace)
    {
      fprintf(fp,"            colorPerVertex FALSE\n");
    }
    // ****End of insertion****
    fprintf(fp,"          }\n");
  }

3. Do the same at the end of writing out lines:

  // write out lines if any
  if (pd->GetNumberOfLines() > 0)
  {

    ....

    fprintf(fp,"            ]\n");
    // ****Insert the following 4 lines****
    if (colorPerFace)
    {
      fprintf(fp,"            colorPerVertex FALSE\n");
    }
    // ****End of insertion****
    fprintf(fp,"          }\n");
  }

I don't quite know what to do about triangle strips, but I
hope the above suggestion would be a partial fix.

Paul


--------------------------------------------------------------------
This is the private VTK discussion list. Please keep messages on-topic.
Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at public.kitware.com>. For help, send message body containing
"info vtkusers" to the same address.
--------------------------------------------------------------------



More information about the vtkusers mailing list