Commit 4bf5d204 authored by Sebastien Barre's avatar Sebastien Barre
Browse files

BUG: [backward compat change]. GetActiveCamera() does not reset the camera...

BUG: [backward compat change]. GetActiveCamera() does not reset the camera anymore. If the renderer had no camera, it would create one automatically *and* reset it. This side effect would trigger the whole pipeline to get the props bounds. Moreover, a call to GetActiveCamera()->Foobar() would have different/inconsistent results depending on whether or not the renderer had a camera already. GetActiveCamera() still creates a cam, but does not reset it. If one calls GetActiveCamera(), it should have full control of it anyway at this point (and reset it or not). The old friendly behaviour remains though, if the user does not bother with the camera at all, it is created during the first render *and* reset to show the whole scene.
parent 29c3fce9
......@@ -249,6 +249,9 @@ int TestViewDependentErrorMetric(int argc, char* argv[])
// vtkCamera *cam1=renderer->GetActiveCamera();
vtkCamera *cam2=renderer2->GetActiveCamera();
renderer->ResetCamera();
renderer2->ResetCamera();
cam2->Azimuth(90);
......@@ -258,7 +261,7 @@ int TestViewDependentErrorMetric(int argc, char* argv[])
// but the view dependent error metric are not yet initialized!
renderer->AddActor(actor);
renderer2->AddActor(actor);
renWin->Render();
#ifdef WRITE_GENERIC_RESULT
......
......@@ -220,6 +220,7 @@ static void TestBox(vtkRenderWindow *renwin, int boxnum,
renderer->AddActor(actor);
renderer->SetBackground(0.0, 0.5, 0.5);
PlaceRenderer(renderer, boxnum, i, 0);
renderer->ResetCamera();
renwin->AddRenderer(renderer);
vtkCamera *camera = renderer->GetActiveCamera();
......@@ -265,6 +266,7 @@ static void TestBox(vtkRenderWindow *renwin, int boxnum,
renderer->AddActor(actor2);
renderer->SetBackground(0.0, 0.5, 0.5);
PlaceRenderer(renderer, boxnum, i, 1);
renderer->ResetCamera();
renwin->AddRenderer(renderer);
vtkCamera *camera = renderer->GetActiveCamera();
......@@ -303,6 +305,7 @@ static void TestBox(vtkRenderWindow *renwin, int boxnum,
renderer->AddActor(actor);
renderer->SetBackground(0.0, 0.5, 0.5);
PlaceRenderer(renderer, boxnum, i, 2);
renderer->ResetCamera();
renwin->AddRenderer(renderer);
vtkCamera *camera = renderer->GetActiveCamera();
......@@ -349,6 +352,7 @@ static void TestBox(vtkRenderWindow *renwin, int boxnum,
renderer->AddActor(actor2);
renderer->SetBackground(0.0, 0.5, 0.5);
PlaceRenderer(renderer, boxnum, i, 3);
renderer->ResetCamera();
renwin->AddRenderer(renderer);
vtkCamera *camera = renderer->GetActiveCamera();
......
......@@ -87,6 +87,7 @@ int RGrid( int argc, char *argv[] )
renderer->AddActor(wireActor);
renderer->SetBackground(1,1,1);
renderer->ResetCamera();
renderer->GetActiveCamera()->Elevation(60.0);
renderer->GetActiveCamera()->Azimuth(30.0);
renderer->GetActiveCamera()->Zoom(1.0);
......
......@@ -109,6 +109,7 @@ int expCos( int argc, char *argv[] )
renWin->SetSize(300,300);
// draw the resulting scene
ren->ResetCamera();
ren->GetActiveCamera()->Zoom(1.4);
ren->GetActiveCamera()->Elevation(-55);
ren->GetActiveCamera()->Azimuth(25);
......
......@@ -347,6 +347,7 @@ renWin SetSize 300 300
#
iren AddObserver UserEvent {wm deiconify .vtkInteract}
ren1 ResetCamera
set cam1 [ren1 GetActiveCamera]
$cam1 Zoom 4.5
$cam1 Azimuth -90
......
......@@ -420,6 +420,7 @@ ren1 AddActor left
ren1 AddActor back
[back GetProperty] SetDiffuseColor .2 .2 .2
ren1 ResetCamera
[ren1 GetActiveCamera] Dolly 2.5
ren1 ResetCameraClippingRange
......
......@@ -47,6 +47,7 @@ ren1 AddActor cone1Actor
ren1 AddActor cone2Actor
ren1 AddActor cone8Actor
ren1 SetBackground .5 .5 .5
ren1 ResetCamera
[ren1 GetActiveCamera] Elevation 30
[ren1 GetActiveCamera] Dolly 1.3
ren1 ResetCameraClippingRange
......
......@@ -56,6 +56,7 @@ ren1 AddActor model
ren1 AddActor boxActor
ren1 SetBackground 0.1 0.2 0.4
renWin SetSize 300 300
ren1 ResetCamera
[ren1 GetActiveCamera] Zoom 1.5
# render the image
......
......@@ -633,6 +633,7 @@ aPolyLine aVertex aPolyVertex aPixel aPolygon aPenta aHexa" {
[${cell}hogActor GetProperty] SetRepresentationToWireframe
}
ren1 ResetCamera
[ren1 GetActiveCamera] Azimuth 30
[ren1 GetActiveCamera] Elevation 20
[ren1 GetActiveCamera] Dolly 3.0
......
......@@ -49,6 +49,7 @@ ren1 AddActor outlineActor
ren1 AddActor isoActor
ren1 SetBackground 0.2 0.3 0.4
renWin SetSize 200 200
ren1 ResetCamera
[ren1 GetActiveCamera] Elevation 90
[ren1 GetActiveCamera] SetViewUp 0 0 -1
[ren1 GetActiveCamera] Azimuth 180
......
......@@ -539,6 +539,7 @@ ren1 AddViewProp romanTextActor
ren1 SetBackground 0.7 0.8 1
renWin SetSize 500 500
ren1 ResetCamera
[ren1 GetActiveCamera] Zoom 1.3
iren AddObserver UserEvent {wm deiconify .vtkInteract}
renWin Render
......
......@@ -62,6 +62,7 @@ for {set i 1} {$i<5} {incr i 1} {
vtkRenderer ren$i
ren$i AddActor edgeActor$i
ren$i SetBackground 0 0 0
ren$i ResetCamera
[ren$i GetActiveCamera] Zoom 1
[ren$i GetActiveCamera] SetPosition 1.73906 12.7987 -0.257808
[ren$i GetActiveCamera] SetViewUp 0.992444 0.00890284 -0.122379
......
......@@ -59,7 +59,8 @@ ren1 AddActor tubeActor
ren1 SetBackground 1 1 1
renWin SetSize 900 350
eval ren1 SetBackground 1 1 1
ren1 SetBackground 1 1 1
ren1 ResetCamera
[ren1 GetActiveCamera] Zoom 4
# render the image
......
......@@ -38,6 +38,7 @@ ren1 AddActor isoActor
ren1 SetBackground 0.8 0.8 1
renWin SetSize 400 400
ren1 ResetCamera
[ren1 GetActiveCamera] Zoom 1.3
iren Initialize
......
......@@ -102,6 +102,7 @@ ren1 AddActor actor
ren1 SetBackground 1 1 1
renWin SetSize 300 150
ren1 ResetCamera
[ren1 GetActiveCamera] Zoom 2.5
renWin Render
......
......@@ -77,6 +77,7 @@ ren1 AddActor clipActor
ren1 AddActor cutActor
ren1 AddActor restActor
ren1 SetBackground 1 1 1
ren1 ResetCamera
[ren1 GetActiveCamera] Azimuth 30
[ren1 GetActiveCamera] Elevation 30
[ren1 GetActiveCamera] Dolly 1.5
......
......@@ -73,6 +73,7 @@ vtkRenderWindowInteractor iren
ren1 AddActor clipActor
ren1 AddActor boundaryActor
ren1 SetBackground 1 1 1
ren1 ResetCamera
[ren1 GetActiveCamera] Azimuth 30
[ren1 GetActiveCamera] Elevation 30
[ren1 GetActiveCamera] Dolly 1.2
......
......@@ -133,6 +133,7 @@ ren1 AddActor clipart
[clipart GetProperty] SetSpecularPower 30
[clipart GetProperty] SetDiffuse .9
ren1 ResetCamera
set camera [ren1 GetActiveCamera]
$camera Azimuth 30
$camera Elevation -30
......
......@@ -492,6 +492,7 @@ ren1 AddActor left
ren1 AddActor back
[back GetProperty] SetDiffuseColor .2 .2 .2
ren1 ResetCamera
[ren1 GetActiveCamera] Dolly 2.5
ren1 ResetCameraClippingRange
......
......@@ -44,6 +44,7 @@ ren1 AddActor cone1Actor
ren1 AddActor cone2Actor
ren1 AddActor cone8Actor
ren1 SetBackground .5 .5 .5
ren1 ResetCamera
[ren1 GetActiveCamera] Elevation 30
[ren1 GetActiveCamera] Dolly 1.3
ren1 ResetCameraClippingRange
......
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