Oxygine  1
2g game engine
NativeTexture.h
1 #pragma once
2 #include "oxygine-include.h"
3 #include "closure/closure.h"
4 #include "core/Restorable.h"
5 #include "ox_debug.h"
6 #include "Texture.h"
7 
8 namespace oxygine
9 {
10  class NativeTexture: public Texture, public Restorable
11  {
12  public:
13  NativeTexture() {}
14  virtual void init(nativeTextureHandle, int w, int h, TextureFormat tf) = 0;
15  virtual void init(int w, int h, TextureFormat tf, bool renderTarget = false) = 0;
16  virtual void init(const ImageData& src, bool sysMemCopy = false) = 0;
17  //virtual void release() = 0;
18 
19  virtual ImageData lock(lock_flags, const Rect* src) = 0;
20  virtual void unlock() = 0;
21  virtual void swap(NativeTexture*) = 0;
22 
24  virtual void setLinearFilter(bool enable) = 0;
26  virtual void setClamp2Edge(bool clamp2edge) = 0;
27  virtual void updateRegion(int x, int y, const ImageData& data) = 0;
28  virtual void apply(const Rect* rect = 0) = 0;
29 
31  virtual nativeTextureHandle getHandle() const = 0;
32 
33  //debug
34  static void dumpCreatedTextures();
35  static std::vector<spNativeTexture> getCreatedTextures();
37  static volatile int created;
38  };
39 
41  {
42  public:
43  void init(nativeTextureHandle, int w, int h, TextureFormat tf);
44  void init(int w, int h, TextureFormat tf, bool renderTarget = false);
45  void init(const ImageData& src, bool sysMemCopy);
46  void release();
47 
48  ImageData lock(lock_flags, const Rect* src);
49  void unlock();
50  void swap(NativeTexture*);
51 
52  void setClamp2Edge(bool clamp2edge);
53  void setLinearFilter(bool enable);
54  void updateRegion(int x, int y, const ImageData& data);
55  void apply(const Rect* rect = 0);
56 
58  nativeTextureHandle getHandle() const;
59  int getWidth() const;
60  int getHeight() const;
61  TextureFormat getFormat() const;
62 
63  void* _getRestorableObject() { return 0; }
64  };
65 }
virtual void setLinearFilter(bool enable)=0
virtual void setClamp2Edge(bool clamp2edge)=0
virtual nativeTextureHandle getHandle() const =0
Definition: Texture.h:24
Definition: ImageData.h:54
void setLinearFilter(bool enable)
nativeTextureHandle getHandle() const
–oxgl-end–!
Definition: Actor.h:14
Definition: NativeTexture.h:40
Definition: Restorable.h:8
void setClamp2Edge(bool clamp2edge)
static volatile int created
Definition: NativeTexture.h:37
Definition: NativeTexture.h:10