Imported Upstream version 2.81
[platform/upstream/libbullet.git] / Extras / CDTestFramework / AntTweakBar / src / TwDirect3D9.h
1 //  ---------------------------------------------------------------------------
2 //
3 //  @file       TwDirect3D9.h
4 //  @brief      Direct3D9 graph functions
5 //  @author     Philippe Decaudin - http://www.antisphere.com
6 //  @license    This file is part of the AntTweakBar library.
7 //              For conditions of distribution and use, see License.txt
8 //
9 //  note:       Private header
10 //
11 //  ---------------------------------------------------------------------------
12
13
14 #if !defined ANT_TW_DIRECT3D9_INCLUDED
15 #define ANT_TW_DIRECT3D9_INCLUDED
16
17 #include "TwGraph.h"
18
19 //  ---------------------------------------------------------------------------
20
21 class CTwGraphDirect3D9 : public ITwGraph
22 {
23 public:
24     virtual int                 Init();
25     virtual int                 Shut();
26     virtual void                BeginDraw(int _WndWidth, int _WndHeight);
27     virtual void                EndDraw();
28     virtual bool                IsDrawing();
29     virtual void                Restore();
30     virtual void                DrawLine(int _X0, int _Y0, int _X1, int _Y1, color32 _Color0, color32 _Color1, bool _AntiAliased=false);
31     virtual void                DrawLine(int _X0, int _Y0, int _X1, int _Y1, color32 _Color, bool _AntiAliased=false) { DrawLine(_X0, _Y0, _X1, _Y1, _Color, _Color, _AntiAliased); }
32     virtual void                DrawRect(int _X0, int _Y0, int _X1, int _Y1, color32 _Color00, color32 _Color10, color32 _Color01, color32 _Color11);
33     virtual void                DrawRect(int _X0, int _Y0, int _X1, int _Y1, color32 _Color) { DrawRect(_X0, _Y0, _X1, _Y1, _Color, _Color, _Color, _Color); }
34     virtual void                DrawTriangles(int _NumTriangles, int *_Vertices, color32 *_Colors, Cull _CullMode);
35
36     virtual void *              NewTextObj();
37     virtual void                DeleteTextObj(void *_TextObj);
38     virtual void                BuildText(void *_TextObj, const std::string *_TextLines, color32 *_LineColors, color32 *_LineBgColors, int _NbLines, const CTexFont *_Font, int _Sep, int _BgWidth);
39     virtual void                DrawText(void *_TextObj, int _X, int _Y, color32 _Color, color32 _BgColor);
40
41     virtual void                ChangeViewport(int _X0, int _Y0, int _Width, int _Height, int _OffsetX, int _OffsetY);
42     virtual void                RestoreViewport();
43     virtual void                SetScissor(int _X0, int _Y0, int _Width, int _Height);
44
45 protected:
46     struct IDirect3DDevice9 *   m_D3DDev;
47     bool                        m_Drawing;
48     const CTexFont *            m_FontTex;
49     struct IDirect3DTexture9 *  m_FontD3DTex;
50     bool                        m_PureDevice;
51     int                         m_WndWidth;
52     int                         m_WndHeight;
53     void *                      m_ViewportInit;
54     int                         m_OffsetX;
55     int                         m_OffsetY;
56
57     struct CTextVtx
58     {
59         float                   m_Pos[4];
60         color32                 m_Color;
61         float                   m_UV[2];
62     };
63     struct CBgVtx
64     {
65         float                   m_Pos[4];
66         color32                 m_Color;
67     };
68
69     struct CTextObj
70     {
71         std::vector<CTextVtx>   m_TextVerts;
72         std::vector<CBgVtx>     m_BgVerts;
73         bool                    m_LineColors;
74         bool                    m_LineBgColors;
75     };
76
77     struct CTriVtx
78     {
79         float m_Pos[4];
80         DWORD m_Color;
81     };
82     std::vector<CTriVtx>        m_TriVertices;
83
84     struct CState *             m_State;
85 };
86
87 //  ---------------------------------------------------------------------------
88
89
90 #endif // !defined ANT_TW_DIRECT3D9_INCLUDED