Details
Description
The Z value of vec3 returned by QQuick3DCamera::mapToViewport() indicates the distance to camera clipNear plane. However, this value is always positive, even if the point is behind the camera.
There are use cases where knowing if the point is in front of or behind the camera is valuable, such as displaying an icon for non-visual item such as light. The icon should be hidden if the light is behind camera, but that is difficult to determine currently without doing the math yourself.
I suggest QQuick3DCamera::mapToViewport() should return a negative Z value if point is behind camera.
Attachments
For Gerrit Dashboard: QTBUG-79578 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
279355,3 | Return negative distance from mapToViewport if point is behind camera | 5.14 | qt/qtquick3d | Status: MERGED | +2 | 0 |