My Project
TextureComposer.h
1 #pragma once
2 #include "RenderTarget.h"
3 #include "TextureEntity.h"
4 namespace ParaEngine
5 {
9  {
10  public:
11  virtual ~TextureComposeTask(){};
12  virtual bool IsAssetAllLoaded() { return false; };
13  /* in most cases, we will unload all used textures here. */
14  virtual void OnTaskCompleted() {};
15  virtual void DoPaint(CPaintDevice* pd) {};
16  virtual TextureEntity* GetTexture();
20  bool UpdateToStaticTexture(CRenderTarget* pRenderTarget, Color colorKey = 0);
21 
22  const std::string& GetName() const { return m_name; }
23  void SetName(const std::string& val) { m_name = val; }
24 
25  bool IsDirty() const { return m_dirty; }
26  void SetDirty(bool val) { m_dirty = val; }
27 
28 
29  protected:
30  TextureComposeTask() :m_dirty(true){};
31 
32  protected:
33  bool m_dirty;
34  std::string m_name;
35  ref_ptr<TextureEntity> m_composedTexture;
36  };
37 
40  {
41  public:
43  virtual ~TextureComposeRenderTarget();
44 
45  ATTRIBUTE_DEFINE_CLASS(TextureComposeRenderTarget);
46  ATTRIBUTE_SUPPORT_CREATE_FACTORY(TextureComposeRenderTarget);
47  public:
48  void AddTask(TextureComposeTask* pTask);
49 
51  virtual HRESULT Draw(SceneState * sceneState);
52  virtual bool IsAssetAllLoaded();
53 
55  bool IsFlipY() const { return m_bFlipY; }
56  void SetFlipY(bool val) { m_bFlipY = val; }
57 
58  /*
59  * @param colorKey: transparent color key. if 0, it means no color key.
60  */
61  void SetColorKey(const Color& val) { m_colorKey = val; }
62  Color GetColorKey() const { return m_colorKey; }
63 
64  protected:
65  Color m_colorKey;
66  bool m_bFlipY;
67 
69  std::map < std::string, ref_ptr<TextureComposeTask> > m_all_layers;
70  std::map < std::string, ref_ptr<TextureComposeTask> > m_dirty_layers;
72  std::vector < ref_ptr<TextureComposeTask> > m_pending_layers;
73  std::vector < ref_ptr<TextureComposeTask> > m_completed_layers;
74  };
75 }
Which DXT Compression to Use? Obviously, there are some trade-offs between the different formats whic...
Definition: TextureEntity.h:29
It&#39;s used as parameter to Draw method of each scene object.
Definition: SceneState.h:284
a render target scene object.
Definition: RenderTarget.h:16
different physics engine has different winding order.
Definition: EventBinding.h:32
std::map< std::string, ref_ptr< TextureComposeTask > > m_all_layers
all layers
Definition: TextureComposer.h:69
Definition: PERef.h:11
The ref_ptr class template stores a pointer to a dynamically allocated (AssetEntity|CRefCounted|BaseA...
Definition: PERefPtr.h:13
std::vector< ref_ptr< TextureComposeTask > > m_pending_layers
pending to be composed layers.
Definition: TextureComposer.h:72
bool UpdateToStaticTexture(CRenderTarget *pRenderTarget, Color colorKey=0)
Definition: TextureComposer.cpp:92
a special render target for composing the multilayer character skin or facial texture.
Definition: TextureComposer.h:39
bool IsFlipY() const
if we use opengl render target directly, we need to flipY during rendering.
Definition: TextureComposer.h:55
base class for a surface to paint to.
Definition: PaintDevice.h:10
Definition: ParaColor.h:275
base class for texture composer using using a render target.
Definition: TextureComposer.h:8