StreamTexture.hpp
Go to the documentation of this file.
1 #pragma once
2 
4 #include <unordered_map>
5 
6 namespace iv
7 {
8 
14 {
15 public:
18 
20  void each_resource( std::function< void( ResourcePath const & ) > const & ) const;
21  bool has_resource( ResourcePath const & ) const;
22 
23  // used by StreamTexture
24  Texture::Metadata const & get( ResourcePath const & path ) const;
25 
26 private:
27  //----------------------------- StreamMetadata ----------------
28  virtual void Resource( std::string const & resource_class, ResourcePath path ) override;
29 
30 private:
31  std::unordered_map< ResourcePath, Texture::Metadata > _textures;
32  Texture::Metadata _empty;
33 };
34 
37 class StreamTexture : public Texture, private StreamResource, protected GlListener, protected DelayedLoad
38 {
39 public:
40 using Texture::instance;
45  StreamTexture( Instance * inst, StreamResourceProvider const * provider, StreamTexture_Subprovider const * subprovider, ResourcePath const & path );
46  virtual ~StreamTexture();
47 
48 protected:
49  //------------------------------------- GlListener ---------------------
50  virtual void GlEnable() override;
51  virtual void GlDisable() override;
52  virtual void GlDrop() override;
53 
54  //------------------------------------- DelayedLoad ---------------------
55  virtual void Load() override;
56 
59 };
60 
61 }