[Scummvm-cvs-logs] SF.net SVN: scummvm: [22480] residual/trunk/tinygl

aquadran at users.sourceforge.net aquadran at users.sourceforge.net
Mon May 15 06:48:29 CEST 2006


Revision: 22480
Author:   aquadran
Date:     2006-05-15 06:30:34 -0700 (Mon, 15 May 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=22480&view=rev

Log Message:
-----------
removed not needed code

Modified Paths:
--------------
    residual/trunk/tinygl/README.residual
    residual/trunk/tinygl/gl.h
    residual/trunk/tinygl/image_util.cpp
    residual/trunk/tinygl/texture.cpp
    residual/trunk/tinygl/zbuffer.h
    residual/trunk/tinygl/zfeatures.h
    residual/trunk/tinygl/zgl.h
    residual/trunk/tinygl/zline.cpp
    residual/trunk/tinygl/zline.h
    residual/trunk/tinygl/ztriangle.cpp
Modified: residual/trunk/tinygl/README.residual
===================================================================
--- residual/trunk/tinygl/README.residual	2006-05-15 13:19:30 UTC (rev 22479)
+++ residual/trunk/tinygl/README.residual	2006-05-15 13:30:34 UTC (rev 22480)
@@ -7,3 +7,4 @@
 * Added needed type cast and fixes for proper compile.
 * Added 't/T' prefix to prevent OpenGl names duplication.
 * Added light shading texture mapping mode.
+* Removed not needed code.

Modified: residual/trunk/tinygl/gl.h
===================================================================
--- residual/trunk/tinygl/gl.h	2006-05-15 13:19:30 UTC (rev 22479)
+++ residual/trunk/tinygl/gl.h	2006-05-15 13:30:34 UTC (rev 22480)
@@ -802,26 +802,6 @@
 /* opengl 1.2 polygon offset */
 void tglPolygonOffset(TGLfloat factor, TGLfloat units);
 
-/* not implemented, just added to compile  */
-  /*
-inline void tglPointSize(float) {}
-inline void tglLineWidth(float) {}
-inline void tglDeleteLists(int, int) {}
-inline void tglDepthFunc(int) {}
-inline void tglBlendFunc(int, int) {}
-inline void tglTexEnvf(int, int, int) {}
-inline void tglOrtho(float,float,float,float,float,float){}
-inline void tglVertex2i(int,int) {}
-inline void tglDepthMask(int) {}
-inline void tglFogi(int, int) {}
-inline void tglFogfv(int, const float*) {}
-inline void tglFogf(int, float) {}
-inline void tglRasterPos2f(float, float) {}
-inline void tglPolygonStipple(void*) {}
-inline void tglTexParameterf(int, int, int) {};
-  */
-/* non compatible functions */
-
 void tglDebug(int mode);
 
 void tglInit(void *zbuffer);

Modified: residual/trunk/tinygl/image_util.cpp
===================================================================
--- residual/trunk/tinygl/image_util.cpp	2006-05-15 13:19:30 UTC (rev 22479)
+++ residual/trunk/tinygl/image_util.cpp	2006-05-15 13:30:34 UTC (rev 22480)
@@ -18,22 +18,6 @@
   }
 }
 
-void gl_convertRGB_to_8A8R8G8B(unsigned int *pixmap, unsigned char *rgb,
-                               int xsize, int ysize)
-{
-    int i,n;
-    unsigned char *p;
-    
-    p=rgb;
-    n=xsize*ysize;
-    for(i=0;i<n;i++) {
-        pixmap[i]=(((unsigned int)p[0])<<16) | 
-            (((unsigned int)p[1])<<8) | 
-            (((unsigned int)p[2])); 
-        p+=3;
-    }
-}
-
 /*
  * linear interpolation with xf,yf normalized to 2^16
  */

Modified: residual/trunk/tinygl/texture.cpp
===================================================================
--- residual/trunk/tinygl/texture.cpp	2006-05-15 13:19:30 UTC (rev 22479)
+++ residual/trunk/tinygl/texture.cpp	2006-05-15 13:30:34 UTC (rev 22480)
@@ -158,24 +158,10 @@
   im->xsize=width;
   im->ysize=height;
   if (im->pixmap!=NULL) gl_free(im->pixmap);
