camera_example.rst#
Controlling the Camera¶
In [1]:
import example_utils
from vapor import session, renderer, dataset, camera
ses = session.Session()
data = example_utils.OpenExampleDataset(ses)
ren = data.NewRenderer(renderer.VolumeIsoRenderer)
ren.SetIsoValues([-0.10, 0.2])
# Show 3D orientation arrows.
ses.GetSceneAnnotations().SetAxisArrowEnabled(True)
Warning: sysroot "/Applications/Xcode_12.4.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk" not found (ignoring for now).
Vapor 3.9.2 Python 3.9.19 (/Users/pearse/miniconda3/envs/readTheDocs) OpenGL 4.1 Metal - 83.1
In [2]:
cam = ses.GetCamera()
In [3]:
help(cam.ViewAll)
cam.ViewAll()
ses.Show()
Help on method ViewAll in module vapor.camera: ViewAll() method of vapor.camera.Camera instance Places the camera above the dataset looking down so that it is visible in its entirety. This is the default view when opening a new dataset.
UNSUPPORTED (log once): POSSIBLE ISSUE: unit 2 GLD_TEXTURE_INDEX_3D is unloadable and bound to sampler type (Float) - using zero texture because texture unloadable
In [4]:
help(cam.AlignView)
cam.AlignView("-X")
ses.Show()
Help on method AlignView in module vapor.camera: AlignView(axis: str) method of vapor.camera.Camera instance Align camera looking down an axis Axis format: [+-][XYZ]
In [5]:
help(cam.Zoom)
cam.Zoom(-0.4)
ses.Show()
Help on method Zoom in module vapor.camera: Zoom(fractionOfDistanceToTarget: float) method of vapor.camera.Camera instance Moves the camera a fractionOfDistanceToTarget with positive zooming in and negative zooming out.
In [6]:
help(cam.LookAt)
cam.LookAt((32, -100, 100), ren.GetTransform().GetOrigin())
ses.Show()
Help on method LookAt in module vapor.camera: LookAt(camera_position: tuple[float, float, float], target: tuple[float, float, float], up: tuple[float, float, float] = (0, 0, 1)) method of vapor.camera.Camera instance Moves the camera to camera_position facing target. up can be used to adjust the camera roll.