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