Commit 4d742b7b authored by Michael Migliore's avatar Michael Migliore

Fix OSPRay offscreen with render passes

parent d601827e
......@@ -65,9 +65,8 @@ void vtkOSPRayCameraNode::Render(bool prepass)
}
}
vtkWindow* win = ren->GetVTKWindow();
double* vp = win->GetTileViewport();
int* ts = win->GetTileScale();
double* vp = orn->GetViewport();
int* ts = orn->GetScale();
vtkCamera* cam = static_cast<vtkCamera*>(this->Renderable);
double myDistance = cam->GetDistance();
......
......@@ -226,21 +226,33 @@ void vtkOSPRayPass::RenderInternal(const vtkRenderState* s)
vtkFrameBufferObjectBase* fbo = s->GetFrameBuffer();
int viewportX, viewportY;
int viewportWidth, viewportHeight;
double tileViewport[4];
int tileScale[2];
if (fbo)
{
viewportX = 0;
viewportY = 0;
fbo->GetLastSize(viewportWidth, viewportHeight);
tileViewport[0] = tileViewport[1] = 0.0;
tileViewport[2] = tileViewport[3] = 1.0;
tileScale[0] = tileScale[1] = 1;
}
else
{
ren->GetTiledSizeAndOrigin(&viewportWidth, &viewportHeight, &viewportX, &viewportY);
vtkWindow* win = ren->GetVTKWindow();
win->GetTileViewport(tileViewport);
win->GetTileScale(tileScale);
}
vtkOSPRayRendererNode* oren =
vtkOSPRayRendererNode::SafeDownCast(this->SceneGraph->GetViewNodeFor(ren));
oren->SetSize(viewportWidth, viewportHeight);
oren->SetViewport(tileViewport);
oren->SetScale(tileScale);
this->SceneGraph->TraverseAllPasses();
......
......@@ -36,6 +36,12 @@ vtkRendererNode::vtkRendererNode()
{
this->Size[0] = 0;
this->Size[1] = 0;
this->Viewport[0] = 0.0;
this->Viewport[1] = 0.0;
this->Viewport[2] = 1.0;
this->Viewport[3] = 1.0;
this->Scale[0] = 1;
this->Scale[1] = 1;
}
//----------------------------------------------------------------------------
......
......@@ -45,11 +45,25 @@ public:
vtkGetVector2Macro(Size, int);
vtkSetVector2Macro(Size, int);
/**
* Get/Set the window viewport
*/
vtkGetVector4Macro(Viewport, double);
vtkSetVector4Macro(Viewport, double);
/**
* Get/Set the window tile scale
*/
vtkGetVector2Macro(Scale, int);
vtkSetVector2Macro(Scale, int);
protected:
vtkRendererNode();
~vtkRendererNode() override;
int Size[2];
double Viewport[4];
int Scale[2];
private:
vtkRendererNode(const vtkRendererNode&) = delete;
......
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