panda3d.core.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

Inheritance diagram of Camera

__init__(copy: Camera) → None
__init__(name: str, lens: Lens) → None
property active
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.

Return type

bool

property aux_scene_data
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.

Return type

Mapping[AuxSceneData]

property camera_mask
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.

Return type

DrawMask

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_bounds
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.

Return type

BoundingVolume

property cull_center
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.

Return type

NodePath

property display_regions

Returns the nth display region associated with the camera.

Return type

Sequence[DisplayRegion]

getAuxSceneData(node_path: NodePath) → AuxSceneData

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

Return type

AuxSceneData

getCameraMask() → DrawMask

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

Return type

DrawMask

static getClassType() → TypeHandle
Return type

TypeHandle

getCullBounds() → BoundingVolume

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

Return type

BoundingVolume

getCullCenter() → NodePath

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

Return type

NodePath

getDisplayRegion(n: size_t) → DisplayRegion

Returns the nth display region associated with the camera.

Return type

DisplayRegion

getDisplayRegions() → list
getInitialState() → RenderState

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

Return type

RenderState

getLodCenter() → NodePath

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

Return type

NodePath

getLodScale() → float

Returns the multiplier for LOD distances.

getNumDisplayRegions() → size_t

Returns the number of display regions associated with the camera.

Return type

size_t

getScene() → NodePath

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

Return type

NodePath

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.

Return type

RenderState

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
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.

Return type

ConstPointerTo_RenderState

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_center
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.

Return type

NodePath

property lod_scale
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.

Return type

float

property scene
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.

Return type

NodePath

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
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()).

Return type

string

property tag_states
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.

Return type

Mapping[ConstPointerTo_RenderState]