-#if TGL_FEATURE_RENDER_BITS == 24 
-  im->pixmap=gl_malloc(width*height*3);
-  if(im->pixmap) {
-      memcpy(im->pixmap,pixels1,width*height*3);
-  }
-#elif TGL_FEATURE_RENDER_BITS == 32
-  im->pixmap=gl_malloc(width*height*4);
-  if(im->pixmap) {
-      gl_convertRGB_to_8A8R8G8B(im->pixmap,pixels1,width,height);
-  }
-#elif TGL_FEATURE_RENDER_BITS == 16
   im->pixmap=gl_malloc(width*height*2);
   if(im->pixmap) {
       gl_convertRGB_to_5R6G5B((unsigned short *)im->pixmap,pixels1,width,height);
   }
-#else
-#error TODO
-#endif
   if (do_free) gl_free(pixels1);
 }
 

Modified: residual/trunk/tinygl/zbuffer.h
===================================================================
--- residual/trunk/tinygl/zbuffer.h	2006-05-15 13:19:30 UTC (rev 22479)
+++ residual/trunk/tinygl/zbuffer.h	2006-05-15 13:30:34 UTC (rev 22480)
@@ -30,18 +30,6 @@
 #define ZB_MODE_RGB24   4  /* 24 bit rgb mode */
 #define ZB_NB_COLORS    225 /* number of colors for 8 bit display */
 
-#if TGL_FEATURE_RENDER_BITS == 15
-
-#define RGB_TO_PIXEL(r,g,b) \
-  ((((r) >> 1) & 0x7c00) | (((g) >> 6) & 0x03e0) | ((b) >> 11))
-typedef unsigned short PIXEL;
-/* bytes per pixel */
-#define PSZB 2 
-/* bits per pixel = (1 << PSZH) */
-#define PSZSH 4 
-
-#elif TGL_FEATURE_RENDER_BITS == 16
-
 /* 16 bit mode */
 #define RGB_TO_PIXEL(r,g,b) \
   (((r) & 0xF800) | (((g) >> 5) & 0x07E0) | ((b) >> 11))
@@ -49,28 +37,6 @@
 #define PSZB 2 
 #define PSZSH 4 
 
