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

aquadran at users.sourceforge.net aquadran at users.sourceforge.net
Tue Jul 29 21:28:20 CEST 2008


Revision: 33423
          http://scummvm.svn.sourceforge.net/scummvm/?rev=33423&view=rev
Author:   aquadran
Date:     2008-07-29 19:28:19 +0000 (Tue, 29 Jul 2008)

Log Message:
-----------
formating code

Modified Paths:
--------------
    residual/trunk/engine/tinygl/api.cpp
    residual/trunk/engine/tinygl/arrays.cpp
    residual/trunk/engine/tinygl/clear.cpp
    residual/trunk/engine/tinygl/clip.cpp
    residual/trunk/engine/tinygl/get.cpp
    residual/trunk/engine/tinygl/gl.h
    residual/trunk/engine/tinygl/light.cpp
    residual/trunk/engine/tinygl/list.cpp
    residual/trunk/engine/tinygl/misc.cpp
    residual/trunk/engine/tinygl/msghandling.cpp
    residual/trunk/engine/tinygl/specbuf.cpp
    residual/trunk/engine/tinygl/texture.cpp
    residual/trunk/engine/tinygl/vertex.cpp
    residual/trunk/engine/tinygl/zbuffer.cpp
    residual/trunk/engine/tinygl/zbuffer.h
    residual/trunk/engine/tinygl/zgl.h
    residual/trunk/engine/tinygl/zline.cpp
    residual/trunk/engine/tinygl/zmath.h
    residual/trunk/engine/tinygl/ztriangle.cpp

Modified: residual/trunk/engine/tinygl/api.cpp
===================================================================
--- residual/trunk/engine/tinygl/api.cpp	2008-07-29 19:01:17 UTC (rev 33422)
+++ residual/trunk/engine/tinygl/api.cpp	2008-07-29 19:28:19 UTC (rev 33423)
@@ -1,8 +1,6 @@
 
 #include "engine/tinygl/zgl.h"
 
-#include <stdio.h>
-
 // glVertex
 
 void tglVertex4f(float x, float y, float z, float w) {
@@ -312,8 +310,7 @@
 	gl_add_op(p);
 }
 
