dsrc isn't necessary for this repo
[client-tools.git] / src / external / 3rd / application / UiBuilder / UIDirect3DPrimaryCanvas.h
blob54ff031783699092e2578136f65b3cdb4e49149d
1 #ifndef __DIRECT3DPRIMARYCANVAS_H__
2 #define __DIRECT3DPRIMARYCANVAS_H__
4 #include "UICanvas.h"
6 #include <d3d.h>
7 #include <list>
8 #include <set>
10 class UIDirect3DTextureCanvas;
11 typedef std::set<UIDirect3DTextureCanvas *> UIDirect3DTextureCanvasSet;
13 class UIDirect3DPrimaryCanvas : public UICanvas
15 public:
16 typedef std::list<UIQuad> UIQuadList;
18 UIDirect3DPrimaryCanvas( const UISize &, HWND, bool );
19 virtual ~UIDirect3DPrimaryCanvas();
21 virtual bool IsA( const UITypeID ) const;
22 virtual UIBaseObject *Clone( void ) const;
24 virtual void Attach( UIBaseObject * );
25 virtual void Detach( UIBaseObject * = 0 );
27 virtual void SetSize( const UISize & );
29 virtual bool Prepare( void ) const;
30 virtual bool Generate( void );
32 virtual void BltFrom( const UICanvas * const src, const UIPoint &Source, const UIPoint &Destination, const UISize &Size );
33 virtual void BltFromNoScaleOrRotate( const UICanvas * const src, const UIPoint &Source, const UIPoint &Destination, const UISize &Size );
34 virtual void RenderLines (const UICanvas * const src, int numLines, const UILine * lines, const UILine * uvs);
35 virtual void RenderLines(const UICanvas * const , int numLines, const UILine * lines, const UIFloatPoint * uvs, const UIColor * colors );
36 virtual void ClearTo (const UIColor &c, const UIRect & rc);
37 void RenderTriangles (const UICanvas * const src, int numTris, const UITriangle * tris, const UITriangle * uvs);
39 // virtual void ClearTo( const UIColor &, const UIRect &);
41 virtual void EnableFiltering( bool );
43 virtual bool BeginRendering( void );
44 virtual void EndRendering( void );
46 virtual void Flip( void );
47 void ShowTriangles ( bool );
48 void ShowShaders ( bool );
49 bool GetShowShaders () const;
50 virtual long GetTriangleCount( void ) const;
52 virtual HWND GetWindow( void );
54 virtual void GetPreferedPixelFormat( LPDDPIXELFORMAT );
55 virtual bool MatchPixelFormat( LPDDPIXELFORMAT In, LPDDPIXELFORMAT Out );
57 LPDIRECT3DDEVICE7 getDevice () { return mRenderDevice; }
59 private:
62 UIDirect3DPrimaryCanvas & operator= (const UIDirect3DPrimaryCanvas &);
63 UIDirect3DPrimaryCanvas (const UIDirect3DPrimaryCanvas &);
65 virtual void RenderQuad( const UICanvas * const src, const UIFloatPoint Vertices[4], const UIFloatPoint UVs[4] );
66 virtual void RenderQuad( const UICanvas * const src, const UIFloatPoint Vertices[4], const UIFloatPoint UVs[4], const UIColor Colors[4] );
69 virtual void DestroyAll( void );
71 virtual HRESULT D3DEnumPixelFormats( LPDDPIXELFORMAT );
72 static HRESULT CALLBACK D3DEnumPixelFormatsStaticCallback( LPDDPIXELFORMAT, LPVOID );
74 virtual HRESULT D3DEnumPixelFormatsForBestMatch( LPDDPIXELFORMAT );
75 static HRESULT CALLBACK D3DEnumPixelFormatsForBestMatchStaticCallback( LPDDPIXELFORMAT, LPVOID );
77 DDPIXELFORMAT mPreferedTexturePixelFormat;
78 LPDIRECTDRAWSURFACE7 mPrimarySurface;
79 LPDIRECTDRAWSURFACE7 mBackBufferSurface;
80 LPDIRECTDRAWSURFACE7 mCurrentTexture;
81 LPDIRECT3DDEVICE7 mRenderDevice;
82 LPDIRECTDRAWCLIPPER mClipper;
83 HWND mWindow;
84 bool mIsFullscreen;
85 UIDirect3DTextureCanvasSet mAttachedTextures;
87 long mTriangleCount;
88 bool mShowTriangles;
89 bool mShowShaders;
90 UIQuadList mQuads;
91 UIQuadList mShaderQuads;
93 bool mBestMatchFound;
94 DDPIXELFORMAT mFormatToMatch;
95 DDPIXELFORMAT mBestMatchPixelFormat;
99 #endif // __DIRECT3DPRIMARYCANVAS_H__