Panda3D

Loading...
Searching...
No Matches
lensNode.I
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file lensNode.I
10 * @author drose
11 * @date 2002-02-26
12 */
13
14/**
15 * Sets up the LensNode using a copy of the indicated Lens. If the original
16 * Lens is changed or destroyed, this LensNode is not affected.
17 */
18INLINE void LensNode::
19 copy_lens(const Lens &lens) {
20 return copy_lens(0, lens);
21}
22
23/**
24 * Copies the indicated lens into the specified slot.
25 */
26INLINE void LensNode::
27 copy_lens(int index, const Lens &lens) {
28 set_lens(index, lens.make_copy());
29}
30
31/**
32 * Sets up the LensNode using this particular Lens pointer. If the lens is
33 * subsequently modified, the LensNode properties immediately reflect the
34 * change.
35 */
36INLINE void LensNode::
37 set_lens(Lens *lens) {
38 return set_lens(0, lens);
39}
40
41/**
42 * Returns a pointer to the particular Lens associated with this LensNode, or
43 * NULL if there is not yet a Lens associated. If an index number is
44 * specified, returns the nth lens.
45 */
46INLINE Lens *LensNode::
47 get_lens(int index) const {
48 nassertr(index >= 0 && index < max_lenses, nullptr); // Sanity check
49
50 if (index < (int)_lenses.size()) {
51 return _lenses[index]._lens;
52 }
53 return nullptr;
54}
55
56/**
57 * Returns the active flag for the nth lens.
58 */
59INLINE bool LensNode::
60 get_lens_active(int index) const {
61 nassertr(index >= 0 && index < max_lenses, false);
62
63 if (index < (int)_lenses.size()) {
64 return _lenses[index]._is_active;
65 }
66 return false;
67}
68
69/**
70 * An alternate way to call set_lens_active(index, true).
71 */
72INLINE bool LensNode::
73 activate_lens(int index) {
74 return set_lens_active(index, true);
75}
76
77/**
78 * An alternate way to call set_lens_active(index, false).
79 */
80INLINE bool LensNode::
81 deactivate_lens(int index) {
82 return set_lens_active(index, false);
83}
84
85/**
86 * Returns true if the given point is within the bounds of the lens of the
87 * LensNode (i.e. if the camera can see the point).
88 */
89INLINE bool LensNode::
90 is_in_view(const LPoint3 &pos) {
91 return is_in_view(0, pos);
92}
LensNode::set_lens
void set_lens(Lens *lens)
Sets up the LensNode using this particular Lens pointer.
Definition lensNode.I:37
LensNode::copy_lens
void copy_lens(const Lens &lens)
Sets up the LensNode using a copy of the indicated Lens.
Definition lensNode.I:19
LensNode::is_in_view
bool is_in_view(const LPoint3 &pos)
Returns true if the given point is within the bounds of the lens of the LensNode (i....
Definition lensNode.I:90
LensNode::set_lens_active
bool set_lens_active(int index, bool active)
Sets the active flag for the nth lens.
Definition lensNode.cxx:99
LensNode::get_lens
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...
Definition lensNode.I:47
LensNode::activate_lens
bool activate_lens(int index)
An alternate way to call set_lens_active(index, true).
Definition lensNode.I:73
LensNode::deactivate_lens
bool deactivate_lens(int index)
An alternate way to call set_lens_active(index, false).
Definition lensNode.I:81
LensNode::get_lens_active
bool get_lens_active(int index) const
Returns the active flag for the nth lens.
Definition lensNode.I:60
Lens
A base class for any number of different kinds of lenses, linear and otherwise.
Definition lens.h:41