Panda3D
 All Classes Functions Variables Enumerations
textureReloadRequest.h
00001 // Filename: textureReloadRequest.h
00002 // Created by:  drose (12Aug08)
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 #ifndef TEXTURERELOADREQUEST
00016 #define TEXTURERELOADREQUEST
00017 
00018 #include "pandabase.h"
00019 
00020 #include "asyncTask.h"
00021 #include "texture.h"
00022 #include "preparedGraphicsObjects.h"
00023 #include "pointerTo.h"
00024 #include "pmutex.h"
00025 
00026 ////////////////////////////////////////////////////////////////////
00027 //       Class : TextureReloadRequest
00028 // Description : This loader request will call
00029 //               Texture::get_ram_image() in a sub-thread, to force
00030 //               the texture's image to be re-read from disk.  It is
00031 //               used by GraphicsStateGuardian::async_reload_texture(),
00032 //               when get_incomplete_render() is true.
00033 ////////////////////////////////////////////////////////////////////
00034 class EXPCL_PANDA_GOBJ TextureReloadRequest : public AsyncTask {
00035 public:
00036   ALLOC_DELETED_CHAIN(TextureReloadRequest);
00037 
00038 PUBLISHED:
00039   INLINE TextureReloadRequest(const string &name,
00040                               PreparedGraphicsObjects *pgo, Texture *texture,
00041                               bool allow_compressed);
00042   
00043   INLINE PreparedGraphicsObjects *get_prepared_graphics_objects() const;
00044   INLINE Texture *get_texture() const;
00045   INLINE bool get_allow_compressed() const;
00046   INLINE bool is_ready() const;
00047   
00048 protected:
00049   virtual DoneStatus do_task();
00050   
00051 private:
00052   PT(PreparedGraphicsObjects) _pgo;
00053   PT(Texture) _texture;
00054   bool _allow_compressed;
00055   bool _is_ready;
00056   
00057 public:
00058   static TypeHandle get_class_type() {
00059     return _type_handle;
00060   }
00061   static void init_type() {
00062     AsyncTask::init_type();
00063     register_type(_type_handle, "TextureReloadRequest",
00064                   AsyncTask::get_class_type());
00065     }
00066   virtual TypeHandle get_type() const {
00067     return get_class_type();
00068   }
00069   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00070   
00071 private:
00072   static TypeHandle _type_handle;
00073 };
00074 
00075 #include "textureReloadRequest.I"
00076 
00077 #endif
 All Classes Functions Variables Enumerations