Commit 9a4a4bba authored by Ken Martin's avatar Ken Martin Committed by Kitware Robot

Merge topic 'update_for_vtk_picking_changes'

9f0addc8 update ParaView to use the new picking changes in VTK
5bba1bd4 this is an update to match recent changes in VTK picking
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Acked-by: Utkarsh Ayachit's avatarUtkarsh Ayachit <utkarsh.ayachit@kitware.com>
Merge-request: !2500
parents 83547f91 9f0addc8
Pipeline #109257 failed with stage
in 0 seconds
......@@ -73,16 +73,20 @@ void vtkPVHardwareSelector::SetSynchronizedWindows(vtkPVSynchronizedRenderWindow
//----------------------------------------------------------------------------
bool vtkPVHardwareSelector::PassRequired(int pass)
{
if (pass == MIN_KNOWN_PASS + 1)
if (pass == PROCESS_PASS && this->Iteration == 0)
{
// synchronize the MaxAttributeId among all active processes (BUG #141112).
if (this->SynchronizedWindows && this->SynchronizedWindows->GetEnabled())
{
this->SynchronizedWindows->Reduce(
this->MaxAttributeId, vtkPVSynchronizedRenderWindows::MAX_OP);
}
return true;
}
return (pass == PROCESS_PASS ? true : this->Superclass::PassRequired(pass));
vtkIdType passRequiredValue = this->Superclass::PassRequired(pass) ? 1 : 0;
// synchronize the value among all active processes (BUG #141112).
if (this->SynchronizedWindows && this->SynchronizedWindows->GetEnabled())
{
this->SynchronizedWindows->Reduce(passRequiredValue, vtkPVSynchronizedRenderWindows::MAX_OP);
}
return passRequiredValue > 0;
}
//----------------------------------------------------------------------------
......
......@@ -18,6 +18,7 @@
#include "vtkCameraPass.h"
#include "vtkFloatArray.h"
#include "vtkFrameBufferObjectBase.h"
#include "vtkHardwareSelector.h"
#include "vtkIceTContext.h"
#include "vtkIntArray.h"
#include "vtkMatrix3x3.h"
......@@ -474,6 +475,7 @@ void vtkIceTCompositePass::Render(const vtkRenderState* render_state)
cam->GetKeyMatrices(render_state->GetRenderer(), wcvc, norms, vcdc, unused);
float background[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
// here is where the actual drawing occurs
vtkOpenGLRenderUtilities::MarkDebugEvent("vtkIceTCompositePass: icetDrawFrame Start");
IceTImage renderedImage = icetDrawFrame(vcdc->Element[0], wcvc->Element[0], background);
vtkOpenGLRenderUtilities::MarkDebugEvent("vtkIceTCompositePass: icetDrawFrame End");
......@@ -484,7 +486,8 @@ void vtkIceTCompositePass::Render(const vtkRenderState* render_state)
// isolate vtk from IceT OpenGL errors
vtkOpenGLClearErrorMacro();
if (render_state->GetRenderer()->GetRenderWindow()->GetStereoRender() == 1)
vtkRenderer* ren = render_state->GetRenderer();
if (ren->GetRenderWindow()->GetStereoRender() == 1)
{
// if we are doing a stereo render we need to know
// which stereo eye we are currently rendering. If we don't do this
......@@ -551,7 +554,9 @@ void vtkIceTCompositePass::Render(const vtkRenderState* render_state)
else if (this->FixBackground)
{
if (format == ICET_IMAGE_COLOR_RGBA_UBYTE)
{
this->PushIceTColorBufferToScreen(render_state);
}
}
this->CleanupContext(render_state);
......@@ -608,8 +613,8 @@ void vtkIceTCompositePass::Draw(const vtkRenderState* render_state, const IceTDo
{
vtkOpenGLClearErrorMacro();
vtkOpenGLRenderWindow* context =
static_cast<vtkOpenGLRenderWindow*>(render_state->GetRenderer()->GetRenderWindow());
vtkRenderer* ren = static_cast<vtkRenderer*>(render_state->GetRenderer());
vtkOpenGLRenderWindow* context = static_cast<vtkOpenGLRenderWindow*>(ren->GetRenderWindow());
vtkOpenGLState* ostate = context->GetState();
GLbitfield clear_mask = 0;
......@@ -676,8 +681,35 @@ void vtkIceTCompositePass::Draw(const vtkRenderState* render_state, const IceTDo
// Copy image from default buffer.
if (icetImageGetColorFormat(result) != ICET_IMAGE_COLOR_NONE)
{
// read in the pixels
unsigned char* destdata = icetImageGetColorub(result);
glReadPixels(0, 0, icetImageGetWidth(result), icetImageGetHeight(result), GL_RGBA,
GL_UNSIGNED_BYTE, icetImageGetColorub(result));
GL_UNSIGNED_BYTE, destdata);
// for selections we need the adjusted buffer
// so we overwrite the RGB with the selection buffer
vtkHardwareSelector* sel = ren->GetSelector();
if (sel)
{
// copy the processed selection buffers into icet
unsigned char* passdata = sel->GetPixelBuffer(sel->GetCurrentPass());
if (passdata)
{
unsigned int* area = sel->GetArea();
unsigned int passwidth = area[2] - area[0] + 1;
for (int y = 0; y < icetImageGetHeight(result); ++y)
{
for (int x = 0; x < icetImageGetWidth(result); ++x)
{
unsigned char* pdptr = passdata + (y * passwidth + x) * 3;
destdata[0] = pdptr[0];
destdata[1] = pdptr[1];
destdata[2] = pdptr[2];
destdata += 4;
}
}
}
}
}
if (icetImageGetDepthFormat(result) != ICET_IMAGE_DEPTH_NONE)
......
Subproject commit 6edfd72d7c33dcc605e283c9c31fa04b9c2e2544
Subproject commit 23ec83e4f681ce14e19f7bdbbcf61905cbf97717
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