Imported Upstream version 2.81
[platform/upstream/libbullet.git] / Extras / CDTestFramework / AntTweakBar / src / TwDirect3D10.h
1 //  ---------------------------------------------------------------------------\r
2 //\r
3 //  @file       TwDirect3D10.h\r
4 //  @brief      Direct3D10 graph functions\r
5 //  @author     Philippe Decaudin - http://www.antisphere.com\r
6 //  @license    This file is part of the AntTweakBar library.\r
7 //              For conditions of distribution and use, see License.txt\r
8 //\r
9 //  note:       Private header\r
10 //\r
11 //  ---------------------------------------------------------------------------\r
12 \r
13 \r
14 #if !defined ANT_TW_DIRECT3D10_INCLUDED\r
15 #define ANT_TW_DIRECT3D10_INCLUDED\r
16 \r
17 #include "TwGraph.h"\r
18 \r
19 //  ---------------------------------------------------------------------------\r
20 \r
21 class CTwGraphDirect3D10 : public ITwGraph\r
22 {\r
23 public:\r
24     virtual int                 Init();\r
25     virtual int                 Shut();\r
26     virtual void                BeginDraw(int _WndWidth, int _WndHeight);\r
27     virtual void                EndDraw();\r
28     virtual bool                IsDrawing();\r
29     virtual void                Restore();\r
30     virtual void                DrawLine(int _X0, int _Y0, int _X1, int _Y1, color32 _Color0, color32 _Color1, bool _AntiAliased=false);\r
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); }\r
32     virtual void                DrawRect(int _X0, int _Y0, int _X1, int _Y1, color32 _Color00, color32 _Color10, color32 _Color01, color32 _Color11);\r
33     virtual void                DrawRect(int _X0, int _Y0, int _X1, int _Y1, color32 _Color) { DrawRect(_X0, _Y0, _X1, _Y1, _Color, _Color, _Color, _Color); }\r
34     virtual void                DrawTriangles(int _NumTriangles, int *_Vertices, color32 *_Colors, Cull _CullMode);\r
35 \r
36     virtual void *              NewTextObj();\r
37     virtual void                DeleteTextObj(void *_TextObj);\r
38     virtual void                BuildText(void *_TextObj, const std::string *_TextLines, color32 *_LineColors, color32 *_LineBgColors, int _NbLines, const CTexFont *_Font, int _Sep, int _BgWidth);\r
39     virtual void                DrawText(void *_TextObj, int _X, int _Y, color32 _Color, color32 _BgColor);\r
40 \r
41     virtual void                ChangeViewport(int _X0, int _Y0, int _Width, int _Height, int _OffsetX, int _OffsetY);\r
42     virtual void                RestoreViewport();\r
43     virtual void                SetScissor(int _X0, int _Y0, int _Width, int _Height);\r
44 \r
45 protected:\r
46     struct ID3D10Device *       m_D3DDev;\r
47     unsigned int                m_D3DDevInitialRefCount;\r
48     bool                        m_Drawing;\r
49     const CTexFont *            m_FontTex;\r
50     struct ID3D10ShaderResourceView *m_FontD3DTexRV;\r
51     int                         m_WndWidth;\r
52     int                         m_WndHeight;\r
53     int                         m_OffsetX;\r
54     int                         m_OffsetY;\r
55     void *                      m_ViewportInit;\r
56     RECT                        m_ViewportAndScissorRects[2];\r
57 \r
58     struct CLineRectVtx\r
59     {\r
60         float                   m_Pos[3];\r
61         color32                 m_Color;\r
62     };\r
63     struct CTextVtx\r
64     {\r
65         float                   m_Pos[3];\r
66         color32                 m_Color;\r
67         float                   m_UV[2];\r
68     };\r
69 \r
70     struct CTextObj\r
71     {\r
72         struct ID3D10Buffer *   m_TextVertexBuffer;\r
73         struct ID3D10Buffer *   m_BgVertexBuffer;\r
74         int                     m_NbTextVerts;\r
75         int                     m_NbBgVerts;\r
76         int                     m_TextVertexBufferSize;\r
77         int                     m_BgVertexBufferSize;\r
78         bool                    m_LineColors;\r
79         bool                    m_LineBgColors;\r
80     };\r
81 \r
82     struct CState10 *               m_State;\r
83     struct ID3D10DepthStencilState *m_DepthStencilState;\r
84     struct ID3D10BlendState *       m_BlendState;\r
85     struct ID3D10RasterizerState *  m_RasterState;\r
86     struct ID3D10RasterizerState *  m_RasterStateAntialiased;\r
87     struct ID3D10RasterizerState *  m_RasterStateCullCW;\r
88     struct ID3D10RasterizerState *  m_RasterStateCullCCW;\r
89     struct ID3D10Effect *           m_Effect;\r
90     struct ID3D10EffectTechnique*   m_LineRectTech;\r
91     struct ID3D10EffectTechnique*   m_LineRectCstColorTech;\r
92     struct ID3D10InputLayout *      m_LineRectVertexLayout;\r
93     struct ID3D10Buffer *           m_LineVertexBuffer;\r
94     struct ID3D10Buffer *           m_RectVertexBuffer;\r
95     struct ID3D10Buffer *           m_TrianglesVertexBuffer;\r
96     int                             m_TrianglesVertexBufferCount;\r
97     struct ID3D10EffectTechnique*   m_TextTech;\r
98     struct ID3D10EffectTechnique*   m_TextCstColorTech;\r
99     struct ID3D10InputLayout *      m_TextVertexLayout;\r
100     struct ID3D10EffectShaderResourceVariable *m_FontD3DResVar;\r
101     struct ID3D10EffectVectorVariable *m_OffsetVar;\r
102     struct ID3D10EffectVectorVariable *m_CstColorVar;\r
103 };\r
104 \r
105 //  ---------------------------------------------------------------------------\r
106 \r
107 \r
108 #endif // !defined ANT_TW_DIRECT3D10_INCLUDED\r