Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

SDLRenderTools.h

Go to the documentation of this file.
00001 #ifndef __SDLRENDERTOOLS_H
00002 #define __SDLRENDERTOOLS_H
00003 
00004 
00005 #include "RAS_IRenderTools.h"
00006 
00007 
00008 class SDLRenderTools : public RAS_IRenderTools
00009 {
00010   public:
00011     SDLRenderTools() {}
00012     virtual ~SDLRenderTools() {}
00013     virtual void EndFrame(RAS_IRasterizer* rasty) {}
00014     virtual void BeginFrame(RAS_IRasterizer* rasty)

00015     {
00016       m_modified=true;
00017       DisableOpenGLLights();
00018     }
00019     void DisableOpenGLLights()

00020     {
00021       glDisable(GL_LIGHTING);
00022       glDisable(GL_COLOR_MATERIAL);
00023       glDisableClientState(GL_NORMAL_ARRAY);
00024     }
00025     void EnableOpenGLLights()

00026     {
00027       glEnable(GL_LIGHTING);
00028       glColorMaterial(GL_FRONT_AND_BACK,GL_DIFFUSE);
00029       glEnable(GL_COLOR_MATERIAL);
00030       glEnableClientState(GL_NORMAL_ARRAY);
00031     }
00032     int ProcessLighting(int layer)

00033     {
00034       return false;
00035     }
00036     void Perspective(int a,int width,int height,float mat[4][4] ,float viewmat[4][4])

00037     {
00038       if(a== 0)
00039       {
00040         glMatrixMode(GL_PROJECTION);
00041         //getmatrix(mat);//curarea->winmat);
00042         glMatrixMode(GL_MODELVIEW);
00043         //ortho2(-0.5, (float)(width)-.05, -0.5, (float)(height)-0.5);
00044         glLoadIdentity();
00045       }
00046       else
00047         if(a== 1)
00048         {
00049           glMatrixMode(GL_PROJECTION);
00050           //loadmatrix(mat);//curarea->winmat);
00051           glMatrixMode(GL_MODELVIEW);
00052           //loadmatrix(viewmat);//G.vd->viewmat);
00053         }
00054     }
00055     virtual void RenderText2D(const char* text,int xco,int yco)

00056     {
00057       CCString tmpstr(text);
00058       //BL_print_gamedebug_line(tmpstr.Ptr(),xco,yco);
00059       int lines;
00060       char* s = tmpstr.Ptr();
00061       char* p;
00062 
00063       glDisable(GL_DEPTH_TEST);
00064       glDisable(GL_FOG);
00065       glMatrixMode(GL_PROJECTION);
00066       glPushMatrix();
00067       glLoadIdentity();
00068 #if 0
00069       glOrtho(0, glutGet((GLenum)GLUT_WINDOW_WIDTH),
00070           0, glutGet((GLenum)GLUT_WINDOW_HEIGHT), -1, 1);
00071 #endif
00072       glOrtho(0, 100 /* temp */,
00073           0, 100 /* temp */, -1, 1);
00074       glMatrixMode(GL_MODELVIEW);
00075       glPushMatrix();
00076       glLoadIdentity();
00077       glColor3ub(255, 255, 255);
00078       glRasterPos2i(xco, yco);
00079       for(p = s, lines = 0; *p; p++)
00080       {
00081         if (*p == '\n')
00082         {
00083           lines++;
00084           glRasterPos2i(xco, yco-(lines*18));
00085         }
00086 #if 0
00087         glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, *p);
00088 #endif
00089       }
00090       glMatrixMode(GL_PROJECTION);
00091       glPopMatrix();
00092       glMatrixMode(GL_MODELVIEW);
00093       glPopMatrix();
00094       glEnable(GL_FOG);
00095       glEnable(GL_DEPTH_TEST);
00096 
00097     }
00098     virtual void RenderText(int mode,RAS_IPolyMaterial* polymat,float v1[3],float v2[3],float v3[3],float v4[3])

00099     {
00100       //CCString mytext = ((KX_GameObject*)m_clientobject)->GetPropertyText("Text");
00101       //KX_BlenderPolyMaterial* blenderpoly = (KX_BlenderPolyMaterial*)polymat;
00102       //struct TFace* tface = blenderpoly->GetTFace();
00103 //              BL_RenderText( mode,mytext,mytext.Length(),tface,v1,v2,v3,v4);
00104     }
00105     void Render(RAS_IRasterizer* rasty,double* oglmatrix,int objectdrawmode)

00106     {
00107       glPopMatrix();
00108       glPushMatrix();
00109       glMultMatrixd(oglmatrix);
00110     }
00111     void applyTransform(RAS_IRasterizer* rasty,double* oglmatrix,int objectdrawmode )

00112     {
00113       glPopMatrix();
00114       glPushMatrix();
00115       glMultMatrixd(oglmatrix);
00116     }
00117 
00118 };
00119 
00120 
00121 #endif  // __SDLRENDERTOOLS_H

Generated at Thu Feb 1 13:03:11 2001 for Ketsji Game Engine by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000