# LensNode¶

class LensNode

Bases: PandaNode

A node that contains a Lens. The most important example of this kind of node is a Camera, but other kinds of nodes also contain a lens (for instance, a Spotlight).

Inheritance diagram

explicit LensNode(std::string const &name, Lens *lens = nullptr)
bool activate_lens(int index)

An alternate way to call set_lens_active(index, true).

void copy_lens(Lens const &lens)
void copy_lens(int index, Lens const &lens)

Sets up the LensNode using a copy of the indicated Lens. If the original Lens is changed or destroyed, this LensNode is not affected.

Copies the indicated lens into the specified slot.

bool deactivate_lens(int index)

An alternate way to call set_lens_active(index, false).

static TypeHandle get_class_type(void)
Lens *get_lens(int index = 0) const

Returns a pointer to the particular Lens associated with this LensNode, or NULL if there is not yet a Lens associated. If an index number is specified, returns the nth lens.

bool get_lens_active(int index) const

Returns the active flag for the nth lens.

void hide_frustum(void)

Disables the drawing of the lens’s frustum to aid in visualization.

bool is_in_view(LPoint3 const &pos)
bool is_in_view(int index, LPoint3 const &pos)

Returns true if the given point is within the bounds of the lens of the LensNode (i.e. if the camera can see the point).

void set_lens(Lens *lens)
void set_lens(int index, Lens *lens)

Sets up the LensNode using this particular Lens pointer. If the lens is subsequently modified, the LensNode properties immediately reflect the change.

Sets the indicated lens. Although a LensNode normally holds only one lens, it may optionally include multiple lenses, each with a different index number. The different lenses may be referenced by index number on the DisplayRegion. Adding a new lens automatically makes it active.

bool set_lens_active(int index, bool active)

Sets the active flag for the nth lens. When a lens is inactive, it is not used for rendering, and any DisplayRegions associated with it are implicitly inactive as well. Returns true if the flag is changed, false if it already had this value.

void show_frustum(void)

Enables the drawing of the lens’s frustum to aid in visualization. This actually creates a GeomNode which is parented to the LensNode.