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