2 Copyright (C) 2003 Rice1964
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.
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.
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.
20 #ifndef _DEVICE_BUILDER_H
21 #define _DEVICE_BUILDER_H
26 #include "GraphicsContext.h"
27 #include "TextureManager.h"
29 //========================================================================
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;
40 void DeleteGraphicsContext(void);
41 void DeleteRender(void);
42 void DeleteColorCombiner(void);
43 void DeleteAlphaBlender(void);
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;
53 virtual ~CDeviceBuilder();
55 static CDeviceBuilder* CreateBuilder(SupportedDeviceType type);
56 static SupportedDeviceType m_deviceType;
57 static CDeviceBuilder* m_pInstance;
60 CGraphicsContext* m_pGraphicsContext;
61 CColorCombiner* m_pColorCombiner;
62 CBlender* m_pAlphaBlender;
65 class OGLDeviceBuilder : public CDeviceBuilder
67 friend class CDeviceBuilder;
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);
76 OGLDeviceBuilder() {};
77 virtual ~OGLDeviceBuilder() {};