Commit b8556888 authored by Utkarsh Ayachit's avatar Utkarsh Ayachit

BUG: Fixes BUG #2809. vtkPainter now passes along a vtkDataObject. Restructured

the painter hierarchy to make those painters that don't really use polydata to
be subclasses of vtkPainter (they were made subclasses of vtkPolyDataPainter so
  that they could pass the polydata along the pipeline).

ENH: Added new vtkMultiGroupPolyDataMapper2 and vtkCompositePainter for
rendering composite datasets without using multiple mappers.
vtkMultiGroupPolyDataMapper2 will create a single display list for rendering all
blocks when display lists are enabled.
parent db9b4328
......@@ -36,6 +36,7 @@ SET( Kit_SRCS
vtkChooserPainter.cxx
vtkClipPlanesPainter.cxx
vtkCoincidentTopologyResolutionPainter.cxx
vtkCompositePainter.cxx
vtkCullerCollection.cxx
vtkCuller.cxx
vtkDataSetMapper.cxx
......@@ -87,6 +88,7 @@ SET( Kit_SRCS
vtkMapperCollection.cxx
vtkMapper.cxx
vtkMultiGroupPolyDataMapper.cxx
vtkMultiGroupPolyDataMapper2.cxx
vtkOBJExporter.cxx
vtkObserverMediator.cxx
vtkOOGLExporter.cxx
......
......@@ -28,7 +28,7 @@
#include "vtkStandardPolyDataPainter.h"
#include "vtkTStripsPainter.h"
vtkCxxRevisionMacro(vtkChooserPainter, "1.4");
vtkCxxRevisionMacro(vtkChooserPainter, "1.5");
vtkStandardNewMacro(vtkChooserPainter);
vtkCxxSetObjectMacro(vtkChooserPainter, VertPainter, vtkPolyDataPainter);
......@@ -98,7 +98,7 @@ void vtkChooserPainter::PrepareForRendering(vtkRenderer* ren, vtkActor* actor)
if (this->PaintersChoiceTime < this->MTime ||
this->PaintersChoiceTime < this->Information->GetMTime() ||
this->LastRenderer != ren ||
this->PaintersChoiceTime < this->PolyData->GetMTime())
this->PaintersChoiceTime < this->GetInput()->GetMTime())
{
this->LastRenderer = ren;
// Choose the painters.
......@@ -291,19 +291,20 @@ vtkPolyDataPainter* vtkChooserPainter::CreatePainter(const char *paintertype)
void vtkChooserPainter::RenderInternal(vtkRenderer* renderer, vtkActor* actor,
unsigned long typeflags)
{
vtkIdType numVerts = this->PolyData->GetNumberOfVerts();
vtkIdType numLines = this->PolyData->GetNumberOfLines();
vtkIdType numPolys = this->PolyData->GetNumberOfPolys();
vtkIdType numStrips = this->PolyData->GetNumberOfStrips();
vtkPolyData* pdInput = this->GetInputAsPolyData();
vtkIdType numVerts = pdInput->GetNumberOfVerts();
vtkIdType numLines = pdInput->GetNumberOfLines();
vtkIdType numPolys = pdInput->GetNumberOfPolys();
vtkIdType numStrips = pdInput->GetNumberOfStrips();
vtkIdType total_cells = (typeflags & vtkPainter::VERTS)?
this->PolyData->GetNumberOfVerts() : 0;
pdInput->GetNumberOfVerts() : 0;
total_cells += (typeflags & vtkPainter::LINES)?
this->PolyData->GetNumberOfLines() : 0;
pdInput->GetNumberOfLines() : 0;
total_cells += (typeflags & vtkPainter::POLYS)?
this->PolyData->GetNumberOfPolys() : 0;
pdInput->GetNumberOfPolys() : 0;
total_cells += (typeflags & vtkPainter::STRIPS)?
this->PolyData->GetNumberOfStrips() : 0;
pdInput->GetNumberOfStrips() : 0;
if (total_cells == 0)
{
......
......@@ -18,16 +18,16 @@
#ifndef __vtkClipPlanesPainter_h
#define __vtkClipPlanesPainter_h
#include "vtkPolyDataPainter.h"
#include "vtkPainter.h"
class vtkInformationObjectBaseKey;
class vtkPlaneCollection;
class VTK_RENDERING_EXPORT vtkClipPlanesPainter : public vtkPolyDataPainter
class VTK_RENDERING_EXPORT vtkClipPlanesPainter : public vtkPainter
{
public:
static vtkClipPlanesPainter* New();
vtkTypeRevisionMacro(vtkClipPlanesPainter, vtkPolyDataPainter);
vtkTypeRevisionMacro(vtkClipPlanesPainter, vtkPainter);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
......
/*=========================================================================
Program: Visualization Toolkit
Module: vtkCompositePainter.cxx
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#include "vtkCompositePainter.h"
#include "vtkCompositeDataIterator.h"
#include "vtkCompositeDataSet.h"
#include "vtkGarbageCollector.h"
#include "vtkInformation.h"
#include "vtkInformationIntegerKey.h"
#include "vtkObjectFactory.h"
#include "vtkPainterDeviceAdapter.h"
#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "vtkCellData.h"
#ifndef VTK_IMPLEMENT_MESA_CXX
# include "vtkOpenGL.h"
#endif
vtkStandardNewMacro(vtkCompositePainter);
vtkCxxRevisionMacro(vtkCompositePainter, "1.1");
vtkInformationKeyMacro(vtkCompositePainter, COLOR_LEAVES, Integer);
//----------------------------------------------------------------------------
vtkCompositePainter::vtkCompositePainter()
{
this->ColorLeaves = 0;
this->OutputData = 0;
}
//----------------------------------------------------------------------------
vtkCompositePainter::~vtkCompositePainter()
{
}
//----------------------------------------------------------------------------
void vtkCompositePainter::ProcessInformation(vtkInformation* info)
{
this->Superclass::ProcessInformation(info);
if (info->Has(COLOR_LEAVES()))
{
this->SetColorLeaves(info->Get(COLOR_LEAVES()));
}
else
{
this->SetColorLeaves(0);
}
}
//----------------------------------------------------------------------------
vtkDataObject* vtkCompositePainter::GetOutput()
{
return this->OutputData? this->OutputData : this->GetInput();
}
//----------------------------------------------------------------------------
void vtkCompositePainter::RenderInternal(vtkRenderer* renderer, vtkActor* actor,
unsigned long typeflags)
{
vtkPainterDeviceAdapter* device = renderer->GetRenderWindow()->
GetPainterDeviceAdapter();
vtkCompositeDataSet* input = vtkCompositeDataSet::SafeDownCast(this->GetInput());
if (!input || !this->DelegatePainter)
{
this->Superclass::RenderInternal(renderer, actor, typeflags);
return;
}
//turn off antialising and lighting so that the colors we draw will be the
//colors we read back
int origMultisample = device->QueryMultisampling();
int origLighting = device->QueryLighting();
int origBlending = device->QueryBlending();
if (this->ColorLeaves)
{
device->MakeMultisampling(0);
device->MakeLighting(0);
device->MakeBlending(0);
}
vtkCompositeDataIterator* iter = input->NewIterator();
unsigned int index=1; // start from 1 since 0 cannot be a color.
for (iter->InitTraversal(); !iter->IsDoneWithTraversal();
iter->GoToNextItem(), index++)
{
vtkDataObject* dobj = iter->GetCurrentDataObject();
if (dobj)
{
if (this->ColorLeaves)
{
unsigned char params[4] = {255, 255, 0, 255};
params[0] = static_cast<unsigned char>(index & 0x0000ff);
params[1] = static_cast<unsigned char>((index & 0x00ff00)>>8);
params[2] = static_cast<unsigned char>((index & 0xff0000)>>16);
params[3] = 255;
float color[4];
color[0] = params[0]/255.0;
color[1] = params[1]/255.0;
color[2] = params[2]/255.0;
color[3] = params[3]/255.0;
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, color);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, color);
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, color);
}
this->DelegatePainter->SetInput(dobj);
this->OutputData = dobj;
this->Superclass::RenderInternal(renderer, actor, typeflags);
this->OutputData = 0;
}
}
iter->Delete();
if (this->ColorLeaves)
{
//reset lighting back to the default
device->MakeBlending(origBlending);
device->MakeLighting(origLighting);
device->MakeMultisampling(origMultisample);
}
}
//-----------------------------------------------------------------------------
void vtkCompositePainter::ReportReferences(vtkGarbageCollector *collector)
{
this->Superclass::ReportReferences(collector);
vtkGarbageCollectorReport(collector, this->OutputData, "Output");
}
//----------------------------------------------------------------------------
void vtkCompositePainter::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os, indent);
os << indent << "ColorLeaves: " << this->ColorLeaves << endl;
}
/*=========================================================================
Program: Visualization Toolkit
Module: vtkCompositePainter.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// .NAME vtkCompositePainter - painter that can be inserted before any
// vtkDataSet painting chain to handle composite datasets.
// .SECTION Description
// vtkCompositePainter iterates over the leaves in a composite datasets.
// This painter can also handle the case when the dataset is not a composite
// dataset.
#ifndef __vtkCompositePainter_h
#define __vtkCompositePainter_h
#include "vtkPainter.h"
class vtkInformationIntegerKey;
class VTK_RENDERING_EXPORT vtkCompositePainter : public vtkPainter
{
public:
static vtkCompositePainter* New();
vtkTypeRevisionMacro(vtkCompositePainter, vtkPainter);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// When this key is present and set to 1 in the information passed to the
// painter, the painter colors each block using a unique color.
static vtkInformationIntegerKey* COLOR_LEAVES();
// Description:
// Get the output data object from this painter. The default implementation
// simply forwards the input data object as the output.
virtual vtkDataObject* GetOutput();
//BTX
protected:
vtkCompositePainter();
~vtkCompositePainter();
// Description:
// Take part in garbage collection.
virtual void ReportReferences(vtkGarbageCollector *collector);
// Description:
// Called before RenderInternal() if the Information has been changed
// since the last time this method was called.
// Overridden to update the state of COLOR_LEAVES key.
virtual void ProcessInformation(vtkInformation*);
// Description:
// Performs the actual rendering. Subclasses may override this method.
// default implementation merely call a Render on the DelegatePainter,
// if any. When RenderInternal() is called, it is assured that the
// DelegatePainter is in sync with this painter i.e. UpdateDelegatePainter()
// has been called.
virtual void RenderInternal(vtkRenderer* renderer, vtkActor* actor,
unsigned long typeflags);
vtkSetMacro(ColorLeaves, int);
vtkGetMacro(ColorLeaves, int);
int ColorLeaves;
vtkDataObject* OutputData;
private:
vtkCompositePainter(const vtkCompositePainter&); // Not implemented.
void operator=(const vtkCompositePainter&); // Not implemented.
//ETX
};
#endif
......@@ -27,7 +27,7 @@
#include "vtkRepresentationPainter.h"
vtkStandardNewMacro(vtkDefaultPainter);
vtkCxxRevisionMacro(vtkDefaultPainter, "1.4");
vtkCxxRevisionMacro(vtkDefaultPainter, "1.5");
vtkCxxSetObjectMacro(vtkDefaultPainter, DefaultPainterDelegate, vtkPainter);
vtkCxxSetObjectMacro(vtkDefaultPainter, ScalarsToColorsPainter,
vtkScalarsToColorsPainter);
......@@ -91,9 +91,9 @@ vtkDefaultPainter::~vtkDefaultPainter()
//-----------------------------------------------------------------------------
void vtkDefaultPainter::BuildPainterChain()
{
vtkPolyDataPainter* headPainter = 0;
vtkPolyDataPainter* prevPainter = 0;
vtkPolyDataPainter* painter = 0;
vtkPainter* headPainter = 0;
vtkPainter* prevPainter = 0;
vtkPainter* painter = 0;
painter = this->GetScalarsToColorsPainter();
if (painter)
......@@ -116,7 +116,7 @@ void vtkDefaultPainter::BuildPainterChain()
prevPainter = painter;
headPainter = (headPainter)? headPainter : painter;
}
painter = this->GetDisplayListPainter();
if (painter)
{
......
......@@ -29,7 +29,7 @@
#ifndef __vtkDefaultPainter_h
#define __vtkDefaultPainter_h
#include "vtkPolyDataPainter.h"
#include "vtkPainter.h"
class vtkClipPlanesPainter;
class vtkCoincidentTopologyResolutionPainter;
......@@ -38,11 +38,11 @@ class vtkLightingPainter;
class vtkScalarsToColorsPainter;
class vtkRepresentationPainter;
class VTK_RENDERING_EXPORT vtkDefaultPainter : public vtkPolyDataPainter
class VTK_RENDERING_EXPORT vtkDefaultPainter : public vtkPainter
{
public:
static vtkDefaultPainter *New();
vtkTypeRevisionMacro(vtkDefaultPainter, vtkPolyDataPainter);
vtkTypeRevisionMacro(vtkDefaultPainter, vtkPainter);
virtual void PrintSelf(ostream &os, vtkIndent indent);
// Description:
......
......@@ -18,15 +18,15 @@
#ifndef __vtkDisplayListPainter_h
#define __vtkDisplayListPainter_h
#include "vtkPolyDataPainter.h"
#include "vtkPainter.h"
class vtkInformationIntegerKey;
class VTK_RENDERING_EXPORT vtkDisplayListPainter : public vtkPolyDataPainter
class VTK_RENDERING_EXPORT vtkDisplayListPainter : public vtkPainter
{
public:
static vtkDisplayListPainter* New();
vtkTypeRevisionMacro(vtkDisplayListPainter, vtkPolyDataPainter);
vtkTypeRevisionMacro(vtkDisplayListPainter, vtkPainter);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
......
......@@ -37,7 +37,7 @@
#endif
//-----------------------------------------------------------------------------
vtkCxxRevisionMacro(vtkIdentColoredPainter, "1.23");
vtkCxxRevisionMacro(vtkIdentColoredPainter, "1.24");
vtkStandardNewMacro(vtkIdentColoredPainter);
//-----------------------------------------------------------------------------
......@@ -275,8 +275,9 @@ void vtkIdentColoredPainter::RenderInternal(vtkRenderer* renderer,
return;
}
vtkPolyData* polyData = this->GetInputAsPolyData();
this->TotalCells =
vtkIdentColoredPainterGetTotalCells(this->PolyData, typeflags);
vtkIdentColoredPainterGetTotalCells(polyData, typeflags);
this->Timer->StartTimer();
......@@ -294,41 +295,41 @@ void vtkIdentColoredPainter::RenderInternal(vtkRenderer* renderer,
if (typeflags & vtkPainter::VERTS)
{
this->DrawCells(VTK_POLY_VERTEX, this->PolyData->GetVerts(), startCell,
this->DrawCells(VTK_POLY_VERTEX, polyData->GetVerts(), startCell,
renderer);
}
startCell += this->PolyData->GetNumberOfVerts();
startCell += polyData->GetNumberOfVerts();
if (typeflags & vtkPainter::LINES)
{
this->DrawCells(VTK_POLY_LINE, this->PolyData->GetLines(), startCell,
this->DrawCells(VTK_POLY_LINE, polyData->GetLines(), startCell,
renderer);
}
startCell += this->PolyData->GetNumberOfLines();
startCell += polyData->GetNumberOfLines();
if (typeflags & vtkPainter::POLYS)
{
#if defined(__APPLE__) && (defined(VTK_USE_CARBON) || defined(VTK_USE_COCOA))
if (actor->GetProperty()->GetRepresentation() == VTK_WIREFRAME)
{
this->DrawCells(VTK_TETRA, this->PolyData->GetPolys(), startCell,
this->DrawCells(VTK_TETRA, polyData->GetPolys(), startCell,
renderer);
}
else
#endif
{
this->DrawCells(VTK_POLYGON, this->PolyData->GetPolys(), startCell,
this->DrawCells(VTK_POLYGON, polyData->GetPolys(), startCell,
renderer);
}
}
startCell += this->PolyData->GetNumberOfPolys();
startCell += polyData->GetNumberOfPolys();
if (typeflags & vtkPainter::STRIPS)
{
this->DrawCells(VTK_TRIANGLE_STRIP, this->PolyData->GetStrips(), startCell,
this->DrawCells(VTK_TRIANGLE_STRIP, polyData->GetStrips(), startCell,
renderer);
}
startCell += this->PolyData->GetNumberOfStrips();
startCell += polyData->GetNumberOfStrips();
//reset lighting back to the default
device->MakeBlending(origBlending);
......@@ -349,16 +350,10 @@ void vtkIdentColoredPainter::DrawCells(int mode, vtkCellArray *connectivity,
vtkIdType startCellId,
vtkRenderer *renderer)
{
if (!this->PolyData)
{
vtkWarningMacro("No polydata to render!");
return;
}
vtkPainterDeviceAdapter* device = renderer->GetRenderWindow()->
GetPainterDeviceAdapter();
vtkPoints* p = this->PolyData->GetPoints();
vtkPoints* p = this->GetInputAsPolyData()->GetPoints();
vtkIdType npts, *pts;
vtkIdType cellId = startCellId;
......
......@@ -27,7 +27,7 @@
#include "vtkUnsignedCharArray.h"
vtkStandardNewMacro(vtkLinesPainter);
vtkCxxRevisionMacro(vtkLinesPainter, "1.3");
vtkCxxRevisionMacro(vtkLinesPainter, "1.4");
//-----------------------------------------------------------------------------
vtkLinesPainter::vtkLinesPainter()
{
......@@ -89,10 +89,10 @@ void vtkLinesPainter::RenderInternal(vtkRenderer* renderer, vtkActor* actor,
int vtkLinesPainter::RenderPrimitive(unsigned long idx, vtkDataArray* n,
vtkUnsignedCharArray* c, vtkDataArray* t, vtkRenderer* ren)
{
vtkPoints* p = this->PolyData->GetPoints();
vtkCellArray* ca = (this->RenderPolys)? this->PolyData->GetPolys() :
this->PolyData->GetLines();
vtkIdType cellNum = this->PolyData->GetVerts()->GetNumberOfCells();
vtkPolyData* pd = this->GetInputAsPolyData();
vtkPoints* p = pd->GetPoints();
vtkCellArray* ca = (this->RenderPolys)? pd->GetPolys() : pd->GetLines();
vtkIdType cellNum = pd->GetVerts()->GetNumberOfCells();
vtkIdType cellNumStart = cellNum;
vtkIdType totalCells = ca->GetNumberOfCells();
......
/*=========================================================================
Program: Visualization Toolkit
Module: vtkMultiGroupPolyDataMapper2.cxx
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#include "vtkMultiGroupPolyDataMapper2.h"
#include "vtkCommand.h"
#include "vtkCompositeDataIterator.h"
#include "vtkCompositeDataPipeline.h"
#include "vtkCompositeDataSet.h"
#include "vtkCompositePainter.h"
#include "vtkInformation.h"
#include "vtkMath.h"
#include "vtkObjectFactory.h"
#include "vtkPolyData.h"
#include "vtkPolyDataPainter.h"
#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "vtkScalarsToColorsPainter.h"
#include "vtkDisplayListPainter.h"
#include "vtkDefaultPainter.h"
vtkStandardNewMacro(vtkMultiGroupPolyDataMapper2);
vtkCxxRevisionMacro(vtkMultiGroupPolyDataMapper2, "1.1");
//----------------------------------------------------------------------------
vtkMultiGroupPolyDataMapper2::vtkMultiGroupPolyDataMapper2()
{
this->ColorBlocks = 0;
// Setup chain as
// vtkDisplayListPainter -> vtkCompositePainter -> vtkDefaultPainter
// -> vtkChooserPainter
// vtkDefaultPainter no longer has another display list painter.
vtkDefaultPainter* curPainter =
vtkDefaultPainter::SafeDownCast(this->GetPainter());
curPainter->SetDisplayListPainter(0);
vtkCompositePainter* cpainter = vtkCompositePainter::New();
cpainter->SetDelegatePainter(curPainter);
vtkDisplayListPainter* dlpainter = vtkDisplayListPainter::New();
dlpainter->SetDelegatePainter(cpainter);
this->SetPainter(dlpainter);
cpainter->Delete();
dlpainter->Delete();
}
//----------------------------------------------------------------------------
vtkMultiGroupPolyDataMapper2::~vtkMultiGroupPolyDataMapper2()
{
}
//----------------------------------------------------------------------------
int vtkMultiGroupPolyDataMapper2::FillInputPortInformation(
int vtkNotUsed(port), vtkInformation* info)
{
info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkDataObject");
return 1;
}
//----------------------------------------------------------------------------
vtkExecutive* vtkMultiGroupPolyDataMapper2::CreateDefaultExecutive()
{
return vtkCompositeDataPipeline::New();
}
//-----------------------------------------------------------------------------
void vtkMultiGroupPolyDataMapper2::RenderPiece(vtkRenderer* ren, vtkActor* act)
{
vtkDataObject* inputDO = this->GetInputDataObject(0, 0);
vtkCompositeDataSet* inputCD = vtkCompositeDataSet::SafeDownCast(inputDO);
if (!inputCD)
{
this->Superclass::RenderPiece(ren, act);
return;
}
//
// make sure that we've been properly initialized
//
if (ren->GetRenderWindow()->CheckAbortStatus())
{
return;
}
if ( inputCD == NULL )
{
vtkErrorMacro(<< "No input!");
return;
}
this->InvokeEvent(vtkCommand::StartEvent,NULL);
if (!this->Static)
{
inputCD->Update();
}
this->InvokeEvent(vtkCommand::EndEvent,NULL);
// make sure our window is current
ren->GetRenderWindow()->MakeCurrent();
this->TimeToDraw = 0.0;
if (this->Painter)
{
// Update Painter information if obsolete.
if (this->PainterUpdateTime < this->GetMTime())
{
this->UpdatePainterInformation();
this->PainterUpdateTime.Modified();
}
// Pass polydata if changed.
if (this->Painter->GetInput() != inputDO)
{
this->Painter->SetInput(inputDO);
}
this->Painter->Render(ren, act, 0xff);
this->TimeToDraw = this->Painter->GetTimeToDraw();
}
// If the timer is not accurate enough, set it to a small
// time so that it is not zero
if ( this->TimeToDraw == 0.0 )
{
this->TimeToDraw = 0.0001;
}
this->UpdateProgress(1.0);
}
//-----------------------------------------------------------------------------
void vtkMultiGroupPolyDataMapper2::Render(vtkRenderer *ren, vtkActor *act)
{
if (this->Static)
{
this->RenderPiece(ren,act);
return;
}
int currentPiece, nPieces;
vtkDataObject *input = this->GetInputDataObject(0, 0);
if (input == NULL)
{
vtkErrorMacro("Mapper has no input.");
return;
}
nPieces = this->NumberOfPieces * this->NumberOfSubPieces;
for(int i=0; i<this->NumberOfSubPieces; i++)
{
// If more than one pieces, render in loop.
currentPiece = this->NumberOfSubPieces * this->Piece + i;
input->SetUpdateExtent(currentPiece, nPieces, this->GhostLevel);
this->RenderPiece(ren, act);
}
}
//-----------------------------------------------------------------------------
//Looks at each DataSet and finds the union of all the bounds
void vtkMultiGroupPolyDataMapper2::ComputeBounds()
{
vtkMath::UninitializeBounds(this->Bounds);
vtkCompositeDataSet *input = vtkCompositeDataSet::SafeDownCast(
this->GetInputDataObject(0, 0));
input->Update();
// If we don't have hierarchical data, test to see if we have
// plain old polydata. In this case, the bounds are simply
// the bounds of the input polydata.
if(!input)
{
this->Superclass::GetBounds();
return;
}
// We do have hierarchical data - so we need to loop over
// it and get the total bounds.
vtkCompositeDataIterator* iter = input->NewIterator();
iter->GoToFirstItem();
double bounds[6];
int i;
while (!iter->IsDoneWithTraversal())
{
vtkPolyData *pd = vtkPolyData::SafeDownCast(iter->GetCurrentDataObject());
if (pd)
{
// If this isn't the first time through, expand bounds
// we've compute so far based on the bounds of this
// block
if ( vtkMath::AreBoundsInitialized(this->Bounds) )
{
pd->GetBounds(bounds);
for(i=0; i<3; i++)
{
this->Bounds[i*2] =
(bounds[i*2]<this->Bounds[i*2])?
(bounds[i*2]):(this->Bounds[i*2]);
this->Bounds[i*2+1] =