CameraThe Camera item defines the viewing position and projection for a 3D scene. More... Inherits QtObject Camera instantiates the C++ class QGLCamera This type was introduced in Qt 4.8. Properties
Detailed DescriptionCamera instances are defined on a Viewport item using the Viewport::camera property: import QtQuick 2.0 import Qt3D 1.0 Viewport { width: 640; height: 480 camera: Camera { eye: Qt.vector3d(-1, 2, 10) } light: Light {} Item3D { mesh: Mesh { source: "meshes/teapot.bez" } effect: Effect {} } } Positioning and orienting the viewThe viewer position and orientation are defined by eye, center, and upVector. The location of the viewer in world co-ordinates is given by eye, the viewer is looking at the object of interest located at center, and the upVector specifies the direction that should be considered "up" with respect to the viewer. The vector from the eye to the center is called the "view vector", and the cross-product of the view vector and upVector is called the "side vector". The view vector specifies the direction the viewer is looking, and the side vector points off to the right of the viewer. It is recommended that the view vector and upVector be at right angles to each other, but this is not required as long as the angle between them is close to 90 degrees. The most common use of view and up vectors that are not at right angles is to simulate a human eye at a specific height above the ground looking down at a lower object or up at a higher object. In this case, the the view vector will not be true horizontal, but the upVector indicating the human's upright stance will be true vertical. Zooming the camera imageThere are two ways to zoom the image seen through the camera: either the camera eye position can be moved closer to the object of interest, or the field of view of the camera lens can be changed to make it appear as though the object is moving closer. Changing the eye position changes the lighting calculation in the scene because the viewer is in a different position, changing the angle of light reflection on the object's surface. The fieldOfView property function can be used to simulate the effect of a camera lens. The smaller the fieldOfView, the closer the object will appear. The lighting calculation will be the same as for the unzoomed scene. If fieldOfView is zero, then a standard perspective frustum of is used to define the viewing volume based on the width and height of the Viewport. Stereo projectionsCamera can adjust the camera position for rendering separate left and right eye images by setting the eyeSeparation property to a non-zero value. The eyeSeparation is in world co-ordinates. Objects that are placed at center will coincide in the left and right eye images, establishing the logical center of the stereo effect. Objects that are closer to the eye will be rendered to appear closer in the stereo effect, and objects that are further away from eye than center will be rendered to appear further away. See also Viewport. Property DocumentationThe adjustment state of the aspect ratio in the viewing volume. By default, the camera adjusts the viewing volume for the aspect ratio of the window so that pixels appear square without the application needing to adjust the view size manually. If this property is false, then the aspect ratio adjustment is not performed. See also projectionType. The position of the viewer's eye. The default value is (0, 0, 10). See also upVector, center, and eyeSeparation. The distance from the eye to the far clipping plane. The default value is 1000. See also nearPlane. The field of view in degrees for a perspective projection. The default value is zero, which indicates a standard perspective frustum view volume. This value is ignored if projectionType is not Perspective. See also projectionType. The distance from the eye to the near clipping plane. The default value is 5. See also farPlane. The projection type for this camera, which is one of:
|