Commit d2fe1dd8 authored by Utkarsh Ayachit's avatar Utkarsh Ayachit

Cleaned up ordered compositing code.

* Reintroduced support for generating kdtree using image data extents.
* Restructured code to ensure redistribution happens correctly for every render.
  The previous implementation required that the client triggered the
  redistribution in Delivery() call which was not possible esp. as
  representations were added/removed (since Delivery() is only called when data
  really needs to be delivered which is not the case when representations are
  removed).
parent 777f36be
......@@ -96,16 +96,20 @@ int vtkImageVolumeRepresentation::ProcessViewRequest(
}
if (request_type == vtkPVView::REQUEST_UPDATE())
{
// FIXME:STREAMING :- how do we tell the view to use "cuts" from this
// representation for ordered compositing?
// At the same time, the image data is not the data being delivered
// anywhere, so we don't really report it to the view's storage.
// vtkPVRenderView::SetPiece(inInfo, this, this->Cache);
vtkPVRenderView::SetPiece(inInfo, this,
this->OutlineSource->GetOutputDataObject(0));
outInfo->Set(vtkPVRenderView::NEED_ORDERED_COMPOSITING(), 1);
vtkPVRenderView::SetGeometryBounds(inInfo, this->DataBounds);
// The KdTree generation code that uses the image cuts needs to be updated
// bigtime. But due to time shortage, I'm leaving the old code as is. We
// will get back to it later.
if (this->GetNumberOfInputConnections(0) == 1)
{
vtkPVRenderView::SetImageDataProducer(inInfo, this,
this->GetInputConnection(0, 0));
}
}
else if (request_type == vtkPVView::REQUEST_RENDER())
{
......
......@@ -106,6 +106,11 @@ public:
void SetRenderView(vtkPVRenderView*);
vtkPVRenderView* GetRenderView();
// Description:
// Called by the view on ever render when ordered compositing is to be used to
// ensure that the geometries are redistributed, as needed.
void RedistributeDataForOrderedCompositing(bool use_lod);
//BTX
// Description:
// Internal method used to determine the list of representations that need
......@@ -137,6 +142,11 @@ public:
void StreamingDeliver(unsigned int key);
// *******************************************************************
// *******************************************************************
// HACK for dealing with volume rendering for image data
void SetImageDataProducer(vtkPVDataRepresentation* repr, vtkAlgorithmOutput*);
//BTX
protected:
vtkPVDataDeliveryManager();
......@@ -145,6 +155,7 @@ protected:
vtkWeakPointer<vtkPVRenderView> RenderView;
vtkSmartPointer<vtkPKdTree> KdTree;
vtkTimeStamp RedistributionTimeStamp;
private:
vtkPVDataDeliveryManager(const vtkPVDataDeliveryManager&); // Not implemented
void operator=(const vtkPVDataDeliveryManager&); // Not implemented
......
......@@ -976,6 +976,18 @@ void vtkPVRenderView::Render(bool interactive, bool skip_rendering)
this->GetUseDistributedRenderingForInteractiveRender():
this->GetUseDistributedRenderingForStillRender();
if (this->GetUseOrderedCompositing())
{
this->Internals->DeliveryManager->RedistributeDataForOrderedCompositing(
use_lod_rendering);
this->SynchronizedRenderers->SetKdTree(
this->Internals->DeliveryManager->GetKdTree());
}
else
{
this->SynchronizedRenderers->SetKdTree(NULL);
}
// Render each representation with available geometry.
// This is the pass where representations get an opportunity to get the
// currently "available" represented data and try to render it.
......@@ -1007,8 +1019,6 @@ void vtkPVRenderView::Render(bool interactive, bool skip_rendering)
in_cave_mode ||
(!use_distributed_rendering && in_tile_display_mode));
this->SynchronizedRenderers->SetKdTree(
this->Internals->DeliveryManager->GetKdTree());
// When in batch mode, we are using the same render window for all views. That
// makes it impossible for vtkPVSynchronizedRenderWindows to identify which
......@@ -1164,6 +1174,20 @@ void vtkPVRenderView::SetStreamable(
view->GetDeliveryManager()->SetStreamable(repr, val);
}
//----------------------------------------------------------------------------
void vtkPVRenderView::SetImageDataProducer(
vtkInformation* info, vtkPVDataRepresentation* repr,
vtkAlgorithmOutput* producer)
{
vtkPVRenderView* view = vtkPVRenderView::SafeDownCast(info->Get(VIEW()));
if (!view)
{
vtkGenericWarningMacro("Missing VIEW().");
return;
}
view->GetDeliveryManager()->SetImageDataProducer(repr, producer);
}
//----------------------------------------------------------------------------
void vtkPVRenderView::SetDeliverToAllProcesses(vtkInformation* info,
......@@ -1260,7 +1284,7 @@ bool vtkPVRenderView::GetUseOrderedCompositing()
return false;
}
if (!this->NeedsOrderedCompositing)
if (!this->NeedsOrderedCompositing || this->MakingSelection)
{
return false;
}
......
......@@ -310,6 +310,12 @@ public:
static void SetStreamable(
vtkInformation* info, vtkPVDataRepresentation* repr, bool streamable);
// Description:
// Hack to pass along image data producer to use to generate the KdTree cuts
// when volume rendering image data. This code needs refactoring.
static void SetImageDataProducer(
vtkInformation* info, vtkPVDataRepresentation* repr, vtkAlgorithmOutput*);
// Description:
// Representations that support hardware (render-buffer based) selection,
// should register the prop that they use for selection rendering. They can do
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment