mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 01:07:51 -04:00
support set_dt(0) in M_slave mode
This commit is contained in:
parent
58555a2895
commit
8a30b5fae0
@ -146,23 +146,6 @@ get_dt(Thread *current_thread) const {
|
|||||||
return cdata->_dt;
|
return cdata->_dt;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
// Function: ClockObject::set_dt
|
|
||||||
// Access: Published
|
|
||||||
// Description: In non-real-time mode, sets the number of seconds
|
|
||||||
// that should appear to elapse between frames. In
|
|
||||||
// forced mode or limited mode, sets our target dt. In
|
|
||||||
// normal mode, this has no effect.
|
|
||||||
//
|
|
||||||
// Also see set_frame_rate(), which is a different way
|
|
||||||
// to specify the same quantity.
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
INLINE void ClockObject::
|
|
||||||
set_dt(double dt) {
|
|
||||||
nassertv(dt != 0.0);
|
|
||||||
set_frame_rate(1.0 / dt);
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: ClockObject::get_max_dt
|
// Function: ClockObject::get_max_dt
|
||||||
// Access: Published
|
// Access: Published
|
||||||
|
@ -224,6 +224,34 @@ set_frame_count(int frame_count, Thread *current_thread) {
|
|||||||
cdata->_frame_count / _user_frame_rate;
|
cdata->_frame_count / _user_frame_rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: ClockObject::set_dt
|
||||||
|
// Access: Published
|
||||||
|
// Description: In non-real-time mode, sets the number of seconds
|
||||||
|
// that should appear to elapse between frames. In
|
||||||
|
// forced mode or limited mode, sets our target dt. In
|
||||||
|
// normal mode, this has no effect.
|
||||||
|
//
|
||||||
|
// Also see set_frame_rate(), which is a different way
|
||||||
|
// to specify the same quantity.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
void ClockObject::
|
||||||
|
set_dt(double dt) {
|
||||||
|
if (_mode == M_slave) {
|
||||||
|
// In M_slave mode, we can set any dt we like.
|
||||||
|
CDWriter cdata(_cycler, Thread::get_current_thread());
|
||||||
|
cdata->_dt = dt;
|
||||||
|
if (dt != 0.0) {
|
||||||
|
set_frame_rate(1.0 / dt);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// In any other mode, we can only set non-zero dt.
|
||||||
|
nassertv(dt != 0.0);
|
||||||
|
set_frame_rate(1.0 / dt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: ClockObject::set_frame_rate
|
// Function: ClockObject::set_frame_rate
|
||||||
// Access: Published
|
// Access: Published
|
||||||
|
@ -94,7 +94,7 @@ PUBLISHED:
|
|||||||
INLINE double get_net_frame_rate(Thread *current_thread = Thread::get_current_thread()) const;
|
INLINE double get_net_frame_rate(Thread *current_thread = Thread::get_current_thread()) const;
|
||||||
|
|
||||||
INLINE double get_dt(Thread *current_thread = Thread::get_current_thread()) const;
|
INLINE double get_dt(Thread *current_thread = Thread::get_current_thread()) const;
|
||||||
INLINE void set_dt(double dt);
|
void set_dt(double dt);
|
||||||
void set_frame_rate(double frame_rate);
|
void set_frame_rate(double frame_rate);
|
||||||
|
|
||||||
INLINE double get_max_dt() const;
|
INLINE double get_max_dt() const;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user