diff --git a/README b/README.md similarity index 55% rename from README rename to README.md index 1f4cf49c..e8cd6f0e 100644 --- a/README +++ b/README.md @@ -39,7 +39,7 @@ renamed to id-readme.txt so as to prevent confusion. Please refer to the web-site for updated status. ---------------------------------------------- Compilation and installation ----- +# Compilation and installation For *nix 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 Makefile.local: +``` CFLAGS - use this for custom CFLAGS V - set to show cc command line when building 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 COPYDIR - the target installation directory TEMPDIR - specify user defined directory for temp files +``` 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_aviFrameRate - the framerate to use when capturing video cl_aviMotionJpeg - use the mjpeg codec when capturing video @@ -271,8 +275,11 @@ New cvars cl_aviMotionJpeg is enabled r_mode -2 - This new video mode automatically uses the desktop resolution. +``` -New commands +## New commands + +``` video [filename] - start video capture (use with demo command) stopvideo - stop video capture stopmusic - stop background music @@ -307,132 +314,150 @@ New commands all bots even if someone is named "allbots") tell - send message to a single client (new to server) +``` ---------------------------------------------------------- README for Users ----- +# README for Users -Using shared libraries instead of qvm - 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 +## Using shared libraries instead of qvm -Using Demo Data Files - 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 - shared libraries or qvms from this project. To use the new qvms, they must be - put into a pk3 file. A pk3 file is just a zip file, so any compression tool - that can create such files will work. The shared libraries should already be - in the correct place. Use the instructions above to use them. +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` - Please bear in mind that you will not be able to play online using the demo - data, nor is it something that we like to spend much time maintaining or - supporting. +## Using Demo Data Files -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 - next frame when com_maxfps was hit. This will improve your CPU load - considerably in these cases. However, not all systems may support a - granularity for its timing functions that is required to perform this waiting - correctly. For instance, ioquake3 tells select() to wait 2 milliseconds, but - really it can only wait for a multiple of 5ms, i.e. 5, 10, 15, 20... ms. - In this case you can always revert back to the old behaviour by setting the - cvar com_busyWait to 1. +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 +shared libraries or qvms from this project. To use the new qvms, they must be +put into a pk3 file. A pk3 file is just a zip file, so any compression tool +that can create such files will work. The shared libraries should already be +in the correct place. Use the instructions above to use them. -Using HTTP/FTP Download Support (Server) - 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 - the sv_dlURL cvar into your SERVERINFO string and ensure sv_allowDownloads - is set to 1 +Please bear in mind that you will not be able to play online using the demo +data, nor is it something that we like to spend much time maintaining or +supporting. - 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 - this value. For example, if you have sv_dlURL set to - "http://ioquake3.org", fs_game is "baseq3", and the client is - missing "test.pk3", it will attempt to download from the URL - "http://ioquake3.org/baseq3/test.pk3" +## Help! Ioquake3 won't give me an fps of X anymore when setting com_maxfps! - sv_allowDownload's value is now a bitmask made up of the following - flags: - 1 - ENABLE - 4 - do not use UDP downloads - 8 - do not ask the client to disconnect when using HTTP/FTP +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 +considerably in these cases. However, not all systems may support a +granularity for its timing functions that is required to perform this waiting +correctly. For instance, ioquake3 tells select() to wait 2 milliseconds, but +really it can only wait for a multiple of 5ms, i.e. 5, 10, 15, 20... ms. +In this case you can always revert back to the old behaviour by setting the +cvar com_busyWait to 1. - Server operators who are concerned about potential "leeching" from their - HTTP servers from other ioquake3 servers can make use of the HTTP_REFERER - that ioquake3 sets which is "ioQ3://{SERVER_IP}:{SERVER_PORT}". For, - example, Apache's mod_rewrite can restrict access based on HTTP_REFERER. +## Using HTTP/FTP Download Support (Server) - On a sidenote, downloading via UDP has been improved and yields higher data - rates now. You can configure the maximum bandwidth for UDP downloads via the - 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. +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 +the sv_dlURL cvar into your SERVERINFO string and ensure sv_allowDownloads +is set to 1 -Using HTTP/FTP Download Support (Client) - Simply setting cl_allowDownload to 1 will enable HTTP/FTP downloads - assuming ioquake3 was compiled with USE_CURL=1 (the default). - like sv_allowDownload, cl_allowDownload also uses a bitmask value - supporting the following flags: - 1 - ENABLE - 2 - do not use HTTP/FTP downloads - 4 - do not use UDP downloads +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 +this value. For example, if you have sv_dlURL set to +`"http://ioquake3.org"`, fs_game is `"baseq3"`, and the client is +missing `"test.pk3"`, it will attempt to download from the URL +`"http://ioquake3.org/baseq3/test.pk3"` - 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 - library to dynamically load. +sv_allowDownload's value is now a bitmask made up of the following +flags: -Multiuser Support on Windows systems - On Windows, all user specific files such as autogenerated configuration, - demos, videos, screenshots, and autodownloaded pk3s are now saved in a - directory specific to the user who is running ioquake3. + * 1 - ENABLE + * 4 - do not use UDP downloads + * 8 - do not ask the client to disconnect when using HTTP/FTP - On NT-based such as Windows XP, this is usually a directory named: - "C:\Documents and Settings\%USERNAME%\Application Data\Quake3\" +Server operators who are concerned about potential "leeching" from their +HTTP servers from other ioquake3 servers can make use of the HTTP_REFERER +that ioquake3 sets which is `"ioQ3://{SERVER_IP}:{SERVER_PORT}"`. For, +example, Apache's mod_rewrite can restrict access based on HTTP_REFERER. - Windows 95, Windows 98, and Windows ME will use a directory like: - "C:\Windows\Application Data\Quake3" - in single-user mode, or: - "C:\Windows\Profiles\%USERNAME%\Application Data\Quake3" - if multiple logins have been enabled. +On a sidenote, downloading via UDP has been improved and yields higher data +rates now. You can configure the maximum bandwidth for UDP downloads via the +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. - In order to access this directory more easily, the installer may create a - Shortcut which has its target set to: - "%APPDATA%\Quake3\" - This Shortcut would work for all users on the system regardless of the - locale settings. Unfortunately, this environment variable is only - present on Windows NT based systems. +## Using HTTP/FTP Download Support (Client) + +Simply setting cl_allowDownload to 1 will enable HTTP/FTP downloads +assuming ioquake3 was compiled with USE_CURL=1 (the default). +like sv_allowDownload, cl_allowDownload also uses a bitmask value +supporting the following flags: + + * 1 - ENABLE + * 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), +it will use the value of the cvar cl_cURLLib as the filename of the cURL +library to dynamically load. + +## Multiuser Support on Windows systems +On Windows, all user specific files such as autogenerated configuration, +demos, videos, screenshots, and autodownloaded pk3s are now saved in a +directory specific to the user who is running ioquake3. + +On NT-based such as Windows XP, this is usually a directory named: + + C:\Documents and Settings\%USERNAME%\Application Data\Quake3\ + +Windows 95, Windows 98, and Windows ME will use a directory like: + + C:\Windows\Application Data\Quake3 + +in single-user mode, or: + + C:\Windows\Profiles\%USERNAME%\Application Data\Quake3 + +if multiple logins have been enabled. + +In order to access this directory more easily, the installer may create a +Shortcut which has its target set to: + + %APPDATA%\Quake3\ + +This Shortcut would work for all users on the system regardless of the +locale settings. Unfortunately, this environment variable is only +present on Windows NT based systems. + +You can revert to the old single-user behaviour by setting the fs_homepath +cvar to the directory where ioquake3 is installed. For example: - You can revert to the old single-user behaviour by setting the fs_homepath - cvar to the directory where ioquake3 is installed. For example: ioquake3.exe +set fs_homepath "c:\ioquake3" - Note that this cvar MUST be set as a command line parameter. -SDL Keyboard Differences - ioquake3 clients have different keyboard behaviour compared to the original - Quake3 clients. +Note that this cvar MUST be set as a command line parameter. - * "Caps Lock" and "Num Lock" can not be used as normal binds since they +## SDL Keyboard Differences + +ioquake3 clients have different keyboard behaviour compared to the original +Quake3 clients. + + * "Caps Lock" and "Num Lock" can not be used as normal binds since they do not send a KEYUP event until the key is pressed again. - * SDL > 1.2.9 does not support disabling dead key recognition. In order to + * SDL > 1.2.9 does not support disabling dead key recognition. In order to send dead key characters (e.g. ~, ', `, and ^), you must key a Space (or sometimes the same character again) after the character to send it on many international keyboard layouts. - * The SDL client supports many more keys than the original Quake3 client. + * The SDL client supports many more keys than the original Quake3 client. For example the keys: "Windows", "SysReq", "ScrollLock", and "Break". For non-US keyboards, all of the so called "World" keys are now supported as well as F13, F14, F15, and the country-specific mode/meta keys. - On many international layouts the default console toggle keys are also dead - keys, meaning that dropping the console potentially results in - unintentionally initiating the keying of a dead key. Furthermore SDL 1.2's - dead key support is broken by design and Q3 doesn't support non-ASCII text - entry, so the chances are you won't get the correct character anyway. +On many international layouts the default console toggle keys are also dead +keys, meaning that dropping the console potentially results in +unintentionally initiating the keying of a dead key. Furthermore SDL 1.2's +dead key support is broken by design and Q3 doesn't support non-ASCII text +entry, so the chances are you won't get the correct character anyway. - If you use such a keyboard layout, you can set the cvar cl_consoleKeys. This - is a space delimited list of key names that will toggle the console. The key - names are the usual Q3 names e.g. "~", "`", "c", "BACKSPACE", "PAUSE", - "WINDOWS" etc. It's also possible to use ASCII characters, by hexadecimal - number. Some example values for cl_consoleKeys: +If you use such a keyboard layout, you can set the cvar cl_consoleKeys. This +is a space delimited list of key names that will toggle the console. The key +names are the usual Q3 names e.g. "~", "`", "c", "BACKSPACE", "PAUSE", +"WINDOWS" etc. It's also possible to use ASCII characters, by hexadecimal +number. Some example values for cl_consoleKeys: "~ ` 0x7e 0x60" Toggle on ~ or ` (the default) "WINDOWS" Toggle on the Windows key @@ -440,75 +465,79 @@ SDL Keyboard Differences "0x43" Toggle on the C character (Shift-c) "PAUSE F1 PGUP" Toggle on the Pause, F1 or Page Up keys - Note that when you elect a set of console keys or characters, they cannot - then be used for binding, nor will they generate characters when entering - text. Also, in addition to the nominated console keys, Shift-ESC is hard - coded to always toggle the console. +Note that when you elect a set of console keys or characters, they cannot +then be used for binding, nor will they generate characters when entering +text. Also, in addition to the nominated console keys, Shift-ESC is hard +coded to always toggle the console. -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 - 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 - players: - To enable it, set cl_mouseAccelStyle 1 (0 is the default/legacy behavior) +## QuakeLive mouse acceleration +(patch and this text written by TTimo from id) - New style is controlled with 3 cvars: +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 +understand the explanations below, this is mostly intended for advanced +players: +To enable it, set cl_mouseAccelStyle 1 (0 is the default/legacy behavior) - sensitivity - cl_mouseAccel - cl_mouseAccelOffset +New style is controlled with 3 cvars: - The old code (cl_mouseAccelStyle 0) can be difficult to calibrate because if - you have a base sensitivity setup, as soon as you set a non zero acceleration - your base sensitivity at low speeds will change as well. The other problem - with style 0 is that you are stuck on a square (power of two) acceleration - curve. +sensitivity +cl_mouseAccel +cl_mouseAccelOffset - The new code tries to solve both problems: +The old code (cl_mouseAccelStyle 0) can be difficult to calibrate because if +you have a base sensitivity setup, as soon as you set a non zero acceleration +your base sensitivity at low speeds will change as well. The other problem +with style 0 is that you are stuck on a square (power of two) acceleration +curve. - Once you setup your sensitivity to feel comfortable and accurate enough for - low mouse deltas with no acceleration (cl_mouseAccel 0), you can start - increasing cl_mouseAccel and tweaking cl_mouseAccelOffset to get the - amplification you want for high deltas with little effect on low mouse deltas. +The new code tries to solve both problems: - cl_mouseAccel is a power value. Should be >= 1, 2 will be the same power curve - as style 0. The higher the value, the faster the amplification grows with the - mouse delta. +Once you setup your sensitivity to feel comfortable and accurate enough for +low mouse deltas with no acceleration (cl_mouseAccel 0), you can start +increasing cl_mouseAccel and tweaking cl_mouseAccelOffset to get the +amplification you want for high deltas with little effect on low mouse deltas. - cl_mouseAccelOffset sets how much base mouse delta will be doubled by - acceleration. The closer to zero you bring it, the more acceleration will - happen at low speeds. This is also very useful if you are changing to a new - mouse with higher dpi, if you go from 500 to 1000 dpi, you can divide your - cl_mouseAccelOffset by two to keep the same overall 'feel' (you will likely - gain in precision when you do that, but that is not related to mouse - acceleration). +cl_mouseAccel is a power value. Should be >= 1, 2 will be the same power curve +as style 0. The higher the value, the faster the amplification grows with the +mouse delta. - Mouse acceleration is tricky to configure, and when you do you'll have to - re-learn your aiming. But you will find that it's very much forth it in the - long run. +cl_mouseAccelOffset sets how much base mouse delta will be doubled by +acceleration. The closer to zero you bring it, the more acceleration will +happen at low speeds. This is also very useful if you are changing to a new +mouse with higher dpi, if you go from 500 to 1000 dpi, you can divide your +cl_mouseAccelOffset by two to keep the same overall 'feel' (you will likely +gain in precision when you do that, but that is not related to mouse +acceleration). - If you try the new acceleration code and start using it, I'd be very - interested by your feedback. +Mouse acceleration is tricky to configure, and when you do you'll have to +re-learn your aiming. But you will find that it's very much forth it in the +long run. + +If you try the new acceleration code and start using it, I'd be very +interested by your feedback. ----------------------------------------------------- README for Developers ----- +# README for Developers -pk3dir - 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 - all files specific to your map in one directory tree and easily zip this - folder for distribution. +## pk3dir -64bit mods - 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 - interface code a little. Open the files ending in _syscalls.c and change - every instance of int to intptr_t in the declaration of the syscall function - pointer and the dllEntry function. Also find the vmMain function for each - module (usually in cg_main.c g_main.c etc.) and similarly replace the return - value in the prototype with intptr_t (arg0, arg1, ...stay int). +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 +all files specific to your map in one directory tree and easily zip this +folder for distribution. - Add the following code snippet to q_shared.h: +## 64bit mods + +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 +interface code a little. Open the files ending in _syscalls.c and change +every instance of int to intptr_t in the declaration of the syscall function +pointer and the dllEntry function. Also find the vmMain function for each +module (usually in cg_main.c g_main.c etc.) and similarly replace the return +value in the prototype with intptr_t (arg0, arg1, ...stay int). + +Add the following code snippet to q_shared.h: #ifdef Q3_VM typedef int intptr_t; @@ -516,165 +545,173 @@ pk3dir #include #endif - 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. +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. -Creating mods compatible with Q3 1.32b - 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 - 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 - compiler. +## Creating mods compatible with Q3 1.32b -Creating standalone games - 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 - the game without owning a copy of Q3, which consequently means removing cd-key - and authentication server checks. In addition to being a straightforward Q3 - client, ioquake3 also purports to be a reliable and stable code base on which - to base your game project. +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 +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 +compiler. - However, before you start compiling your own version of ioquake3, you have to - ask yourself: Have we changed or will we need to change anything of importance - in the engine? +## Creating standalone games - If your answer to this question is "no", it probably makes no sense to build - your own binaries. Instead, you can just use the pre-built binaries on the - website. Just make sure the game is called with: +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 +the game without owning a copy of Q3, which consequently means removing cd-key +and authentication server checks. In addition to being a straightforward Q3 +client, ioquake3 also purports to be a reliable and stable code base on which +to base your game project. + +However, before you start compiling your own version of ioquake3, you have to +ask yourself: Have we changed or will we need to change anything of importance +in the engine? + +If your answer to this question is "no", it probably makes no sense to build +your own binaries. Instead, you can just use the pre-built binaries on the +website. Just make sure the game is called with: +set com_basegame - in any links/scripts you install for your users to start the game. The - binary must not detect any original quake3 game pak files. If this - condition is met, the game will set com_standalone to 1 and is then running - in stand alone mode. - - If you want the engine to use a different directory in your homepath than - e.g. "Quake3" on Windows or ".q3a" on Linux, then set a new name at startup - by adding +in any links/scripts you install for your users to start the game. The +binary must not detect any original quake3 game pak files. If this +condition is met, the game will set com_standalone to 1 and is then running +in stand alone mode. +If you want the engine to use a different directory in your homepath than +e.g. "Quake3" on Windows or ".q3a" on Linux, then set a new name at startup +by adding + +set com_homepath - - to the command line. You can also control which game name to use when talking - to the master server: - + +to the command line. You can also control which game name to use when talking +to the master server: + +set com_gamename - - So clients requesting a server list will only receive servers that have a - matching game name. - - Example line: - + +So clients requesting a server list will only receive servers that have a +matching game name. + +Example line: + +set com_basegame basefoo +set com_homepath .foo +set com_gamename foo +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 +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 +information appropriate for your project. - 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 - 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 - information appropriate for your project. +## Standalone game licensing - 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 - aware that as soon as you start distributing your game with an engine based on - our sources we expect you to fully comply with the requirements as stated in - the GPL. That includes making sources and modifications you made to the - ioquake3 engine as well as the game-code used to compile the .qvm files for - the game logic freely available to everyone. Furthermore, note that the "QIIIA - Game Source License" prohibits distribution of mods that are intended to - operate on a version of Q3 not sanctioned by id software: +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 +aware that as soon as you start distributing your game with an engine based on +our sources we expect you to fully comply with the requirements as stated in +the GPL. That includes making sources and modifications you made to the +ioquake3 engine as well as the game-code used to compile the .qvm files for +the game logic freely available to everyone. Furthermore, note that the "QIIIA +Game Source License" prohibits distribution of mods that are intended to +operate on a version of Q3 not sanctioned by id software: "with this Agreement, ID grants to you the non-exclusive and limited right to distribute copies of the Software ... for operation only with the full version of the software game QUAKE III ARENA" - This means that if you're creating a standalone game, you cannot use said - license on any portion of the product. As the only other license this code has - been released under is the GPL, this is the only option. +This means that if you're creating a standalone game, you cannot use said +license on any portion of the product. As the only other license this code has +been released under is the GPL, this is the only option. - This does NOT mean that you cannot market this game commercially. The GPL does - not prohibit commercial exploitation and all assets (e.g. textures, sounds, - maps) created by yourself are your property and can be sold like every other - game you find in stores. +This does NOT mean that you cannot market this game commercially. The GPL does +not prohibit commercial exploitation and all assets (e.g. textures, sounds, +maps) created by yourself are your property and can be sold like every other +game you find in stores. -Network protocols - There are now two cvars that give you some degree of freedom over the reported - protocol versions between clients and servers: "com_protocol" and - "com_legacyprotocol". - The reason for this is that some standalone games increased the protocol - number even though nothing really changed in their protocol and the ioquake3 - engine is still fully compatible. +## Network protocols - In order to harden the network protocol against UDP spoofing attacks a new - network protocol was introduced that defends against such attacks. - Unfortunately, this protocol will be incompatible to the original quake3 1.32c - which is the latest official release from id. - Luckily, ioquake3 has backwards compatibility, on the client as well as on the - server. This means ioquake3 players can play on old servers just as ioquake3 - servers are able to service old clients. +There are now two cvars that give you some degree of freedom over the reported +protocol versions between clients and servers: "com_protocol" and +"com_legacyprotocol". +The reason for this is that some standalone games increased the protocol +number even though nothing really changed in their protocol and the ioquake3 +engine is still fully compatible. - The cvar "com_protocol" denotes the protocol version for the new hardened - protocol, whereas the "com_legacyprotocol" cvar denotes the protocol version - for the legacy protocol. - If the value for "com_protocol" and "com_legacyprotocol" is identical, then - the legacy protocol is always used. If "com_legacyprotocol" is set to 0, then - support for the legacy protocol is disabled. - - Mods that use a standalone engine obviously do not require dual protocol - support, and it is turned off if the engine is compiled with STANDALONE per - default. If you desire backwards compatibility to older versions of your - game you can still enable it in q_shared.h by defining - LEGACY_PROTOCOL. +In order to harden the network protocol against UDP spoofing attacks a new +network protocol was introduced that defends against such attacks. +Unfortunately, this protocol will be incompatible to the original quake3 1.32c +which is the latest official release from id. +Luckily, ioquake3 has backwards compatibility, on the client as well as on the +server. This means ioquake3 players can play on old servers just as ioquake3 +servers are able to service old clients. -cl_guid Support - 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 - value is pseudo-unique for every player. Id's Quake 3 Arena client also - sets cl_guid, but only if Punkbuster is enabled on the client. +The cvar "com_protocol" denotes the protocol version for the new hardened +protocol, whereas the "com_legacyprotocol" cvar denotes the protocol version +for the legacy protocol. +If the value for "com_protocol" and "com_legacyprotocol" is identical, then +the legacy protocol is always used. If "com_legacyprotocol" is set to 0, then +support for the legacy protocol is disabled. - If cl_guidServerUniq is non-zero (the default), then this value is also - pseudo-unique for each server a client connects to (based on IP:PORT of - the server). +Mods that use a standalone engine obviously do not require dual protocol +support, and it is turned off if the engine is compiled with STANDALONE per +default. If you desire backwards compatibility to older versions of your +game you can still enable it in q_shared.h by defining +LEGACY_PROTOCOL. - The purpose of cl_guid is to add an identifier for each player on - 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 - your mod's game code: - 1) improve logging to allow statistical tools to index players by more +## cl_guid Support + +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 +value is pseudo-unique for every player. Id's Quake 3 Arena client also +sets cl_guid, but only if Punkbuster is enabled on the client. + +If cl_guidServerUniq is non-zero (the default), then this value is also +pseudo-unique for each server a client connects to (based on IP:PORT of +the server). + +The purpose of cl_guid is to add an identifier for each player on +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 +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 + 2. granting some weak admin rights to players without requiring passwords -PNG support - 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 - result in missing placeholder textures where the map is used with the id - Quake 3 client or earlier versions of ioquake3. +## PNG support - Recent versions of GtkRadiant and q3map2 support PNG images without - modification. However GtkRadiant is not aware that PNG textures are supported - by ioquake3. To change this behaviour open the file 'q3.game' in the 'games' - directory of the GtkRadiant base directory with an editor and change the - line: +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 +result in missing placeholder textures where the map is used with the id +Quake 3 client or earlier versions of ioquake3. + +Recent versions of GtkRadiant and q3map2 support PNG images without +modification. However GtkRadiant is not aware that PNG textures are supported +by ioquake3. To change this behaviour open the file 'q3.game' in the 'games' +directory of the GtkRadiant base directory with an editor and change the +line: texturetypes="tga jpg" - to +to texturetypes="tga jpg png" - Restart GtkRadiant and PNG textures are now available. +Restart GtkRadiant and PNG textures are now available. -Building with MinGW for pre Windows XP - IPv6 support requires a header named "wspiapi.h" to abstract away from - differences in earlier versions of Windows' IPv6 stack. There is no MinGW - equivalent of this header and the Microsoft version is obviously not - redistributable, so in its absence we're forced to require Windows XP. - However if this header is acquired separately and placed in the qcommon/ - directory, this restriction is lifted. +## Building with MinGW for pre Windows XP + +IPv6 support requires a header named "wspiapi.h" to abstract away from +differences in earlier versions of Windows' IPv6 stack. There is no MinGW +equivalent of this header and the Microsoft version is obviously not +redistributable, so in its absence we're forced to require Windows XP. +However if this header is acquired separately and placed in the qcommon/ +directory, this restriction is lifted. -------------------------------------------------------------- Contributing ----- +# Contributing 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 @@ -689,7 +726,7 @@ accepted as long as they are entirely optional, do not require new media and are off by default. ---------------------------------------------- Building Official Installers ----- +# Building Official Installers We need help getting automated installers on all the platforms that ioquake3 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 a done deal. ------------------------------------------------------------------- Credits ----- + +# Credits Maintainers - James Canete - Ludwig Nussel - Thilo Schulz - Tim Angus - Tony J. White - Zachary J. Slater - Zack Middleton + + * James Canete + * Ludwig Nussel + * Thilo Schulz + * Tim Angus + * Tony J. White + * Zachary J. Slater + * Zack Middleton Significant contributions from - Ryan C. Gordon - Andreas Kohn - Joerg Dietrich - Stuart Dalton - Vincent S. Cojot - optical - Aaron Gyes + + * Ryan C. Gordon + * Andreas Kohn + * Joerg Dietrich + * Stuart Dalton + * Vincent S. Cojot + * optical + * Aaron Gyes + + +[![githalytics.com alpha](https://cruel-carlota.pagodabox.com/f88af076b5015c62b699968f6772c3a5 "githalytics.com")](http://githalytics.com/ioquake/ioq3) diff --git a/code/client/snd_dma.c b/code/client/snd_dma.c index 1e78f350..d623ec4c 100644 --- a/code/client/snd_dma.c +++ b/code/client/snd_dma.c @@ -1371,6 +1371,32 @@ void S_Base_StopBackgroundTrack( void ) { 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 @@ -1397,24 +1423,7 @@ void S_Base_StartBackgroundTrack( const char *intro, const char *loop ){ Q_strncpyz( s_backgroundLoop, loop, sizeof( s_backgroundLoop ) ); } - // 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(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 ); - } + S_OpenBackgroundStream( intro ); } /* @@ -1477,9 +1486,7 @@ void S_UpdateBackgroundTrack( void ) { // loop if(s_backgroundLoop[0]) { - S_CodecCloseStream(s_backgroundStream); - s_backgroundStream = NULL; - S_Base_StartBackgroundTrack( s_backgroundLoop, s_backgroundLoop ); + S_OpenBackgroundStream( s_backgroundLoop ); if(!s_backgroundStream) return; } diff --git a/code/game/g_client.c b/code/game/g_client.c index 737707cd..ee88fac5 100644 --- a/code/game/g_client.c +++ b/code/game/g_client.c @@ -426,7 +426,7 @@ void CopyToBodyQue( gentity_t *ent ) { body->s.eFlags |= EF_KAMIKAZE; // 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]; if (!e->inuse) continue; diff --git a/code/game/g_combat.c b/code/game/g_combat.c index ed0de7f2..2fbd3170 100644 --- a/code/game/g_combat.c +++ b/code/game/g_combat.c @@ -241,7 +241,7 @@ void GibEntity( gentity_t *self, int killer ) { //if this entity still has kamikaze if (self->s.eFlags & EF_KAMIKAZE) { // 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]; if (!ent->inuse) continue; diff --git a/code/renderergl1/tr_backend.c b/code/renderergl1/tr_backend.c index 60449261..0a3fe036 100644 --- a/code/renderergl1/tr_backend.c +++ b/code/renderergl1/tr_backend.c @@ -737,6 +737,10 @@ void RE_StretchRaw (int x, int y, int w, int h, int cols, int rows, const byte * } R_IssuePendingRenderCommands(); + if ( tess.numIndexes ) { + RB_EndSurface(); + } + // we definately want to sync every frame for the cinematics qglFinish(); diff --git a/code/renderergl2/tr_backend.c b/code/renderergl2/tr_backend.c index 10d05353..a050379a 100644 --- a/code/renderergl2/tr_backend.c +++ b/code/renderergl2/tr_backend.c @@ -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); - 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); } @@ -765,7 +765,7 @@ RB_SetGL2D ================ */ void RB_SetGL2D (void) { - matrix_t matrix; + mat4_t matrix; int width, height; if (backEnd.projection2D && backEnd.last2DFBO == glState.currentFBO) @@ -789,9 +789,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 | @@ -830,6 +830,10 @@ void RE_StretchRaw (int x, int y, int w, int h, int cols, int rows, const byte * } R_IssuePendingRenderCommands(); + if ( tess.numIndexes ) { + RB_EndSurface(); + } + // we definately want to sync every frame for the cinematics 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_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); @@ -1122,9 +1126,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); { @@ -1578,7 +1582,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 @@ -1664,7 +1668,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); @@ -1675,7 +1679,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); @@ -1684,7 +1688,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); } @@ -1692,7 +1696,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/code/renderergl2/tr_extramath.c b/code/renderergl2/tr_extramath.c index 8cb6fe1a..b844678f 100644 --- a/code/renderergl2/tr_extramath.c +++ b/code/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/code/renderergl2/tr_extramath.h b/code/renderergl2/tr_extramath.h index 3e11bb48..08fb080a 100644 --- a/code/renderergl2/tr_extramath.h +++ b/code/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]; +typedef vec_t mat4_t[16]; +typedef int ivec2_t[2]; +typedef int ivec3_t[3]; +typedef int ivec4_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); +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/code/renderergl2/tr_fbo.c b/code/renderergl2/tr_fbo.c index d9fd917f..c76e7db1 100644 --- a/code/renderergl2/tr_fbo.c +++ b/code/renderergl2/tr_fbo.c @@ -386,7 +386,7 @@ void FBO_Init(void) hdrFormat = GL_RGBA8; if (r_hdr->integer && glRefConfig.framebufferObject && glRefConfig.textureFloat) { - hdrFormat = GL_RGB16F_ARB; + hdrFormat = GL_RGBA16F_ARB; } qglGetIntegerv(GL_MAX_SAMPLES_EXT, &multisample); @@ -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/code/renderergl2/tr_fbo.h b/code/renderergl2/tr_fbo.h index f0366251..b5ab18c1 100644 --- a/code/renderergl2/tr_fbo.h +++ b/code/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/code/renderergl2/tr_flares.c b/code/renderergl2/tr_flares.c index 4447aa23..e1d46d54 100644 --- a/code/renderergl2/tr_flares.c +++ b/code/renderergl2/tr_flares.c @@ -277,6 +277,7 @@ void RB_TestFlare( flare_t *f ) { qboolean visible; float fade; float screenZ; + FBO_t *oldFbo; backEnd.pc.c_flareTests++; @@ -284,9 +285,22 @@ void RB_TestFlare( flare_t *f ) { // don't bother with another sync 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 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] / ( ( 2*depth - 1 ) * backEnd.viewParms.projectionMatrix[11] - backEnd.viewParms.projectionMatrix[10] ); @@ -458,7 +472,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; @@ -516,11 +530,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/code/renderergl2/tr_glsl.c b/code/renderergl2/tr_glsl.c index d0573b97..42ce225e 100644 --- a/code/renderergl2/tr_glsl.c +++ b/code/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/code/renderergl2/tr_image.c b/code/renderergl2/tr_image.c index 56b4b882..670b4499 100644 --- a/code/renderergl2/tr_image.c +++ b/code/renderergl2/tr_image.c @@ -2922,7 +2922,7 @@ void R_CreateBuiltinImages( void ) { hdrFormat = GL_RGBA8; if (r_hdr->integer && glRefConfig.framebufferObject && glRefConfig.textureFloat) - hdrFormat = GL_RGB16F_ARB; + hdrFormat = GL_RGBA16F_ARB; rgbFormat = GL_RGBA8; @@ -2941,7 +2941,7 @@ void R_CreateBuiltinImages( void ) { unsigned short sdata[4]; void *p; - if (hdrFormat == GL_RGB16F_ARB) + if (hdrFormat == GL_RGBA16F_ARB) { sdata[0] = FloatToHalf(0.0f); sdata[1] = FloatToHalf(0.45f); diff --git a/code/renderergl2/tr_local.h b/code/renderergl2/tr_local.h index bdf502b8..6268549e 100644 --- a/code/renderergl2/tr_local.h +++ b/code/renderergl2/tr_local.h @@ -1454,9 +1454,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 { @@ -1964,8 +1964,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 ); @@ -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_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/code/renderergl2/tr_main.c b/code/renderergl2/tr_main.c index e87bb8ee..81bd09f3 100644 --- a/code/renderergl2/tr_main.c +++ b/code/renderergl2/tr_main.c @@ -840,7 +840,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 @@ -2634,7 +2634,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; @@ -2642,7 +2642,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]); @@ -2653,22 +2653,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]); @@ -2679,22 +2679,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) @@ -2792,7 +2792,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/code/renderergl2/tr_postprocess.c b/code/renderergl2/tr_postprocess.c index dba19d4a..35982fce 100644 --- a/code/renderergl2/tr_postprocess.c +++ b/code/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/code/renderergl2/tr_postprocess.h b/code/renderergl2/tr_postprocess.h index 6c34ecc2..09daf134 100644 --- a/code/renderergl2/tr_postprocess.h +++ b/code/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/code/renderergl2/tr_shade.c b/code/renderergl2/tr_shade.c index 695b42fc..9e53e73b 100644 --- a/code/renderergl2/tr_shade.c +++ b/code/renderergl2/tr_shade.c @@ -148,7 +148,7 @@ static void DrawTris (shaderCommands_t *input) { GLSL_VertexAttribsState(ATTR_POSITION); GLSL_BindProgram(sp); - GLSL_SetUniformMatrix16(sp, UNIFORM_MODELVIEWPROJECTIONMATRIX, glState.modelviewProjection); + GLSL_SetUniformMat4(sp, UNIFORM_MODELVIEWPROJECTIONMATRIX, glState.modelviewProjection); VectorSet4(color, 1, 1, 1, 1); GLSL_SetUniformVec4(sp, UNIFORM_COLOR, color); @@ -392,7 +392,7 @@ static void ProjectDlightTexture( void ) { GLSL_BindProgram(sp); - GLSL_SetUniformMatrix16(sp, UNIFORM_MODELVIEWPROJECTIONMATRIX, glState.modelviewProjection); + GLSL_SetUniformMat4(sp, UNIFORM_MODELVIEWPROJECTIONMATRIX, glState.modelviewProjection); GLSL_SetUniformFloat(sp, UNIFORM_VERTEXLERP, glState.vertexAttribsInterpolation); @@ -757,7 +757,7 @@ static void ForwardDlight( void ) { 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_LOCALVIEWORIGIN, backEnd.or.viewOrigin); @@ -817,7 +817,7 @@ static void ForwardDlight( void ) { // where they aren't rendered 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]) R_BindAnimatedImageToTMU( &pStage->bundle[TB_DIFFUSEMAP], TB_DIFFUSEMAP); @@ -894,7 +894,7 @@ static void ProjectPshadowVBOGLSL( void ) { GLSL_BindProgram(sp); - GLSL_SetUniformMatrix16(sp, UNIFORM_MODELVIEWPROJECTIONMATRIX, glState.modelviewProjection); + GLSL_SetUniformMat4(sp, UNIFORM_MODELVIEWPROJECTIONMATRIX, glState.modelviewProjection); VectorCopy(origin, vector); vector[3] = 1.0f; @@ -974,7 +974,7 @@ static void RB_FogPass( void ) { 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); @@ -1132,7 +1132,7 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input ) 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_LOCALVIEWORIGIN, backEnd.or.viewOrigin); @@ -1220,7 +1220,7 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input ) 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); @@ -1391,9 +1391,9 @@ static void RB_RenderShadowmap( shaderCommands_t *input ) 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); diff --git a/code/renderergl2/tr_sky.c b/code/renderergl2/tr_sky.c index 13eb4042..6a220318 100644 --- a/code/renderergl2/tr_sky.c +++ b/code/renderergl2/tr_sky.c @@ -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_BindProgram(sp); - GLSL_SetUniformMatrix16(sp, UNIFORM_MODELVIEWPROJECTIONMATRIX, glState.modelviewProjection); + GLSL_SetUniformMat4(sp, UNIFORM_MODELVIEWPROJECTIONMATRIX, glState.modelviewProjection); color[0] = 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_BindProgram(sp); - GLSL_SetUniformMatrix16(sp, UNIFORM_MODELVIEWPROJECTIONMATRIX, glState.modelviewProjection); + GLSL_SetUniformMat4(sp, UNIFORM_MODELVIEWPROJECTIONMATRIX, glState.modelviewProjection); color[0] = 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]); { // 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 ); } @@ -869,18 +869,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 ); } diff --git a/code/renderergl2/tr_surface.c b/code/renderergl2/tr_surface.c index 8978519c..ee368cbd 100644 --- a/code/renderergl2/tr_surface.c +++ b/code/renderergl2/tr_surface.c @@ -243,7 +243,7 @@ void RB_InstantQuad(vec4_t quadVerts[4]) 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); @@ -630,7 +630,7 @@ static void RB_SurfaceBeam( void ) GLSL_VertexAttribsState(ATTR_POSITION); GLSL_BindProgram(sp); - GLSL_SetUniformMatrix16(sp, UNIFORM_MODELVIEWPROJECTIONMATRIX, glState.modelviewProjection); + GLSL_SetUniformMat4(sp, UNIFORM_MODELVIEWPROJECTIONMATRIX, glState.modelviewProjection); GLSL_SetUniformVec4(sp, UNIFORM_COLOR, colorRed); @@ -856,6 +856,7 @@ static void RB_SurfaceLightningBolt( void ) { } } +#if 0 /* ** VectorArrayNormalize * @@ -911,12 +912,14 @@ static void VectorArrayNormalize(vec4_t *normals, unsigned int count) #endif } +#endif /* ** LerpMeshVertexes */ +#if 0 #if idppc_altivec static void LerpMeshVertexes_altivec(md3Surface_t *surf, float backlerp) { @@ -1046,6 +1049,7 @@ static void LerpMeshVertexes_altivec(md3Surface_t *surf, float backlerp) } } #endif +#endif static void LerpMeshVertexes_scalar(mdvSurface_t *surf, float backlerp) {