本文整理汇总了C++中SbTime::setValue方法的典型用法代码示例。如果您正苦于以下问题:C++ SbTime::setValue方法的具体用法?C++ SbTime::setValue怎么用?C++ SbTime::setValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SbTime
的用法示例。
在下文中一共展示了SbTime::setValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
// Read SbTime from input stream, return TRUE if successful. Used from
// SoSFTime and SoMFTime.
SbBool
sosftime_read_value(SoInput * in, SbTime & t)
{
double val;
if (!in->read(val)) {
SoReadError::post(in, "unable to read floating point value");
return FALSE;
}
if (!coin_finite(val)) {
SoReadError::post(in,
"Detected non-valid floating point number, replacing "
"with 0.0f");
val = 0.0;
// We don't return FALSE, thereby allowing the read process to
// continue, as a convenience for the application programmer.
}
t.setValue(val);
return TRUE;
}
示例2: if
// This function gets called whenever something has happened to any of
// the sensor queues. It starts or reschedules a timer which will
// trigger when a sensor is ripe for plucking.
void
SoGuiP::sensorQueueChanged(void * cbdata)
{
SoSensorManager * sensormanager = SoDB::getSensorManager();
SbTime timevalue;
if (sensormanager->isTimerSensorPending(timevalue)) {
SbTime interval = timevalue - SbTime::getTimeOfDay();
if (interval.getValue() < 0.0) interval.setValue(0.0);
if (SoWinP::timerSensorId != 0) Win32::KillTimer(NULL, SoWinP::timerSensorId);
SoWinP::timerSensorId =
Win32::SetTimer(NULL,
/* ignored because of NULL first argument: */ 0,
interval.getMsecValue(),
(TIMERPROC)SoWinP::timerSensorCB);
}
else if (SoWinP::timerSensorId != 0) {
Win32::KillTimer(NULL, SoWinP::timerSensorId);
SoWinP::timerSensorId = 0;
}
if (sensormanager->isDelaySensorPending()) {
if (SoWinP::idleSensorId == 0) {
SoWinP::idleSensorId =
Win32::SetTimer(NULL,
/* ignored because of NULL first argument: */ 0,
// FIXME: this seems like a rather bogus way
// of setting up a timer to check when the
// system goes idle. Should investigate how
// this actually works, and perhaps if there
// is some other mechanism we could
// use. 20040721 mortene.
0,
(TIMERPROC)SoWinP::idleSensorCB);
}
if (SoWinP::delaySensorId == 0) {
unsigned long timeout = SoDB::getDelaySensorTimeout().getMsecValue();
SoWinP::delaySensorId =
Win32::SetTimer(NULL,
/* ignored because of NULL first argument: */ 0,
timeout,
(TIMERPROC)SoWinP::delaySensorCB);
}
}
else {
if (SoWinP::idleSensorId != 0) {
Win32::KillTimer(NULL, SoWinP::idleSensorId);
SoWinP::idleSensorId = 0;
}
if (SoWinP::delaySensorId != 0) {
Win32::KillTimer(NULL, SoWinP::delaySensorId);
SoWinP::delaySensorId = 0;
}
}
}