textureReloadRequest.cxx 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // Filename: textureReloadRequest.cxx
  2. // Created by: drose (12Aug08)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. //
  6. // PANDA 3D SOFTWARE
  7. // Copyright (c) Carnegie Mellon University. All rights reserved.
  8. //
  9. // All use of this software is subject to the terms of the revised BSD
  10. // license. You should have received a copy of this license along
  11. // with this source code in a file named "LICENSE."
  12. //
  13. ////////////////////////////////////////////////////////////////////
  14. #include "textureReloadRequest.h"
  15. #include "textureContext.h"
  16. TypeHandle TextureReloadRequest::_type_handle;
  17. ////////////////////////////////////////////////////////////////////
  18. // Function: TextureReloadRequest::do_task
  19. // Access: Protected, Virtual
  20. // Description: Performs the task: that is, loads the one model.
  21. ////////////////////////////////////////////////////////////////////
  22. bool TextureReloadRequest::
  23. do_task() {
  24. // Don't reload the texture if it doesn't need it.
  25. if (_texture->was_image_modified(_pgo)) {
  26. double delay = async_load_delay;
  27. if (delay != 0.0) {
  28. Thread::sleep(delay);
  29. }
  30. if (_texture->was_image_modified(_pgo)) {
  31. if (_allow_compressed) {
  32. _texture->get_ram_image();
  33. } else {
  34. _texture->get_uncompressed_ram_image();
  35. }
  36. }
  37. }
  38. _is_ready = true;
  39. // Don't continue the task; we're done.
  40. return false;
  41. }