d07c171f |
1 | /* |
2 | Copyright (C) 2003 Rice1964 |
3 | |
4 | This program is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU General Public License |
6 | as published by the Free Software Foundation; either version 2 |
7 | of the License, or (at your option) any later version. |
8 | |
9 | This program is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | GNU General Public License for more details. |
13 | |
14 | You should have received a copy of the GNU General Public License |
15 | along with this program; if not, write to the Free Software |
16 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
17 | |
18 | */ |
19 | |
20 | #ifndef _DEVICE_BUILDER_H |
21 | #define _DEVICE_BUILDER_H |
22 | |
23 | #include "Blender.h" |
24 | #include "Combiner.h" |
25 | #include "Config.h" |
26 | #include "GraphicsContext.h" |
27 | #include "TextureManager.h" |
28 | |
29 | //======================================================================== |
30 | |
31 | class CDeviceBuilder |
32 | { |
33 | public: |
34 | virtual CGraphicsContext * CreateGraphicsContext(void)=0; |
35 | virtual CRender * CreateRender(void)=0; |
36 | virtual CTexture * CreateTexture(uint32 dwWidth, uint32 dwHeight, TextureUsage usage = AS_NORMAL)=0; |
37 | virtual CColorCombiner * CreateColorCombiner(CRender *pRender)=0; |
38 | virtual CBlender * CreateAlphaBlender(CRender *pRender)=0; |
39 | |
40 | void DeleteGraphicsContext(void); |
41 | void DeleteRender(void); |
42 | void DeleteColorCombiner(void); |
43 | void DeleteAlphaBlender(void); |
44 | |
45 | static void DeleteBuilder(void); |
46 | static CDeviceBuilder* GetBuilder(void); |
47 | static void SelectDeviceType(SupportedDeviceType type); |
48 | static SupportedDeviceType GetDeviceType(void); |
49 | static SupportedDeviceType GetGeneralDeviceType(void); |
50 | static SupportedDeviceType m_deviceGeneralType; |
51 | protected: |
52 | CDeviceBuilder(); |
53 | virtual ~CDeviceBuilder(); |
54 | |
55 | static CDeviceBuilder* CreateBuilder(SupportedDeviceType type); |
56 | static SupportedDeviceType m_deviceType; |
57 | static CDeviceBuilder* m_pInstance; |
58 | |
59 | CRender* m_pRender; |
60 | CGraphicsContext* m_pGraphicsContext; |
61 | CColorCombiner* m_pColorCombiner; |
62 | CBlender* m_pAlphaBlender; |
63 | }; |
64 | |
65 | class OGLDeviceBuilder : public CDeviceBuilder |
66 | { |
67 | friend class CDeviceBuilder; |
68 | public: |
69 | CGraphicsContext * CreateGraphicsContext(void); |
70 | CRender * CreateRender(void); |
71 | CTexture * CreateTexture(uint32 dwWidth, uint32 dwHeight, TextureUsage usage = AS_NORMAL); |
72 | CColorCombiner * CreateColorCombiner(CRender *pRender); |
73 | CBlender * CreateAlphaBlender(CRender *pRender); |
74 | |
75 | protected: |
76 | OGLDeviceBuilder() {}; |
77 | virtual ~OGLDeviceBuilder() {}; |
78 | |
79 | }; |
80 | |
81 | #endif |
82 | |
83 | |