Panda3D

lensNode.I

00001 // Filename: lensNode.I
00002 // Created by:  drose (26Feb02)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 
00016 ////////////////////////////////////////////////////////////////////
00017 //     Function: LensNode::copy_lens
00018 //       Access: Published
00019 //  Description: Sets up the LensNode using a copy of the
00020 //               indicated Lens.  If the original Lens is
00021 //               changed or destroyed, this LensNode is not
00022 //               affected.
00023 ////////////////////////////////////////////////////////////////////
00024 INLINE void LensNode::
00025 copy_lens(const Lens &lens) {
00026   return copy_lens(0, lens);
00027 }
00028 
00029 ////////////////////////////////////////////////////////////////////
00030 //     Function: LensNode::copy_lens
00031 //       Access: Published
00032 //  Description: Copies the indicated lens into the specified slot.
00033 ////////////////////////////////////////////////////////////////////
00034 INLINE void LensNode::
00035 copy_lens(int index, const Lens &lens) {
00036   set_lens(index, lens.make_copy());
00037 }
00038 
00039 ////////////////////////////////////////////////////////////////////
00040 //     Function: LensNode::set_lens
00041 //       Access: Published
00042 //  Description: Sets up the LensNode using this particular Lens
00043 //               pointer.  If the lens is subsequently modified, the
00044 //               LensNode properties immediately reflect the change.
00045 ////////////////////////////////////////////////////////////////////
00046 INLINE void LensNode::
00047 set_lens(Lens *lens) {
00048   return set_lens(0, lens);
00049 }
00050 
00051 ////////////////////////////////////////////////////////////////////
00052 //     Function: LensNode::get_lens
00053 //       Access: Published
00054 //  Description: Returns a pointer to the particular Lens
00055 //               associated with this LensNode, or NULL if there is
00056 //               not yet a Lens associated.  If an index number is
00057 //               specified, returns the nth lens.
00058 ////////////////////////////////////////////////////////////////////
00059 INLINE Lens *LensNode::
00060 get_lens(int index) const {
00061   nassertr(index >= 0 && index < max_lenses, NULL); // Sanity check
00062 
00063   if (index < (int)_lenses.size()) {
00064     return _lenses[index]._lens;
00065   }
00066   return NULL;
00067 }
00068 
00069 ////////////////////////////////////////////////////////////////////
00070 //     Function: LensNode::get_lens_active
00071 //       Access: Published
00072 //  Description: Returns the active flag for the nth lens.
00073 ////////////////////////////////////////////////////////////////////
00074 INLINE bool LensNode::
00075 get_lens_active(int index) const {
00076   nassertr(index >= 0 && index < max_lenses, false);
00077 
00078   if (index < (int)_lenses.size()) {
00079     return _lenses[index]._is_active;
00080   }
00081   return false;
00082 }
00083 
00084 ////////////////////////////////////////////////////////////////////
00085 //     Function: LensNode::activate_lens
00086 //       Access: Published
00087 //  Description: An alternate way to call set_lens_active(index,
00088 //               true).
00089 ////////////////////////////////////////////////////////////////////
00090 INLINE bool LensNode::
00091 activate_lens(int index) {
00092   return set_lens_active(index, true);
00093 }
00094 
00095 ////////////////////////////////////////////////////////////////////
00096 //     Function: LensNode::deactivate_lens
00097 //       Access: Published
00098 //  Description: An alternate way to call set_lens_active(index,
00099 //               false).
00100 ////////////////////////////////////////////////////////////////////
00101 INLINE bool LensNode::
00102 deactivate_lens(int index) {
00103   return set_lens_active(index, false);
00104 }
00105 
00106 ////////////////////////////////////////////////////////////////////
00107 //     Function: LensNode::is_in_view
00108 //       Access: Published
00109 //  Description: Returns true if the given point is within the bounds
00110 //               of the lens of the LensNode (i.e. if the camera can
00111 //               see the point).
00112 ////////////////////////////////////////////////////////////////////
00113 INLINE bool LensNode::
00114 is_in_view(const LPoint3 &pos) {
00115   return is_in_view(0, pos);
00116 }
00117 
 All Classes Functions Variables Enumerations