setCamera
Sets one or more parameters of the camera.
Signatures
- Paramate.Viewport.setCamera( camera, doRedraw )
Details
The function sets the camera to the given parameters.
The viewport is automatically redrawn after the use of this function.
If automatic camera positioning is turned on (see setCameraAutoPos) the camera position is automatically adjusted before the viewport is redrawn.
Note
The three vectors view, top and right must form a right-handed orthogonal vector system. The origin position must be aligned to the focus point and the view vector e.g. focus + b * view = origin.
It is not guaranteed that the API performs an automatic validation of the parmeters. Wrongly set parameters may cause unexpected behavior or crash.
Example
oConfig.setCamera({
origin : [ 0.0, 0.0, 0.0 ],
focus : [ 10.0, 10.0, 10.0 ],
view : [ -1.0, -1.0, -1.0 ],
top : [ -1.0, -1.0, 1.0 ],
right : [ -1.0, 1.0, 0.0 ],
aperture : 30.0 });
Parameters
- camera
-
Parameter container for setting the camera.
The object can contain the following properties:
Property Type Description origin 3-vector (float array) Center of the camera rotation. The camera is heading into this direction. Typically the origin lies close to the center of the 3d model. focus 3-vector (float array) The actual position of the camera. view 3-vector (float array) Camera orientation vector: the camera is heading into this direction. Must be orthogonal to top and right vector. top 3-vector (float array) Camera orientation vector: defines the direction that points straight upwards (as seen from the camera's coordinate system). Must be orthogonal to view and right vector. right 3-vector (float array) Camera orientation vector: defines the direction that points straight to the right (as seen from the camera's coordinate system). Must be orthogonal to view and top vector. aperture float Camera angle of view in degrees. - doRedraw
-
(optional) If this argument is present and has a value 'true' the function will call function redrawimplicitly after the camera positioning.