View Single Post
Old 09 December 2017, 14:42   #10
Cowcat
Registered User
 
Join Date: Apr 2013
Location: Mallorca
Posts: 617
Quote:
Seems like it has improved since Alpha 4
There are some endian inlines in some places also take a look at this code used on original Q3 sources:

Code:
        
	width = xmax - xmin;
	height = ymax - ymin;
	
	dest->projectionMatrix[0] = 2 * zProj / width;
	dest->projectionMatrix[4] = 0;
	dest->projectionMatrix[8] = (xmax + xmin + 2 * stereoSep) / width;
	dest->projectionMatrix[12] = 2 * zProj * stereoSep / width;

	dest->projectionMatrix[1] = 0;
	dest->projectionMatrix[5] = 2 * zProj / height;
	dest->projectionMatrix[9] = ( ymax + ymin ) / height;	// normally 0
	dest->projectionMatrix[13] = 0;
Now my version:

Code:
	width = 1.0f / (xmax - xmin);
	height = 1.0f / (ymax - ymin);
	
	dest->projectionMatrix[0] = 2 * zProj * width;
	dest->projectionMatrix[4] = 0;
	dest->projectionMatrix[8] = (xmax + xmin + 2 * stereoSep) * width;
	dest->projectionMatrix[12] = 2 * zProj * stereoSep * width;

	dest->projectionMatrix[1] = 0;
	dest->projectionMatrix[5] = 2 * zProj * height;
	dest->projectionMatrix[9] = ( ymax + ymin ) * height;	// normally 0
	dest->projectionMatrix[13] = 0;
Half of this stuff is how minigl does things for projections, but Q3 bypasses opengl functions by doing it his own way. I don't claim this to be the result of the increased speed but even the "inexact" calculations by saving divisions, it seems to work (besides other faster calculations in other places).

Gibberish for people, but this is Coders thread
Cowcat is offline  
 
Page generated in 0.04222 seconds with 11 queries