00001
00026 #ifndef _CRENDERER_
00027 #define _CRENDERER_
00028
00029 #include "main.h"
00030 #include "GameObject3DManager.h"
00031 #include "GameObject2DManager.h"
00032 #include "Camera.h"
00033
00034 class CRenderer: public CSingleton<CRenderer> {
00035
00036 public:
00037
00038 CRenderer();
00039 CRenderer(int viewportWidth, int viewportHeight);
00040
00041 ~CRenderer();
00042
00043 void setViewport(int width, int height) {
00044 m_viewportWidth = width;
00045 m_viewportHeight = height;
00046 }
00047 ;
00048 void setViewportWidth(int width) {
00049 m_viewportWidth = width;
00050 }
00051 ;
00052 void setViewportHeight(int height) {
00053 m_viewportHeight = height;
00054 }
00055 ;
00056
00057 void setBackgroundColor(Color4f color) {
00058 m_backgroundColor = color;
00059 }
00060 ;
00061 void setBackgroundColor(float red, float green, float blue, float alpha) {
00062 m_backgroundColor.r = red / 255.0f;
00063 m_backgroundColor.b = blue / 255.0f;
00064 m_backgroundColor.g = green / 255.0f;
00065 m_backgroundColor.alpha = alpha / 255.0f;
00066 }
00067 ;
00068
00069 int getViewportWidth() const {
00070 return m_viewportWidth;
00071 }
00072 ;
00073 int getViewportHeight() const {
00074 return m_viewportHeight;
00075 }
00076 ;
00077
00078 void setCamera(CCamera* camera) {
00079 m_pCamera = camera;
00080 }
00081 ;
00082 CCamera* getCamera() const {
00083 return m_pCamera;
00084 }
00085
00086 void setObject3DManager(CGameObject3DManager* object3DManager) {
00087 m_pObject3DManager = object3DManager;
00088 }
00089 ;
00090 void setObject2DManager(CGameObject2DManager* object2DManager) {
00091 m_pObject2DManager = object2DManager;
00092 }
00093 ;
00094
00095 void render(void);
00096
00097
00098 void blendingEnable();
00099 void blendingEnable(GLenum sfactor, GLenum dfactor);
00100 void blendingDisable();
00101 void setBlendingParams(GLenum sfactor, GLenum dfactor);
00102
00103 void disconnect();
00104
00105 private:
00106
00107 void enable2D(void);
00108 void disable2D(void);
00109
00110 static CRenderer* m_instance;
00111
00112 int m_viewportWidth;
00113 int m_viewportHeight;
00114
00115 Color4f m_backgroundColor;
00116
00117 CGameObject3DManager* m_pObject3DManager;
00118 CGameObject2DManager* m_pObject2DManager;
00119 CCamera* m_pCamera;
00120
00121
00122
00123 bool m_blending;
00124 GLenum m_blendingDestinationFactor;
00125 GLenum m_blendingSourceFactor;
00126
00127 };
00128
00129 #endif
00130