[vtkusers] Problem with AddLODMapper and vtkTransform
KM
karanovicm at gmail.com
Wed Feb 8 09:41:59 EST 2012
Hello all,
I'm having the problem with LODActor and transformations. I have three Hi,
Med and Low resolution mappers assigned to my Actor. First Hi res mapper is
assigned using "SetMapper" while other two were added with AddLODMapper,
Everything works fine until I use transformation to rotate or translate
actor. Hi res mapper is rendering correctly, but med and low resolution
mappers during the interaction with a mouse were rendered at the original
position, and as soon interaction is finished, hi res mapper is rendered at
correct translated position.
Please, take a look at my pipeline, what I'm doing wrong
Thanks a million.
void UpdateActor()
{
vtkExtractEdges edgesFilter=new vtkExtractEdges();
vtkTransform transform = new vtkTransform();
vtkGeometryFilter filter = new vtkGeometryFilter();
vtkTransformFilter tf = new vtkTransformFilter();
vtkOutlineFilter outline = new vtkOutlineFilter();
vtkMaskPolyData ptMask = new vtkMaskPolyData();
vtkPolyDataMapper MedMaper;
vtkPolyDataMapper Mapper;
vtkPolyDataMapper OutlineMapper;
vtkDataSetSurfaceFilter surfFilter;
vtkDataSetSurfaceFilter MedSurfFilter;
for (int k = 0; k < dataSource.nlay; k++)
{
transform = new vtkTransform();
transform.RotateZ(DataSource.ROT);
transform.PostMultiply();
transform.Translate(DataSource.XOFF, DataSource.YOFF, 0);
transform.Scale(1, 1, DataSource.SCALE);
transform.Translate(0.0, 0.0, DataSource.EXPLODE * (DataSource.nlay
- 1 - k) * (DataSource.Zmax - DataSource.Zmin) / DataSource.nlay);
tf = new vtkTransformFilter();
tf.SetInput(DataSource.MFUGrid[k]);
tf.SetTransform(transform);
tf.Update();
filter = new vtkGeometryFilter();
filter.SetInputConnection(tf.GetOutputPort());
filter.Update();
surfFilter = new vtkDataSetSurfaceFilter();
surfFilter.SetInput(filter.GetOutput());
surfFilter.Update();
outline.SetInput(surfFilter.GetOutput());
outline.Modified();
ptMask.SetInputConnection(surfFilter.GetOutputPort());
ptMask.SetOnRatio(10);
MedSurfFilter = new vtkDataSetSurfaceFilter();
MedSurfFilter.SetInput(ptMask.GetOutput());
MedSurfFilter.SetPieceInvariant(1);
MedSurfFilter.Update();
Mapper = vtkPolyDataMapper.New();
MedMaper =vtkPolyDataMapper.New();
OutlineMapper =vtkPolyDataMapper.New();
Mapper.SetInputConnection(surfFilter.GetOutputPort());
MedMaper.SetInputConnection(MedSurfFilter.GetOutputPort());
OutlineMapper.SetInputConnection(outline.GetOutputPort());
Mapper.SetScalarModeToUseCellFieldData();
switch (showwhat)
{
case GRIDPropType.LayerID:
Mapper.SelectColorArray("Layers");
MedMaper.SelectColorArray("Layers");
break;
case GRIDPropType.LayerThickness:
Mapper.SelectColorArray("Thickness");
MedMaper.SelectColorArray("Thickness");
break;
case GRIDPropType.Row:
Mapper.SelectColorArray("Rows");
MedMaper.SelectColorArray("Rows");
break;
case GRIDPropType.Column:
Mapper.SelectColorArray("Columns");
MedMaper.SelectColorArray("Columns");
break;
}
Mapper.SetLookupTable(CTF);
Mapper.ImmediateModeRenderingOn();
MedMaper.SetLookupTable(CTF);
MedMaper.ImmediateModeRenderingOn();
GRIDAactor[k].SetLowResFilter(outline);
GRIDAactor[k].SetMediumResFilter(outline);
GRIDAactor[k].SetMapper(Mapper);
// GRIDAactor[k].AddLODMapper(Mapper);
GRIDAactor[k].AddLODMapper(OutlineMapper);
GRIDAactor[k].AddLODMapper(MedMaper);
//GRIDAactor[k].GetProperty().SetInterpolationToGouraud();
//GRIDAactor[k].GetProperty().ShadingOn();
switch (ShowAs)
{
case DisplayAs.Points:
GRIDAactor[k].GetProperty().SetRepresentationToPoints();
break;
case DisplayAs.Surface:
GRIDAactor[k].GetProperty().SetRepresentationToSurface();
break;
case DisplayAs.Wireframe:
GRIDAactor[k].GetProperty().SetRepresentationToWireframe();
break;
}
MedSurfFilter.Dispose();
surfFilter.Dispose();
edgesFilter.Dispose();
filter.Dispose();
Mapper.Dispose();
tf.Dispose();
MedMaper.Dispose();
OutlineMapper.Dispose();
transform.Dispose();
}
--
View this message in context: http://vtk.1045678.n5.nabble.com/Problem-with-AddLODMapper-and-vtkTransform-tp5466679p5466679.html
Sent from the VTK - Users mailing list archive at Nabble.com.
More information about the vtkusers
mailing list