# Camera¶

from panda3d.core import Camera

class Camera

Bases: LensNode

A node that can be positioned around in the scene graph to represent a point of view for rendering a scene.

Inheritance diagram

__init__(copy: Camera)
__init__(name: str, lens: Lens)
property activebool
Getter

Returns the current setting of the active flag on the camera.

Setter

Sets the active flag on the camera. When the camera is not active, nothing will be rendered.

property aux_scene_dataAuxSceneData
Getter

Returns the AuxSceneData associated with the indicated NodePath, or NULL if nothing is associated.

Setter

Associates the indicated AuxSceneData object with the given NodePath, possibly replacing a previous data defined for the same NodePath, if any.

property camera_maskDrawMask
Getter

Returns the set of bits that represent the subset of the scene graph the camera will render. See setCameraMask().

Setter

Changes the set of bits that represent the subset of the scene graph the camera will render.

During the cull traversal, a node is not visited if none of its draw mask bits intersect with the camera’s camera mask bits. These masks can be used to selectively hide and show different parts of the scene graph from different cameras that are otherwise viewing the same scene.

cleanupAuxSceneData(current_thread: Thread)int

Walks through the list of currently-assigned AuxSceneData objects and releases any that are past their expiration times. Returns the number of elements released.

clearAuxSceneData(node_path: NodePath)bool

Removes the AuxSceneData associated with the indicated NodePath. Returns true if it is removed successfully, false if it was already gone.

clearTagState(tag_state: str)None

Removes the association established by a previous call to setTagState().

clearTagStates()None

Removes all associations established by previous calls to setTagState().

property cull_boundsBoundingVolume
Getter

Returns the custom cull volume that was set by setCullBounds(), if any, or NULL if no custom cull volume was set.

Setter

Specifies the bounding volume that should be used to perform culling from this camera. Normally, this is the bounding volume returned from the active lens’ make_bounds() call, but you may override this to specify a custom volume if you require. The specified bounding volume will be understood to be in the coordinate space of the getCullCenter() node.

property cull_centerNodePath
Getter

Returns the point from which the culling operations will be performed, if it was set by setCullCenter(), or the empty NodePath otherwise.

Setter

Specifies the point from which the culling operations are performed. Normally, this is the same as the camera, and that is the default if this is not specified; but it may sometimes be useful to perform the culling from some other viewpoint, particularly when you are debugging the culling itself.

property display_regions → Sequence[DisplayRegion]

Returns the nth display region associated with the camera.

getAuxSceneData(node_path: NodePath)AuxSceneData

Returns the AuxSceneData associated with the indicated NodePath, or NULL if nothing is associated.

getCameraMask()DrawMask

Returns the set of bits that represent the subset of the scene graph the camera will render. See setCameraMask().

static getClassType()TypeHandle
getCullBounds()BoundingVolume

Returns the custom cull volume that was set by setCullBounds(), if any, or NULL if no custom cull volume was set.

getCullCenter()NodePath

Returns the point from which the culling operations will be performed, if it was set by setCullCenter(), or the empty NodePath otherwise.

getDisplayRegion(n: int)DisplayRegion

Returns the nth display region associated with the camera.

getDisplayRegions()list
getInitialState()RenderState

Returns the initial state as set by a previous call to setInitialState().

getLodCenter()NodePath

Returns the point from which the LOD distances will be measured, if it was set by setLodCenter(), or the empty NodePath otherwise.

getLodScale()float

Returns the multiplier for LOD distances.

getNumDisplayRegions()int

Returns the number of display regions associated with the camera.

getScene()NodePath

Returns the scene that will be rendered by the camera. See setScene().

getTagState(tag_state: str)RenderState

Returns the state associated with the indicated tag state by a previous call to setTagState(), or the empty state if nothing has been associated.

getTagStateKey()str

Returns the tag key as set by a previous call to setTagStateKey().

hasTagState(tag_state: str)bool

Returns true if setTagState() has previously been called with the indicated tag state, false otherwise.

property initial_state → ConstPointerTo_RenderState
Getter

Returns the initial state as set by a previous call to setInitialState().

Setter

Sets the initial state which is applied to all nodes in the scene, as if it were set at the top of the scene graph.

isActive()bool

Returns the current setting of the active flag on the camera.

listAuxSceneData(out: ostream)None

Outputs all of the NodePaths and AuxSceneDatas in use.

property lod_centerNodePath
Getter

Returns the point from which the LOD distances will be measured, if it was set by setLodCenter(), or the empty NodePath otherwise.

Setter

