Browse Source

fix comments, reorder static init timing

David Rose 18 years ago
parent
commit
5412780717

+ 24 - 0
panda/src/putil/clockObject.cxx

@@ -46,6 +46,30 @@ ClockObject() {
   _start_short_time = _true_clock->get_short_time();
   _start_long_time = _true_clock->get_long_time();
   _actual_frame_time = 0.0;
+
+  ConfigVariableDouble max_dt
+    ("max-dt", -1.0,
+     PRC_DESC("Sets a limit on the value returned by ClockObject::get_dt().  If "
+              "this value is less than zero, no limit is imposed; "
+              "otherwise, this is the maximum value that will ever "
+              "be returned by get_dt(), regardless of how much time "
+              "has actually elapsed between frames.  See ClockObject::set_dt()."));
+  ConfigVariableDouble clock_frame_rate
+    ("clock-frame-rate", 1.0,
+     PRC_DESC("In non-real-time clock mode, sets the number of frames per "
+              "second that we should appear to be running.  In forced "
+              "mode or limited mode, sets our target frame rate.  In "
+              "normal mode, this has no effect.  See ClockObject::set_frame_rate()."));
+  ConfigVariableDouble clock_degrade_factor
+    ("clock-degrade-factor", 1.0,
+     PRC_DESC("In degrade clock mode, returns the ratio by which the "
+              "performance is degraded.  A value of 2.0 causes the "
+              "clock to be slowed down by a factor of two (reducing "
+              "performance to 1/2 what would be otherwise).  See ClockObject::set_degrade_factor()."));
+  ConfigVariableDouble average_frame_rate_interval
+    ("average-frame-rate-interval", 1.0,
+     PRC_DESC("See ClockObject::set_average_frame_rate_interval()."));
+
   _max_dt = max_dt;
   _user_frame_rate = clock_frame_rate;
   _degrade_factor = clock_degrade_factor;

+ 12 - 11
panda/src/putil/clockObject.h

@@ -41,18 +41,19 @@ PUBLISHED:
 ////////////////////////////////////////////////////////////////////
 //       Class : ClockObject
 // Description : A ClockObject keeps track of elapsed real time and
-//               discrete time.  It can run in two modes: In normal
-//               mode, get_frame_time() returns the time as of the
-//               last time tick() was called.  This is the "discrete"
-//               time, and is usually used to get the time as of, for
-//               instance, the beginning of the current frame.  In
-//               non-real-time mode, get_frame_time() returns a
-//               constant increment since the last time tick() was
-//               called; this is useful when it is desirable to fake
-//               the clock out, for instance for non-real-time
-//               animation rendering.
+//               discrete time.  In normal mode, get_frame_time()
+//               returns the time as of the last time tick() was
+//               called.  This is the "discrete" time, and is usually
+//               used to get the time as of, for instance, the
+//               beginning of the current frame.
 //
-//               In both modes, get_real_time() always returns the
+//               In other modes, as set by set_mode() or the
+//               clock-mode config variable, get_frame_time() may
+//               return other values to simulate different timing
+//               effects, for instance to perform non-real-time
+//               animation.  See set_mode().
+//
+//               In all modes, get_real_time() always returns the
 //               elapsed real time in seconds since the ClockObject
 //               was constructed, or since it was last reset.
 //

+ 0 - 10
panda/src/putil/config_util.cxx

@@ -113,13 +113,6 @@ get_sound_path() {
   return sound_path;
 }
 
-ConfigVariableDouble clock_frame_rate
-("clock-frame-rate", 1.0);
-ConfigVariableDouble clock_degrade_factor
-("clock-degrade-factor", 1.0);
-ConfigVariableDouble max_dt
-("max-dt", -1.0);
-
 ConfigVariableDouble sleep_precision
 ("sleep-precision", 0.01,
  PRC_DESC("This is the accuracy within which we can expect select() to "
@@ -127,9 +120,6 @@ ConfigVariableDouble sleep_precision
           "timeout of 1.0 seconds, we can expect to actually sleep for "
           "somewhere between 1.0 and 1.0 + sleep-precision seconds."));
 
-ConfigVariableDouble average_frame_rate_interval
-("average-frame-rate-interval", 1.0);
-
 ////////////////////////////////////////////////////////////////////
 //     Function: init_libputil
 //  Description: Initializes the library.  This must be called at

+ 1 - 1
panda/src/putil/simpleHashMap.I

@@ -250,7 +250,7 @@ template<class Key, class Value, class Compare>
 INLINE bool SimpleHashMap<Key, Value, Compare>::
 has_element(int n) const {
   nassertr(n >= 0 && n < (int)_table_size, false);
-  return get_exists_array()[n];
+  return (get_exists_array()[n] != 0);
 }
 
 ////////////////////////////////////////////////////////////////////