From 3fd05669dc86e983c2a94ec825ae3fed33cfcfd3 Mon Sep 17 00:00:00 2001 From: murraystevenson <50844517+murraystevenson@users.noreply.github.com> Date: Sat, 26 Oct 2019 13:17:47 -0700 Subject: [PATCH] Update CameraAlgo.cpp support for camera crop window --- src/GafferCycles/IECoreCyclesPreview/CameraAlgo.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/GafferCycles/IECoreCyclesPreview/CameraAlgo.cpp b/src/GafferCycles/IECoreCyclesPreview/CameraAlgo.cpp index 4b0fe24..5497c4e 100644 --- a/src/GafferCycles/IECoreCyclesPreview/CameraAlgo.cpp +++ b/src/GafferCycles/IECoreCyclesPreview/CameraAlgo.cpp @@ -103,7 +103,18 @@ ccl::Camera *convertCommon( const IECoreScene::Camera *camera, const std::string const Imath::V2f &clippingPlanes = camera->getClippingPlanes(); ccam->nearclip = clippingPlanes.x; ccam->farclip = clippingPlanes.y; - + + // Crop window + if ( camera->hasCropWindow() ) + { + const Imath::Box2f &cropWindow = camera->getCropWindow(); + ccam->border.left = cropWindow.min.x; + ccam->border.right = cropWindow.max.x; + ccam->border.top = cropWindow.max.y; + ccam->border.bottom = cropWindow.min.y; + ccam->border.clamp(); + } + // Shutter TODO: Need to see if this is correct or not, cycles also has a shutter curve... const Imath::V2f &shutter = camera->getShutter(); if ((shutter.x > 0.0) && (shutter.y > 0.0))