pxr/imaging/lib/cameraUtil/conformWindow.cpp : CameraUtilConformedWindow
| 287 | |
| 288 | //pxr/imaging/lib/cameraUtil/conformWindow.cpp : CameraUtilConformedWindow |
| 289 | Imath::Box2f Camera::fitWindow( const Imath::Box2f &window, Camera::FilmFit fitMode, float targetAspect) |
| 290 | { |
| 291 | if( fitMode == Camera::Distort ) |
| 292 | { |
| 293 | return window; // Just return the original window, even if this produces non-square pixels |
| 294 | } |
| 295 | |
| 296 | const Camera::FilmFit resolvedFitMode = |
| 297 | resolveFitMode( window.size(), fitMode, targetAspect); |
| 298 | |
| 299 | if( resolvedFitMode == Camera::Horizontal ) |
| 300 | { |
| 301 | const double height = |
| 302 | window.size()[0] / (targetAspect != 0.0 ? targetAspect : 1.0); |
| 303 | |
| 304 | return Imath::Box2f( |
| 305 | Imath::V2f( window.min[0], window.center()[1] - 0.5f * height ), |
| 306 | Imath::V2f( window.max[0], window.center()[1] + 0.5f * height ) |
| 307 | ); |
| 308 | } |
| 309 | else |
| 310 | { |
| 311 | const double width = window.size()[1] * targetAspect; |
| 312 | |
| 313 | return Imath::Box2f( |
| 314 | Imath::V2f(window.center()[0] - 0.5f * width, window.min[1]), |
| 315 | Imath::V2f(window.center()[0] + 0.5f * width, window.max[1]) |
| 316 | ); |
| 317 | } |
| 318 | } |
| 319 | |
| 320 | Imath::Box2f Camera::frustum() const |
| 321 | { |
no test coverage detected