00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef LAMP_GRAPHICS_H_
00026 #define LAMP_GRAPHICS_H_
00027
00028 #include <Core/Container/ArrayList.h>
00029 #include <Core/Container/HashMap.h>
00030 #include <Graphics/Scene/Scene.h>
00031
00032 namespace Lamp{
00033
00034 class GraphicsDeviceEnumeration;
00035 class GraphicsDeviceSelector;
00036 class GraphicsDeviceSettings;
00037 class GraphicsDevice;
00038 class GraphicsDeviceCapacity;
00039 class RenderingDevice;
00040 class ShaderManager;
00041 class GraphicsDeviceObjectHolder;
00042 class Scene;
00043
00044
00045
00046
00047
00048 class LampGraphics{
00049 friend class LampCore;
00050 friend class GraphicsDevice;
00051 public:
00052
00053
00054
00055 static void initialize();
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066 static bool initializeDevice(HWND windowHandle, bool startFullscreen);
00067
00068
00069
00070
00071 static void finalize();
00072
00073
00074
00075
00076
00077
00078
00079
00080 static void setDeviceSelector(GraphicsDeviceSelector* selector);
00081
00082
00083
00084
00085
00086 static GraphicsDeviceSelector* getDeviceSelector(){ return selector_; }
00087
00088
00089
00090
00091
00092
00093 static HWND getWindowHandle(){ return windowHandle_; }
00094
00095
00096
00097
00098
00099 static Direct3D* getDirect3D(){ return direct3D_; }
00100
00101
00102
00103
00104
00105 static Direct3DDevice* getDirect3DDevice(){ return direct3DDevice_; }
00106
00107
00108
00109
00110
00111
00112
00113
00114 static void addDeviceObjectHolder(GraphicsDeviceObjectHolder* objectHolder){
00115 deviceObjectHolders_.add(objectHolder);
00116 }
00117
00118
00119
00120
00121
00122 static void removeDeviceObjectHolder(
00123 GraphicsDeviceObjectHolder* objectHolder){
00124 deviceObjectHolders_.removeByValue(objectHolder);
00125 }
00126
00127
00128
00129
00130
00131 static int getDeviceObjectHolderCount(){
00132 return deviceObjectHolders_.getCount();
00133 }
00134
00135
00136
00137
00138
00139
00140 static GraphicsDeviceObjectHolder* getDeviceObjectHolder(int index){
00141 return deviceObjectHolders_.get(index);
00142 }
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152 static Scene* createScene(const String& name);
00153
00154
00155
00156
00157
00158 static void destroyScene(Scene* scene);
00159
00160
00161
00162
00163
00164 static int getSceneCount(){ return sceneArray_.getCount(); }
00165
00166
00167
00168
00169
00170
00171 static Scene* getScene(int index){ return sceneArray_.get(index); }
00172
00173
00174
00175
00176
00177
00178 static Scene* search(String name){ return sceneDatabase_.get(name); }
00179
00180
00181 protected:
00182
00183
00184
00185
00186
00187
00188
00189
00190 static LRESULT windowProcedure(
00191 HWND windowHandle, u_int message, WPARAM wParam, LPARAM lParam);
00192
00193
00194
00195
00196
00197 static void deviceReset();
00198
00199
00200
00201
00202
00203 static bool initializeDeviceObjects();
00204
00205
00206
00207
00208 static void deleteDeviceObjects();
00209
00210
00211
00212
00213
00214 static bool restoreDeviceObjects();
00215
00216
00217
00218
00219 static void invalidateDeviceObjects();
00220
00221
00222 private:
00223
00224 LampGraphics();
00225
00226
00227 static HWND windowHandle_;
00228
00229 static GraphicsDeviceEnumeration* enumeration_;
00230
00231 static GraphicsDeviceSelector* selector_;
00232
00233 static GraphicsDeviceSettings* settings_;
00234
00235 static GraphicsDevice* device_;
00236
00237 static Direct3DDevice* direct3DDevice_;
00238
00239 static GraphicsDeviceCapacity* deviceCapacity_;
00240
00241 static RenderingDevice* renderingDevice_;
00242
00243 static ShaderManager* shaderManager_;
00244
00245 static Direct3D* direct3D_;
00246
00247 static ArrayList<GraphicsDeviceObjectHolder*> deviceObjectHolders_;
00248
00249
00250 static ArrayList<Scene*> sceneArray_;
00251
00252 static HashMap<String, Scene*> sceneDatabase_;
00253
00254 static const int scenesCapacity_ = 16;
00255
00256
00257 static bool isInitialized_;
00258
00259 static bool deviceInitialized_;
00260 };
00261
00262
00263 }
00264 #endif // End of LAMP_GRAPHICS_H_
00265
00266