renderEffect.I 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // Filename: renderEffect.I
  2. // Created by: drose (14Mar02)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. //
  6. // PANDA 3D SOFTWARE
  7. // Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
  8. //
  9. // All use of this software is subject to the terms of the Panda 3d
  10. // Software license. You should have received a copy of this license
  11. // along with this source code; you will also find a current copy of
  12. // the license at http://etc.cmu.edu/panda3d/docs/license/ .
  13. //
  14. // To contact the maintainers of this program write to
  15. // [email protected] .
  16. //
  17. ////////////////////////////////////////////////////////////////////
  18. ////////////////////////////////////////////////////////////////////
  19. // Function: RenderEffect::compare_to
  20. // Access: Published
  21. // Description: Provides an arbitrary ordering among all unique
  22. // RenderEffects, so we can store the essentially
  23. // different ones in a big set and throw away the rest.
  24. //
  25. // This method is not needed outside of the RenderEffect
  26. // class because all equivalent RenderEffect objects are
  27. // guaranteed to share the same pointer; thus, a pointer
  28. // comparison is always sufficient.
  29. ////////////////////////////////////////////////////////////////////
  30. INLINE int RenderEffect::
  31. compare_to(const RenderEffect &other) const {
  32. // First, we compare the types; if they are of different types then
  33. // they sort differently.
  34. TypeHandle type = get_type();
  35. TypeHandle other_type = other.get_type();
  36. if (type != other_type) {
  37. return type.get_index() - other_type.get_index();
  38. }
  39. // We only call compare_to_impl() if they have the same type.
  40. return compare_to_impl(&other);
  41. }