-#elif TGL_FEATURE_RENDER_BITS == 24
-
-#define RGB_TO_PIXEL(r,g,b) \
-  ((((r) << 8) & 0xff0000) | ((g) & 0xff00) | ((b) >> 8))
-typedef unsigned char PIXEL;
-#define PSZB 3
-#define PSZSH 5
-
-#elif TGL_FEATURE_RENDER_BITS == 32
-
-#define RGB_TO_PIXEL(r,g,b) \
-  ((((r) << 8) & 0xff0000) | ((g) & 0xff00) | ((b) >> 8))
-typedef unsigned int PIXEL;
-#define PSZB 4
-#define PSZSH 5
-
-#else
-
-#error Incorrect number of bits per pixel
-
-#endif
-
 typedef struct {
     int xsize,ysize;
     int linesize; /* line size, in bytes */

Modified: residual/trunk/tinygl/zfeatures.h
===================================================================
--- residual/trunk/tinygl/zfeatures.h	2006-05-15 13:19:30 UTC (rev 22479)
+++ residual/trunk/tinygl/zfeatures.h	2006-05-15 13:30:34 UTC (rev 22480)
@@ -35,9 +35,6 @@
 #define TGL_FEATURE_32_BITS        1
 
 
-//#define TGL_FEATURE_RENDER_BITS    15
 #define TGL_FEATURE_RENDER_BITS    16
-//#define TGL_FEATURE_RENDER_BITS    24
-//#define TGL_FEATURE_RENDER_BITS    32
 
 #endif /* _tgl_features_h_ */

Modified: residual/trunk/tinygl/zgl.h
===================================================================
--- residual/trunk/tinygl/zgl.h	2006-05-15 13:19:30 UTC (rev 22479)
+++ residual/trunk/tinygl/zgl.h	2006-05-15 13:30:34 UTC (rev 22480)
@@ -313,8 +313,6 @@
 /* image_util.c */
 void gl_convertRGB_to_5R6G5B(unsigned short *pixmap,unsigned char *rgb,
                              int xsize,int ysize);
-void gl_convertRGB_to_8A8R8G8B(unsigned int *pixmap, unsigned char *rgb,
-                               int xsize, int ysize);
 void gl_resizeImage(unsigned char *dest,int xsize_dest,int ysize_dest,
                     unsigned char *src,int xsize_src,int ysize_src);
 void gl_resizeImageNoInterpolate(unsigned char *dest,int xsize_dest,int ysize_dest,

Modified: residual/trunk/tinygl/zline.cpp
===================================================================
--- residual/trunk/tinygl/zline.cpp	2006-05-15 13:19:30 UTC (rev 22479)
+++ residual/trunk/tinygl/zline.cpp	2006-05-15 13:30:34 UTC (rev 22480)
@@ -13,13 +13,7 @@
     pp = (PIXEL *) ((char *) zb->pbuf + zb->linesize * p->y + p->x * PSZB);
     zz = p->z >> ZB_POINT_Z_FRAC_BITS;
     if (ZCMP(zz, *pz)) {
-#if TGL_FEATURE_RENDER_BITS == 24 
-        pp[0]=p->r>>8;
-        pp[1]=p->g>>8;
-        pp[2]=p->b>>8;
-#else
 	*pp = RGB_TO_PIXEL(p->r, p->g, p->b);
-#endif
 	*pz = zz;
     }
 }

Modified: residual/trunk/tinygl/zline.h
===================================================================
--- residual/trunk/tinygl/zline.h	2006-05-15 13:19:30 UTC (rev 22479)
+++ residual/trunk/tinygl/zline.h	2006-05-15 13:30:34 UTC (rev 22480)
@@ -2,7 +2,7 @@
     int n, dx, dy, sx, pp_inc_1, pp_inc_2;
     register int a;
     register PIXEL *pp;
-#if defined(INTERP_RGB) || TGL_FEATURE_RENDER_BITS == 24
+#if defined(INTERP_RGB)
     register unsigned int r, g, b;
 #endif
 #ifdef INTERP_RGB
@@ -33,27 +33,14 @@
     r = p2->r << 8;
     g = p2->g << 8;
     b = p2->b << 8;
-#elif TGL_FEATURE_RENDER_BITS == 24
-    /* for 24 bits, we store the colors in different variables */
-    r = p2->r >> 8;
-    g = p2->g >> 8;
-    b = p2->b >> 8;
 #endif
 
 #ifdef INTERP_RGB
 #define RGB(x) x
-#if TGL_FEATURE_RENDER_BITS == 24
-#define RGBPIXEL pp[0] = r >> 16, pp[1] = g >> 16, pp[2] = b >> 16
-#else
 #define RGBPIXEL *pp = RGB_TO_PIXEL(r >> 8,g >> 8,b >> 8)
-#endif
 #else /* INTERP_RGB */
 #define RGB(x)
-#if TGL_FEATURE_RENDER_BITS == 24
-#define RGBPIXEL pp[0] = r, pp[1] = g, pp[2] = b
-#else
 #define RGBPIXEL *pp = color
-#endif
 #endif /* INTERP_RGB */
 
 #ifdef INTERP_Z

Modified: residual/trunk/tinygl/ztriangle.cpp
===================================================================
--- residual/trunk/tinygl/ztriangle.cpp	2006-05-15 13:19:30 UTC (rev 22479)
+++ residual/trunk/tinygl/ztriangle.cpp	2006-05-15 13:30:34 UTC (rev 22480)
@@ -6,39 +6,12 @@
 void ZB_fillTriangleFlat(ZBuffer *zb,
 			 ZBufferPoint *p0,ZBufferPoint *p1,ZBufferPoint *p2)
 {
-#if TGL_FEATURE_RENDER_BITS == 24
-    unsigned char colorR, colorG, colorB;
-#else
     int color;
-#endif
 
 #define INTERP_Z
 
-#if TGL_FEATURE_RENDER_BITS == 24 
-
 #define DRAW_INIT()				\
 {						\
-  colorR=p2->r>>8; \
-  colorG=p2->g>>8; \
-  colorB=p2->b>>8; \
-}
-
-#define PUT_PIXEL(_a)		\
-{						\
-    zz=z >> ZB_POINT_Z_FRAC_BITS;		\
-    if (ZCMP(zz,pz[_a])) {				\
-      pp[3 * _a]=colorR;\
-      pp[3 * _a + 1]=colorG;\
-      pp[3 * _a + 2]=colorB;\
-      pz[_a]=zz;				\
-    }\
-    z+=dzdx;					\
-}
-
-#else
-
-#define DRAW_INIT()				\
-{						\
   color=RGB_TO_PIXEL(p2->r,p2->g,p2->b);	\
 }
   
@@ -51,7 +24,6 @@
     }						\
     z+=dzdx;					\
 }
