Browse Source

fix multitransitions/lights for Windows

David Rose 24 years ago
parent
commit
0a7ff1b5c9

+ 5 - 19
panda/src/graph/multiTransition.T

@@ -22,20 +22,6 @@
 template<class Property, class NameClass>
 TypeHandle MultiTransition<Property, NameClass>::_type_handle;
 
-////////////////////////////////////////////////////////////////////
-//     Function: MultiTransition::SortByFirstOfPair function operator
-//       Access: Public
-//  Description: Implements the STL function object that sorts
-//               elements in the vector according to the first
-//               component of each element.
-////////////////////////////////////////////////////////////////////
-template<class Property, class NameClass>
-INLINE_GRAPH bool MultiTransition<Property, NameClass>::SortByFirstOfPair::
-operator ()(const MultiTransition<Property, NameClass>::Element &a, 
-            const MultiTransition<Property, NameClass>::Element &b) const {
-  return a.first < b.first;
-}
-
 ////////////////////////////////////////////////////////////////////
 //     Function: MultiTransition::Constructor
 //       Access: Public
@@ -127,7 +113,7 @@ is_identity() const {
 //               are left unchanged.
 ////////////////////////////////////////////////////////////////////
 template<class Property, class NameClass>
-INLINE_GRAPH void MultiTransition<Property, NameClass>::
+INLINE void MultiTransition<Property, NameClass>::
 set_default_dir(TransitionDirection dir) {
   _default_dir = dir;
 }
@@ -138,7 +124,7 @@ set_default_dir(TransitionDirection dir) {
 //  Description:
 ////////////////////////////////////////////////////////////////////
 template<class Property, class NameClass>
-INLINE_GRAPH TransitionDirection MultiTransition<Property, NameClass>::
+INLINE TransitionDirection MultiTransition<Property, NameClass>::
 get_default_dir() const {
   return _default_dir;
 }
@@ -594,7 +580,7 @@ write_property(ostream &, const Property &, int) const {
 //  Description:
 ////////////////////////////////////////////////////////////////////
 template<class Property, class NameClass>
-INLINE_GRAPH MultiTransition<Property, NameClass>::size_type MultiTransition<Property, NameClass>::
+INLINE MultiTransition<Property, NameClass>::size_type MultiTransition<Property, NameClass>::
 size() const {
   return _properties.size();
 }
@@ -606,7 +592,7 @@ size() const {
 //               properties in the transition.
 ////////////////////////////////////////////////////////////////////
 template<class Property, class NameClass>
-INLINE_GRAPH MultiTransition<Property, NameClass>::const_iterator MultiTransition<Property, NameClass>::
+INLINE MultiTransition<Property, NameClass>::const_iterator MultiTransition<Property, NameClass>::
 begin() const {
   return _properties.begin();
 }
@@ -618,7 +604,7 @@ begin() const {
 //               sequence of properties in the transition.
 ////////////////////////////////////////////////////////////////////
 template<class Property, class NameClass>
-INLINE_GRAPH MultiTransition<Property, NameClass>::const_iterator MultiTransition<Property, NameClass>::
+INLINE MultiTransition<Property, NameClass>::const_iterator MultiTransition<Property, NameClass>::
 end() const {
   return _properties.end();
 }

+ 7 - 9
panda/src/graph/multiTransition.h

@@ -26,6 +26,7 @@
 #include "multiTransitionHelpers.h"
 
 #include "indent.h"
+#include "firstOfPairLess.h"
 
 #include <algorithm>
 
@@ -62,10 +63,7 @@ private:
 
   // We use this as an STL function object for sorting the vector in
   // order by its property.
-  class SortByFirstOfPair {
-  public:
-    INLINE_GRAPH bool operator ()(const Element &a, const Element &b) const;
-  };
+  typedef FirstOfPairLess<Element> SortByFirstOfPair;
 
 protected:
   MultiTransition();
@@ -89,8 +87,8 @@ PUBLISHED:
   // set the default direction, which indicates whether to implicitly
   // turn on or off (or leave alone) any property not explicitly
   // mentioned in the transition.
-  INLINE_GRAPH void set_default_dir(TransitionDirection dir);
-  INLINE_GRAPH TransitionDirection get_default_dir() const;
+  INLINE void set_default_dir(TransitionDirection dir);
+  INLINE TransitionDirection get_default_dir() const;
 
   void set_identity(const Property &prop);
   void set_on(const Property &prop);
@@ -125,9 +123,9 @@ public:
   typedef Properties::value_type value_type;
   typedef Properties::size_type size_type;
 
-  INLINE_GRAPH size_type size() const;
-  INLINE_GRAPH const_iterator begin() const;
-  INLINE_GRAPH const_iterator end() const;
+  INLINE size_type size() const;
+  INLINE const_iterator begin() const;
+  INLINE const_iterator end() const;
 
 private:
   Properties _properties;

+ 6 - 1
panda/src/putil/Sources.pp

@@ -15,7 +15,10 @@
      collideMask.h config_util.N config_util.h \
      configurable.h factoryBase.I factoryBase.h \
      factoryParam.I factoryParam.h factoryParams.I \
-     factoryParams.h globPattern.I globPattern.h \
+     factoryParams.h \
+     firstOfPairCompare.I firstOfPairCompare.h \
+     firstOfPairLess.I firstOfPairLess.h \
+     globPattern.I globPattern.h \
      globalPointerRegistry.I globalPointerRegistry.h \
      indirectCompareNames.I indirectCompareNames.h \
      indirectCompareTo.I indirectCompareTo.h \
@@ -62,6 +65,8 @@
     config_util.h configurable.h factory.I factory.h \
     factoryBase.I factoryBase.h factoryParam.I factoryParam.h \
     factoryParams.I factoryParams.h \
+    firstOfPairCompare.I firstOfPairCompare.h \
+    firstOfPairLess.I firstOfPairLess.h \
     globPattern.I globPattern.h \
     globalPointerRegistry.I globalPointerRegistry.h \
     indirectCompareNames.I indirectCompareNames.h indirectCompareTo.I \

+ 39 - 0
panda/src/putil/firstOfPairCompare.I

@@ -0,0 +1,39 @@
+// Filename: firstOfPairCompare.I
+// Created by:  drose (04Apr00)
+//
+////////////////////////////////////////////////////////////////////
+//
+// PANDA 3D SOFTWARE
+// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
+//
+// All use of this software is subject to the terms of the Panda 3d
+// Software license.  You should have received a copy of this license
+// along with this source code; you will also find a current copy of
+// the license at http://www.panda3d.org/license.txt .
+//
+// To contact the maintainers of this program write to
+// [email protected] .
+//
+////////////////////////////////////////////////////////////////////
+
+
+////////////////////////////////////////////////////////////////////
+//     Function: FirstOfPairCompare::Constructor
+//       Access: Public
+//  Description: 
+////////////////////////////////////////////////////////////////////
+template<class ObjectType, class Compare>
+INLINE FirstOfPairCompare<ObjectType, Compare>::
+FirstOfPairCompare(Compare compare) : _compare(compare) {
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: FirstOfPairCompare::operator ()
+//       Access: Public
+//  Description: Returns true if a sorts before b, false otherwise.
+////////////////////////////////////////////////////////////////////
+template<class ObjectType, class Compare>
+INLINE bool FirstOfPairCompare<ObjectType, Compare>::
+operator () (const ObjectType &a, const ObjectType &b) const {
+  return _compare(a.first, b.first);
+}

+ 42 - 0
panda/src/putil/firstOfPairCompare.h

@@ -0,0 +1,42 @@
+// Filename: firstOfPairCompare.h
+// Created by:  drose (27Jun01)
+//
+////////////////////////////////////////////////////////////////////
+//
+// PANDA 3D SOFTWARE
+// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
+//
+// All use of this software is subject to the terms of the Panda 3d
+// Software license.  You should have received a copy of this license
+// along with this source code; you will also find a current copy of
+// the license at http://www.panda3d.org/license.txt .
+//
+// To contact the maintainers of this program write to
+// [email protected] .
+//
+////////////////////////////////////////////////////////////////////
+
+#ifndef FIRSTOFPAIRCOMPARE_H
+#define FIRSTOFPAIRCOMPARE_H
+
+#include <pandabase.h>
+
+////////////////////////////////////////////////////////////////////
+//       Class : FirstOfPairCompare
+// Description : An STL function object class, this is intended to be
+//               used on any ordered collection of pairs of objects.
+//               It invokes the indicated comparison function object
+//               on the first object of its pair.
+////////////////////////////////////////////////////////////////////
+template<class ObjectType, class Compare>
+class FirstOfPairCompare {
+public:
+  INLINE FirstOfPairCompare(Compare compare = Compare());
+  INLINE bool operator () (const ObjectType &a, const ObjectType &b) const;
+  Compare _compare;
+};
+
+#include "firstOfPairCompare.I"
+
+#endif
+

+ 28 - 0
panda/src/putil/firstOfPairLess.I

@@ -0,0 +1,28 @@
+// Filename: firstOfPairLess.I
+// Created by:  drose (04Apr00)
+//
+////////////////////////////////////////////////////////////////////
+//
+// PANDA 3D SOFTWARE
+// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
+//
+// All use of this software is subject to the terms of the Panda 3d
+// Software license.  You should have received a copy of this license
+// along with this source code; you will also find a current copy of
+// the license at http://www.panda3d.org/license.txt .
+//
+// To contact the maintainers of this program write to
+// [email protected] .
+//
+////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////
+//     Function: FirstOfPairLess::operator ()
+//       Access: Public
+//  Description: Returns true if a sorts before b, false otherwise.
+////////////////////////////////////////////////////////////////////
+template<class ObjectType>
+INLINE bool FirstOfPairLess<ObjectType>::
+operator () (const ObjectType &a, const ObjectType &b) const {
+  return a.first < b.first;
+}

+ 39 - 0
panda/src/putil/firstOfPairLess.h

@@ -0,0 +1,39 @@
+// Filename: firstOfPairLess.h
+// Created by:  drose (27Jun01)
+//
+////////////////////////////////////////////////////////////////////
+//
+// PANDA 3D SOFTWARE
+// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
+//
+// All use of this software is subject to the terms of the Panda 3d
+// Software license.  You should have received a copy of this license
+// along with this source code; you will also find a current copy of
+// the license at http://www.panda3d.org/license.txt .
+//
+// To contact the maintainers of this program write to
+// [email protected] .
+//
+////////////////////////////////////////////////////////////////////
+
+#ifndef FIRSTOFPAIRLESS_H
+#define FIRSTOFPAIRLESS_H
+
+#include <pandabase.h>
+
+////////////////////////////////////////////////////////////////////
+//       Class : FirstOfPairLess
+// Description : An STL function object class, this is intended to be
+//               used on any ordered collection of pairs of objects.
+//               It uses < to compare the first elements of the pair.
+////////////////////////////////////////////////////////////////////
+template<class ObjectType>
+class FirstOfPairLess {
+public:
+  INLINE bool operator () (const ObjectType &a, const ObjectType &b) const;
+};
+
+#include "firstOfPairLess.I"
+
+#endif
+