add async-load-delay

This commit is contained in:
David Rose 2008-08-22 23:43:05 +00:00
parent 3e12bc0f65
commit 09dc4e3b84
3 changed files with 17 additions and 0 deletions

View File

@ -274,6 +274,16 @@ ConfigVariableBool flatten_geoms
"only the NodePath interfaces; you may still make the lower-level "
"SceneGraphReducer calls directly."));
ConfigVariableDouble async_load_delay
("async-load-delay", 0.0,
PRC_DESC("If this is nonzero, it represents an artificial delay, "
"in seconds, that is imposed on every asynchronous load attempt "
"(within the thread). Its purpose is to help debug errors that "
"may occur when an asynchronous load is delayed. The "
"delay is per-model, and all aync loads will be queued "
"up behind the delay--it is as if the time it takes to read a "
"file is increased by this amount per read."));
ConfigVariableBool polylight_info
("polylight-info", false,
PRC_DESC("Set this true to view some info statements regarding the polylight. "

View File

@ -53,6 +53,7 @@ extern ConfigVariableInt max_collect_indices;
extern ConfigVariableBool premunge_data;
extern ConfigVariableBool preserve_geom_nodes;
extern ConfigVariableBool flatten_geoms;
extern ConfigVariableDouble async_load_delay;
extern ConfigVariableBool polylight_info;
extern ConfigVariableDouble lod_fade_time;

View File

@ -14,6 +14,7 @@
#include "modelLoadRequest.h"
#include "loader.h"
#include "config_pgraph.h"
TypeHandle ModelLoadRequest::_type_handle;
@ -24,6 +25,11 @@ TypeHandle ModelLoadRequest::_type_handle;
////////////////////////////////////////////////////////////////////
bool ModelLoadRequest::
do_task() {
double delay = async_load_delay;
if (delay != 0.0) {
Thread::sleep(delay);
}
Loader *loader;
DCAST_INTO_R(loader, _manager, false);