shithub: tinygl

Download patch

ref: 75e55346c70c831fe17df3f57379b280680e039e
parent: acb9df2f3366456315a3bdb28b4903705ec3495d
author: David <gek@katherine>
date: Fri Feb 19 12:21:22 EST 2021

SPEED IS THE NAME, SPEED IS THE GAME, SPEEDgit add .git add .

--- a/SDL_Examples/Makefile
+++ b/SDL_Examples/Makefile
@@ -1,5 +1,6 @@
-CC= gcc
-CFLAGS = -g -Wall -O3 -w
+include ../config.mk
+#CC= gcc
+#CFLAGS = -g -Wall -O3 -w
 GL_LIBS= -L../ 
 GL_INCLUDES= -I../include/
 ALL_T= gears texture model helloworld
--- /dev/null
+++ b/config.mk
@@ -1,0 +1,10 @@
+#####################################################################
+# C compiler
+
+CC= gcc
+CFLAGS= -Wall -O3 -g -std=c99 -Wno-undef
+LFLAGS=
+
+
+
+
--- a/src/Makefile
+++ b/src/Makefile
@@ -1,4 +1,4 @@
-include config.mk
+include ../config.mk
 
 OBJS= api.o list.o vertex.o init.o matrix.o texture.o \
       misc.o clear.o light.o clip.o select.o get.o \
--- a/src/config.mk
+++ /dev/null
@@ -1,83 +1,0 @@
-#####################################################################
-# C compiler
-
-# linux
-CC= gcc
-CFLAGS= -Wall -O3 -g -std=c99 -Wno-undef
-LFLAGS=
-
-# for BeOS PPC
-#CC= mwcc
-#CFLAGS= -I. -i-
-#LFLAGS=
-
-#####################################################################
-# TinyGL configuration 
-
-#####################################################################
-# Select window API for TinyGL: 
-
-# standard X11 GLX like API 
-TINYGL_USE_GLX=n
-
-# BEOS API
-#TINYGL_USE_BEOS=y
-
-# Micro Windows NanoX API
-#TINYGL_USE_NANOX=y
-
-#####################################################################
-# X11 configuration (for the examples only)
-
-ifdef TINYGL_USE_GLX
-# Linux
-#UI_LIBS= -L/usr/X11R6/lib -lX11 -lXext
-UI_LIBS=
-UI_INCLUDES= 
-# Solaris
-#UI_LIBS= -L/usr/X11/lib -lX11 -lXext -lsocket -lnsl
-#UI_INCLUDES= 
-
-UI_OBJS=x11.o
-endif
-
-#####################################################################
-# Micro windowX11 configuration (for the examples only)
-
-ifdef TINYGL_USE_NANOX
-UI_LIBS= -lnano-X -lmwengine -lmwdrivers -lmwfonts
-UI_INCLUDES=
-
-# X11 target for nanoX
-UI_LIBS+= -L/usr/X11R6/lib -lX11 -lXext
-
-UI_OBJS=nanox.o
-endif
-
-#####################################################################
-# OpenGL configuration (for the examples only)
-
-# use TinyGL 
-GL_LIBS= -L../ -lTinyGL 
-GL_INCLUDES= -I../include
-GL_DEPS= ../libTinyGL.a
-
-# use Mesa
-#GL_LIBS= -lMesaGL 
-#GL_INCLUDES= 
-#GL_DEPS=
-
-# use OpenGL
-#GL_LIBS= -lGL 
-#GL_INCLUDES= 
-#GL_DEPS=
-
-####################################################################
-# Compile and link control
-
-# UNIX systems
-DIRS= src examples
-
-# BeOS
-# DIRS= src BeOS
-
--- a/src/ztriangle.c
+++ b/src/ztriangle.c
@@ -439,7 +439,7 @@
 #define INTERP_Z
 #define INTERP_STZ
 
-
+//NB_INTERP refers to some sort of texture mapping speedup enhancement.
 #define NB_INTERP 8
 
 #define DRAW_INIT()                                                                                                                                            \
@@ -580,8 +580,6 @@
 	}
 #endif
 #define DRAW_LINE() {DRAW_LINE_TRI_TEXTURED()}
-
-
 #include "ztriangle.h"
 }
 
--- a/src/ztriangle.h
+++ b/src/ztriangle.h
@@ -20,7 +20,7 @@
  */
 
 {
-	GLfloat fdx1, fdx2, fdy1, fdy2, d1, d2;
+	GLfloat fdx1, fdx2, fdy1, fdy2;
 	GLushort* pz1;
 	PIXEL* pp1;
 	GLint update_left, update_right;
@@ -86,6 +86,8 @@
 	fdx2 *= fz;
 	fdy2 *= fz;
 	//and then
+{
+GLfloat d1, d2;
 #ifdef INTERP_Z
 {
 	d1 = p1->z - p0->z; //d1 first usage
@@ -157,7 +159,7 @@
 		dtzdy = (fdx1 * d2 - fdx2 * d1);
 	}
 #endif
-
+} //EOF d1, d2 lifetimes.
 	/* screen coordinates */
 
 	pp1 = (PIXEL*)(zb->pbuf) + zb->xsize * p0->y; //pp1 first usage