PerspectiveCamera

class pyrender.camera.PerspectiveCamera(yfov, znear=0.05, zfar=None, aspectRatio=None, name=None)[source]

Bases: pyrender.camera.Camera

A perspective camera for perspective projection.

Parameters:
  • yfov (float) – The floating-point vertical field of view in radians.
  • znear (float) – The floating-point distance to the near clipping plane. If not specified, defaults to 0.05.
  • zfar (float, optional) – The floating-point distance to the far clipping plane. zfar must be greater than znear. If None, the camera uses an infinite projection matrix.
  • aspectRatio (float, optional) – The floating-point aspect ratio of the field of view. If not specified, the camera uses the viewport’s aspect ratio.
  • name (str, optional) – The user-defined name of this object.

Attributes Summary

aspectRatio The ratio of the width to the height of the field of view.
name The user-defined name of this object.
yfov The vertical field of view in radians.
zfar The distance to the far clipping plane.
znear The distance to the near clipping plane.

Methods Summary

get_projection_matrix([width, height]) Return the OpenGL projection matrix for this camera.

Attributes Documentation

aspectRatio

The ratio of the width to the height of the field of view.

Type:float
name

The user-defined name of this object.

Type:str
yfov

The vertical field of view in radians.

Type:float
zfar

The distance to the far clipping plane.

Type:float
znear

The distance to the near clipping plane.

Type:float

Methods Documentation

get_projection_matrix(width=None, height=None)[source]

Return the OpenGL projection matrix for this camera.

Parameters:
  • width (int) – Width of the current viewport, in pixels.
  • height (int) – Height of the current viewport, in pixels.