Merge branch 'master' into sdl2

This commit is contained in:
Zack Middleton 2013-11-26 16:57:10 -06:00
commit ad514c9689
20 changed files with 515 additions and 439 deletions

View file

@ -39,7 +39,7 @@ renamed to id-readme.txt so as to prevent confusion. Please refer to the
web-site for updated status. web-site for updated status.
--------------------------------------------- Compilation and installation ----- # Compilation and installation
For *nix For *nix
1. Change to the directory containing this readme. 1. Change to the directory containing this readme.
@ -73,6 +73,7 @@ x86_64.
The following variables may be set, either on the command line or in The following variables may be set, either on the command line or in
Makefile.local: Makefile.local:
```
CFLAGS - use this for custom CFLAGS CFLAGS - use this for custom CFLAGS
V - set to show cc command line when building V - set to show cc command line when building
DEFAULT_BASEDIR - extra path to search for baseq3 and such DEFAULT_BASEDIR - extra path to search for baseq3 and such
@ -108,13 +109,16 @@ Makefile.local:
DEBUG_CFLAGS - C compiler flags to use for building debug version DEBUG_CFLAGS - C compiler flags to use for building debug version
COPYDIR - the target installation directory COPYDIR - the target installation directory
TEMPDIR - specify user defined directory for temp files TEMPDIR - specify user defined directory for temp files
```
The defaults for these variables differ depending on the target platform. The defaults for these variables differ depending on the target platform.
------------------------------------------------------------------ Console ----- # Console
New cvars ## New cvars
```
cl_autoRecordDemo - record a new demo on each map change cl_autoRecordDemo - record a new demo on each map change
cl_aviFrameRate - the framerate to use when capturing video cl_aviFrameRate - the framerate to use when capturing video
cl_aviMotionJpeg - use the mjpeg codec when capturing video cl_aviMotionJpeg - use the mjpeg codec when capturing video
@ -271,8 +275,11 @@ New cvars
cl_aviMotionJpeg is enabled cl_aviMotionJpeg is enabled
r_mode -2 - This new video mode automatically uses the r_mode -2 - This new video mode automatically uses the
desktop resolution. desktop resolution.
```
New commands ## New commands
```
video [filename] - start video capture (use with demo command) video [filename] - start video capture (use with demo command)
stopvideo - stop video capture stopvideo - stop video capture
stopmusic - stop background music stopmusic - stop background music
@ -307,15 +314,18 @@ New commands
all bots even if someone is named "allbots") all bots even if someone is named "allbots")
tell <client num> <msg> - send message to a single client (new to server) tell <client num> <msg> - send message to a single client (new to server)
```
--------------------------------------------------------- README for Users ----- # README for Users
## Using shared libraries instead of qvm
Using shared libraries instead of qvm
To force Q3 to use shared libraries instead of qvms run it with the following To force Q3 to use shared libraries instead of qvms run it with the following
parameters: +set sv_pure 0 +set vm_cgame 0 +set vm_game 0 +set vm_ui 0 parameters: `+set sv_pure 0 +set vm_cgame 0 +set vm_game 0 +set vm_ui 0`
## Using Demo Data Files
Using Demo Data Files
Copy demoq3/pak0.pk3 from the demo installer to your baseq3 directory. The Copy demoq3/pak0.pk3 from the demo installer to your baseq3 directory. The
qvm files in this pak0.pk3 will not work, so you have to use the native qvm files in this pak0.pk3 will not work, so you have to use the native
shared libraries or qvms from this project. To use the new qvms, they must be shared libraries or qvms from this project. To use the new qvms, they must be
@ -327,7 +337,8 @@ Using Demo Data Files
data, nor is it something that we like to spend much time maintaining or data, nor is it something that we like to spend much time maintaining or
supporting. supporting.
Help! Ioquake3 won't give me an fps of X anymore when setting com_maxfps! ## Help! Ioquake3 won't give me an fps of X anymore when setting com_maxfps!
Ioquake3 now uses the select() system call to wait for the rendering of the Ioquake3 now uses the select() system call to wait for the rendering of the
next frame when com_maxfps was hit. This will improve your CPU load next frame when com_maxfps was hit. This will improve your CPU load
considerably in these cases. However, not all systems may support a considerably in these cases. However, not all systems may support a
@ -337,7 +348,8 @@ Help! Ioquake3 won't give me an fps of X anymore when setting com_maxfps!
In this case you can always revert back to the old behaviour by setting the In this case you can always revert back to the old behaviour by setting the
cvar com_busyWait to 1. cvar com_busyWait to 1.
Using HTTP/FTP Download Support (Server) ## Using HTTP/FTP Download Support (Server)
You can enable redirected downloads on your server even if it's not You can enable redirected downloads on your server even if it's not
an ioquake3 server. You simply need to use the 'sets' command to put an ioquake3 server. You simply need to use the 'sets' command to put
the sv_dlURL cvar into your SERVERINFO string and ensure sv_allowDownloads the sv_dlURL cvar into your SERVERINFO string and ensure sv_allowDownloads
@ -346,19 +358,20 @@ Using HTTP/FTP Download Support (Server)
sv_dlURL is the base of the URL that contains your custom .pk3 files sv_dlURL is the base of the URL that contains your custom .pk3 files
the client will append both fs_game and the filename to the end of the client will append both fs_game and the filename to the end of
this value. For example, if you have sv_dlURL set to this value. For example, if you have sv_dlURL set to
"http://ioquake3.org", fs_game is "baseq3", and the client is `"http://ioquake3.org"`, fs_game is `"baseq3"`, and the client is
missing "test.pk3", it will attempt to download from the URL missing `"test.pk3"`, it will attempt to download from the URL
"http://ioquake3.org/baseq3/test.pk3" `"http://ioquake3.org/baseq3/test.pk3"`
sv_allowDownload's value is now a bitmask made up of the following sv_allowDownload's value is now a bitmask made up of the following
flags: flags:
1 - ENABLE
4 - do not use UDP downloads * 1 - ENABLE
8 - do not ask the client to disconnect when using HTTP/FTP * 4 - do not use UDP downloads
* 8 - do not ask the client to disconnect when using HTTP/FTP
Server operators who are concerned about potential "leeching" from their Server operators who are concerned about potential "leeching" from their
HTTP servers from other ioquake3 servers can make use of the HTTP_REFERER HTTP servers from other ioquake3 servers can make use of the HTTP_REFERER
that ioquake3 sets which is "ioQ3://{SERVER_IP}:{SERVER_PORT}". For, that ioquake3 sets which is `"ioQ3://{SERVER_IP}:{SERVER_PORT}"`. For,
example, Apache's mod_rewrite can restrict access based on HTTP_REFERER. example, Apache's mod_rewrite can restrict access based on HTTP_REFERER.
On a sidenote, downloading via UDP has been improved and yields higher data On a sidenote, downloading via UDP has been improved and yields higher data
@ -366,46 +379,58 @@ Using HTTP/FTP Download Support (Server)
cvar sv_dlRate. Due to system-specific limits the download rate is capped cvar sv_dlRate. Due to system-specific limits the download rate is capped
at about 1 Mbyte/s per client, so curl downloading may still be faster. at about 1 Mbyte/s per client, so curl downloading may still be faster.
Using HTTP/FTP Download Support (Client) ## Using HTTP/FTP Download Support (Client)
Simply setting cl_allowDownload to 1 will enable HTTP/FTP downloads Simply setting cl_allowDownload to 1 will enable HTTP/FTP downloads
assuming ioquake3 was compiled with USE_CURL=1 (the default). assuming ioquake3 was compiled with USE_CURL=1 (the default).
like sv_allowDownload, cl_allowDownload also uses a bitmask value like sv_allowDownload, cl_allowDownload also uses a bitmask value
supporting the following flags: supporting the following flags:
1 - ENABLE
2 - do not use HTTP/FTP downloads * 1 - ENABLE
4 - do not use UDP downloads * 2 - do not use HTTP/FTP downloads
* 4 - do not use UDP downloads
When ioquake3 is built with USE_CURL_DLOPEN=1 (default on some platforms), When ioquake3 is built with USE_CURL_DLOPEN=1 (default on some platforms),
it will use the value of the cvar cl_cURLLib as the filename of the cURL it will use the value of the cvar cl_cURLLib as the filename of the cURL
library to dynamically load. library to dynamically load.
Multiuser Support on Windows systems ## Multiuser Support on Windows systems
On Windows, all user specific files such as autogenerated configuration, On Windows, all user specific files such as autogenerated configuration,
demos, videos, screenshots, and autodownloaded pk3s are now saved in a demos, videos, screenshots, and autodownloaded pk3s are now saved in a
directory specific to the user who is running ioquake3. directory specific to the user who is running ioquake3.
On NT-based such as Windows XP, this is usually a directory named: On NT-based such as Windows XP, this is usually a directory named:
"C:\Documents and Settings\%USERNAME%\Application Data\Quake3\"
C:\Documents and Settings\%USERNAME%\Application Data\Quake3\
Windows 95, Windows 98, and Windows ME will use a directory like: Windows 95, Windows 98, and Windows ME will use a directory like:
"C:\Windows\Application Data\Quake3"
C:\Windows\Application Data\Quake3
in single-user mode, or: in single-user mode, or:
"C:\Windows\Profiles\%USERNAME%\Application Data\Quake3"
C:\Windows\Profiles\%USERNAME%\Application Data\Quake3
if multiple logins have been enabled. if multiple logins have been enabled.
In order to access this directory more easily, the installer may create a In order to access this directory more easily, the installer may create a
Shortcut which has its target set to: Shortcut which has its target set to:
"%APPDATA%\Quake3\"
%APPDATA%\Quake3\
This Shortcut would work for all users on the system regardless of the This Shortcut would work for all users on the system regardless of the
locale settings. Unfortunately, this environment variable is only locale settings. Unfortunately, this environment variable is only
present on Windows NT based systems. present on Windows NT based systems.
You can revert to the old single-user behaviour by setting the fs_homepath You can revert to the old single-user behaviour by setting the fs_homepath
cvar to the directory where ioquake3 is installed. For example: cvar to the directory where ioquake3 is installed. For example:
ioquake3.exe +set fs_homepath "c:\ioquake3" ioquake3.exe +set fs_homepath "c:\ioquake3"
Note that this cvar MUST be set as a command line parameter. Note that this cvar MUST be set as a command line parameter.
SDL Keyboard Differences ## SDL Keyboard Differences
ioquake3 clients have different keyboard behaviour compared to the original ioquake3 clients have different keyboard behaviour compared to the original
Quake3 clients. Quake3 clients.
@ -445,7 +470,9 @@ SDL Keyboard Differences
text. Also, in addition to the nominated console keys, Shift-ESC is hard text. Also, in addition to the nominated console keys, Shift-ESC is hard
coded to always toggle the console. coded to always toggle the console.
QuakeLive mouse acceleration (patch and this text written by TTimo from id) ## QuakeLive mouse acceleration
(patch and this text written by TTimo from id)
I've been using an experimental mouse acceleration code for a while, and I've been using an experimental mouse acceleration code for a while, and
decided to make it available to everyone. Don't be too worried if you don't decided to make it available to everyone. Don't be too worried if you don't
understand the explanations below, this is mostly intended for advanced understand the explanations below, this is mostly intended for advanced
@ -491,15 +518,17 @@ QuakeLive mouse acceleration (patch and this text written by TTimo from id)
interested by your feedback. interested by your feedback.
---------------------------------------------------- README for Developers ----- # README for Developers
## pk3dir
pk3dir
ioquake3 has a useful new feature for mappers. Paths in a game directory with ioquake3 has a useful new feature for mappers. Paths in a game directory with
the extension ".pk3dir" are treated like pk3 files. This means you can keep the extension ".pk3dir" are treated like pk3 files. This means you can keep
all files specific to your map in one directory tree and easily zip this all files specific to your map in one directory tree and easily zip this
folder for distribution. folder for distribution.
64bit mods ## 64bit mods
If you wish to compile external mods as shared libraries on a 64bit platform, If you wish to compile external mods as shared libraries on a 64bit platform,
and the mod source is derived from the id Q3 SDK, you will need to modify the and the mod source is derived from the id Q3 SDK, you will need to modify the
interface code a little. Open the files ending in _syscalls.c and change interface code a little. Open the files ending in _syscalls.c and change
@ -519,14 +548,16 @@ pk3dir
Note if you simply wish to run mods on a 64bit platform you do not need to Note if you simply wish to run mods on a 64bit platform you do not need to
recompile anything since by default Q3 uses a virtual machine system. recompile anything since by default Q3 uses a virtual machine system.
Creating mods compatible with Q3 1.32b ## Creating mods compatible with Q3 1.32b
If you're using this package to create mods for the last official release of If you're using this package to create mods for the last official release of
Q3, it is necessary to pass the commandline option '-vq3' to your invocation Q3, it is necessary to pass the commandline option '-vq3' to your invocation
of q3asm. This is because by default q3asm outputs an updated qvm format that of q3asm. This is because by default q3asm outputs an updated qvm format that
is necessary to fix a bug involving the optimizing pass of the x86 vm JIT is necessary to fix a bug involving the optimizing pass of the x86 vm JIT
compiler. compiler.
Creating standalone games ## Creating standalone games
Have you finished the daunting task of removing all dependencies on the Q3 Have you finished the daunting task of removing all dependencies on the Q3
game data? You probably now want to give your users the opportunity to play game data? You probably now want to give your users the opportunity to play
the game without owning a copy of Q3, which consequently means removing cd-key the game without owning a copy of Q3, which consequently means removing cd-key
@ -568,13 +599,14 @@ Creating standalone games
+set com_basegame basefoo +set com_homepath .foo +set com_basegame basefoo +set com_homepath .foo
+set com_gamename foo +set com_gamename foo
If you really changed parts that would make vanilla ioquake3 incompatible with If you really changed parts that would make vanilla ioquake3 incompatible with
your mod, we have included another way to conveniently build a stand-alone your mod, we have included another way to conveniently build a stand-alone
binary. Just run make with the option BUILD_STANDALONE=1. Don't forget to edit binary. Just run make with the option BUILD_STANDALONE=1. Don't forget to edit
the PRODUCT_NAME and subsequent #defines in qcommon/q_shared.h with the PRODUCT_NAME and subsequent #defines in qcommon/q_shared.h with
information appropriate for your project. information appropriate for your project.
## Standalone game licensing
While a lot of work has been put into ioquake3 that you can benefit from free While a lot of work has been put into ioquake3 that you can benefit from free
of charge, it does not mean that you have no obligations to fulfill. Please be of charge, it does not mean that you have no obligations to fulfill. Please be
aware that as soon as you start distributing your game with an engine based on aware that as soon as you start distributing your game with an engine based on
@ -598,7 +630,8 @@ Creating standalone games
maps) created by yourself are your property and can be sold like every other maps) created by yourself are your property and can be sold like every other
game you find in stores. game you find in stores.
Network protocols ## Network protocols
There are now two cvars that give you some degree of freedom over the reported There are now two cvars that give you some degree of freedom over the reported
protocol versions between clients and servers: "com_protocol" and protocol versions between clients and servers: "com_protocol" and
"com_legacyprotocol". "com_legacyprotocol".
@ -627,7 +660,8 @@ Network protocols
game you can still enable it in q_shared.h by defining game you can still enable it in q_shared.h by defining
LEGACY_PROTOCOL. LEGACY_PROTOCOL.
cl_guid Support ## cl_guid Support
cl_guid is a cvar which is part of the client's USERINFO string. Its value cl_guid is a cvar which is part of the client's USERINFO string. Its value
is a 32 character string made up of [a-f] and [0-9] characters. This is a 32 character string made up of [a-f] and [0-9] characters. This
value is pseudo-unique for every player. Id's Quake 3 Arena client also value is pseudo-unique for every player. Id's Quake 3 Arena client also
@ -641,11 +675,13 @@ cl_guid Support
a server. This value can be reset by the client at any time so it's not a server. This value can be reset by the client at any time so it's not
useful for blocking access. However, it can have at least two uses in useful for blocking access. However, it can have at least two uses in
your mod's game code: your mod's game code:
1) improve logging to allow statistical tools to index players by more
than just name
2) granting some weak admin rights to players without requiring passwords
PNG support 1. improve logging to allow statistical tools to index players by more
than just name
2. granting some weak admin rights to players without requiring passwords
## PNG support
ioquake3 supports the use of PNG (Portable Network Graphic) images as ioquake3 supports the use of PNG (Portable Network Graphic) images as
textures. It should be noted that the use of such images in a map will textures. It should be noted that the use of such images in a map will
result in missing placeholder textures where the map is used with the id result in missing placeholder textures where the map is used with the id
@ -665,7 +701,8 @@ PNG support
Restart GtkRadiant and PNG textures are now available. Restart GtkRadiant and PNG textures are now available.
Building with MinGW for pre Windows XP ## Building with MinGW for pre Windows XP
IPv6 support requires a header named "wspiapi.h" to abstract away from IPv6 support requires a header named "wspiapi.h" to abstract away from
differences in earlier versions of Windows' IPv6 stack. There is no MinGW differences in earlier versions of Windows' IPv6 stack. There is no MinGW
equivalent of this header and the Microsoft version is obviously not equivalent of this header and the Microsoft version is obviously not
@ -674,7 +711,7 @@ Building with MinGW for pre Windows XP
directory, this restriction is lifted. directory, this restriction is lifted.
------------------------------------------------------------- Contributing ----- # Contributing
Please send all patches to bugzilla (https://bugzilla.icculus.org), or join the Please send all patches to bugzilla (https://bugzilla.icculus.org), or join the
mailing list (http://lists.ioquake.org/listinfo.cgi/ioquake3-ioquake.org) and mailing list (http://lists.ioquake.org/listinfo.cgi/ioquake3-ioquake.org) and
@ -689,7 +726,7 @@ accepted as long as they are entirely optional, do not require new media and
are off by default. are off by default.
--------------------------------------------- Building Official Installers ----- # Building Official Installers
We need help getting automated installers on all the platforms that ioquake3 We need help getting automated installers on all the platforms that ioquake3
supports. We don't necessarily care about all the installers being identical, supports. We don't necessarily care about all the installers being identical,
@ -722,22 +759,28 @@ but we have some general guidelines:
* Your installer will be mirrored to an "official" directory, thus making it * Your installer will be mirrored to an "official" directory, thus making it
a done deal. a done deal.
------------------------------------------------------------------ Credits -----
# Credits
Maintainers Maintainers
James Canete <use.less01@gmail.com>
Ludwig Nussel <ludwig.nussel@suse.de> * James Canete <use.less01@gmail.com>
Thilo Schulz <arny@ats.s.bawue.de> * Ludwig Nussel <ludwig.nussel@suse.de>
Tim Angus <tim@ngus.net> * Thilo Schulz <arny@ats.s.bawue.de>
Tony J. White <tjw@tjw.org> * Tim Angus <tim@ngus.net>
Zachary J. Slater <zachary@ioquake.org> * Tony J. White <tjw@tjw.org>
Zack Middleton <zturtleman@gmail.com> * Zachary J. Slater <zachary@ioquake.org>
* Zack Middleton <zturtleman@gmail.com>
Significant contributions from Significant contributions from
Ryan C. Gordon <icculus@icculus.org>
Andreas Kohn <andreas@syndrom23.de> * Ryan C. Gordon <icculus@icculus.org>
Joerg Dietrich <Dietrich_Joerg@t-online.de> * Andreas Kohn <andreas@syndrom23.de>
Stuart Dalton <badcdev@gmail.com> * Joerg Dietrich <Dietrich_Joerg@t-online.de>
Vincent S. Cojot <vincent at cojot dot name> * Stuart Dalton <badcdev@gmail.com>
optical <alex@rigbo.se> * Vincent S. Cojot <vincent at cojot dot name>
Aaron Gyes <floam@aaron.gy> * optical <alex@rigbo.se>
* Aaron Gyes <floam@aaron.gy>
[![githalytics.com alpha](https://cruel-carlota.pagodabox.com/f88af076b5015c62b699968f6772c3a5 "githalytics.com")](http://githalytics.com/ioquake/ioq3)

View file

@ -1371,6 +1371,32 @@ void S_Base_StopBackgroundTrack( void ) {
s_rawend[0] = 0; s_rawend[0] = 0;
} }
/*
======================
S_OpenBackgroundStream
======================
*/
static void S_OpenBackgroundStream( const char *filename ) {
// close the background track, but DON'T reset s_rawend
// if restarting the same back ground track
if(s_backgroundStream)
{
S_CodecCloseStream(s_backgroundStream);
s_backgroundStream = NULL;
}
// Open stream
s_backgroundStream = S_CodecOpenStream(filename);
if(!s_backgroundStream) {
Com_Printf( S_COLOR_YELLOW "WARNING: couldn't open music file %s\n", filename );
return;
}
if(s_backgroundStream->info.channels != 2 || s_backgroundStream->info.rate != 22050) {
Com_Printf(S_COLOR_YELLOW "WARNING: music file %s is not 22k stereo\n", filename );
}
}
/* /*
====================== ======================
S_StartBackgroundTrack S_StartBackgroundTrack
@ -1397,24 +1423,7 @@ void S_Base_StartBackgroundTrack( const char *intro, const char *loop ){
Q_strncpyz( s_backgroundLoop, loop, sizeof( s_backgroundLoop ) ); Q_strncpyz( s_backgroundLoop, loop, sizeof( s_backgroundLoop ) );
} }
// close the background track, but DON'T reset s_rawend S_OpenBackgroundStream( intro );
// if restarting the same back ground track
if(s_backgroundStream)
{
S_CodecCloseStream(s_backgroundStream);
s_backgroundStream = NULL;
}
// Open stream
s_backgroundStream = S_CodecOpenStream(intro);
if(!s_backgroundStream) {
Com_Printf( S_COLOR_YELLOW "WARNING: couldn't open music file %s\n", intro );
return;
}
if(s_backgroundStream->info.channels != 2 || s_backgroundStream->info.rate != 22050) {
Com_Printf(S_COLOR_YELLOW "WARNING: music file %s is not 22k stereo\n", intro );
}
} }
/* /*
@ -1477,9 +1486,7 @@ void S_UpdateBackgroundTrack( void ) {
// loop // loop
if(s_backgroundLoop[0]) if(s_backgroundLoop[0])
{ {
S_CodecCloseStream(s_backgroundStream); S_OpenBackgroundStream( s_backgroundLoop );
s_backgroundStream = NULL;
S_Base_StartBackgroundTrack( s_backgroundLoop, s_backgroundLoop );
if(!s_backgroundStream) if(!s_backgroundStream)
return; return;
} }

View file

@ -426,7 +426,7 @@ void CopyToBodyQue( gentity_t *ent ) {
body->s.eFlags |= EF_KAMIKAZE; body->s.eFlags |= EF_KAMIKAZE;
// check if there is a kamikaze timer around for this owner // check if there is a kamikaze timer around for this owner
for (i = 0; i < MAX_GENTITIES; i++) { for (i = 0; i < level.num_entities; i++) {
e = &g_entities[i]; e = &g_entities[i];
if (!e->inuse) if (!e->inuse)
continue; continue;

View file

@ -241,7 +241,7 @@ void GibEntity( gentity_t *self, int killer ) {
//if this entity still has kamikaze //if this entity still has kamikaze
if (self->s.eFlags & EF_KAMIKAZE) { if (self->s.eFlags & EF_KAMIKAZE) {
// check if there is a kamikaze timer around for this owner // check if there is a kamikaze timer around for this owner
for (i = 0; i < MAX_GENTITIES; i++) { for (i = 0; i < level.num_entities; i++) {
ent = &g_entities[i]; ent = &g_entities[i];
if (!ent->inuse) if (!ent->inuse)
continue; continue;

View file

@ -737,6 +737,10 @@ void RE_StretchRaw (int x, int y, int w, int h, int cols, int rows, const byte *
} }
R_IssuePendingRenderCommands(); R_IssuePendingRenderCommands();
if ( tess.numIndexes ) {
RB_EndSurface();
}
// we definately want to sync every frame for the cinematics // we definately want to sync every frame for the cinematics
qglFinish(); qglFinish();

View file

@ -371,17 +371,17 @@ void GL_State( unsigned long stateBits )
} }
void GL_SetProjectionMatrix(matrix_t matrix) void GL_SetProjectionMatrix(mat4_t matrix)
{ {
Matrix16Copy(matrix, glState.projection); Mat4Copy(matrix, glState.projection);
Matrix16Multiply(glState.projection, glState.modelview, glState.modelviewProjection); Mat4Multiply(glState.projection, glState.modelview, glState.modelviewProjection);
} }
void GL_SetModelviewMatrix(matrix_t matrix) void GL_SetModelviewMatrix(mat4_t matrix)
{ {
Matrix16Copy(matrix, glState.modelview); Mat4Copy(matrix, glState.modelview);
Matrix16Multiply(glState.projection, glState.modelview, glState.modelviewProjection); Mat4Multiply(glState.projection, glState.modelview, glState.modelviewProjection);
} }
@ -765,7 +765,7 @@ RB_SetGL2D
================ ================
*/ */
void RB_SetGL2D (void) { void RB_SetGL2D (void) {
matrix_t matrix; mat4_t matrix;
int width, height; int width, height;
if (backEnd.projection2D && backEnd.last2DFBO == glState.currentFBO) if (backEnd.projection2D && backEnd.last2DFBO == glState.currentFBO)
@ -789,9 +789,9 @@ void RB_SetGL2D (void) {
qglViewport( 0, 0, width, height ); qglViewport( 0, 0, width, height );
qglScissor( 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); GL_SetProjectionMatrix(matrix);
Matrix16Identity(matrix); Mat4Identity(matrix);
GL_SetModelviewMatrix(matrix); GL_SetModelviewMatrix(matrix);
GL_State( GLS_DEPTHTEST_DISABLE | GL_State( GLS_DEPTHTEST_DISABLE |
@ -830,6 +830,10 @@ void RE_StretchRaw (int x, int y, int w, int h, int cols, int rows, const byte *
} }
R_IssuePendingRenderCommands(); R_IssuePendingRenderCommands();
if ( tess.numIndexes ) {
RB_EndSurface();
}
// we definately want to sync every frame for the cinematics // we definately want to sync every frame for the cinematics
qglFinish(); qglFinish();
@ -881,7 +885,7 @@ void RE_StretchRaw (int x, int y, int w, int h, int cols, int rows, const byte *
GLSL_BindProgram(&tr.textureColorShader); 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); GLSL_SetUniformVec4(&tr.textureColorShader, UNIFORM_COLOR, colorWhite);
RB_InstantQuad2(quadVerts, texCoords); RB_InstantQuad2(quadVerts, texCoords);
@ -1122,9 +1126,9 @@ const void *RB_DrawSurfs( const void *data ) {
GL_BindToTMU(tr.sunShadowDepthImage[1], TB_SHADOWMAP2); GL_BindToTMU(tr.sunShadowDepthImage[1], TB_SHADOWMAP2);
GL_BindToTMU(tr.sunShadowDepthImage[2], TB_SHADOWMAP3); GL_BindToTMU(tr.sunShadowDepthImage[2], TB_SHADOWMAP3);
GLSL_SetUniformMatrix16(&tr.shadowmaskShader, UNIFORM_SHADOWMVP, backEnd.refdef.sunShadowMvp[0]); GLSL_SetUniformMat4(&tr.shadowmaskShader, UNIFORM_SHADOWMVP, backEnd.refdef.sunShadowMvp[0]);
GLSL_SetUniformMatrix16(&tr.shadowmaskShader, UNIFORM_SHADOWMVP2, backEnd.refdef.sunShadowMvp[1]); GLSL_SetUniformMat4(&tr.shadowmaskShader, UNIFORM_SHADOWMVP2, backEnd.refdef.sunShadowMvp[1]);
GLSL_SetUniformMatrix16(&tr.shadowmaskShader, UNIFORM_SHADOWMVP3, backEnd.refdef.sunShadowMvp[2]); GLSL_SetUniformMat4(&tr.shadowmaskShader, UNIFORM_SHADOWMVP3, backEnd.refdef.sunShadowMvp[2]);
GLSL_SetUniformVec3(&tr.shadowmaskShader, UNIFORM_VIEWORIGIN, backEnd.refdef.vieworg); GLSL_SetUniformVec3(&tr.shadowmaskShader, UNIFORM_VIEWORIGIN, backEnd.refdef.vieworg);
{ {
@ -1578,7 +1582,7 @@ const void *RB_PostProcess(const void *data)
{ {
const postProcessCommand_t *cmd = data; const postProcessCommand_t *cmd = data;
FBO_t *srcFbo; FBO_t *srcFbo;
vec4i_t srcBox, dstBox; ivec4_t srcBox, dstBox;
qboolean autoExposure; qboolean autoExposure;
// finish any 2D drawing if needed // finish any 2D drawing if needed
@ -1664,7 +1668,7 @@ const void *RB_PostProcess(const void *data)
if (0) if (0)
{ {
vec4i_t dstBox; ivec4_t dstBox;
VectorSet4(dstBox, 0, 0, 128, 128); VectorSet4(dstBox, 0, 0, 128, 128);
FBO_BlitFromTexture(tr.sunShadowDepthImage[0], NULL, NULL, NULL, dstBox, NULL, NULL, 0); FBO_BlitFromTexture(tr.sunShadowDepthImage[0], NULL, NULL, NULL, dstBox, NULL, NULL, 0);
VectorSet4(dstBox, 128, 0, 128, 128); VectorSet4(dstBox, 128, 0, 128, 128);
@ -1675,7 +1679,7 @@ const void *RB_PostProcess(const void *data)
if (0) if (0)
{ {
vec4i_t dstBox; ivec4_t dstBox;
VectorSet4(dstBox, 256, glConfig.vidHeight - 256, 256, 256); VectorSet4(dstBox, 256, glConfig.vidHeight - 256, 256, 256);
FBO_BlitFromTexture(tr.renderDepthImage, NULL, NULL, NULL, dstBox, NULL, NULL, 0); FBO_BlitFromTexture(tr.renderDepthImage, NULL, NULL, NULL, dstBox, NULL, NULL, 0);
VectorSet4(dstBox, 512, glConfig.vidHeight - 256, 256, 256); VectorSet4(dstBox, 512, glConfig.vidHeight - 256, 256, 256);
@ -1684,7 +1688,7 @@ const void *RB_PostProcess(const void *data)
if (0) if (0)
{ {
vec4i_t dstBox; ivec4_t dstBox;
VectorSet4(dstBox, 256, glConfig.vidHeight - 256, 256, 256); VectorSet4(dstBox, 256, glConfig.vidHeight - 256, 256, 256);
FBO_BlitFromTexture(tr.sunRaysImage, NULL, NULL, NULL, dstBox, NULL, NULL, 0); FBO_BlitFromTexture(tr.sunRaysImage, NULL, NULL, NULL, dstBox, NULL, NULL, 0);
} }
@ -1692,7 +1696,7 @@ const void *RB_PostProcess(const void *data)
#if 0 #if 0
if (r_cubeMapping->integer && tr.numCubemaps) if (r_cubeMapping->integer && tr.numCubemaps)
{ {
vec4i_t dstBox; ivec4_t dstBox;
int cubemapIndex = R_CubemapForPoint( backEnd.viewParms.or.origin ); int cubemapIndex = R_CubemapForPoint( backEnd.viewParms.or.origin );
if (cubemapIndex) if (cubemapIndex)

View file

@ -26,7 +26,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
// Some matrix helper functions // Some matrix helper functions
// FIXME: do these already exist in ioq3 and I don't know about them? // 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[ 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; 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; 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[ 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; 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; 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[ 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]; 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]; 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[ 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]; 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]; 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[ 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]; 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]; 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] || 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] || 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]); 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[ 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]); 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]); 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[ 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]; 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; 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[ 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); 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; 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[0] = axes[0][0];
out[1] = axes[1][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; out[15] = 1;
} }
void Matrix16SimpleInverse( const matrix_t in, matrix_t out) void Mat4SimpleInverse( const mat4_t in, mat4_t out)
{ {
vec3_t v; vec3_t v;
float invSqrLen; float invSqrLen;

View file

@ -24,22 +24,22 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#ifndef __TR_EXTRAMATH_H__ #ifndef __TR_EXTRAMATH_H__
#define __TR_EXTRAMATH_H__ #define __TR_EXTRAMATH_H__
typedef vec_t matrix_t[16]; typedef vec_t mat4_t[16];
typedef int vec2i_t[2]; typedef int ivec2_t[2];
typedef int vec3i_t[3]; typedef int ivec3_t[3];
typedef int vec4i_t[4]; typedef int ivec4_t[4];
void Matrix16Zero( matrix_t out ); void Mat4Zero( mat4_t out );
void Matrix16Identity( matrix_t out ); void Mat4Identity( mat4_t out );
void Matrix16Copy( const matrix_t in, matrix_t out ); void Mat4Copy( const mat4_t in, mat4_t out );
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 );
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 );
qboolean Matrix16Compare(const matrix_t a, const matrix_t b); qboolean Mat4Compare(const mat4_t a, const mat4_t b);
void Matrix16Dump( const matrix_t in ); void Mat4Dump( const mat4_t in );
void Matrix16Translation( vec3_t vec, matrix_t out ); void Mat4Translation( vec3_t vec, mat4_t out );
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 );
void Matrix16View(vec3_t axes[3], vec3_t origin, matrix_t out); void Mat4View(vec3_t axes[3], vec3_t origin, mat4_t out);
void Matrix16SimpleInverse( const matrix_t in, matrix_t out); void Mat4SimpleInverse( const mat4_t in, mat4_t out);
#define VectorCopy2(a,b) ((b)[0]=(a)[0],(b)[1]=(a)[1]) #define VectorCopy2(a,b) ((b)[0]=(a)[0],(b)[1]=(a)[1])
#define VectorSet2(v,x,y) ((v)[0]=(x),(v)[1]=(y)); #define VectorSet2(v,x,y) ((v)[0]=(x),(v)[1]=(y));

View file

@ -386,7 +386,7 @@ void FBO_Init(void)
hdrFormat = GL_RGBA8; hdrFormat = GL_RGBA8;
if (r_hdr->integer && glRefConfig.framebufferObject && glRefConfig.textureFloat) if (r_hdr->integer && glRefConfig.framebufferObject && glRefConfig.textureFloat)
{ {
hdrFormat = GL_RGB16F_ARB; hdrFormat = GL_RGBA16F_ARB;
} }
qglGetIntegerv(GL_MAX_SAMPLES_EXT, &multisample); qglGetIntegerv(GL_MAX_SAMPLES_EXT, &multisample);
@ -651,16 +651,16 @@ void R_FBOList_f(void)
// FIXME // FIXME
extern void RB_SetGL2D (void); 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; vec2_t srcTexScale;
vec4_t color; vec4_t color;
vec4_t quadVerts[4]; vec4_t quadVerts[4];
vec2_t texCoords[4]; vec2_t texCoords[4];
vec2_t invTexRes; vec2_t invTexRes;
FBO_t *oldFbo = glState.currentFBO; FBO_t *oldFbo = glState.currentFBO;
matrix_t projection; mat4_t projection;
int width, height; int width, height;
if (!src) if (!src)
@ -741,7 +741,7 @@ void FBO_BlitFromTexture(struct image_s *src, vec4i_t inSrcBox, vec2_t inSrcTexS
qglViewport( 0, 0, width, height ); qglViewport( 0, 0, width, height );
qglScissor( 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 ); 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_BindProgram(shaderProgram);
GLSL_SetUniformMatrix16(shaderProgram, UNIFORM_MODELVIEWPROJECTIONMATRIX, projection); GLSL_SetUniformMat4(shaderProgram, UNIFORM_MODELVIEWPROJECTIONMATRIX, projection);
GLSL_SetUniformVec4(shaderProgram, UNIFORM_COLOR, color); GLSL_SetUniformVec4(shaderProgram, UNIFORM_COLOR, color);
GLSL_SetUniformVec2(shaderProgram, UNIFORM_INVTEXRES, invTexRes); GLSL_SetUniformVec2(shaderProgram, UNIFORM_INVTEXRES, invTexRes);
GLSL_SetUniformVec2(shaderProgram, UNIFORM_AUTOEXPOSUREMINMAX, tr.refdef.autoExposureMinMax); 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); 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) 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); 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; GLuint srcFb, dstFb;
if (!glRefConfig.framebufferBlit) if (!glRefConfig.framebufferBlit)

View file

@ -56,9 +56,9 @@ void FBO_Bind(FBO_t *fbo);
void FBO_Init(void); void FBO_Init(void);
void FBO_Shutdown(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_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, 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, 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, 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);
#endif #endif

View file

@ -277,6 +277,7 @@ void RB_TestFlare( flare_t *f ) {
qboolean visible; qboolean visible;
float fade; float fade;
float screenZ; float screenZ;
FBO_t *oldFbo;
backEnd.pc.c_flareTests++; backEnd.pc.c_flareTests++;
@ -284,9 +285,22 @@ void RB_TestFlare( flare_t *f ) {
// don't bother with another sync // don't bother with another sync
glState.finishCalled = qfalse; glState.finishCalled = qfalse;
// if we're doing multisample rendering, read from the correct FBO
oldFbo = glState.currentFBO;
if (tr.msaaResolveFbo)
{
FBO_Bind(tr.msaaResolveFbo);
}
// read back the z buffer contents // read back the z buffer contents
qglReadPixels( f->windowX, f->windowY, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &depth ); qglReadPixels( f->windowX, f->windowY, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &depth );
// if we're doing multisample rendering, switch to the old FBO
if (tr.msaaResolveFbo)
{
FBO_Bind(oldFbo);
}
screenZ = backEnd.viewParms.projectionMatrix[14] / screenZ = backEnd.viewParms.projectionMatrix[14] /
( ( 2*depth - 1 ) * backEnd.viewParms.projectionMatrix[11] - backEnd.viewParms.projectionMatrix[10] ); ( ( 2*depth - 1 ) * backEnd.viewParms.projectionMatrix[11] - backEnd.viewParms.projectionMatrix[10] );
@ -458,7 +472,7 @@ void RB_RenderFlares (void) {
flare_t *f; flare_t *f;
flare_t **prev; flare_t **prev;
qboolean draw; qboolean draw;
matrix_t oldmodelview, oldprojection, matrix; mat4_t oldmodelview, oldprojection, matrix;
if ( !r_flares->integer ) { if ( !r_flares->integer ) {
return; return;
@ -516,11 +530,11 @@ void RB_RenderFlares (void) {
qglDisable (GL_CLIP_PLANE0); qglDisable (GL_CLIP_PLANE0);
} }
Matrix16Copy(glState.projection, oldprojection); Mat4Copy(glState.projection, oldprojection);
Matrix16Copy(glState.modelview, oldmodelview); Mat4Copy(glState.modelview, oldmodelview);
Matrix16Identity(matrix); Mat4Identity(matrix);
GL_SetModelviewMatrix(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, backEnd.viewParms.viewportY, backEnd.viewParms.viewportY + backEnd.viewParms.viewportHeight,
-99999, 99999, matrix ); -99999, 99999, matrix );
GL_SetProjectionMatrix(matrix); GL_SetProjectionMatrix(matrix);

View file

@ -809,7 +809,7 @@ void GLSL_SetUniformFloat5(shaderProgram_t *program, int uniformNum, const vec5_
qglUniform1fvARB(uniforms[uniformNum], 5, v); 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; GLint *uniforms = program->uniforms;
vec_t *compare = (float *)(program->uniformBuffer + program->uniformBufferOffsets[uniformNum]); 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) 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; return;
} }
if (Matrix16Compare(matrix, compare)) if (Mat4Compare(matrix, compare))
{ {
return; return;
} }
Matrix16Copy(matrix, compare); Mat4Copy(matrix, compare);
qglUniformMatrix4fvARB(uniforms[uniformNum], 1, GL_FALSE, matrix); qglUniformMatrix4fvARB(uniforms[uniformNum], 1, GL_FALSE, matrix);
} }

View file

@ -2922,7 +2922,7 @@ void R_CreateBuiltinImages( void ) {
hdrFormat = GL_RGBA8; hdrFormat = GL_RGBA8;
if (r_hdr->integer && glRefConfig.framebufferObject && glRefConfig.textureFloat) if (r_hdr->integer && glRefConfig.framebufferObject && glRefConfig.textureFloat)
hdrFormat = GL_RGB16F_ARB; hdrFormat = GL_RGBA16F_ARB;
rgbFormat = GL_RGBA8; rgbFormat = GL_RGBA8;
@ -2941,7 +2941,7 @@ void R_CreateBuiltinImages( void ) {
unsigned short sdata[4]; unsigned short sdata[4];
void *p; void *p;
if (hdrFormat == GL_RGB16F_ARB) if (hdrFormat == GL_RGBA16F_ARB)
{ {
sdata[0] = FloatToHalf(0.0f); sdata[0] = FloatToHalf(0.0f);
sdata[1] = FloatToHalf(0.45f); sdata[1] = FloatToHalf(0.45f);

View file

@ -1454,9 +1454,9 @@ typedef struct {
FBO_t *currentFBO; FBO_t *currentFBO;
VBO_t *currentVBO; VBO_t *currentVBO;
IBO_t *currentIBO; IBO_t *currentIBO;
matrix_t modelview; mat4_t modelview;
matrix_t projection; mat4_t projection;
matrix_t modelviewProjection; mat4_t modelviewProjection;
} glstate_t; } glstate_t;
typedef enum { typedef enum {
@ -1964,8 +1964,8 @@ void GL_TextureMode( const char *string );
void GL_CheckErrs( char *file, int line ); void GL_CheckErrs( char *file, int line );
#define GL_CheckErrors(...) GL_CheckErrs(__FILE__, __LINE__) #define GL_CheckErrors(...) GL_CheckErrs(__FILE__, __LINE__)
void GL_State( unsigned long stateVector ); void GL_State( unsigned long stateVector );
void GL_SetProjectionMatrix(matrix_t matrix); void GL_SetProjectionMatrix(mat4_t matrix);
void GL_SetModelviewMatrix(matrix_t matrix); void GL_SetModelviewMatrix(mat4_t matrix);
void GL_TexEnv( int env ); void GL_TexEnv( int env );
void GL_Cull( int cullType ); void GL_Cull( int cullType );
@ -2296,7 +2296,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_SetUniformVec2(shaderProgram_t *program, int uniformNum, const vec2_t v);
void GLSL_SetUniformVec3(shaderProgram_t *program, int uniformNum, const vec3_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_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); shaderProgram_t *GLSL_GetGenericShaderProgram(int stage);

View file

@ -840,7 +840,7 @@ void R_RotateForEntity( const trRefEntity_t *ent, const viewParms_t *viewParms,
glMatrix[11] = 0; glMatrix[11] = 0;
glMatrix[15] = 1; glMatrix[15] = 1;
Matrix16Copy(glMatrix, or->transformMatrix); Mat4Copy(glMatrix, or->transformMatrix);
myGlMultMatrix( glMatrix, viewParms->world.modelMatrix, or->modelMatrix ); myGlMultMatrix( glMatrix, viewParms->world.modelMatrix, or->modelMatrix );
// calculate the viewer origin in the model's space // calculate the viewer origin in the model's space
@ -2634,7 +2634,7 @@ void R_RenderSunShadowMaps(const refdef_t *fd, int level)
// Create bounds for light projection using slice of view projection // Create bounds for light projection using slice of view projection
{ {
matrix_t lightViewMatrix; mat4_t lightViewMatrix;
vec4_t point, base, lightViewPoint; vec4_t point, base, lightViewPoint;
float lx, ly; float lx, ly;
@ -2642,7 +2642,7 @@ void R_RenderSunShadowMaps(const refdef_t *fd, int level)
point[3] = 1; point[3] = 1;
lightViewPoint[3] = 1; lightViewPoint[3] = 1;
Matrix16View(lightViewAxis, lightOrigin, lightViewMatrix); Mat4View(lightViewAxis, lightOrigin, lightViewMatrix);
ClearBounds(lightviewBounds[0], lightviewBounds[1]); ClearBounds(lightviewBounds[0], lightviewBounds[1]);
@ -2653,22 +2653,22 @@ void R_RenderSunShadowMaps(const refdef_t *fd, int level)
VectorMA(base, lx, fd->viewaxis[1], point); VectorMA(base, lx, fd->viewaxis[1], point);
VectorMA(point, ly, fd->viewaxis[2], point); VectorMA(point, ly, fd->viewaxis[2], point);
Matrix16Transform(lightViewMatrix, point, lightViewPoint); Mat4Transform(lightViewMatrix, point, lightViewPoint);
AddPointToBounds(lightViewPoint, lightviewBounds[0], lightviewBounds[1]); AddPointToBounds(lightViewPoint, lightviewBounds[0], lightviewBounds[1]);
VectorMA(base, -lx, fd->viewaxis[1], point); VectorMA(base, -lx, fd->viewaxis[1], point);
VectorMA(point, ly, fd->viewaxis[2], point); VectorMA(point, ly, fd->viewaxis[2], point);
Matrix16Transform(lightViewMatrix, point, lightViewPoint); Mat4Transform(lightViewMatrix, point, lightViewPoint);
AddPointToBounds(lightViewPoint, lightviewBounds[0], lightviewBounds[1]); AddPointToBounds(lightViewPoint, lightviewBounds[0], lightviewBounds[1]);
VectorMA(base, lx, fd->viewaxis[1], point); VectorMA(base, lx, fd->viewaxis[1], point);
VectorMA(point, -ly, fd->viewaxis[2], point); VectorMA(point, -ly, fd->viewaxis[2], point);
Matrix16Transform(lightViewMatrix, point, lightViewPoint); Mat4Transform(lightViewMatrix, point, lightViewPoint);
AddPointToBounds(lightViewPoint, lightviewBounds[0], lightviewBounds[1]); AddPointToBounds(lightViewPoint, lightviewBounds[0], lightviewBounds[1]);
VectorMA(base, -lx, fd->viewaxis[1], point); VectorMA(base, -lx, fd->viewaxis[1], point);
VectorMA(point, -ly, fd->viewaxis[2], point); VectorMA(point, -ly, fd->viewaxis[2], point);
Matrix16Transform(lightViewMatrix, point, lightViewPoint); Mat4Transform(lightViewMatrix, point, lightViewPoint);
AddPointToBounds(lightViewPoint, lightviewBounds[0], lightviewBounds[1]); AddPointToBounds(lightViewPoint, lightviewBounds[0], lightviewBounds[1]);
@ -2679,22 +2679,22 @@ void R_RenderSunShadowMaps(const refdef_t *fd, int level)
VectorMA(base, lx, fd->viewaxis[1], point); VectorMA(base, lx, fd->viewaxis[1], point);
VectorMA(point, ly, fd->viewaxis[2], point); VectorMA(point, ly, fd->viewaxis[2], point);
Matrix16Transform(lightViewMatrix, point, lightViewPoint); Mat4Transform(lightViewMatrix, point, lightViewPoint);
AddPointToBounds(lightViewPoint, lightviewBounds[0], lightviewBounds[1]); AddPointToBounds(lightViewPoint, lightviewBounds[0], lightviewBounds[1]);
VectorMA(base, -lx, fd->viewaxis[1], point); VectorMA(base, -lx, fd->viewaxis[1], point);
VectorMA(point, ly, fd->viewaxis[2], point); VectorMA(point, ly, fd->viewaxis[2], point);
Matrix16Transform(lightViewMatrix, point, lightViewPoint); Mat4Transform(lightViewMatrix, point, lightViewPoint);
AddPointToBounds(lightViewPoint, lightviewBounds[0], lightviewBounds[1]); AddPointToBounds(lightViewPoint, lightviewBounds[0], lightviewBounds[1]);
VectorMA(base, lx, fd->viewaxis[1], point); VectorMA(base, lx, fd->viewaxis[1], point);
VectorMA(point, -ly, fd->viewaxis[2], point); VectorMA(point, -ly, fd->viewaxis[2], point);
Matrix16Transform(lightViewMatrix, point, lightViewPoint); Mat4Transform(lightViewMatrix, point, lightViewPoint);
AddPointToBounds(lightViewPoint, lightviewBounds[0], lightviewBounds[1]); AddPointToBounds(lightViewPoint, lightviewBounds[0], lightviewBounds[1]);
VectorMA(base, -lx, fd->viewaxis[1], point); VectorMA(base, -lx, fd->viewaxis[1], point);
VectorMA(point, -ly, fd->viewaxis[2], point); VectorMA(point, -ly, fd->viewaxis[2], point);
Matrix16Transform(lightViewMatrix, point, lightViewPoint); Mat4Transform(lightViewMatrix, point, lightViewPoint);
AddPointToBounds(lightViewPoint, lightviewBounds[0], lightviewBounds[1]); AddPointToBounds(lightViewPoint, lightviewBounds[0], lightviewBounds[1]);
if (!glRefConfig.depthClamp) if (!glRefConfig.depthClamp)
@ -2792,7 +2792,7 @@ void R_RenderSunShadowMaps(const refdef_t *fd, int level)
R_SortDrawSurfs( tr.refdef.drawSurfs + firstDrawSurf, tr.refdef.numDrawSurfs - firstDrawSurf ); 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]);
} }
} }

View file

@ -22,9 +22,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "tr_local.h" #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; vec4_t color;
static int lastFrameCount = 0; static int lastFrameCount = 0;
@ -103,9 +103,9 @@ Blurs a part of one framebuffer to another.
Framebuffers can be identical. 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; vec4_t color;
blur *= 10.0f; 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 // bokeh blur
if (blur > 0.0f) if (blur > 0.0f)
{ {
vec4i_t quarterBox; ivec4_t quarterBox;
quarterBox[0] = 0; quarterBox[0] = 0;
quarterBox[1] = tr.quarterFbo[0]->height; 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) 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; vec4_t color;
const float inc = 1.f / passes; const float inc = 1.f / passes;
const float mul = powf(stretch, inc); const float mul = powf(stretch, inc);
@ -308,7 +308,7 @@ static qboolean RB_UpdateSunFlareVis(void)
return sampleCount > 0; 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; vec4_t color;
float dot; float dot;
@ -316,7 +316,7 @@ void RB_SunRays(FBO_t *srcFbo, vec4i_t srcBox, FBO_t *dstFbo, vec4i_t dstBox)
qboolean colorize = qtrue; qboolean colorize = qtrue;
// float w, h, w2, h2; // float w, h, w2, h2;
matrix_t mvp; mat4_t mvp;
vec4_t pos, hpos; vec4_t pos, hpos;
dot = DotProduct(tr.sunDirection, backEnd.viewParms.or.axis[0]); 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() // From RB_DrawSun()
{ {
float dist; float dist;
matrix_t trans, model, mvp; mat4_t trans, model, mvp;
Matrix16Translation( backEnd.viewParms.or.origin, trans ); Mat4Translation( backEnd.viewParms.or.origin, trans );
Matrix16Multiply( backEnd.viewParms.world.modelMatrix, trans, model ); Mat4Multiply( backEnd.viewParms.world.modelMatrix, trans, model );
Matrix16Multiply(backEnd.viewParms.projectionMatrix, model, mvp); Mat4Multiply(backEnd.viewParms.projectionMatrix, model, mvp);
dist = backEnd.viewParms.zFar / 1.75; // div sqrt(3) 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 // project sun point
//Matrix16Multiply(backEnd.viewParms.projectionMatrix, backEnd.viewParms.world.modelMatrix, mvp); //Mat4Multiply(backEnd.viewParms.projectionMatrix, backEnd.viewParms.world.modelMatrix, mvp);
Matrix16Transform(mvp, pos, hpos); Mat4Transform(mvp, pos, hpos);
// transform to UV coords // transform to UV coords
hpos[3] = 0.5f / hpos[3]; 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; float mul = 1.f;
vec2_t texScale; vec2_t texScale;
vec4i_t rayBox, quarterBox; ivec4_t rayBox, quarterBox;
texScale[0] = texScale[0] =
texScale[1] = 1.0f; texScale[1] = 1.0f;
@ -441,7 +441,7 @@ static void RB_BlurAxis(FBO_t *srcFbo, FBO_t *dstFbo, float strength, qboolean h
ymul *= strength; ymul *= strength;
{ {
vec4i_t srcBox, dstBox; ivec4_t srcBox, dstBox;
vec4_t color; vec4_t color;
vec2_t texScale; vec2_t texScale;
@ -490,7 +490,7 @@ void RB_GaussianBlur(float blur)
return; return;
{ {
vec4i_t srcBox, dstBox; ivec4_t srcBox, dstBox;
vec4_t color; vec4_t color;
vec2_t texScale; vec2_t texScale;

View file

@ -25,9 +25,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "tr_fbo.h" #include "tr_fbo.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);
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);
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);
void RB_GaussianBlur(float blur); void RB_GaussianBlur(float blur);
#endif #endif

View file

@ -148,7 +148,7 @@ static void DrawTris (shaderCommands_t *input) {
GLSL_VertexAttribsState(ATTR_POSITION); GLSL_VertexAttribsState(ATTR_POSITION);
GLSL_BindProgram(sp); GLSL_BindProgram(sp);
GLSL_SetUniformMatrix16(sp, UNIFORM_MODELVIEWPROJECTIONMATRIX, glState.modelviewProjection); GLSL_SetUniformMat4(sp, UNIFORM_MODELVIEWPROJECTIONMATRIX, glState.modelviewProjection);
VectorSet4(color, 1, 1, 1, 1); VectorSet4(color, 1, 1, 1, 1);
GLSL_SetUniformVec4(sp, UNIFORM_COLOR, color); GLSL_SetUniformVec4(sp, UNIFORM_COLOR, color);
@ -392,7 +392,7 @@ static void ProjectDlightTexture( void ) {
GLSL_BindProgram(sp); GLSL_BindProgram(sp);
GLSL_SetUniformMatrix16(sp, UNIFORM_MODELVIEWPROJECTIONMATRIX, glState.modelviewProjection); GLSL_SetUniformMat4(sp, UNIFORM_MODELVIEWPROJECTIONMATRIX, glState.modelviewProjection);
GLSL_SetUniformFloat(sp, UNIFORM_VERTEXLERP, glState.vertexAttribsInterpolation); GLSL_SetUniformFloat(sp, UNIFORM_VERTEXLERP, glState.vertexAttribsInterpolation);
@ -757,7 +757,7 @@ static void ForwardDlight( void ) {
GLSL_BindProgram(sp); GLSL_BindProgram(sp);
GLSL_SetUniformMatrix16(sp, UNIFORM_MODELVIEWPROJECTIONMATRIX, glState.modelviewProjection); GLSL_SetUniformMat4(sp, UNIFORM_MODELVIEWPROJECTIONMATRIX, glState.modelviewProjection);
GLSL_SetUniformVec3(sp, UNIFORM_VIEWORIGIN, backEnd.viewParms.or.origin); GLSL_SetUniformVec3(sp, UNIFORM_VIEWORIGIN, backEnd.viewParms.or.origin);
GLSL_SetUniformVec3(sp, UNIFORM_LOCALVIEWORIGIN, backEnd.or.viewOrigin); GLSL_SetUniformVec3(sp, UNIFORM_LOCALVIEWORIGIN, backEnd.or.viewOrigin);
@ -817,7 +817,7 @@ static void ForwardDlight( void ) {
// where they aren't rendered // where they aren't rendered
GL_State( GLS_SRCBLEND_ONE | GLS_DSTBLEND_ONE | GLS_DEPTHFUNC_EQUAL ); GL_State( GLS_SRCBLEND_ONE | GLS_DSTBLEND_ONE | GLS_DEPTHFUNC_EQUAL );
GLSL_SetUniformMatrix16(sp, UNIFORM_MODELMATRIX, backEnd.or.transformMatrix); GLSL_SetUniformMat4(sp, UNIFORM_MODELMATRIX, backEnd.or.transformMatrix);
if (pStage->bundle[TB_DIFFUSEMAP].image[0]) if (pStage->bundle[TB_DIFFUSEMAP].image[0])
R_BindAnimatedImageToTMU( &pStage->bundle[TB_DIFFUSEMAP], TB_DIFFUSEMAP); R_BindAnimatedImageToTMU( &pStage->bundle[TB_DIFFUSEMAP], TB_DIFFUSEMAP);
@ -894,7 +894,7 @@ static void ProjectPshadowVBOGLSL( void ) {
GLSL_BindProgram(sp); GLSL_BindProgram(sp);
GLSL_SetUniformMatrix16(sp, UNIFORM_MODELVIEWPROJECTIONMATRIX, glState.modelviewProjection); GLSL_SetUniformMat4(sp, UNIFORM_MODELVIEWPROJECTIONMATRIX, glState.modelviewProjection);
VectorCopy(origin, vector); VectorCopy(origin, vector);
vector[3] = 1.0f; vector[3] = 1.0f;
@ -974,7 +974,7 @@ static void RB_FogPass( void ) {
fog = tr.world->fogs + tess.fogNum; fog = tr.world->fogs + tess.fogNum;
GLSL_SetUniformMatrix16(sp, UNIFORM_MODELVIEWPROJECTIONMATRIX, glState.modelviewProjection); GLSL_SetUniformMat4(sp, UNIFORM_MODELVIEWPROJECTIONMATRIX, glState.modelviewProjection);
GLSL_SetUniformFloat(sp, UNIFORM_VERTEXLERP, glState.vertexAttribsInterpolation); GLSL_SetUniformFloat(sp, UNIFORM_VERTEXLERP, glState.vertexAttribsInterpolation);
@ -1132,7 +1132,7 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input )
GLSL_BindProgram(sp); GLSL_BindProgram(sp);
GLSL_SetUniformMatrix16(sp, UNIFORM_MODELVIEWPROJECTIONMATRIX, glState.modelviewProjection); GLSL_SetUniformMat4(sp, UNIFORM_MODELVIEWPROJECTIONMATRIX, glState.modelviewProjection);
GLSL_SetUniformVec3(sp, UNIFORM_VIEWORIGIN, backEnd.viewParms.or.origin); GLSL_SetUniformVec3(sp, UNIFORM_VIEWORIGIN, backEnd.viewParms.or.origin);
GLSL_SetUniformVec3(sp, UNIFORM_LOCALVIEWORIGIN, backEnd.or.viewOrigin); GLSL_SetUniformVec3(sp, UNIFORM_LOCALVIEWORIGIN, backEnd.or.viewOrigin);
@ -1220,7 +1220,7 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input )
GLSL_SetUniformVec3(sp, UNIFORM_TCGEN0VECTOR1, vec); GLSL_SetUniformVec3(sp, UNIFORM_TCGEN0VECTOR1, vec);
} }
GLSL_SetUniformMatrix16(sp, UNIFORM_MODELMATRIX, backEnd.or.transformMatrix); GLSL_SetUniformMat4(sp, UNIFORM_MODELMATRIX, backEnd.or.transformMatrix);
GLSL_SetUniformVec2(sp, UNIFORM_MATERIALINFO, pStage->materialInfo); GLSL_SetUniformVec2(sp, UNIFORM_MATERIALINFO, pStage->materialInfo);
@ -1391,9 +1391,9 @@ static void RB_RenderShadowmap( shaderCommands_t *input )
GLSL_BindProgram(sp); GLSL_BindProgram(sp);
GLSL_SetUniformMatrix16(sp, UNIFORM_MODELVIEWPROJECTIONMATRIX, glState.modelviewProjection); GLSL_SetUniformMat4(sp, UNIFORM_MODELVIEWPROJECTIONMATRIX, glState.modelviewProjection);
GLSL_SetUniformMatrix16(sp, UNIFORM_MODELMATRIX, backEnd.or.transformMatrix); GLSL_SetUniformMat4(sp, UNIFORM_MODELMATRIX, backEnd.or.transformMatrix);
GLSL_SetUniformFloat(sp, UNIFORM_VERTEXLERP, glState.vertexAttribsInterpolation); GLSL_SetUniformFloat(sp, UNIFORM_VERTEXLERP, glState.vertexAttribsInterpolation);

View file

@ -429,7 +429,7 @@ static void DrawSkySide( struct image_s *image, const int mins[2], const int max
GLSL_VertexAttribsState(ATTR_POSITION | ATTR_TEXCOORD); GLSL_VertexAttribsState(ATTR_POSITION | ATTR_TEXCOORD);
GLSL_BindProgram(sp); GLSL_BindProgram(sp);
GLSL_SetUniformMatrix16(sp, UNIFORM_MODELVIEWPROJECTIONMATRIX, glState.modelviewProjection); GLSL_SetUniformMat4(sp, UNIFORM_MODELVIEWPROJECTIONMATRIX, glState.modelviewProjection);
color[0] = color[0] =
color[1] = color[1] =
@ -445,7 +445,7 @@ static void DrawSkySide( struct image_s *image, const int mins[2], const int max
GLSL_VertexAttribsState(ATTR_POSITION | ATTR_TEXCOORD); GLSL_VertexAttribsState(ATTR_POSITION | ATTR_TEXCOORD);
GLSL_BindProgram(sp); GLSL_BindProgram(sp);
GLSL_SetUniformMatrix16(sp, UNIFORM_MODELVIEWPROJECTIONMATRIX, glState.modelviewProjection); GLSL_SetUniformMat4(sp, UNIFORM_MODELVIEWPROJECTIONMATRIX, glState.modelviewProjection);
color[0] = color[0] =
color[1] = color[1] =
@ -806,10 +806,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]); //qglTranslatef (backEnd.viewParms.or.origin[0], backEnd.viewParms.or.origin[1], backEnd.viewParms.or.origin[2]);
{ {
// FIXME: this could be a lot cleaner // FIXME: this could be a lot cleaner
matrix_t translation, modelview; mat4_t translation, modelview;
Matrix16Translation( backEnd.viewParms.or.origin, translation ); Mat4Translation( backEnd.viewParms.or.origin, translation );
Matrix16Multiply( backEnd.viewParms.world.modelMatrix, translation, modelview ); Mat4Multiply( backEnd.viewParms.world.modelMatrix, translation, modelview );
GL_SetModelviewMatrix( modelview ); GL_SetModelviewMatrix( modelview );
} }
@ -869,18 +869,18 @@ void RB_StageIteratorSky( void ) {
// draw the outer skybox // draw the outer skybox
if ( tess.shader->sky.outerbox[0] && tess.shader->sky.outerbox[0] != tr.defaultImage ) { if ( tess.shader->sky.outerbox[0] && tess.shader->sky.outerbox[0] != tr.defaultImage ) {
matrix_t oldmodelview; mat4_t oldmodelview;
GL_State( 0 ); GL_State( 0 );
//qglTranslatef (backEnd.viewParms.or.origin[0], backEnd.viewParms.or.origin[1], backEnd.viewParms.or.origin[2]); //qglTranslatef (backEnd.viewParms.or.origin[0], backEnd.viewParms.or.origin[1], backEnd.viewParms.or.origin[2]);
{ {
// FIXME: this could be a lot cleaner // FIXME: this could be a lot cleaner
matrix_t trans, product; mat4_t trans, product;
Matrix16Copy( glState.modelview, oldmodelview ); Mat4Copy( glState.modelview, oldmodelview );
Matrix16Translation( backEnd.viewParms.or.origin, trans ); Mat4Translation( backEnd.viewParms.or.origin, trans );
Matrix16Multiply( glState.modelview, trans, product ); Mat4Multiply( glState.modelview, trans, product );
GL_SetModelviewMatrix( product ); GL_SetModelviewMatrix( product );
} }

View file

@ -243,7 +243,7 @@ void RB_InstantQuad(vec4_t quadVerts[4])
GLSL_BindProgram(&tr.textureColorShader); 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); GLSL_SetUniformVec4(&tr.textureColorShader, UNIFORM_COLOR, colorWhite);
RB_InstantQuad2(quadVerts, texCoords); RB_InstantQuad2(quadVerts, texCoords);
@ -630,7 +630,7 @@ static void RB_SurfaceBeam( void )
GLSL_VertexAttribsState(ATTR_POSITION); GLSL_VertexAttribsState(ATTR_POSITION);
GLSL_BindProgram(sp); GLSL_BindProgram(sp);
GLSL_SetUniformMatrix16(sp, UNIFORM_MODELVIEWPROJECTIONMATRIX, glState.modelviewProjection); GLSL_SetUniformMat4(sp, UNIFORM_MODELVIEWPROJECTIONMATRIX, glState.modelviewProjection);
GLSL_SetUniformVec4(sp, UNIFORM_COLOR, colorRed); GLSL_SetUniformVec4(sp, UNIFORM_COLOR, colorRed);
@ -856,6 +856,7 @@ static void RB_SurfaceLightningBolt( void ) {
} }
} }
#if 0
/* /*
** VectorArrayNormalize ** VectorArrayNormalize
* *
@ -911,12 +912,14 @@ static void VectorArrayNormalize(vec4_t *normals, unsigned int count)
#endif #endif
} }
#endif
/* /*
** LerpMeshVertexes ** LerpMeshVertexes
*/ */
#if 0
#if idppc_altivec #if idppc_altivec
static void LerpMeshVertexes_altivec(md3Surface_t *surf, float backlerp) static void LerpMeshVertexes_altivec(md3Surface_t *surf, float backlerp)
{ {
@ -1046,6 +1049,7 @@ static void LerpMeshVertexes_altivec(md3Surface_t *surf, float backlerp)
} }
} }
#endif #endif
#endif
static void LerpMeshVertexes_scalar(mdvSurface_t *surf, float backlerp) static void LerpMeshVertexes_scalar(mdvSurface_t *surf, float backlerp)
{ {