Specifies the point from which the LOD distances are measured. Normally, this is the same as the camera, and that is the default if this is not specified; but it may sometimes be useful to perform the distance test from some other viewpoint. This may be used, for instance, to reduce LOD popping when the camera rotates in a small circle about an avatar.

property lod_scalefloat
Getter

Returns the multiplier for LOD distances.

Setter

Sets the multiplier for LOD distances. This value is multiplied with the LOD scale set on LodNodes.

property sceneNodePath
Getter

Returns the scene that will be rendered by the camera. See setScene().

Setter

Sets the scene that will be rendered by the camera. This is normally the root node of a scene graph, typically a node called ‘render’, although it could represent the root of any subgraph.

Note that the use of this method is now deprecated. In the absence of an explicit scene set on the camera, the camera will render whatever scene it is parented into. This is the preferred way to specify the scene, since it is the more intuitive mechanism.

setActive(active: bool)None

Sets the active flag on the camera. When the camera is not active, nothing will be rendered.

setAuxSceneData(node_path: NodePath, data: AuxSceneData)None

Associates the indicated AuxSceneData object with the given NodePath, possibly replacing a previous data defined for the same NodePath, if any.

setCameraMask(mask: DrawMask)None

Changes the set of bits that represent the subset of the scene graph the camera will render.

During the cull traversal, a node is not visited if none of its draw mask bits intersect with the camera’s camera mask bits. These masks can be used to selectively hide and show different parts of the scene graph from different cameras that are otherwise viewing the same scene.

setCullBounds(cull_bounds: BoundingVolume)None

Specifies the bounding volume that should be used to perform culling from this camera. Normally, this is the bounding volume returned from the active lens’ make_bounds() call, but you may override this to specify a custom volume if you require. The specified bounding volume will be understood to be in the coordinate space of the getCullCenter() node.

setCullCenter(cull_center: NodePath)None

Specifies the point from which the culling operations are performed. Normally, this is the same as the camera, and that is the default if this is not specified; but it may sometimes be useful to perform the culling from some other viewpoint, particularly when you are debugging the culling itself.

setInitialState(state: RenderState)None

Sets the initial state which is applied to all nodes in the scene, as if it were set at the top of the scene graph.

setLodCenter(lod_center: NodePath)None

Specifies the point from which the LOD distances are measured. Normally, this is the same as the camera, and that is the default if this is not specified; but it may sometimes be useful to perform the distance test from some other viewpoint. This may be used, for instance, to reduce LOD popping when the camera rotates in a small circle about an avatar.

setLodScale(value: float)None

Sets the multiplier for LOD distances. This value is multiplied with the LOD scale set on LodNodes.

setScene(scene: NodePath)None

Sets the scene that will be rendered by the camera. This is normally the root node of a scene graph, typically a node called ‘render’, although it could represent the root of any subgraph.

Note that the use of this method is now deprecated. In the absence of an explicit scene set on the camera, the camera will render whatever scene it is parented into. This is the preferred way to specify the scene, since it is the more intuitive mechanism.

setTagState(tag_state: str, state: RenderState)None

Associates a particular state transition with the indicated tag value. When a node is encountered during traversal with the tag key specified by setTagStateKey(), if the value of that tag matches tag_state, then the indicated state is applied to this node–but only when it is rendered by this camera.

This can be used to apply special effects to nodes when they are rendered by certain cameras. It is particularly useful for multipass rendering, in which specialty cameras might be needed to render the scene with a particular set of effects.

setTagStateKey(tag_state_key: str)None

Sets the tag key which, when encountered as a tag on nodes in the scene graph, causes this Camera to apply an arbitrary state transition based on the value of the tag (as specified to setTagState()).

property tag_state_key → string
Getter

Returns the tag key as set by a previous call to setTagStateKey().

Setter

Sets the tag key which, when encountered as a tag on nodes in the scene graph, causes this Camera to apply an arbitrary state transition based on the value of the tag (as specified to setTagState()).

property tag_states → ConstPointerTo_RenderState
Getter

Returns the state associated with the indicated tag state by a previous call to setTagState(), or the empty state if nothing has been associated.

Setter

Associates a particular state transition with the indicated tag value. When a node is encountered during traversal with the tag key specified by setTagStateKey(), if the value of that tag matches tag_state, then the indicated state is applied to this node–but only when it is rendered by this camera.

This can be used to apply special effects to nodes when they are rendered by certain cameras. It is particularly useful for multipass rendering, in which specialty cameras might be needed to render the scene with a particular set of effects.