Commit 2e2927df authored by Bill Lorensen's avatar Bill Lorensen Committed by Code Review
Browse files

Merge topic 'fix_split_stereo_test' into master

29fc8066 Updated offaxis stereo test
94a03fda Removed debug code
d34e1f51 Fixed camera deep copy, partial copy, and window to image filer copy
f6a90eb4 Removed wireframe background
afb056ff Updated stereo test so that we can get consistent image on various platforms
parents 963368cf 29fc8066
......@@ -17,7 +17,7 @@
#include "vtkActor.h"
#include "vtkCamera.h"
#include "vtkExtractEdges.h"
#include "vtkConeSource.h"
#include "vtkMatrix4x4.h"
#include "vtkPolyDataMapper.h"
#include "vtkProperty.h"
......@@ -25,7 +25,6 @@
#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkConeSource.h"
#include "vtkSphereSource.h"
#include "vtkSmartPointer.h"
......@@ -34,30 +33,25 @@
int TestSplitViewportStereoHorizontal(int argc, char *argv[])
{
double bottomLeft[3] = {-2.0, -1.0, -1.0};
double bottomRight[3] = { 2.0, -1.0, -1.0};
double topRight[3] = { 2.0, 1.0, -1.0};
double bottomLeft[3] = {-1.0, -1.0, -10.0};
double bottomRight[3] = { 1.0, -1.0, -10.0};
double topRight[3] = { 1.0, 1.0, -10.0};
VTK_CREATE(vtkSphereSource, sphere1);
sphere1->SetCenter(0.0, 0.0, -5.0);
sphere1->SetRadius(15.0);
sphere1->SetThetaResolution(40);
sphere1->SetPhiResolution(40);
VTK_CREATE(vtkExtractEdges, edges);
edges->SetInputConnection(sphere1->GetOutputPort());
sphere1->SetCenter(0.2, 0.0, -7.0);
sphere1->SetRadius(0.5);
sphere1->SetThetaResolution(100);
sphere1->SetPhiResolution(100);
VTK_CREATE(vtkPolyDataMapper, mapper1);
mapper1->SetInputConnection(edges->GetOutputPort());
mapper1->SetInputConnection(sphere1->GetOutputPort());
VTK_CREATE(vtkActor, actor1);
actor1->SetMapper(mapper1);
actor1->GetProperty()->SetAmbient(1.0);
actor1->GetProperty()->SetDiffuse(0.0);
actor1->GetProperty()->SetColor(0.8, 0.8, 0.0);
VTK_CREATE(vtkConeSource, cone1);
cone1->SetCenter(0.0, 0.0, -5.0);
cone1->SetCenter(0.0, 0.0, -6.0);
cone1->SetResolution(100);
VTK_CREATE(vtkPolyDataMapper, mapper2);
......@@ -82,7 +76,7 @@ int TestSplitViewportStereoHorizontal(int argc, char *argv[])
VTK_CREATE(vtkRenderWindowInteractor, iren);
iren->SetRenderWindow(renwin);
double eyePosition[3] = {0.0, 0.0, 5.0};
double eyePosition[3] = {0.0, 0.0, 2.0};
vtkCamera *camera = renderer->GetActiveCamera();
camera->SetScreenBottomLeft(bottomLeft);
......@@ -98,6 +92,7 @@ int TestSplitViewportStereoHorizontal(int argc, char *argv[])
renwin->Render();
int retVal = vtkRegressionTestImageThreshold(renwin, 25);
if (retVal == vtkRegressionTester::DO_INTERACTOR)
{
......
......@@ -1268,6 +1268,30 @@ void vtkCamera::ShallowCopy(vtkCamera *source)
{
this->CameraLightTransform->Register(this);
}
this->EyeTransformMatrix = source->EyeTransformMatrix;
if (this->EyeTransformMatrix !=0)
{
this->EyeTransformMatrix->Register(this);
}
this->WorldToScreenMatrix = source->WorldToScreenMatrix;
if (this->WorldToScreenMatrix != 0)
{
this->WorldToScreenMatrix->Register(this);
}
this->ModelTransformMatrix = source->ModelTransformMatrix;
if (this->ModelTransformMatrix != 0)
{
this->ModelTransformMatrix->Register(this);
}
this->ModelViewTransform = source->ModelViewTransform;
if (this->ModelViewTransform != 0)
{
this->ModelViewTransform->Register(this);
}
}
// ----------------------------------------------------------------------------
......@@ -1397,6 +1421,83 @@ void vtkCamera::DeepCopy(vtkCamera *source)
}
this->CameraLightTransform->DeepCopy(source->CameraLightTransform);
}
if(source->ModelViewTransform==0)
{
if(this->ModelViewTransform!=0)
{
this->ModelViewTransform->UnRegister(this);
this->ModelViewTransform=0;
}
}
else
{
if(this->ModelViewTransform==0)
{
this->ModelViewTransform=
static_cast<vtkTransform *>(
source->ModelViewTransform->MakeTransform());
}
this->ModelViewTransform->DeepCopy(source->ModelViewTransform);
}
if(source->ModelTransformMatrix == 0)
{
if(this->ModelTransformMatrix != 0)
{
this->ModelTransformMatrix->UnRegister(this);
this->ModelTransformMatrix = 0;
}
}
else
{
if(this->ModelTransformMatrix==0)
{
this->ModelTransformMatrix=
static_cast<vtkMatrix4x4 *>(
source->ModelTransformMatrix->NewInstance());
}
this->ModelTransformMatrix->DeepCopy(source->ModelTransformMatrix);
}
if(source->EyeTransformMatrix == 0)
{
if(this->EyeTransformMatrix != 0)
{
this->EyeTransformMatrix->UnRegister(this);
this->EyeTransformMatrix = 0;
}
}
else
{
if(this->EyeTransformMatrix==0)
{
this->EyeTransformMatrix=
static_cast<vtkMatrix4x4 *>(
source->EyeTransformMatrix->NewInstance());
}
this->EyeTransformMatrix->DeepCopy(source->EyeTransformMatrix);
}
if(source->WorldToScreenMatrix == 0)
{
if(this->WorldToScreenMatrix != 0)
{
this->WorldToScreenMatrix->UnRegister(this);
this->WorldToScreenMatrix = 0;
}
}
else
{
if(this->WorldToScreenMatrix==0)
{
this->WorldToScreenMatrix=
static_cast<vtkMatrix4x4 *>(
source->WorldToScreenMatrix->NewInstance());
}
this->WorldToScreenMatrix->DeepCopy(source->WorldToScreenMatrix);
}
}
// ----------------------------------------------------------------------------
......@@ -1429,6 +1530,10 @@ void vtkCamera::PartialCopy(vtkCamera *source)
this->DirectionOfProjection[i]=source->DirectionOfProjection[i];
this->ViewPlaneNormal[i]=source->ViewPlaneNormal[i];
this->ViewShear[i]=source->ViewShear[i];
this->ScreenBottomLeft[i]=source->ScreenBottomLeft[i];
this->ScreenBottomRight[i]=source->ScreenBottomRight[i];
this->ScreenTopRight[i]=source->ScreenTopRight[i];
++i;
}
......@@ -1441,7 +1546,12 @@ void vtkCamera::PartialCopy(vtkCamera *source)
this->Thickness=source->Thickness;
this->Distance=source->Distance;
this->UseHorizontalViewAngle=source->UseHorizontalViewAngle;
this->UseOffAxisProjection=source->UseOffAxisProjection;
this->FocalDisk=source->FocalDisk;
this->EyeSeparation=source->EyeSeparation;
this->WorldToScreenMatrixMTime=source->WorldToScreenMatrixMTime;
this->ViewingRaysMTime=source->ViewingRaysMTime;
}
......@@ -1537,6 +1647,10 @@ void vtkCamera::PrintSelf(ostream& os, vtkIndent indent)
os << indent << "ModelTransformMatrix: (" << this->ModelTransformMatrix << "\n";
this->ModelTransformMatrix->PrintSelf(os, indent.GetNextIndent());
os << indent << ")\n";
os << indent << "ProjectionTransform: (" << this->ProjectionTransform << "\n";
this->ProjectionTransform->PrintSelf(os, indent.GetNextIndent());
os << indent << ")\n";
}
//-----------------------------------------------------------------------------
......
......@@ -301,6 +301,16 @@ void vtkWindowToImageFilter::RequestData(
cam->SetUserTransform(cams[i]->GetUserTransform());
cam->SetUseHorizontalViewAngle(cams[i]->GetUseHorizontalViewAngle());
cam->SetViewShear(cams[i]->GetViewShear());
cam->SetModelTransformMatrix(cams[i]->GetModelTransformMatrix());
cam->SetEyeTransformMatrix(cams[i]->GetEyeTransformMatrix());
cam->SetUseOffAxisProjection(cams[i]->GetUseOffAxisProjection());
cam->SetScreenBottomLeft(cams[i]->GetScreenBottomLeft());
cam->SetScreenBottomRight(cams[i]->GetScreenBottomRight());
cam->SetScreenTopRight(cams[i]->GetScreenTopRight());
cam->SetEyeSeparation(cams[i]->GetEyeSeparation());
double eyePos[3];
cams[i]->GetEyePosition(eyePos);
cam->SetEyePosition(eyePos);
aren->SetActiveCamera(cam);
}
......
......@@ -34,12 +34,12 @@
int TestOffAxisStereo(int argc, char *argv[])
{
double bottomLeft[3] = {-1.0, -1.0, -1.0};
double bottomRight[3] = { 1.0, -1.0, -1.0};
double topRight[3] = { 1.0, 1.0, -1.0};
double bottomLeft[3] = {-1.0, -1.0, -10.0};
double bottomRight[3] = { 1.0, -1.0, -10.0};
double topRight[3] = { 1.0, 1.0, -10.0};
VTK_CREATE(vtkSphereSource, sphere1);
sphere1->SetCenter(0.0, 0.0, -4.0);
sphere1->SetCenter(0.6, 0.0, -15.0);
sphere1->SetThetaResolution(100);
sphere1->SetPhiResolution(100);
......@@ -51,7 +51,7 @@ int TestOffAxisStereo(int argc, char *argv[])
actor1->GetProperty()->SetAmbient(0.1);
VTK_CREATE(vtkConeSource, cone1);
cone1->SetCenter(0.0, 0.0, -10.0);
cone1->SetCenter(0.0, 0.0, -2.0);
cone1->SetResolution(100);
VTK_CREATE(vtkPolyDataMapper, mapper2);
......
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