Commit fbdbed60 authored by Nikhil Shetty's avatar Nikhil Shetty Committed by Kitware Robot
Browse files

Merge topic 'headTrackSyncRenderer'

87cec5d0 Fixing head-tracking with synchronous-renderer.
parents 55f984be 87cec5d0
......@@ -411,7 +411,23 @@ void vtkSynchronizedRenderers::RendererInfo::Save(vtkMultiProcessStream& stream)
<< this->CameraClippingRange[0]
<< this->CameraClippingRange[1]
<< this->CameraViewAngle
<< this->CameraParallelScale;
<< this->CameraParallelScale
<< this->HeadPose[0]
<< this->HeadPose[1]
<< this->HeadPose[2]
<< this->HeadPose[3]
<< this->HeadPose[4]
<< this->HeadPose[5]
<< this->HeadPose[6]
<< this->HeadPose[7]
<< this->HeadPose[8]
<< this->HeadPose[9]
<< this->HeadPose[10]
<< this->HeadPose[11]
<< this->HeadPose[12]
<< this->HeadPose[13]
<< this->HeadPose[14]
<< this->HeadPose[15] ;
}
//----------------------------------------------------------------------------
......@@ -426,9 +442,9 @@ bool vtkSynchronizedRenderers::RendererInfo::Restore(vtkMultiProcessStream& stre
stream >> this->ImageReductionFactor
>> this->Draw
>> this->CameraParallelProjection
>> this->Viewport[0]
>> this->Viewport[0]
>> this->Viewport[1]
>> this->Viewport[2]
>> this->Viewport[2]
>> this->Viewport[3]
>> this->CameraPosition[0]
>> this->CameraPosition[1]
......@@ -444,7 +460,23 @@ bool vtkSynchronizedRenderers::RendererInfo::Restore(vtkMultiProcessStream& stre
>> this->CameraClippingRange[0]
>> this->CameraClippingRange[1]
>> this->CameraViewAngle
>> this->CameraParallelScale;
>> this->CameraParallelScale
>> this->HeadPose[0]
>> this->HeadPose[1]
>> this->HeadPose[2]
>> this->HeadPose[3]
>> this->HeadPose[4]
>> this->HeadPose[5]
>> this->HeadPose[6]
>> this->HeadPose[7]
>> this->HeadPose[8]
>> this->HeadPose[9]
>> this->HeadPose[10]
>> this->HeadPose[11]
>> this->HeadPose[12]
>> this->HeadPose[13]
>> this->HeadPose[14]
>> this->HeadPose[15];
return true;
}
......@@ -462,6 +494,7 @@ void vtkSynchronizedRenderers::RendererInfo::CopyFrom(vtkRenderer* ren)
cam->GetClippingRange(this->CameraClippingRange);
this->CameraViewAngle = cam->GetViewAngle();
this->CameraParallelScale = cam->GetParallelScale();
cam->GetHeadPose( this->HeadPose );
}
//----------------------------------------------------------------------------
......@@ -475,10 +508,26 @@ void vtkSynchronizedRenderers::RendererInfo::CopyTo(vtkRenderer* ren)
cam->SetFocalPoint(this->CameraFocalPoint);
cam->SetViewUp(this->CameraViewUp);
cam->SetWindowCenter(this->CameraWindowCenter[0],
this->CameraWindowCenter[1]);
this->CameraWindowCenter[1]);
cam->SetClippingRange(this->CameraClippingRange);
cam->SetViewAngle(this->CameraViewAngle);
cam->SetParallelScale(this->CameraParallelScale);
cam->SetHeadPose(this->HeadPose[0],
this->HeadPose[1],
this->HeadPose[2],
this->HeadPose[3],
this->HeadPose[4],
this->HeadPose[5],
this->HeadPose[6],
this->HeadPose[7],
this->HeadPose[8],
this->HeadPose[9],
this->HeadPose[10],
this->HeadPose[11],
this->HeadPose[12],
this->HeadPose[13],
this->HeadPose[14],
this->HeadPose[15] );
}
......@@ -669,7 +718,7 @@ bool vtkSynchronizedRenderers::vtkRawImage::Capture(vtkRenderer* ren)
static_cast<int>(window_size[0] * viewport[2])-1,
static_cast<int>(window_size[1] * viewport[3])-1,
ren->GetRenderWindow()->GetDoubleBuffer()? 0 : 1,
this->GetRawPtr());
this->GetRawPtr());
this->MarkValid();
return true;
}
......@@ -107,7 +107,7 @@ public:
vtkBooleanMacro(AutomaticEventHandling, bool);
//BTX
enum
enum
{
SYNC_RENDERER_TAG = 15101,
RESET_CAMERA_TAG = 15102,
......@@ -140,8 +140,8 @@ public:
void MarkInValid() { this->Valid = false; }
bool IsValid() { return this->Valid; }
int GetWidth() { return this->Size[0];}
int GetHeight() { return this->Size[1];}
int GetWidth() { return this->Size[0];}
int GetHeight() { return this->Size[1];}
vtkUnsignedCharArray* GetRawPtr()
{ return this->Data; }
......@@ -185,6 +185,7 @@ protected:
double CameraClippingRange[2];
double CameraViewAngle;
double CameraParallelScale;
double HeadPose[16];
// Save/restore the struct to/from a stream.
void Save(vtkMultiProcessStream& stream);
......@@ -221,7 +222,7 @@ protected:
// Can be used in HandleEndRender(), MasterEndRender() or SlaveEndRender()
// calls to paste back the image from either this->ReducedImage or
// this->FullImage info the viewport.
void PushImageToScreen();
void PushImageToScreen();
vtkSynchronizedRenderers* CaptureDelegate;
vtkRawImage ReducedImage;
......
......@@ -864,8 +864,13 @@ void vtkCamera::SetHeadPose( double x00, double x01, double x02, double x03,
double x20, double x21, double x22, double x23,
double x30, double x31, double x32, double x33 )
{
vtkDebugMacro( <<"vtkCamera::HeadTracked = " << this->HeadTracked );
vtkDebugMacro( << "vtkCamera::SetHeadPose( "
<< x00 << " " << x01 << " " << x02 << " " << x03
<< x10 << " " << x11 << " " << x12 << " " << x13
<< x20 << " " << x21 << " " << x22 << " " << x23
<< x30 << " " << x31 << " " << x32 << " " << x33
<< ")" );
this->HeadPose->SetElement( 0,0,x00 );
this->HeadPose->SetElement( 0,1,x01 );
this->HeadPose->SetElement( 0,2,x02 );
......@@ -885,8 +890,30 @@ void vtkCamera::SetHeadPose( double x00, double x01, double x02, double x03,
this->HeadPose->SetElement( 3,1,x31 );
this->HeadPose->SetElement( 3,2,x32 );
this->HeadPose->SetElement( 3,3,x33 );
// this->ComputeProjAndViewParams();
// this->ComputeViewTransform();
}
// -----------------------------------------------------------------HeadTracked
void vtkCamera::GetHeadPose( double x[16] )
{
x[0] = this->HeadPose->GetElement( 0,0 );
x[1] = this->HeadPose->GetElement( 0,1 );
x[2] = this->HeadPose->GetElement( 0,2 );
x[3] = this->HeadPose->GetElement( 0,3 );
x[4] = this->HeadPose->GetElement( 1,0 );
x[5] = this->HeadPose->GetElement( 1,1 );
x[6] = this->HeadPose->GetElement( 1,2 );
x[7] = this->HeadPose->GetElement( 1,3 );
x[8] = this->HeadPose->GetElement( 2,0 );
x[9] = this->HeadPose->GetElement( 2,1 );
x[10] = this->HeadPose->GetElement( 2,2 );
x[11] = this->HeadPose->GetElement( 2,3 );
x[12] = this->HeadPose->GetElement( 3,0 );
x[13] = this->HeadPose->GetElement( 3,1 );
x[14] = this->HeadPose->GetElement( 3,2 );
x[15] = this->HeadPose->GetElement( 3,3 );
}
//------------------------------------------------------------------HeadTracked
......
......@@ -428,6 +428,7 @@ public:
void SetConfigParams( double o2screen, double o2right, double o2left,
double o2top, double o2bottom , double interOccDist,
double scale, vtkMatrix4x4 * surfaceRot );
// Description:
// This function is a convinience function intended for the Paraview
// ServerManager
......@@ -436,6 +437,11 @@ public:
double x20, double x21, double x22, double x23,
double x30, double x31, double x32, double x33 );
// Description:
// This is a convenience function to get the current head position. This is
// typically used by ParaView for head-tracking support
void GetHeadPose( double *x );
// Description:
// HeadTracker mode. It impacts on the computation of the transforms.
// Initial value is false.
......
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