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

panda/src/pgraph/renderEffects.I

Go to the documentation of this file.
00001 // Filename: renderEffects.I
00002 // Created by:  drose (14Mar02)
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: RenderEffects::Effect::Constructor
00022 //       Access: Public
00023 //  Description:
00024 ////////////////////////////////////////////////////////////////////
00025 INLINE RenderEffects::Effect::
00026 Effect(const RenderEffect *effect) :
00027   _type(effect->get_type()),
00028   _effect(effect)
00029 {
00030 }
00031 
00032 ////////////////////////////////////////////////////////////////////
00033 //     Function: RenderEffects::Effect::Constructor
00034 //       Access: Public
00035 //  Description: This constructor is only used when reading the
00036 //               RenderEffects from a bam file.  At this point, the
00037 //               effect pointer is unknown.
00038 ////////////////////////////////////////////////////////////////////
00039 INLINE RenderEffects::Effect::
00040 Effect() {
00041 }
00042 
00043 ////////////////////////////////////////////////////////////////////
00044 //     Function: RenderEffects::Effect::Constructor
00045 //       Access: Public
00046 //  Description: This constructor makes an invalid Effect with no
00047 //               RenderEffect pointer; its purpose is just to make an
00048 //               object we can use to look up a particular type in the
00049 //               Effect set.
00050 ////////////////////////////////////////////////////////////////////
00051 INLINE RenderEffects::Effect::
00052 Effect(TypeHandle type) :
00053   _type(type),
00054   _effect(NULL)
00055 {
00056 }
00057 
00058 ////////////////////////////////////////////////////////////////////
00059 //     Function: RenderEffects::Effect::Copy Constructor
00060 //       Access: Public
00061 //  Description:
00062 ////////////////////////////////////////////////////////////////////
00063 INLINE RenderEffects::Effect::
00064 Effect(const Effect &copy) :
00065   _type(copy._type),
00066   _effect(copy._effect)
00067 {
00068 }
00069 
00070 ////////////////////////////////////////////////////////////////////
00071 //     Function: RenderEffects::Effect::Copy Assignment Operator
00072 //       Access: Public
00073 //  Description:
00074 ////////////////////////////////////////////////////////////////////
00075 INLINE void RenderEffects::Effect::
00076 operator = (const Effect &copy) {
00077   _type = copy._type;
00078   _effect = copy._effect;
00079 }
00080 
00081 ////////////////////////////////////////////////////////////////////
00082 //     Function: RenderEffects::Effect::operator <
00083 //       Access: Public
00084 //  Description: This is used by the Effects set to uniquify
00085 //               RenderEffects by type.  Only one RenderEffect of a
00086 //               given type is allowed in the set.  This ordering must
00087 //               also match the ordering reported by compare_to().
00088 ////////////////////////////////////////////////////////////////////
00089 INLINE bool RenderEffects::Effect::
00090 operator < (const Effect &other) const {
00091   return _type < other._type;
00092 }
00093 
00094 ////////////////////////////////////////////////////////////////////
00095 //     Function: RenderEffects::Effect::compare_to
00096 //       Access: Public
00097 //  Description: Provides an indication of whether a particular
00098 //               effect is equivalent to another one, for purposes
00099 //               of generating unique RenderEffectss.  This should
00100 //               compare all properties of the Effect, but it is
00101 //               important that the type is compared first, to be
00102 //               consistent with the ordering defined by operator <.
00103 ////////////////////////////////////////////////////////////////////
00104 INLINE int RenderEffects::Effect::
00105 compare_to(const Effect &other) const {
00106   if (_type != other._type) {
00107     return _type.get_index() - other._type.get_index();
00108   }
00109   return _effect - other._effect;
00110 }
00111 
00112 ////////////////////////////////////////////////////////////////////
00113 //     Function: RenderEffects::is_empty
00114 //       Access: Published
00115 //  Description: Returns true if the state is empty, false otherwise.
00116 ////////////////////////////////////////////////////////////////////
00117 INLINE bool RenderEffects::
00118 is_empty() const {
00119   return _effects.empty();
00120 }
00121 
00122 ////////////////////////////////////////////////////////////////////
00123 //     Function: RenderEffects::get_num_effects
00124 //       Access: Published
00125 //  Description: Returns the number of separate effects indicated
00126 //               in the state.
00127 ////////////////////////////////////////////////////////////////////
00128 INLINE int RenderEffects::
00129 get_num_effects() const {
00130   return _effects.size();
00131 }
00132 
00133 ////////////////////////////////////////////////////////////////////
00134 //     Function: RenderEffects::get_effect
00135 //       Access: Published
00136 //  Description: Returns the nth effect in the state.
00137 ////////////////////////////////////////////////////////////////////
00138 INLINE const RenderEffect *RenderEffects::
00139 get_effect(int n) const {
00140   nassertr(n >= 0 && n < (int)_effects.size(), NULL);
00141   return _effects[n]._effect;
00142 }
00143 
00144 ////////////////////////////////////////////////////////////////////
00145 //     Function: RenderEffects::get_billboard
00146 //       Access: Public
00147 //  Description: This function is provided as an optimization, to
00148 //               speed up the render-time checking for the existance
00149 //               of a BillboardEffect on this state.  It returns a
00150 //               pointer to the BillboardEffect, if there is one, or
00151 //               NULL if there is not.
00152 ////////////////////////////////////////////////////////////////////
00153 INLINE const BillboardEffect *RenderEffects::
00154 get_billboard() const {
00155   if ((_flags & F_checked_billboard) == 0) {
00156     // We pretend this function is const, even though it transparently
00157     // modifies the internal billboard cache.
00158     ((RenderEffects *)this)->determine_billboard();
00159   }
00160   return _billboard;
00161 }
00162 
00163 ////////////////////////////////////////////////////////////////////
00164 //     Function: RenderEffects::has_decal
00165 //       Access: Public
00166 //  Description: This function is provided as an optimization, to
00167 //               speed up the render-time checking for the existance
00168 //               of a DecalEffect on this state.  It returns true if a
00169 //               DecalEffect exists, false otherwise.  Note that since
00170 //               there is no additional information stored on the
00171 //               DecalEffect, there's no point in returning it if it
00172 //               exists.
00173 ////////////////////////////////////////////////////////////////////
00174 INLINE bool RenderEffects::
00175 has_decal() const {
00176   if ((_flags & F_checked_decal) == 0) {
00177     // We pretend this function is const, even though it transparently
00178     // modifies the internal decal cache.
00179     ((RenderEffects *)this)->determine_decal();
00180   }
00181   return ((_flags & F_has_decal) != 0);
00182 }
00183 
00184 ////////////////////////////////////////////////////////////////////
00185 //     Function: RenderEffects::get_compass
00186 //       Access: Public
00187 //  Description: This function is provided as an optimization, to
00188 //               speed up the render-time checking for the existance
00189 //               of a CompassEffect on this state.  It returns a
00190 //               pointer to the CompassEffect, if there is one, or
00191 //               NULL if there is not.
00192 ////////////////////////////////////////////////////////////////////
00193 INLINE const CompassEffect *RenderEffects::
00194 get_compass() const {
00195   if ((_flags & F_checked_compass) == 0) {
00196     // We pretend this function is const, even though it transparently
00197     // modifies the internal compass cache.
00198     ((RenderEffects *)this)->determine_compass();
00199   }
00200   return _compass;
00201 }
00202 
00203 ////////////////////////////////////////////////////////////////////
00204 //     Function: RenderEffects::has_show_bounds
00205 //       Access: Public
00206 //  Description: This function is provided as an optimization, to
00207 //               speed up the render-time checking for the existance
00208 //               of a ShowBoundsEffect on this state.  It returns true
00209 //               if a ShowBoundsEffect exists, false otherwise.  Note
00210 //               that since there is no additional information stored
00211 //               on the ShowBoundsEffect, there's no point in
00212 //               returning it if it exists.
00213 ////////////////////////////////////////////////////////////////////
00214 INLINE bool RenderEffects::
00215 has_show_bounds() const {
00216   if ((_flags & F_checked_show_bounds) == 0) {
00217     // We pretend this function is const, even though it transparently
00218     // modifies the internal show_bounds cache.
00219     ((RenderEffects *)this)->determine_show_bounds();
00220   }
00221   return ((_flags & F_has_show_bounds) != 0);
00222 }

Generated on Fri May 2 00:42:16 2003 for Panda by doxygen1.3