-#endif /* TGL_FEATURE_RENDER_BITS == 24 */
 
 #include "ztriangle.h"
 }
@@ -64,40 +36,15 @@
 void ZB_fillTriangleSmooth(ZBuffer *zb,
 			   ZBufferPoint *p0,ZBufferPoint *p1,ZBufferPoint *p2)
 {
-#if TGL_FEATURE_RENDER_BITS == 16
         int _drgbdx;
-#endif
 
 #define INTERP_Z
 #define INTERP_RGB
 
 #define SAR_RND_TO_ZERO(v,n) (v / (1<<n))
 
-#if TGL_FEATURE_RENDER_BITS == 24
-
 #define DRAW_INIT() 				\
 {						\
-}
-
-#define PUT_PIXEL(_a)				\
-{						\
-    zz=z >> ZB_POINT_Z_FRAC_BITS;		\
-    if (ZCMP(zz,pz[_a])) {				\
-      pp[3 * _a]=or1 >> 8;\
-      pp[3 * _a + 1]=og1 >> 8;\
-      pp[3 * _a + 2]=ob1 >> 8;\
-      pz[_a]=zz;				\
-    }\
-    z+=dzdx;					\
-    og1+=dgdx;					\
-    or1+=drdx;					\
-    ob1+=dbdx;					\
-}
-
-#elif TGL_FEATURE_RENDER_BITS == 16
-
-#define DRAW_INIT() 				\
-{						\
   _drgbdx=(SAR_RND_TO_ZERO(drdx,6) << 22) & 0xFFC00000;		\
   _drgbdx|=SAR_RND_TO_ZERO(dgdx,5) & 0x000007FF;		\
   _drgbdx|=(SAR_RND_TO_ZERO(dbdx,7) << 12) & 0x001FF000; 	\
@@ -147,27 +94,6 @@
   }									   \
 }
 
-#else
-
-#define DRAW_INIT() 				\
-{						\
-}
-
-#define PUT_PIXEL(_a)				\
-{						\
-    zz=z >> ZB_POINT_Z_FRAC_BITS;		\
-    if (ZCMP(zz,pz[_a])) {				\
-      pp[_a] = RGB_TO_PIXEL(or1, og1, ob1);\
-      pz[_a]=zz;				\
-    }\
-    z+=dzdx;					\
-    og1+=dgdx;					\
-    or1+=drdx;					\
-    ob1+=dbdx;					\
-}
-
-#endif /* TGL_FEATURE_RENDER_BITS */
-
 #include "ztriangle.h"
 }
 
@@ -189,30 +115,10 @@
   texture=zb->current_texture;			\
 }
 
