collada.camera.PerspectiveCamera¶
- class collada.camera.PerspectiveCamera(id, znear, zfar, xfov=None, yfov=None, aspect_ratio=None, xmlnode=None)¶
Perspective camera as defined in COLLADA tag <perspective>.
- __init__(id, znear, zfar, xfov=None, yfov=None, aspect_ratio=None, xmlnode=None)¶
Create a new perspective camera.
Note:
aspect_ratio = tan(0.5*xfov) / tan(0.5*yfov)
- You can specify one of:
xfov
aloneyfov
alonexfov
andyfov
xfov
andaspect_ratio
yfov
andaspect_ratio
Any other combination will raise
collada.common.DaeMalformedError
- Parameters:
id (str) – Identifier for the camera
znear (float) – Distance to the near clipping plane
zfar (float) – Distance to the far clipping plane
xfov (float) – Horizontal field of view, in degrees
yfov (float) – Vertical field of view, in degrees
aspect_ratio (float) – Aspect ratio of the field of view
xmlnode – If loaded from xml, the xml node
Methods
__init__
(id, znear, zfar[, xfov, yfov, ...])Create a new perspective camera.
bind
(matrix)Create a bound camera of itself based on a transform matrix.
load
(collada, localscope, node)Load and return a class instance from an XML node.
save
()Saves the perspective camera's properties back to xmlnode
Attributes
xmlnode
ElementTree representation of the data.
id
Identifier for the camera
xfov
Horizontal field of view, in degrees
yfov
Vertical field of view, in degrees
aspect_ratio
Aspect ratio of the field of view
znear
Distance to the near clipping plane
zfar
Distance to the far clipping plane