00001 #ifndef __RAS_OPENGLRASTERIZER
00002 #define __RAS_OPENGLRASTERIZER
00003
00004 #pragma warning (disable:4786)
00005
00006 #include "KX_Matrix4x4.h"
00007 #include <vector>
00008 using namespace std;
00009
00010
00011 #include "RAS_IRasterizer.h"
00012 #include "RAS_MaterialBucket.h"
00013 #include "RAS_ICanvas.h"
00014
00018
00019 class RAS_OpenGLRasterizer : public RAS_IRasterizer
00020 {
00021
00022 RAS_ICanvas* m_2DCanvas;
00023
00024 bool m_fogenabled;
00025 float m_fogstart;
00026 float m_fogdist;
00027 float m_fogr;
00028 float m_fogg;
00029 float m_fogb;
00030
00031 float m_redback;
00032 float m_greenback;
00033 float m_blueback;
00034 float m_alphaback;
00035
00036 bool m_bEXT_compiled_vertex_array;
00037
00038 int m_drawingmode;
00039 CMatrix4x4 m_viewmatrix;
00040 MT_Point3 m_campos;
00041
00042 public:
00043 RAS_OpenGLRasterizer(RAS_ICanvas* canv);
00044 virtual ~RAS_OpenGLRasterizer();
00045 enum {
00046 KX_BOUNDINGBOX = 1,
00047 KX_WIREFRAME,
00048 KX_SOLID,
00049 KX_SHADED,
00050 KX_TEXTURED
00051 };
00052
00053 enum {
00054 KX_DEPTHMASK_ENABLED =1,
00055 KX_DEPTHMASK_DISABLED,
00056 };
00057 virtual void SetDepthMask(int depthmask);
00058
00059 virtual void SetMaterial(const RAS_IPolyMaterial& mat);
00060 virtual bool Init();
00061 virtual void Exit();
00062 virtual bool BeginFrame();
00063 virtual void EndFrame();
00064 virtual void SwapBuffers();
00065 virtual void IndexPrimitives( const vecVertexArray& vertexarrays,
00066 const vecIndexArrays & indexarrays,
00067 int mode,
00068 class RAS_IPolyMaterial* polymat,
00069 class RAS_IRenderTools* rendertools);
00070 virtual void SetProjectionMatrix(CMatrix4x4 & mat);
00071 virtual void SetViewMatrix(CMatrix4x4 & mat,const MT_Vector3& campos);
00072 virtual const MT_Point3& GetCameraPosition();
00073 virtual void LoadViewMatrix();
00074
00075 virtual void SetFog(float start,float dist,float r,float g,float b);
00076 virtual void DisplayFog();
00077 virtual void SetBackColor(float red,float green,float blue,float alpha);
00078
00079 virtual void SetDrawingMode(int drawingmode) { m_drawingmode = drawingmode;};
00080 virtual int GetDrawingMode() { return m_drawingmode;};
00081
00082 virtual void EnableTextures(bool enable);
00083 virtual void SetCullFace(bool enable);
00084
00085 };
00086
00087 #endif //__RAS_OPENGLRASTERIZER