-#if TGL_FEATURE_RENDER_BITS == 24
-
 #define PUT_PIXEL(_a)				\
 {						\
-   unsigned char *ptr;\
    zz=z >> ZB_POINT_Z_FRAC_BITS;		\
      if (ZCMP(zz,pz[_a])) {				\
-       ptr = texture + (((t & 0x3FC00000) | s) >> 14) * 3; \
-       pp[3 * _a]= ptr[0];\
-       pp[3 * _a + 1]= ptr[1];\
-       pp[3 * _a + 2]= ptr[2];\
-       pz[_a]=zz;				\
-    }						\
-    z+=dzdx;					\
-    s+=dsdx;					\
-    t+=dtdx;					\
-}
-
-#else
-
-#define PUT_PIXEL(_a)				\
-{						\
-   zz=z >> ZB_POINT_Z_FRAC_BITS;		\
-     if (ZCMP(zz,pz[_a])) {				\
        pp[_a]=texture[((t & 0x3FC00000) | s) >> 14];	\
        pz[_a]=zz;				\
     }						\
@@ -221,18 +127,9 @@
     t+=dtdx;					\
 }
 
-#endif
-
 #include "ztriangle.h"
 }
 
-/*
- * Texture mapping with perspective correction.
- * We use the gradient method to make less divisions.
- * TODO: pipeline the division
- */
-#if 1
-
 void ZB_fillTriangleMappingPerspective(ZBuffer *zb,
                             ZBufferPoint *p0,ZBufferPoint *p1,ZBufferPoint *p2)
 {
@@ -261,30 +158,10 @@
 }
 
 
-#if TGL_FEATURE_RENDER_BITS == 24
-
 #define PUT_PIXEL(_a)				\
 {						\
-   unsigned char *ptr;\
    zz=z >> ZB_POINT_Z_FRAC_BITS;		\
      if (ZCMP(zz,pz[_a])) {				\
-       ptr = texture + (((t & 0x3FC00000) | (s & 0x003FC000)) >> 14) * 3;\
-       pp[3 * _a]= ptr[0];\
-       pp[3 * _a + 1]= ptr[1];\
-       pp[3 * _a + 2]= ptr[2];\
-       pz[_a]=zz;				\
-    }						\
-    z+=dzdx;					\
-    s+=dsdx;					\
-    t+=dtdx;					\
-}
-
-#else
-
-#define PUT_PIXEL(_a)				\
-{						\
-   zz=z >> ZB_POINT_Z_FRAC_BITS;		\
-     if (ZCMP(zz,pz[_a])) {				\
        tmp=rgb & 0xF81F07E0;			\
 	   unsigned int light = tmp | (tmp >> 16); \
        PIXEL pixel = *(PIXEL *)((char *)texture+ \
@@ -308,8 +185,6 @@
     rgb=(rgb+drgbdx) & ( ~ 0x00200800);		\
 }
 
-#endif
-
 #define DRAW_LINE()				\
 {						\
   register unsigned short *pz;		\
@@ -374,46 +249,3 @@
   
 #include "ztriangle.h"
 }
-
-#endif
-
-#if 0
-
-/* slow but exact version (only there for reference, incorrect for 24
-   bits) */
-
-void ZB_fillTriangleMappingPerspective(ZBuffer *zb,
-                            ZBufferPoint *p0,ZBufferPoint *p1,ZBufferPoint *p2)
-{
-    PIXEL *texture;
-
-#define INTERP_Z
-#define INTERP_STZ
-
-#define DRAW_INIT()				\
-{						\
-  texture=zb->current_texture;			\
-}
-
-#define PUT_PIXEL(_a)				\
-{						\
-   float zinv; \
-   int s,t; \
-   zz=z >> ZB_POINT_Z_FRAC_BITS;		\
-     if (ZCMP(zz,pz[_a])) {				\
-       zinv= 1.0 / (float) z; \
-       s= (int) (sz * zinv); \
-       t= (int) (tz * zinv); \
-       pp[_a]=texture[((t & 0x3FC00000) | s) >> 14];	\
-       pz[_a]=zz;				\
-    }						\
-    z+=dzdx;					\
-    sz+=dszdx;					\
-    tz+=dtzdx;					\
-}
-
-#include "ztriangle.h"
-}
-
-
-#endif


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.





More information about the Scummvm-git-logs mailing list