Skip to content

Commit

Permalink
Update CameraAlgo.cpp
Browse files Browse the repository at this point in the history
support for camera crop window
  • Loading branch information
murraystevenson authored Oct 26, 2019
1 parent 4434c81 commit 3fd0566
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/GafferCycles/IECoreCyclesPreview/CameraAlgo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 3fd0566

Please sign in to comment.