textureReloadRequest.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. // Filename: textureReloadRequest.h
  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. #ifndef TEXTURERELOADREQUEST
  15. #define TEXTURERELOADREQUEST
  16. #include "pandabase.h"
  17. #include "asyncTask.h"
  18. #include "texture.h"
  19. #include "preparedGraphicsObjects.h"
  20. #include "pointerTo.h"
  21. #include "pmutex.h"
  22. ////////////////////////////////////////////////////////////////////
  23. // Class : TextureReloadRequest
  24. // Description : This loader request will call
  25. // Texture::get_ram_image() in a sub-thread, to force
  26. // the texture's image to be re-read from disk. It is
  27. // used by GraphicsStateGuardian::async_reload_texture(),
  28. // when get_incomplete_render() is true.
  29. ////////////////////////////////////////////////////////////////////
  30. class EXPCL_PANDA_GOBJ TextureReloadRequest : public AsyncTask {
  31. public:
  32. ALLOC_DELETED_CHAIN(TextureReloadRequest);
  33. PUBLISHED:
  34. INLINE TextureReloadRequest(const string &name,
  35. PreparedGraphicsObjects *pgo, Texture *texture,
  36. bool allow_compressed);
  37. INLINE PreparedGraphicsObjects *get_prepared_graphics_objects() const;
  38. INLINE Texture *get_texture() const;
  39. INLINE bool get_allow_compressed() const;
  40. INLINE bool is_ready() const;
  41. protected:
  42. virtual DoneStatus do_task();
  43. private:
  44. PT(PreparedGraphicsObjects) _pgo;
  45. PT(Texture) _texture;
  46. bool _allow_compressed;
  47. bool _is_ready;
  48. public:
  49. static TypeHandle get_class_type() {
  50. return _type_handle;
  51. }
  52. static void init_type() {
  53. AsyncTask::init_type();
  54. register_type(_type_handle, "TextureReloadRequest",
  55. AsyncTask::get_class_type());
  56. }
  57. virtual TypeHandle get_type() const {
  58. return get_class_type();
  59. }
  60. virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
  61. private:
  62. static TypeHandle _type_handle;
  63. };
  64. #include "textureReloadRequest.I"
  65. #endif