-void tglFrustum(double left, double right, double bottom, double top,
-               double nearv, double farv) {
+void tglFrustum(double left, double right, double bottom, double top, double nearv, double farv) {
 	TGLParam p[7];
 
 	p[0].op = OP_Frustum;

Modified: residual/trunk/engine/tinygl/arrays.cpp
===================================================================
--- residual/trunk/engine/tinygl/arrays.cpp	2008-07-29 19:01:17 UTC (rev 33422)
+++ residual/trunk/engine/tinygl/arrays.cpp	2008-07-29 19:28:19 UTC (rev 33423)
@@ -1,9 +1,6 @@
 
 #include "engine/tinygl/zgl.h"
 
-#include <assert.h>
-#include <stdio.h>
-
 #define VERTEX_ARRAY	0x0001
 #define COLOR_ARRAY		0x0002
 #define NORMAL_ARRAY	0x0004
@@ -120,8 +117,7 @@
 	c->vertex_array = (float *)p[3].p;
 }
 
-void  glVertexPointer(TGLint size, TGLenum type, TGLsizei stride,
-					  const TGLvoid *pointer) {
+void  glVertexPointer(TGLint size, TGLenum type, TGLsizei stride, const TGLvoid *pointer) {
 	TGLParam p[4];
 	assert(type == TGL_FLOAT);
 	p[0].op = OP_VertexPointer;
@@ -137,8 +133,7 @@
 	c->color_array = (float *)p[3].p;  
 }
 
-void  glColorPointer(TGLint size, TGLenum type, TGLsizei stride, 
-					 const TGLvoid *pointer) {
+void  glColorPointer(TGLint size, TGLenum type, TGLsizei stride, const TGLvoid *pointer) {
 	TGLParam p[4];
 	assert(type == TGL_FLOAT);
 	p[0].op = OP_ColorPointer;
@@ -167,8 +162,7 @@
 	c->texcoord_array = (float *)p[3].p;
 }
 
-void glTexCoordPointer(TGLint size, TGLenum type, TGLsizei stride,
-					   const TGLvoid *pointer) {
+void glTexCoordPointer(TGLint size, TGLenum type, TGLsizei stride, const TGLvoid *pointer) {
 	TGLParam p[4];
 	assert(type == TGL_FLOAT);
 	p[0].op = OP_TexCoordPointer;

Modified: residual/trunk/engine/tinygl/clear.cpp
===================================================================
--- residual/trunk/engine/tinygl/clear.cpp	2008-07-29 19:01:17 UTC (rev 33422)
+++ residual/trunk/engine/tinygl/clear.cpp	2008-07-29 19:28:19 UTC (rev 33423)
@@ -20,6 +20,5 @@
 	int b = (int)(c->clear_color.v[2] * 65535);
 
 	// TODO : correct value of Z
-	ZB_clear(c->zb,mask & TGL_DEPTH_BUFFER_BIT, z,
-			mask & TGL_COLOR_BUFFER_BIT, r, g, b);
+	ZB_clear(c->zb,mask & TGL_DEPTH_BUFFER_BIT, z, mask & TGL_COLOR_BUFFER_BIT, r, g, b);
 }

Modified: residual/trunk/engine/tinygl/clip.cpp
===================================================================
--- residual/trunk/engine/tinygl/clip.cpp	2008-07-29 19:01:17 UTC (rev 33422)
+++ residual/trunk/engine/tinygl/clip.cpp	2008-07-29 19:28:19 UTC (rev 33423)
@@ -2,7 +2,7 @@
 #include "engine/tinygl/zgl.h"
 
 // fill triangle profile
-// #define PROFILE
+// #define TINYGL_PROFILE
 
 #define CLIP_XMIN	(1 << 0)
 #define CLIP_XMAX	(1 << 1)
@@ -366,12 +366,12 @@
 	gl_add_select1(c, p0->zp.z, p1->zp.z, p2->zp.z);
 }
 
-#ifdef PROFILE
+#ifdef TINYGL_PROFILE
 int count_triangles, count_triangles_textured, count_pixels;
 #endif
 
 void gl_draw_triangle_fill(GLContext *c, GLVertex *p0, GLVertex *p1, GLVertex *p2) {
-#ifdef PROFILE
+#ifdef TINYGL_PROFILE
 	{
 		int norm;
 		assert(p0->zp.x >= 0 && p0->zp.x < c->zb->xsize);
@@ -395,7 +395,7 @@
 		assert(c->zb->shadow_mask_buf);
 		ZB_fillTriangleFlatShadow(c->zb, &p0->zp, &p1->zp, &p2->zp);
 	} else if (c->texture_2d_enabled) {
-#ifdef PROFILE
+#ifdef TINYGL_PROFILE
 		count_triangles_textured++;
 #endif
 		ZB_setTexture(c->zb, (PIXEL *)c->current_texture->images[0].pixmap);

Modified: residual/trunk/engine/tinygl/get.cpp
===================================================================
--- residual/trunk/engine/tinygl/get.cpp	2008-07-29 19:01:17 UTC (rev 33422)
+++ residual/trunk/engine/tinygl/get.cpp	2008-07-29 19:28:19 UTC (rev 33423)
@@ -4,69 +4,68 @@
 void glGetIntegerv(int pname,int *params) {
 	GLContext *c=gl_get_context();
 
-	switch(pname) {
+	switch (pname) {
 	case TGL_VIEWPORT:
-		params[0]=c->viewport.xmin;
-		params[1]=c->viewport.ymin;
-		params[2]=c->viewport.xsize;
-		params[3]=c->viewport.ysize;
+		params[0] = c->viewport.xmin;
+		params[1] = c->viewport.ymin;
+		params[2] = c->viewport.xsize;
+		params[3] = c->viewport.ysize;
 		break;
-  case TGL_MAX_MODELVIEW_STACK_DEPTH:
-    *params = MAX_MODELVIEW_STACK_DEPTH;
-    break;
-  case TGL_MAX_PROJECTION_STACK_DEPTH:
-    *params = MAX_PROJECTION_STACK_DEPTH;
-    break;
-  case TGL_MAX_LIGHTS:
-    *params = T_MAX_LIGHTS;
-    break;
-  case TGL_MAX_TEXTURE_SIZE:
-    *params = 256; /* not completely true, but... */
-    break;
-  case TGL_MAX_TEXTURE_STACK_DEPTH:
-    *params = MAX_TEXTURE_STACK_DEPTH;
-    break;
-  default:
-    gl_fatal_error("glGet: option not implemented");
-    break;
-  }
+	case TGL_MAX_MODELVIEW_STACK_DEPTH:
+		*params = MAX_MODELVIEW_STACK_DEPTH;
+		break;
+	case TGL_MAX_PROJECTION_STACK_DEPTH:
+		*params = MAX_PROJECTION_STACK_DEPTH;
+		break;
+	case TGL_MAX_LIGHTS:
+		*params = T_MAX_LIGHTS;
+		break;
+	case TGL_MAX_TEXTURE_SIZE:
+		*params = 256; // not completely true, but...
+		break;
+	case TGL_MAX_TEXTURE_STACK_DEPTH:
+		*params = MAX_TEXTURE_STACK_DEPTH;
+		break;
+	default:
+		gl_fatal_error("glGet: option not implemented");
+		break;
+	}
 }
 
-void glGetFloatv(int pname, float *v)
-{
-  int i;
-  int mnr = 0; /* just a trick to return the correct matrix */
-  GLContext *c = gl_get_context();
-  switch (pname) {
-  case TGL_TEXTURE_MATRIX:
-    mnr++; 
-  case TGL_PROJECTION_MATRIX:
-    mnr++; 
-  case TGL_MODELVIEW_MATRIX:
-    {
-      float *p = &c->matrix_stack_ptr[mnr]->m[0][0];;
-      for (i = 0; i < 4; i++) {
-        *v++ = p[0];
-        *v++ = p[4];
-        *v++ = p[8];
-        *v++ = p[12];
-        p++;
-      }
-    } 
-    break;
-  case TGL_LINE_WIDTH:
-    *v = 1.0f;
-    break;
-  case TGL_LINE_WIDTH_RANGE:
-    v[0] = v[1] = 1.0f;
-    break;
-  case TGL_POINT_SIZE:
-    *v = 1.0f;
-    break;
-  case TGL_POINT_SIZE_RANGE:
-    v[0] = v[1] = 1.0f;
-  default:
-    fprintf(stderr,"warning: unknown pname in glGetFloatv()\n");
-    break;
-  }
+void glGetFloatv(int pname, float *v) {
+	int i;
+	int mnr = 0; // just a trick to return the correct matrix
+	GLContext *c = gl_get_context();
+	switch (pname) {
+	case TGL_TEXTURE_MATRIX:
+		mnr++; 
+	case TGL_PROJECTION_MATRIX:
+		mnr++; 
+	case TGL_MODELVIEW_MATRIX:
+		{
+			float *p = &c->matrix_stack_ptr[mnr]->m[0][0];;
+			for (i = 0; i < 4; i++) {
+				*v++ = p[0];
+				*v++ = p[4];
+				*v++ = p[8];
+				*v++ = p[12];
+				p++;
+			}
+		} 
+		break;
+	case TGL_LINE_WIDTH:
+		*v = 1.0f;
+		break;
+	case TGL_LINE_WIDTH_RANGE:
+		v[0] = v[1] = 1.0f;
+		break;
+	case TGL_POINT_SIZE:
+		*v = 1.0f;
+		break;
+	case TGL_POINT_SIZE_RANGE:
+		v[0] = v[1] = 1.0f;
+	default:
+		fprintf(stderr, "warning: unknown pname in glGetFloatv()\n");
+		break;
+	}
 }

Modified: residual/trunk/engine/tinygl/gl.h
===================================================================
--- residual/trunk/engine/tinygl/gl.h	2008-07-29 19:01:17 UTC (rev 33422)
+++ residual/trunk/engine/tinygl/gl.h	2008-07-29 19:28:19 UTC (rev 33423)
@@ -677,7 +677,7 @@
 void tglPolygonMode(int face,int mode);
 
 void tglBegin(int type);
-void tglEnd(void);
+void tglEnd();
 
 #define PROTO_GL1(name)				\
 void tgl ## name ## 1f(float);		\
@@ -722,10 +722,10 @@
 // matrix
 void tglMatrixMode(int mode);
 void tglLoadMatrixf(const float *m);
-void tglLoadIdentity(void);
+void tglLoadIdentity();
 void tglMultMatrixf(const float *m);
-void tglPushMatrix(void);
-void tglPopMatrix(void);
+void tglPushMatrix();
+void tglPopMatrix();
 void tglRotatef(float angle, float x, float y, float z);
 void tglTranslatef(float x, float y, float z);
 void tglScalef(float x, float y, float z);
@@ -750,7 +750,7 @@
 int tglRenderMode(int mode);
 void tglSelectBuffer(int size, unsigned int *buf);
 
-void tglInitNames(void);
+void tglInitNames();
 void tglPushName(unsigned int name);
 void tglPopName(void);
 void tglLoadName(unsigned int name);
@@ -779,7 +779,7 @@
 
 // misc
 
-void tglFlush(void);
+void tglFlush();
 void tglHint(int target, int mode);
 void tglGetIntegerv(int pname, int *params);
 void tglGetFloatv(int pname, float *v);
@@ -792,14 +792,10 @@
 void tglEnableClientState(TGLenum array);
 void tglDisableClientState(TGLenum array);
 void tglArrayElement(TGLint i);
-void tglVertexPointer(TGLint size, TGLenum type, TGLsizei stride,
-                     const TGLvoid *pointer);
-void tglColorPointer(TGLint size, TGLenum type, TGLsizei stride,
-                     const TGLvoid *pointer);
-void tglNormalPointer(TGLenum type, TGLsizei stride,
-                      const TGLvoid *pointer);
-void tglTexCoordPointer(TGLint size, TGLenum type, TGLsizei stride,
-                       const TGLvoid *pointer);
+void tglVertexPointer(TGLint size, TGLenum type, TGLsizei stride, const TGLvoid *pointer);
+void tglColorPointer(TGLint size, TGLenum type, TGLsizei stride, const TGLvoid *pointer);
+void tglNormalPointer(TGLenum type, TGLsizei stride, const TGLvoid *pointer);
+void tglTexCoordPointer(TGLint size, TGLenum type, TGLsizei stride, const TGLvoid *pointer);
 
 // opengl 1.2 polygon offset
 void tglPolygonOffset(TGLfloat factor, TGLfloat units);
@@ -807,6 +803,6 @@
 void tglDebug(int mode);
 
 void tglInit(void *zbuffer);
-void tglClose(void);
+void tglClose();
 
 #endif

Modified: residual/trunk/engine/tinygl/light.cpp
===================================================================
--- residual/trunk/engine/tinygl/light.cpp	2008-07-29 19:01:17 UTC (rev 33422)
+++ residual/trunk/engine/tinygl/light.cpp	2008-07-29 19:28:19 UTC (rev 33423)
@@ -239,7 +239,7 @@
 			// diffuse light
 			lR += dot * l->diffuse.v[0] * m->diffuse.v[0];
 			lG += dot * l->diffuse.v[1] * m->diffuse.v[1];
-			lB+= dot * l->diffuse.v[2] * m->diffuse.v[2];
+			lB += dot * l->diffuse.v[2] * m->diffuse.v[2];
 
 			// spot light
 			if (l->spot_cutoff != 180) {

Modified: residual/trunk/engine/tinygl/list.cpp
===================================================================
--- residual/trunk/engine/tinygl/list.cpp	2008-07-29 19:01:17 UTC (rev 33422)
+++ residual/trunk/engine/tinygl/list.cpp	2008-07-29 19:28:19 UTC (rev 33423)
@@ -154,7 +154,7 @@
 
 	list = p[1].ui;
 	l = find_list(c, list);
-	if (l == NULL)
+	if (!l)
 		gl_fatal_error("list %d not defined", list);
 	p = l->first_op_buffer->ops;
 
@@ -179,7 +179,7 @@
 	assert(c->compile_flag == 0);
 
 	l = find_list(c, list);
-	if (l != NULL)
+	if (l)
 		delete_list(c, list);
 	l = alloc_list(c, list);
 
@@ -219,7 +219,7 @@
 	lists = c->shared_state.lists;
 	count = 0;
 	for (i = 0; i < MAX_DISPLAY_LISTS; i++) {
-		if (lists[i] == NULL) {
+		if (!lists[i]) {
 			count++;
 			if (count == range) {
 				list = i - range + 1;

Modified: residual/trunk/engine/tinygl/misc.cpp
===================================================================
--- residual/trunk/engine/tinygl/misc.cpp	2008-07-29 19:01:17 UTC (rev 33422)
+++ residual/trunk/engine/tinygl/misc.cpp	2008-07-29 19:28:19 UTC (rev 33423)
@@ -12,16 +12,13 @@
 
 	// we may need to resize the zbuffer
 
-	if (c->viewport.xmin != xmin ||
-			c->viewport.ymin != ymin ||
-			c->viewport.xsize != xsize ||
-			c->viewport.ysize != ysize) {
+	if (c->viewport.xmin != xmin || c->viewport.ymin != ymin ||
+			c->viewport.xsize != xsize || c->viewport.ysize != ysize) {
 
 		xsize_req = xmin + xsize;
 		ysize_req = ymin + ysize;
 
-		if (c->gl_resize_viewport &&
-				c->gl_resize_viewport(c, &xsize_req, &ysize_req) != 0) {
+		if (c->gl_resize_viewport && c->gl_resize_viewport(c, &xsize_req, &ysize_req) != 0) {
 			gl_fatal_error("glViewport: error while resizing display");
 		}
 
@@ -95,8 +92,8 @@
 			c->shadow_mode &= ~2;
 		break; 
 	default:
-		if (code>=TGL_LIGHT0 && code<TGL_LIGHT0+T_MAX_LIGHTS) {
-			gl_enable_disable_light(c,code - TGL_LIGHT0, v);
+		if (code >= TGL_LIGHT0 && code < TGL_LIGHT0 + T_MAX_LIGHTS) {
+			gl_enable_disable_light(c, code - TGL_LIGHT0, v);
 		} else {
 			//fprintf(stderr, "glEnableDisable: 0x%X not supported.\n", code);
 		}

Modified: residual/trunk/engine/tinygl/msghandling.cpp
===================================================================
--- residual/trunk/engine/tinygl/msghandling.cpp	2008-07-29 19:01:17 UTC (rev 33422)
+++ residual/trunk/engine/tinygl/msghandling.cpp	2008-07-29 19:28:19 UTC (rev 33423)
@@ -1,19 +1,15 @@
-#include <stdarg.h>
-#include <stdio.h>
 
-#ifndef NDEBUG
-#define NDEBUG
-#endif
+#include "engine/tinygl/zgl.h"
 
-#ifdef NDEBUG
-#define NO_DEBUG_OUTPUT
+#ifndef TINYGL_DEBUG
+//#define TINYGL_DEBUG
 #endif
 
 // Use this function to output messages when something unexpected
 // happens (which might be an indication of an error). *Don't* use it
 // when there's internal errors in the code - these should be handled
 // by asserts.
-#ifndef NO_DEBUG_OUTPUT
+#ifndef TINYGL_DEBUG
 void tgl_warning(const char *, ...) { }
 #else
 void tgl_warning(const char *format, ...) {
@@ -23,10 +19,10 @@
 	vfprintf(stderr, format, args);
 	va_end(args);
 }
-#endif // !NO_DEBUG_OUTPUT
+#endif
 
 // This function should be used for debug output only.
-#ifndef NO_DEBUG_OUTPUT
+#ifndef TINYGL_DEBUG
 void tgl_trace(const char *, ...) { }
 #else
 void tgl_trace(const char *format, ...) {
@@ -36,12 +32,12 @@
 	vfprintf(stderr, format, args);
 	va_end(args);
 }
-#endif // !NO_DEBUG_OUTPUT
+#endif
 
 // Use this function to output info about things in the code which
 // should be fixed (missing handling of special cases, important
 // features not implemented, known bugs/buglets, ...).
-#ifndef NO_DEBUG_OUTPUT
+#ifndef TINYGL_DEBUG
 void tgl_fixme(const char *, ...) { }
 #else
 void tgl_fixme(const char *format, ...) {
@@ -51,4 +47,5 @@
 	vfprintf(stderr, format, args);
 	va_end(args);
 }
-#endif // !NO_DEBUG_OUTPUT
+#endif
+

Modified: residual/trunk/engine/tinygl/specbuf.cpp
===================================================================
--- residual/trunk/engine/tinygl/specbuf.cpp	2008-07-29 19:01:17 UTC (rev 33422)
+++ residual/trunk/engine/tinygl/specbuf.cpp	2008-07-29 19:28:19 UTC (rev 33423)
@@ -2,9 +2,6 @@
 #include "engine/tinygl/zgl.h"
 #include "engine/tinygl/msghandling.h"
 
-#include <math.h>
-#include <stdlib.h>
-
 static void calc_buf(GLSpecBuf *buf, const float shininess) {
 	int i;
 	float val, inc;
@@ -29,7 +26,7 @@
 		found->last_used = c->specbuf_used_counter++;
 		return found;
 	}
-	if (oldest == NULL || c->specbuf_num_buffers < MAX_SPECULAR_BUFFERS) {
+	if (!oldest || c->specbuf_num_buffers < MAX_SPECULAR_BUFFERS) {
 		// create new buffer
 		GLSpecBuf *buf = (GLSpecBuf *)gl_malloc(sizeof(GLSpecBuf));
 		if (!buf)

Modified: residual/trunk/engine/tinygl/texture.cpp
===================================================================
--- residual/trunk/engine/tinygl/texture.cpp	2008-07-29 19:01:17 UTC (rev 33422)
+++ residual/trunk/engine/tinygl/texture.cpp	2008-07-29 19:28:19 UTC (rev 33423)
@@ -21,13 +21,13 @@
 	int i;
 
 	t = find_texture(c, h);
-	if (t->prev == NULL) {
+	if (!t->prev) {
 		ht = &c->shared_state.texture_hash_table[t->handle % TEXTURE_HASH_TABLE_SIZE];
 		*ht = t->next;
 	} else {
 		t->prev->next = t->next;
 	}
-	if (t->next != NULL)
+	if (t->next)
 		t->next->prev = t->prev;
 
 	for (i = 0; i < MAX_TEXTURE_LEVELS; i++) {
@@ -39,85 +39,77 @@
 	gl_free(t);
 }
 
-GLTexture *alloc_texture(GLContext *c,int h)
-{
-  GLTexture *t,**ht;
-  
-  t=(GLTexture *)gl_zalloc(sizeof(GLTexture));
+GLTexture *alloc_texture(GLContext *c, int h) {
+	GLTexture *t, **ht;
 
-  ht=&c->shared_state.texture_hash_table[h % TEXTURE_HASH_TABLE_SIZE];
+	t = (GLTexture *)gl_zalloc(sizeof(GLTexture));
 
-  t->next=*ht;
-  t->prev=NULL;
-  if (t->next != NULL) t->next->prev=t;
-  *ht=t;
+	ht = &c->shared_state.texture_hash_table[h % TEXTURE_HASH_TABLE_SIZE];
 
-  t->handle=h;
-  
-  return t;
-}
+	t->next = *ht;
+	t->prev = NULL;
+	if (t->next)
+		t->next->prev = t;
+	*ht = t;
 
+	t->handle = h;
 
-void glInitTextures(GLContext *c)
-{
-  /* textures */
+	return t;
+}
 
-  c->texture_2d_enabled=0;
-  c->current_texture=find_texture(c,0);
+void glInitTextures(GLContext *c) {
+	// textures
+	c->texture_2d_enabled = 0;
+	c->current_texture = find_texture(c, 0);
 }
 
-void tglGenTextures(int n, unsigned int *textures)
-{
-  GLContext *c=gl_get_context();
-  int max,i;
-  GLTexture *t;
+void tglGenTextures(int n, unsigned int *textures) {
+	GLContext *c = gl_get_context();
+	int max, i;
+	GLTexture *t;
 
-  max=0;
-  for(i=0;i<TEXTURE_HASH_TABLE_SIZE;i++) {
-    t=c->shared_state.texture_hash_table[i];
-    while (t!=NULL) {
-      if (t->handle>max) max=t->handle;
-      t=t->next;
-    }
-
-  }
-  for(i=0;i<n;i++) {
-    textures[i]=max+i+1;
-  }
+	max = 0;
+	for (i = 0; i < TEXTURE_HASH_TABLE_SIZE; i++) {
+		t = c->shared_state.texture_hash_table[i];
+		while (t) {
+			if (t->handle > max)
+				max = t->handle;
+			t = t->next;
+		}
+	}
+	for(i = 0; i < n; i++) {
+		textures[i] = max + i + 1;
+	}
 }
 
+void tglDeleteTextures(int n, const unsigned int *textures) {
+	GLContext *c = gl_get_context();
+	int i;
+	GLTexture *t;
 
-void tglDeleteTextures(int n, const unsigned int *textures)
-{
-  GLContext *c=gl_get_context();
-  int i;
-  GLTexture *t;
-
-  for(i=0;i<n;i++) {
-    t=find_texture(c,textures[i]);
-    if (t!=NULL && t!=0) {
-      if (t==c->current_texture) {
-	tglBindTexture(TGL_TEXTURE_2D,0);
-      }
-      free_texture(c,textures[i]);
-    }
-  }
+	for (i = 0; i < n; i++) {
+		t = find_texture(c, textures[i]);
+		if (t) {
+			if (t == c->current_texture) {
+				tglBindTexture(TGL_TEXTURE_2D, 0);
+			}
+			free_texture(c, textures[i]);
+		}
+	}
 }
 
+void glopBindTexture(GLContext *c, TGLParam *p) {
+	int target = p[1].i;
+	int texture = p[2].i;
+	GLTexture *t;
 
-void glopBindTexture(GLContext *c,TGLParam *p)
-{
-  int target=p[1].i;
-  int texture=p[2].i;
-  GLTexture *t;
+	assert(target == TGL_TEXTURE_2D && texture >= 0);
 
-  assert(target == TGL_TEXTURE_2D && texture >= 0);
-
-  t=find_texture(c,texture);
-  if (t==NULL) {
-    t=alloc_texture(c,texture);
-  }
-  c->current_texture=t;
+	t = find_texture(c, texture);
+	if (!t) {
+		t = alloc_texture(c, texture);
+	}
+	c->current_texture = t;
 }
 
 void glopTexImage2D(GLContext *c, TGLParam *p) {
@@ -134,12 +126,11 @@
 	unsigned char *pixels1;
 	int do_free;
 
-	if (!(target == TGL_TEXTURE_2D && level == 0 && components == 3 && 
-			border == 0 && format == TGL_RGBA &&
-			type == TGL_UNSIGNED_BYTE)) {
+	if (!(target == TGL_TEXTURE_2D && level == 0 && components == 3 && border == 0
+				&& format == TGL_RGBA && type == TGL_UNSIGNED_BYTE)) {
 		gl_fatal_error("glTexImage2D: combination of parameters not handled");
 	}
-  
+
 	do_free = 0;
 	if (width != 256 || height != 256) {
 		pixels1 = (unsigned char *)gl_malloc(256 * 256 * 4);
@@ -150,67 +141,67 @@
 		do_free = 1;
 		width = 256;
 		height = 256;
-  } else {
+	} else {
 		pixels1 = (unsigned char *)pixels;
-  }
+	}
 
-  im = &c->current_texture->images[level];
-  im->xsize = width;
-  im->ysize = height;
-  if (im->pixmap)
-	  gl_free(im->pixmap);
-  im->pixmap = gl_malloc(width * height * 3);
-  if (im->pixmap)
+	im = &c->current_texture->images[level];
+	im->xsize = width;
+	im->ysize = height;
+	if (im->pixmap)
+		gl_free(im->pixmap);
+	im->pixmap = gl_malloc(width * height * 3);
+	if (im->pixmap)
 		gl_convertRGB_to_5R6G5B8A((unsigned short *)im->pixmap, pixels1, width, height);
-  if (do_free)
+	if (do_free)
 		gl_free(pixels1);
 }
 
+// TODO: not all tests are done
+void glopTexEnv(GLContext *, TGLParam *p) {
+	int target = p[1].i;
+	int pname = p[2].i;
+	int param = p[3].i;
 
-/* TODO: not all tests are done */
-void glopTexEnv(GLContext *,TGLParam *p)
-{
-  int target=p[1].i;
-  int pname=p[2].i;
-  int param=p[3].i;
+	if (target != TGL_TEXTURE_ENV) {
+error:
+		gl_fatal_error("glTexParameter: unsupported option");
+	}
 
-  if (target != TGL_TEXTURE_ENV) {
-  error:
-    gl_fatal_error("glTexParameter: unsupported option");
-  }
+	if (pname != TGL_TEXTURE_ENV_MODE)
+		goto error;
 
-  if (pname != TGL_TEXTURE_ENV_MODE) goto error;
-
-  if (param != TGL_DECAL) goto error;
+	if (param != TGL_DECAL)
+		goto error;
 }
 
-/* TODO: not all tests are done */
-void glopTexParameter(GLContext *,TGLParam *p)
-{
-  int target=p[1].i;
-  int pname=p[2].i;
-  int param=p[3].i;
-  
-  if (target != TGL_TEXTURE_2D) {
-  error:
-    gl_fatal_error("glTexParameter: unsupported option");
-  }
+// TODO: not all tests are done
+void glopTexParameter(GLContext *, TGLParam *p) {
+	int target = p[1].i;
+	int pname = p[2].i;
+	int param = p[3].i;
 
-  switch(pname) {
-  case TGL_TEXTURE_WRAP_S:
-  case TGL_TEXTURE_WRAP_T:
-    if (param != TGL_REPEAT) goto error;
-    break;
-  }
+	if (target != TGL_TEXTURE_2D) {
+error:
+		gl_fatal_error("glTexParameter: unsupported option");
+	}
+
+	switch (pname) {
+	case TGL_TEXTURE_WRAP_S:
+	case TGL_TEXTURE_WRAP_T:
+		if (param != TGL_REPEAT)
+			goto error;
+		break;
+	default:
+		;
+	}
 }
 
-void glopPixelStore(GLContext *,TGLParam *p)
-{
-  int pname=p[1].i;
-  int param=p[2].i;
+void glopPixelStore(GLContext *, TGLParam *p) {
+	int pname = p[1].i;
+	int param = p[2].i;
 
-  if (pname != TGL_UNPACK_ALIGNMENT ||
-      param != 1) {
-    gl_fatal_error("glPixelStore: unsupported option");
-  }
+	if (pname != TGL_UNPACK_ALIGNMENT || param != 1) {
+		gl_fatal_error("glPixelStore: unsupported option");
+	}
 }

Modified: residual/trunk/engine/tinygl/vertex.cpp
===================================================================
--- residual/trunk/engine/tinygl/vertex.cpp	2008-07-29 19:01:17 UTC (rev 33422)
+++ residual/trunk/engine/tinygl/vertex.cpp	2008-07-29 19:28:19 UTC (rev 33423)
@@ -155,14 +155,10 @@
 
 		// projection coordinates
 		m = &c->matrix_stack_ptr[1]->m[0][0];
-		v->pc.X = (v->ec.X * m[0] + v->ec.Y * m[1] +
-				v->ec.Z * m[2] + v->ec.W * m[3]);
-		v->pc.Y = (v->ec.X * m[4] + v->ec.Y * m[5] +
-				v->ec.Z * m[6] + v->ec.W * m[7]);
-		v->pc.Z = (v->ec.X * m[8] + v->ec.Y * m[9] +
-				v->ec.Z * m[10] + v->ec.W * m[11]);
-		v->pc.W = (v->ec.X * m[12] + v->ec.Y * m[13] +
-				v->ec.Z * m[14] + v->ec.W * m[15]);
+		v->pc.X = (v->ec.X * m[0] + v->ec.Y * m[1] + v->ec.Z * m[2] + v->ec.W * m[3]);
+		v->pc.Y = (v->ec.X * m[4] + v->ec.Y * m[5] + v->ec.Z * m[6] + v->ec.W * m[7]);
+		v->pc.Z = (v->ec.X * m[8] + v->ec.Y * m[9] + v->ec.Z * m[10] + v->ec.W * m[11]);
+		v->pc.W = (v->ec.X * m[12] + v->ec.Y * m[13] + v->ec.Z * m[14] + v->ec.W * m[15]);
 
 		m = &c->matrix_model_view_inv.m[0][0];
 		n = &c->current_normal;
@@ -179,17 +175,13 @@
 		// NOTE: W = 1 is assumed
 		m = &c->matrix_model_projection.m[0][0];
 
-		v->pc.X = (v->coord.X * m[0] + v->coord.Y * m[1] +
-				v->coord.Z * m[2] + m[3]);
-		v->pc.Y = (v->coord.X * m[4] + v->coord.Y * m[5] +
-				v->coord.Z * m[6] + m[7]);
-		v->pc.Z = (v->coord.X * m[8] + v->coord.Y * m[9] +
-				v->coord.Z * m[10] + m[11]);
+		v->pc.X = (v->coord.X * m[0] + v->coord.Y * m[1] + v->coord.Z * m[2] + m[3]);
+		v->pc.Y = (v->coord.X * m[4] + v->coord.Y * m[5] + v->coord.Z * m[6] + m[7]);
+		v->pc.Z = (v->coord.X * m[8] + v->coord.Y * m[9] + v->coord.Z * m[10] + m[11]);
 		if (c->matrix_model_projection_no_w_transform) {
 			v->pc.W = m[15];
 		} else {
-			v->pc.W = (v->coord.X * m[12] + v->coord.Y * m[13] +
-			       v->coord.Z * m[14] + m[15]);
+			v->pc.W = (v->coord.X * m[12] + v->coord.Y * m[13] + v->coord.Z * m[14] + m[15]);
 		}
 	}
 

Modified: residual/trunk/engine/tinygl/zbuffer.cpp
===================================================================
--- residual/trunk/engine/tinygl/zbuffer.cpp	2008-07-29 19:01:17 UTC (rev 33422)
+++ residual/trunk/engine/tinygl/zbuffer.cpp	2008-07-29 19:28:19 UTC (rev 33423)
@@ -13,7 +13,7 @@
 	int size;
 
 	zb = (ZBuffer *)gl_malloc(sizeof(ZBuffer));
-	if (zb == NULL)
+	if (!zb)
 		return NULL;
 
 	zb->xsize = xsize;
@@ -173,8 +173,7 @@
 	*p++ = val;
 }
 
-void ZB_clear(ZBuffer *zb, int clear_z, int z, 
-			  int clear_color, int r, int g, int b) {
+void ZB_clear(ZBuffer *zb, int clear_z, int z, int clear_color, int r, int g, int b) {
 	int color;
 	int y;
 	PIXEL *pp;

Modified: residual/trunk/engine/tinygl/zbuffer.h
===================================================================
--- residual/trunk/engine/tinygl/zbuffer.h	2008-07-29 19:01:17 UTC (rev 33422)
+++ residual/trunk/engine/tinygl/zbuffer.h	2008-07-29 19:28:19 UTC (rev 33423)
@@ -63,7 +63,6 @@
 void ZB_clear(ZBuffer *zb, int clear_z, int z, int clear_color, int r, int g, int b);
 // linesize is in BYTES
 void ZB_copyFrameBuffer(ZBuffer *zb, void *buf, int linesize);
-//void ZB_setShadowMaskBuf(
 
 // zline.c
 

Modified: residual/trunk/engine/tinygl/zgl.h
===================================================================
--- residual/trunk/engine/tinygl/zgl.h	2008-07-29 19:01:17 UTC (rev 33422)
+++ residual/trunk/engine/tinygl/zgl.h	2008-07-29 19:28:19 UTC (rev 33423)
@@ -10,9 +10,6 @@
 #include "engine/tinygl/zbuffer.h"
 #include "engine/tinygl/zmath.h"
 
-#define DEBUG
-/* #define NDEBUG */
-
 enum {
 
 #define ADD_OP(a,b,c) OP_ ## a ,
@@ -21,23 +18,23 @@
 
 };
 
-/* initially # of allocated GLVertexes (will grow when necessary) */
+// initially # of allocated GLVertexes (will grow when necessary)
 #define POLYGON_MAX_VERTEX 16
 
-/* Max # of specular light pow buffers */
+// Max # of specular light pow buffers
 #define MAX_SPECULAR_BUFFERS 8
-/* # of entries in specular buffer */
+// # of entries in specular buffer
 #define SPECULAR_BUFFER_SIZE 1024
-/* specular buffer granularity */
+// specular buffer granularity
 #define SPECULAR_BUFFER_RESOLUTION 1024
 
 
-#define MAX_MODELVIEW_STACK_DEPTH  35
-#define MAX_PROJECTION_STACK_DEPTH 8
-#define MAX_TEXTURE_STACK_DEPTH    8
-#define MAX_NAME_STACK_DEPTH       64
-#define MAX_TEXTURE_LEVELS         11
-#define T_MAX_LIGHTS                 16
+#define MAX_MODELVIEW_STACK_DEPTH	35
+#define MAX_PROJECTION_STACK_DEPTH	8
+#define MAX_TEXTURE_STACK_DEPTH		8
+#define MAX_NAME_STACK_DEPTH		64
+#define MAX_TEXTURE_LEVELS			11
+#define T_MAX_LIGHTS				16
 
 #define VERTEX_HASH_SIZE 1031
 
@@ -49,275 +46,266 @@
 #define TGL_OFFSET_POINT   0x4
 
 typedef struct GLSpecBuf {
-  int shininess_i;
-  int last_used;
-  float buf[SPECULAR_BUFFER_SIZE+1];
-  struct GLSpecBuf *next;
+	int shininess_i;
+	int last_used;
+	float buf[SPECULAR_BUFFER_SIZE+1];
+	struct GLSpecBuf *next;
 } GLSpecBuf;
 
 typedef struct GLLight {
-  V4 ambient;
-  V4 diffuse;
-  V4 specular;
-  V4 position;	
-  V3 spot_direction;
-  float spot_exponent;
-  float spot_cutoff;
-  float attenuation[3];
-  /* precomputed values */
-  float cos_spot_cutoff;
-  V3 norm_spot_direction;
-  V3 norm_position;
-  /* we use a linked list to know which are the enabled lights */
-  int enabled;
-  struct GLLight *next,*prev;
+	V4 ambient;
+	V4 diffuse;
+	V4 specular;
+	V4 position;	
+	V3 spot_direction;
+	float spot_exponent;
+	float spot_cutoff;
+	float attenuation[3];
+	// precomputed values
+	float cos_spot_cutoff;
+	V3 norm_spot_direction;
+	V3 norm_position;
+	// we use a linked list to know which are the enabled lights
+	int enabled;
+	struct GLLight *next, *prev;
 } GLLight;
 
 typedef struct GLMaterial {
-  V4 emission;
-  V4 ambient;
-  V4 diffuse;
-  V4 specular;
-  float shininess;
+	V4 emission;
+	V4 ambient;
+	V4 diffuse;
+	V4 specular;
+	float shininess;
 
-  /* computed values */
-  int shininess_i;
-  int do_specular;  
+	// computed values
+	int shininess_i;
+	int do_specular;  
 } GLMaterial;
 
 
 typedef struct GLViewport {
-  int xmin,ymin,xsize,ysize;
-  V3 scale;
-  V3 trans;
-  int updated;
+	int xmin, ymin, xsize, ysize;
+	V3 scale;
+	V3 trans;
+	int updated;
 } GLViewport;
 
 typedef union {
-  int op;
-  float f;
-  int i;
-  unsigned int ui;
-  void *p;
+	int op;
+	float f;
+	int i;
+	unsigned int ui;
+	void *p;
 } TGLParam;
 
 typedef struct TGLParamBuffer {
-  TGLParam ops[OP_BUFFER_MAX_SIZE];
-  struct TGLParamBuffer *next;
+	TGLParam ops[OP_BUFFER_MAX_SIZE];
+	struct TGLParamBuffer *next;
 } TGLParamBuffer;
 
 typedef struct GLList {
-  TGLParamBuffer *first_op_buffer;
-  /* TODO: extensions for an hash table or a better allocating scheme */
+	TGLParamBuffer *first_op_buffer;
+	// TODO: extensions for an hash table or a better allocating scheme
 } GLList;
 
 typedef struct GLVertex {
-  int edge_flag;
-  V3 normal;
-  V4 coord;
-  V4 tex_coord;
-  V4 color;
-  
-  /* computed values */
-  V4 ec;                /* eye coordinates */
-  V4 pc;                /* coordinates in the normalized volume */
-  int clip_code;        /* clip code */
-  ZBufferPoint zp;      /* integer coordinates for the rasterization */
+	int edge_flag;
+	V3 normal;
+	V4 coord;
+	V4 tex_coord;
+	V4 color;
+
+	// computed values
+	V4 ec;                // eye coordinates
+	V4 pc;                // coordinates in the normalized volume
+	int clip_code;        // clip code
+	ZBufferPoint zp;      // integer coordinates for the rasterization
 } GLVertex;
 
 typedef struct GLImage {
-  void *pixmap;
-  int xsize,ysize;
+	void *pixmap;
+	int xsize, ysize;
 } GLImage;
 
-/* textures */
+// textures
 
 #define TEXTURE_HASH_TABLE_SIZE 256
 
 typedef struct GLTexture {
-  GLImage images[MAX_TEXTURE_LEVELS];
-  int handle;
-  struct GLTexture *next,*prev;
+	GLImage images[MAX_TEXTURE_LEVELS];
+	int handle;
+	struct GLTexture *next, *prev;
 } GLTexture;
 
 
-/* shared state */
+// shared state
 
 typedef struct GLSharedState {
-  GLList **lists;
-  GLTexture **texture_hash_table;
+	GLList **lists;
+	GLTexture **texture_hash_table;
 } GLSharedState;
 
 struct GLContext;
 
-typedef void (*gl_draw_triangle_func)(struct GLContext *c,
-                                      GLVertex *p0,GLVertex *p1,GLVertex *p2);
+typedef void (*gl_draw_triangle_func)(GLContext *c, GLVertex *p0, GLVertex *p1, GLVertex *p2);
 
-/* display context */
+// display context
 
 typedef struct GLContext {
-  /* Z buffer */
-  ZBuffer *zb;
+	// Z buffer
+	ZBuffer *zb;
 
-  /* lights */
-  GLLight lights[T_MAX_LIGHTS];
-  GLLight *first_light;
-  V4 ambient_light_model;
-  int local_light_model;
-  int lighting_enabled;
-  int light_model_two_side;
+	// lights
+	GLLight lights[T_MAX_LIGHTS];
+	GLLight *first_light;
+	V4 ambient_light_model;
+	int local_light_model;
+	int lighting_enabled;
+	int light_model_two_side;
 
-  /* materials */
-  GLMaterial materials[2];
-  int color_material_enabled;
-  int current_color_material_mode;
-  int current_color_material_type;
+	// materials
+	GLMaterial materials[2];
+	int color_material_enabled;
+	int current_color_material_mode;
+	int current_color_material_type;
 
-  /* textures */
-  GLTexture *current_texture;
-  int texture_2d_enabled;
+	// textures
+	GLTexture *current_texture;
+	int texture_2d_enabled;
 
-  /* shared state */
-  GLSharedState shared_state;
+	// shared state
+	GLSharedState shared_state;
 
-  /* current list */
-  TGLParamBuffer *current_op_buffer;
-  int current_op_buffer_index;
-  int exec_flag,compile_flag,print_flag;
+	// current list
+	TGLParamBuffer *current_op_buffer;
+	int current_op_buffer_index;
+	int exec_flag, compile_flag, print_flag;
 
-  /* matrix */
+	// matrix
+	int matrix_mode;
+	M4 *matrix_stack[3];
+	M4 *matrix_stack_ptr[3];
+	int matrix_stack_depth_max[3];
 
-  int matrix_mode;
-  M4 *matrix_stack[3];
-  M4 *matrix_stack_ptr[3];
-  int matrix_stack_depth_max[3];
+	M4 matrix_model_view_inv;
+	M4 matrix_model_projection;
+	int matrix_model_projection_updated;
+	int matrix_model_projection_no_w_transform; 
+	int apply_texture_matrix;
 
-  M4 matrix_model_view_inv;
-  M4 matrix_model_projection;
-  int matrix_model_projection_updated;
-  int matrix_model_projection_no_w_transform; 
-  int apply_texture_matrix;
+	// viewport
+	GLViewport viewport;
 
-  /* viewport */
-  GLViewport viewport;
+	// current state
+	int polygon_mode_back;
+	int polygon_mode_front;
 
-  /* current state */
-  int polygon_mode_back;
-  int polygon_mode_front;
+	int current_front_face;
+	int current_shade_model;
+	int current_cull_face;
+	int cull_face_enabled;
+	int normalize_enabled;
+	gl_draw_triangle_func draw_triangle_front, draw_triangle_back;
 
-  int current_front_face;
-  int current_shade_model;
-  int current_cull_face;
-  int cull_face_enabled;
-  int normalize_enabled;
-  gl_draw_triangle_func draw_triangle_front,draw_triangle_back;
+	// selection
+	int render_mode;
+	unsigned int *select_buffer;
+	int select_size;
+	unsigned int *select_ptr, *select_hit;
+	int select_overflow;
+	int select_hits;
 
-  /* selection */
-  int render_mode;
-  unsigned int *select_buffer;
-  int select_size;
-  unsigned int *select_ptr,*select_hit;
-  int select_overflow;
-  int select_hits;
+	// names
+	unsigned int name_stack[MAX_NAME_STACK_DEPTH];
+	int name_stack_size;
 
-  /* names */
-  unsigned int name_stack[MAX_NAME_STACK_DEPTH];
-  int name_stack_size;
+	// clear
+	float clear_depth;
+	V4 clear_color;
 
-  /* clear */
-  float clear_depth;
-  V4 clear_color;
+	// current vertex state
+	V4 current_color;
+	unsigned int longcurrent_color[3]; // precomputed integer color
+	V4 current_normal;
+	V4 current_tex_coord;
+	int current_edge_flag;
 
-  /* current vertex state */
-  V4 current_color;
-  unsigned int longcurrent_color[3]; /* precomputed integer color */
-  V4 current_normal;
-  V4 current_tex_coord;
-  int current_edge_flag;
+	// glBegin / glEnd
+	int in_begin;
+	int begin_type;
+	int vertex_n, vertex_cnt;
+	int vertex_max;
+	GLVertex *vertex;
 
-  /* glBegin / glEnd */
-  int in_begin;
-  int begin_type;
-  int vertex_n,vertex_cnt;
-  int vertex_max;
-  GLVertex *vertex;
+	// opengl 1.1 arrays
+	float *vertex_array;
+	int vertex_array_size;
+	int vertex_array_stride;
+	float *normal_array;
+	int normal_array_stride;
+	float *color_array;
+	int color_array_size;
+	int color_array_stride;
+	float *texcoord_array;
+	int texcoord_array_size;
+	int texcoord_array_stride;
+	int client_states;
 
-  /* opengl 1.1 arrays  */
-  float *vertex_array;
-  int vertex_array_size;
-  int vertex_array_stride;
-  float *normal_array;
-  int normal_array_stride;
-  float *color_array;
-  int color_array_size;
-  int color_array_stride;
-  float *texcoord_array;
-  int texcoord_array_size;
-  int texcoord_array_stride;
-  int client_states;
-  
-  /* opengl 1.1 polygon offset */
-  float offset_factor;
-  float offset_units;
-  int offset_states;
+	// opengl 1.1 polygon offset
+	float offset_factor;
+	float offset_units;
+	int offset_states;
 
-  int shadow_mode;
+	int shadow_mode;
 
-  /* specular buffer. could probably be shared between contexts, 
-    but that wouldn't be 100% thread safe */
-  GLSpecBuf *specbuf_first;
-  int specbuf_used_counter;
-  int specbuf_num_buffers;
+	// specular buffer. could probably be shared between contexts, 
+	// but that wouldn't be 100% thread safe
+	GLSpecBuf *specbuf_first;
+	int specbuf_used_counter;
+	int specbuf_num_buffers;
 
-  /* opaque structure for user's use */
-  void *opaque;
-  /* resize viewport function */
-  int (*gl_resize_viewport)(struct GLContext *c,int *xsize,int *ysize);
+	// opaque structure for user's use
+	void *opaque;
+	// resize viewport function
+	int (*gl_resize_viewport)(GLContext *c, int *xsize, int *ysize);
 
-  /* depth test */
-  int depth_test;
+	// depth test
+	int depth_test;
 } GLContext;
 
 extern GLContext *gl_ctx;
 
 void gl_add_op(TGLParam *p);
 
-/* clip.c */
-void gl_transform_to_viewport(GLContext *c,GLVertex *v);
-void gl_draw_triangle(GLContext *c,GLVertex *p0,GLVertex *p1,GLVertex *p2);
-void gl_draw_line(GLContext *c,GLVertex *p0,GLVertex *p1);
-void gl_draw_point(GLContext *c,GLVertex *p0);
+// clip.c
+void gl_transform_to_viewport(GLContext *c, GLVertex *v);
+void gl_draw_triangle(GLContext *c, GLVertex *p0, GLVertex *p1, GLVertex *p2);
+void gl_draw_line(GLContext *c, GLVertex *p0, GLVertex *p1);
+void gl_draw_point(GLContext *c, GLVertex *p0);
 
-void gl_draw_triangle_point(GLContext *c,
-                            GLVertex *p0,GLVertex *p1,GLVertex *p2);
-void gl_draw_triangle_line(GLContext *c,
-                           GLVertex *p0,GLVertex *p1,GLVertex *p2);
-void gl_draw_triangle_fill(GLContext *c,
-                           GLVertex *p0,GLVertex *p1,GLVertex *p2);
-void gl_draw_triangle_select(GLContext *c,
-                             GLVertex *p0,GLVertex *p1,GLVertex *p2);
+void gl_draw_triangle_point(GLContext *c, GLVertex *p0, GLVertex *p1, GLVertex *p2);
+void gl_draw_triangle_line(GLContext *c, GLVertex *p0, GLVertex *p1, GLVertex *p2);
+void gl_draw_triangle_fill(GLContext *c, GLVertex *p0, GLVertex *p1, GLVertex *p2);
+void gl_draw_triangle_select(GLContext *c, GLVertex *p0, GLVertex *p1, GLVertex *p2);
 
-/* matrix.c */
+// matrix.c
 void gl_print_matrix(const float *m);
-/*
-void glopLoadIdentity(GLContext *c,TGLParam *p);
-void glopTranslate(GLContext *c,TGLParam *p);*/
 
-/* light.c */
-void gl_add_select(GLContext *c,unsigned int zmin,unsigned int zmax);
-void gl_enable_disable_light(GLContext *c,int light,int v);
-void gl_shade_vertex(GLContext *c,GLVertex *v);
+// light.c
+void gl_add_select(GLContext *c, unsigned int zmin, unsigned int zmax);
+void gl_enable_disable_light(GLContext *c, int light, int v);
+void gl_shade_vertex(GLContext *c, GLVertex *v);
 
 void glInitTextures(GLContext *c);
 void glEndTextures(GLContext *c);
-GLTexture *alloc_texture(GLContext *c,int h);
+GLTexture *alloc_texture(GLContext *c, int h);
 
 // image_util.c
 void gl_convertRGB_to_5R6G5B8A(unsigned short *pixmap, unsigned char *rgba, 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);
+					unsigned char *src, int xsize_src, int ysize_src);
 void gl_resizeImageNoInterpolate(unsigned char *dest, int xsize_dest, int ysize_dest,
-                                 unsigned char *src, int xsize_src, int ysize_src);
+								 unsigned char *src, int xsize_src, int ysize_src);
 
 GLContext *gl_get_context(void);
 
@@ -350,8 +338,7 @@
 	float w;
 
 	w = (float)(w1 * (1.0 + CLIP_EPSILON));
-	return (x < -w) | ((x > w) << 1) | ((y < -w) << 2) |
-			((y > w) << 3) | ((z < -w) << 4) | ((z > w) << 5);
+	return (x < -w) | ((x > w) << 1) | ((y < -w) << 2) | ((y > w) << 3) | ((z < -w) << 4) | ((z > w) << 5);
 }
 
 #endif // _tgl_zgl_h_

Modified: residual/trunk/engine/tinygl/zline.cpp
===================================================================
--- residual/trunk/engine/tinygl/zline.cpp	2008-07-29 19:01:17 UTC (rev 33422)
+++ residual/trunk/engine/tinygl/zline.cpp	2008-07-29 19:28:19 UTC (rev 33423)
@@ -1,4 +1,3 @@
-#include <stdlib.h>
 
 #include "engine/tinygl/zbuffer.h"
 
@@ -14,7 +13,7 @@
 	pz_2 = zb->zbuf2 + (p->y * zb->xsize + p->x);
 	pp = (PIXEL *)((char *) zb->pbuf + zb->linesize * p->y + p->x * PSZB);
 	zz = p->z >> ZB_POINT_Z_FRAC_BITS;
-	if ((ZCMP(zz, *pz)) && (ZCMP((unsigned int)p->z, *pz_2)) ) {
+	if ((ZCMP(zz, *pz)) && (ZCMP((unsigned int)p->z, *pz_2))) {
 		*pp = RGB_TO_PIXEL(p->r, p->g, p->b);
 		*pz_2 = p->z;
     }

Modified: residual/trunk/engine/tinygl/zmath.h
===================================================================
--- residual/trunk/engine/tinygl/zmath.h	2008-07-29 19:01:17 UTC (rev 33422)
+++ residual/trunk/engine/tinygl/zmath.h	2008-07-29 19:28:19 UTC (rev 33423)
@@ -43,7 +43,7 @@
 void gl_M4_MulLeft(M4 *c, M4 *a);
 void gl_M4_Transpose(M4 *a, M4 *b);
 void gl_M4_Rotate(M4 *c, float t, int u);
-int  gl_V3_Norm(V3 *a);
+int gl_V3_Norm(V3 *a);
 
 V3 gl_V3_New(float x, float y, float z);
 V4 gl_V4_New(float x, float y, float z, float w);

Modified: residual/trunk/engine/tinygl/ztriangle.cpp
===================================================================
--- residual/trunk/engine/tinygl/ztriangle.cpp	2008-07-29 19:01:17 UTC (rev 33422)
+++ residual/trunk/engine/tinygl/ztriangle.cpp	2008-07-29 19:28:19 UTC (rev 33423)
@@ -5,8 +5,7 @@
 
 #define ZCMP(z, zpix) ((z) >= (zpix))
 
-void ZB_fillTriangleFlat(ZBuffer *zb, ZBufferPoint *p0,
-						 ZBufferPoint *p1, ZBufferPoint *p2) {
+void ZB_fillTriangleFlat(ZBuffer *zb, ZBufferPoint *p0, ZBufferPoint *p1, ZBufferPoint *p2) {
 	int color;
 
 #define INTERP_Z
@@ -30,8 +29,7 @@
 // Smooth filled triangle.
 // The code below is very tricky :)
 
-void ZB_fillTriangleSmooth(ZBuffer *zb, ZBufferPoint *p0,
-						   ZBufferPoint *p1, ZBufferPoint *p2) {
+void ZB_fillTriangleSmooth(ZBuffer *zb, ZBufferPoint *p0, ZBufferPoint *p1, ZBufferPoint *p2) {
 	int _drgbdx;
 
 #define INTERP_Z
@@ -97,8 +95,7 @@
 	zb->current_texture=texture;
 }
 
-void ZB_fillTriangleMapping(ZBuffer *zb, ZBufferPoint *p0,
-							ZBufferPoint *p1, ZBufferPoint *p2) {
+void ZB_fillTriangleMapping(ZBuffer *zb, ZBufferPoint *p0, ZBufferPoint *p1, ZBufferPoint *p2) {
 	PIXEL *texture;
 
 #define INTERP_Z
@@ -122,8 +119,7 @@
 #include "engine/tinygl/ztriangle.h"
 }
 
-void ZB_fillTriangleMappingPerspective(ZBuffer *zb, ZBufferPoint *p0,
-									   ZBufferPoint *p1, ZBufferPoint *p2) {
+void ZB_fillTriangleMappingPerspective(ZBuffer *zb, ZBufferPoint *p0, ZBufferPoint *p1, ZBufferPoint *p2) {
 	PIXEL *texture;
 	float fdzdx, fndzdx, ndszdx, ndtzdx;
 	int _drgbdx;


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