521 double ratio = this->AspectRatio();
522 double fov = this->HFOV().Radian();
525 double _near = this->NearClipPlane();
526 double _far = this->FarClipPlane();
527 double top = _near *
std::tan(0.5*vfov) / f;
528 double height = 2 * top;
529 double width = ratio * height;
530 double left = -0.5 * width;
531 double right = left + width;
532 double bottom = top - height;
534 double invw = 1.0 / (right - left);
535 double invh = 1.0 / (top - bottom);
536 double invd = 1.0 / (_far - _near);
537 double x = 2 * _near * invw;
538 double y = 2 * _near * invh;
539 double a = (right + left) * invw;
540 double b = (top + bottom) * invh;
541 double c = -(_far + _near) * invd;
542 double d = -2 * _far * _near * invd;
553 double width = this->ImageWidth();
554 double height = this->ImageHeight();
555 double left = -width * 0.5;
556 double right = -left;
557 double top = height * 0.5;
558 double bottom = -top;
559 double _near = this->NearClipPlane();
560 double _far = this->FarClipPlane();
562 double invw = 1.0 / (right - left);
563 double invh = 1.0 / (top - bottom);
564 double invd = 1.0 / (_far - _near);
566 result(0, 0) = 2.0 * invw;
567 result(0, 3) = -(right + left) * invw;
568 result(1, 1) = 2.0 * invh;
569 result(1, 3) = -(top + bottom) * invh;
570 result(2, 2) = -2.0 * invd;
571 result(2, 3) = -(_far + _near) * invd;
576 gzerr <<
"Unknown camera projection type: " << this->projectionType