Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/pgraph/clipPlaneAttrib.I

Go to the documentation of this file.
00001 // Filename: clipPlaneAttrib.I
00002 // Created by:  drose (11Jul02)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 
00020 ////////////////////////////////////////////////////////////////////
00021 //     Function: ClipPlaneAttrib::Constructor
00022 //       Access: Private
00023 //  Description: Use ClipPlaneAttrib::make() to construct a new
00024 //               ClipPlaneAttrib object.
00025 ////////////////////////////////////////////////////////////////////
00026 INLINE ClipPlaneAttrib::
00027 ClipPlaneAttrib() {
00028   _operation = O_set;
00029 }
00030 
00031 ////////////////////////////////////////////////////////////////////
00032 //     Function: ClipPlaneAttrib::get_operation
00033 //       Access: Published
00034 //  Description: Returns the basic operation type of the ClipPlaneAttrib.
00035 //               If this is O_set, the planes listed here completely
00036 //               replace any planes that were already on.  If this is
00037 //               O_add, the planes here are added to the set of of
00038 //               planes that were already on, and if O_remove, the
00039 //               planes here are removed from the set of planes that
00040 //               were on.
00041 ////////////////////////////////////////////////////////////////////
00042 INLINE ClipPlaneAttrib::Operation ClipPlaneAttrib::
00043 get_operation() const {
00044   return _operation;
00045 }
00046 
00047 ////////////////////////////////////////////////////////////////////
00048 //     Function: ClipPlaneAttrib::get_num_planes
00049 //       Access: Published
00050 //  Description: Returns the number of planes listed in the attribute.
00051 ////////////////////////////////////////////////////////////////////
00052 INLINE int ClipPlaneAttrib::
00053 get_num_planes() const {
00054   return _planes.size();
00055 }
00056 
00057 ////////////////////////////////////////////////////////////////////
00058 //     Function: ClipPlaneAttrib::get_plane
00059 //       Access: Published
00060 //  Description: Returns the nth planes listed in the attribute.
00061 ////////////////////////////////////////////////////////////////////
00062 INLINE PlaneNode *ClipPlaneAttrib::
00063 get_plane(int n) const {
00064   nassertr(n >= 0 && n < (int)_planes.size(), (PlaneNode *)NULL);
00065   return _planes[n];
00066 }
00067 
00068 ////////////////////////////////////////////////////////////////////
00069 //     Function: ClipPlaneAttrib::add_plane
00070 //       Access: Published
00071 //  Description: Returns a new ClipPlaneAttrib, just like this one, but
00072 //               with the indicated plane added to the list of planes.
00073 ////////////////////////////////////////////////////////////////////
00074 INLINE CPT(RenderAttrib) ClipPlaneAttrib::
00075 add_plane(PlaneNode *plane) const {
00076   if (_operation == O_remove) {  
00077     return compose(make(O_remove, plane));
00078   } else {
00079     return compose(make(O_add, plane));
00080   }
00081 }
00082 
00083 ////////////////////////////////////////////////////////////////////
00084 //     Function: ClipPlaneAttrib::remove_plane
00085 //       Access: Published
00086 //  Description: Returns a new ClipPlaneAttrib, just like this one, but
00087 //               with the indicated plane removed from the list of
00088 //               planes.
00089 ////////////////////////////////////////////////////////////////////
00090 INLINE CPT(RenderAttrib) ClipPlaneAttrib::
00091 remove_plane(PlaneNode *plane) const {
00092   if (_operation == O_remove) {  
00093     return compose(make(O_add, plane));
00094   } else {
00095     return compose(make(O_remove, plane));
00096   }
00097 }
00098 
00099 ////////////////////////////////////////////////////////////////////
00100 //     Function: ClipPlaneAttrib::is_identity
00101 //       Access: Published
00102 //  Description: Returns true if this is an identity attrib: it does
00103 //               not change the set of planes in use.
00104 ////////////////////////////////////////////////////////////////////
00105 INLINE bool ClipPlaneAttrib::
00106 is_identity() const {
00107   return _operation != O_set && _planes.empty();
00108 }
00109 
00110 ////////////////////////////////////////////////////////////////////
00111 //     Function: ClipPlaneAttrib::is_all_off
00112 //       Access: Published
00113 //  Description: Returns true if this attrib turns off all planes and
00114 //               turns none on.
00115 ////////////////////////////////////////////////////////////////////
00116 INLINE bool ClipPlaneAttrib::
00117 is_all_off() const {
00118   return _operation == O_set && _planes.empty();
00119 }

Generated on Fri May 2 00:41:09 2003 for Panda by doxygen1.3