summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSmileTheory <SmileTheory@gmail.com>2013-11-19 03:18:23 -0800
committerTim Angus <tim@ngus.net>2014-06-17 17:43:36 +0100
commit85e0fa4841fd5ca6bf6c9b2f0204ee7be9c0915b (patch)
tree967d7968faf0c62bc683bfa5eb9e00aa3b89d4b2
parent38af27b32b1302fd5ddd83d992fc8ec73209b3ad (diff)
OpenGL2: Match glsl data type names: matrix_t -> mat4_t, vec*i_t -> ivec*_t
-rw-r--r--src/renderergl2/tr_backend.c36
-rw-r--r--src/renderergl2/tr_extramath.c22
-rw-r--r--src/renderergl2/tr_extramath.h32
-rw-r--r--src/renderergl2/tr_fbo.c18
-rw-r--r--src/renderergl2/tr_fbo.h6
-rw-r--r--src/renderergl2/tr_flares.c10
-rw-r--r--src/renderergl2/tr_glsl.c8
-rw-r--r--src/renderergl2/tr_local.h12
-rw-r--r--src/renderergl2/tr_main.c24
-rw-r--r--src/renderergl2/tr_postprocess.c34
-rw-r--r--src/renderergl2/tr_postprocess.h6
-rw-r--r--src/renderergl2/tr_sky.c20
12 files changed, 114 insertions, 114 deletions
diff --git a/src/renderergl2/tr_backend.c b/src/renderergl2/tr_backend.c
index b9cbedd9..def0786a 100644
--- a/src/renderergl2/tr_backend.c
+++ b/src/renderergl2/tr_backend.c
@@ -372,17 +372,17 @@ void GL_State( unsigned long stateBits )
}
-void GL_SetProjectionMatrix(matrix_t matrix)
+void GL_SetProjectionMatrix(mat4_t matrix)
{
- Matrix16Copy(matrix, glState.projection);
- Matrix16Multiply(glState.projection, glState.modelview, glState.modelviewProjection);
+ Mat4Copy(matrix, glState.projection);
+ Mat4Multiply(glState.projection, glState.modelview, glState.modelviewProjection);
}
-void GL_SetModelviewMatrix(matrix_t matrix)
+void GL_SetModelviewMatrix(mat4_t matrix)
{
- Matrix16Copy(matrix, glState.modelview);
- Matrix16Multiply(glState.projection, glState.modelview, glState.modelviewProjection);
+ Mat4Copy(matrix, glState.modelview);
+ Mat4Multiply(glState.projection, glState.modelview, glState.modelviewProjection);
}
@@ -766,7 +766,7 @@ RB_SetGL2D
================
*/
void RB_SetGL2D (void) {
- matrix_t matrix;
+ mat4_t matrix;
int width, height;
if (backEnd.projection2D && backEnd.last2DFBO == glState.currentFBO)
@@ -790,9 +790,9 @@ void RB_SetGL2D (void) {
qglViewport( 0, 0, width, height );
qglScissor( 0, 0, width, height );
- Matrix16Ortho(0, width, height, 0, 0, 1, matrix);
+ Mat4Ortho(0, width, height, 0, 0, 1, matrix);
GL_SetProjectionMatrix(matrix);
- Matrix16Identity(matrix);
+ Mat4Identity(matrix);
GL_SetModelviewMatrix(matrix);
GL_State( GLS_DEPTHTEST_DISABLE |
@@ -882,7 +882,7 @@ void RE_StretchRaw (int x, int y, int w, int h, int cols, int rows, const byte *
GLSL_BindProgram(&tr.textureColorShader);
- GLSL_SetUniformMatrix16(&tr.textureColorShader, UNIFORM_MODELVIEWPROJECTIONMATRIX, glState.modelviewProjection);
+ GLSL_SetUniformMat4(&tr.textureColorShader, UNIFORM_MODELVIEWPROJECTIONMATRIX, glState.modelviewProjection);
GLSL_SetUniformVec4(&tr.textureColorShader, UNIFORM_COLOR, colorWhite);
RB_InstantQuad2(quadVerts, texCoords);
@@ -1123,9 +1123,9 @@ const void *RB_DrawSurfs( const void *data ) {
GL_BindToTMU(tr.sunShadowDepthImage[1], TB_SHADOWMAP2);
GL_BindToTMU(tr.sunShadowDepthImage[2], TB_SHADOWMAP3);
- GLSL_SetUniformMatrix16(&tr.shadowmaskShader, UNIFORM_SHADOWMVP, backEnd.refdef.sunShadowMvp[0]);
- GLSL_SetUniformMatrix16(&tr.shadowmaskShader, UNIFORM_SHADOWMVP2, backEnd.refdef.sunShadowMvp[1]);
- GLSL_SetUniformMatrix16(&tr.shadowmaskShader, UNIFORM_SHADOWMVP3, backEnd.refdef.sunShadowMvp[2]);
+ GLSL_SetUniformMat4(&tr.shadowmaskShader, UNIFORM_SHADOWMVP, backEnd.refdef.sunShadowMvp[0]);
+ GLSL_SetUniformMat4(&tr.shadowmaskShader, UNIFORM_SHADOWMVP2, backEnd.refdef.sunShadowMvp[1]);
+ GLSL_SetUniformMat4(&tr.shadowmaskShader, UNIFORM_SHADOWMVP3, backEnd.refdef.sunShadowMvp[2]);
GLSL_SetUniformVec3(&tr.shadowmaskShader, UNIFORM_VIEWORIGIN, backEnd.refdef.vieworg);
{
@@ -1579,7 +1579,7 @@ const void *RB_PostProcess(const void *data)
{
const postProcessCommand_t *cmd = data;
FBO_t *srcFbo;
- vec4i_t srcBox, dstBox;
+ ivec4_t srcBox, dstBox;
qboolean autoExposure;
// finish any 2D drawing if needed
@@ -1665,7 +1665,7 @@ const void *RB_PostProcess(const void *data)
if (0)
{
- vec4i_t dstBox;
+ ivec4_t dstBox;
VectorSet4(dstBox, 0, 0, 128, 128);
FBO_BlitFromTexture(tr.sunShadowDepthImage[0], NULL, NULL, NULL, dstBox, NULL, NULL, 0);
VectorSet4(dstBox, 128, 0, 128, 128);
@@ -1676,7 +1676,7 @@ const void *RB_PostProcess(const void *data)
if (0)
{
- vec4i_t dstBox;
+ ivec4_t dstBox;
VectorSet4(dstBox, 256, glConfig.vidHeight - 256, 256, 256);
FBO_BlitFromTexture(tr.renderDepthImage, NULL, NULL, NULL, dstBox, NULL, NULL, 0);
VectorSet4(dstBox, 512, glConfig.vidHeight - 256, 256, 256);
@@ -1685,7 +1685,7 @@ const void *RB_PostProcess(const void *data)
if (0)
{
- vec4i_t dstBox;
+ ivec4_t dstBox;
VectorSet4(dstBox, 256, glConfig.vidHeight - 256, 256, 256);
FBO_BlitFromTexture(tr.sunRaysImage, NULL, NULL, NULL, dstBox, NULL, NULL, 0);
}
@@ -1693,7 +1693,7 @@ const void *RB_PostProcess(const void *data)
#if 0
if (r_cubeMapping->integer && tr.numCubemaps)
{
- vec4i_t dstBox;
+ ivec4_t dstBox;
int cubemapIndex = R_CubemapForPoint( backEnd.viewParms.or.origin );
if (cubemapIndex)
diff --git a/src/renderergl2/tr_extramath.c b/src/renderergl2/tr_extramath.c
index 859f3a3f..fe787ef1 100644
--- a/src/renderergl2/tr_extramath.c
+++ b/src/renderergl2/tr_extramath.c
@@ -26,7 +26,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
// Some matrix helper functions
// FIXME: do these already exist in ioq3 and I don't know about them?
-void Matrix16Zero( matrix_t out )
+void Mat4Zero( mat4_t out )
{
out[ 0] = 0.0f; out[ 4] = 0.0f; out[ 8] = 0.0f; out[12] = 0.0f;
out[ 1] = 0.0f; out[ 5] = 0.0f; out[ 9] = 0.0f; out[13] = 0.0f;
@@ -34,7 +34,7 @@ void Matrix16Zero( matrix_t out )
out[ 3] = 0.0f; out[ 7] = 0.0f; out[11] = 0.0f; out[15] = 0.0f;
}
-void Matrix16Identity( matrix_t out )
+void Mat4Identity( mat4_t out )
{
out[ 0] = 1.0f; out[ 4] = 0.0f; out[ 8] = 0.0f; out[12] = 0.0f;
out[ 1] = 0.0f; out[ 5] = 1.0f; out[ 9] = 0.0f; out[13] = 0.0f;
@@ -42,7 +42,7 @@ void Matrix16Identity( matrix_t out )
out[ 3] = 0.0f; out[ 7] = 0.0f; out[11] = 0.0f; out[15] = 1.0f;
}
-void Matrix16Copy( const matrix_t in, matrix_t out )
+void Mat4Copy( const mat4_t in, mat4_t out )
{
out[ 0] = in[ 0]; out[ 4] = in[ 4]; out[ 8] = in[ 8]; out[12] = in[12];
out[ 1] = in[ 1]; out[ 5] = in[ 5]; out[ 9] = in[ 9]; out[13] = in[13];
@@ -50,7 +50,7 @@ void Matrix16Copy( const matrix_t in, matrix_t out )
out[ 3] = in[ 3]; out[ 7] = in[ 7]; out[11] = in[11]; out[15] = in[15];
}
-void Matrix16Multiply( const matrix_t in1, const matrix_t in2, matrix_t out )
+void Mat4Multiply( const mat4_t in1, const mat4_t in2, mat4_t out )
{
out[ 0] = in1[ 0] * in2[ 0] + in1[ 4] * in2[ 1] + in1[ 8] * in2[ 2] + in1[12] * in2[ 3];
out[ 1] = in1[ 1] * in2[ 0] + in1[ 5] * in2[ 1] + in1[ 9] * in2[ 2] + in1[13] * in2[ 3];
@@ -73,7 +73,7 @@ void Matrix16Multiply( const matrix_t in1, const matrix_t in2, matrix_t out )
out[15] = in1[ 3] * in2[12] + in1[ 7] * in2[13] + in1[11] * in2[14] + in1[15] * in2[15];
}
-void Matrix16Transform( const matrix_t in1, const vec4_t in2, vec4_t out )
+void Mat4Transform( const mat4_t in1, const vec4_t in2, vec4_t out )
{
out[ 0] = in1[ 0] * in2[ 0] + in1[ 4] * in2[ 1] + in1[ 8] * in2[ 2] + in1[12] * in2[ 3];
out[ 1] = in1[ 1] * in2[ 0] + in1[ 5] * in2[ 1] + in1[ 9] * in2[ 2] + in1[13] * in2[ 3];
@@ -81,7 +81,7 @@ void Matrix16Transform( const matrix_t in1, const vec4_t in2, vec4_t out )
out[ 3] = in1[ 3] * in2[ 0] + in1[ 7] * in2[ 1] + in1[11] * in2[ 2] + in1[15] * in2[ 3];
}
-qboolean Matrix16Compare( const matrix_t a, const matrix_t b )
+qboolean Mat4Compare( const mat4_t a, const mat4_t b )
{
return !(a[ 0] != b[ 0] || a[ 4] != b[ 4] || a[ 8] != b[ 8] || a[12] != b[12] ||
a[ 1] != b[ 1] || a[ 5] != b[ 5] || a[ 9] != b[ 9] || a[13] != b[13] ||
@@ -89,7 +89,7 @@ qboolean Matrix16Compare( const matrix_t a, const matrix_t b )
a[ 3] != b[ 3] || a[ 7] != b[ 7] || a[11] != b[11] || a[15] != b[15]);
}
-void Matrix16Dump( const matrix_t in )
+void Mat4Dump( const mat4_t in )
{
ri.Printf(PRINT_ALL, "%3.5f %3.5f %3.5f %3.5f\n", in[ 0], in[ 4], in[ 8], in[12]);
ri.Printf(PRINT_ALL, "%3.5f %3.5f %3.5f %3.5f\n", in[ 1], in[ 5], in[ 9], in[13]);
@@ -97,7 +97,7 @@ void Matrix16Dump( const matrix_t in )
ri.Printf(PRINT_ALL, "%3.5f %3.5f %3.5f %3.5f\n", in[ 3], in[ 7], in[11], in[15]);
}
-void Matrix16Translation( vec3_t vec, matrix_t out )
+void Mat4Translation( vec3_t vec, mat4_t out )
{
out[ 0] = 1.0f; out[ 4] = 0.0f; out[ 8] = 0.0f; out[12] = vec[0];
out[ 1] = 0.0f; out[ 5] = 1.0f; out[ 9] = 0.0f; out[13] = vec[1];
@@ -105,7 +105,7 @@ void Matrix16Translation( vec3_t vec, matrix_t out )
out[ 3] = 0.0f; out[ 7] = 0.0f; out[11] = 0.0f; out[15] = 1.0f;
}
-void Matrix16Ortho( float left, float right, float bottom, float top, float znear, float zfar, matrix_t out )
+void Mat4Ortho( float left, float right, float bottom, float top, float znear, float zfar, mat4_t out )
{
out[ 0] = 2.0f / (right - left); out[ 4] = 0.0f; out[ 8] = 0.0f; out[12] = -(right + left) / (right - left);
out[ 1] = 0.0f; out[ 5] = 2.0f / (top - bottom); out[ 9] = 0.0f; out[13] = -(top + bottom) / (top - bottom);
@@ -113,7 +113,7 @@ void Matrix16Ortho( float left, float right, float bottom, float top, float znea
out[ 3] = 0.0f; out[ 7] = 0.0f; out[11] = 0.0f; out[15] = 1.0f;
}
-void Matrix16View(vec3_t axes[3], vec3_t origin, matrix_t out)
+void Mat4View(vec3_t axes[3], vec3_t origin, mat4_t out)
{
out[0] = axes[0][0];
out[1] = axes[1][0];
@@ -136,7 +136,7 @@ void Matrix16View(vec3_t axes[3], vec3_t origin, matrix_t out)
out[15] = 1;
}
-void Matrix16SimpleInverse( const matrix_t in, matrix_t out)
+void Mat4SimpleInverse( const mat4_t in, mat4_t out)
{
vec3_t v;
float invSqrLen;
diff --git a/src/renderergl2/tr_extramath.h b/src/renderergl2/tr_extramath.h
index 509521fa..0be8f6c0 100644
--- a/src/renderergl2/tr_extramath.h
+++ b/src/renderergl2/tr_extramath.h
@@ -24,22 +24,22 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#ifndef __TR_EXTRAMATH_H__
#define __TR_EXTRAMATH_H__
-typedef vec_t matrix_t[16];
-typedef int vec2i_t[2];
-typedef int vec3i_t[3];
-typedef int vec4i_t[4];
-
-void Matrix16Zero( matrix_t out );
-void Matrix16Identity( matrix_t out );
-void Matrix16Copy( const matrix_t in, matrix_t out );
-void Matrix16Multiply( const matrix_t in1, const matrix_t in2, matrix_t out );
-void Matrix16Transform( const matrix_t in1, const vec4_t in2, vec4_t out );
-qboolean Matrix16Compare(const matrix_t a, const matrix_t b);
-void Matrix16Dump( const matrix_t in );
-void Matrix16Translation( vec3_t vec, matrix_t out );
-void Matrix16Ortho( float left, float right, float bottom, float top, float znear, float zfar, matrix_t out );
-void Matrix16View(vec3_t axes[3], vec3_t origin, matrix_t out);
-void Matrix16SimpleInverse( const matrix_t in, matrix_t out);
+typedef vec_t mat4_t[16];
+typedef int ivec2_t[2];
+typedef int ivec3_t[3];
+typedef int ivec4_t[4];
+
+void Mat4Zero( mat4_t out );
+void Mat4Identity( mat4_t out );
+void Mat4Copy( const mat4_t in, mat4_t out );
+void Mat4Multiply( const mat4_t in1, const mat4_t in2, mat4_t out );
+void Mat4Transform( const mat4_t in1, const vec4_t in2, vec4_t out );
+qboolean Mat4Compare(const mat4_t a, const mat4_t b);
+void Mat4Dump( const mat4_t in );
+void Mat4Translation( vec3_t vec, mat4_t out );
+void Mat4Ortho( float left, float right, float bottom, float top, float znear, float zfar, mat4_t out );
+void Mat4View(vec3_t axes[3], vec3_t origin, mat4_t out);
+void Mat4SimpleInverse( const mat4_t in, mat4_t out);
#define VectorCopy2(a,b) ((b)[0]=(a)[0],(b)[1]=(a)[1])
#define VectorSet2(v,x,y) ((v)[0]=(x),(v)[1]=(y));
diff --git a/src/renderergl2/tr_fbo.c b/src/renderergl2/tr_fbo.c
index d9fd917f..35e2b74d 100644
--- a/src/renderergl2/tr_fbo.c
+++ b/src/renderergl2/tr_fbo.c
@@ -651,16 +651,16 @@ void R_FBOList_f(void)
// FIXME
extern void RB_SetGL2D (void);
-void FBO_BlitFromTexture(struct image_s *src, vec4i_t inSrcBox, vec2_t inSrcTexScale, FBO_t *dst, vec4i_t inDstBox, struct shaderProgram_s *shaderProgram, vec4_t inColor, int blend)
+void FBO_BlitFromTexture(struct image_s *src, ivec4_t inSrcBox, vec2_t inSrcTexScale, FBO_t *dst, ivec4_t inDstBox, struct shaderProgram_s *shaderProgram, vec4_t inColor, int blend)
{
- vec4i_t dstBox, srcBox;
+ ivec4_t dstBox, srcBox;
vec2_t srcTexScale;
vec4_t color;
vec4_t quadVerts[4];
vec2_t texCoords[4];
vec2_t invTexRes;
FBO_t *oldFbo = glState.currentFBO;
- matrix_t projection;
+ mat4_t projection;
int width, height;
if (!src)
@@ -741,7 +741,7 @@ void FBO_BlitFromTexture(struct image_s *src, vec4i_t inSrcBox, vec2_t inSrcTexS
qglViewport( 0, 0, width, height );
qglScissor( 0, 0, width, height );
- Matrix16Ortho(0, width, height, 0, 0, 1, projection);
+ Mat4Ortho(0, width, height, 0, 0, 1, projection);
qglDisable( GL_CULL_FACE );
@@ -764,7 +764,7 @@ void FBO_BlitFromTexture(struct image_s *src, vec4i_t inSrcBox, vec2_t inSrcTexS
GLSL_BindProgram(shaderProgram);
- GLSL_SetUniformMatrix16(shaderProgram, UNIFORM_MODELVIEWPROJECTIONMATRIX, projection);
+ GLSL_SetUniformMat4(shaderProgram, UNIFORM_MODELVIEWPROJECTIONMATRIX, projection);
GLSL_SetUniformVec4(shaderProgram, UNIFORM_COLOR, color);
GLSL_SetUniformVec2(shaderProgram, UNIFORM_INVTEXRES, invTexRes);
GLSL_SetUniformVec2(shaderProgram, UNIFORM_AUTOEXPOSUREMINMAX, tr.refdef.autoExposureMinMax);
@@ -775,9 +775,9 @@ void FBO_BlitFromTexture(struct image_s *src, vec4i_t inSrcBox, vec2_t inSrcTexS
FBO_Bind(oldFbo);
}
-void FBO_Blit(FBO_t *src, vec4i_t inSrcBox, vec2_t srcTexScale, FBO_t *dst, vec4i_t dstBox, struct shaderProgram_s *shaderProgram, vec4_t color, int blend)
+void FBO_Blit(FBO_t *src, ivec4_t inSrcBox, vec2_t srcTexScale, FBO_t *dst, ivec4_t dstBox, struct shaderProgram_s *shaderProgram, vec4_t color, int blend)
{
- vec4i_t srcBox;
+ ivec4_t srcBox;
if (!src)
{
@@ -801,9 +801,9 @@ void FBO_Blit(FBO_t *src, vec4i_t inSrcBox, vec2_t srcTexScale, FBO_t *dst, vec4
FBO_BlitFromTexture(src->colorImage[0], srcBox, srcTexScale, dst, dstBox, shaderProgram, color, blend | GLS_DEPTHTEST_DISABLE);
}
-void FBO_FastBlit(FBO_t *src, vec4i_t srcBox, FBO_t *dst, vec4i_t dstBox, int buffers, int filter)
+void FBO_FastBlit(FBO_t *src, ivec4_t srcBox, FBO_t *dst, ivec4_t dstBox, int buffers, int filter)
{
- vec4i_t srcBoxFinal, dstBoxFinal;
+ ivec4_t srcBoxFinal, dstBoxFinal;
GLuint srcFb, dstFb;
if (!glRefConfig.framebufferBlit)
diff --git a/src/renderergl2/tr_fbo.h b/src/renderergl2/tr_fbo.h
index 2bd302ad..530fee5c 100644
--- a/src/renderergl2/tr_fbo.h
+++ b/src/renderergl2/tr_fbo.h
@@ -56,9 +56,9 @@ void FBO_Bind(FBO_t *fbo);
void FBO_Init(void);
void FBO_Shutdown(void);
-void FBO_BlitFromTexture(struct image_s *src, vec4i_t srcBox, vec2_t srcTexScale, FBO_t *dst, vec4i_t dstBox, struct shaderProgram_s *shaderProgram, vec4_t color, int blend);
-void FBO_Blit(FBO_t *src, vec4i_t srcBox, vec2_t srcTexScale, FBO_t *dst, vec4i_t dstBox, struct shaderProgram_s *shaderProgram, vec4_t color, int blend);
-void FBO_FastBlit(FBO_t *src, vec4i_t srcBox, FBO_t *dst, vec4i_t dstBox, int buffers, int filter);
+void FBO_BlitFromTexture(struct image_s *src, ivec4_t srcBox, vec2_t srcTexScale, FBO_t *dst, ivec4_t dstBox, struct shaderProgram_s *shaderProgram, vec4_t color, int blend);
+void FBO_Blit(FBO_t *src, ivec4_t srcBox, vec2_t srcTexScale, FBO_t *dst, ivec4_t dstBox, struct shaderProgram_s *shaderProgram, vec4_t color, int blend);
+void FBO_FastBlit(FBO_t *src, ivec4_t srcBox, FBO_t *dst, ivec4_t dstBox, int buffers, int filter);
#endif
diff --git a/src/renderergl2/tr_flares.c b/src/renderergl2/tr_flares.c
index 4ac81329..76abbdd7 100644
--- a/src/renderergl2/tr_flares.c
+++ b/src/renderergl2/tr_flares.c
@@ -459,7 +459,7 @@ void RB_RenderFlares (void) {
flare_t *f;
flare_t **prev;
qboolean draw;
- matrix_t oldmodelview, oldprojection, matrix;
+ mat4_t oldmodelview, oldprojection, matrix;
if ( !r_flares->integer ) {
return;
@@ -517,11 +517,11 @@ void RB_RenderFlares (void) {
qglDisable (GL_CLIP_PLANE0);
}
- Matrix16Copy(glState.projection, oldprojection);
- Matrix16Copy(glState.modelview, oldmodelview);
- Matrix16Identity(matrix);
+ Mat4Copy(glState.projection, oldprojection);
+ Mat4Copy(glState.modelview, oldmodelview);
+ Mat4Identity(matrix);
GL_SetModelviewMatrix(matrix);
- Matrix16Ortho( backEnd.viewParms.viewportX, backEnd.viewParms.viewportX + backEnd.viewParms.viewportWidth,
+ Mat4Ortho( backEnd.viewParms.viewportX, backEnd.viewParms.viewportX + backEnd.viewParms.viewportWidth,
backEnd.viewParms.viewportY, backEnd.viewParms.viewportY + backEnd.viewParms.viewportHeight,
-99999, 99999, matrix );
GL_SetProjectionMatrix(matrix);
diff --git a/src/renderergl2/tr_glsl.c b/src/renderergl2/tr_glsl.c
index d0573b97..42ce225e 100644
--- a/src/renderergl2/tr_glsl.c
+++ b/src/renderergl2/tr_glsl.c
@@ -809,7 +809,7 @@ void GLSL_SetUniformFloat5(shaderProgram_t *program, int uniformNum, const vec5_
qglUniform1fvARB(uniforms[uniformNum], 5, v);
}
-void GLSL_SetUniformMatrix16(shaderProgram_t *program, int uniformNum, const matrix_t matrix)
+void GLSL_SetUniformMat4(shaderProgram_t *program, int uniformNum, const mat4_t matrix)
{
GLint *uniforms = program->uniforms;
vec_t *compare = (float *)(program->uniformBuffer + program->uniformBufferOffsets[uniformNum]);
@@ -819,16 +819,16 @@ void GLSL_SetUniformMatrix16(shaderProgram_t *program, int uniformNum, const mat
if (uniformsInfo[uniformNum].type != GLSL_MAT16)
{
- ri.Printf( PRINT_WARNING, "GLSL_SetUniformMatrix16: wrong type for uniform %i in program %s\n", uniformNum, program->name);
+ ri.Printf( PRINT_WARNING, "GLSL_SetUniformMat4: wrong type for uniform %i in program %s\n", uniformNum, program->name);
return;
}
- if (Matrix16Compare(matrix, compare))
+ if (Mat4Compare(matrix, compare))
{
return;
}
- Matrix16Copy(matrix, compare);
+ Mat4Copy(matrix, compare);
qglUniformMatrix4fvARB(uniforms[uniformNum], 1, GL_FALSE, matrix);
}
diff --git a/src/renderergl2/tr_local.h b/src/renderergl2/tr_local.h
index 557b285e..158d29dc 100644
--- a/src/renderergl2/tr_local.h
+++ b/src/renderergl2/tr_local.h
@@ -1455,9 +1455,9 @@ typedef struct {
FBO_t *currentFBO;
VBO_t *currentVBO;
IBO_t *currentIBO;
- matrix_t modelview;
- matrix_t projection;
- matrix_t modelviewProjection;
+ mat4_t modelview;
+ mat4_t projection;
+ mat4_t modelviewProjection;
} glstate_t;
typedef enum {
@@ -1966,8 +1966,8 @@ void GL_TextureMode( const char *string );
void GL_CheckErrs( char *file, int line );
#define GL_CheckErrors(...) GL_CheckErrs(__FILE__, __LINE__)
void GL_State( unsigned long stateVector );
-void GL_SetProjectionMatrix(matrix_t matrix);
-void GL_SetModelviewMatrix(matrix_t matrix);
+void GL_SetProjectionMatrix(mat4_t matrix);
+void GL_SetModelviewMatrix(mat4_t matrix);
void GL_TexEnv( int env );
void GL_Cull( int cullType );
@@ -2298,7 +2298,7 @@ void GLSL_SetUniformFloat5(shaderProgram_t *program, int uniformNum, const vec5_
void GLSL_SetUniformVec2(shaderProgram_t *program, int uniformNum, const vec2_t v);
void GLSL_SetUniformVec3(shaderProgram_t *program, int uniformNum, const vec3_t v);
void GLSL_SetUniformVec4(shaderProgram_t *program, int uniformNum, const vec4_t v);
-void GLSL_SetUniformMatrix16(shaderProgram_t *program, int uniformNum, const matrix_t matrix);
+void GLSL_SetUniformMat4(shaderProgram_t *program, int uniformNum, const mat4_t matrix);
shaderProgram_t *GLSL_GetGenericShaderProgram(int stage);
diff --git a/src/renderergl2/tr_main.c b/src/renderergl2/tr_main.c
index 5973b9b5..ef1a7444 100644
--- a/src/renderergl2/tr_main.c
+++ b/src/renderergl2/tr_main.c
@@ -841,7 +841,7 @@ void R_RotateForEntity( const trRefEntity_t *ent, const viewParms_t *viewParms,
glMatrix[11] = 0;
glMatrix[15] = 1;
- Matrix16Copy(glMatrix, or->transformMatrix);
+ Mat4Copy(glMatrix, or->transformMatrix);
myGlMultMatrix( glMatrix, viewParms->world.modelMatrix, or->modelMatrix );
// calculate the viewer origin in the model's space
@@ -2635,7 +2635,7 @@ void R_RenderSunShadowMaps(const refdef_t *fd, int level)
// Create bounds for light projection using slice of view projection
{
- matrix_t lightViewMatrix;
+ mat4_t lightViewMatrix;
vec4_t point, base, lightViewPoint;
float lx, ly;
@@ -2643,7 +2643,7 @@ void R_RenderSunShadowMaps(const refdef_t *fd, int level)
point[3] = 1;
lightViewPoint[3] = 1;
- Matrix16View(lightViewAxis, lightOrigin, lightViewMatrix);
+ Mat4View(lightViewAxis, lightOrigin, lightViewMatrix);
ClearBounds(lightviewBounds[0], lightviewBounds[1]);
@@ -2654,22 +2654,22 @@ void R_RenderSunShadowMaps(const refdef_t *fd, int level)
VectorMA(base, lx, fd->viewaxis[1], point);
VectorMA(point, ly, fd->viewaxis[2], point);
- Matrix16Transform(lightViewMatrix, point, lightViewPoint);
+ Mat4Transform(lightViewMatrix, point, lightViewPoint);
AddPointToBounds(lightViewPoint, lightviewBounds[0], lightviewBounds[1]);
VectorMA(base, -lx, fd->viewaxis[1], point);
VectorMA(point, ly, fd->viewaxis[2], point);
- Matrix16Transform(lightViewMatrix, point, lightViewPoint);
+ Mat4Transform(lightViewMatrix, point, lightViewPoint);
AddPointToBounds(lightViewPoint, lightviewBounds[0], lightviewBounds[1]);
VectorMA(base, lx, fd->viewaxis[1], point);
VectorMA(point, -ly, fd->viewaxis[2], point);
- Matrix16Transform(lightViewMatrix, point, lightViewPoint);
+ Mat4Transform(lightViewMatrix, point, lightViewPoint);
AddPointToBounds(lightViewPoint, lightviewBounds[0], lightviewBounds[1]);
VectorMA(base, -lx, fd->viewaxis[1], point);
VectorMA(point, -ly, fd->viewaxis[2], point);
- Matrix16Transform(lightViewMatrix, point, lightViewPoint);
+ Mat4Transform(lightViewMatrix, point, lightViewPoint);
AddPointToBounds(lightViewPoint, lightviewBounds[0], lightviewBounds[1]);
@@ -2680,22 +2680,22 @@ void R_RenderSunShadowMaps(const refdef_t *fd, int level)
VectorMA(base, lx, fd->viewaxis[1], point);
VectorMA(point, ly, fd->viewaxis[2], point);
- Matrix16Transform(lightViewMatrix, point, lightViewPoint);
+ Mat4Transform(lightViewMatrix, point, lightViewPoint);
AddPointToBounds(lightViewPoint, lightviewBounds[0], lightviewBounds[1]);
VectorMA(base, -lx, fd->viewaxis[1], point);
VectorMA(point, ly, fd->viewaxis[2], point);
- Matrix16Transform(lightViewMatrix, point, lightViewPoint);
+ Mat4Transform(lightViewMatrix, point, lightViewPoint);
AddPointToBounds(lightViewPoint, lightviewBounds[0], lightviewBounds[1]);
VectorMA(base, lx, fd->viewaxis[1], point);
VectorMA(point, -ly, fd->viewaxis[2], point);
- Matrix16Transform(lightViewMatrix, point, lightViewPoint);
+ Mat4Transform(lightViewMatrix, point, lightViewPoint);
AddPointToBounds(lightViewPoint, lightviewBounds[0], lightviewBounds[1]);
VectorMA(base, -lx, fd->viewaxis[1], point);
VectorMA(point, -ly, fd->viewaxis[2], point);
- Matrix16Transform(lightViewMatrix, point, lightViewPoint);
+ Mat4Transform(lightViewMatrix, point, lightViewPoint);
AddPointToBounds(lightViewPoint, lightviewBounds[0], lightviewBounds[1]);
if (!glRefConfig.depthClamp)
@@ -2793,7 +2793,7 @@ void R_RenderSunShadowMaps(const refdef_t *fd, int level)
R_SortDrawSurfs( tr.refdef.drawSurfs + firstDrawSurf, tr.refdef.numDrawSurfs - firstDrawSurf );
}
- Matrix16Multiply(tr.viewParms.projectionMatrix, tr.viewParms.world.modelMatrix, tr.refdef.sunShadowMvp[level]);
+ Mat4Multiply(tr.viewParms.projectionMatrix, tr.viewParms.world.modelMatrix, tr.refdef.sunShadowMvp[level]);
}
}
diff --git a/src/renderergl2/tr_postprocess.c b/src/renderergl2/tr_postprocess.c
index dba19d4a..35982fce 100644
--- a/src/renderergl2/tr_postprocess.c
+++ b/src/renderergl2/tr_postprocess.c
@@ -22,9 +22,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "tr_local.h"
-void RB_ToneMap(FBO_t *hdrFbo, vec4i_t hdrBox, FBO_t *ldrFbo, vec4i_t ldrBox, int autoExposure)
+void RB_ToneMap(FBO_t *hdrFbo, ivec4_t hdrBox, FBO_t *ldrFbo, ivec4_t ldrBox, int autoExposure)
{
- vec4i_t srcBox, dstBox;
+ ivec4_t srcBox, dstBox;
vec4_t color;
static int lastFrameCount = 0;
@@ -103,9 +103,9 @@ Blurs a part of one framebuffer to another.
Framebuffers can be identical.
=============
*/
-void RB_BokehBlur(FBO_t *src, vec4i_t srcBox, FBO_t *dst, vec4i_t dstBox, float blur)
+void RB_BokehBlur(FBO_t *src, ivec4_t srcBox, FBO_t *dst, ivec4_t dstBox, float blur)
{
-// vec4i_t srcBox, dstBox;
+// ivec4_t srcBox, dstBox;
vec4_t color;
blur *= 10.0f;
@@ -118,7 +118,7 @@ void RB_BokehBlur(FBO_t *src, vec4i_t srcBox, FBO_t *dst, vec4i_t dstBox, float
// bokeh blur
if (blur > 0.0f)
{
- vec4i_t quarterBox;
+ ivec4_t quarterBox;
quarterBox[0] = 0;
quarterBox[1] = tr.quarterFbo[0]->height;
@@ -226,7 +226,7 @@ void RB_BokehBlur(FBO_t *src, vec4i_t srcBox, FBO_t *dst, vec4i_t dstBox, float
static void RB_RadialBlur(FBO_t *srcFbo, FBO_t *dstFbo, int passes, float stretch, float x, float y, float w, float h, float xcenter, float ycenter, float alpha)
{
- vec4i_t srcBox, dstBox;
+ ivec4_t srcBox, dstBox;
vec4_t color;
const float inc = 1.f / passes;
const float mul = powf(stretch, inc);
@@ -308,7 +308,7 @@ static qboolean RB_UpdateSunFlareVis(void)
return sampleCount > 0;
}
-void RB_SunRays(FBO_t *srcFbo, vec4i_t srcBox, FBO_t *dstFbo, vec4i_t dstBox)
+void RB_SunRays(FBO_t *srcFbo, ivec4_t srcBox, FBO_t *dstFbo, ivec4_t dstBox)
{
vec4_t color;
float dot;
@@ -316,7 +316,7 @@ void RB_SunRays(FBO_t *srcFbo, vec4i_t srcBox, FBO_t *dstFbo, vec4i_t dstBox)
qboolean colorize = qtrue;
// float w, h, w2, h2;
- matrix_t mvp;
+ mat4_t mvp;
vec4_t pos, hpos;
dot = DotProduct(tr.sunDirection, backEnd.viewParms.or.axis[0]);
@@ -329,11 +329,11 @@ void RB_SunRays(FBO_t *srcFbo, vec4i_t srcBox, FBO_t *dstFbo, vec4i_t dstBox)
// From RB_DrawSun()
{
float dist;
- matrix_t trans, model, mvp;
+ mat4_t trans, model, mvp;
- Matrix16Translation( backEnd.viewParms.or.origin, trans );
- Matrix16Multiply( backEnd.viewParms.world.modelMatrix, trans, model );
- Matrix16Multiply(backEnd.viewParms.projectionMatrix, model, mvp);
+ Mat4Translation( backEnd.viewParms.or.origin, trans );
+ Mat4Multiply( backEnd.viewParms.world.modelMatrix, trans, model );
+ Mat4Multiply(backEnd.viewParms.projectionMatrix, model, mvp);
dist = backEnd.viewParms.zFar / 1.75; // div sqrt(3)
@@ -341,8 +341,8 @@ void RB_SunRays(FBO_t *srcFbo, vec4i_t srcBox, FBO_t *dstFbo, vec4i_t dstBox)
}
// project sun point
- //Matrix16Multiply(backEnd.viewParms.projectionMatrix, backEnd.viewParms.world.modelMatrix, mvp);
- Matrix16Transform(mvp, pos, hpos);
+ //Mat4Multiply(backEnd.viewParms.projectionMatrix, backEnd.viewParms.world.modelMatrix, mvp);
+ Mat4Transform(mvp, pos, hpos);
// transform to UV coords
hpos[3] = 0.5f / hpos[3];
@@ -354,7 +354,7 @@ void RB_SunRays(FBO_t *srcFbo, vec4i_t srcBox, FBO_t *dstFbo, vec4i_t dstBox)
{
float mul = 1.f;
vec2_t texScale;
- vec4i_t rayBox, quarterBox;
+ ivec4_t rayBox, quarterBox;
texScale[0] =
texScale[1] = 1.0f;
@@ -441,7 +441,7 @@ static void RB_BlurAxis(FBO_t *srcFbo, FBO_t *dstFbo, float strength, qboolean h
ymul *= strength;
{
- vec4i_t srcBox, dstBox;
+ ivec4_t srcBox, dstBox;
vec4_t color;
vec2_t texScale;
@@ -490,7 +490,7 @@ void RB_GaussianBlur(float blur)
return;
{
- vec4i_t srcBox, dstBox;
+ ivec4_t srcBox, dstBox;
vec4_t color;
vec2_t texScale;
diff --git a/src/renderergl2/tr_postprocess.h b/src/renderergl2/tr_postprocess.h
index 6c34ecc2..09daf134 100644
--- a/src/renderergl2/tr_postprocess.h
+++ b/src/renderergl2/tr_postprocess.h
@@ -25,9 +25,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "tr_fbo.h"
-void RB_ToneMap(FBO_t *hdrFbo, vec4i_t hdrBox, FBO_t *ldrFbo, vec4i_t ldrBox, int autoExposure);
-void RB_BokehBlur(FBO_t *src, vec4i_t srcBox, FBO_t *dst, vec4i_t dstBox, float blur);
-void RB_SunRays(FBO_t *srcFbo, vec4i_t srcBox, FBO_t *dstFbo, vec4i_t dstBox);
+void RB_ToneMap(FBO_t *hdrFbo, ivec4_t hdrBox, FBO_t *ldrFbo, ivec4_t ldrBox, int autoExposure);
+void RB_BokehBlur(FBO_t *src, ivec4_t srcBox, FBO_t *dst, ivec4_t dstBox, float blur);
+void RB_SunRays(FBO_t *srcFbo, ivec4_t srcBox, FBO_t *dstFbo, ivec4_t dstBox);
void RB_GaussianBlur(float blur);
#endif
diff --git a/src/renderergl2/tr_sky.c b/src/renderergl2/tr_sky.c
index cb3b9434..291bd7fb 100644
--- a/src/renderergl2/tr_sky.c
+++ b/src/renderergl2/tr_sky.c
@@ -430,7 +430,7 @@ static void DrawSkySide( struct image_s *image, const int mins[2], const int max
GLSL_VertexAttribsState(ATTR_POSITION | ATTR_TEXCOORD);
GLSL_BindProgram(sp);
- GLSL_SetUniformMatrix16(sp, UNIFORM_MODELVIEWPROJECTIONMATRIX, glState.modelviewProjection);
+ GLSL_SetUniformMat4(sp, UNIFORM_MODELVIEWPROJECTIONMATRIX, glState.modelviewProjection);
color[0] =
color[1] =
@@ -446,7 +446,7 @@ static void DrawSkySide( struct image_s *image, const int mins[2], const int max
GLSL_VertexAttribsState(ATTR_POSITION | ATTR_TEXCOORD);
GLSL_BindProgram(sp);
- GLSL_SetUniformMatrix16(sp, UNIFORM_MODELVIEWPROJECTIONMATRIX, glState.modelviewProjection);
+ GLSL_SetUniformMat4(sp, UNIFORM_MODELVIEWPROJECTIONMATRIX, glState.modelviewProjection);
color[0] =
color[1] =
@@ -807,10 +807,10 @@ void RB_DrawSun( float scale, shader_t *shader ) {
//qglTranslatef (backEnd.viewParms.or.origin[0], backEnd.viewParms.or.origin[1], backEnd.viewParms.or.origin[2]);
{
// FIXME: this could be a lot cleaner
- matrix_t translation, modelview;
+ mat4_t translation, modelview;
- Matrix16Translation( backEnd.viewParms.or.origin, translation );
- Matrix16Multiply( backEnd.viewParms.world.modelMatrix, translation, modelview );
+ Mat4Translation( backEnd.viewParms.or.origin, translation );
+ Mat4Multiply( backEnd.viewParms.world.modelMatrix, translation, modelview );
GL_SetModelviewMatrix( modelview );
}
@@ -870,18 +870,18 @@ void RB_StageIteratorSky( void ) {
// draw the outer skybox
if ( tess.shader->sky.outerbox[0] && tess.shader->sky.outerbox[0] != tr.defaultImage ) {
- matrix_t oldmodelview;
+ mat4_t oldmodelview;
GL_State( 0 );
//qglTranslatef (backEnd.viewParms.or.origin[0], backEnd.viewParms.or.origin[1], backEnd.viewParms.or.origin[2]);
{
// FIXME: this could be a lot cleaner
- matrix_t trans, product;
+ mat4_t trans, product;
- Matrix16Copy( glState.modelview, oldmodelview );
- Matrix16Translation( backEnd.viewParms.or.origin, trans );
- Matrix16Multiply( glState.modelview, trans, product );
+ Mat4Copy( glState.modelview, oldmodelview );
+ Mat4Translation( backEnd.viewParms.or.origin, trans );
+ Mat4Multiply( glState.modelview, trans, product );
GL_SetModelviewMatrix( product );
}