Panda3D
textureReloadRequest.h
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file textureReloadRequest.h
10  * @author drose
11  * @date 2008-08-12
12  */
13 
14 #ifndef TEXTURERELOADREQUEST
15 #define TEXTURERELOADREQUEST
16 
17 #include "pandabase.h"
18 
19 #include "asyncTask.h"
20 #include "texture.h"
22 #include "pointerTo.h"
23 #include "pmutex.h"
24 
25 /**
26  * This loader request will call Texture::get_ram_image() in a sub-thread, to
27  * force the texture's image to be re-read from disk. It is used by
28  * GraphicsStateGuardian::async_reload_texture(), when get_incomplete_render()
29  * is true.
30  */
31 class EXPCL_PANDA_GOBJ TextureReloadRequest : public AsyncTask {
32 public:
33  ALLOC_DELETED_CHAIN(TextureReloadRequest);
34 
35 PUBLISHED:
36  INLINE explicit TextureReloadRequest(const std::string &name,
38  Texture *texture,
39  bool allow_compressed);
40 
41  INLINE PreparedGraphicsObjects *get_prepared_graphics_objects() const;
42  INLINE Texture *get_texture() const;
43  INLINE bool get_allow_compressed() const;
44  INLINE bool is_ready() const;
45 
46  MAKE_PROPERTY(texture, get_texture);
47 
48 protected:
49  virtual DoneStatus do_task();
50 
51 private:
52  PT(PreparedGraphicsObjects) _pgo;
53  PT(Texture) _texture;
54  bool _allow_compressed;
55 
56 public:
57  static TypeHandle get_class_type() {
58  return _type_handle;
59  }
60  static void init_type() {
61  AsyncTask::init_type();
62  register_type(_type_handle, "TextureReloadRequest",
63  AsyncTask::get_class_type());
64  }
65  virtual TypeHandle get_type() const {
66  return get_class_type();
67  }
68  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
69 
70 private:
71  static TypeHandle _type_handle;
72 };
73 
74 #include "textureReloadRequest.I"
75 
76 #endif
This loader request will call Texture::get_ram_image() in a sub-thread, to force the texture's image ...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Represents a texture object, which is typically a single 2-d image but may also represent a 1-d or 3-...
Definition: texture.h:71
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
Definition: register_type.I:22
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A table of objects that are saved within the graphics context for reference by handle later.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This class represents a concrete task performed by an AsyncManager.
Definition: asyncTask.h:32
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81