Panda3D

renderEffect.I

00001 // Filename: renderEffect.I
00002 // Created by:  drose (14Mar02)
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: RenderEffect::compare_to
00018 //       Access: Published
00019 //  Description: Provides an arbitrary ordering among all unique
00020 //               RenderEffects, so we can store the essentially
00021 //               different ones in a big set and throw away the rest.
00022 //
00023 //               This method is not needed outside of the RenderEffect
00024 //               class because all equivalent RenderEffect objects are
00025 //               guaranteed to share the same pointer; thus, a pointer
00026 //               comparison is always sufficient.
00027 ////////////////////////////////////////////////////////////////////
00028 INLINE int RenderEffect::
00029 compare_to(const RenderEffect &other) const {
00030   // First, we compare the types; if they are of different types then
00031   // they sort differently.
00032   TypeHandle type = get_type();
00033   TypeHandle other_type = other.get_type();
00034   if (type != other_type) {
00035     return type.get_index() - other_type.get_index();
00036   }
00037 
00038   // We only call compare_to_impl() if they have the same type.
00039   return compare_to_impl(&other);
00040 }
 All Classes Functions Variables Enumerations