MCPcopy Create free account
hub / github.com/OSVR/OSVR-Core / m_getRect

Method m_getRect

src/osvr/Client/ViewerEye.cpp:70–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68 }
69
70 util::Rectd ViewerEye::m_getRect(double near, double /*far*/ = 100) const {
71 util::Rectd rect(m_unitBounds);
72 // Scale the in-plane positions based on the near plane to put
73 // the virtual viewing window on the near plane with the eye at the
74 // origin.
75 rect *= near;
76
77 /// @todo Incorporate any rotation of the lenses around the eye Y axis
78 // (such as the Oculus DK2) by shifting the boundaries.
79
80 // Incorporate pitch_tilt (degrees, positive is downwards)
81 // We assume that this results in a shearing of the image that leaves
82 // the plane of the screen the same.
83 if (m_pitchTilt != 0) {
84 /// @todo
85 }
86
87 /// @todo Incorporate distortion (find the new boundaries so that
88 // we will have something to put into every pixel once the
89 // predistortion has been applied around the center of projection).
90
91 /// @todo Incorporate extra space to enable us to shift the image
92 /// after it has been rendered based on a new tracker report.
93
94 // See if we need to rotate 180 degrees about Z.
95 //
96 // If so, do so by swapping each pair of edges, producing an upside-down
97 // projection. We do this after all of the above shifts, producing an
98 // image that matches but which is upside down.
99 //
100 // NOTE: This would adjust the distortion center of projection, but it
101 // is assumed that we're doing this to make scan-out circuitry behave
102 // rather than to change where the actual pixel location of the center
103 // of projection is.
104 if (m_rot180) {
105 std::swap(rect[util::Rectd::LEFT], rect[util::Rectd::RIGHT]);
106 std::swap(rect[util::Rectd::TOP], rect[util::Rectd::BOTTOM]);
107 }
108
109#if 0
110 // Make sure that things won't blow up in the math below.
111 if ((nearClip <= 0) || (farClip <= 0) || (nearClip == farClip) ||
112 (left == right) || (top == bottom)) {
113 return false;
114 }
115#endif
116
117 /// @todo Figure out interactions between the above shifts and
118 /// distortions and make sure to do them in the right order, or to
119 /// adjust as needed to make them consistent when they are composed.
120
121 return rect;
122 }
123
124 Eigen::Matrix4d ViewerEye::getProjection(double near, double far) const {
125

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected