Panda3D
|
00001 // Filename: modelLoadRequest.cxx 00002 // Created by: drose (29Aug06) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #include "modelLoadRequest.h" 00016 #include "loader.h" 00017 #include "config_pgraph.h" 00018 00019 TypeHandle ModelLoadRequest::_type_handle; 00020 00021 //////////////////////////////////////////////////////////////////// 00022 // Function: ModelLoadRequest::Constructor 00023 // Access: Published 00024 // Description: Create a new ModelLoadRequest, and add it to the loader 00025 // via load_async(), to begin an asynchronous load. 00026 //////////////////////////////////////////////////////////////////// 00027 ModelLoadRequest:: 00028 ModelLoadRequest(const string &name, 00029 const Filename &filename, const LoaderOptions &options, 00030 Loader *loader) : 00031 AsyncTask(name), 00032 _filename(filename), 00033 _options(options), 00034 _loader(loader), 00035 _is_ready(false) 00036 { 00037 } 00038 00039 //////////////////////////////////////////////////////////////////// 00040 // Function: ModelLoadRequest::do_task 00041 // Access: Protected, Virtual 00042 // Description: Performs the task: that is, loads the one model. 00043 //////////////////////////////////////////////////////////////////// 00044 AsyncTask::DoneStatus ModelLoadRequest:: 00045 do_task() { 00046 double delay = async_load_delay; 00047 if (delay != 0.0) { 00048 Thread::sleep(delay); 00049 } 00050 00051 _model = _loader->load_sync(_filename, _options); 00052 _is_ready = true; 00053 00054 // Don't continue the task; we're done. 00055 return DS_done; 00056 }