mirror of
https://github.com/UberGames/lilium-voyager.git
synced 2024-11-10 06:31:47 +00:00
Merge branch 'master' into game/eliteforce
Conflicts: Makefile code/qcommon/q_shared.h
This commit is contained in:
commit
69f9c7d692
132 changed files with 10874 additions and 3238 deletions
5
.gitignore
vendored
5
.gitignore
vendored
|
@ -2,6 +2,7 @@ build
|
|||
Makefile.local
|
||||
*.swp
|
||||
*tags
|
||||
*~
|
||||
|
||||
# OS X
|
||||
####################
|
||||
|
@ -35,4 +36,6 @@ profile
|
|||
|
||||
# Microsoft Visual Studio
|
||||
####################
|
||||
*.sdf
|
||||
*.sdf
|
||||
*.opensdf
|
||||
*.suo
|
||||
|
|
116
Makefile
116
Makefile
|
@ -3,18 +3,12 @@
|
|||
#
|
||||
# GNU Make required
|
||||
#
|
||||
|
||||
COMPILE_PLATFORM=$(shell uname|sed -e s/_.*//|tr '[:upper:]' '[:lower:]'|sed -e 's/\//_/g')
|
||||
|
||||
COMPILE_ARCH=$(shell uname -m | sed -e s/i.86/x86/ | sed -e 's/^arm.*/arm/')
|
||||
COMPILE_PLATFORM=$(shell uname | sed -e 's/_.*//' | tr '[:upper:]' '[:lower:]' | sed -e 's/\//_/g')
|
||||
COMPILE_ARCH=$(shell uname -m | sed -e 's/i.86/x86/' | sed -e 's/^arm.*/arm/')
|
||||
|
||||
ifeq ($(COMPILE_PLATFORM),sunos)
|
||||
# Solaris uname and GNU uname differ
|
||||
COMPILE_ARCH=$(shell uname -p | sed -e s/i.86/x86/)
|
||||
endif
|
||||
ifeq ($(COMPILE_PLATFORM),darwin)
|
||||
# Apple does some things a little differently...
|
||||
COMPILE_ARCH=$(shell uname -p | sed -e s/i.86/x86/)
|
||||
COMPILE_ARCH=$(shell uname -p | sed -e 's/i.86/x86/')
|
||||
endif
|
||||
|
||||
ifndef BUILD_ELITEFORCE
|
||||
|
@ -229,10 +223,6 @@ ifndef USE_INTERNAL_LIBS
|
|||
USE_INTERNAL_LIBS=1
|
||||
endif
|
||||
|
||||
ifndef USE_INTERNAL_SPEEX
|
||||
USE_INTERNAL_SPEEX=$(USE_INTERNAL_LIBS)
|
||||
endif
|
||||
|
||||
ifndef USE_INTERNAL_OGG
|
||||
USE_INTERNAL_OGG=$(USE_INTERNAL_LIBS)
|
||||
endif
|
||||
|
@ -262,7 +252,7 @@ USE_RENDERER_DLOPEN=1
|
|||
endif
|
||||
|
||||
ifndef DEBUG_CFLAGS
|
||||
DEBUG_CFLAGS=-g -O0
|
||||
DEBUG_CFLAGS=-ggdb -O0
|
||||
endif
|
||||
|
||||
#############################################################################
|
||||
|
@ -285,7 +275,6 @@ NDIR=$(MOUNT_DIR)/null
|
|||
UIDIR=$(MOUNT_DIR)/ui
|
||||
Q3UIDIR=$(MOUNT_DIR)/q3_ui
|
||||
JPDIR=$(MOUNT_DIR)/jpeg-8c
|
||||
SPEEXDIR=$(MOUNT_DIR)/libspeex
|
||||
OGGDIR=$(MOUNT_DIR)/libogg-1.3.1
|
||||
VORBISDIR=$(MOUNT_DIR)/libvorbis-1.3.4
|
||||
OPUSDIR=$(MOUNT_DIR)/opus-1.1
|
||||
|
@ -450,8 +439,7 @@ ifeq ($(PLATFORM),darwin)
|
|||
RENDERER_LIBS=
|
||||
OPTIMIZEVM=
|
||||
|
||||
BASE_CFLAGS = -Wall -Wimplicit -Wstrict-prototypes -mmacosx-version-min=10.5 \
|
||||
-DMAC_OS_X_VERSION_MIN_REQUIRED=1050
|
||||
BASE_CFLAGS += -mmacosx-version-min=10.7 -DMAC_OS_X_VERSION_MIN_REQUIRED=1070
|
||||
|
||||
ifeq ($(ARCH),ppc)
|
||||
BASE_CFLAGS += -arch ppc -faltivec
|
||||
|
@ -489,11 +477,9 @@ ifeq ($(PLATFORM),darwin)
|
|||
$(error Architecture $(ARCH) is not supported when cross compiling)
|
||||
endif
|
||||
endif
|
||||
else
|
||||
TOOLS_CFLAGS += -DMACOS_X
|
||||
endif
|
||||
|
||||
BASE_CFLAGS += -fno-strict-aliasing -DMACOS_X -fno-common -pipe
|
||||
BASE_CFLAGS += -fno-strict-aliasing -fno-common -pipe
|
||||
|
||||
ifeq ($(USE_OPENAL),1)
|
||||
ifneq ($(USE_OPENAL_DLOPEN),1)
|
||||
|
@ -510,6 +496,9 @@ ifeq ($(PLATFORM),darwin)
|
|||
|
||||
BASE_CFLAGS += -D_THREAD_SAFE=1
|
||||
|
||||
# FIXME: It is not possible to build using system SDL2 framework
|
||||
# 1. IF you try, this Makefile will still drop libSDL-2.0.0.dylib into the builddir
|
||||
# 2. Debugger warns that you have 2- which one will be used is undefined
|
||||
ifeq ($(USE_LOCAL_HEADERS),1)
|
||||
BASE_CFLAGS += -I$(SDLHDIR)/include
|
||||
endif
|
||||
|
@ -556,13 +545,13 @@ ifdef MINGW
|
|||
endif
|
||||
|
||||
ifndef CC
|
||||
CC=$(strip $(foreach MINGW_PREFIX, $(MINGW_PREFIXES), \
|
||||
$(call bin_path, $(MINGW_PREFIX)-gcc)))
|
||||
CC=$(firstword $(strip $(foreach MINGW_PREFIX, $(MINGW_PREFIXES), \
|
||||
$(call bin_path, $(MINGW_PREFIX)-gcc))))
|
||||
endif
|
||||
|
||||
ifndef WINDRES
|
||||
WINDRES=$(strip $(foreach MINGW_PREFIX, $(MINGW_PREFIXES), \
|
||||
$(call bin_path, $(MINGW_PREFIX)-windres)))
|
||||
WINDRES=$(firstword $(strip $(foreach MINGW_PREFIX, $(MINGW_PREFIXES), \
|
||||
$(call bin_path, $(MINGW_PREFIX)-windres))))
|
||||
endif
|
||||
else
|
||||
# Some MinGW installations define CC to cc, but don't actually provide cc,
|
||||
|
@ -1038,8 +1027,18 @@ ifeq ($(USE_CODEC_MP3),1)
|
|||
CLIENT_LIBS += $(MAD_LIBS)
|
||||
endif
|
||||
|
||||
ifeq ($(USE_VOIP),1)
|
||||
CLIENT_CFLAGS += -DUSE_VOIP
|
||||
SERVER_CFLAGS += -DUSE_VOIP
|
||||
NEED_OPUS=1
|
||||
endif
|
||||
|
||||
ifeq ($(USE_CODEC_OPUS),1)
|
||||
CLIENT_CFLAGS += -DUSE_CODEC_OPUS
|
||||
NEED_OPUS=1
|
||||
endif
|
||||
|
||||
ifeq ($(NEED_OPUS),1)
|
||||
ifeq ($(USE_INTERNAL_OPUS),1)
|
||||
OPUS_CFLAGS = -DOPUS_BUILD -DHAVE_LRINTF -DFLOATING_POINT -DUSE_ALLOCA \
|
||||
-I$(OPUSDIR)/include -I$(OPUSDIR)/celt -I$(OPUSDIR)/silk \
|
||||
|
@ -1085,19 +1084,6 @@ ifeq ($(USE_MUMBLE),1)
|
|||
CLIENT_CFLAGS += -DUSE_MUMBLE
|
||||
endif
|
||||
|
||||
ifeq ($(USE_VOIP),1)
|
||||
CLIENT_CFLAGS += -DUSE_VOIP
|
||||
SERVER_CFLAGS += -DUSE_VOIP
|
||||
ifeq ($(USE_INTERNAL_SPEEX),1)
|
||||
SPEEX_CFLAGS += -DFLOATING_POINT -DUSE_ALLOCA -I$(SPEEXDIR)/include
|
||||
else
|
||||
SPEEX_CFLAGS ?= $(shell pkg-config --silence-errors --cflags speex speexdsp || true)
|
||||
SPEEX_LIBS ?= $(shell pkg-config --silence-errors --libs speex speexdsp || echo -lspeex -lspeexdsp)
|
||||
endif
|
||||
CLIENT_CFLAGS += $(SPEEX_CFLAGS)
|
||||
CLIENT_LIBS += $(SPEEX_LIBS)
|
||||
endif
|
||||
|
||||
ifeq ($(USE_INTERNAL_ZLIB),1)
|
||||
ZLIB_CFLAGS = -DNO_GZIP -I$(ZDIR)
|
||||
else
|
||||
|
@ -1308,7 +1294,7 @@ endif
|
|||
|
||||
NAKED_TARGETS=$(shell echo $(TARGETS) | sed -e "s!$(B)/!!g")
|
||||
|
||||
print_list=@for i in $(1); \
|
||||
print_list=-@for i in $(1); \
|
||||
do \
|
||||
echo " $$i"; \
|
||||
done
|
||||
|
@ -1700,6 +1686,7 @@ Q3R2OBJ = \
|
|||
$(B)/renderergl2/tr_bsp.o \
|
||||
$(B)/renderergl2/tr_cmds.o \
|
||||
$(B)/renderergl2/tr_curve.o \
|
||||
$(B)/renderergl2/tr_dsa.o \
|
||||
$(B)/renderergl2/tr_extramath.o \
|
||||
$(B)/renderergl2/tr_extensions.o \
|
||||
$(B)/renderergl2/tr_fbo.o \
|
||||
|
@ -1712,6 +1699,7 @@ Q3R2OBJ = \
|
|||
$(B)/renderergl2/tr_image_pcx.o \
|
||||
$(B)/renderergl2/tr_image_png.o \
|
||||
$(B)/renderergl2/tr_image_tga.o \
|
||||
$(B)/renderergl2/tr_image_dds.o \
|
||||
$(B)/renderergl2/tr_init.o \
|
||||
$(B)/renderergl2/tr_light.o \
|
||||
$(B)/renderergl2/tr_main.o \
|
||||
|
@ -1875,53 +1863,7 @@ ifeq ($(ARCH),x86_64)
|
|||
$(B)/client/ftola.o
|
||||
endif
|
||||
|
||||
ifeq ($(USE_VOIP),1)
|
||||
ifeq ($(USE_INTERNAL_SPEEX),1)
|
||||
Q3OBJ += \
|
||||
$(B)/client/bits.o \
|
||||
$(B)/client/buffer.o \
|
||||
$(B)/client/cb_search.o \
|
||||
$(B)/client/exc_10_16_table.o \
|
||||
$(B)/client/exc_10_32_table.o \
|
||||
$(B)/client/exc_20_32_table.o \
|
||||
$(B)/client/exc_5_256_table.o \
|
||||
$(B)/client/exc_5_64_table.o \
|
||||
$(B)/client/exc_8_128_table.o \
|
||||
$(B)/client/fftwrap.o \
|
||||
$(B)/client/filterbank.o \
|
||||
$(B)/client/filters.o \
|
||||
$(B)/client/gain_table.o \
|
||||
$(B)/client/gain_table_lbr.o \
|
||||
$(B)/client/hexc_10_32_table.o \
|
||||
$(B)/client/hexc_table.o \
|
||||
$(B)/client/high_lsp_tables.o \
|
||||
$(B)/client/jitter.o \
|
||||
$(B)/client/kiss_fft.o \
|
||||
$(B)/client/kiss_fftr.o \
|
||||
$(B)/client/lpc.o \
|
||||
$(B)/client/lsp.o \
|
||||
$(B)/client/lsp_tables_nb.o \
|
||||
$(B)/client/ltp.o \
|
||||
$(B)/client/mdf.o \
|
||||
$(B)/client/modes.o \
|
||||
$(B)/client/modes_wb.o \
|
||||
$(B)/client/nb_celp.o \
|
||||
$(B)/client/preprocess.o \
|
||||
$(B)/client/quant_lsp.o \
|
||||
$(B)/client/resample.o \
|
||||
$(B)/client/sb_celp.o \
|
||||
$(B)/client/smallft.o \
|
||||
$(B)/client/speex.o \
|
||||
$(B)/client/speex_callbacks.o \
|
||||
$(B)/client/speex_header.o \
|
||||
$(B)/client/stereo.o \
|
||||
$(B)/client/vbr.o \
|
||||
$(B)/client/vq.o \
|
||||
$(B)/client/window.o
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(USE_CODEC_OPUS),1)
|
||||
ifeq ($(NEED_OPUS),1)
|
||||
ifeq ($(USE_INTERNAL_OPUS),1)
|
||||
Q3OBJ += \
|
||||
$(B)/client/opus/analysis.o \
|
||||
|
@ -2628,9 +2570,6 @@ $(B)/client/%.o: $(CMDIR)/%.c
|
|||
$(B)/client/%.o: $(BLIBDIR)/%.c
|
||||
$(DO_BOT_CC)
|
||||
|
||||
$(B)/client/%.o: $(SPEEXDIR)/%.c
|
||||
$(DO_CC)
|
||||
|
||||
$(B)/client/%.o: $(OGGDIR)/src/%.c
|
||||
$(DO_CC)
|
||||
|
||||
|
@ -2921,7 +2860,6 @@ ifdef MINGW
|
|||
USE_OPENAL_DLOPEN=$(USE_OPENAL_DLOPEN) \
|
||||
USE_CURL_DLOPEN=$(USE_CURL_DLOPEN) \
|
||||
USE_INTERNAL_OPUS=$(USE_INTERNAL_OPUS) \
|
||||
USE_INTERNAL_SPEEX=$(USE_INTERNAL_SPEEX) \
|
||||
USE_INTERNAL_ZLIB=$(USE_INTERNAL_ZLIB) \
|
||||
USE_INTERNAL_JPEG=$(USE_INTERNAL_JPEG)
|
||||
else
|
||||
|
|
265
README.md
265
README.md
|
@ -38,6 +38,8 @@ The original id software readme that accompanied the Q3 source release has been
|
|||
renamed to id-readme.txt so as to prevent confusion. Please refer to the
|
||||
web-site for updated status.
|
||||
|
||||
More documentation is on:
|
||||
http://wiki.ioquake3.org/
|
||||
|
||||
# Compilation and installation
|
||||
|
||||
|
@ -243,7 +245,7 @@ The defaults for these variables differ depending on the target platform.
|
|||
ipv6 servers on the local network
|
||||
net_mcastiface - outgoing interface to use for scan
|
||||
|
||||
r_allowResize - make window resizable (SDL only)
|
||||
r_allowResize - make window resizable
|
||||
r_ext_texture_filter_anisotropic - anisotropic texture filtering
|
||||
r_zProj - distance of observer camera to projection
|
||||
plane in quake3 standard units
|
||||
|
@ -326,204 +328,6 @@ The defaults for these variables differ depending on the target platform.
|
|||
```
|
||||
|
||||
|
||||
# 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 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.
|
||||
|
||||
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.
|
||||
|
||||
## 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.
|
||||
|
||||
## 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
|
||||
|
||||
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"`
|
||||
|
||||
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
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
## 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:
|
||||
|
||||
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.
|
||||
|
||||
* 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.
|
||||
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.
|
||||
|
||||
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
|
||||
"c" Toggle on the c key
|
||||
"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.
|
||||
|
||||
## 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)
|
||||
|
||||
New style is controlled with 3 cvars:
|
||||
|
||||
sensitivity
|
||||
cl_mouseAccel
|
||||
cl_mouseAccelOffset
|
||||
|
||||
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.
|
||||
|
||||
The new code tries to solve both problems:
|
||||
|
||||
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_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.
|
||||
|
||||
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).
|
||||
|
||||
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
|
||||
|
||||
## pk3dir
|
||||
|
@ -636,55 +440,6 @@ 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.
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
## 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
|
||||
|
||||
## PNG support
|
||||
|
||||
|
@ -719,18 +474,13 @@ directory, this restriction is lifted.
|
|||
|
||||
# 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
|
||||
submit your patch there. The best case scenario is that you submit your patch
|
||||
to bugzilla, and then post the URL to the mailing list.
|
||||
Please send all patches to bugzilla (https://bugzilla.icculus.org), or as a GitHub pull request and
|
||||
submit your patch there.
|
||||
|
||||
The focus for ioq3 is to develop a stable base suitable for further development
|
||||
and provide players with the same Quake 3 experience they've had for years. As
|
||||
such ioq3 does not have any significant graphical enhancements and none are
|
||||
planned at this time. However, improved graphics and sound patches will be
|
||||
accepted as long as they are entirely optional, do not require new media and
|
||||
are off by default.
|
||||
and provide players with the same Quake 3 experience they've had for years.
|
||||
|
||||
We do have graphical improvements with the new renderer, but they are off by default.
|
||||
|
||||
# Building Official Installers
|
||||
|
||||
|
@ -789,4 +539,3 @@ Significant contributions from
|
|||
* Aaron Gyes <floam@aaron.gy>
|
||||
|
||||
|
||||
[![githalytics.com alpha](https://cruel-carlota.pagodabox.com/6d196bd663b47049a25dcb8caef95949 "githalytics.com")](http://githalytics.com/ioquake/ioq3)
|
||||
|
|
|
@ -31,10 +31,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
// If you absolutely need something stored, it can either be kept
|
||||
// by the server in the server stored userinfos, or stashed in a cvar.
|
||||
|
||||
#ifdef MISSIONPACK
|
||||
#define CG_FONT_THRESHOLD 0.1
|
||||
#endif
|
||||
|
||||
#define POWERUP_BLINKS 5
|
||||
|
||||
#define POWERUP_BLINK_TIME 1000
|
||||
|
|
|
@ -1223,7 +1223,7 @@ static void CG_Text_Paint_Limit(float *maxX, float x, float y, float scale, vec4
|
|||
continue;
|
||||
} else {
|
||||
float yadj = useScale * glyph->top;
|
||||
if (CG_Text_Width(s, useScale, 1) + x > max) {
|
||||
if (CG_Text_Width(s, scale, 1) + x > max) {
|
||||
*maxX = 0;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -947,37 +947,27 @@ void CL_FirstSnapshot( void ) {
|
|||
#endif
|
||||
|
||||
#ifdef USE_VOIP
|
||||
if (!clc.speexInitialized) {
|
||||
if (!clc.voipCodecInitialized) {
|
||||
int i;
|
||||
speex_bits_init(&clc.speexEncoderBits);
|
||||
speex_bits_reset(&clc.speexEncoderBits);
|
||||
int error;
|
||||
|
||||
clc.speexEncoder = speex_encoder_init(&speex_nb_mode);
|
||||
clc.opusEncoder = opus_encoder_create(48000, 1, OPUS_APPLICATION_VOIP, &error);
|
||||
|
||||
speex_encoder_ctl(clc.speexEncoder, SPEEX_GET_FRAME_SIZE,
|
||||
&clc.speexFrameSize);
|
||||
speex_encoder_ctl(clc.speexEncoder, SPEEX_GET_SAMPLING_RATE,
|
||||
&clc.speexSampleRate);
|
||||
|
||||
clc.speexPreprocessor = speex_preprocess_state_init(clc.speexFrameSize,
|
||||
clc.speexSampleRate);
|
||||
|
||||
i = 1;
|
||||
speex_preprocess_ctl(clc.speexPreprocessor,
|
||||
SPEEX_PREPROCESS_SET_DENOISE, &i);
|
||||
|
||||
i = 1;
|
||||
speex_preprocess_ctl(clc.speexPreprocessor,
|
||||
SPEEX_PREPROCESS_SET_AGC, &i);
|
||||
if ( error ) {
|
||||
Com_DPrintf("VoIP: Error opus_encoder_create %d\n", error);
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < MAX_CLIENTS; i++) {
|
||||
speex_bits_init(&clc.speexDecoderBits[i]);
|
||||
speex_bits_reset(&clc.speexDecoderBits[i]);
|
||||
clc.speexDecoder[i] = speex_decoder_init(&speex_nb_mode);
|
||||
clc.opusDecoder[i] = opus_decoder_create(48000, 1, &error);
|
||||
if ( error ) {
|
||||
Com_DPrintf("VoIP: Error opus_decoder_create(%d) %d\n", i, error);
|
||||
return;
|
||||
}
|
||||
clc.voipIgnore[i] = qfalse;
|
||||
clc.voipGain[i] = 1.0f;
|
||||
}
|
||||
clc.speexInitialized = qtrue;
|
||||
clc.voipCodecInitialized = qtrue;
|
||||
clc.voipMuteAll = qfalse;
|
||||
Cmd_AddCommand ("voip", CL_Voip_f);
|
||||
Cvar_Set("cl_voipSendTarget", "spatial");
|
||||
|
|
|
@ -1384,6 +1384,7 @@ e_status CIN_RunCinematic (int handle)
|
|||
RoQReset();
|
||||
} else {
|
||||
RoQShutdown();
|
||||
return FMV_EOF;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -220,14 +220,25 @@ static size_t CL_cURL_CallbackWrite(void *buffer, size_t size, size_t nmemb,
|
|||
CURLcode qcurl_easy_setopt_warn(CURL *curl, CURLoption option, ...)
|
||||
{
|
||||
CURLcode result;
|
||||
va_list args;
|
||||
|
||||
va_start(args, option);
|
||||
result = qcurl_easy_setopt(curl, option, args);
|
||||
va_end(args);
|
||||
va_list argp;
|
||||
va_start(argp, option);
|
||||
|
||||
if(option < CURLOPTTYPE_OBJECTPOINT) {
|
||||
long longValue = va_arg(argp, long);
|
||||
result = qcurl_easy_setopt(curl, option, longValue);
|
||||
} else if(option < CURLOPTTYPE_OFF_T) {
|
||||
void *pointerValue = va_arg(argp, void *);
|
||||
result = qcurl_easy_setopt(curl, option, pointerValue);
|
||||
} else {
|
||||
curl_off_t offsetValue = va_arg(argp, curl_off_t);
|
||||
result = qcurl_easy_setopt(curl, option, offsetValue);
|
||||
}
|
||||
|
||||
if(result != CURLE_OK) {
|
||||
Com_DPrintf("qcurl_easy_setopt failed: %s\n", qcurl_easy_strerror(result));
|
||||
}
|
||||
va_end(argp);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
#ifdef WIN32
|
||||
#define DEFAULT_CURL_LIB "libcurl-4.dll"
|
||||
#define ALTERNATE_CURL_LIB "libcurl-3.dll"
|
||||
#elif defined(MACOS_X)
|
||||
#elif defined(__APPLE__)
|
||||
#define DEFAULT_CURL_LIB "libcurl.dylib"
|
||||
#else
|
||||
#define DEFAULT_CURL_LIB "libcurl.so.4"
|
||||
|
|
|
@ -634,6 +634,12 @@ void CL_CreateNewCommands( void ) {
|
|||
|
||||
frame_msec = com_frameTime - old_com_frameTime;
|
||||
|
||||
// if running over 1000fps, act as if each frame is 1ms
|
||||
// prevents divisions by zero
|
||||
if ( frame_msec < 1 ) {
|
||||
frame_msec = 1;
|
||||
}
|
||||
|
||||
// if running less than 5fps, truncate the extra time to prevent
|
||||
// unexpected moves after a hitch
|
||||
if ( frame_msec > 200 ) {
|
||||
|
@ -805,7 +811,7 @@ void CL_WritePacket( void ) {
|
|||
{
|
||||
if((clc.voipFlags & VOIP_SPATIAL) || Com_IsVoipTarget(clc.voipTargets, sizeof(clc.voipTargets), -1))
|
||||
{
|
||||
MSG_WriteByte (&buf, clc_voip);
|
||||
MSG_WriteByte (&buf, clc_voipOpus);
|
||||
MSG_WriteByte (&buf, clc.voipOutgoingGeneration);
|
||||
MSG_WriteLong (&buf, clc.voipOutgoingSequence);
|
||||
MSG_WriteByte (&buf, clc.voipOutgoingDataFrames);
|
||||
|
@ -826,7 +832,7 @@ void CL_WritePacket( void ) {
|
|||
MSG_Init (&fakemsg, fakedata, sizeof (fakedata));
|
||||
MSG_Bitstream (&fakemsg);
|
||||
MSG_WriteLong (&fakemsg, clc.reliableAcknowledge);
|
||||
MSG_WriteByte (&fakemsg, svc_voip);
|
||||
MSG_WriteByte (&fakemsg, svc_voipOpus);
|
||||
MSG_WriteShort (&fakemsg, clc.clientNum);
|
||||
MSG_WriteByte (&fakemsg, clc.voipOutgoingGeneration);
|
||||
MSG_WriteLong (&fakemsg, clc.voipOutgoingSequence);
|
||||
|
|
|
@ -44,6 +44,7 @@ cvar_t *cl_voipSendTarget;
|
|||
cvar_t *cl_voipGainDuringCapture;
|
||||
cvar_t *cl_voipCaptureMult;
|
||||
cvar_t *cl_voipShowMeter;
|
||||
cvar_t *cl_voipProtocol;
|
||||
cvar_t *cl_voip;
|
||||
#endif
|
||||
|
||||
|
@ -250,8 +251,8 @@ void CL_Voip_f( void )
|
|||
|
||||
if (clc.state != CA_ACTIVE)
|
||||
reason = "Not connected to a server";
|
||||
else if (!clc.speexInitialized)
|
||||
reason = "Speex not initialized";
|
||||
else if (!clc.voipCodecInitialized)
|
||||
reason = "Voip codec not initialized";
|
||||
else if (!clc.voipEnabled)
|
||||
reason = "Server doesn't support VoIP";
|
||||
else if (!clc.demoplaying && (Cvar_VariableValue( "g_gametype" ) == GT_SINGLE_PLAYER || Cvar_VariableValue("ui_singlePlayerActive")))
|
||||
|
@ -306,6 +307,8 @@ void CL_VoipNewGeneration(void)
|
|||
clc.voipOutgoingGeneration = 1;
|
||||
clc.voipPower = 0.0f;
|
||||
clc.voipOutgoingSequence = 0;
|
||||
|
||||
opus_encoder_ctl(clc.opusEncoder, OPUS_RESET_STATE);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -394,7 +397,7 @@ void CL_VoipParseTargets(void)
|
|||
===============
|
||||
CL_CaptureVoip
|
||||
|
||||
Record more audio from the hardware if required and encode it into Speex
|
||||
Record more audio from the hardware if required and encode it into Opus
|
||||
data for later transmission.
|
||||
===============
|
||||
*/
|
||||
|
@ -424,11 +427,12 @@ void CL_CaptureVoip(void)
|
|||
Com_Printf("Until then, VoIP is disabled.\n");
|
||||
Cvar_Set("cl_voip", "0");
|
||||
}
|
||||
Cvar_Set("cl_voipProtocol", cl_voip->integer ? "opus" : "");
|
||||
cl_voip->modified = qfalse;
|
||||
cl_rate->modified = qfalse;
|
||||
}
|
||||
|
||||
if (!clc.speexInitialized)
|
||||
if (!clc.voipCodecInitialized)
|
||||
return; // just in case this gets called at a bad time.
|
||||
|
||||
if (clc.voipOutgoingDataSize > 0)
|
||||
|
@ -481,80 +485,67 @@ void CL_CaptureVoip(void)
|
|||
|
||||
if ((cl_voipSend->integer) || (finalFrame)) { // user wants to capture audio?
|
||||
int samples = S_AvailableCaptureSamples();
|
||||
const int mult = (finalFrame) ? 1 : 4; // 4 == 80ms of audio.
|
||||
const int packetSamples = (finalFrame) ? VOIP_MAX_FRAME_SAMPLES : VOIP_MAX_PACKET_SAMPLES;
|
||||
|
||||
// enough data buffered in audio hardware to process yet?
|
||||
if (samples >= (clc.speexFrameSize * mult)) {
|
||||
// audio capture is always MONO16 (and that's what speex wants!).
|
||||
// 2048 will cover 12 uncompressed frames in narrowband mode.
|
||||
static int16_t sampbuffer[2048];
|
||||
if (samples >= packetSamples) {
|
||||
// audio capture is always MONO16.
|
||||
static int16_t sampbuffer[VOIP_MAX_PACKET_SAMPLES];
|
||||
float voipPower = 0.0f;
|
||||
int speexFrames = 0;
|
||||
int wpos = 0;
|
||||
int pos = 0;
|
||||
int voipFrames;
|
||||
int i, bytes;
|
||||
|
||||
if (samples > (clc.speexFrameSize * 4))
|
||||
samples = (clc.speexFrameSize * 4);
|
||||
if (samples > VOIP_MAX_PACKET_SAMPLES)
|
||||
samples = VOIP_MAX_PACKET_SAMPLES;
|
||||
|
||||
// !!! FIXME: maybe separate recording from encoding, so voipPower
|
||||
// !!! FIXME: updates faster than 4Hz?
|
||||
|
||||
samples -= samples % clc.speexFrameSize;
|
||||
samples -= samples % VOIP_MAX_FRAME_SAMPLES;
|
||||
if (samples != 120 && samples != 240 && samples != 480 && samples != 960 && samples != 1920 && samples != 2880 ) {
|
||||
Com_Printf("Voip: bad number of samples %d\n", samples);
|
||||
return;
|
||||
}
|
||||
voipFrames = samples / VOIP_MAX_FRAME_SAMPLES;
|
||||
|
||||
S_Capture(samples, (byte *) sampbuffer); // grab from audio card.
|
||||
|
||||
// this will probably generate multiple speex packets each time.
|
||||
while (samples > 0) {
|
||||
int16_t *sampptr = &sampbuffer[pos];
|
||||
int i, bytes;
|
||||
// check the "power" of this packet...
|
||||
for (i = 0; i < samples; i++) {
|
||||
const float flsamp = (float) sampbuffer[i];
|
||||
const float s = fabs(flsamp);
|
||||
voipPower += s * s;
|
||||
sampbuffer[i] = (int16_t) ((flsamp) * audioMult);
|
||||
}
|
||||
|
||||
// preprocess samples to remove noise...
|
||||
speex_preprocess_run(clc.speexPreprocessor, sampptr);
|
||||
|
||||
// check the "power" of this packet...
|
||||
for (i = 0; i < clc.speexFrameSize; i++) {
|
||||
const float flsamp = (float) sampptr[i];
|
||||
const float s = fabs(flsamp);
|
||||
voipPower += s * s;
|
||||
sampptr[i] = (int16_t) ((flsamp) * audioMult);
|
||||
}
|
||||
|
||||
// encode raw audio samples into Speex data...
|
||||
speex_bits_reset(&clc.speexEncoderBits);
|
||||
speex_encode_int(clc.speexEncoder, sampptr,
|
||||
&clc.speexEncoderBits);
|
||||
bytes = speex_bits_write(&clc.speexEncoderBits,
|
||||
(char *) &clc.voipOutgoingData[wpos+1],
|
||||
sizeof (clc.voipOutgoingData) - (wpos+1));
|
||||
assert((bytes > 0) && (bytes < 256));
|
||||
clc.voipOutgoingData[wpos] = (byte) bytes;
|
||||
wpos += bytes + 1;
|
||||
|
||||
// look at the data for the next packet...
|
||||
pos += clc.speexFrameSize;
|
||||
samples -= clc.speexFrameSize;
|
||||
speexFrames++;
|
||||
// encode raw audio samples into Opus data...
|
||||
bytes = opus_encode(clc.opusEncoder, sampbuffer, samples,
|
||||
(unsigned char *) clc.voipOutgoingData,
|
||||
sizeof (clc.voipOutgoingData));
|
||||
if ( bytes <= 0 ) {
|
||||
Com_DPrintf("VoIP: Error encoding %d samples\n", samples);
|
||||
bytes = 0;
|
||||
}
|
||||
|
||||
clc.voipPower = (voipPower / (32768.0f * 32768.0f *
|
||||
((float) (clc.speexFrameSize * speexFrames)))) *
|
||||
100.0f;
|
||||
((float) samples))) * 100.0f;
|
||||
|
||||
if ((useVad) && (clc.voipPower < cl_voipVADThreshold->value)) {
|
||||
CL_VoipNewGeneration(); // no "talk" for at least 1/4 second.
|
||||
} else {
|
||||
clc.voipOutgoingDataSize = wpos;
|
||||
clc.voipOutgoingDataFrames = speexFrames;
|
||||
clc.voipOutgoingDataSize = bytes;
|
||||
clc.voipOutgoingDataFrames = voipFrames;
|
||||
|
||||
Com_DPrintf("VoIP: Send %d frames, %d bytes, %f power\n",
|
||||
speexFrames, wpos, clc.voipPower);
|
||||
voipFrames, bytes, clc.voipPower);
|
||||
|
||||
#if 0
|
||||
static FILE *encio = NULL;
|
||||
if (encio == NULL) encio = fopen("voip-outgoing-encoded.bin", "wb");
|
||||
if (encio != NULL) { fwrite(clc.voipOutgoingData, wpos, 1, encio); fflush(encio); }
|
||||
if (encio != NULL) { fwrite(clc.voipOutgoingData, bytes, 1, encio); fflush(encio); }
|
||||
static FILE *decio = NULL;
|
||||
if (decio == NULL) decio = fopen("voip-outgoing-decoded.bin", "wb");
|
||||
if (decio != NULL) { fwrite(sampbuffer, speexFrames * clc.speexFrameSize * 2, 1, decio); fflush(decio); }
|
||||
if (decio != NULL) { fwrite(sampbuffer, voipFrames * VOIP_MAX_FRAME_SAMPLES * 2, 1, decio); fflush(decio); }
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -1477,14 +1468,11 @@ void CL_Disconnect( qboolean showMainMenu ) {
|
|||
cl_voipUseVAD->integer = tmp;
|
||||
}
|
||||
|
||||
if (clc.speexInitialized) {
|
||||
if (clc.voipCodecInitialized) {
|
||||
int i;
|
||||
speex_bits_destroy(&clc.speexEncoderBits);
|
||||
speex_encoder_destroy(clc.speexEncoder);
|
||||
speex_preprocess_state_destroy(clc.speexPreprocessor);
|
||||
opus_encoder_destroy(clc.opusEncoder);
|
||||
for (i = 0; i < MAX_CLIENTS; i++) {
|
||||
speex_bits_destroy(&clc.speexDecoderBits[i]);
|
||||
speex_decoder_destroy(clc.speexDecoder[i]);
|
||||
opus_decoder_destroy(clc.opusDecoder[i]);
|
||||
}
|
||||
}
|
||||
Cmd_RemoveCommand ("voip");
|
||||
|
@ -1865,6 +1853,50 @@ static void CL_CompleteRcon( char *args, int argNum )
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
CL_CompletePlayerName
|
||||
==================
|
||||
*/
|
||||
static void CL_CompletePlayerName( char *args, int argNum )
|
||||
{
|
||||
if( argNum == 2 )
|
||||
{
|
||||
char names[MAX_CLIENTS][MAX_NAME_LENGTH];
|
||||
const char *namesPtr[MAX_CLIENTS];
|
||||
int i;
|
||||
int clientCount;
|
||||
int nameCount;
|
||||
const char *info;
|
||||
const char *name;
|
||||
|
||||
//configstring
|
||||
info = cl.gameState.stringData + cl.gameState.stringOffsets[CS_SERVERINFO];
|
||||
clientCount = atoi( Info_ValueForKey( info, "sv_maxclients" ) );
|
||||
|
||||
nameCount = 0;
|
||||
|
||||
for( i = 0; i < clientCount; i++ ) {
|
||||
if( i == clc.clientNum )
|
||||
continue;
|
||||
|
||||
info = cl.gameState.stringData + cl.gameState.stringOffsets[CS_PLAYERS+i];
|
||||
|
||||
name = Info_ValueForKey( info, "n" );
|
||||
if( name[0] == '\0' )
|
||||
continue;
|
||||
Q_strncpyz( names[nameCount], name, sizeof(names[nameCount]) );
|
||||
Q_CleanStr( names[nameCount] );
|
||||
|
||||
namesPtr[nameCount] = names[nameCount];
|
||||
nameCount++;
|
||||
}
|
||||
qsort( (void*)namesPtr, nameCount, sizeof( namesPtr[0] ), Com_strCompare );
|
||||
|
||||
Field_CompletePlayerName( namesPtr, nameCount );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=====================
|
||||
CL_Rcon_f
|
||||
|
@ -1877,7 +1909,7 @@ void CL_Rcon_f( void ) {
|
|||
char message[MAX_RCON_MESSAGE];
|
||||
netadr_t to;
|
||||
|
||||
if ( !rcon_client_password->string ) {
|
||||
if ( !rcon_client_password->string[0] ) {
|
||||
Com_Printf ("You must set 'rconpassword' before\n"
|
||||
"issuing an rcon command.\n");
|
||||
return;
|
||||
|
@ -3501,6 +3533,56 @@ static void CL_GenerateQKey(void)
|
|||
}
|
||||
}
|
||||
|
||||
void CL_Sayto_f( void ) {
|
||||
char *rawname;
|
||||
char name[MAX_NAME_LENGTH];
|
||||
char cleanName[MAX_NAME_LENGTH];
|
||||
const char *info;
|
||||
int count;
|
||||
int i;
|
||||
int clientNum;
|
||||
char *p;
|
||||
|
||||
if ( Cmd_Argc() < 3 ) {
|
||||
Com_Printf ("sayto <player name> <text>\n");
|
||||
return;
|
||||
}
|
||||
|
||||
rawname = Cmd_Argv(1);
|
||||
|
||||
Com_FieldStringToPlayerName( name, MAX_NAME_LENGTH, rawname );
|
||||
|
||||
info = cl.gameState.stringData + cl.gameState.stringOffsets[CS_SERVERINFO];
|
||||
count = atoi( Info_ValueForKey( info, "sv_maxclients" ) );
|
||||
|
||||
clientNum = -1;
|
||||
for( i = 0; i < count; i++ ) {
|
||||
|
||||
info = cl.gameState.stringData + cl.gameState.stringOffsets[CS_PLAYERS+i];
|
||||
Q_strncpyz( cleanName, Info_ValueForKey( info, "n" ), sizeof(cleanName) );
|
||||
Q_CleanStr( cleanName );
|
||||
|
||||
if ( !Q_stricmp( cleanName, name ) ) {
|
||||
clientNum = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if( clientNum <= -1 )
|
||||
{
|
||||
Com_Printf ("No such player name: %s.\n", name);
|
||||
return;
|
||||
}
|
||||
|
||||
p = Cmd_ArgsFrom(2);
|
||||
|
||||
if ( *p == '"' ) {
|
||||
p++;
|
||||
p[strlen(p)-1] = 0;
|
||||
}
|
||||
|
||||
CL_AddReliableCommand(va("tell %i \"%s\"", clientNum, p ), qfalse);
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
CL_Init
|
||||
|
@ -3583,7 +3665,7 @@ void CL_Init( void ) {
|
|||
#endif
|
||||
|
||||
cl_conXOffset = Cvar_Get ("cl_conXOffset", "0", 0);
|
||||
#ifdef MACOS_X
|
||||
#ifdef __APPLE__
|
||||
// In game video is REALLY slow in Mac OS X right now due to driver slowness
|
||||
cl_inGameVideo = Cvar_Get ("r_inGameVideo", "0", CVAR_ARCHIVE);
|
||||
#else
|
||||
|
@ -3600,7 +3682,7 @@ void CL_Init( void ) {
|
|||
m_yaw = Cvar_Get ("m_yaw", "0.022", CVAR_ARCHIVE);
|
||||
m_forward = Cvar_Get ("m_forward", "0.25", CVAR_ARCHIVE);
|
||||
m_side = Cvar_Get ("m_side", "0.25", CVAR_ARCHIVE);
|
||||
#ifdef MACOS_X
|
||||
#ifdef __APPLE__
|
||||
// Input is jittery on OS X w/o this
|
||||
m_filter = Cvar_Get ("m_filter", "1", CVAR_ARCHIVE);
|
||||
#else
|
||||
|
@ -3672,9 +3754,9 @@ void CL_Init( void ) {
|
|||
cl_voipVADThreshold = Cvar_Get ("cl_voipVADThreshold", "0.25", CVAR_ARCHIVE);
|
||||
cl_voipShowMeter = Cvar_Get ("cl_voipShowMeter", "1", CVAR_ARCHIVE);
|
||||
|
||||
// This is a protocol version number.
|
||||
cl_voip = Cvar_Get ("cl_voip", "1", CVAR_USERINFO | CVAR_ARCHIVE);
|
||||
cl_voip = Cvar_Get ("cl_voip", "1", CVAR_ARCHIVE);
|
||||
Cvar_CheckRange( cl_voip, 0, 1, qtrue );
|
||||
cl_voipProtocol = Cvar_Get ("cl_voipProtocol", cl_voip->integer ? "opus" : "", CVAR_USERINFO | CVAR_ROM);
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -3711,6 +3793,10 @@ void CL_Init( void ) {
|
|||
Cmd_AddCommand ("model", CL_SetModel_f );
|
||||
Cmd_AddCommand ("video", CL_Video_f );
|
||||
Cmd_AddCommand ("stopvideo", CL_StopVideo_f );
|
||||
if( !com_dedicated->integer ) {
|
||||
Cmd_AddCommand ("sayto", CL_Sayto_f );
|
||||
Cmd_SetCommandCompletionFunc( "sayto", CL_CompletePlayerName );
|
||||
}
|
||||
CL_InitRef();
|
||||
|
||||
SCR_Init ();
|
||||
|
|
|
@ -34,7 +34,8 @@ char *svc_strings[256] = {
|
|||
"svc_download",
|
||||
"svc_snapshot",
|
||||
"svc_EOF",
|
||||
"svc_voip",
|
||||
"svc_voipSpeex",
|
||||
"svc_voipOpus",
|
||||
};
|
||||
|
||||
void SHOWNET( msg_t *msg, char *s) {
|
||||
|
@ -362,8 +363,8 @@ void CL_SystemInfoChanged( void ) {
|
|||
else
|
||||
#endif
|
||||
{
|
||||
s = Info_ValueForKey( systemInfo, "sv_voip" );
|
||||
clc.voipEnabled = atoi(s);
|
||||
s = Info_ValueForKey( systemInfo, "sv_voipProtocol" );
|
||||
clc.voipEnabled = !Q_stricmp(s, "opus");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -698,13 +699,13 @@ static void CL_PlayVoip(int sender, int samplecnt, const byte *data, int flags)
|
|||
{
|
||||
if(flags & VOIP_DIRECT)
|
||||
{
|
||||
S_RawSamples(sender + 1, samplecnt, clc.speexSampleRate, 2, 1,
|
||||
S_RawSamples(sender + 1, samplecnt, 48000, 2, 1,
|
||||
data, clc.voipGain[sender], -1);
|
||||
}
|
||||
|
||||
if(flags & VOIP_SPATIAL)
|
||||
{
|
||||
S_RawSamples(sender + MAX_CLIENTS + 1, samplecnt, clc.speexSampleRate, 2, 1,
|
||||
S_RawSamples(sender + MAX_CLIENTS + 1, samplecnt, 48000, 2, 1,
|
||||
data, 1.0f, sender);
|
||||
}
|
||||
}
|
||||
|
@ -717,8 +718,8 @@ A VoIP message has been received from the server
|
|||
=====================
|
||||
*/
|
||||
static
|
||||
void CL_ParseVoip ( msg_t *msg ) {
|
||||
static short decoded[4096]; // !!! FIXME: don't hardcode.
|
||||
void CL_ParseVoip ( msg_t *msg, qboolean ignoreData ) {
|
||||
static short decoded[VOIP_MAX_PACKET_SAMPLES*4]; // !!! FIXME: don't hard code
|
||||
|
||||
const int sender = MSG_ReadShort(msg);
|
||||
const int generation = MSG_ReadByte(msg);
|
||||
|
@ -726,7 +727,8 @@ void CL_ParseVoip ( msg_t *msg ) {
|
|||
const int frames = MSG_ReadByte(msg);
|
||||
const int packetsize = MSG_ReadShort(msg);
|
||||
const int flags = MSG_ReadBits(msg, VOIP_FLAGCNT);
|
||||
char encoded[1024];
|
||||
unsigned char encoded[4000];
|
||||
int numSamples;
|
||||
int seqdiff;
|
||||
int written = 0;
|
||||
int i;
|
||||
|
@ -756,14 +758,15 @@ void CL_ParseVoip ( msg_t *msg ) {
|
|||
return; // overlarge packet, bail.
|
||||
}
|
||||
|
||||
if (!clc.speexInitialized) {
|
||||
MSG_ReadData(msg, encoded, packetsize); // skip payload.
|
||||
return; // can't handle VoIP without libspeex!
|
||||
MSG_ReadData(msg, encoded, packetsize);
|
||||
|
||||
if (ignoreData) {
|
||||
return; // just ignore legacy speex voip data
|
||||
} else if (!clc.voipCodecInitialized) {
|
||||
return; // can't handle VoIP without libopus!
|
||||
} else if (sender >= MAX_CLIENTS) {
|
||||
MSG_ReadData(msg, encoded, packetsize); // skip payload.
|
||||
return; // bogus sender.
|
||||
} else if (CL_ShouldIgnoreVoipSender(sender)) {
|
||||
MSG_ReadData(msg, encoded, packetsize); // skip payload.
|
||||
return; // Channel is muted, bail.
|
||||
}
|
||||
|
||||
|
@ -776,70 +779,59 @@ void CL_ParseVoip ( msg_t *msg ) {
|
|||
// This is a new "generation" ... a new recording started, reset the bits.
|
||||
if (generation != clc.voipIncomingGeneration[sender]) {
|
||||
Com_DPrintf("VoIP: new generation %d!\n", generation);
|
||||
speex_bits_reset(&clc.speexDecoderBits[sender]);
|
||||
opus_decoder_ctl(clc.opusDecoder[sender], OPUS_RESET_STATE);
|
||||
clc.voipIncomingGeneration[sender] = generation;
|
||||
seqdiff = 0;
|
||||
} else if (seqdiff < 0) { // we're ahead of the sequence?!
|
||||
// This shouldn't happen unless the packet is corrupted or something.
|
||||
Com_DPrintf("VoIP: misordered sequence! %d < %d!\n",
|
||||
sequence, clc.voipIncomingSequence[sender]);
|
||||
// reset the bits just in case.
|
||||
speex_bits_reset(&clc.speexDecoderBits[sender]);
|
||||
// reset the decoder just in case.
|
||||
opus_decoder_ctl(clc.opusDecoder[sender], OPUS_RESET_STATE);
|
||||
seqdiff = 0;
|
||||
} else if (seqdiff * clc.speexFrameSize * 2 >= sizeof (decoded)) { // dropped more than we can handle?
|
||||
} else if (seqdiff * VOIP_MAX_PACKET_SAMPLES*2 >= sizeof (decoded)) { // dropped more than we can handle?
|
||||
// just start over.
|
||||
Com_DPrintf("VoIP: Dropped way too many (%d) frames from client #%d\n",
|
||||
seqdiff, sender);
|
||||
speex_bits_reset(&clc.speexDecoderBits[sender]);
|
||||
opus_decoder_ctl(clc.opusDecoder[sender], OPUS_RESET_STATE);
|
||||
seqdiff = 0;
|
||||
}
|
||||
|
||||
if (seqdiff != 0) {
|
||||
Com_DPrintf("VoIP: Dropped %d frames from client #%d\n",
|
||||
seqdiff, sender);
|
||||
// tell speex that we're missing frames...
|
||||
// tell opus that we're missing frames...
|
||||
for (i = 0; i < seqdiff; i++) {
|
||||
assert((written + clc.speexFrameSize) * 2 < sizeof (decoded));
|
||||
speex_decode_int(clc.speexDecoder[sender], NULL, decoded + written);
|
||||
written += clc.speexFrameSize;
|
||||
assert((written + VOIP_MAX_PACKET_SAMPLES) * 2 < sizeof (decoded));
|
||||
numSamples = opus_decode(clc.opusDecoder[sender], NULL, 0, decoded + written, VOIP_MAX_PACKET_SAMPLES, 0);
|
||||
if ( numSamples <= 0 ) {
|
||||
Com_DPrintf("VoIP: Error decoding frame %d from client #%d\n", i, sender);
|
||||
continue;
|
||||
}
|
||||
written += numSamples;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < frames; i++) {
|
||||
const int len = MSG_ReadByte(msg);
|
||||
if (len < 0) {
|
||||
Com_DPrintf("VoIP: Short packet!\n");
|
||||
break;
|
||||
}
|
||||
MSG_ReadData(msg, encoded, len);
|
||||
numSamples = opus_decode(clc.opusDecoder[sender], encoded, packetsize, decoded + written, ARRAY_LEN(decoded) - written, 0);
|
||||
|
||||
// shouldn't happen, but just in case...
|
||||
if ((written + clc.speexFrameSize) * 2 > sizeof (decoded)) {
|
||||
Com_DPrintf("VoIP: playback %d bytes, %d samples, %d frames\n",
|
||||
written * 2, written, i);
|
||||
|
||||
CL_PlayVoip(sender, written, (const byte *) decoded, flags);
|
||||
written = 0;
|
||||
}
|
||||
|
||||
speex_bits_read_from(&clc.speexDecoderBits[sender], encoded, len);
|
||||
speex_decode_int(clc.speexDecoder[sender],
|
||||
&clc.speexDecoderBits[sender], decoded + written);
|
||||
|
||||
#if 0
|
||||
static FILE *encio = NULL;
|
||||
if (encio == NULL) encio = fopen("voip-incoming-encoded.bin", "wb");
|
||||
if (encio != NULL) { fwrite(encoded, len, 1, encio); fflush(encio); }
|
||||
static FILE *decio = NULL;
|
||||
if (decio == NULL) decio = fopen("voip-incoming-decoded.bin", "wb");
|
||||
if (decio != NULL) { fwrite(decoded+written, clc.speexFrameSize*2, 1, decio); fflush(decio); }
|
||||
#endif
|
||||
|
||||
written += clc.speexFrameSize;
|
||||
if ( numSamples <= 0 ) {
|
||||
Com_DPrintf("VoIP: Error decoding voip data from client #%d\n", sender);
|
||||
numSamples = 0;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static FILE *encio = NULL;
|
||||
if (encio == NULL) encio = fopen("voip-incoming-encoded.bin", "wb");
|
||||
if (encio != NULL) { fwrite(encoded, len, 1, encio); fflush(encio); }
|
||||
static FILE *decio = NULL;
|
||||
if (decio == NULL) decio = fopen("voip-incoming-decoded.bin", "wb");
|
||||
if (decio != NULL) { fwrite(decoded+written, clc.speexFrameSize*2, 1, decio); fflush(decio); }
|
||||
#endif
|
||||
|
||||
written += numSamples;
|
||||
|
||||
Com_DPrintf("VoIP: playback %d bytes, %d samples, %d frames\n",
|
||||
written * 2, written, i);
|
||||
written * 2, written, frames);
|
||||
|
||||
if(written > 0)
|
||||
CL_PlayVoip(sender, written, (const byte *) decoded, flags);
|
||||
|
@ -954,9 +946,14 @@ void CL_ParseServerMessage( msg_t *msg ) {
|
|||
case svc_download:
|
||||
CL_ParseDownload( msg );
|
||||
break;
|
||||
case svc_voip:
|
||||
case svc_voipSpeex:
|
||||
#ifdef USE_VOIP
|
||||
CL_ParseVoip( msg );
|
||||
CL_ParseVoip( msg, qtrue );
|
||||
#endif
|
||||
break;
|
||||
case svc_voipOpus:
|
||||
#ifdef USE_VOIP
|
||||
CL_ParseVoip( msg, !clc.voipEnabled );
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -35,8 +35,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
#endif /* USE_CURL */
|
||||
|
||||
#ifdef USE_VOIP
|
||||
#include "speex/speex.h"
|
||||
#include "speex/speex_preprocess.h"
|
||||
#include <opus.h>
|
||||
#endif
|
||||
|
||||
// file full of random crap that gets used to create cl_guid
|
||||
|
@ -238,14 +237,11 @@ typedef struct {
|
|||
|
||||
#ifdef USE_VOIP
|
||||
qboolean voipEnabled;
|
||||
qboolean speexInitialized;
|
||||
int speexFrameSize;
|
||||
int speexSampleRate;
|
||||
qboolean voipCodecInitialized;
|
||||
|
||||
// incoming data...
|
||||
// !!! FIXME: convert from parallel arrays to array of a struct.
|
||||
SpeexBits speexDecoderBits[MAX_CLIENTS];
|
||||
void *speexDecoder[MAX_CLIENTS];
|
||||
OpusDecoder *opusDecoder[MAX_CLIENTS];
|
||||
byte voipIncomingGeneration[MAX_CLIENTS];
|
||||
int voipIncomingSequence[MAX_CLIENTS];
|
||||
float voipGain[MAX_CLIENTS];
|
||||
|
@ -257,9 +253,7 @@ typedef struct {
|
|||
// then we are sending to clientnum i.
|
||||
uint8_t voipTargets[(MAX_CLIENTS + 7) / 8];
|
||||
uint8_t voipFlags;
|
||||
SpeexPreprocessState *speexPreprocessor;
|
||||
SpeexBits speexEncoderBits;
|
||||
void *speexEncoder;
|
||||
OpusEncoder *opusEncoder;
|
||||
int voipOutgoingDataSize;
|
||||
int voipOutgoingDataFrames;
|
||||
int voipOutgoingSequence;
|
||||
|
@ -447,6 +441,13 @@ extern cvar_t *cl_voipGainDuringCapture;
|
|||
extern cvar_t *cl_voipCaptureMult;
|
||||
extern cvar_t *cl_voipShowMeter;
|
||||
extern cvar_t *cl_voip;
|
||||
|
||||
// 20ms at 48k
|
||||
#define VOIP_MAX_FRAME_SAMPLES ( 20 * 48 )
|
||||
|
||||
// 3 frame is 60ms of audio, the max opus will encode at once
|
||||
#define VOIP_MAX_PACKET_FRAMES 3
|
||||
#define VOIP_MAX_PACKET_SAMPLES ( VOIP_MAX_FRAME_SAMPLES * VOIP_MAX_PACKET_FRAMES )
|
||||
#endif
|
||||
|
||||
//=================================================
|
||||
|
|
|
@ -37,8 +37,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
#include "../AL/al.h"
|
||||
#include "../AL/alc.h"
|
||||
#else
|
||||
#ifdef _MSC_VER
|
||||
#if defined(_MSC_VER) || defined(__APPLE__)
|
||||
// MSVC users must install the OpenAL SDK which doesn't use the AL/*.h scheme.
|
||||
// OSX framework also needs this
|
||||
#include <al.h>
|
||||
#include <alc.h>
|
||||
#else
|
||||
|
|
|
@ -23,7 +23,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
|
||||
#include "client.h"
|
||||
#include "snd_local.h"
|
||||
#if idppc_altivec && !defined(MACOS_X)
|
||||
#if idppc_altivec && !defined(__APPLE__)
|
||||
#include <altivec.h>
|
||||
#endif
|
||||
|
||||
|
|
|
@ -597,7 +597,7 @@ typedef struct src_s
|
|||
qboolean local; // Is this local (relative to the cam)
|
||||
} src_t;
|
||||
|
||||
#ifdef MACOS_X
|
||||
#ifdef __APPLE__
|
||||
#define MAX_SRC 64
|
||||
#else
|
||||
#define MAX_SRC 128
|
||||
|
@ -2223,7 +2223,7 @@ static cvar_t *s_alCapture;
|
|||
|
||||
#ifdef _WIN32
|
||||
#define ALDRIVER_DEFAULT "OpenAL32.dll"
|
||||
#elif defined(MACOS_X)
|
||||
#elif defined(__APPLE__)
|
||||
#define ALDRIVER_DEFAULT "/System/Library/Frameworks/OpenAL.framework/OpenAL"
|
||||
#elif defined(__OpenBSD__)
|
||||
#define ALDRIVER_DEFAULT "libopenal.so"
|
||||
|
@ -2657,7 +2657,7 @@ qboolean S_AL_Init( soundInterface_t *si )
|
|||
#endif
|
||||
else
|
||||
{
|
||||
#ifdef MACOS_X
|
||||
#ifdef __APPLE__
|
||||
// !!! FIXME: Apple has a 1.1-compliant OpenAL, which includes
|
||||
// !!! FIXME: capture support, but they don't list it in the
|
||||
// !!! FIXME: extension string. We need to check the version string,
|
||||
|
@ -2696,16 +2696,12 @@ qboolean S_AL_Init( soundInterface_t *si )
|
|||
|
||||
s_alAvailableInputDevices = Cvar_Get("s_alAvailableInputDevices", inputdevicenames, CVAR_ROM | CVAR_NORESTART);
|
||||
|
||||
// !!! FIXME: 8000Hz is what Speex narrowband mode needs, but we
|
||||
// !!! FIXME: should probably open the capture device after
|
||||
// !!! FIXME: initializing Speex so we can change to wideband
|
||||
// !!! FIXME: if we like.
|
||||
Com_Printf("OpenAL default capture device is '%s'\n", defaultinputdevice ? defaultinputdevice : "none");
|
||||
alCaptureDevice = qalcCaptureOpenDevice(inputdevice, 8000, AL_FORMAT_MONO16, 4096);
|
||||
alCaptureDevice = qalcCaptureOpenDevice(inputdevice, 48000, AL_FORMAT_MONO16, VOIP_MAX_PACKET_SAMPLES*4);
|
||||
if( !alCaptureDevice && inputdevice )
|
||||
{
|
||||
Com_Printf( "Failed to open OpenAL Input device '%s', trying default.\n", inputdevice );
|
||||
alCaptureDevice = qalcCaptureOpenDevice(NULL, 8000, AL_FORMAT_MONO16, 4096);
|
||||
alCaptureDevice = qalcCaptureOpenDevice(NULL, 48000, AL_FORMAT_MONO16, VOIP_MAX_PACKET_SAMPLES*4);
|
||||
}
|
||||
Com_Printf( "OpenAL capture device %s.\n",
|
||||
(alCaptureDevice == NULL) ? "failed to open" : "opened");
|
||||
|
|
|
@ -59,10 +59,16 @@ ADD BOTS MENU
|
|||
|
||||
typedef struct {
|
||||
menuframework_s menu;
|
||||
|
||||
menutext_s banner;
|
||||
menubitmap_s background;
|
||||
|
||||
menubitmap_s arrows;
|
||||
menubitmap_s up;
|
||||
menubitmap_s down;
|
||||
|
||||
menutext_s bots[7];
|
||||
|
||||
menulist_s skill;
|
||||
menulist_s team;
|
||||
menubitmap_s go;
|
||||
|
@ -215,21 +221,6 @@ static void UI_AddBotsMenu_GetSortedBotNums( void ) {
|
|||
qsort( addBotsMenuInfo.sortedBotNums, addBotsMenuInfo.numBots, sizeof(addBotsMenuInfo.sortedBotNums[0]), UI_AddBotsMenu_SortCompare );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_AddBotsMenu_Draw
|
||||
=================
|
||||
*/
|
||||
static void UI_AddBotsMenu_Draw( void ) {
|
||||
UI_DrawBannerString( 320, 16, "ADD BOTS", UI_CENTER, color_white );
|
||||
UI_DrawNamedPic( 320-233, 240-166, 466, 332, ART_BACKGROUND );
|
||||
|
||||
// standard menu drawing
|
||||
Menu_Draw( &addBotsMenuInfo.menu );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_AddBotsMenu_Init
|
||||
|
@ -266,7 +257,6 @@ static void UI_AddBotsMenu_Init( void ) {
|
|||
gametype = atoi( Info_ValueForKey( info,"g_gametype" ) );
|
||||
|
||||
memset( &addBotsMenuInfo, 0 ,sizeof(addBotsMenuInfo) );
|
||||
addBotsMenuInfo.menu.draw = UI_AddBotsMenu_Draw;
|
||||
addBotsMenuInfo.menu.fullscreen = qfalse;
|
||||
addBotsMenuInfo.menu.wrapAround = qtrue;
|
||||
addBotsMenuInfo.delay = 1000;
|
||||
|
@ -276,6 +266,21 @@ static void UI_AddBotsMenu_Init( void ) {
|
|||
addBotsMenuInfo.numBots = UI_GetNumBots();
|
||||
count = addBotsMenuInfo.numBots < 7 ? addBotsMenuInfo.numBots : 7;
|
||||
|
||||
addBotsMenuInfo.banner.generic.type = MTYPE_BTEXT;
|
||||
addBotsMenuInfo.banner.generic.x = 320;
|
||||
addBotsMenuInfo.banner.generic.y = 16;
|
||||
addBotsMenuInfo.banner.string = "ADD BOTS";
|
||||
addBotsMenuInfo.banner.color = color_white;
|
||||
addBotsMenuInfo.banner.style = UI_CENTER;
|
||||
|
||||
addBotsMenuInfo.background.generic.type = MTYPE_BITMAP;
|
||||
addBotsMenuInfo.background.generic.name = ART_BACKGROUND;
|
||||
addBotsMenuInfo.background.generic.flags = QMF_INACTIVE;
|
||||
addBotsMenuInfo.background.generic.x = 320-233;
|
||||
addBotsMenuInfo.background.generic.y = 240-166;
|
||||
addBotsMenuInfo.background.width = 466;
|
||||
addBotsMenuInfo.background.height = 332;
|
||||
|
||||
addBotsMenuInfo.arrows.generic.type = MTYPE_BITMAP;
|
||||
addBotsMenuInfo.arrows.generic.name = ART_ARROWS;
|
||||
addBotsMenuInfo.arrows.generic.flags = QMF_INACTIVE;
|
||||
|
@ -370,8 +375,9 @@ static void UI_AddBotsMenu_Init( void ) {
|
|||
UI_AddBotsMenu_GetSortedBotNums();
|
||||
UI_AddBotsMenu_SetBotNames();
|
||||
|
||||
Menu_AddItem( &addBotsMenuInfo.menu, &addBotsMenuInfo.background );
|
||||
Menu_AddItem( &addBotsMenuInfo.menu, &addBotsMenuInfo.banner );
|
||||
Menu_AddItem( &addBotsMenuInfo.menu, &addBotsMenuInfo.arrows );
|
||||
|
||||
Menu_AddItem( &addBotsMenuInfo.menu, &addBotsMenuInfo.up );
|
||||
Menu_AddItem( &addBotsMenuInfo.menu, &addBotsMenuInfo.down );
|
||||
for( n = 0; n < count; n++ ) {
|
||||
|
|
|
@ -796,7 +796,7 @@ void UI_SPUnlockMedals_f( void ) {
|
|||
|
||||
trap_Cvar_Set( "g_spAwards", awardData );
|
||||
|
||||
trap_Print( "All levels unlocked at 100\n" );
|
||||
trap_Print( "All awards unlocked at 100\n" );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -418,7 +418,7 @@ static int numPlanes;
|
|||
static patchPlane_t planes[MAX_PATCH_PLANES];
|
||||
|
||||
static int numFacets;
|
||||
static facet_t facets[MAX_PATCH_PLANES]; //maybe MAX_FACETS ??
|
||||
static facet_t facets[MAX_FACETS];
|
||||
|
||||
#define NORMAL_EPSILON 0.0001
|
||||
#define DIST_EPSILON 0.02
|
||||
|
|
|
@ -667,6 +667,7 @@ void Cmd_SetCommandCompletionFunc( const char *command, completionFunc_t complet
|
|||
for( cmd = cmd_functions; cmd; cmd = cmd->next ) {
|
||||
if( !Q_stricmp( command, cmd->name ) ) {
|
||||
cmd->complete = complete;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -743,8 +744,11 @@ void Cmd_CompleteArgument( const char *command, char *args, int argNum ) {
|
|||
cmd_function_t *cmd;
|
||||
|
||||
for( cmd = cmd_functions; cmd; cmd = cmd->next ) {
|
||||
if( !Q_stricmp( command, cmd->name ) && cmd->complete ) {
|
||||
cmd->complete( args, argNum );
|
||||
if( !Q_stricmp( command, cmd->name ) ) {
|
||||
if ( cmd->complete ) {
|
||||
cmd->complete( args, argNum );
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2896,10 +2896,10 @@ void Com_Init( char *commandLine ) {
|
|||
#else
|
||||
// if the user didn't give any commands, run default action
|
||||
if ( !com_dedicated->integer ) {
|
||||
Cbuf_AddText ("cinematic idlogo.RoQ\n");
|
||||
Cbuf_AddText ("cinematic " CINEMATICS_LOGO "\n");
|
||||
if( !com_introPlayed->integer ) {
|
||||
Cvar_Set( com_introPlayed->name, "1" );
|
||||
Cvar_Set( "nextmap", "cinematic intro.RoQ" );
|
||||
Cvar_Set( "nextmap", "cinematic " CINEMATICS_INTRO );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -3677,3 +3677,177 @@ qboolean Com_IsVoipTarget(uint8_t *voipTargets, int voipTargetsSize, int clientN
|
|||
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
Field_CompletePlayerName
|
||||
===============
|
||||
*/
|
||||
static qboolean Field_CompletePlayerNameFinal( qboolean whitespace )
|
||||
{
|
||||
int completionOffset;
|
||||
|
||||
if( matchCount == 0 )
|
||||
return qtrue;
|
||||
|
||||
completionOffset = strlen( completionField->buffer ) - strlen( completionString );
|
||||
|
||||
Q_strncpyz( &completionField->buffer[ completionOffset ], shortestMatch,
|
||||
sizeof( completionField->buffer ) - completionOffset );
|
||||
|
||||
completionField->cursor = strlen( completionField->buffer );
|
||||
|
||||
if( matchCount == 1 && whitespace )
|
||||
{
|
||||
Q_strcat( completionField->buffer, sizeof( completionField->buffer ), " " );
|
||||
completionField->cursor++;
|
||||
return qtrue;
|
||||
}
|
||||
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
static void Name_PlayerNameCompletion( const char **names, int nameCount, void(*callback)(const char *s) )
|
||||
{
|
||||
int i;
|
||||
|
||||
for( i = 0; i < nameCount; i++ ) {
|
||||
callback( names[ i ] );
|
||||
}
|
||||
}
|
||||
|
||||
qboolean Com_FieldStringToPlayerName( char *name, int length, const char *rawname )
|
||||
{
|
||||
char hex[5];
|
||||
int i;
|
||||
int ch;
|
||||
|
||||
if( name == NULL || rawname == NULL )
|
||||
return qfalse;
|
||||
|
||||
if( length <= 0 )
|
||||
return qtrue;
|
||||
|
||||
for( i = 0; *rawname && i + 1 <= length; rawname++, i++ ) {
|
||||
if( *rawname == '\\' ) {
|
||||
Q_strncpyz( hex, rawname + 1, sizeof(hex) );
|
||||
ch = Com_HexStrToInt( hex );
|
||||
if( ch > -1 ) {
|
||||
name[i] = ch;
|
||||
rawname += 4; //hex string length, 0xXX
|
||||
} else {
|
||||
name[i] = *rawname;
|
||||
}
|
||||
} else {
|
||||
name[i] = *rawname;
|
||||
}
|
||||
}
|
||||
name[i] = '\0';
|
||||
|
||||
return qtrue;
|
||||
}
|
||||
|
||||
qboolean Com_PlayerNameToFieldString( char *str, int length, const char *name )
|
||||
{
|
||||
const char *p;
|
||||
int i;
|
||||
int x1, x2;
|
||||
|
||||
if( str == NULL || name == NULL )
|
||||
return qfalse;
|
||||
|
||||
if( length <= 0 )
|
||||
return qtrue;
|
||||
|
||||
*str = '\0';
|
||||
p = name;
|
||||
|
||||
for( i = 0; *p != '\0'; i++, p++ )
|
||||
{
|
||||
if( i + 1 >= length )
|
||||
break;
|
||||
|
||||
if( *p <= ' ' )
|
||||
{
|
||||
if( i + 5 + 1 >= length )
|
||||
break;
|
||||
|
||||
x1 = *p >> 4;
|
||||
x2 = *p & 15;
|
||||
|
||||
str[i+0] = '\\';
|
||||
str[i+1] = '0';
|
||||
str[i+2] = 'x';
|
||||
str[i+3] = x1 > 9 ? x1 - 10 + 'a' : x1 + '0';
|
||||
str[i+4] = x2 > 9 ? x2 - 10 + 'a' : x2 + '0';
|
||||
|
||||
i += 4;
|
||||
} else {
|
||||
str[i] = *p;
|
||||
}
|
||||
}
|
||||
str[i] = '\0';
|
||||
|
||||
return qtrue;
|
||||
}
|
||||
|
||||
void Field_CompletePlayerName( const char **names, int nameCount )
|
||||
{
|
||||
qboolean whitespace;
|
||||
|
||||
matchCount = 0;
|
||||
shortestMatch[ 0 ] = 0;
|
||||
|
||||
if( nameCount <= 0 )
|
||||
return;
|
||||
|
||||
Name_PlayerNameCompletion( names, nameCount, FindMatches );
|
||||
|
||||
if( completionString[0] == '\0' )
|
||||
{
|
||||
Com_PlayerNameToFieldString( shortestMatch, sizeof( shortestMatch ), names[ 0 ] );
|
||||
}
|
||||
|
||||
//allow to tab player names
|
||||
//if full player name switch to next player name
|
||||
if( completionString[0] != '\0'
|
||||
&& Q_stricmp( shortestMatch, completionString ) == 0
|
||||
&& nameCount > 1 )
|
||||
{
|
||||
int i;
|
||||
|
||||
for( i = 0; i < nameCount; i++ ) {
|
||||
if( Q_stricmp( names[ i ], completionString ) == 0 )
|
||||
{
|
||||
i++;
|
||||
if( i >= nameCount )
|
||||
{
|
||||
i = 0;
|
||||
}
|
||||
|
||||
Com_PlayerNameToFieldString( shortestMatch, sizeof( shortestMatch ), names[ i ] );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( matchCount > 1 )
|
||||
{
|
||||
Com_Printf( "]%s\n", completionField->buffer );
|
||||
|
||||
Name_PlayerNameCompletion( names, nameCount, PrintMatches );
|
||||
}
|
||||
|
||||
whitespace = nameCount == 1? qtrue: qfalse;
|
||||
if( !Field_CompletePlayerNameFinal( whitespace ) )
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
int QDECL Com_strCompare( const void *a, const void *b )
|
||||
{
|
||||
const char **pa = (const char **)a;
|
||||
const char **pb = (const char **)b;
|
||||
return strcmp( *pa, *pb );
|
||||
}
|
||||
|
|
|
@ -1117,6 +1117,9 @@ cvar_t *Cvar_Unset(cvar_t *cv)
|
|||
{
|
||||
cvar_t *next = cv->next;
|
||||
|
||||
// note what types of cvars have been modified (userinfo, archive, serverinfo, systeminfo)
|
||||
cvar_modifiedFlags |= cv->flags;
|
||||
|
||||
if(cv->name)
|
||||
Z_Free(cv->name);
|
||||
if(cv->string)
|
||||
|
|
|
@ -256,10 +256,11 @@ static char fs_gamedir[MAX_OSPATH]; // this will be a single file name with no
|
|||
static cvar_t *fs_debug;
|
||||
static cvar_t *fs_homepath;
|
||||
|
||||
#ifdef MACOS_X
|
||||
#ifdef __APPLE__
|
||||
// Also search the .app bundle for .pk3 files
|
||||
static cvar_t *fs_apppath;
|
||||
#endif
|
||||
static cvar_t *fs_steampath;
|
||||
|
||||
static cvar_t *fs_basepath;
|
||||
static cvar_t *fs_basegame;
|
||||
|
@ -758,6 +759,21 @@ long FS_SV_FOpenFileRead(const char *filename, fileHandle_t *fp)
|
|||
fsh[f].handleSync = qfalse;
|
||||
}
|
||||
|
||||
// Check fs_steampath too
|
||||
if (!fsh[f].handleFiles.file.o && fs_steampath->string[0])
|
||||
{
|
||||
ospath = FS_BuildOSPath( fs_steampath->string, filename, "" );
|
||||
ospath[strlen(ospath)-1] = '\0';
|
||||
|
||||
if ( fs_debug->integer )
|
||||
{
|
||||
Com_Printf( "FS_SV_FOpenFileRead (fs_steampath): %s\n", ospath );
|
||||
}
|
||||
|
||||
fsh[f].handleFiles.file.o = Sys_FOpen( ospath, "rb" );
|
||||
fsh[f].handleSync = qfalse;
|
||||
}
|
||||
|
||||
if ( !fsh[f].handleFiles.file.o )
|
||||
{
|
||||
f = 0;
|
||||
|
@ -2496,6 +2512,8 @@ int FS_GetModList( char *listbuf, int bufsize ) {
|
|||
int dummy;
|
||||
char **pFiles0 = NULL;
|
||||
char **pFiles1 = NULL;
|
||||
char **pFiles2 = NULL;
|
||||
char **pFiles3 = NULL;
|
||||
qboolean bDrop = qfalse;
|
||||
|
||||
*listbuf = 0;
|
||||
|
@ -2503,9 +2521,12 @@ int FS_GetModList( char *listbuf, int bufsize ) {
|
|||
|
||||
pFiles0 = Sys_ListFiles( fs_homepath->string, NULL, NULL, &dummy, qtrue );
|
||||
pFiles1 = Sys_ListFiles( fs_basepath->string, NULL, NULL, &dummy, qtrue );
|
||||
pFiles2 = Sys_ListFiles( fs_steampath->string, NULL, NULL, &dummy, qtrue );
|
||||
// we searched for mods in the three paths
|
||||
// it is likely that we have duplicate names now, which we will cleanup below
|
||||
pFiles = Sys_ConcatenateFileLists( pFiles0, pFiles1 );
|
||||
pFiles3 = Sys_ConcatenateFileLists( pFiles0, pFiles1 );
|
||||
pFiles = Sys_ConcatenateFileLists( pFiles2, pFiles3 );
|
||||
|
||||
nPotential = Sys_CountFileList(pFiles);
|
||||
|
||||
for ( i = 0 ; i < nPotential ; i++ ) {
|
||||
|
@ -2547,6 +2568,15 @@ int FS_GetModList( char *listbuf, int bufsize ) {
|
|||
Sys_FreeFileList( pPaks );
|
||||
}
|
||||
|
||||
/* try on steam path */
|
||||
if ( nPaks <= 0 )
|
||||
{
|
||||
path = FS_BuildOSPath( fs_steampath->string, name, "" );
|
||||
nPaks = 0;
|
||||
pPaks = Sys_ListFiles( path, ".pk3", NULL, &nPaks, qfalse );
|
||||
Sys_FreeFileList( pPaks );
|
||||
}
|
||||
|
||||
if (nPaks > 0) {
|
||||
nLen = strlen(name) + 1;
|
||||
// nLen is the length of the mod path
|
||||
|
@ -2753,7 +2783,7 @@ void FS_Path_f( void ) {
|
|||
searchpath_t *s;
|
||||
int i;
|
||||
|
||||
Com_Printf ("Current search path:\n");
|
||||
Com_Printf ("We are looking in the current search path:\n");
|
||||
for (s = fs_searchpaths; s; s = s->next) {
|
||||
if (s->pack) {
|
||||
Com_Printf ("%s (%i files)\n", s->pack->pakFilename, s->pack->numfiles);
|
||||
|
@ -3292,12 +3322,16 @@ static void FS_Startup( const char *gameName )
|
|||
fs_gamedirvar = Cvar_Get ("fs_game", "", CVAR_INIT|CVAR_SYSTEMINFO );
|
||||
|
||||
// add search path elements in reverse priority order
|
||||
fs_steampath = Cvar_Get ("fs_steampath", Sys_SteamPath(), CVAR_INIT|CVAR_PROTECTED );
|
||||
if (fs_steampath->string[0]) {
|
||||
FS_AddGameDirectory( fs_steampath->string, gameName );
|
||||
}
|
||||
if (fs_basepath->string[0]) {
|
||||
FS_AddGameDirectory( fs_basepath->string, gameName );
|
||||
}
|
||||
// fs_homepath is somewhat particular to *nix systems, only add if relevant
|
||||
|
||||
#ifdef MACOS_X
|
||||
#ifdef __APPLE__
|
||||
fs_apppath = Cvar_Get ("fs_apppath", Sys_DefaultAppPath(), CVAR_INIT|CVAR_PROTECTED );
|
||||
// Make MacOSX also include the base path included with the .app bundle
|
||||
if (fs_apppath->string[0])
|
||||
|
@ -3312,6 +3346,9 @@ static void FS_Startup( const char *gameName )
|
|||
|
||||
// check for additional base game so mods can be based upon other mods
|
||||
if ( fs_basegame->string[0] && Q_stricmp( fs_basegame->string, gameName ) ) {
|
||||
if (fs_steampath->string[0]) {
|
||||
FS_AddGameDirectory(fs_steampath->string, fs_basegame->string);
|
||||
}
|
||||
if (fs_basepath->string[0]) {
|
||||
FS_AddGameDirectory(fs_basepath->string, fs_basegame->string);
|
||||
}
|
||||
|
@ -3322,6 +3359,9 @@ static void FS_Startup( const char *gameName )
|
|||
|
||||
// check for additional game folder for mods
|
||||
if ( fs_gamedirvar->string[0] && Q_stricmp( fs_gamedirvar->string, gameName ) ) {
|
||||
if (fs_steampath->string[0]) {
|
||||
FS_AddGameDirectory(fs_steampath->string, fs_gamedirvar->string);
|
||||
}
|
||||
if (fs_basepath->string[0]) {
|
||||
FS_AddGameDirectory(fs_basepath->string, fs_gamedirvar->string);
|
||||
}
|
||||
|
|
353
code/qcommon/json.h
Normal file
353
code/qcommon/json.h
Normal file
|
@ -0,0 +1,353 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2016 James Canete
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#ifndef JSON_H
|
||||
#define JSON_H
|
||||
|
||||
enum
|
||||
{
|
||||
JSONTYPE_STRING, // string
|
||||
JSONTYPE_OBJECT, // object
|
||||
JSONTYPE_ARRAY, // array
|
||||
JSONTYPE_VALUE, // number, true, false, or null
|
||||
JSONTYPE_ERROR // out of data
|
||||
};
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Array Functions
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
// Get pointer to first value in array
|
||||
// When given pointer to an array, returns pointer to the first
|
||||
// returns NULL if array is empty or not an array.
|
||||
const char *JSON_ArrayGetFirstValue(const char *json, const char *jsonEnd);
|
||||
|
||||
// Get pointer to next value in array
|
||||
// When given pointer to a value, returns pointer to the next value
|
||||
// returns NULL when no next value.
|
||||
const char *JSON_ArrayGetNextValue(const char *json, const char *jsonEnd);
|
||||
|
||||
// Get pointers to values in an array
|
||||
// returns 0 if not an array, array is empty, or out of data
|
||||
// returns number of values in the array and copies into index if successful
|
||||
unsigned int JSON_ArrayGetIndex(const char *json, const char *jsonEnd, const char **indexes, unsigned int numIndexes);
|
||||
|
||||
// Get pointer to indexed value from array
|
||||
// returns NULL if not an array, no index, or out of data
|
||||
const char *JSON_ArrayGetValue(const char *json, const char *jsonEnd, unsigned int index);
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Object Functions
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
// Get pointer to named value from object
|
||||
// returns NULL if not an object, name not found, or out of data
|
||||
const char *JSON_ObjectGetNamedValue(const char *json, const char *jsonEnd, const char *name);
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Value Functions
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
// Get type of value
|
||||
// returns JSONTYPE_ERROR if out of data
|
||||
unsigned int JSON_ValueGetType(const char *json, const char *jsonEnd);
|
||||
|
||||
// Get value as string
|
||||
// returns 0 if out of data
|
||||
// returns length and copies into string if successful, including terminating nul.
|
||||
// string values are stripped of enclosing quotes but not escaped
|
||||
unsigned int JSON_ValueGetString(const char *json, const char *jsonEnd, char *outString, unsigned int stringLen);
|
||||
|
||||
// Get value as appropriate type
|
||||
// returns 0 if value is false, value is null, or out of data
|
||||
// returns 1 if value is true
|
||||
// returns value otherwise
|
||||
double JSON_ValueGetDouble(const char *json, const char *jsonEnd);
|
||||
float JSON_ValueGetFloat(const char *json, const char *jsonEnd);
|
||||
int JSON_ValueGetInt(const char *json, const char *jsonEnd);
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef JSON_IMPLEMENTATION
|
||||
#include <stdio.h>
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Internal Functions
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
static const char *JSON_SkipSeparators(const char *json, const char *jsonEnd);
|
||||
static const char *JSON_SkipString(const char *json, const char *jsonEnd);
|
||||
static const char *JSON_SkipStruct(const char *json, const char *jsonEnd);
|
||||
static const char *JSON_SkipValue(const char *json, const char *jsonEnd);
|
||||
static const char *JSON_SkipValueAndSeparators(const char *json, const char *jsonEnd);
|
||||
|
||||
#define IS_SEPARATOR(x) ((x) == ' ' || (x) == '\t' || (x) == '\n' || (x) == '\r' || (x) == ',' || (x) == ':')
|
||||
#define IS_STRUCT_OPEN(x) ((x) == '{' || (x) == '[')
|
||||
#define IS_STRUCT_CLOSE(x) ((x) == '}' || (x) == ']')
|
||||
|
||||
static const char *JSON_SkipSeparators(const char *json, const char *jsonEnd)
|
||||
{
|
||||
while (json < jsonEnd && IS_SEPARATOR(*json))
|
||||
json++;
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
static const char *JSON_SkipString(const char *json, const char *jsonEnd)
|
||||
{
|
||||
for (json++; json < jsonEnd && *json != '"'; json++)
|
||||
if (*json == '\\')
|
||||
json++;
|
||||
|
||||
return (json + 1 > jsonEnd) ? jsonEnd : json + 1;
|
||||
}
|
||||
|
||||
static const char *JSON_SkipStruct(const char *json, const char *jsonEnd)
|
||||
{
|
||||
json = JSON_SkipSeparators(json + 1, jsonEnd);
|
||||
while (json < jsonEnd && !IS_STRUCT_CLOSE(*json))
|
||||
json = JSON_SkipValueAndSeparators(json, jsonEnd);
|
||||
|
||||
return (json + 1 > jsonEnd) ? jsonEnd : json + 1;
|
||||
}
|
||||
|
||||
static const char *JSON_SkipValue(const char *json, const char *jsonEnd)
|
||||
{
|
||||
if (json >= jsonEnd)
|
||||
return jsonEnd;
|
||||
else if (*json == '"')
|
||||
json = JSON_SkipString(json, jsonEnd);
|
||||
else if (IS_STRUCT_OPEN(*json))
|
||||
json = JSON_SkipStruct(json, jsonEnd);
|
||||
else
|
||||
{
|
||||
while (json < jsonEnd && !IS_SEPARATOR(*json) && !IS_STRUCT_CLOSE(*json))
|
||||
json++;
|
||||
}
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
static const char *JSON_SkipValueAndSeparators(const char *json, const char *jsonEnd)
|
||||
{
|
||||
json = JSON_SkipValue(json, jsonEnd);
|
||||
return JSON_SkipSeparators(json, jsonEnd);
|
||||
}
|
||||
|
||||
// returns 0 if value requires more parsing, 1 if no more data/false/null, 2 if true
|
||||
static unsigned int JSON_NoParse(const char *json, const char *jsonEnd)
|
||||
{
|
||||
if (!json || json >= jsonEnd || *json == 'f' || *json == 'n')
|
||||
return 1;
|
||||
|
||||
if (*json == 't')
|
||||
return 2;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Array Functions
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
const char *JSON_ArrayGetFirstValue(const char *json, const char *jsonEnd)
|
||||
{
|
||||
if (!json || json >= jsonEnd || !IS_STRUCT_OPEN(*json))
|
||||
return NULL;
|
||||
|
||||
json = JSON_SkipSeparators(json + 1, jsonEnd);
|
||||
|
||||
return (json >= jsonEnd || IS_STRUCT_CLOSE(*json)) ? NULL : json;
|
||||
}
|
||||
|
||||
const char *JSON_ArrayGetNextValue(const char *json, const char *jsonEnd)
|
||||
{
|
||||
if (!json || json >= jsonEnd || IS_STRUCT_CLOSE(*json))
|
||||
return NULL;
|
||||
|
||||
json = JSON_SkipValueAndSeparators(json, jsonEnd);
|
||||
|
||||
return (json >= jsonEnd || IS_STRUCT_CLOSE(*json)) ? NULL : json;
|
||||
}
|
||||
|
||||
unsigned int JSON_ArrayGetIndex(const char *json, const char *jsonEnd, const char **indexes, unsigned int numIndexes)
|
||||
{
|
||||
unsigned int length = 0;
|
||||
|
||||
for (json = JSON_ArrayGetFirstValue(json, jsonEnd); json; json = JSON_ArrayGetNextValue(json, jsonEnd))
|
||||
{
|
||||
if (indexes && numIndexes)
|
||||
{
|
||||
*indexes++ = json;
|
||||
numIndexes--;
|
||||
}
|
||||
length++;
|
||||
}
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
const char *JSON_ArrayGetValue(const char *json, const char *jsonEnd, unsigned int index)
|
||||
{
|
||||
for (json = JSON_ArrayGetFirstValue(json, jsonEnd); json && index; json = JSON_ArrayGetNextValue(json, jsonEnd))
|
||||
index--;
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Object Functions
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
const char *JSON_ObjectGetNamedValue(const char *json, const char *jsonEnd, const char *name)
|
||||
{
|
||||
unsigned int nameLen = strlen(name);
|
||||
|
||||
for (json = JSON_ArrayGetFirstValue(json, jsonEnd); json; json = JSON_ArrayGetNextValue(json, jsonEnd))
|
||||
{
|
||||
if (*json == '"')
|
||||
{
|
||||
const char *thisNameStart, *thisNameEnd;
|
||||
|
||||
thisNameStart = json + 1;
|
||||
json = JSON_SkipString(json, jsonEnd);
|
||||
thisNameEnd = json - 1;
|
||||
json = JSON_SkipSeparators(json, jsonEnd);
|
||||
|
||||
if ((unsigned int)(thisNameEnd - thisNameStart) == nameLen)
|
||||
if (strncmp(thisNameStart, name, nameLen) == 0)
|
||||
return json;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Value Functions
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
unsigned int JSON_ValueGetType(const char *json, const char *jsonEnd)
|
||||
{
|
||||
if (!json || json >= jsonEnd)
|
||||
return JSONTYPE_ERROR;
|
||||
else if (*json == '"')
|
||||
return JSONTYPE_STRING;
|
||||
else if (*json == '{')
|
||||
return JSONTYPE_OBJECT;
|
||||
else if (*json == '[')
|
||||
return JSONTYPE_ARRAY;
|
||||
|
||||
return JSONTYPE_VALUE;
|
||||
}
|
||||
|
||||
unsigned int JSON_ValueGetString(const char *json, const char *jsonEnd, char *outString, unsigned int stringLen)
|
||||
{
|
||||
const char *stringEnd, *stringStart;
|
||||
|
||||
if (!json)
|
||||
{
|
||||
*outString = '\0';
|
||||
return 0;
|
||||
}
|
||||
|
||||
stringStart = json;
|
||||
stringEnd = JSON_SkipValue(stringStart, jsonEnd);
|
||||
if (stringEnd >= jsonEnd)
|
||||
{
|
||||
*outString = '\0';
|
||||
return 0;
|
||||
}
|
||||
|
||||
// skip enclosing quotes if they exist
|
||||
if (*stringStart == '"')
|
||||
stringStart++;
|
||||
|
||||
if (*(stringEnd - 1) == '"')
|
||||
stringEnd--;
|
||||
|
||||
stringLen--;
|
||||
if (stringLen > stringEnd - stringStart)
|
||||
stringLen = stringEnd - stringStart;
|
||||
|
||||
json = stringStart;
|
||||
while (stringLen--)
|
||||
*outString++ = *json++;
|
||||
*outString = '\0';
|
||||
|
||||
return stringEnd - stringStart;
|
||||
}
|
||||
|
||||
double JSON_ValueGetDouble(const char *json, const char *jsonEnd)
|
||||
{
|
||||
char cValue[256];
|
||||
double dValue = 0.0;
|
||||
unsigned int np = JSON_NoParse(json, jsonEnd);
|
||||
|
||||
if (np)
|
||||
return (double)(np - 1);
|
||||
|
||||
if (!JSON_ValueGetString(json, jsonEnd, cValue, 256))
|
||||
return 0.0;
|
||||
|
||||
sscanf(cValue, "%lf", &dValue);
|
||||
|
||||
return dValue;
|
||||
}
|
||||
|
||||
float JSON_ValueGetFloat(const char *json, const char *jsonEnd)
|
||||
{
|
||||
char cValue[256];
|
||||
float fValue = 0.0f;
|
||||
unsigned int np = JSON_NoParse(json, jsonEnd);
|
||||
|
||||
if (np)
|
||||
return (float)(np - 1);
|
||||
|
||||
if (!JSON_ValueGetString(json, jsonEnd, cValue, 256))
|
||||
return 0.0f;
|
||||
|
||||
sscanf(cValue, "%f", &fValue);
|
||||
|
||||
return fValue;
|
||||
}
|
||||
|
||||
int JSON_ValueGetInt(const char *json, const char *jsonEnd)
|
||||
{
|
||||
char cValue[256];
|
||||
int iValue = 0;
|
||||
unsigned int np = JSON_NoParse(json, jsonEnd);
|
||||
|
||||
if (np)
|
||||
return np - 1;
|
||||
|
||||
if (!JSON_ValueGetString(json, jsonEnd, cValue, 256))
|
||||
return 0;
|
||||
|
||||
sscanf(cValue, "%d", &iValue);
|
||||
|
||||
return iValue;
|
||||
}
|
||||
|
||||
#undef IS_SEPARATOR
|
||||
#undef IS_STRUCT_OPEN
|
||||
#undef IS_STRUCT_CLOSE
|
||||
|
||||
#endif
|
|
@ -1272,7 +1272,7 @@ static void NET_AddLocalAddress(char *ifname, struct sockaddr *addr, struct sock
|
|||
}
|
||||
}
|
||||
|
||||
#if defined(__linux__) || defined(MACOSX) || defined(__BSD__)
|
||||
#if defined(__linux__) || defined(__APPLE__) || defined(__BSD__)
|
||||
static void NET_GetLocalAddress(void)
|
||||
{
|
||||
struct ifaddrs *ifap, *search;
|
||||
|
|
|
@ -46,7 +46,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
#define idppc 1
|
||||
#if defined(__VEC__)
|
||||
#define idppc_altivec 1
|
||||
#ifdef MACOS_X // Apple's GCC does this differently than the FSF.
|
||||
#ifdef __APPLE__ // Apple's GCC does this differently than the FSF.
|
||||
#define VECCONST_UINT8(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) \
|
||||
(vector unsigned char) (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p)
|
||||
#else
|
||||
|
@ -139,12 +139,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
|
||||
//============================================================== MAC OS X ===
|
||||
|
||||
#if defined(MACOS_X) || defined(__APPLE_CC__)
|
||||
|
||||
// make sure this is defined, just for sanity's sake...
|
||||
#ifndef MACOS_X
|
||||
#define MACOS_X
|
||||
#endif
|
||||
#if defined(__APPLE__) || defined(__APPLE_CC__)
|
||||
|
||||
#define OS_STRING "macosx"
|
||||
#define ID_INLINE inline
|
||||
|
|
|
@ -27,14 +27,18 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
// A user mod should never modify this file
|
||||
|
||||
#ifdef STANDALONE
|
||||
#define PRODUCT_NAME "iofoo3"
|
||||
#define BASEGAME "foobar"
|
||||
#define CLIENT_WINDOW_TITLE "changeme"
|
||||
#define CLIENT_WINDOW_MIN_TITLE "changeme2"
|
||||
#define PRODUCT_NAME "iofoo3"
|
||||
#define BASEGAME "foobar"
|
||||
#define CLIENT_WINDOW_TITLE "changeme"
|
||||
#define CLIENT_WINDOW_MIN_TITLE "changeme2"
|
||||
#define HOMEPATH_NAME_UNIX ".foo"
|
||||
#define HOMEPATH_NAME_WIN "FooBar"
|
||||
#define HOMEPATH_NAME_WIN "FooBar"
|
||||
#define HOMEPATH_NAME_MACOSX HOMEPATH_NAME_WIN
|
||||
// #define STEAMPATH_NAME "Foo Bar"
|
||||
// #define STEAMPATH_APPID ""
|
||||
#define GAMENAME_FOR_MASTER "foobar" // must NOT contain whitespace
|
||||
#define CINEMATICS_LOGO "foologo.roq"
|
||||
#define CINEMATICS_INTRO "intro.roq"
|
||||
// #define LEGACY_PROTOCOL // You probably don't need this for your standalone game
|
||||
#else
|
||||
#ifdef ELITEFORCE
|
||||
|
@ -45,7 +49,11 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
#define HOMEPATH_NAME_UNIX ".stvef"
|
||||
#define HOMEPATH_NAME_WIN "STVEF"
|
||||
#define HOMEPATH_NAME_MACOSX HOMEPATH_NAME_WIN
|
||||
//#define STEAMPATH_NAME "Quake 3 Arena"
|
||||
//#define STEAMPATH_APPID "2200"
|
||||
#define GAMENAME_FOR_MASTER "EliteForce"
|
||||
//#define CINEMATICS_LOGO "eflogo.bik"
|
||||
//#define CINEMATICS_INTRO "intro.bik"
|
||||
#define LEGACY_PROTOCOL
|
||||
#else
|
||||
#define PRODUCT_NAME "ioq3"
|
||||
|
@ -55,7 +63,11 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
#define HOMEPATH_NAME_UNIX ".q3a"
|
||||
#define HOMEPATH_NAME_WIN "Quake3"
|
||||
#define HOMEPATH_NAME_MACOSX HOMEPATH_NAME_WIN
|
||||
#define STEAMPATH_NAME "Quake 3 Arena"
|
||||
#define STEAMPATH_APPID "2200"
|
||||
#define GAMENAME_FOR_MASTER "Quake3Arena"
|
||||
#define CINEMATICS_LOGO "idlogo.RoQ"
|
||||
#define CINEMATICS_INTRO "intro.RoQ"
|
||||
#define LEGACY_PROTOCOL
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -337,7 +337,8 @@ enum svc_ops_e {
|
|||
svc_EOF,
|
||||
|
||||
// new commands, supported only by ioquake3 protocol but not legacy
|
||||
svc_voip, // not wrapped in USE_VOIP, so this value is reserved.
|
||||
svc_voipSpeex, // not wrapped in USE_VOIP, so this value is reserved.
|
||||
svc_voipOpus, //
|
||||
};
|
||||
|
||||
|
||||
|
@ -353,7 +354,8 @@ enum clc_ops_e {
|
|||
clc_EOF,
|
||||
|
||||
// new commands, supported only by ioquake3 protocol but not legacy
|
||||
clc_voip, // not wrapped in USE_VOIP, so this value is reserved.
|
||||
clc_voipSpeex, // not wrapped in USE_VOIP, so this value is reserved.
|
||||
clc_voipOpus, //
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -807,6 +809,7 @@ void Field_CompleteFilename( const char *dir,
|
|||
const char *ext, qboolean stripExt, qboolean allowNonPureFilesOnDisk );
|
||||
void Field_CompleteCommand( char *cmd,
|
||||
qboolean doCommands, qboolean doCvars );
|
||||
void Field_CompletePlayerName( const char **names, int count );
|
||||
|
||||
/*
|
||||
==============================================================
|
||||
|
@ -886,6 +889,10 @@ void Com_StartupVariable( const char *match );
|
|||
// if match is NULL, all set commands will be executed, otherwise
|
||||
// only a set with the exact name. Only used during startup.
|
||||
|
||||
qboolean Com_PlayerNameToFieldString( char *str, int length, const char *name );
|
||||
qboolean Com_FieldStringToPlayerName( char *name, int length, const char *rawname );
|
||||
int QDECL Com_strCompare( const void *a, const void *b );
|
||||
|
||||
|
||||
extern cvar_t *com_developer;
|
||||
extern cvar_t *com_dedicated;
|
||||
|
@ -1146,8 +1153,9 @@ FILE *Sys_Mkfifo( const char *ospath );
|
|||
char *Sys_Cwd( void );
|
||||
void Sys_SetDefaultInstallPath(const char *path);
|
||||
char *Sys_DefaultInstallPath(void);
|
||||
char *Sys_SteamPath(void);
|
||||
|
||||
#ifdef MACOS_X
|
||||
#ifdef __APPLE__
|
||||
char *Sys_DefaultAppPath(void);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -677,12 +677,12 @@ extern void (APIENTRY * qglRenderbufferStorageMultisampleEXT)(GLenum target, GLs
|
|||
#define GL_FRAMEBUFFER_SRGB_EXT 0x8DB9
|
||||
#endif
|
||||
|
||||
#ifndef GL_EXT_texture_compression_latc
|
||||
#define GL_EXT_texture_compression_latc
|
||||
#define GL_COMPRESSED_LUMINANCE_LATC1_EXT 0x8C70
|
||||
#define GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT 0x8C71
|
||||
#define GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT 0x8C72
|
||||
#define GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT 0x8C73
|
||||
#ifndef GL_ARB_texture_compression_rgtc
|
||||
#define GL_ARB_texture_compression_rgtc
|
||||
#define GL_COMPRESSED_RED_RGTC1 0x8DBB
|
||||
#define GL_COMPRESSED_SIGNED_RED_RGTC1 0x8DBC
|
||||
#define GL_COMPRESSED_RG_RGTC2 0x8DBD
|
||||
#define GL_COMPRESSED_SIGNED_RG_RGTC2 0x8DBE
|
||||
#endif
|
||||
|
||||
#ifndef GL_ARB_texture_compression_bptc
|
||||
|
@ -693,29 +693,6 @@ extern void (APIENTRY * qglRenderbufferStorageMultisampleEXT)(GLenum target, GLs
|
|||
#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB 0x8E8F
|
||||
#endif
|
||||
|
||||
// GL_ARB_draw_buffers
|
||||
extern void (APIENTRY * qglDrawBuffersARB)(GLsizei n, const GLenum *bufs);
|
||||
#ifndef GL_ARB_draw_buffers
|
||||
#define GL_ARB_draw_buffers
|
||||
#define GL_MAX_DRAW_BUFFERS_ARB 0x8824
|
||||
#define GL_DRAW_BUFFER0_ARB 0x8825
|
||||
#define GL_DRAW_BUFFER1_ARB 0x8826
|
||||
#define GL_DRAW_BUFFER2_ARB 0x8827
|
||||
#define GL_DRAW_BUFFER3_ARB 0x8828
|
||||
#define GL_DRAW_BUFFER4_ARB 0x8829
|
||||
#define GL_DRAW_BUFFER5_ARB 0x882A
|
||||
#define GL_DRAW_BUFFER6_ARB 0x882B
|
||||
#define GL_DRAW_BUFFER7_ARB 0x882C
|
||||
#define GL_DRAW_BUFFER8_ARB 0x882D
|
||||
#define GL_DRAW_BUFFER9_ARB 0x882E
|
||||
#define GL_DRAW_BUFFER10_ARB 0x882F
|
||||
#define GL_DRAW_BUFFER11_ARB 0x8830
|
||||
#define GL_DRAW_BUFFER12_ARB 0x8831
|
||||
#define GL_DRAW_BUFFER13_ARB 0x8832
|
||||
#define GL_DRAW_BUFFER14_ARB 0x8833
|
||||
#define GL_DRAW_BUFFER15_ARB 0x8834
|
||||
#endif
|
||||
|
||||
#ifndef GL_ARB_depth_clamp
|
||||
#define GL_ARB_depth_clamp
|
||||
#define GL_DEPTH_CLAMP 0x864F
|
||||
|
@ -736,6 +713,51 @@ extern GLboolean (APIENTRY * qglIsVertexArrayARB)(GLuint array);
|
|||
#define GL_VERTEX_ARRAY_BINDING_ARB 0x85B5
|
||||
#endif
|
||||
|
||||
// GL_EXT_direct_state_access
|
||||
extern GLvoid(APIENTRY * qglBindMultiTexture)(GLenum texunit, GLenum target, GLuint texture);
|
||||
extern GLvoid(APIENTRY * qglTextureParameterf)(GLuint texture, GLenum target, GLenum pname, GLfloat param);
|
||||
extern GLvoid(APIENTRY * qglTextureParameteri)(GLuint texture, GLenum target, GLenum pname, GLint param);
|
||||
extern GLvoid(APIENTRY * qglTextureImage2D)(GLuint texture, GLenum target, GLint level, GLint internalformat,
|
||||
GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
|
||||
extern GLvoid(APIENTRY * qglTextureSubImage2D)(GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset,
|
||||
GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
|
||||
extern GLvoid(APIENTRY * qglCopyTextureImage2D)(GLuint texture, GLenum target, GLint level, GLenum internalformat,
|
||||
GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
|
||||
extern GLvoid(APIENTRY * qglCompressedTextureImage2D)(GLuint texture, GLenum target, GLint level, GLenum internalformat,
|
||||
GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
|
||||
extern GLvoid(APIENTRY * qglCompressedTextureSubImage2D)(GLuint texture, GLenum target, GLint level,
|
||||
GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format,
|
||||
GLsizei imageSize, const GLvoid *data);
|
||||
extern GLvoid(APIENTRY * qglGenerateTextureMipmap)(GLuint texture, GLenum target);
|
||||
|
||||
extern GLvoid(APIENTRY * qglProgramUniform1i)(GLuint program, GLint location, GLint v0);
|
||||
extern GLvoid(APIENTRY * qglProgramUniform1f)(GLuint program, GLint location, GLfloat v0);
|
||||
extern GLvoid(APIENTRY * qglProgramUniform2f)(GLuint program, GLint location,
|
||||
GLfloat v0, GLfloat v1);
|
||||
extern GLvoid(APIENTRY * qglProgramUniform3f)(GLuint program, GLint location,
|
||||
GLfloat v0, GLfloat v1, GLfloat v2);
|
||||
extern GLvoid(APIENTRY * qglProgramUniform4f)(GLuint program, GLint location,
|
||||
GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
|
||||
extern GLvoid(APIENTRY * qglProgramUniform1fv)(GLuint program, GLint location,
|
||||
GLsizei count, const GLfloat *value);
|
||||
extern GLvoid(APIENTRY * qglProgramUniformMatrix4fv)(GLuint program, GLint location,
|
||||
GLsizei count, GLboolean transpose,
|
||||
const GLfloat *value);
|
||||
|
||||
extern GLvoid(APIENTRY * qglNamedRenderbufferStorage)(GLuint renderbuffer,
|
||||
GLenum internalformat, GLsizei width, GLsizei height);
|
||||
|
||||
extern GLvoid(APIENTRY * qglNamedRenderbufferStorageMultisample)(GLuint renderbuffer,
|
||||
GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
|
||||
|
||||
extern GLenum(APIENTRY * qglCheckNamedFramebufferStatus)(GLuint framebuffer, GLenum target);
|
||||
extern GLvoid(APIENTRY * qglNamedFramebufferTexture2D)(GLuint framebuffer,
|
||||
GLenum attachment, GLenum textarget, GLuint texture, GLint level);
|
||||
extern GLvoid(APIENTRY * qglNamedFramebufferRenderbuffer)(GLuint framebuffer,
|
||||
GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
|
||||
|
||||
|
||||
|
||||
|
||||
#if defined(WIN32)
|
||||
// WGL_ARB_create_context
|
||||
|
|
|
@ -20,6 +20,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
===========================================================================
|
||||
*/
|
||||
|
||||
#include <setjmp.h>
|
||||
|
||||
#include "tr_common.h"
|
||||
|
||||
/*
|
||||
|
@ -42,16 +44,27 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
# endif
|
||||
#endif
|
||||
|
||||
static void __attribute__((__noreturn__)) R_JPGErrorExit(j_common_ptr cinfo)
|
||||
/* Catching errors, as done in libjpeg's example.c */
|
||||
typedef struct q_jpeg_error_mgr_s
|
||||
{
|
||||
struct jpeg_error_mgr pub; /* "public" fields */
|
||||
|
||||
jmp_buf setjmp_buffer; /* for return to caller */
|
||||
} q_jpeg_error_mgr_t;
|
||||
|
||||
static void R_JPGErrorExit(j_common_ptr cinfo)
|
||||
{
|
||||
char buffer[JMSG_LENGTH_MAX];
|
||||
|
||||
/* cinfo->err really points to a q_jpeg_error_mgr_s struct, so coerce pointer */
|
||||
q_jpeg_error_mgr_t *jerr = (q_jpeg_error_mgr_t *)cinfo->err;
|
||||
|
||||
(*cinfo->err->format_message) (cinfo, buffer);
|
||||
|
||||
/* Let the memory manager delete any temp files before we die */
|
||||
jpeg_destroy(cinfo);
|
||||
|
||||
ri.Error(ERR_FATAL, "%s", buffer);
|
||||
|
||||
ri.Printf(PRINT_ALL, "Error: %s", buffer);
|
||||
|
||||
/* Return control to the setjmp point */
|
||||
longjmp(jerr->setjmp_buffer, 1);
|
||||
}
|
||||
|
||||
static void R_JPGOutputMessage(j_common_ptr cinfo)
|
||||
|
@ -83,7 +96,7 @@ void R_LoadJPG(const char *filename, unsigned char **pic, int *width, int *heigh
|
|||
* Note that this struct must live as long as the main JPEG parameter
|
||||
* struct, to avoid dangling-pointer problems.
|
||||
*/
|
||||
struct jpeg_error_mgr jerr;
|
||||
q_jpeg_error_mgr_t jerr;
|
||||
/* More stuff */
|
||||
JSAMPARRAY buffer; /* Output row buffer */
|
||||
unsigned int row_stride; /* physical row width in output buffer */
|
||||
|
@ -115,10 +128,24 @@ void R_LoadJPG(const char *filename, unsigned char **pic, int *width, int *heigh
|
|||
* This routine fills in the contents of struct jerr, and returns jerr's
|
||||
* address which we place into the link field in cinfo.
|
||||
*/
|
||||
cinfo.err = jpeg_std_error(&jerr);
|
||||
cinfo.err = jpeg_std_error(&jerr.pub);
|
||||
cinfo.err->error_exit = R_JPGErrorExit;
|
||||
cinfo.err->output_message = R_JPGOutputMessage;
|
||||
|
||||
/* Establish the setjmp return context for R_JPGErrorExit to use. */
|
||||
if (setjmp(jerr.setjmp_buffer))
|
||||
{
|
||||
/* If we get here, the JPEG code has signaled an error.
|
||||
* We need to clean up the JPEG object, close the input file, and return.
|
||||
*/
|
||||
jpeg_destroy_decompress(&cinfo);
|
||||
ri.FS_FreeFile(fbuffer.v);
|
||||
|
||||
/* Append the filename to the error for easier debugging */
|
||||
ri.Printf(PRINT_ALL, ", loading file %s\n", filename);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Now we can initialize the JPEG decompression object. */
|
||||
jpeg_create_decompress(&cinfo);
|
||||
|
||||
|
@ -361,17 +388,29 @@ size_t RE_SaveJPGToBuffer(byte *buffer, size_t bufSize, int quality,
|
|||
int image_width, int image_height, byte *image_buffer, int padding)
|
||||
{
|
||||
struct jpeg_compress_struct cinfo;
|
||||
struct jpeg_error_mgr jerr;
|
||||
q_jpeg_error_mgr_t jerr;
|
||||
JSAMPROW row_pointer[1]; /* pointer to JSAMPLE row[s] */
|
||||
my_dest_ptr dest;
|
||||
int row_stride; /* physical row width in image buffer */
|
||||
size_t outcount;
|
||||
|
||||
/* Step 1: allocate and initialize JPEG compression object */
|
||||
cinfo.err = jpeg_std_error(&jerr);
|
||||
cinfo.err = jpeg_std_error(&jerr.pub);
|
||||
cinfo.err->error_exit = R_JPGErrorExit;
|
||||
cinfo.err->output_message = R_JPGOutputMessage;
|
||||
|
||||
/* Establish the setjmp return context for R_JPGErrorExit to use. */
|
||||
if (setjmp(jerr.setjmp_buffer))
|
||||
{
|
||||
/* If we get here, the JPEG code has signaled an error.
|
||||
* We need to clean up the JPEG object and return.
|
||||
*/
|
||||
jpeg_destroy_compress(&cinfo);
|
||||
|
||||
ri.Printf(PRINT_ALL, "\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Now we can initialize the JPEG compression object. */
|
||||
jpeg_create_compress(&cinfo);
|
||||
|
||||
|
|
|
@ -502,8 +502,6 @@ void RB_BeginDrawingView (void) {
|
|||
}
|
||||
|
||||
|
||||
#define MAC_EVENT_PUMP_MSEC 5
|
||||
|
||||
/*
|
||||
==================
|
||||
RB_RenderDrawSurfList
|
||||
|
|
|
@ -114,20 +114,20 @@ void R_IssuePendingRenderCommands( void ) {
|
|||
|
||||
/*
|
||||
============
|
||||
R_GetCommandBuffer
|
||||
R_GetCommandBufferReserved
|
||||
|
||||
make sure there is enough command space
|
||||
============
|
||||
*/
|
||||
void *R_GetCommandBuffer( int bytes ) {
|
||||
void *R_GetCommandBufferReserved( int bytes, int reservedBytes ) {
|
||||
renderCommandList_t *cmdList;
|
||||
|
||||
cmdList = &backEndData->commands;
|
||||
bytes = PAD(bytes, sizeof(void *));
|
||||
|
||||
// always leave room for the end of list command
|
||||
if ( cmdList->used + bytes + 4 > MAX_RENDER_COMMANDS ) {
|
||||
if ( bytes > MAX_RENDER_COMMANDS - 4 ) {
|
||||
if ( cmdList->used + bytes + sizeof( int ) + reservedBytes > MAX_RENDER_COMMANDS ) {
|
||||
if ( bytes > MAX_RENDER_COMMANDS - sizeof( int ) ) {
|
||||
ri.Error( ERR_FATAL, "R_GetCommandBuffer: bad size %i", bytes );
|
||||
}
|
||||
// if we run out of room, just start dropping commands
|
||||
|
@ -139,6 +139,17 @@ void *R_GetCommandBuffer( int bytes ) {
|
|||
return cmdList->cmds + cmdList->used - bytes;
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
R_GetCommandBuffer
|
||||
|
||||
returns NULL if there is not enough space for important commands
|
||||
=============
|
||||
*/
|
||||
void *R_GetCommandBuffer( int bytes ) {
|
||||
return R_GetCommandBufferReserved( bytes, PAD( sizeof( swapBuffersCommand_t ), sizeof(void *) ) );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
=============
|
||||
|
@ -454,7 +465,7 @@ void RE_EndFrame( int *frontEndMsec, int *backEndMsec ) {
|
|||
if ( !tr.registered ) {
|
||||
return;
|
||||
}
|
||||
cmd = R_GetCommandBuffer( sizeof( *cmd ) );
|
||||
cmd = R_GetCommandBufferReserved( sizeof( *cmd ), 0 );
|
||||
if ( !cmd ) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -557,6 +557,7 @@ static void Upload32( unsigned *data,
|
|||
qboolean mipmap,
|
||||
qboolean picmip,
|
||||
qboolean lightMap,
|
||||
qboolean allowCompression,
|
||||
int *format,
|
||||
int *pUploadWidth, int *pUploadHeight )
|
||||
{
|
||||
|
@ -692,11 +693,11 @@ static void Upload32( unsigned *data,
|
|||
}
|
||||
else
|
||||
{
|
||||
if ( glConfig.textureCompression == TC_S3TC_ARB )
|
||||
if ( allowCompression && glConfig.textureCompression == TC_S3TC_ARB )
|
||||
{
|
||||
internalFormat = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
|
||||
}
|
||||
else if ( glConfig.textureCompression == TC_S3TC )
|
||||
else if ( allowCompression && glConfig.textureCompression == TC_S3TC )
|
||||
{
|
||||
internalFormat = GL_RGB4_S3TC;
|
||||
}
|
||||
|
@ -892,6 +893,7 @@ image_t *R_CreateImage( const char *name, byte *pic, int width, int height,
|
|||
image->flags & IMGFLAG_MIPMAP,
|
||||
image->flags & IMGFLAG_PICMIP,
|
||||
isLightmap,
|
||||
!(image->flags & IMGFLAG_NO_COMPRESSION),
|
||||
&image->internalFormat,
|
||||
&image->uploadWidth,
|
||||
&image->uploadHeight );
|
||||
|
|
|
@ -1153,13 +1153,6 @@ void R_SortDrawSurfs( drawSurf_t *drawSurfs, int numDrawSurfs ) {
|
|||
return;
|
||||
}
|
||||
|
||||
// if we overflowed MAX_DRAWSURFS, the drawsurfs
|
||||
// wrapped around in the buffer and we will be missing
|
||||
// the first surfaces, not the last ones
|
||||
if ( numDrawSurfs > MAX_DRAWSURFS ) {
|
||||
numDrawSurfs = MAX_DRAWSURFS;
|
||||
}
|
||||
|
||||
// sort the drawsurfs by sort type, then orientation, then shader
|
||||
R_RadixSort( drawSurfs, numDrawSurfs );
|
||||
|
||||
|
@ -1380,6 +1373,7 @@ or a mirror / remote location
|
|||
*/
|
||||
void R_RenderView (viewParms_t *parms) {
|
||||
int firstDrawSurf;
|
||||
int numDrawSurfs;
|
||||
|
||||
if ( parms->viewportWidth <= 0 || parms->viewportHeight <= 0 ) {
|
||||
return;
|
||||
|
@ -1402,7 +1396,15 @@ void R_RenderView (viewParms_t *parms) {
|
|||
|
||||
R_GenerateDrawSurfs();
|
||||
|
||||
R_SortDrawSurfs( tr.refdef.drawSurfs + firstDrawSurf, tr.refdef.numDrawSurfs - firstDrawSurf );
|
||||
// if we overflowed MAX_DRAWSURFS, the drawsurfs
|
||||
// wrapped around in the buffer and we will be missing
|
||||
// the first surfaces, not the last ones
|
||||
numDrawSurfs = tr.refdef.numDrawSurfs;
|
||||
if ( numDrawSurfs > MAX_DRAWSURFS ) {
|
||||
numDrawSurfs = MAX_DRAWSURFS;
|
||||
}
|
||||
|
||||
R_SortDrawSurfs( tr.refdef.drawSurfs + firstDrawSurf, numDrawSurfs - firstDrawSurf );
|
||||
|
||||
// draw main system development information (surface outlines, etc)
|
||||
R_DebugGraphics();
|
||||
|
|
|
@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
// tr_shade.c
|
||||
|
||||
#include "tr_local.h"
|
||||
#if idppc_altivec && !defined(MACOS_X)
|
||||
#if idppc_altivec && !defined(__APPLE__)
|
||||
#include <altivec.h>
|
||||
#endif
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
// tr_shade_calc.c
|
||||
|
||||
#include "tr_local.h"
|
||||
#if idppc_altivec && !defined(MACOS_X)
|
||||
#if idppc_altivec && !defined(__APPLE__)
|
||||
#include <altivec.h>
|
||||
#endif
|
||||
|
||||
|
|
|
@ -769,6 +769,7 @@ void RB_StageIteratorSky( void ) {
|
|||
|
||||
qglPushMatrix ();
|
||||
GL_State( 0 );
|
||||
GL_Cull( CT_FRONT_SIDED );
|
||||
qglTranslatef (backEnd.viewParms.or.origin[0], backEnd.viewParms.or.origin[1], backEnd.viewParms.or.origin[2]);
|
||||
|
||||
DrawSkyBox( tess.shader );
|
||||
|
|
|
@ -21,7 +21,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
*/
|
||||
// tr_surf.c
|
||||
#include "tr_local.h"
|
||||
#if idppc_altivec && !defined(MACOS_X)
|
||||
#if idppc_altivec && !defined(__APPLE__)
|
||||
#include <altivec.h>
|
||||
#endif
|
||||
|
||||
|
|
|
@ -14,8 +14,8 @@ vec3 GetValues(vec2 offset, vec3 current)
|
|||
|
||||
#ifdef FIRST_PASS
|
||||
|
||||
#if defined(r_framebufferGamma)
|
||||
minAvgMax = pow(minAvgMax, vec3(r_framebufferGamma));
|
||||
#if defined(USE_PBR)
|
||||
minAvgMax *= minAvgMax;
|
||||
#endif
|
||||
|
||||
float lumi = max(dot(LUMINANCE_VECTOR, minAvgMax), 0.000001);
|
||||
|
|
|
@ -1,58 +1,82 @@
|
|||
uniform sampler2D u_ScreenImageMap;
|
||||
uniform sampler2D u_ScreenDepthMap;
|
||||
|
||||
uniform vec4 u_ViewInfo; // zfar / znear, zfar
|
||||
uniform vec4 u_ViewInfo; // zfar / znear, zfar, 1/width, 1/height
|
||||
varying vec2 var_ScreenTex;
|
||||
|
||||
//float gauss[8] = float[8](0.17, 0.17, 0.16, 0.14, 0.12, 0.1, 0.08, 0.06);
|
||||
//float gauss[5] = float[5](0.30, 0.23, 0.097, 0.024, 0.0033);
|
||||
float gauss[4] = float[4](0.40, 0.24, 0.054, 0.0044);
|
||||
//float gauss[3] = float[3](0.60, 0.19, 0.0066);
|
||||
#define GAUSS_SIZE 4
|
||||
#define BLUR_SIZE 4
|
||||
|
||||
#if !defined(USE_DEPTH)
|
||||
//#define USE_GAUSS
|
||||
#endif
|
||||
|
||||
float getLinearDepth(sampler2D depthMap, const vec2 tex, const float zFarDivZNear)
|
||||
{
|
||||
float sampleZDivW = texture2D(depthMap, tex).r;
|
||||
return 1.0 / mix(zFarDivZNear, 1.0, sampleZDivW);
|
||||
float sampleZDivW = texture2D(depthMap, tex).r;
|
||||
return 1.0 / mix(zFarDivZNear, 1.0, sampleZDivW);
|
||||
}
|
||||
|
||||
vec4 depthGaussian1D(sampler2D imageMap, sampler2D depthMap, vec2 tex, float zFarDivZNear, float zFar)
|
||||
vec4 depthGaussian1D(sampler2D imageMap, sampler2D depthMap, vec2 tex, float zFarDivZNear, float zFar, vec2 scale)
|
||||
{
|
||||
float scale = 1.0 / 256.0;
|
||||
|
||||
#if defined(USE_DEPTH)
|
||||
float depthCenter = getLinearDepth(depthMap, tex, zFarDivZNear);
|
||||
vec2 slope = vec2(dFdx(depthCenter), dFdy(depthCenter)) / vec2(dFdx(tex.x), dFdy(tex.y));
|
||||
scale /= clamp(zFarDivZNear * depthCenter / 32.0, 1.0, 2.0);
|
||||
#endif
|
||||
|
||||
#if defined(USE_HORIZONTAL_BLUR)
|
||||
vec2 direction = vec2(1.0, 0.0) * scale;
|
||||
vec2 direction = vec2(scale.x * 2.0, 0.0);
|
||||
vec2 nudge = vec2(0.0, scale.y * 0.5);
|
||||
#else // if defined(USE_VERTICAL_BLUR)
|
||||
vec2 direction = vec2(0.0, 1.0) * scale;
|
||||
vec2 direction = vec2(0.0, scale.y * 2.0);
|
||||
vec2 nudge = vec2(-scale.x * 0.5, 0.0);
|
||||
#endif
|
||||
|
||||
float depthCenter = zFar * getLinearDepth(depthMap, tex, zFarDivZNear);
|
||||
vec2 centerSlope = vec2(dFdx(depthCenter), dFdy(depthCenter)) / vec2(dFdx(tex.x), dFdy(tex.y));
|
||||
|
||||
|
||||
#if defined(USE_GAUSS)
|
||||
vec4 result = texture2D(imageMap, tex) * gauss[0];
|
||||
float total = gauss[0];
|
||||
#else
|
||||
vec4 result = texture2D(imageMap, tex);
|
||||
float total = 1.0;
|
||||
#endif
|
||||
|
||||
float zLimit = 5.0 / zFar;
|
||||
int i, j;
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
for (j = 1; j < GAUSS_SIZE; j++)
|
||||
for (j = 1; j < BLUR_SIZE; j++)
|
||||
{
|
||||
vec2 offset = direction * j;
|
||||
float depthSample = zFar * getLinearDepth(depthMap, tex + offset, zFarDivZNear);
|
||||
float depthExpected = depthCenter + dot(centerSlope, offset);
|
||||
if(abs(depthSample - depthExpected) < 5.0)
|
||||
{
|
||||
result += texture2D(imageMap, tex + offset) * gauss[j];
|
||||
total += gauss[j];
|
||||
}
|
||||
vec2 offset = direction * (float(j) - 0.25) + nudge;
|
||||
#if defined(USE_DEPTH)
|
||||
float depthSample = getLinearDepth(depthMap, tex + offset, zFarDivZNear);
|
||||
float depthExpected = depthCenter + dot(slope, offset);
|
||||
float useSample = float(abs(depthSample - depthExpected) < zLimit);
|
||||
#else
|
||||
float useSample = 1.0;
|
||||
#endif
|
||||
#if defined(USE_GAUSS)
|
||||
result += texture2D(imageMap, tex + offset) * (gauss[j] * useSample);
|
||||
total += gauss[j] * useSample;
|
||||
#else
|
||||
result += texture2D(imageMap, tex + offset) * useSample;
|
||||
total += useSample;
|
||||
#endif
|
||||
nudge = -nudge;
|
||||
}
|
||||
|
||||
|
||||
direction = -direction;
|
||||
}
|
||||
|
||||
nudge = -nudge;
|
||||
}
|
||||
|
||||
return result / total;
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_FragColor = depthGaussian1D(u_ScreenImageMap, u_ScreenDepthMap, var_ScreenTex, u_ViewInfo.x, u_ViewInfo.y);
|
||||
{
|
||||
gl_FragColor = depthGaussian1D(u_ScreenImageMap, u_ScreenDepthMap, var_ScreenTex, u_ViewInfo.x, u_ViewInfo.y, u_ViewInfo.zw);
|
||||
}
|
||||
|
|
|
@ -1,12 +1,16 @@
|
|||
attribute vec4 attr_Position;
|
||||
attribute vec4 attr_TexCoord0;
|
||||
|
||||
uniform vec4 u_ViewInfo; // zfar / znear, zfar, 1/width, 1/height
|
||||
|
||||
varying vec2 var_ScreenTex;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = attr_Position;
|
||||
var_ScreenTex = attr_TexCoord0.xy;
|
||||
vec2 wh = vec2(1.0) / u_ViewInfo.zw - vec2(1.0);
|
||||
var_ScreenTex = (floor(attr_TexCoord0.xy * wh) + vec2(0.5)) * u_ViewInfo.zw;
|
||||
|
||||
//vec2 screenCoords = gl_Position.xy / gl_Position.w;
|
||||
//var_ScreenTex = screenCoords * 0.5 + 0.5;
|
||||
}
|
||||
|
|
|
@ -29,11 +29,6 @@ uniform samplerCube u_CubeMap;
|
|||
uniform vec4 u_EnableTextures;
|
||||
#endif
|
||||
|
||||
#if defined(USE_LIGHT_VECTOR) && !defined(USE_FAST_LIGHT)
|
||||
uniform vec3 u_DirectedLight;
|
||||
uniform vec3 u_AmbientLight;
|
||||
#endif
|
||||
|
||||
#if defined(USE_PRIMARY_LIGHT) || defined(USE_SHADOWMAP)
|
||||
uniform vec3 u_PrimaryLightColor;
|
||||
uniform vec3 u_PrimaryLightAmbient;
|
||||
|
@ -53,6 +48,9 @@ uniform vec4 u_CubeMapInfo;
|
|||
varying vec4 var_TexCoords;
|
||||
|
||||
varying vec4 var_Color;
|
||||
#if (defined(USE_LIGHT) && !defined(USE_FAST_LIGHT))
|
||||
varying vec4 var_ColorAmbient;
|
||||
#endif
|
||||
|
||||
#if (defined(USE_LIGHT) && !defined(USE_FAST_LIGHT))
|
||||
#if defined(USE_VERT_TANGENT_SPACE)
|
||||
|
@ -150,156 +148,35 @@ float RayIntersectDisplaceMap(vec2 dp, vec2 ds, sampler2D normalMap)
|
|||
}
|
||||
#endif
|
||||
|
||||
vec3 CalcDiffuse(vec3 diffuseAlbedo, vec3 N, vec3 L, vec3 E, float NE, float NL, float shininess)
|
||||
vec3 CalcDiffuse(vec3 diffuseAlbedo, float NH, float EH, float roughness)
|
||||
{
|
||||
#if defined(USE_OREN_NAYAR) || defined(USE_TRIACE_OREN_NAYAR)
|
||||
float gamma = dot(E, L) - NE * NL;
|
||||
float B = 2.22222 + 0.1 * shininess;
|
||||
|
||||
#if defined(USE_OREN_NAYAR)
|
||||
float A = 1.0 - 1.0 / (2.0 + 0.33 * shininess);
|
||||
gamma = clamp(gamma, 0.0, 1.0);
|
||||
#endif
|
||||
|
||||
#if defined(USE_TRIACE_OREN_NAYAR)
|
||||
float A = 1.0 - 1.0 / (2.0 + 0.65 * shininess);
|
||||
|
||||
if (gamma >= 0.0)
|
||||
#endif
|
||||
{
|
||||
B = max(B * max(NL, NE), EPSILON);
|
||||
}
|
||||
|
||||
return diffuseAlbedo * (A + gamma / B);
|
||||
#else
|
||||
#if defined(USE_BURLEY)
|
||||
// modified from https://disney-animation.s3.amazonaws.com/library/s2012_pbs_disney_brdf_notes_v2.pdf
|
||||
float fd90 = -0.5 + EH * EH * roughness;
|
||||
float burley = 1.0 + fd90 * 0.04 / NH;
|
||||
burley *= burley;
|
||||
return diffuseAlbedo * burley;
|
||||
#else
|
||||
return diffuseAlbedo;
|
||||
#endif
|
||||
}
|
||||
|
||||
vec3 EnvironmentBRDF(float gloss, float NE, vec3 specular)
|
||||
{
|
||||
#if 1
|
||||
// from http://blog.selfshadow.com/publications/s2013-shading-course/lazarov/s2013_pbs_black_ops_2_notes.pdf
|
||||
vec4 t = vec4( 1.0/0.96, 0.475, (0.0275 - 0.25 * 0.04)/0.96,0.25 ) * gloss;
|
||||
t += vec4( 0.0, 0.0, (0.015 - 0.75 * 0.04)/0.96,0.75 );
|
||||
float a0 = t.x * min( t.y, exp2( -9.28 * NE ) ) + t.z;
|
||||
float a1 = t.w;
|
||||
return clamp( a0 + specular * ( a1 - a0 ), 0.0, 1.0 );
|
||||
#elif 0
|
||||
// from http://seblagarde.wordpress.com/2011/08/17/hello-world/
|
||||
return specular + CalcFresnel(NE) * clamp(vec3(gloss) - specular, 0.0, 1.0);
|
||||
#else
|
||||
// from http://advances.realtimerendering.com/s2011/Lazarov-Physically-Based-Lighting-in-Black-Ops%20%28Siggraph%202011%20Advances%20in%20Real-Time%20Rendering%20Course%29.pptx
|
||||
return mix(specular.rgb, vec3(1.0), CalcFresnel(NE) / (4.0 - 3.0 * gloss));
|
||||
#endif
|
||||
}
|
||||
|
||||
float CalcBlinn(float NH, float shininess)
|
||||
{
|
||||
#if defined(USE_BLINN) || defined(USE_BLINN_FRESNEL)
|
||||
// Normalized Blinn-Phong
|
||||
float norm = shininess * 0.125 + 1.0;
|
||||
#elif defined(USE_MCAULEY)
|
||||
// Cook-Torrance as done by Stephen McAuley
|
||||
// http://blog.selfshadow.com/publications/s2012-shading-course/mcauley/s2012_pbs_farcry3_notes_v2.pdf
|
||||
float norm = shininess * 0.25 + 0.125;
|
||||
#elif defined(USE_GOTANDA)
|
||||
// Neumann-Neumann as done by Yoshiharu Gotanda
|
||||
// http://research.tri-ace.com/Data/s2012_beyond_CourseNotes.pdf
|
||||
float norm = shininess * 0.124858 + 0.269182;
|
||||
#elif defined(USE_LAZAROV)
|
||||
// Cook-Torrance as done by Dimitar Lazarov
|
||||
// http://blog.selfshadow.com/publications/s2013-shading-course/lazarov/s2013_pbs_black_ops_2_notes.pdf
|
||||
float norm = shininess * 0.125 + 0.25;
|
||||
#else
|
||||
float norm = 1.0;
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
// from http://seblagarde.wordpress.com/2012/06/03/spherical-gaussien-approximation-for-blinn-phong-phong-and-fresnel/
|
||||
float a = shininess + 0.775;
|
||||
return norm * exp(a * NH - a);
|
||||
#else
|
||||
return norm * pow(NH, shininess);
|
||||
#endif
|
||||
}
|
||||
|
||||
float CalcGGX(float NH, float gloss)
|
||||
vec3 EnvironmentBRDF(float roughness, float NE, vec3 specular)
|
||||
{
|
||||
// from http://blog.selfshadow.com/publications/s2013-shading-course/karis/s2013_pbs_epic_notes_v2.pdf
|
||||
float a_sq = exp2(gloss * -13.0 + 1.0);
|
||||
float d = ((NH * NH) * (a_sq - 1.0) + 1.0);
|
||||
return a_sq / (d * d);
|
||||
// from http://community.arm.com/servlet/JiveServlet/download/96891546-19496/siggraph2015-mmg-renaldas-slides.pdf
|
||||
float v = 1.0 - max(roughness, NE);
|
||||
v *= v * v;
|
||||
return vec3(v) + specular;
|
||||
}
|
||||
|
||||
float CalcFresnel(float EH)
|
||||
vec3 CalcSpecular(vec3 specular, float NH, float EH, float roughness)
|
||||
{
|
||||
#if 1
|
||||
// From http://blog.selfshadow.com/publications/s2013-shading-course/lazarov/s2013_pbs_black_ops_2_notes.pdf
|
||||
// not accurate, but fast
|
||||
return exp2(-10.0 * EH);
|
||||
#elif 0
|
||||
// From http://seblagarde.wordpress.com/2012/06/03/spherical-gaussien-approximation-for-blinn-phong-phong-and-fresnel/
|
||||
return exp2((-5.55473 * EH - 6.98316) * EH);
|
||||
#elif 0
|
||||
float blend = 1.0 - EH;
|
||||
float blend2 = blend * blend;
|
||||
blend *= blend2 * blend2;
|
||||
|
||||
return blend;
|
||||
#else
|
||||
return pow(1.0 - EH, 5.0);
|
||||
#endif
|
||||
}
|
||||
|
||||
float CalcVisibility(float NH, float NL, float NE, float EH, float gloss)
|
||||
{
|
||||
#if defined(USE_GOTANDA)
|
||||
// Neumann-Neumann as done by Yoshiharu Gotanda
|
||||
// http://research.tri-ace.com/Data/s2012_beyond_CourseNotes.pdf
|
||||
return 1.0 / max(max(NL, NE), EPSILON);
|
||||
#elif defined(USE_LAZAROV)
|
||||
// Cook-Torrance as done by Dimitar Lazarov
|
||||
// http://blog.selfshadow.com/publications/s2013-shading-course/lazarov/s2013_pbs_black_ops_2_notes.pdf
|
||||
float k = min(1.0, gloss + 0.545);
|
||||
return 1.0 / (k * (EH * EH - 1.0) + 1.0);
|
||||
#elif defined(USE_GGX)
|
||||
float roughness = exp2(gloss * -6.5);
|
||||
|
||||
// Modified from http://blog.selfshadow.com/publications/s2013-shading-course/karis/s2013_pbs_epic_notes_v2.pdf
|
||||
// NL, NE in numerator factored out from cook-torrance
|
||||
float k = roughness + 1.0;
|
||||
k *= k * 0.125;
|
||||
|
||||
float k2 = 1.0 - k;
|
||||
|
||||
float invGeo1 = NL * k2 + k;
|
||||
float invGeo2 = NE * k2 + k;
|
||||
|
||||
return 1.0 / (invGeo1 * invGeo2);
|
||||
#else
|
||||
return 1.0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
vec3 CalcSpecular(vec3 specular, float NH, float NL, float NE, float EH, float gloss, float shininess)
|
||||
{
|
||||
#if defined(USE_GGX)
|
||||
float distrib = CalcGGX(NH, gloss);
|
||||
#else
|
||||
float distrib = CalcBlinn(NH, shininess);
|
||||
#endif
|
||||
|
||||
#if defined(USE_BLINN)
|
||||
vec3 fSpecular = specular;
|
||||
#else
|
||||
vec3 fSpecular = mix(specular, vec3(1.0), CalcFresnel(EH));
|
||||
#endif
|
||||
|
||||
float vis = CalcVisibility(NH, NL, NE, EH, gloss);
|
||||
|
||||
return fSpecular * (distrib * vis);
|
||||
// from http://community.arm.com/servlet/JiveServlet/download/96891546-19496/siggraph2015-mmg-renaldas-slides.pdf
|
||||
float rr = roughness*roughness;
|
||||
float rrrr = rr*rr;
|
||||
float d = (NH * NH) * (rrrr - 1.0) + 1.0;
|
||||
float v = (EH * EH) * (roughness + 0.5);
|
||||
return specular * (rrrr / (4.0 * d * d * v));
|
||||
}
|
||||
|
||||
|
||||
|
@ -341,7 +218,7 @@ mat3 cotangent_frame( vec3 N, vec3 p, vec2 uv )
|
|||
|
||||
void main()
|
||||
{
|
||||
vec3 viewDir, lightColor, ambientColor;
|
||||
vec3 viewDir, lightColor, ambientColor, reflectance;
|
||||
vec3 L, N, E, H;
|
||||
float NL, NH, NE, EH, attenuation;
|
||||
|
||||
|
@ -353,21 +230,20 @@ void main()
|
|||
mat3 tangentToWorld = cotangent_frame(var_Normal, -var_ViewDir, var_TexCoords.xy);
|
||||
viewDir = var_ViewDir;
|
||||
#endif
|
||||
|
||||
E = normalize(viewDir);
|
||||
|
||||
L = var_LightDir.xyz;
|
||||
#if defined(USE_DELUXEMAP)
|
||||
L += (texture2D(u_DeluxeMap, var_TexCoords.zw).xyz - vec3(0.5)) * u_EnableTextures.y;
|
||||
#endif
|
||||
float sqrLightDist = dot(L, L);
|
||||
#endif
|
||||
|
||||
lightColor = var_Color.rgb;
|
||||
|
||||
#if defined(USE_LIGHTMAP)
|
||||
vec4 lightmapColor = texture2D(u_LightMap, var_TexCoords.zw);
|
||||
#if defined(RGBM_LIGHTMAP)
|
||||
lightmapColor.rgb *= lightmapColor.a;
|
||||
#endif
|
||||
#if defined(USE_PBR) && !defined(USE_FAST_LIGHT)
|
||||
lightmapColor.rgb *= lightmapColor.rgb;
|
||||
#endif
|
||||
lightColor *= lightmapColor.rgb;
|
||||
#endif
|
||||
|
||||
vec2 texCoords = var_TexCoords.xy;
|
||||
|
@ -383,17 +259,16 @@ void main()
|
|||
vec4 diffuse = texture2D(u_DiffuseMap, texCoords);
|
||||
|
||||
#if defined(USE_LIGHT) && !defined(USE_FAST_LIGHT)
|
||||
#if defined(USE_LIGHTMAP)
|
||||
lightColor = lightmapColor.rgb * var_Color.rgb;
|
||||
ambientColor = vec3(0.0);
|
||||
attenuation = 1.0;
|
||||
#elif defined(USE_LIGHT_VECTOR)
|
||||
lightColor = u_DirectedLight * var_Color.rgb;
|
||||
ambientColor = u_AmbientLight * var_Color.rgb;
|
||||
L = var_LightDir.xyz;
|
||||
#if defined(USE_DELUXEMAP)
|
||||
L += (texture2D(u_DeluxeMap, var_TexCoords.zw).xyz - vec3(0.5)) * u_EnableTextures.y;
|
||||
#endif
|
||||
float sqrLightDist = dot(L, L);
|
||||
L /= sqrt(sqrLightDist);
|
||||
|
||||
#if defined(USE_LIGHT_VECTOR)
|
||||
attenuation = CalcLightAttenuation(float(var_LightDir.w > 0.0), var_LightDir.w / sqrLightDist);
|
||||
#elif defined(USE_LIGHT_VERTEX)
|
||||
lightColor = var_Color.rgb;
|
||||
ambientColor = vec3(0.0);
|
||||
#else
|
||||
attenuation = 1.0;
|
||||
#endif
|
||||
|
||||
|
@ -411,33 +286,20 @@ void main()
|
|||
#endif
|
||||
|
||||
N = normalize(N);
|
||||
L /= sqrt(sqrLightDist);
|
||||
|
||||
#if defined(USE_SHADOWMAP)
|
||||
vec2 shadowTex = gl_FragCoord.xy * r_FBufScale;
|
||||
float shadowValue = texture2D(u_ShadowMap, shadowTex).r;
|
||||
|
||||
// surfaces not facing the light are always shadowed
|
||||
shadowValue *= float(dot(var_Normal.xyz, var_PrimaryLightDir.xyz) > 0.0);
|
||||
shadowValue *= clamp(dot(N, var_PrimaryLightDir.xyz), 0.0, 1.0);
|
||||
|
||||
#if defined(SHADOWMAP_MODULATE)
|
||||
//vec3 shadowColor = min(u_PrimaryLightAmbient, lightColor);
|
||||
vec3 shadowColor = u_PrimaryLightAmbient * lightColor;
|
||||
|
||||
#if 0
|
||||
// Only shadow when the world light is parallel to the primary light
|
||||
shadowValue = 1.0 + (shadowValue - 1.0) * clamp(dot(L, var_PrimaryLightDir.xyz), 0.0, 1.0);
|
||||
#endif
|
||||
lightColor = mix(shadowColor, lightColor, shadowValue);
|
||||
lightColor *= shadowValue * (1.0 - u_PrimaryLightAmbient.r) + u_PrimaryLightAmbient.r;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(r_lightGamma)
|
||||
lightColor = pow(lightColor, vec3(r_lightGamma));
|
||||
ambientColor = pow(ambientColor, vec3(r_lightGamma));
|
||||
#endif
|
||||
|
||||
#if defined(USE_LIGHTMAP) || defined(USE_LIGHT_VERTEX)
|
||||
#if !defined(USE_LIGHT_VECTOR)
|
||||
ambientColor = lightColor;
|
||||
float surfNL = clamp(dot(var_Normal.xyz, L), 0.0, 1.0);
|
||||
|
||||
|
@ -447,10 +309,10 @@ void main()
|
|||
|
||||
// Recover any unused light as ambient, in case attenuation is over 4x or
|
||||
// light is below the surface
|
||||
ambientColor = clamp(ambientColor - lightColor * surfNL, 0.0, 1.0);
|
||||
ambientColor = max(ambientColor - lightColor * surfNL, vec3(0.0));
|
||||
#else
|
||||
ambientColor = var_ColorAmbient.rgb;
|
||||
#endif
|
||||
|
||||
vec3 reflectance;
|
||||
|
||||
NL = clamp(dot(N, L), 0.0, 1.0);
|
||||
NE = clamp(dot(N, E), 0.0, 1.0);
|
||||
|
@ -460,70 +322,47 @@ void main()
|
|||
#else
|
||||
vec4 specular = vec4(1.0);
|
||||
#endif
|
||||
|
||||
specular *= u_SpecularScale;
|
||||
|
||||
#if defined(r_materialGamma)
|
||||
diffuse.rgb = pow(diffuse.rgb, vec3(r_materialGamma));
|
||||
specular.rgb = pow(specular.rgb, vec3(r_materialGamma));
|
||||
#if defined(USE_PBR)
|
||||
diffuse.rgb *= diffuse.rgb;
|
||||
#endif
|
||||
|
||||
float gloss = specular.a;
|
||||
float shininess = exp2(gloss * 13.0);
|
||||
|
||||
#if defined(SPECULAR_IS_METALLIC)
|
||||
// diffuse is actually base color, and red of specular is metallicness
|
||||
float metallic = specular.r;
|
||||
|
||||
specular.rgb = (0.96 * metallic) * diffuse.rgb + vec3(0.04);
|
||||
diffuse.rgb *= 1.0 - metallic;
|
||||
#if defined(USE_PBR)
|
||||
// diffuse rgb is base color
|
||||
// specular red is gloss
|
||||
// specular green is metallicness
|
||||
float gloss = specular.r;
|
||||
float metal = specular.g;
|
||||
specular.rgb = metal * diffuse.rgb + vec3(0.04 - 0.04 * metal);
|
||||
diffuse.rgb *= 1.0 - metal;
|
||||
#else
|
||||
// diffuse rgb is diffuse
|
||||
// specular rgb is specular reflectance at normal incidence
|
||||
// specular alpha is gloss
|
||||
float gloss = specular.a;
|
||||
|
||||
// adjust diffuse by specular reflectance, to maintain energy conservation
|
||||
diffuse.rgb *= vec3(1.0) - specular.rgb;
|
||||
#endif
|
||||
|
||||
reflectance = CalcDiffuse(diffuse.rgb, N, L, E, NE, NL, shininess);
|
||||
|
||||
#if defined(r_deluxeSpecular) || defined(USE_LIGHT_VECTOR)
|
||||
float adjGloss = gloss;
|
||||
float adjShininess = shininess;
|
||||
|
||||
#if !defined(USE_LIGHT_VECTOR)
|
||||
adjGloss *= r_deluxeSpecular;
|
||||
adjShininess = exp2(adjGloss * 13.0);
|
||||
#endif
|
||||
|
||||
H = normalize(L + E);
|
||||
|
||||
EH = clamp(dot(E, H), 0.0, 1.0);
|
||||
NH = clamp(dot(N, H), 0.0, 1.0);
|
||||
|
||||
#if !defined(USE_LIGHT_VECTOR)
|
||||
reflectance += CalcSpecular(specular.rgb, NH, NL, NE, EH, adjGloss, adjShininess) * r_deluxeSpecular;
|
||||
#else
|
||||
reflectance += CalcSpecular(specular.rgb, NH, NL, NE, EH, adjGloss, adjShininess);
|
||||
#endif
|
||||
#if defined(GLOSS_IS_GLOSS)
|
||||
float roughness = exp2(-3.0 * gloss);
|
||||
#elif defined(GLOSS_IS_SMOOTHNESS)
|
||||
float roughness = 1.0 - gloss;
|
||||
#elif defined(GLOSS_IS_ROUGHNESS)
|
||||
float roughness = gloss;
|
||||
#elif defined(GLOSS_IS_SHININESS)
|
||||
float roughness = pow(2.0 / (8190.0 * gloss + 2.0), 0.25);
|
||||
#endif
|
||||
|
||||
reflectance = CalcDiffuse(diffuse.rgb, NH, EH, roughness);
|
||||
|
||||
gl_FragColor.rgb = lightColor * reflectance * (attenuation * NL);
|
||||
|
||||
#if 0
|
||||
vec3 aSpecular = EnvironmentBRDF(gloss, NE, specular.rgb);
|
||||
|
||||
// do ambient as two hemisphere lights, one straight up one straight down
|
||||
float hemiDiffuseUp = N.z * 0.5 + 0.5;
|
||||
float hemiDiffuseDown = 1.0 - hemiDiffuseUp;
|
||||
float hemiSpecularUp = mix(hemiDiffuseUp, float(N.z >= 0.0), gloss);
|
||||
float hemiSpecularDown = 1.0 - hemiSpecularUp;
|
||||
|
||||
gl_FragColor.rgb += ambientColor * 0.75 * (diffuse.rgb * hemiDiffuseUp + aSpecular * hemiSpecularUp);
|
||||
gl_FragColor.rgb += ambientColor * 0.25 * (diffuse.rgb * hemiDiffuseDown + aSpecular * hemiSpecularDown);
|
||||
#else
|
||||
gl_FragColor.rgb += ambientColor * (diffuse.rgb + specular.rgb);
|
||||
#endif
|
||||
gl_FragColor.rgb += ambientColor * diffuse.rgb;
|
||||
|
||||
#if defined(USE_CUBEMAP)
|
||||
reflectance = EnvironmentBRDF(gloss, NE, specular.rgb);
|
||||
reflectance = EnvironmentBRDF(roughness, NE, specular.rgb);
|
||||
|
||||
vec3 R = reflect(E, N);
|
||||
|
||||
|
@ -531,15 +370,15 @@ void main()
|
|||
// from http://seblagarde.wordpress.com/2012/09/29/image-based-lighting-approaches-and-parallax-corrected-cubemap/
|
||||
vec3 parallax = u_CubeMapInfo.xyz + u_CubeMapInfo.w * viewDir;
|
||||
|
||||
vec3 cubeLightColor = textureCubeLod(u_CubeMap, R + parallax, 7.0 - gloss * 7.0).rgb * u_EnableTextures.w;
|
||||
vec3 cubeLightColor = textureCubeLod(u_CubeMap, R + parallax, ROUGHNESS_MIPS * roughness).rgb * u_EnableTextures.w;
|
||||
|
||||
// normalize cubemap based on lowest mip (~diffuse)
|
||||
// normalize cubemap based on last roughness mip (~diffuse)
|
||||
// multiplying cubemap values by lighting below depends on either this or the cubemap being normalized at generation
|
||||
//vec3 cubeLightDiffuse = max(textureCubeLod(u_CubeMap, N, 6.0).rgb, 0.5 / 255.0);
|
||||
//vec3 cubeLightDiffuse = max(textureCubeLod(u_CubeMap, N, ROUGHNESS_MIPS).rgb, 0.5 / 255.0);
|
||||
//cubeLightColor /= dot(cubeLightDiffuse, vec3(0.2125, 0.7154, 0.0721));
|
||||
|
||||
#if defined(r_framebufferGamma)
|
||||
cubeLightColor = pow(cubeLightColor, vec3(r_framebufferGamma));
|
||||
#if defined(USE_PBR)
|
||||
cubeLightColor *= cubeLightColor;
|
||||
#endif
|
||||
|
||||
// multiply cubemap values by lighting
|
||||
|
@ -549,7 +388,7 @@ void main()
|
|||
gl_FragColor.rgb += cubeLightColor * reflectance;
|
||||
#endif
|
||||
|
||||
#if defined(USE_PRIMARY_LIGHT)
|
||||
#if defined(USE_PRIMARY_LIGHT) || defined(SHADOWMAP_MODULATE)
|
||||
vec3 L2, H2;
|
||||
float NL2, EH2, NH2;
|
||||
|
||||
|
@ -560,20 +399,19 @@ void main()
|
|||
//L2 /= sqrt(sqrLightDist);
|
||||
|
||||
NL2 = clamp(dot(N, L2), 0.0, 1.0);
|
||||
|
||||
H2 = normalize(L2 + E);
|
||||
EH2 = clamp(dot(E, H2), 0.0, 1.0);
|
||||
NH2 = clamp(dot(N, H2), 0.0, 1.0);
|
||||
|
||||
reflectance = CalcDiffuse(diffuse.rgb, N, L2, E, NE, NL2, shininess);
|
||||
reflectance += CalcSpecular(specular.rgb, NH2, NL2, NE, EH2, gloss, shininess);
|
||||
reflectance = CalcSpecular(specular.rgb, NH2, EH2, roughness);
|
||||
|
||||
lightColor = u_PrimaryLightColor * var_Color.rgb;
|
||||
|
||||
#if defined(r_lightGamma)
|
||||
lightColor = pow(lightColor, vec3(r_lightGamma));
|
||||
// bit of a hack, with modulated shadowmaps, ignore diffuse
|
||||
#if !defined(SHADOWMAP_MODULATE)
|
||||
reflectance += CalcDiffuse(diffuse.rgb, NH2, EH2, roughness);
|
||||
#endif
|
||||
|
||||
lightColor = u_PrimaryLightColor;
|
||||
|
||||
#if defined(USE_SHADOWMAP)
|
||||
lightColor *= shadowValue;
|
||||
#endif
|
||||
|
@ -583,28 +421,16 @@ void main()
|
|||
|
||||
gl_FragColor.rgb += lightColor * reflectance * NL2;
|
||||
#endif
|
||||
|
||||
#if defined(USE_PBR)
|
||||
gl_FragColor.rgb = sqrt(gl_FragColor.rgb);
|
||||
#endif
|
||||
|
||||
#else
|
||||
lightColor = var_Color.rgb;
|
||||
|
||||
#if defined(USE_LIGHTMAP)
|
||||
lightColor *= lightmapColor.rgb;
|
||||
#endif
|
||||
|
||||
#if defined(r_lightGamma)
|
||||
lightColor = pow(lightColor, vec3(r_lightGamma));
|
||||
#endif
|
||||
|
||||
#if defined(r_materialGamma)
|
||||
diffuse.rgb = pow(diffuse.rgb, vec3(r_materialGamma));
|
||||
#endif
|
||||
|
||||
gl_FragColor.rgb = diffuse.rgb * lightColor;
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(r_framebufferGamma)
|
||||
gl_FragColor.rgb = pow(gl_FragColor.rgb, vec3(1.0 / r_framebufferGamma));
|
||||
#endif
|
||||
|
||||
gl_FragColor.a = diffuse.a * var_Color.a;
|
||||
}
|
||||
|
|
|
@ -57,10 +57,8 @@ uniform float u_VertexLerp;
|
|||
#if defined(USE_LIGHT_VECTOR)
|
||||
uniform vec4 u_LightOrigin;
|
||||
uniform float u_LightRadius;
|
||||
#if defined(USE_FAST_LIGHT)
|
||||
uniform vec3 u_DirectedLight;
|
||||
uniform vec3 u_AmbientLight;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(USE_PRIMARY_LIGHT) || defined(USE_SHADOWMAP)
|
||||
|
@ -71,6 +69,9 @@ uniform float u_PrimaryLightRadius;
|
|||
varying vec4 var_TexCoords;
|
||||
|
||||
varying vec4 var_Color;
|
||||
#if defined(USE_LIGHT_VECTOR) && !defined(USE_FAST_LIGHT)
|
||||
varying vec4 var_ColorAmbient;
|
||||
#endif
|
||||
|
||||
#if defined(USE_LIGHT) && !defined(USE_FAST_LIGHT)
|
||||
#if defined(USE_VERT_TANGENT_SPACE)
|
||||
|
@ -208,12 +209,24 @@ void main()
|
|||
|
||||
var_Color = u_VertColor * attr_Color + u_BaseColor;
|
||||
|
||||
#if defined(USE_LIGHT_VECTOR) && defined(USE_FAST_LIGHT)
|
||||
#if defined(USE_LIGHT_VECTOR)
|
||||
#if defined(USE_FAST_LIGHT)
|
||||
float sqrLightDist = dot(L, L);
|
||||
float attenuation = CalcLightAttenuation(u_LightOrigin.w, u_LightRadius * u_LightRadius / sqrLightDist);
|
||||
float NL = clamp(dot(normalize(normal), L) / sqrt(sqrLightDist), 0.0, 1.0);
|
||||
float attenuation = CalcLightAttenuation(u_LightOrigin.w, u_LightRadius * u_LightRadius / sqrLightDist);
|
||||
|
||||
var_Color.rgb *= u_DirectedLight * (attenuation * NL) + u_AmbientLight;
|
||||
#else
|
||||
var_ColorAmbient.rgb = u_AmbientLight * var_Color.rgb;
|
||||
var_Color.rgb *= u_DirectedLight;
|
||||
#if defined(USE_PBR)
|
||||
var_ColorAmbient.rgb *= var_ColorAmbient.rgb;
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(USE_LIGHT) && !defined(USE_FAST_LIGHT) && defined(USE_PBR)
|
||||
var_Color.rgb *= var_Color.rgb;
|
||||
#endif
|
||||
|
||||
#if defined(USE_PRIMARY_LIGHT) || defined(USE_SHADOWMAP)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
uniform sampler2D u_ScreenDepthMap;
|
||||
|
||||
uniform vec4 u_ViewInfo; // zfar / znear, zfar
|
||||
uniform vec4 u_ViewInfo; // zfar / znear, zfar, 1/width, 1/height
|
||||
|
||||
varying vec2 var_ScreenTex;
|
||||
|
||||
|
@ -11,6 +11,7 @@ vec2(0.5784913, -0.002528916), vec2(0.192888, 0.4064181),
|
|||
vec2(-0.6335801, -0.5247476), vec2(-0.5579782, 0.7491854),
|
||||
vec2(0.7320465, 0.6317794)
|
||||
);
|
||||
#define NUM_SAMPLES 3
|
||||
|
||||
// Input: It uses texture coords as the random number seed.
|
||||
// Output: Random number: [0,1), that is between 0.0 and 0.999999... inclusive.
|
||||
|
@ -39,48 +40,47 @@ mat2 randomRotation( const vec2 p )
|
|||
|
||||
float getLinearDepth(sampler2D depthMap, const vec2 tex, const float zFarDivZNear)
|
||||
{
|
||||
float sampleZDivW = texture2D(depthMap, tex).r;
|
||||
return 1.0 / mix(zFarDivZNear, 1.0, sampleZDivW);
|
||||
float sampleZDivW = texture2D(depthMap, tex).r;
|
||||
return 1.0 / mix(zFarDivZNear, 1.0, sampleZDivW);
|
||||
}
|
||||
|
||||
float ambientOcclusion(sampler2D depthMap, const vec2 tex, const float zFarDivZNear, const float zFar)
|
||||
float ambientOcclusion(sampler2D depthMap, const vec2 tex, const float zFarDivZNear, const float zFar, const vec2 scale)
|
||||
{
|
||||
float result = 0;
|
||||
|
||||
float sampleZ = zFar * getLinearDepth(depthMap, tex, zFarDivZNear);
|
||||
float sampleZ = getLinearDepth(depthMap, tex, zFarDivZNear);
|
||||
float scaleZ = zFarDivZNear * sampleZ;
|
||||
|
||||
vec2 expectedSlope = vec2(dFdx(sampleZ), dFdy(sampleZ)) / vec2(dFdx(tex.x), dFdy(tex.y));
|
||||
|
||||
if (length(expectedSlope) > 5000.0)
|
||||
vec2 slope = vec2(dFdx(sampleZ), dFdy(sampleZ)) / vec2(dFdx(tex.x), dFdy(tex.y));
|
||||
|
||||
if (length(slope) * zFar > 5000.0)
|
||||
return 1.0;
|
||||
|
||||
vec2 offsetScale = vec2(3.0 / sampleZ);
|
||||
|
||||
|
||||
vec2 offsetScale = vec2(scale * 1024.0 / scaleZ);
|
||||
|
||||
mat2 rmat = randomRotation(tex);
|
||||
|
||||
|
||||
float invZFar = 1.0 / zFar;
|
||||
float zLimit = 20.0 * invZFar;
|
||||
int i;
|
||||
for (i = 0; i < 3; i++)
|
||||
for (i = 0; i < NUM_SAMPLES; i++)
|
||||
{
|
||||
vec2 offset = rmat * poissonDisc[i] * offsetScale;
|
||||
float sampleZ2 = zFar * getLinearDepth(depthMap, tex + offset, zFarDivZNear);
|
||||
float sampleDiff = getLinearDepth(depthMap, tex + offset, zFarDivZNear) - sampleZ;
|
||||
|
||||
if (abs(sampleZ - sampleZ2) > 20.0)
|
||||
result += 1.0;
|
||||
else
|
||||
{
|
||||
float expectedZ = sampleZ + dot(expectedSlope, offset);
|
||||
result += step(expectedZ - 1.0, sampleZ2);
|
||||
}
|
||||
bool s1 = abs(sampleDiff) > zLimit;
|
||||
bool s2 = sampleDiff + invZFar > dot(slope, offset);
|
||||
result += float(s1 || s2);
|
||||
}
|
||||
|
||||
result *= 0.33333;
|
||||
|
||||
|
||||
result *= 1.0 / float(NUM_SAMPLES);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
float result = ambientOcclusion(u_ScreenDepthMap, var_ScreenTex, u_ViewInfo.x, u_ViewInfo.y);
|
||||
|
||||
float result = ambientOcclusion(u_ScreenDepthMap, var_ScreenTex, u_ViewInfo.x, u_ViewInfo.y, u_ViewInfo.wz);
|
||||
|
||||
gl_FragColor = vec4(vec3(result), 1.0);
|
||||
}
|
||||
|
|
|
@ -28,8 +28,8 @@ void main()
|
|||
{
|
||||
vec4 color = texture2D(u_TextureMap, var_TexCoords) * u_Color;
|
||||
|
||||
#if defined(r_framebufferGamma)
|
||||
color.rgb = pow(color.rgb, vec3(r_framebufferGamma));
|
||||
#if defined(USE_PBR)
|
||||
color.rgb *= color.rgb;
|
||||
#endif
|
||||
|
||||
vec3 minAvgMax = texture2D(u_LevelsMap, var_TexCoords).rgb;
|
||||
|
@ -46,9 +46,12 @@ void main()
|
|||
|
||||
color.rgb = clamp(color.rgb * var_InvWhite, 0.0, 1.0);
|
||||
|
||||
#if defined(r_tonemapGamma)
|
||||
color.rgb = pow(color.rgb, vec3(1.0 / r_tonemapGamma));
|
||||
#if defined(USE_PBR)
|
||||
color.rgb = sqrt(color.rgb);
|
||||
#endif
|
||||
|
||||
// add a bit of dither to reduce banding
|
||||
color.rgb += vec3(1.0/510.0 * mod(gl_FragCoord.x + gl_FragCoord.y, 2.0) - 1.0/1020.0);
|
||||
|
||||
gl_FragColor = color;
|
||||
}
|
||||
|
|
|
@ -20,6 +20,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
===========================================================================
|
||||
*/
|
||||
#include "tr_local.h"
|
||||
#include "tr_fbo.h"
|
||||
#include "tr_dsa.h"
|
||||
|
||||
backEndData_t *backEndData;
|
||||
backEndState_t backEnd;
|
||||
|
@ -35,81 +37,28 @@ static float s_flipMatrix[16] = {
|
|||
};
|
||||
|
||||
|
||||
/*
|
||||
** GL_Bind
|
||||
*/
|
||||
void GL_Bind( image_t *image ) {
|
||||
int texnum;
|
||||
|
||||
if ( !image ) {
|
||||
ri.Printf( PRINT_WARNING, "GL_Bind: NULL image\n" );
|
||||
texnum = tr.defaultImage->texnum;
|
||||
} else {
|
||||
texnum = image->texnum;
|
||||
}
|
||||
|
||||
if ( r_nobind->integer && tr.dlightImage ) { // performance evaluation option
|
||||
texnum = tr.dlightImage->texnum;
|
||||
}
|
||||
|
||||
if ( glState.currenttextures[glState.currenttmu] != texnum ) {
|
||||
if ( image ) {
|
||||
image->frameUsed = tr.frameCount;
|
||||
}
|
||||
glState.currenttextures[glState.currenttmu] = texnum;
|
||||
if (image && image->flags & IMGFLAG_CUBEMAP)
|
||||
qglBindTexture( GL_TEXTURE_CUBE_MAP, texnum );
|
||||
else
|
||||
qglBindTexture( GL_TEXTURE_2D, texnum );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** GL_SelectTexture
|
||||
*/
|
||||
void GL_SelectTexture( int unit )
|
||||
{
|
||||
if ( glState.currenttmu == unit )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(unit >= 0 && unit <= 31))
|
||||
ri.Error( ERR_DROP, "GL_SelectTexture: unit = %i", unit );
|
||||
|
||||
if (!qglActiveTextureARB)
|
||||
ri.Error( ERR_DROP, "GL_SelectTexture: multitexture disabled" );
|
||||
|
||||
qglActiveTextureARB( GL_TEXTURE0_ARB + unit );
|
||||
|
||||
glState.currenttmu = unit;
|
||||
}
|
||||
|
||||
/*
|
||||
** GL_BindToTMU
|
||||
*/
|
||||
void GL_BindToTMU( image_t *image, int tmu )
|
||||
{
|
||||
int texnum;
|
||||
int oldtmu = glState.currenttmu;
|
||||
GLuint texture = (tmu == TB_COLORMAP) ? tr.defaultImage->texnum : 0;
|
||||
GLenum target = GL_TEXTURE_2D;
|
||||
|
||||
if (!image)
|
||||
texnum = 0;
|
||||
else
|
||||
texnum = image->texnum;
|
||||
if (image)
|
||||
{
|
||||
if (image->flags & IMGFLAG_CUBEMAP)
|
||||
target = GL_TEXTURE_CUBE_MAP;
|
||||
|
||||
if ( glState.currenttextures[tmu] != texnum ) {
|
||||
GL_SelectTexture( tmu );
|
||||
if (image)
|
||||
image->frameUsed = tr.frameCount;
|
||||
glState.currenttextures[tmu] = texnum;
|
||||
|
||||
if (image && (image->flags & IMGFLAG_CUBEMAP))
|
||||
qglBindTexture( GL_TEXTURE_CUBE_MAP, texnum );
|
||||
else
|
||||
qglBindTexture( GL_TEXTURE_2D, texnum );
|
||||
GL_SelectTexture( oldtmu );
|
||||
image->frameUsed = tr.frameCount;
|
||||
texture = image->texnum;
|
||||
}
|
||||
else
|
||||
{
|
||||
ri.Printf(PRINT_WARNING, "GL_BindToTMU: NULL image\n");
|
||||
}
|
||||
|
||||
GL_BindMultiTexture(GL_TEXTURE0_ARB + tmu, target, texture);
|
||||
}
|
||||
|
||||
|
||||
|
@ -141,39 +90,6 @@ void GL_Cull( int cullType ) {
|
|||
glState.faceCulling = cullType;
|
||||
}
|
||||
|
||||
/*
|
||||
** GL_TexEnv
|
||||
*/
|
||||
void GL_TexEnv( int env )
|
||||
{
|
||||
if ( env == glState.texEnv[glState.currenttmu] )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
glState.texEnv[glState.currenttmu] = env;
|
||||
|
||||
|
||||
switch ( env )
|
||||
{
|
||||
case GL_MODULATE:
|
||||
qglTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
|
||||
break;
|
||||
case GL_REPLACE:
|
||||
qglTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE );
|
||||
break;
|
||||
case GL_DECAL:
|
||||
qglTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL );
|
||||
break;
|
||||
case GL_ADD:
|
||||
qglTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_ADD );
|
||||
break;
|
||||
default:
|
||||
ri.Error( ERR_DROP, "GL_TexEnv: invalid env '%d' passed", env );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** GL_State
|
||||
**
|
||||
|
@ -462,30 +378,20 @@ void RB_BeginDrawingView (void) {
|
|||
|
||||
if (glRefConfig.framebufferObject)
|
||||
{
|
||||
FBO_t *fbo = backEnd.viewParms.targetFbo;
|
||||
|
||||
// FIXME: HUGE HACK: render to the screen fbo if we've already postprocessed the frame and aren't drawing more world
|
||||
// drawing more world check is in case of double renders, such as skyportals
|
||||
if (backEnd.viewParms.targetFbo == NULL)
|
||||
{
|
||||
if (!tr.renderFbo || (backEnd.framePostProcessed && (backEnd.refdef.rdflags & RDF_NOWORLDMODEL)))
|
||||
{
|
||||
FBO_Bind(NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
FBO_Bind(tr.renderFbo);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FBO_Bind(backEnd.viewParms.targetFbo);
|
||||
if (fbo == NULL && !(backEnd.framePostProcessed && (backEnd.refdef.rdflags & RDF_NOWORLDMODEL)))
|
||||
fbo = tr.renderFbo;
|
||||
|
||||
// FIXME: hack for cubemap testing
|
||||
if (tr.renderCubeFbo && backEnd.viewParms.targetFbo == tr.renderCubeFbo)
|
||||
{
|
||||
//qglFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_CUBE_MAP_POSITIVE_X + backEnd.viewParms.targetFboLayer, backEnd.viewParms.targetFbo->colorImage[0]->texnum, 0);
|
||||
qglFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_CUBE_MAP_POSITIVE_X + backEnd.viewParms.targetFboLayer, tr.cubemaps[backEnd.viewParms.targetFboCubemapIndex]->texnum, 0);
|
||||
}
|
||||
if (tr.renderCubeFbo && fbo == tr.renderCubeFbo)
|
||||
{
|
||||
cubemap_t *cubemap = &tr.cubemaps[backEnd.viewParms.targetFboCubemapIndex];
|
||||
FBO_AttachImage(fbo, cubemap->image, GL_COLOR_ATTACHMENT0_EXT, backEnd.viewParms.targetFboLayer);
|
||||
}
|
||||
|
||||
FBO_Bind(fbo);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -555,8 +461,6 @@ void RB_BeginDrawingView (void) {
|
|||
}
|
||||
|
||||
|
||||
#define MAC_EVENT_PUMP_MSEC 5
|
||||
|
||||
/*
|
||||
==================
|
||||
RB_RenderDrawSurfList
|
||||
|
@ -862,6 +766,7 @@ void RE_StretchRaw (int x, int y, int w, int h, int cols, int rows, const byte *
|
|||
}
|
||||
|
||||
RE_UploadCinematic (w, h, cols, rows, data, client, dirty);
|
||||
GL_BindToTMU(tr.scratchImage[client], TB_COLORMAP);
|
||||
|
||||
if ( r_speeds->integer ) {
|
||||
end = ri.Milliseconds();
|
||||
|
@ -871,14 +776,7 @@ void RE_StretchRaw (int x, int y, int w, int h, int cols, int rows, const byte *
|
|||
// FIXME: HUGE hack
|
||||
if (glRefConfig.framebufferObject)
|
||||
{
|
||||
if (!tr.renderFbo || backEnd.framePostProcessed)
|
||||
{
|
||||
FBO_Bind(NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
FBO_Bind(tr.renderFbo);
|
||||
}
|
||||
FBO_Bind(backEnd.framePostProcessed ? NULL : tr.renderFbo);
|
||||
}
|
||||
|
||||
RB_SetGL2D();
|
||||
|
@ -902,23 +800,30 @@ void RE_StretchRaw (int x, int y, int w, int h, int cols, int rows, const byte *
|
|||
}
|
||||
|
||||
void RE_UploadCinematic (int w, int h, int cols, int rows, const byte *data, int client, qboolean dirty) {
|
||||
GLuint texture;
|
||||
|
||||
GL_Bind( tr.scratchImage[client] );
|
||||
if (!tr.scratchImage[client])
|
||||
{
|
||||
ri.Printf(PRINT_WARNING, "RE_UploadCinematic: scratch images not initialized\n");
|
||||
return;
|
||||
}
|
||||
|
||||
texture = tr.scratchImage[client]->texnum;
|
||||
|
||||
// if the scratchImage isn't in the format we want, specify it as a new texture
|
||||
if ( cols != tr.scratchImage[client]->width || rows != tr.scratchImage[client]->height ) {
|
||||
tr.scratchImage[client]->width = tr.scratchImage[client]->uploadWidth = cols;
|
||||
tr.scratchImage[client]->height = tr.scratchImage[client]->uploadHeight = rows;
|
||||
qglTexImage2D( GL_TEXTURE_2D, 0, GL_RGB8, cols, rows, 0, GL_RGBA, GL_UNSIGNED_BYTE, data );
|
||||
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
|
||||
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
|
||||
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
|
||||
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
|
||||
qglTextureImage2D(texture, GL_TEXTURE_2D, 0, GL_RGB8, cols, rows, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
|
||||
qglTextureParameterf(texture, GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
qglTextureParameterf(texture, GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
|
||||
qglTextureParameterf(texture, GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
qglTextureParameterf(texture, GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
} else {
|
||||
if (dirty) {
|
||||
// otherwise, just subimage upload it so that drivers can tell we are going to be changing
|
||||
// it and don't try and do a texture compression
|
||||
qglTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, cols, rows, GL_RGBA, GL_UNSIGNED_BYTE, data );
|
||||
qglTextureSubImage2D(texture, GL_TEXTURE_2D, 0, 0, 0, cols, rows, GL_RGBA, GL_UNSIGNED_BYTE, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -957,16 +862,7 @@ const void *RB_StretchPic ( const void *data ) {
|
|||
|
||||
// FIXME: HUGE hack
|
||||
if (glRefConfig.framebufferObject)
|
||||
{
|
||||
if (!tr.renderFbo || backEnd.framePostProcessed)
|
||||
{
|
||||
FBO_Bind(NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
FBO_Bind(tr.renderFbo);
|
||||
}
|
||||
}
|
||||
FBO_Bind(backEnd.framePostProcessed ? NULL : tr.renderFbo);
|
||||
|
||||
RB_SetGL2D();
|
||||
|
||||
|
@ -1066,6 +962,9 @@ const void *RB_DrawSurfs( const void *data ) {
|
|||
if (glRefConfig.framebufferObject && !(backEnd.refdef.rdflags & RDF_NOWORLDMODEL) && (r_depthPrepass->integer || (backEnd.viewParms.flags & VPF_DEPTHSHADOW)))
|
||||
{
|
||||
FBO_t *oldFbo = glState.currentFBO;
|
||||
vec4_t viewInfo;
|
||||
|
||||
VectorSet4(viewInfo, backEnd.viewParms.zFar / r_znear->value, backEnd.viewParms.zFar, 0.0, 0.0);
|
||||
|
||||
backEnd.depthFill = qtrue;
|
||||
qglColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
|
||||
|
@ -1078,17 +977,20 @@ const void *RB_DrawSurfs( const void *data ) {
|
|||
// If we're using multisampling, resolve the depth first
|
||||
FBO_FastBlit(tr.renderFbo, NULL, tr.msaaResolveFbo, NULL, GL_DEPTH_BUFFER_BIT, GL_NEAREST);
|
||||
}
|
||||
else if (tr.renderFbo == NULL)
|
||||
else if (tr.renderFbo == NULL && tr.renderDepthImage)
|
||||
{
|
||||
// If we're rendering directly to the screen, copy the depth to a texture
|
||||
GL_BindToTMU(tr.renderDepthImage, 0);
|
||||
qglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT24, 0, 0, glConfig.vidWidth, glConfig.vidHeight, 0);
|
||||
qglCopyTextureImage2D(tr.renderDepthImage->texnum, GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT24, 0, 0, glConfig.vidWidth, glConfig.vidHeight, 0);
|
||||
}
|
||||
|
||||
if (r_ssao->integer)
|
||||
if (tr.hdrDepthFbo)
|
||||
{
|
||||
// need the depth in a texture we can do GL_LINEAR sampling on, so copy it to an HDR image
|
||||
FBO_BlitFromTexture(tr.renderDepthImage, NULL, NULL, tr.hdrDepthFbo, NULL, NULL, NULL, 0);
|
||||
vec4_t srcTexCoords;
|
||||
|
||||
VectorSet4(srcTexCoords, 0.0f, 0.0f, 1.0f, 1.0f);
|
||||
|
||||
FBO_BlitFromTexture(tr.renderDepthImage, srcTexCoords, NULL, tr.hdrDepthFbo, NULL, NULL, NULL, 0);
|
||||
}
|
||||
|
||||
if (r_sunlightMode->integer && backEnd.viewParms.flags & VPF_USESUNLIGHT)
|
||||
|
@ -1153,15 +1055,12 @@ const void *RB_DrawSurfs( const void *data ) {
|
|||
|
||||
GLSL_SetUniformVec3(&tr.shadowmaskShader, UNIFORM_VIEWORIGIN, backEnd.refdef.vieworg);
|
||||
{
|
||||
vec4_t viewInfo;
|
||||
vec3_t viewVector;
|
||||
|
||||
float zmax = backEnd.viewParms.zFar;
|
||||
float ymax = zmax * tan(backEnd.viewParms.fovY * M_PI / 360.0f);
|
||||
float xmax = zmax * tan(backEnd.viewParms.fovX * M_PI / 360.0f);
|
||||
|
||||
float zmin = r_znear->value;
|
||||
|
||||
VectorScale(backEnd.refdef.viewaxis[0], zmax, viewVector);
|
||||
GLSL_SetUniformVec3(&tr.shadowmaskShader, UNIFORM_VIEWFORWARD, viewVector);
|
||||
VectorScale(backEnd.refdef.viewaxis[1], xmax, viewVector);
|
||||
|
@ -1169,13 +1068,38 @@ const void *RB_DrawSurfs( const void *data ) {
|
|||
VectorScale(backEnd.refdef.viewaxis[2], ymax, viewVector);
|
||||
GLSL_SetUniformVec3(&tr.shadowmaskShader, UNIFORM_VIEWUP, viewVector);
|
||||
|
||||
VectorSet4(viewInfo, zmax / zmin, zmax, 0.0, 0.0);
|
||||
|
||||
GLSL_SetUniformVec4(&tr.shadowmaskShader, UNIFORM_VIEWINFO, viewInfo);
|
||||
}
|
||||
|
||||
|
||||
RB_InstantQuad2(quadVerts, texCoords); //, color, shaderProgram, invTexRes);
|
||||
|
||||
if (r_shadowBlur->integer)
|
||||
{
|
||||
viewInfo[2] = 1.0f / (float)(tr.screenScratchFbo->width);
|
||||
viewInfo[3] = 1.0f / (float)(tr.screenScratchFbo->height);
|
||||
|
||||
FBO_Bind(tr.screenScratchFbo);
|
||||
|
||||
GLSL_BindProgram(&tr.depthBlurShader[0]);
|
||||
|
||||
GL_BindToTMU(tr.screenShadowImage, TB_COLORMAP);
|
||||
GL_BindToTMU(tr.hdrDepthImage, TB_LIGHTMAP);
|
||||
|
||||
GLSL_SetUniformVec4(&tr.depthBlurShader[0], UNIFORM_VIEWINFO, viewInfo);
|
||||
|
||||
RB_InstantQuad2(quadVerts, texCoords);
|
||||
|
||||
FBO_Bind(tr.screenShadowFbo);
|
||||
|
||||
GLSL_BindProgram(&tr.depthBlurShader[1]);
|
||||
|
||||
GL_BindToTMU(tr.screenScratchImage, TB_COLORMAP);
|
||||
GL_BindToTMU(tr.hdrDepthImage, TB_LIGHTMAP);
|
||||
|
||||
GLSL_SetUniformVec4(&tr.depthBlurShader[1], UNIFORM_VIEWINFO, viewInfo);
|
||||
|
||||
RB_InstantQuad2(quadVerts, texCoords);
|
||||
}
|
||||
}
|
||||
|
||||
if (r_ssao->integer)
|
||||
|
@ -1183,6 +1107,10 @@ const void *RB_DrawSurfs( const void *data ) {
|
|||
vec4_t quadVerts[4];
|
||||
vec2_t texCoords[4];
|
||||
|
||||
viewInfo[2] = 1.0f / ((float)(tr.quarterImage[0]->width) * tan(backEnd.viewParms.fovX * M_PI / 360.0f) * 2.0f);
|
||||
viewInfo[3] = 1.0f / ((float)(tr.quarterImage[0]->height) * tan(backEnd.viewParms.fovY * M_PI / 360.0f) * 2.0f);
|
||||
viewInfo[3] *= (float)backEnd.viewParms.viewportHeight / (float)backEnd.viewParms.viewportWidth;
|
||||
|
||||
FBO_Bind(tr.quarterFbo[0]);
|
||||
|
||||
qglViewport(0, 0, tr.quarterFbo[0]->width, tr.quarterFbo[0]->height);
|
||||
|
@ -1204,20 +1132,14 @@ const void *RB_DrawSurfs( const void *data ) {
|
|||
|
||||
GL_BindToTMU(tr.hdrDepthImage, TB_COLORMAP);
|
||||
|
||||
{
|
||||
vec4_t viewInfo;
|
||||
|
||||
float zmax = backEnd.viewParms.zFar;
|
||||
float zmin = r_znear->value;
|
||||
|
||||
VectorSet4(viewInfo, zmax / zmin, zmax, 0.0, 0.0);
|
||||
|
||||
GLSL_SetUniformVec4(&tr.ssaoShader, UNIFORM_VIEWINFO, viewInfo);
|
||||
}
|
||||
GLSL_SetUniformVec4(&tr.ssaoShader, UNIFORM_VIEWINFO, viewInfo);
|
||||
|
||||
RB_InstantQuad2(quadVerts, texCoords); //, color, shaderProgram, invTexRes);
|
||||
|
||||
|
||||
viewInfo[2] = 1.0f / (float)(tr.quarterImage[0]->width);
|
||||
viewInfo[3] = 1.0f / (float)(tr.quarterImage[0]->height);
|
||||
|
||||
FBO_Bind(tr.quarterFbo[1]);
|
||||
|
||||
qglViewport(0, 0, tr.quarterFbo[1]->width, tr.quarterFbo[1]->height);
|
||||
|
@ -1228,16 +1150,7 @@ const void *RB_DrawSurfs( const void *data ) {
|
|||
GL_BindToTMU(tr.quarterImage[0], TB_COLORMAP);
|
||||
GL_BindToTMU(tr.hdrDepthImage, TB_LIGHTMAP);
|
||||
|
||||
{
|
||||
vec4_t viewInfo;
|
||||
|
||||
float zmax = backEnd.viewParms.zFar;
|
||||
float zmin = r_znear->value;
|
||||
|
||||
VectorSet4(viewInfo, zmax / zmin, zmax, 0.0, 0.0);
|
||||
|
||||
GLSL_SetUniformVec4(&tr.depthBlurShader[0], UNIFORM_VIEWINFO, viewInfo);
|
||||
}
|
||||
GLSL_SetUniformVec4(&tr.depthBlurShader[0], UNIFORM_VIEWINFO, viewInfo);
|
||||
|
||||
RB_InstantQuad2(quadVerts, texCoords); //, color, shaderProgram, invTexRes);
|
||||
|
||||
|
@ -1252,16 +1165,7 @@ const void *RB_DrawSurfs( const void *data ) {
|
|||
GL_BindToTMU(tr.quarterImage[1], TB_COLORMAP);
|
||||
GL_BindToTMU(tr.hdrDepthImage, TB_LIGHTMAP);
|
||||
|
||||
{
|
||||
vec4_t viewInfo;
|
||||
|
||||
float zmax = backEnd.viewParms.zFar;
|
||||
float zmin = r_znear->value;
|
||||
|
||||
VectorSet4(viewInfo, zmax / zmin, zmax, 0.0, 0.0);
|
||||
|
||||
GLSL_SetUniformVec4(&tr.depthBlurShader[1], UNIFORM_VIEWINFO, viewInfo);
|
||||
}
|
||||
GLSL_SetUniformVec4(&tr.depthBlurShader[1], UNIFORM_VIEWINFO, viewInfo);
|
||||
|
||||
|
||||
RB_InstantQuad2(quadVerts, texCoords); //, color, shaderProgram, invTexRes);
|
||||
|
@ -1319,11 +1223,11 @@ const void *RB_DrawSurfs( const void *data ) {
|
|||
|
||||
if (glRefConfig.framebufferObject && tr.renderCubeFbo && backEnd.viewParms.targetFbo == tr.renderCubeFbo)
|
||||
{
|
||||
cubemap_t *cubemap = &tr.cubemaps[backEnd.viewParms.targetFboCubemapIndex];
|
||||
|
||||
FBO_Bind(NULL);
|
||||
GL_SelectTexture(TB_CUBEMAP);
|
||||
GL_BindToTMU(tr.cubemaps[backEnd.viewParms.targetFboCubemapIndex], TB_CUBEMAP);
|
||||
qglGenerateMipmapEXT(GL_TEXTURE_CUBE_MAP);
|
||||
GL_SelectTexture(0);
|
||||
if (cubemap && cubemap->image)
|
||||
qglGenerateTextureMipmap(cubemap->image->texnum, GL_TEXTURE_CUBE_MAP);
|
||||
}
|
||||
|
||||
return (const void *)(cmd + 1);
|
||||
|
@ -1400,7 +1304,7 @@ void RB_ShowImages( void ) {
|
|||
{
|
||||
vec4_t quadVerts[4];
|
||||
|
||||
GL_Bind(image);
|
||||
GL_BindToTMU(image, TB_COLORMAP);
|
||||
|
||||
VectorSet4(quadVerts[0], x, y, 0, 1);
|
||||
VectorSet4(quadVerts[1], x + w, y, 0, 1);
|
||||
|
@ -1576,21 +1480,18 @@ const void *RB_CapShadowMap(const void *data)
|
|||
|
||||
if (cmd->map != -1)
|
||||
{
|
||||
GL_SelectTexture(0);
|
||||
if (cmd->cubeSide != -1)
|
||||
{
|
||||
if (tr.shadowCubemaps[cmd->map])
|
||||
{
|
||||
GL_Bind(tr.shadowCubemaps[cmd->map]);
|
||||
qglCopyTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + cmd->cubeSide, 0, GL_RGBA8, backEnd.refdef.x, glConfig.vidHeight - ( backEnd.refdef.y + PSHADOW_MAP_SIZE ), PSHADOW_MAP_SIZE, PSHADOW_MAP_SIZE, 0);
|
||||
qglCopyTextureImage2D(tr.shadowCubemaps[cmd->map]->texnum, GL_TEXTURE_CUBE_MAP_POSITIVE_X + cmd->cubeSide, 0, GL_RGBA8, backEnd.refdef.x, glConfig.vidHeight - ( backEnd.refdef.y + PSHADOW_MAP_SIZE ), PSHADOW_MAP_SIZE, PSHADOW_MAP_SIZE, 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (tr.pshadowMaps[cmd->map])
|
||||
{
|
||||
GL_Bind(tr.pshadowMaps[cmd->map]);
|
||||
qglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, backEnd.refdef.x, glConfig.vidHeight - ( backEnd.refdef.y + PSHADOW_MAP_SIZE ), PSHADOW_MAP_SIZE, PSHADOW_MAP_SIZE, 0);
|
||||
qglCopyTextureImage2D(tr.pshadowMaps[cmd->map]->texnum, GL_TEXTURE_2D, 0, GL_RGBA8, backEnd.refdef.x, glConfig.vidHeight - (backEnd.refdef.y + PSHADOW_MAP_SIZE), PSHADOW_MAP_SIZE, PSHADOW_MAP_SIZE, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1649,10 +1550,6 @@ const void *RB_PostProcess(const void *data)
|
|||
srcBox[2] = backEnd.viewParms.viewportWidth * tr.screenSsaoImage->width / (float)glConfig.vidWidth;
|
||||
srcBox[3] = backEnd.viewParms.viewportHeight * tr.screenSsaoImage->height / (float)glConfig.vidHeight;
|
||||
|
||||
//FBO_BlitFromTexture(tr.screenSsaoImage, srcBox, NULL, srcFbo, dstBox, NULL, NULL, GLS_SRCBLEND_DST_COLOR | GLS_DSTBLEND_ZERO);
|
||||
srcBox[1] = tr.screenSsaoImage->height - srcBox[1];
|
||||
srcBox[3] = -srcBox[3];
|
||||
|
||||
FBO_Blit(tr.screenSsaoFbo, srcBox, NULL, srcFbo, dstBox, NULL, NULL, GLS_SRCBLEND_DST_COLOR | GLS_DSTBLEND_ZERO);
|
||||
}
|
||||
|
||||
|
@ -1663,7 +1560,7 @@ const void *RB_PostProcess(const void *data)
|
|||
|
||||
if (srcFbo)
|
||||
{
|
||||
if (r_hdr->integer && (r_toneMap->integer || r_forceToneMap->integer) && qglActiveTextureARB)
|
||||
if (r_hdr->integer && (r_toneMap->integer || r_forceToneMap->integer))
|
||||
{
|
||||
autoExposure = r_autoExposure->integer || r_forceAutoExposure->integer;
|
||||
RB_ToneMap(srcFbo, srcBox, NULL, dstBox, autoExposure);
|
||||
|
@ -1693,6 +1590,71 @@ const void *RB_PostProcess(const void *data)
|
|||
else
|
||||
RB_GaussianBlur(backEnd.refdef.blurFactor);
|
||||
|
||||
#if 0
|
||||
if (0)
|
||||
{
|
||||
vec4_t quadVerts[4];
|
||||
vec2_t texCoords[4];
|
||||
ivec4_t iQtrBox;
|
||||
vec4_t box;
|
||||
vec4_t viewInfo;
|
||||
static float scale = 5.0f;
|
||||
|
||||
scale -= 0.005f;
|
||||
if (scale < 0.01f)
|
||||
scale = 5.0f;
|
||||
|
||||
FBO_FastBlit(NULL, NULL, tr.quarterFbo[0], NULL, GL_COLOR_BUFFER_BIT, GL_LINEAR);
|
||||
|
||||
iQtrBox[0] = backEnd.viewParms.viewportX * tr.quarterImage[0]->width / (float)glConfig.vidWidth;
|
||||
iQtrBox[1] = backEnd.viewParms.viewportY * tr.quarterImage[0]->height / (float)glConfig.vidHeight;
|
||||
iQtrBox[2] = backEnd.viewParms.viewportWidth * tr.quarterImage[0]->width / (float)glConfig.vidWidth;
|
||||
iQtrBox[3] = backEnd.viewParms.viewportHeight * tr.quarterImage[0]->height / (float)glConfig.vidHeight;
|
||||
|
||||
qglViewport(iQtrBox[0], iQtrBox[1], iQtrBox[2], iQtrBox[3]);
|
||||
qglScissor(iQtrBox[0], iQtrBox[1], iQtrBox[2], iQtrBox[3]);
|
||||
|
||||
VectorSet4(box, 0.0f, 0.0f, 1.0f, 1.0f);
|
||||
|
||||
texCoords[0][0] = box[0]; texCoords[0][1] = box[3];
|
||||
texCoords[1][0] = box[2]; texCoords[1][1] = box[3];
|
||||
texCoords[2][0] = box[2]; texCoords[2][1] = box[1];
|
||||
texCoords[3][0] = box[0]; texCoords[3][1] = box[1];
|
||||
|
||||
VectorSet4(box, -1.0f, -1.0f, 1.0f, 1.0f);
|
||||
|
||||
VectorSet4(quadVerts[0], box[0], box[3], 0, 1);
|
||||
VectorSet4(quadVerts[1], box[2], box[3], 0, 1);
|
||||
VectorSet4(quadVerts[2], box[2], box[1], 0, 1);
|
||||
VectorSet4(quadVerts[3], box[0], box[1], 0, 1);
|
||||
|
||||
GL_State(GLS_DEPTHTEST_DISABLE);
|
||||
|
||||
|
||||
VectorSet4(viewInfo, backEnd.viewParms.zFar / r_znear->value, backEnd.viewParms.zFar, 0.0, 0.0);
|
||||
|
||||
viewInfo[2] = scale / (float)(tr.quarterImage[0]->width);
|
||||
viewInfo[3] = scale / (float)(tr.quarterImage[0]->height);
|
||||
|
||||
FBO_Bind(tr.quarterFbo[1]);
|
||||
GLSL_BindProgram(&tr.depthBlurShader[2]);
|
||||
GL_BindToTMU(tr.quarterImage[0], TB_COLORMAP);
|
||||
GLSL_SetUniformVec4(&tr.depthBlurShader[2], UNIFORM_VIEWINFO, viewInfo);
|
||||
RB_InstantQuad2(quadVerts, texCoords);
|
||||
|
||||
FBO_Bind(tr.quarterFbo[0]);
|
||||
GLSL_BindProgram(&tr.depthBlurShader[3]);
|
||||
GL_BindToTMU(tr.quarterImage[1], TB_COLORMAP);
|
||||
GLSL_SetUniformVec4(&tr.depthBlurShader[3], UNIFORM_VIEWINFO, viewInfo);
|
||||
RB_InstantQuad2(quadVerts, texCoords);
|
||||
|
||||
SetViewportAndScissor();
|
||||
|
||||
FBO_FastBlit(tr.quarterFbo[1], NULL, NULL, NULL, GL_COLOR_BUFFER_BIT, GL_LINEAR);
|
||||
FBO_Bind(NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (0 && r_sunlightMode->integer)
|
||||
{
|
||||
ivec4_t dstBox;
|
||||
|
@ -1732,7 +1694,7 @@ const void *RB_PostProcess(const void *data)
|
|||
{
|
||||
VectorSet4(dstBox, 0, glConfig.vidHeight - 256, 256, 256);
|
||||
//FBO_BlitFromTexture(tr.renderCubeImage, NULL, NULL, NULL, dstBox, &tr.testcubeShader, NULL, 0);
|
||||
FBO_BlitFromTexture(tr.cubemaps[cubemapIndex - 1], NULL, NULL, NULL, dstBox, &tr.testcubeShader, NULL, 0);
|
||||
FBO_BlitFromTexture(tr.cubemaps[cubemapIndex - 1].image, NULL, NULL, NULL, dstBox, &tr.testcubeShader, NULL, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -1742,6 +1704,74 @@ const void *RB_PostProcess(const void *data)
|
|||
return (const void *)(cmd + 1);
|
||||
}
|
||||
|
||||
// FIXME: put this function declaration elsewhere
|
||||
void R_SaveDDS(const char *filename, byte *pic, int width, int height, int depth);
|
||||
|
||||
/*
|
||||
=============
|
||||
RB_ExportCubemaps
|
||||
|
||||
=============
|
||||
*/
|
||||
const void *RB_ExportCubemaps(const void *data)
|
||||
{
|
||||
const exportCubemapsCommand_t *cmd = data;
|
||||
|
||||
// finish any 2D drawing if needed
|
||||
if (tess.numIndexes)
|
||||
RB_EndSurface();
|
||||
|
||||
if (!glRefConfig.framebufferObject || !tr.world || tr.numCubemaps == 0)
|
||||
{
|
||||
// do nothing
|
||||
ri.Printf(PRINT_ALL, "Nothing to export!\n");
|
||||
return (const void *)(cmd + 1);
|
||||
}
|
||||
|
||||
if (cmd)
|
||||
{
|
||||
FBO_t *oldFbo = glState.currentFBO;
|
||||
int sideSize = r_cubemapSize->integer * r_cubemapSize->integer * 4;
|
||||
byte *cubemapPixels = ri.Malloc(sideSize * 6);
|
||||
int i, j;
|
||||
|
||||
FBO_Bind(tr.renderCubeFbo);
|
||||
|
||||
for (i = 0; i < tr.numCubemaps; i++)
|
||||
{
|
||||
char filename[MAX_QPATH];
|
||||
cubemap_t *cubemap = &tr.cubemaps[i];
|
||||
byte *p = cubemapPixels;
|
||||
|
||||
for (j = 0; j < 6; j++)
|
||||
{
|
||||
FBO_AttachImage(tr.renderCubeFbo, cubemap->image, GL_COLOR_ATTACHMENT0_EXT, j);
|
||||
qglReadPixels(0, 0, r_cubemapSize->integer, r_cubemapSize->integer, GL_RGBA, GL_UNSIGNED_BYTE, p);
|
||||
p += sideSize;
|
||||
}
|
||||
|
||||
if (cubemap->name[0])
|
||||
{
|
||||
COM_StripExtension(cubemap->name, filename, MAX_QPATH);
|
||||
Q_strcat(filename, MAX_QPATH, ".dds");
|
||||
}
|
||||
else
|
||||
{
|
||||
Com_sprintf(filename, MAX_QPATH, "cubemaps/%s/%03d.dds", tr.world->baseName, i);
|
||||
}
|
||||
|
||||
R_SaveDDS(filename, cubemapPixels, r_cubemapSize->integer, r_cubemapSize->integer, 6);
|
||||
ri.Printf(PRINT_ALL, "Saved cubemap %d as %s\n", i, filename);
|
||||
}
|
||||
|
||||
FBO_Bind(oldFbo);
|
||||
|
||||
ri.Free(cubemapPixels);
|
||||
}
|
||||
|
||||
return (const void *)(cmd + 1);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
====================
|
||||
|
@ -1790,6 +1820,9 @@ void RB_ExecuteRenderCommands( const void *data ) {
|
|||
case RC_POSTPROCESS:
|
||||
data = RB_PostProcess(data);
|
||||
break;
|
||||
case RC_EXPORT_CUBEMAPS:
|
||||
data = RB_ExportCubemaps(data);
|
||||
break;
|
||||
case RC_END_OF_LIST:
|
||||
default:
|
||||
// finish any 2D drawing if needed
|
||||
|
|
|
@ -23,6 +23,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
|
||||
#include "tr_local.h"
|
||||
|
||||
#define JSON_IMPLEMENTATION
|
||||
#include "../qcommon/json.h"
|
||||
#undef JSON_IMPLEMENTATION
|
||||
|
||||
/*
|
||||
|
||||
Loads and prepares a map file for scene rendering.
|
||||
|
@ -101,7 +105,11 @@ static void R_ColorShiftLightingBytes( byte in[4], byte out[4] ) {
|
|||
int shift, r, g, b;
|
||||
|
||||
// shift the color data based on overbright range
|
||||
#if defined(USE_OVERBRIGHT)
|
||||
shift = r_mapOverBrightBits->integer - tr.overbrightBits;
|
||||
#else
|
||||
shift = 0;
|
||||
#endif
|
||||
|
||||
// shift the data based on overbright range
|
||||
r = in[0] << shift;
|
||||
|
@ -136,7 +144,9 @@ static void R_ColorShiftLightingFloats(float in[4], float out[4], float scale )
|
|||
{
|
||||
float r, g, b;
|
||||
|
||||
scale *= pow(2.0f, r_mapOverBrightBits->integer - tr.overbrightBits);
|
||||
#if defined(USE_OVERBRIGHT)
|
||||
scale *= 1 << (r_mapOverBrightBits->integer - tr.overbrightBits);
|
||||
#endif
|
||||
|
||||
r = in[0] * scale;
|
||||
g = in[1] * scale;
|
||||
|
@ -2110,12 +2120,6 @@ static void R_CreateWorldVaos(void)
|
|||
// -1 represents 0, -2 represents 1, and so on
|
||||
s_worldData.viewSurfaces = ri.Hunk_Alloc(sizeof(*s_worldData.viewSurfaces) * s_worldData.nummarksurfaces, h_low);
|
||||
|
||||
// copy view surfaces into mark surfaces
|
||||
for (i = 0; i < s_worldData.nummarksurfaces; i++)
|
||||
{
|
||||
s_worldData.viewSurfaces[i] = s_worldData.marksurfaces[i];
|
||||
}
|
||||
|
||||
// actually merge surfaces
|
||||
mergedSurf = s_worldData.mergedSurfaces;
|
||||
for(firstSurf = lastSurf = surfacesSorted; firstSurf < surfacesSorted + numSortedSurfaces; firstSurf = lastSurf)
|
||||
|
@ -2176,23 +2180,22 @@ static void R_CreateWorldVaos(void)
|
|||
mergedSurf->cubemapIndex = (*firstSurf)->cubemapIndex;
|
||||
mergedSurf->shader = (*firstSurf)->shader;
|
||||
|
||||
// redirect view surfaces to this surf
|
||||
// change surfacesViewCount[] from leaf index to viewSurface index - 1 so we can redirect later
|
||||
// subtracting 2 (viewSurface index - 1) to avoid collision with -1 (no leaf)
|
||||
for (currSurf = firstSurf; currSurf < lastSurf; currSurf++)
|
||||
s_worldData.surfacesViewCount[*currSurf - s_worldData.surfaces] = -2;
|
||||
|
||||
for (k = 0; k < s_worldData.nummarksurfaces; k++)
|
||||
{
|
||||
if (s_worldData.surfacesViewCount[s_worldData.marksurfaces[k]] == -2)
|
||||
s_worldData.viewSurfaces[k] = -((int)(mergedSurf - s_worldData.mergedSurfaces) + 1);
|
||||
}
|
||||
|
||||
for (currSurf = firstSurf; currSurf < lastSurf; currSurf++)
|
||||
s_worldData.surfacesViewCount[*currSurf - s_worldData.surfaces] = -1;
|
||||
s_worldData.surfacesViewCount[*currSurf - s_worldData.surfaces] = -((int)(mergedSurf - s_worldData.mergedSurfaces)) - 2;
|
||||
|
||||
mergedSurf++;
|
||||
}
|
||||
|
||||
ri.Printf(PRINT_ALL, "Processed %d mergeable surfaces into %d merged, %d unmerged\n",
|
||||
// direct viewSurfaces to merged and unmerged surfaces
|
||||
for (i = 0; i < s_worldData.nummarksurfaces; i++)
|
||||
{
|
||||
int viewSurfaceIndex = s_worldData.surfacesViewCount[s_worldData.marksurfaces[i]] + 1;
|
||||
s_worldData.viewSurfaces[i] = (viewSurfaceIndex < 0) ? viewSurfaceIndex : s_worldData.marksurfaces[i];
|
||||
}
|
||||
|
||||
ri.Printf(PRINT_ALL, "Processed %d mergeable surfaces into %d merged, %d unmerged\n",
|
||||
numSortedSurfaces, numMergedSurfaces, numUnmergedSurfaces);
|
||||
}
|
||||
|
||||
|
@ -2755,7 +2758,11 @@ void R_LoadLightGrid( lump_t *l ) {
|
|||
|
||||
if (hdrLightGrid)
|
||||
{
|
||||
float lightScale = pow(2, r_mapOverBrightBits->integer - tr.overbrightBits);
|
||||
#if defined(USE_OVERBRIGHT)
|
||||
float lightScale = 1 << (r_mapOverBrightBits->integer - tr.overbrightBits);
|
||||
#else
|
||||
float lightScale = 1.0f;
|
||||
#endif
|
||||
|
||||
//ri.Printf(PRINT_ALL, "found!\n");
|
||||
|
||||
|
@ -2962,6 +2969,78 @@ qboolean R_ParseSpawnVars( char *spawnVarChars, int maxSpawnVarChars, int *numSp
|
|||
return qtrue;
|
||||
}
|
||||
|
||||
void R_LoadEnvironmentJson(const char *baseName)
|
||||
{
|
||||
char filename[MAX_QPATH];
|
||||
|
||||
union {
|
||||
char *c;
|
||||
void *v;
|
||||
} buffer;
|
||||
char *bufferEnd;
|
||||
|
||||
const char *cubemapArrayJson;
|
||||
int filelen, i;
|
||||
|
||||
Com_sprintf(filename, MAX_QPATH, "cubemaps/%s/env.json", baseName);
|
||||
|
||||
filelen = ri.FS_ReadFile(filename, &buffer.v);
|
||||
if (!buffer.c)
|
||||
return;
|
||||
bufferEnd = buffer.c + filelen;
|
||||
|
||||
if (JSON_ValueGetType(buffer.c, bufferEnd) != JSONTYPE_OBJECT)
|
||||
{
|
||||
ri.Printf(PRINT_ALL, "Bad %s: does not start with a object\n", filename);
|
||||
ri.FS_FreeFile(buffer.v);
|
||||
return;
|
||||
}
|
||||
|
||||
cubemapArrayJson = JSON_ObjectGetNamedValue(buffer.c, bufferEnd, "Cubemaps");
|
||||
if (!cubemapArrayJson)
|
||||
{
|
||||
ri.Printf(PRINT_ALL, "Bad %s: no Cubemaps\n", filename);
|
||||
ri.FS_FreeFile(buffer.v);
|
||||
return;
|
||||
}
|
||||
|
||||
if (JSON_ValueGetType(cubemapArrayJson, bufferEnd) != JSONTYPE_ARRAY)
|
||||
{
|
||||
ri.Printf(PRINT_ALL, "Bad %s: Cubemaps not an array\n", filename);
|
||||
ri.FS_FreeFile(buffer.v);
|
||||
return;
|
||||
}
|
||||
|
||||
tr.numCubemaps = JSON_ArrayGetIndex(cubemapArrayJson, bufferEnd, NULL, 0);
|
||||
tr.cubemaps = ri.Hunk_Alloc(tr.numCubemaps * sizeof(*tr.cubemaps), h_low);
|
||||
memset(tr.cubemaps, 0, tr.numCubemaps * sizeof(*tr.cubemaps));
|
||||
|
||||
for (i = 0; i < tr.numCubemaps; i++)
|
||||
{
|
||||
cubemap_t *cubemap = &tr.cubemaps[i];
|
||||
const char *cubemapJson, *keyValueJson, *indexes[3];
|
||||
int j;
|
||||
|
||||
cubemapJson = JSON_ArrayGetValue(cubemapArrayJson, bufferEnd, i);
|
||||
|
||||
keyValueJson = JSON_ObjectGetNamedValue(cubemapJson, bufferEnd, "Name");
|
||||
if (!JSON_ValueGetString(keyValueJson, bufferEnd, cubemap->name, MAX_QPATH))
|
||||
cubemap->name[0] = '\0';
|
||||
|
||||
keyValueJson = JSON_ObjectGetNamedValue(cubemapJson, bufferEnd, "Position");
|
||||
JSON_ArrayGetIndex(keyValueJson, bufferEnd, indexes, 3);
|
||||
for (j = 0; j < 3; j++)
|
||||
cubemap->origin[j] = JSON_ValueGetFloat(indexes[j], bufferEnd);
|
||||
|
||||
cubemap->parallaxRadius = 1000.0f;
|
||||
keyValueJson = JSON_ObjectGetNamedValue(cubemapJson, bufferEnd, "Radius");
|
||||
if (keyValueJson)
|
||||
cubemap->parallaxRadius = JSON_ValueGetFloat(keyValueJson, bufferEnd);
|
||||
}
|
||||
|
||||
ri.FS_FreeFile(buffer.v);
|
||||
}
|
||||
|
||||
void R_LoadCubemapEntities(char *cubemapEntityName)
|
||||
{
|
||||
char spawnVarChars[2048];
|
||||
|
@ -2986,33 +3065,45 @@ void R_LoadCubemapEntities(char *cubemapEntityName)
|
|||
return;
|
||||
|
||||
tr.numCubemaps = numCubemaps;
|
||||
tr.cubemapOrigins = ri.Hunk_Alloc( tr.numCubemaps * sizeof(*tr.cubemapOrigins), h_low);
|
||||
tr.cubemaps = ri.Hunk_Alloc( tr.numCubemaps * sizeof(*tr.cubemaps), h_low);
|
||||
tr.cubemaps = ri.Hunk_Alloc(tr.numCubemaps * sizeof(*tr.cubemaps), h_low);
|
||||
memset(tr.cubemaps, 0, tr.numCubemaps * sizeof(*tr.cubemaps));
|
||||
|
||||
numCubemaps = 0;
|
||||
while(R_ParseSpawnVars(spawnVarChars, sizeof(spawnVarChars), &numSpawnVars, spawnVars))
|
||||
{
|
||||
int i;
|
||||
char name[MAX_QPATH];
|
||||
qboolean isCubemap = qfalse;
|
||||
qboolean positionSet = qfalse;
|
||||
qboolean originSet = qfalse;
|
||||
vec3_t origin;
|
||||
float parallaxRadius = 1000.0f;
|
||||
|
||||
name[0] = '\0';
|
||||
for (i = 0; i < numSpawnVars; i++)
|
||||
{
|
||||
if (!Q_stricmp(spawnVars[i][0], "classname") && !Q_stricmp(spawnVars[i][1], cubemapEntityName))
|
||||
isCubemap = qtrue;
|
||||
|
||||
if (!Q_stricmp(spawnVars[i][0], "name"))
|
||||
Q_strncpyz(name, spawnVars[i][1], MAX_QPATH);
|
||||
|
||||
if (!Q_stricmp(spawnVars[i][0], "origin"))
|
||||
{
|
||||
sscanf(spawnVars[i][1], "%f %f %f", &origin[0], &origin[1], &origin[2]);
|
||||
positionSet = qtrue;
|
||||
originSet = qtrue;
|
||||
}
|
||||
else if (!Q_stricmp(spawnVars[i][0], "radius"))
|
||||
{
|
||||
sscanf(spawnVars[i][1], "%f", ¶llaxRadius);
|
||||
}
|
||||
}
|
||||
|
||||
if (isCubemap && positionSet)
|
||||
if (isCubemap && originSet)
|
||||
{
|
||||
//ri.Printf(PRINT_ALL, "cubemap at %f %f %f\n", origin[0], origin[1], origin[2]);
|
||||
VectorCopy(origin, tr.cubemapOrigins[numCubemaps]);
|
||||
cubemap_t *cubemap = &tr.cubemaps[numCubemaps];
|
||||
Q_strncpyz(cubemap->name, name, MAX_QPATH);
|
||||
VectorCopy(origin, cubemap->origin);
|
||||
cubemap->parallaxRadius = parallaxRadius;
|
||||
numCubemaps++;
|
||||
}
|
||||
}
|
||||
|
@ -3052,23 +3143,41 @@ void R_AssignCubemapsToWorldSurfaces(void)
|
|||
}
|
||||
|
||||
|
||||
void R_RenderAllCubemaps(void)
|
||||
void R_LoadCubemaps(void)
|
||||
{
|
||||
int i, j;
|
||||
int i;
|
||||
imgFlags_t flags = IMGFLAG_CLAMPTOEDGE | IMGFLAG_MIPMAP | IMGFLAG_NOLIGHTSCALE | IMGFLAG_CUBEMAP;
|
||||
|
||||
for (i = 0; i < tr.numCubemaps; i++)
|
||||
{
|
||||
tr.cubemaps[i] = R_CreateImage(va("*cubeMap%d", i), NULL, CUBE_MAP_SIZE, CUBE_MAP_SIZE, IMGTYPE_COLORALPHA, IMGFLAG_NO_COMPRESSION | IMGFLAG_CLAMPTOEDGE | IMGFLAG_MIPMAP | IMGFLAG_CUBEMAP, GL_RGBA8);
|
||||
char filename[MAX_QPATH];
|
||||
cubemap_t *cubemap = &tr.cubemaps[i];
|
||||
|
||||
Com_sprintf(filename, MAX_QPATH, "cubemaps/%s/%03d.dds", tr.world->baseName, i);
|
||||
|
||||
cubemap->image = R_FindImageFile(filename, IMGTYPE_COLORALPHA, flags);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void R_RenderMissingCubemaps(void)
|
||||
{
|
||||
int i, j;
|
||||
imgFlags_t flags = IMGFLAG_NO_COMPRESSION | IMGFLAG_CLAMPTOEDGE | IMGFLAG_MIPMAP | IMGFLAG_NOLIGHTSCALE | IMGFLAG_CUBEMAP;
|
||||
|
||||
for (i = 0; i < tr.numCubemaps; i++)
|
||||
{
|
||||
for (j = 0; j < 6; j++)
|
||||
if (!tr.cubemaps[i].image)
|
||||
{
|
||||
RE_ClearScene();
|
||||
R_RenderCubemapSide(i, j, qfalse);
|
||||
R_IssuePendingRenderCommands();
|
||||
R_InitNextFrame();
|
||||
tr.cubemaps[i].image = R_CreateImage(va("*cubeMap%d", i), NULL, r_cubemapSize->integer, r_cubemapSize->integer, IMGTYPE_COLORALPHA, flags, GL_RGBA8);
|
||||
|
||||
for (j = 0; j < 6; j++)
|
||||
{
|
||||
RE_ClearScene();
|
||||
R_RenderCubemapSide(i, j, qfalse);
|
||||
R_IssuePendingRenderCommands();
|
||||
R_InitNextFrame();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3385,7 +3494,14 @@ void RE_LoadWorldMap( const char *name ) {
|
|||
// load cubemaps
|
||||
if (r_cubeMapping->integer)
|
||||
{
|
||||
R_LoadCubemapEntities("misc_cubemap");
|
||||
// Try loading an env.json file first
|
||||
R_LoadEnvironmentJson(s_worldData.baseName);
|
||||
|
||||
if (!tr.numCubemaps)
|
||||
{
|
||||
R_LoadCubemapEntities("misc_cubemap");
|
||||
}
|
||||
|
||||
if (!tr.numCubemaps)
|
||||
{
|
||||
// use deathmatch spawn points as cubemaps
|
||||
|
@ -3409,10 +3525,11 @@ void RE_LoadWorldMap( const char *name ) {
|
|||
// make sure the VAO glState entry is safe
|
||||
R_BindNullVao();
|
||||
|
||||
// Render all cubemaps
|
||||
// Render or load all cubemaps
|
||||
if (r_cubeMapping->integer && tr.numCubemaps)
|
||||
{
|
||||
R_RenderAllCubemaps();
|
||||
R_LoadCubemaps();
|
||||
R_RenderMissingCubemaps();
|
||||
}
|
||||
|
||||
ri.FS_FreeFile( buffer.v );
|
||||
|
|
|
@ -121,20 +121,20 @@ void R_IssuePendingRenderCommands( void ) {
|
|||
|
||||
/*
|
||||
============
|
||||
R_GetCommandBuffer
|
||||
R_GetCommandBufferReserved
|
||||
|
||||
make sure there is enough command space
|
||||
============
|
||||
*/
|
||||
void *R_GetCommandBuffer( int bytes ) {
|
||||
void *R_GetCommandBufferReserved( int bytes, int reservedBytes ) {
|
||||
renderCommandList_t *cmdList;
|
||||
|
||||
cmdList = &backEndData->commands;
|
||||
bytes = PAD(bytes, sizeof(void *));
|
||||
|
||||
// always leave room for the end of list command
|
||||
if ( cmdList->used + bytes + 4 > MAX_RENDER_COMMANDS ) {
|
||||
if ( bytes > MAX_RENDER_COMMANDS - 4 ) {
|
||||
if ( cmdList->used + bytes + sizeof( int ) + reservedBytes > MAX_RENDER_COMMANDS ) {
|
||||
if ( bytes > MAX_RENDER_COMMANDS - sizeof( int ) ) {
|
||||
ri.Error( ERR_FATAL, "R_GetCommandBuffer: bad size %i", bytes );
|
||||
}
|
||||
// if we run out of room, just start dropping commands
|
||||
|
@ -146,6 +146,17 @@ void *R_GetCommandBuffer( int bytes ) {
|
|||
return cmdList->cmds + cmdList->used - bytes;
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
R_GetCommandBuffer
|
||||
|
||||
returns NULL if there is not enough space for important commands
|
||||
=============
|
||||
*/
|
||||
void *R_GetCommandBuffer( int bytes ) {
|
||||
return R_GetCommandBufferReserved( bytes, PAD( sizeof( swapBuffersCommand_t ), sizeof(void *) ) );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
=============
|
||||
|
@ -525,7 +536,7 @@ void RE_EndFrame( int *frontEndMsec, int *backEndMsec ) {
|
|||
if ( !tr.registered ) {
|
||||
return;
|
||||
}
|
||||
cmd = R_GetCommandBuffer( sizeof( *cmd ) );
|
||||
cmd = R_GetCommandBufferReserved( sizeof( *cmd ), 0 );
|
||||
if ( !cmd ) {
|
||||
return;
|
||||
}
|
||||
|
|
287
code/renderergl2/tr_dsa.c
Normal file
287
code/renderergl2/tr_dsa.c
Normal file
|
@ -0,0 +1,287 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2016 James Canete
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#include "tr_local.h"
|
||||
|
||||
#include "tr_dsa.h"
|
||||
|
||||
static struct
|
||||
{
|
||||
GLuint textures[NUM_TEXTURE_BUNDLES];
|
||||
GLenum texunit;
|
||||
|
||||
GLuint program;
|
||||
|
||||
GLuint drawFramebuffer;
|
||||
GLuint readFramebuffer;
|
||||
GLuint renderbuffer;
|
||||
}
|
||||
glDsaState;
|
||||
|
||||
void GL_BindNullTextures()
|
||||
{
|
||||
int i;
|
||||
|
||||
if (glRefConfig.directStateAccess)
|
||||
{
|
||||
for (i = 0; i < NUM_TEXTURE_BUNDLES; i++)
|
||||
{
|
||||
qglBindMultiTexture(GL_TEXTURE0_ARB + i, GL_TEXTURE_2D, 0);
|
||||
glDsaState.textures[i] = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < NUM_TEXTURE_BUNDLES; i++)
|
||||
{
|
||||
qglActiveTextureARB(GL_TEXTURE0_ARB + i);
|
||||
qglBindTexture(GL_TEXTURE_2D, 0);
|
||||
glDsaState.textures[i] = 0;
|
||||
}
|
||||
|
||||
qglActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
glDsaState.texunit = GL_TEXTURE0_ARB;
|
||||
}
|
||||
}
|
||||
|
||||
int GL_BindMultiTexture(GLenum texunit, GLenum target, GLuint texture)
|
||||
{
|
||||
GLuint tmu = texunit - GL_TEXTURE0_ARB;
|
||||
|
||||
if (glDsaState.textures[tmu] == texture)
|
||||
return 0;
|
||||
|
||||
if (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X && target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z)
|
||||
target = GL_TEXTURE_CUBE_MAP;
|
||||
|
||||
qglBindMultiTexture(texunit, target, texture);
|
||||
glDsaState.textures[tmu] = texture;
|
||||
return 1;
|
||||
}
|
||||
|
||||
GLvoid APIENTRY GLDSA_BindMultiTexture(GLenum texunit, GLenum target, GLuint texture)
|
||||
{
|
||||
if (glDsaState.texunit != texunit)
|
||||
{
|
||||
qglActiveTextureARB(texunit);
|
||||
glDsaState.texunit = texunit;
|
||||
}
|
||||
|
||||
qglBindTexture(target, texture);
|
||||
}
|
||||
|
||||
GLvoid APIENTRY GLDSA_TextureParameterf(GLuint texture, GLenum target, GLenum pname, GLfloat param)
|
||||
{
|
||||
GL_BindMultiTexture(glDsaState.texunit, target, texture);
|
||||
qglTexParameterf(target, pname, param);
|
||||
}
|
||||
|
||||
GLvoid APIENTRY GLDSA_TextureParameteri(GLuint texture, GLenum target, GLenum pname, GLint param)
|
||||
{
|
||||
GL_BindMultiTexture(glDsaState.texunit, target, texture);
|
||||
qglTexParameteri(target, pname, param);
|
||||
}
|
||||
|
||||
GLvoid APIENTRY GLDSA_TextureImage2D(GLuint texture, GLenum target, GLint level, GLint internalformat,
|
||||
GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
|
||||
{
|
||||
GL_BindMultiTexture(glDsaState.texunit, target, texture);
|
||||
qglTexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
|
||||
}
|
||||
|
||||
GLvoid APIENTRY GLDSA_TextureSubImage2D(GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset,
|
||||
GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)
|
||||
{
|
||||
GL_BindMultiTexture(glDsaState.texunit, target, texture);
|
||||
qglTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
|
||||
}
|
||||
|
||||
GLvoid APIENTRY GLDSA_CopyTextureImage2D(GLuint texture, GLenum target, GLint level, GLenum internalformat,
|
||||
GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
|
||||
{
|
||||
GL_BindMultiTexture(glDsaState.texunit, target, texture);
|
||||
qglCopyTexImage2D(target, level, internalformat, x, y, width, height, border);
|
||||
}
|
||||
|
||||
GLvoid APIENTRY GLDSA_CompressedTextureImage2D(GLuint texture, GLenum target, GLint level, GLenum internalformat,
|
||||
GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data)
|
||||
{
|
||||
GL_BindMultiTexture(glDsaState.texunit, target, texture);
|
||||
qglCompressedTexImage2DARB(target, level, internalformat, width, height, border, imageSize, data);
|
||||
}
|
||||
|
||||
GLvoid APIENTRY GLDSA_CompressedTextureSubImage2D(GLuint texture, GLenum target, GLint level,
|
||||
GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format,
|
||||
GLsizei imageSize, const GLvoid *data)
|
||||
{
|
||||
GL_BindMultiTexture(glDsaState.texunit, target, texture);
|
||||
qglCompressedTexSubImage2DARB(target, level, xoffset, yoffset, width, height, format, imageSize, data);
|
||||
}
|
||||
|
||||
GLvoid APIENTRY GLDSA_GenerateTextureMipmap(GLuint texture, GLenum target)
|
||||
{
|
||||
GL_BindMultiTexture(glDsaState.texunit, target, texture);
|
||||
qglGenerateMipmapEXT(target);
|
||||
}
|
||||
|
||||
void GL_BindNullProgram()
|
||||
{
|
||||
qglUseProgramObjectARB(0);
|
||||
glDsaState.program = 0;
|
||||
}
|
||||
|
||||
int GL_UseProgramObject(GLuint program)
|
||||
{
|
||||
if (glDsaState.program == program)
|
||||
return 0;
|
||||
|
||||
qglUseProgramObjectARB(program);
|
||||
glDsaState.program = program;
|
||||
return 1;
|
||||
}
|
||||
|
||||
GLvoid APIENTRY GLDSA_ProgramUniform1i(GLuint program, GLint location, GLint v0)
|
||||
{
|
||||
GL_UseProgramObject(program);
|
||||
qglUniform1iARB(location, v0);
|
||||
}
|
||||
|
||||
GLvoid APIENTRY GLDSA_ProgramUniform1f(GLuint program, GLint location, GLfloat v0)
|
||||
{
|
||||
GL_UseProgramObject(program);
|
||||
qglUniform1fARB(location, v0);
|
||||
}
|
||||
|
||||
GLvoid APIENTRY GLDSA_ProgramUniform2f(GLuint program, GLint location,
|
||||
GLfloat v0, GLfloat v1)
|
||||
{
|
||||
GL_UseProgramObject(program);
|
||||
qglUniform2fARB(location, v0, v1);
|
||||
}
|
||||
|
||||
GLvoid APIENTRY GLDSA_ProgramUniform3f(GLuint program, GLint location,
|
||||
GLfloat v0, GLfloat v1, GLfloat v2)
|
||||
{
|
||||
GL_UseProgramObject(program);
|
||||
qglUniform3fARB(location, v0, v1, v2);
|
||||
}
|
||||
|
||||
GLvoid APIENTRY GLDSA_ProgramUniform4f(GLuint program, GLint location,
|
||||
GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3)
|
||||
{
|
||||
GL_UseProgramObject(program);
|
||||
qglUniform4fARB(location, v0, v1, v2, v3);
|
||||
}
|
||||
|
||||
GLvoid APIENTRY GLDSA_ProgramUniform1fv(GLuint program, GLint location,
|
||||
GLsizei count, const GLfloat *value)
|
||||
{
|
||||
GL_UseProgramObject(program);
|
||||
qglUniform1fvARB(location, count, value);
|
||||
}
|
||||
|
||||
GLvoid APIENTRY GLDSA_ProgramUniformMatrix4fv(GLuint program, GLint location,
|
||||
GLsizei count, GLboolean transpose,
|
||||
const GLfloat *value)
|
||||
{
|
||||
GL_UseProgramObject(program);
|
||||
qglUniformMatrix4fvARB(location, count, transpose, value);
|
||||
}
|
||||
|
||||
void GL_BindNullFramebuffers()
|
||||
{
|
||||
qglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
|
||||
glDsaState.drawFramebuffer = glDsaState.readFramebuffer = 0;
|
||||
qglBindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0);
|
||||
glDsaState.renderbuffer = 0;
|
||||
}
|
||||
|
||||
void GL_BindFramebuffer(GLenum target, GLuint framebuffer)
|
||||
{
|
||||
switch (target)
|
||||
{
|
||||
case GL_FRAMEBUFFER_EXT:
|
||||
if (framebuffer != glDsaState.drawFramebuffer || framebuffer != glDsaState.readFramebuffer)
|
||||
{
|
||||
qglBindFramebufferEXT(target, framebuffer);
|
||||
glDsaState.drawFramebuffer = glDsaState.readFramebuffer = framebuffer;
|
||||
}
|
||||
break;
|
||||
|
||||
case GL_DRAW_FRAMEBUFFER_EXT:
|
||||
if (framebuffer != glDsaState.drawFramebuffer)
|
||||
{
|
||||
qglBindFramebufferEXT(target, framebuffer);
|
||||
glDsaState.drawFramebuffer = framebuffer;
|
||||
}
|
||||
break;
|
||||
|
||||
case GL_READ_FRAMEBUFFER_EXT:
|
||||
if (framebuffer != glDsaState.readFramebuffer)
|
||||
{
|
||||
qglBindFramebufferEXT(target, framebuffer);
|
||||
glDsaState.readFramebuffer = framebuffer;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void GL_BindRenderbuffer(GLuint renderbuffer)
|
||||
{
|
||||
if (renderbuffer != glDsaState.renderbuffer)
|
||||
{
|
||||
qglBindRenderbufferEXT(GL_RENDERBUFFER_EXT, renderbuffer);
|
||||
glDsaState.renderbuffer = renderbuffer;
|
||||
}
|
||||
}
|
||||
|
||||
GLvoid APIENTRY GLDSA_NamedRenderbufferStorage(GLuint renderbuffer,
|
||||
GLenum internalformat, GLsizei width, GLsizei height)
|
||||
{
|
||||
GL_BindRenderbuffer(renderbuffer);
|
||||
qglRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, internalformat, width, height);
|
||||
}
|
||||
|
||||
GLvoid APIENTRY GLDSA_NamedRenderbufferStorageMultisample(GLuint renderbuffer,
|
||||
GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
|
||||
{
|
||||
GL_BindRenderbuffer(renderbuffer);
|
||||
qglRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT, samples, internalformat, width, height);
|
||||
}
|
||||
|
||||
GLenum APIENTRY GLDSA_CheckNamedFramebufferStatus(GLuint framebuffer, GLenum target)
|
||||
{
|
||||
GL_BindFramebuffer(target, framebuffer);
|
||||
return qglCheckFramebufferStatusEXT(target);
|
||||
}
|
||||
|
||||
GLvoid APIENTRY GLDSA_NamedFramebufferTexture2D(GLuint framebuffer,
|
||||
GLenum attachment, GLenum textarget, GLuint texture, GLint level)
|
||||
{
|
||||
GL_BindFramebuffer(GL_FRAMEBUFFER_EXT, framebuffer);
|
||||
qglFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, attachment, textarget, texture, level);
|
||||
}
|
||||
|
||||
GLvoid APIENTRY GLDSA_NamedFramebufferRenderbuffer(GLuint framebuffer,
|
||||
GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
|
||||
{
|
||||
GL_BindFramebuffer(GL_FRAMEBUFFER_EXT, framebuffer);
|
||||
qglFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, attachment, renderbuffertarget, renderbuffer);
|
||||
}
|
80
code/renderergl2/tr_dsa.h
Normal file
80
code/renderergl2/tr_dsa.h
Normal file
|
@ -0,0 +1,80 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2016 James Canete
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#ifndef __TR_DSA_H__
|
||||
#define __TR_DSA_H__
|
||||
|
||||
#include "../renderercommon/qgl.h"
|
||||
|
||||
void GL_BindNullTextures(void);
|
||||
int GL_BindMultiTexture(GLenum texunit, GLenum target, GLuint texture);
|
||||
|
||||
GLvoid APIENTRY GLDSA_BindMultiTexture(GLenum texunit, GLenum target, GLuint texture);
|
||||
GLvoid APIENTRY GLDSA_TextureParameterf(GLuint texture, GLenum target, GLenum pname, GLfloat param);
|
||||
GLvoid APIENTRY GLDSA_TextureParameteri(GLuint texture, GLenum target, GLenum pname, GLint param);
|
||||
GLvoid APIENTRY GLDSA_TextureImage2D(GLuint texture, GLenum target, GLint level, GLint internalformat,
|
||||
GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
|
||||
GLvoid APIENTRY GLDSA_TextureSubImage2D(GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset,
|
||||
GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
|
||||
GLvoid APIENTRY GLDSA_CopyTextureImage2D(GLuint texture, GLenum target, GLint level, GLenum internalformat,
|
||||
GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
|
||||
GLvoid APIENTRY GLDSA_CompressedTextureImage2D(GLuint texture, GLenum target, GLint level, GLenum internalformat,
|
||||
GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
|
||||
GLvoid APIENTRY GLDSA_CompressedTextureSubImage2D(GLuint texture, GLenum target, GLint level,
|
||||
GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format,
|
||||
GLsizei imageSize, const GLvoid *data);
|
||||
|
||||
GLvoid APIENTRY GLDSA_GenerateTextureMipmap(GLuint texture, GLenum target);
|
||||
|
||||
void GL_BindNullProgram(void);
|
||||
int GL_UseProgramObject(GLuint program);
|
||||
|
||||
GLvoid APIENTRY GLDSA_ProgramUniform1i(GLuint program, GLint location, GLint v0);
|
||||
GLvoid APIENTRY GLDSA_ProgramUniform1f(GLuint program, GLint location, GLfloat v0);
|
||||
GLvoid APIENTRY GLDSA_ProgramUniform2f(GLuint program, GLint location,
|
||||
GLfloat v0, GLfloat v1);
|
||||
GLvoid APIENTRY GLDSA_ProgramUniform3f(GLuint program, GLint location,
|
||||
GLfloat v0, GLfloat v1, GLfloat v2);
|
||||
GLvoid APIENTRY GLDSA_ProgramUniform4f(GLuint program, GLint location,
|
||||
GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
|
||||
GLvoid APIENTRY GLDSA_ProgramUniform1fv(GLuint program, GLint location,
|
||||
GLsizei count, const GLfloat *value);
|
||||
GLvoid APIENTRY GLDSA_ProgramUniformMatrix4fv(GLuint program, GLint location,
|
||||
GLsizei count, GLboolean transpose,
|
||||
const GLfloat *value);
|
||||
|
||||
void GL_BindNullFramebuffers(void);
|
||||
void GL_BindFramebuffer(GLenum target, GLuint framebuffer);
|
||||
void GL_BindRenderbuffer(GLuint renderbuffer);
|
||||
|
||||
GLvoid APIENTRY GLDSA_NamedRenderbufferStorage(GLuint renderbuffer,
|
||||
GLenum internalformat, GLsizei width, GLsizei height);
|
||||
|
||||
GLvoid APIENTRY GLDSA_NamedRenderbufferStorageMultisample(GLuint renderbuffer,
|
||||
GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
|
||||
|
||||
GLenum APIENTRY GLDSA_CheckNamedFramebufferStatus(GLuint framebuffer, GLenum target);
|
||||
GLvoid APIENTRY GLDSA_NamedFramebufferTexture2D(GLuint framebuffer,
|
||||
GLenum attachment, GLenum textarget, GLuint texture, GLint level);
|
||||
GLvoid APIENTRY GLDSA_NamedFramebufferRenderbuffer(GLuint framebuffer,
|
||||
GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
|
||||
|
||||
|
||||
#endif
|
|
@ -28,6 +28,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
#endif
|
||||
|
||||
#include "tr_local.h"
|
||||
#include "tr_dsa.h"
|
||||
|
||||
// GL_EXT_draw_range_elements
|
||||
void (APIENTRY * qglDrawRangeElementsEXT) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
|
||||
|
@ -175,15 +176,56 @@ void (APIENTRY * qglBlitFramebufferEXT)(GLint srcX0, GLint srcY0, GLint srcX1, G
|
|||
void (APIENTRY * qglRenderbufferStorageMultisampleEXT)(GLenum target, GLsizei samples,
|
||||
GLenum internalformat, GLsizei width, GLsizei height);
|
||||
|
||||
// GL_ARB_draw_buffers
|
||||
void (APIENTRY * qglDrawBuffersARB)(GLsizei n, const GLenum *bufs);
|
||||
|
||||
// GL_ARB_vertex_array_object
|
||||
void (APIENTRY * qglBindVertexArrayARB)(GLuint array);
|
||||
void (APIENTRY * qglDeleteVertexArraysARB)(GLsizei n, const GLuint *arrays);
|
||||
void (APIENTRY * qglGenVertexArraysARB)(GLsizei n, GLuint *arrays);
|
||||
GLboolean (APIENTRY * qglIsVertexArrayARB)(GLuint array);
|
||||
|
||||
// GL_EXT_direct_state_access
|
||||
GLvoid (APIENTRY * qglBindMultiTexture)(GLenum texunit, GLenum target, GLuint texture);
|
||||
GLvoid (APIENTRY * qglTextureParameterf)(GLuint texture, GLenum target, GLenum pname, GLfloat param);
|
||||
GLvoid (APIENTRY * qglTextureParameteri)(GLuint texture, GLenum target, GLenum pname, GLint param);
|
||||
GLvoid (APIENTRY * qglTextureImage2D)(GLuint texture, GLenum target, GLint level, GLint internalformat,
|
||||
GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
|
||||
GLvoid (APIENTRY * qglTextureSubImage2D)(GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset,
|
||||
GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
|
||||
GLvoid (APIENTRY * qglCopyTextureImage2D)(GLuint texture, GLenum target, GLint level, GLenum internalformat,
|
||||
GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
|
||||
GLvoid (APIENTRY * qglCompressedTextureImage2D)(GLuint texture, GLenum target, GLint level, GLenum internalformat,
|
||||
GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
|
||||
GLvoid (APIENTRY * qglCompressedTextureSubImage2D)(GLuint texture, GLenum target, GLint level,
|
||||
GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format,
|
||||
GLsizei imageSize, const GLvoid *data);
|
||||
GLvoid (APIENTRY * qglGenerateTextureMipmap)(GLuint texture, GLenum target);
|
||||
|
||||
GLvoid(APIENTRY * qglProgramUniform1i)(GLuint program, GLint location, GLint v0);
|
||||
GLvoid(APIENTRY * qglProgramUniform1f)(GLuint program, GLint location, GLfloat v0);
|
||||
GLvoid(APIENTRY * qglProgramUniform2f)(GLuint program, GLint location,
|
||||
GLfloat v0, GLfloat v1);
|
||||
GLvoid(APIENTRY * qglProgramUniform3f)(GLuint program, GLint location,
|
||||
GLfloat v0, GLfloat v1, GLfloat v2);
|
||||
GLvoid(APIENTRY * qglProgramUniform4f)(GLuint program, GLint location,
|
||||
GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
|
||||
GLvoid(APIENTRY * qglProgramUniform1fv)(GLuint program, GLint location,
|
||||
GLsizei count, const GLfloat *value);
|
||||
GLvoid(APIENTRY * qglProgramUniformMatrix4fv)(GLuint program, GLint location,
|
||||
GLsizei count, GLboolean transpose,
|
||||
const GLfloat *value);
|
||||
|
||||
GLvoid(APIENTRY * qglNamedRenderbufferStorage)(GLuint renderbuffer,
|
||||
GLenum internalformat, GLsizei width, GLsizei height);
|
||||
|
||||
GLvoid(APIENTRY * qglNamedRenderbufferStorageMultisample)(GLuint renderbuffer,
|
||||
GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
|
||||
|
||||
GLenum(APIENTRY * qglCheckNamedFramebufferStatus)(GLuint framebuffer, GLenum target);
|
||||
GLvoid(APIENTRY * qglNamedFramebufferTexture2D)(GLuint framebuffer,
|
||||
GLenum attachment, GLenum textarget, GLuint texture, GLint level);
|
||||
GLvoid(APIENTRY * qglNamedFramebufferRenderbuffer)(GLuint framebuffer,
|
||||
GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
|
||||
|
||||
|
||||
static qboolean GLimp_HaveExtension(const char *ext)
|
||||
{
|
||||
// ZTM: FIXME: not elite force specific
|
||||
|
@ -428,7 +470,6 @@ void GLimp_InitExtraExtensions()
|
|||
|
||||
// GL_ARB_shading_language_100
|
||||
extension = "GL_ARB_shading_language_100";
|
||||
glRefConfig.textureFloat = qfalse;
|
||||
if( GLimp_HaveExtension( extension ) )
|
||||
{
|
||||
char version[256];
|
||||
|
@ -587,6 +628,22 @@ void GLimp_InitExtraExtensions()
|
|||
ri.Printf(PRINT_ALL, result[2], extension);
|
||||
}
|
||||
|
||||
// GL_ARB_texture_compression
|
||||
extension = "GL_ARB_texture_compression";
|
||||
glRefConfig.arbTextureCompression = qfalse;
|
||||
if (GLimp_HaveExtension(extension))
|
||||
{
|
||||
qglCompressedTexImage3DARB = (void *)SDL_GL_GetProcAddress("glCompressedTexImage3DARB");
|
||||
qglCompressedTexImage2DARB = (void *)SDL_GL_GetProcAddress("glCompressedTexImage2DARB");
|
||||
qglCompressedTexImage1DARB = (void *)SDL_GL_GetProcAddress("glCompressedTexImage1DARB");
|
||||
qglCompressedTexSubImage3DARB = (void *)SDL_GL_GetProcAddress("glCompressedTexSubImage3DARB");
|
||||
qglCompressedTexSubImage2DARB = (void *)SDL_GL_GetProcAddress("glCompressedTexSubImage2DARB");
|
||||
qglCompressedTexSubImage1DARB = (void *)SDL_GL_GetProcAddress("glCompressedTexSubImage1DARB");
|
||||
qglGetCompressedTexImageARB = (void *)SDL_GL_GetProcAddress("glGetCompressedTexImageARB");
|
||||
glRefConfig.arbTextureCompression = qtrue;
|
||||
ri.Printf(PRINT_ALL, result[glRefConfig.arbTextureCompression], extension);
|
||||
}
|
||||
|
||||
// GL_EXT_framebuffer_multisample
|
||||
extension = "GL_EXT_framebuffer_multisample";
|
||||
glRefConfig.framebufferMultisample = qfalse;
|
||||
|
@ -603,12 +660,12 @@ void GLimp_InitExtraExtensions()
|
|||
|
||||
glRefConfig.textureCompression = TCR_NONE;
|
||||
|
||||
// GL_EXT_texture_compression_latc
|
||||
extension = "GL_EXT_texture_compression_latc";
|
||||
// GL_ARB_texture_compression_rgtc
|
||||
extension = "GL_ARB_texture_compression_rgtc";
|
||||
if (GLimp_HaveExtension(extension))
|
||||
{
|
||||
if (r_ext_compressed_textures->integer)
|
||||
glRefConfig.textureCompression |= TCR_LATC;
|
||||
if (r_ext_compressed_textures->integer && glRefConfig.arbTextureCompression)
|
||||
glRefConfig.textureCompression |= TCR_RGTC;
|
||||
|
||||
ri.Printf(PRINT_ALL, result[r_ext_compressed_textures->integer ? 1 : 0], extension);
|
||||
}
|
||||
|
@ -617,6 +674,8 @@ void GLimp_InitExtraExtensions()
|
|||
ri.Printf(PRINT_ALL, result[2], extension);
|
||||
}
|
||||
|
||||
glRefConfig.swizzleNormalmap = r_ext_compressed_textures->integer && !(glRefConfig.textureCompression & TCR_RGTC);
|
||||
|
||||
// GL_ARB_texture_compression_bptc
|
||||
extension = "GL_ARB_texture_compression_bptc";
|
||||
if (GLimp_HaveExtension(extension))
|
||||
|
@ -631,20 +690,6 @@ void GLimp_InitExtraExtensions()
|
|||
ri.Printf(PRINT_ALL, result[2], extension);
|
||||
}
|
||||
|
||||
// GL_ARB_draw_buffers
|
||||
extension = "GL_ARB_draw_buffers";
|
||||
qglDrawBuffersARB = NULL;
|
||||
if( GLimp_HaveExtension( extension ) )
|
||||
{
|
||||
qglDrawBuffersARB = (void *) SDL_GL_GetProcAddress("glDrawBuffersARB");
|
||||
|
||||
ri.Printf(PRINT_ALL, result[1], extension);
|
||||
}
|
||||
else
|
||||
{
|
||||
ri.Printf(PRINT_ALL, result[2], extension);
|
||||
}
|
||||
|
||||
// GL_ARB_depth_clamp
|
||||
extension = "GL_ARB_depth_clamp";
|
||||
glRefConfig.depthClamp = qfalse;
|
||||
|
@ -734,4 +779,68 @@ void GLimp_InitExtraExtensions()
|
|||
ri.Printf(PRINT_ALL, result[2], extension);
|
||||
}
|
||||
|
||||
// GL_EXT_direct_state_access
|
||||
extension = "GL_EXT_direct_state_access";
|
||||
|
||||
qglBindMultiTexture = GLDSA_BindMultiTexture;
|
||||
qglTextureParameterf = GLDSA_TextureParameterf;
|
||||
qglTextureParameteri = GLDSA_TextureParameteri;
|
||||
qglTextureImage2D = GLDSA_TextureImage2D;
|
||||
qglTextureSubImage2D = GLDSA_TextureSubImage2D;
|
||||
qglCopyTextureImage2D = GLDSA_CopyTextureImage2D;
|
||||
qglCompressedTextureImage2D = GLDSA_CompressedTextureImage2D;
|
||||
qglCompressedTextureSubImage2D = GLDSA_CompressedTextureSubImage2D;
|
||||
qglGenerateTextureMipmap = GLDSA_GenerateTextureMipmap;
|
||||
|
||||
qglProgramUniform1i = GLDSA_ProgramUniform1i;
|
||||
qglProgramUniform1f = GLDSA_ProgramUniform1f;
|
||||
qglProgramUniform2f = GLDSA_ProgramUniform2f;
|
||||
qglProgramUniform3f = GLDSA_ProgramUniform3f;
|
||||
qglProgramUniform4f = GLDSA_ProgramUniform4f;
|
||||
qglProgramUniform1fv = GLDSA_ProgramUniform1fv;
|
||||
qglProgramUniformMatrix4fv = GLDSA_ProgramUniformMatrix4fv;
|
||||
|
||||
qglNamedRenderbufferStorage = GLDSA_NamedRenderbufferStorage;
|
||||
qglNamedRenderbufferStorageMultisample = GLDSA_NamedRenderbufferStorageMultisample;
|
||||
qglCheckNamedFramebufferStatus = GLDSA_CheckNamedFramebufferStatus;
|
||||
qglNamedFramebufferTexture2D = GLDSA_NamedFramebufferTexture2D;
|
||||
qglNamedFramebufferRenderbuffer = GLDSA_NamedFramebufferRenderbuffer;
|
||||
|
||||
glRefConfig.directStateAccess = qfalse;
|
||||
if (GLimp_HaveExtension(extension))
|
||||
{
|
||||
if (r_ext_direct_state_access->integer)
|
||||
{
|
||||
glRefConfig.directStateAccess = qtrue;
|
||||
qglBindMultiTexture = (void *)SDL_GL_GetProcAddress("glBindMultiTextureEXT");
|
||||
qglTextureParameterf = (void *)SDL_GL_GetProcAddress("glTextureParameterfEXT");
|
||||
qglTextureParameteri = (void *)SDL_GL_GetProcAddress("glTextureParameteriEXT");
|
||||
qglTextureImage2D = (void *)SDL_GL_GetProcAddress("glTextureImage2DEXT");
|
||||
qglTextureSubImage2D = (void *)SDL_GL_GetProcAddress("glTextureSubImage2DEXT");
|
||||
qglCopyTextureImage2D = (void *)SDL_GL_GetProcAddress("glCopyTextureImage2DEXT");
|
||||
qglCompressedTextureImage2D = (void *)SDL_GL_GetProcAddress("glCompressedTextureImage2DEXT");
|
||||
qglCompressedTextureSubImage2D = (void *)SDL_GL_GetProcAddress("glCompressedTextureSubImage2DEXT");
|
||||
qglGenerateTextureMipmap = (void *)SDL_GL_GetProcAddress("glGenerateTextureMipmapEXT");
|
||||
|
||||
qglProgramUniform1i = (void *)SDL_GL_GetProcAddress("glProgramUniform1iEXT");
|
||||
qglProgramUniform1f = (void *)SDL_GL_GetProcAddress("glProgramUniform1fEXT");
|
||||
qglProgramUniform2f = (void *)SDL_GL_GetProcAddress("glProgramUniform2fEXT");
|
||||
qglProgramUniform3f = (void *)SDL_GL_GetProcAddress("glProgramUniform3fEXT");
|
||||
qglProgramUniform4f = (void *)SDL_GL_GetProcAddress("glProgramUniform4fEXT");
|
||||
qglProgramUniform1fv = (void *)SDL_GL_GetProcAddress("glProgramUniform1fvEXT");
|
||||
qglProgramUniformMatrix4fv = (void *)SDL_GL_GetProcAddress("glProgramUniformMatrix4fvEXT");
|
||||
|
||||
qglNamedRenderbufferStorage = (void *)SDL_GL_GetProcAddress("glNamedRenderbufferStorageEXT");
|
||||
qglNamedRenderbufferStorageMultisample = (void *)SDL_GL_GetProcAddress("glNamedRenderbufferStorageMultisampleEXT");
|
||||
qglCheckNamedFramebufferStatus = (void *)SDL_GL_GetProcAddress("glCheckNamedFramebufferStatusEXT");
|
||||
qglNamedFramebufferTexture2D = (void *)SDL_GL_GetProcAddress("glNamedFramebufferTexture2DEXT");
|
||||
qglNamedFramebufferRenderbuffer = (void *)SDL_GL_GetProcAddress("glNamedFramebufferRenderbufferEXT");
|
||||
}
|
||||
|
||||
ri.Printf(PRINT_ALL, result[glRefConfig.directStateAccess ? 1 : 0], extension);
|
||||
}
|
||||
else
|
||||
{
|
||||
ri.Printf(PRINT_ALL, result[2], extension);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
// tr_fbo.c
|
||||
#include "tr_local.h"
|
||||
|
||||
#include "tr_dsa.h"
|
||||
|
||||
/*
|
||||
=============
|
||||
R_CheckFBO
|
||||
|
@ -30,19 +32,10 @@ R_CheckFBO
|
|||
*/
|
||||
qboolean R_CheckFBO(const FBO_t * fbo)
|
||||
{
|
||||
int code;
|
||||
int id;
|
||||
|
||||
qglGetIntegerv(GL_FRAMEBUFFER_BINDING_EXT, &id);
|
||||
qglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo->frameBuffer);
|
||||
|
||||
code = qglCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
|
||||
GLenum code = qglCheckNamedFramebufferStatus(fbo->frameBuffer, GL_FRAMEBUFFER_EXT);
|
||||
|
||||
if(code == GL_FRAMEBUFFER_COMPLETE_EXT)
|
||||
{
|
||||
qglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, id);
|
||||
return qtrue;
|
||||
}
|
||||
|
||||
// an error occured
|
||||
switch (code)
|
||||
|
@ -83,13 +76,9 @@ qboolean R_CheckFBO(const FBO_t * fbo)
|
|||
|
||||
default:
|
||||
ri.Printf(PRINT_WARNING, "R_CheckFBO: (%s) unknown error 0x%X\n", fbo->name, code);
|
||||
//ri.Error(ERR_FATAL, "R_CheckFBO: (%s) unknown error 0x%X", fbo->name, code);
|
||||
//assert(0);
|
||||
break;
|
||||
}
|
||||
|
||||
qglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, id);
|
||||
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
|
@ -133,6 +122,11 @@ FBO_t *FBO_Create(const char *name, int width, int height)
|
|||
return fbo;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
FBO_CreateBuffer
|
||||
=================
|
||||
*/
|
||||
void FBO_CreateBuffer(FBO_t *fbo, int format, int index, int multisample)
|
||||
{
|
||||
uint32_t *pRenderBuffer;
|
||||
|
@ -189,115 +183,45 @@ void FBO_CreateBuffer(FBO_t *fbo, int format, int index, int multisample)
|
|||
if (absent)
|
||||
qglGenRenderbuffersEXT(1, pRenderBuffer);
|
||||
|
||||
qglBindRenderbufferEXT(GL_RENDERBUFFER_EXT, *pRenderBuffer);
|
||||
if (multisample && glRefConfig.framebufferMultisample)
|
||||
{
|
||||
qglRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT, multisample, format, fbo->width, fbo->height);
|
||||
}
|
||||
qglNamedRenderbufferStorageMultisample(*pRenderBuffer, multisample, format, fbo->width, fbo->height);
|
||||
else
|
||||
{
|
||||
qglRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, format, fbo->width, fbo->height);
|
||||
}
|
||||
qglNamedRenderbufferStorage(*pRenderBuffer, format, fbo->width, fbo->height);
|
||||
|
||||
if(absent)
|
||||
{
|
||||
if (attachment == 0)
|
||||
{
|
||||
qglFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, *pRenderBuffer);
|
||||
qglFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, *pRenderBuffer);
|
||||
qglNamedFramebufferRenderbuffer(fbo->frameBuffer, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, *pRenderBuffer);
|
||||
qglNamedFramebufferRenderbuffer(fbo->frameBuffer, GL_STENCIL_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, *pRenderBuffer);
|
||||
}
|
||||
else
|
||||
qglFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, attachment, GL_RENDERBUFFER_EXT, *pRenderBuffer);
|
||||
{
|
||||
qglNamedFramebufferRenderbuffer(fbo->frameBuffer, attachment, GL_RENDERBUFFER_EXT, *pRenderBuffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
=================
|
||||
R_AttachFBOTexture1D
|
||||
FBO_AttachImage
|
||||
=================
|
||||
*/
|
||||
void R_AttachFBOTexture1D(int texId, int index)
|
||||
void FBO_AttachImage(FBO_t *fbo, image_t *image, GLenum attachment, GLuint cubemapside)
|
||||
{
|
||||
if(index < 0 || index >= glRefConfig.maxColorAttachments)
|
||||
{
|
||||
ri.Printf(PRINT_WARNING, "R_AttachFBOTexture1D: invalid attachment index %i\n", index);
|
||||
return;
|
||||
}
|
||||
GLenum target = GL_TEXTURE_2D;
|
||||
int index;
|
||||
|
||||
qglFramebufferTexture1DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT + index, GL_TEXTURE_1D, texId, 0);
|
||||
if (image->flags & IMGFLAG_CUBEMAP)
|
||||
target = GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB + cubemapside;
|
||||
|
||||
qglNamedFramebufferTexture2D(fbo->frameBuffer, attachment, target, image->texnum, 0);
|
||||
index = attachment - GL_COLOR_ATTACHMENT0_EXT;
|
||||
if (index >= 0 && index <= 15)
|
||||
fbo->colorImage[index] = image;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
R_AttachFBOTexture2D
|
||||
=================
|
||||
*/
|
||||
void R_AttachFBOTexture2D(int target, int texId, int index)
|
||||
{
|
||||
if(target != GL_TEXTURE_2D && (target < GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB || target > GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB))
|
||||
{
|
||||
ri.Printf(PRINT_WARNING, "R_AttachFBOTexture2D: invalid target %i\n", target);
|
||||
return;
|
||||
}
|
||||
|
||||
if(index < 0 || index >= glRefConfig.maxColorAttachments)
|
||||
{
|
||||
ri.Printf(PRINT_WARNING, "R_AttachFBOTexture2D: invalid attachment index %i\n", index);
|
||||
return;
|
||||
}
|
||||
|
||||
qglFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT + index, target, texId, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
R_AttachFBOTexture3D
|
||||
=================
|
||||
*/
|
||||
void R_AttachFBOTexture3D(int texId, int index, int zOffset)
|
||||
{
|
||||
if(index < 0 || index >= glRefConfig.maxColorAttachments)
|
||||
{
|
||||
ri.Printf(PRINT_WARNING, "R_AttachFBOTexture3D: invalid attachment index %i\n", index);
|
||||
return;
|
||||
}
|
||||
|
||||
qglFramebufferTexture3DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT + index, GL_TEXTURE_3D_EXT, texId, 0, zOffset);
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
R_AttachFBOTextureDepth
|
||||
=================
|
||||
*/
|
||||
void R_AttachFBOTextureDepth(int texId)
|
||||
{
|
||||
qglFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_TEXTURE_2D, texId, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
R_AttachFBOTexturePackedDepthStencil
|
||||
=================
|
||||
*/
|
||||
void R_AttachFBOTexturePackedDepthStencil(int texId)
|
||||
{
|
||||
qglFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_TEXTURE_2D, texId, 0);
|
||||
qglFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT, GL_TEXTURE_2D, texId, 0);
|
||||
}
|
||||
|
||||
void FBO_AttachTextureImage(image_t *img, int index)
|
||||
{
|
||||
if (!glState.currentFBO)
|
||||
{
|
||||
ri.Printf(PRINT_WARNING, "FBO: attempted to attach a texture image with no FBO bound!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
R_AttachFBOTexture2D(GL_TEXTURE_2D, img->texnum, index);
|
||||
glState.currentFBO->colorImage[index] = img;
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
|
@ -312,38 +236,10 @@ void FBO_Bind(FBO_t * fbo)
|
|||
if (r_logFile->integer)
|
||||
{
|
||||
// don't just call LogComment, or we will get a call to va() every frame!
|
||||
if (fbo)
|
||||
GLimp_LogComment(va("--- FBO_Bind( %s ) ---\n", fbo->name));
|
||||
else
|
||||
GLimp_LogComment("--- FBO_Bind ( NULL ) ---\n");
|
||||
GLimp_LogComment(va("--- FBO_Bind( %s ) ---\n", fbo ? fbo->name : "NULL"));
|
||||
}
|
||||
|
||||
if (!fbo)
|
||||
{
|
||||
qglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
|
||||
//qglBindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0);
|
||||
glState.currentFBO = NULL;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
qglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo->frameBuffer);
|
||||
|
||||
/*
|
||||
if(fbo->colorBuffers[0])
|
||||
{
|
||||
qglBindRenderbufferEXT(GL_RENDERBUFFER_EXT, fbo->colorBuffers[0]);
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
if(fbo->depthBuffer)
|
||||
{
|
||||
qglBindRenderbufferEXT(GL_RENDERBUFFER_EXT, fbo->depthBuffer);
|
||||
qglFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, fbo->depthBuffer);
|
||||
}
|
||||
*/
|
||||
|
||||
GL_BindFramebuffer(GL_FRAMEBUFFER_EXT, fbo ? fbo->frameBuffer : 0);
|
||||
glState.currentFBO = fbo;
|
||||
}
|
||||
|
||||
|
@ -355,8 +251,7 @@ FBO_Init
|
|||
void FBO_Init(void)
|
||||
{
|
||||
int i;
|
||||
// int width, height, hdrFormat, multisample;
|
||||
int hdrFormat, multisample;
|
||||
int hdrFormat, multisample = 0;
|
||||
|
||||
ri.Printf(PRINT_ALL, "------- FBO_Init -------\n");
|
||||
|
||||
|
@ -369,73 +264,41 @@ void FBO_Init(void)
|
|||
|
||||
R_IssuePendingRenderCommands();
|
||||
|
||||
/* if(glRefConfig.textureNonPowerOfTwo)
|
||||
{
|
||||
width = glConfig.vidWidth;
|
||||
height = glConfig.vidHeight;
|
||||
}
|
||||
else
|
||||
{
|
||||
width = NextPowerOfTwo(glConfig.vidWidth);
|
||||
height = NextPowerOfTwo(glConfig.vidHeight);
|
||||
} */
|
||||
|
||||
hdrFormat = GL_RGBA8;
|
||||
if (r_hdr->integer && glRefConfig.framebufferObject && glRefConfig.textureFloat)
|
||||
{
|
||||
hdrFormat = GL_RGBA16F_ARB;
|
||||
}
|
||||
|
||||
qglGetIntegerv(GL_MAX_SAMPLES_EXT, &multisample);
|
||||
if (glRefConfig.framebufferMultisample)
|
||||
qglGetIntegerv(GL_MAX_SAMPLES_EXT, &multisample);
|
||||
|
||||
if (r_ext_framebuffer_multisample->integer < multisample)
|
||||
{
|
||||
multisample = r_ext_framebuffer_multisample->integer;
|
||||
}
|
||||
|
||||
if (multisample < 2 || !glRefConfig.framebufferBlit)
|
||||
multisample = 0;
|
||||
|
||||
if (multisample != r_ext_framebuffer_multisample->integer)
|
||||
{
|
||||
ri.Cvar_SetValue("r_ext_framebuffer_multisample", (float)multisample);
|
||||
}
|
||||
|
||||
// only create a render FBO if we need to resolve MSAA or do HDR
|
||||
// otherwise just render straight to the screen (tr.renderFbo = NULL)
|
||||
if (multisample && glRefConfig.framebufferMultisample)
|
||||
{
|
||||
tr.renderFbo = FBO_Create("_render", tr.renderDepthImage->width, tr.renderDepthImage->height);
|
||||
FBO_Bind(tr.renderFbo);
|
||||
|
||||
FBO_CreateBuffer(tr.renderFbo, hdrFormat, 0, multisample);
|
||||
FBO_CreateBuffer(tr.renderFbo, GL_DEPTH_COMPONENT24_ARB, 0, multisample);
|
||||
|
||||
R_CheckFBO(tr.renderFbo);
|
||||
|
||||
|
||||
tr.msaaResolveFbo = FBO_Create("_msaaResolve", tr.renderDepthImage->width, tr.renderDepthImage->height);
|
||||
FBO_Bind(tr.msaaResolveFbo);
|
||||
|
||||
//FBO_CreateBuffer(tr.msaaResolveFbo, hdrFormat, 0, 0);
|
||||
FBO_AttachTextureImage(tr.renderImage, 0);
|
||||
|
||||
//FBO_CreateBuffer(tr.msaaResolveFbo, GL_DEPTH_COMPONENT24_ARB, 0, 0);
|
||||
R_AttachFBOTextureDepth(tr.renderDepthImage->texnum);
|
||||
|
||||
FBO_AttachImage(tr.msaaResolveFbo, tr.renderImage, GL_COLOR_ATTACHMENT0_EXT, 0);
|
||||
FBO_AttachImage(tr.msaaResolveFbo, tr.renderDepthImage, GL_DEPTH_ATTACHMENT_EXT, 0);
|
||||
R_CheckFBO(tr.msaaResolveFbo);
|
||||
}
|
||||
else if (r_hdr->integer)
|
||||
{
|
||||
tr.renderFbo = FBO_Create("_render", tr.renderDepthImage->width, tr.renderDepthImage->height);
|
||||
FBO_Bind(tr.renderFbo);
|
||||
|
||||
//FBO_CreateBuffer(tr.renderFbo, hdrFormat, 0, 0);
|
||||
FBO_AttachTextureImage(tr.renderImage, 0);
|
||||
|
||||
//FBO_CreateBuffer(tr.renderFbo, GL_DEPTH_COMPONENT24_ARB, 0, 0);
|
||||
R_AttachFBOTextureDepth(tr.renderDepthImage->texnum);
|
||||
|
||||
FBO_AttachImage(tr.renderFbo, tr.renderImage, GL_COLOR_ATTACHMENT0_EXT, 0);
|
||||
FBO_AttachImage(tr.renderFbo, tr.renderDepthImage, GL_DEPTH_ATTACHMENT_EXT, 0);
|
||||
R_CheckFBO(tr.renderFbo);
|
||||
}
|
||||
|
||||
|
@ -443,20 +306,23 @@ void FBO_Init(void)
|
|||
// this fixes the corrupt screen bug with r_hdr 1 on older hardware
|
||||
if (tr.renderFbo)
|
||||
{
|
||||
FBO_Bind(tr.renderFbo);
|
||||
GL_BindFramebuffer(GL_FRAMEBUFFER_EXT, tr.renderFbo->frameBuffer);
|
||||
qglClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
|
||||
FBO_Bind(NULL);
|
||||
}
|
||||
|
||||
if (r_drawSunRays->integer)
|
||||
if (tr.screenScratchImage)
|
||||
{
|
||||
tr.screenScratchFbo = FBO_Create("screenScratch", tr.screenScratchImage->width, tr.screenScratchImage->height);
|
||||
FBO_AttachImage(tr.screenScratchFbo, tr.screenScratchImage, GL_COLOR_ATTACHMENT0_EXT, 0);
|
||||
FBO_AttachImage(tr.screenScratchFbo, tr.renderDepthImage, GL_DEPTH_ATTACHMENT_EXT, 0);
|
||||
R_CheckFBO(tr.screenScratchFbo);
|
||||
}
|
||||
|
||||
if (tr.sunRaysImage)
|
||||
{
|
||||
tr.sunRaysFbo = FBO_Create("_sunRays", tr.renderDepthImage->width, tr.renderDepthImage->height);
|
||||
FBO_Bind(tr.sunRaysFbo);
|
||||
|
||||
FBO_AttachTextureImage(tr.sunRaysImage, 0);
|
||||
|
||||
R_AttachFBOTextureDepth(tr.renderDepthImage->texnum);
|
||||
|
||||
FBO_AttachImage(tr.sunRaysFbo, tr.sunRaysImage, GL_COLOR_ATTACHMENT0_EXT, 0);
|
||||
FBO_AttachImage(tr.sunRaysFbo, tr.renderDepthImage, GL_DEPTH_ATTACHMENT_EXT, 0);
|
||||
R_CheckFBO(tr.sunRaysFbo);
|
||||
}
|
||||
|
||||
|
@ -466,121 +332,92 @@ void FBO_Init(void)
|
|||
for( i = 0; i < MAX_DRAWN_PSHADOWS; i++)
|
||||
{
|
||||
tr.pshadowFbos[i] = FBO_Create(va("_shadowmap%d", i), tr.pshadowMaps[i]->width, tr.pshadowMaps[i]->height);
|
||||
FBO_Bind(tr.pshadowFbos[i]);
|
||||
|
||||
//FBO_CreateBuffer(tr.pshadowFbos[i], GL_RGBA8, 0, 0);
|
||||
FBO_AttachTextureImage(tr.pshadowMaps[i], 0);
|
||||
|
||||
FBO_AttachImage(tr.pshadowFbos[i], tr.pshadowMaps[i], GL_COLOR_ATTACHMENT0_EXT, 0);
|
||||
FBO_CreateBuffer(tr.pshadowFbos[i], GL_DEPTH_COMPONENT24_ARB, 0, 0);
|
||||
//R_AttachFBOTextureDepth(tr.textureDepthImage->texnum);
|
||||
|
||||
R_CheckFBO(tr.pshadowFbos[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (tr.sunShadowDepthImage[0])
|
||||
{
|
||||
for ( i = 0; i < 4; i++)
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
tr.sunShadowFbo[i] = FBO_Create("_sunshadowmap", tr.sunShadowDepthImage[i]->width, tr.sunShadowDepthImage[i]->height);
|
||||
FBO_Bind(tr.sunShadowFbo[i]);
|
||||
|
||||
//FBO_CreateBuffer(tr.sunShadowFbo[i], GL_RGBA8, 0, 0);
|
||||
//FBO_AttachTextureImage(tr.sunShadowImage, 0);
|
||||
qglDrawBuffer(GL_NONE);
|
||||
qglReadBuffer(GL_NONE);
|
||||
|
||||
//FBO_CreateBuffer(tr.sunShadowFbo, GL_DEPTH_COMPONENT24_ARB, 0, 0);
|
||||
R_AttachFBOTextureDepth(tr.sunShadowDepthImage[i]->texnum);
|
||||
|
||||
// FIXME: this next line wastes 16mb with 4x1024x1024 sun shadow maps, skip if OpenGL 4.3+ or ARB_framebuffer_no_attachments
|
||||
// This at least gets sun shadows working on older GPUs (Intel)
|
||||
FBO_CreateBuffer(tr.sunShadowFbo[i], GL_RGBA8, 0, 0);
|
||||
FBO_AttachImage(tr.sunShadowFbo[i], tr.sunShadowDepthImage[i], GL_DEPTH_ATTACHMENT_EXT, 0);
|
||||
R_CheckFBO(tr.sunShadowFbo[i]);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (tr.screenShadowImage)
|
||||
{
|
||||
tr.screenShadowFbo = FBO_Create("_screenshadow", tr.screenShadowImage->width, tr.screenShadowImage->height);
|
||||
FBO_Bind(tr.screenShadowFbo);
|
||||
|
||||
FBO_AttachTextureImage(tr.screenShadowImage, 0);
|
||||
|
||||
FBO_AttachImage(tr.screenShadowFbo, tr.screenShadowImage, GL_COLOR_ATTACHMENT0_EXT, 0);
|
||||
R_CheckFBO(tr.screenShadowFbo);
|
||||
}
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
if (tr.textureScratchImage[0])
|
||||
{
|
||||
tr.textureScratchFbo[i] = FBO_Create(va("_texturescratch%d", i), tr.textureScratchImage[i]->width, tr.textureScratchImage[i]->height);
|
||||
FBO_Bind(tr.textureScratchFbo[i]);
|
||||
|
||||
//FBO_CreateBuffer(tr.textureScratchFbo[i], GL_RGBA8, 0, 0);
|
||||
FBO_AttachTextureImage(tr.textureScratchImage[i], 0);
|
||||
|
||||
R_CheckFBO(tr.textureScratchFbo[i]);
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
tr.textureScratchFbo[i] = FBO_Create(va("_texturescratch%d", i), tr.textureScratchImage[i]->width, tr.textureScratchImage[i]->height);
|
||||
FBO_AttachImage(tr.textureScratchFbo[i], tr.textureScratchImage[i], GL_COLOR_ATTACHMENT0_EXT, 0);
|
||||
R_CheckFBO(tr.textureScratchFbo[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (tr.calcLevelsImage)
|
||||
{
|
||||
tr.calcLevelsFbo = FBO_Create("_calclevels", tr.calcLevelsImage->width, tr.calcLevelsImage->height);
|
||||
FBO_Bind(tr.calcLevelsFbo);
|
||||
|
||||
//FBO_CreateBuffer(tr.calcLevelsFbo, hdrFormat, 0, 0);
|
||||
FBO_AttachTextureImage(tr.calcLevelsImage, 0);
|
||||
|
||||
FBO_AttachImage(tr.calcLevelsFbo, tr.calcLevelsImage, GL_COLOR_ATTACHMENT0_EXT, 0);
|
||||
R_CheckFBO(tr.calcLevelsFbo);
|
||||
}
|
||||
|
||||
if (tr.targetLevelsImage)
|
||||
{
|
||||
tr.targetLevelsFbo = FBO_Create("_targetlevels", tr.targetLevelsImage->width, tr.targetLevelsImage->height);
|
||||
FBO_Bind(tr.targetLevelsFbo);
|
||||
|
||||
//FBO_CreateBuffer(tr.targetLevelsFbo, hdrFormat, 0, 0);
|
||||
FBO_AttachTextureImage(tr.targetLevelsImage, 0);
|
||||
|
||||
FBO_AttachImage(tr.targetLevelsFbo, tr.targetLevelsImage, GL_COLOR_ATTACHMENT0_EXT, 0);
|
||||
R_CheckFBO(tr.targetLevelsFbo);
|
||||
}
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
if (tr.quarterImage[0])
|
||||
{
|
||||
tr.quarterFbo[i] = FBO_Create(va("_quarter%d", i), tr.quarterImage[i]->width, tr.quarterImage[i]->height);
|
||||
FBO_Bind(tr.quarterFbo[i]);
|
||||
|
||||
//FBO_CreateBuffer(tr.quarterFbo[i], hdrFormat, 0, 0);
|
||||
FBO_AttachTextureImage(tr.quarterImage[i], 0);
|
||||
|
||||
R_CheckFBO(tr.quarterFbo[i]);
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
tr.quarterFbo[i] = FBO_Create(va("_quarter%d", i), tr.quarterImage[i]->width, tr.quarterImage[i]->height);
|
||||
FBO_AttachImage(tr.quarterFbo[i], tr.quarterImage[i], GL_COLOR_ATTACHMENT0_EXT, 0);
|
||||
R_CheckFBO(tr.quarterFbo[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (r_ssao->integer)
|
||||
if (tr.hdrDepthImage)
|
||||
{
|
||||
tr.hdrDepthFbo = FBO_Create("_hdrDepth", tr.hdrDepthImage->width, tr.hdrDepthImage->height);
|
||||
FBO_Bind(tr.hdrDepthFbo);
|
||||
|
||||
FBO_AttachTextureImage(tr.hdrDepthImage, 0);
|
||||
|
||||
FBO_AttachImage(tr.hdrDepthFbo, tr.hdrDepthImage, GL_COLOR_ATTACHMENT0_EXT, 0);
|
||||
R_CheckFBO(tr.hdrDepthFbo);
|
||||
}
|
||||
|
||||
if (tr.screenSsaoImage)
|
||||
{
|
||||
tr.screenSsaoFbo = FBO_Create("_screenssao", tr.screenSsaoImage->width, tr.screenSsaoImage->height);
|
||||
FBO_Bind(tr.screenSsaoFbo);
|
||||
|
||||
FBO_AttachTextureImage(tr.screenSsaoImage, 0);
|
||||
|
||||
FBO_AttachImage(tr.screenSsaoFbo, tr.screenSsaoImage, GL_COLOR_ATTACHMENT0_EXT, 0);
|
||||
R_CheckFBO(tr.screenSsaoFbo);
|
||||
}
|
||||
|
||||
if (tr.renderCubeImage)
|
||||
{
|
||||
tr.renderCubeFbo = FBO_Create("_renderCubeFbo", tr.renderCubeImage->width, tr.renderCubeImage->height);
|
||||
FBO_Bind(tr.renderCubeFbo);
|
||||
|
||||
//FBO_AttachTextureImage(tr.renderCubeImage, 0);
|
||||
R_AttachFBOTexture2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB, tr.renderCubeImage->texnum, 0);
|
||||
glState.currentFBO->colorImage[0] = tr.renderCubeImage;
|
||||
|
||||
FBO_AttachImage(tr.renderCubeFbo, tr.renderCubeImage, GL_COLOR_ATTACHMENT0_EXT, 0);
|
||||
FBO_CreateBuffer(tr.renderCubeFbo, GL_DEPTH_COMPONENT24_ARB, 0, 0);
|
||||
|
||||
R_CheckFBO(tr.renderCubeFbo);
|
||||
}
|
||||
|
||||
GL_CheckErrors();
|
||||
|
||||
FBO_Bind(NULL);
|
||||
GL_BindFramebuffer(GL_FRAMEBUFFER_EXT, 0);
|
||||
glState.currentFBO = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -650,10 +487,9 @@ void R_FBOList_f(void)
|
|||
ri.Printf(PRINT_ALL, " %i FBOs\n", tr.numFBOs);
|
||||
}
|
||||
|
||||
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)
|
||||
void FBO_BlitFromTexture(struct image_s *src, vec4_t inSrcTexCorners, vec2_t inSrcTexScale, FBO_t *dst, ivec4_t inDstBox, struct shaderProgram_s *shaderProgram, vec4_t inColor, int blend)
|
||||
{
|
||||
ivec4_t dstBox, srcBox;
|
||||
vec2_t srcTexScale;
|
||||
ivec4_t dstBox;
|
||||
vec4_t color;
|
||||
vec4_t quadVerts[4];
|
||||
vec2_t texCoords[4];
|
||||
|
@ -663,51 +499,49 @@ void FBO_BlitFromTexture(struct image_s *src, ivec4_t inSrcBox, vec2_t inSrcTexS
|
|||
int width, height;
|
||||
|
||||
if (!src)
|
||||
return;
|
||||
|
||||
if (inSrcBox)
|
||||
{
|
||||
VectorSet4(srcBox, inSrcBox[0], inSrcBox[1], inSrcBox[0] + inSrcBox[2], inSrcBox[1] + inSrcBox[3]);
|
||||
ri.Printf(PRINT_WARNING, "Tried to blit from a NULL texture!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
width = dst ? dst->width : glConfig.vidWidth;
|
||||
height = dst ? dst->height : glConfig.vidHeight;
|
||||
|
||||
if (inSrcTexCorners)
|
||||
{
|
||||
VectorSet2(texCoords[0], inSrcTexCorners[0], inSrcTexCorners[1]);
|
||||
VectorSet2(texCoords[1], inSrcTexCorners[2], inSrcTexCorners[1]);
|
||||
VectorSet2(texCoords[2], inSrcTexCorners[2], inSrcTexCorners[3]);
|
||||
VectorSet2(texCoords[3], inSrcTexCorners[0], inSrcTexCorners[3]);
|
||||
}
|
||||
else
|
||||
{
|
||||
VectorSet4(srcBox, 0, 0, src->width, src->height);
|
||||
VectorSet2(texCoords[0], 0.0f, 1.0f);
|
||||
VectorSet2(texCoords[1], 1.0f, 1.0f);
|
||||
VectorSet2(texCoords[2], 1.0f, 0.0f);
|
||||
VectorSet2(texCoords[3], 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
// framebuffers are 0 bottom, Y up.
|
||||
if (inDstBox)
|
||||
{
|
||||
if (dst)
|
||||
{
|
||||
dstBox[0] = inDstBox[0];
|
||||
dstBox[1] = dst->height - inDstBox[1] - inDstBox[3];
|
||||
dstBox[2] = inDstBox[0] + inDstBox[2];
|
||||
dstBox[3] = dst->height - inDstBox[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
dstBox[0] = inDstBox[0];
|
||||
dstBox[1] = glConfig.vidHeight - inDstBox[1] - inDstBox[3];
|
||||
dstBox[2] = inDstBox[0] + inDstBox[2];
|
||||
dstBox[3] = glConfig.vidHeight - inDstBox[1];
|
||||
}
|
||||
}
|
||||
else if (dst)
|
||||
{
|
||||
VectorSet4(dstBox, 0, dst->height, dst->width, 0);
|
||||
dstBox[0] = inDstBox[0];
|
||||
dstBox[1] = height - inDstBox[1] - inDstBox[3];
|
||||
dstBox[2] = inDstBox[0] + inDstBox[2];
|
||||
dstBox[3] = height - inDstBox[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
VectorSet4(dstBox, 0, glConfig.vidHeight, glConfig.vidWidth, 0);
|
||||
VectorSet4(dstBox, 0, height, width, 0);
|
||||
}
|
||||
|
||||
if (inSrcTexScale)
|
||||
{
|
||||
VectorCopy2(inSrcTexScale, srcTexScale);
|
||||
VectorCopy2(inSrcTexScale, invTexRes);
|
||||
}
|
||||
else
|
||||
{
|
||||
srcTexScale[0] = srcTexScale[1] = 1.0f;
|
||||
VectorSet2(invTexRes, 1.0f, 1.0f);
|
||||
}
|
||||
|
||||
if (inColor)
|
||||
|
@ -726,17 +560,6 @@ void FBO_BlitFromTexture(struct image_s *src, ivec4_t inSrcBox, vec2_t inSrcTexS
|
|||
|
||||
FBO_Bind(dst);
|
||||
|
||||
if (glState.currentFBO)
|
||||
{
|
||||
width = glState.currentFBO->width;
|
||||
height = glState.currentFBO->height;
|
||||
}
|
||||
else
|
||||
{
|
||||
width = glConfig.vidWidth;
|
||||
height = glConfig.vidHeight;
|
||||
}
|
||||
|
||||
qglViewport( 0, 0, width, height );
|
||||
qglScissor( 0, 0, width, height );
|
||||
|
||||
|
@ -746,18 +569,13 @@ void FBO_BlitFromTexture(struct image_s *src, ivec4_t inSrcBox, vec2_t inSrcTexS
|
|||
|
||||
GL_BindToTMU(src, TB_COLORMAP);
|
||||
|
||||
VectorSet4(quadVerts[0], dstBox[0], dstBox[1], 0, 1);
|
||||
VectorSet4(quadVerts[1], dstBox[2], dstBox[1], 0, 1);
|
||||
VectorSet4(quadVerts[2], dstBox[2], dstBox[3], 0, 1);
|
||||
VectorSet4(quadVerts[3], dstBox[0], dstBox[3], 0, 1);
|
||||
VectorSet4(quadVerts[0], dstBox[0], dstBox[1], 0.0f, 1.0f);
|
||||
VectorSet4(quadVerts[1], dstBox[2], dstBox[1], 0.0f, 1.0f);
|
||||
VectorSet4(quadVerts[2], dstBox[2], dstBox[3], 0.0f, 1.0f);
|
||||
VectorSet4(quadVerts[3], dstBox[0], dstBox[3], 0.0f, 1.0f);
|
||||
|
||||
texCoords[0][0] = srcBox[0] / (float)src->width; texCoords[0][1] = 1.0f - srcBox[1] / (float)src->height;
|
||||
texCoords[1][0] = srcBox[2] / (float)src->width; texCoords[1][1] = 1.0f - srcBox[1] / (float)src->height;
|
||||
texCoords[2][0] = srcBox[2] / (float)src->width; texCoords[2][1] = 1.0f - srcBox[3] / (float)src->height;
|
||||
texCoords[3][0] = srcBox[0] / (float)src->width; texCoords[3][1] = 1.0f - srcBox[3] / (float)src->height;
|
||||
|
||||
invTexRes[0] = 1.0f / src->width * srcTexScale[0];
|
||||
invTexRes[1] = 1.0f / src->height * srcTexScale[1];
|
||||
invTexRes[0] /= src->width;
|
||||
invTexRes[1] /= src->height;
|
||||
|
||||
GL_State( blend );
|
||||
|
||||
|
@ -769,14 +587,14 @@ void FBO_BlitFromTexture(struct image_s *src, ivec4_t inSrcBox, vec2_t inSrcTexS
|
|||
GLSL_SetUniformVec2(shaderProgram, UNIFORM_AUTOEXPOSUREMINMAX, tr.refdef.autoExposureMinMax);
|
||||
GLSL_SetUniformVec3(shaderProgram, UNIFORM_TONEMINAVGMAXLINEAR, tr.refdef.toneMinAvgMaxLinear);
|
||||
|
||||
RB_InstantQuad2(quadVerts, texCoords); //, color, shaderProgram, invTexRes);
|
||||
RB_InstantQuad2(quadVerts, texCoords);
|
||||
|
||||
FBO_Bind(oldFbo);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
ivec4_t srcBox;
|
||||
vec4_t srcTexCorners;
|
||||
|
||||
if (!src)
|
||||
{
|
||||
|
@ -784,20 +602,19 @@ void FBO_Blit(FBO_t *src, ivec4_t inSrcBox, vec2_t srcTexScale, FBO_t *dst, ivec
|
|||
return;
|
||||
}
|
||||
|
||||
// framebuffers are 0 bottom, Y up.
|
||||
if (inSrcBox)
|
||||
{
|
||||
srcBox[0] = inSrcBox[0];
|
||||
srcBox[1] = src->height - inSrcBox[1] - inSrcBox[3];
|
||||
srcBox[2] = inSrcBox[2];
|
||||
srcBox[3] = inSrcBox[3];
|
||||
srcTexCorners[0] = inSrcBox[0] / (float)src->width;
|
||||
srcTexCorners[1] = (inSrcBox[1] + inSrcBox[3]) / (float)src->height;
|
||||
srcTexCorners[2] = (inSrcBox[0] + inSrcBox[2]) / (float)src->width;
|
||||
srcTexCorners[3] = inSrcBox[1] / (float)src->height;
|
||||
}
|
||||
else
|
||||
{
|
||||
VectorSet4(srcBox, 0, src->height, src->width, -src->height);
|
||||
VectorSet4(srcTexCorners, 0.0f, 0.0f, 1.0f, 1.0f);
|
||||
}
|
||||
|
||||
FBO_BlitFromTexture(src->colorImage[0], srcBox, srcTexScale, dst, dstBox, shaderProgram, color, blend | GLS_DEPTHTEST_DISABLE);
|
||||
FBO_BlitFromTexture(src->colorImage[0], srcTexCorners, srcTexScale, dst, dstBox, shaderProgram, color, blend | GLS_DEPTHTEST_DISABLE);
|
||||
}
|
||||
|
||||
void FBO_FastBlit(FBO_t *src, ivec4_t srcBox, FBO_t *dst, ivec4_t dstBox, int buffers, int filter)
|
||||
|
@ -811,22 +628,15 @@ void FBO_FastBlit(FBO_t *src, ivec4_t srcBox, FBO_t *dst, ivec4_t dstBox, int bu
|
|||
return;
|
||||
}
|
||||
|
||||
// get to a neutral state first
|
||||
//FBO_Bind(NULL);
|
||||
|
||||
srcFb = src ? src->frameBuffer : 0;
|
||||
dstFb = dst ? dst->frameBuffer : 0;
|
||||
|
||||
if (!srcBox)
|
||||
{
|
||||
if (src)
|
||||
{
|
||||
VectorSet4(srcBoxFinal, 0, 0, src->width, src->height);
|
||||
}
|
||||
else
|
||||
{
|
||||
VectorSet4(srcBoxFinal, 0, 0, glConfig.vidWidth, glConfig.vidHeight);
|
||||
}
|
||||
int width = src ? src->width : glConfig.vidWidth;
|
||||
int height = src ? src->height : glConfig.vidHeight;
|
||||
|
||||
VectorSet4(srcBoxFinal, 0, 0, width, height);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -835,26 +645,22 @@ void FBO_FastBlit(FBO_t *src, ivec4_t srcBox, FBO_t *dst, ivec4_t dstBox, int bu
|
|||
|
||||
if (!dstBox)
|
||||
{
|
||||
if (dst)
|
||||
{
|
||||
VectorSet4(dstBoxFinal, 0, 0, dst->width, dst->height);
|
||||
}
|
||||
else
|
||||
{
|
||||
VectorSet4(dstBoxFinal, 0, 0, glConfig.vidWidth, glConfig.vidHeight);
|
||||
}
|
||||
int width = dst ? dst->width : glConfig.vidWidth;
|
||||
int height = dst ? dst->height : glConfig.vidHeight;
|
||||
|
||||
VectorSet4(dstBoxFinal, 0, 0, width, height);
|
||||
}
|
||||
else
|
||||
{
|
||||
VectorSet4(dstBoxFinal, dstBox[0], dstBox[1], dstBox[0] + dstBox[2], dstBox[1] + dstBox[3]);
|
||||
}
|
||||
|
||||
qglBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, srcFb);
|
||||
qglBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, dstFb);
|
||||
GL_BindFramebuffer(GL_READ_FRAMEBUFFER_EXT, srcFb);
|
||||
GL_BindFramebuffer(GL_DRAW_FRAMEBUFFER_EXT, dstFb);
|
||||
qglBlitFramebufferEXT(srcBoxFinal[0], srcBoxFinal[1], srcBoxFinal[2], srcBoxFinal[3],
|
||||
dstBoxFinal[0], dstBoxFinal[1], dstBoxFinal[2], dstBoxFinal[3],
|
||||
buffers, filter);
|
||||
|
||||
qglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
|
||||
GL_BindFramebuffer(GL_FRAMEBUFFER_EXT, 0);
|
||||
glState.currentFBO = NULL;
|
||||
}
|
||||
|
|
|
@ -52,11 +52,12 @@ typedef struct FBO_s
|
|||
int height;
|
||||
} FBO_t;
|
||||
|
||||
void FBO_AttachImage(FBO_t *fbo, image_t *image, GLenum attachment, GLuint cubemapside);
|
||||
void FBO_Bind(FBO_t *fbo);
|
||||
void FBO_Init(void);
|
||||
void FBO_Shutdown(void);
|
||||
|
||||
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_BlitFromTexture(struct image_s *src, vec4_t inSrcTexCorners, vec2_t inSrcTexScale, FBO_t *dst, ivec4_t inDstBox, struct shaderProgram_s *shaderProgram, vec4_t inColor, 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);
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
// tr_glsl.c
|
||||
#include "tr_local.h"
|
||||
|
||||
void GLSL_BindNullProgram(void);
|
||||
#include "tr_dsa.h"
|
||||
|
||||
extern const char *fallbackShader_bokeh_vp;
|
||||
extern const char *fallbackShader_bokeh_fp;
|
||||
|
@ -322,17 +322,22 @@ static void GLSL_GetShaderHeader( GLenum shaderType, const GLcharARB *extra, cha
|
|||
Q_strcat(dest, size,
|
||||
va("#ifndef r_FBufScale\n#define r_FBufScale vec2(%f, %f)\n#endif\n", fbufWidthScale, fbufHeightScale));
|
||||
|
||||
if (r_materialGamma->value != 1.0f)
|
||||
Q_strcat(dest, size, va("#ifndef r_materialGamma\n#define r_materialGamma %f\n#endif\n", r_materialGamma->value));
|
||||
if (r_pbr->integer)
|
||||
Q_strcat(dest, size, "#define USE_PBR\n");
|
||||
|
||||
if (r_lightGamma->value != 1.0f)
|
||||
Q_strcat(dest, size, va("#ifndef r_lightGamma\n#define r_lightGamma %f\n#endif\n", r_lightGamma->value));
|
||||
if (r_cubeMapping->integer)
|
||||
{
|
||||
int cubeMipSize = r_cubemapSize->integer;
|
||||
int numRoughnessMips = 0;
|
||||
|
||||
if (r_framebufferGamma->value != 1.0f)
|
||||
Q_strcat(dest, size, va("#ifndef r_framebufferGamma\n#define r_framebufferGamma %f\n#endif\n", r_framebufferGamma->value));
|
||||
|
||||
if (r_tonemapGamma->value != 1.0f)
|
||||
Q_strcat(dest, size, va("#ifndef r_tonemapGamma\n#define r_tonemapGamma %f\n#endif\n", r_tonemapGamma->value));
|
||||
while (cubeMipSize)
|
||||
{
|
||||
cubeMipSize >>= 1;
|
||||
numRoughnessMips++;
|
||||
}
|
||||
numRoughnessMips = MAX(1, numRoughnessMips - 2);
|
||||
Q_strcat(dest, size, va("#define ROUGHNESS_MIPS float(%d)\n", numRoughnessMips));
|
||||
}
|
||||
|
||||
if (extra)
|
||||
{
|
||||
|
@ -482,11 +487,6 @@ static void GLSL_ShowProgramUniforms(GLhandleARB program)
|
|||
GLenum type;
|
||||
char uniformName[1000];
|
||||
|
||||
// install the executables in the program object as part of current state.
|
||||
qglUseProgramObjectARB(program);
|
||||
|
||||
// check for GL Errors
|
||||
|
||||
// query the number of active uniforms
|
||||
qglGetObjectParameterivARB(program, GL_OBJECT_ACTIVE_UNIFORMS_ARB, &count);
|
||||
|
||||
|
@ -497,8 +497,6 @@ static void GLSL_ShowProgramUniforms(GLhandleARB program)
|
|||
|
||||
ri.Printf(PRINT_DEVELOPER, "active uniform: '%s'\n", uniformName);
|
||||
}
|
||||
|
||||
qglUseProgramObjectARB(0);
|
||||
}
|
||||
|
||||
static int GLSL_InitGPUShader2(shaderProgram_t * program, const char *name, int attribs, const char *vpCode, const char *fpCode)
|
||||
|
@ -703,7 +701,7 @@ void GLSL_SetUniformInt(shaderProgram_t *program, int uniformNum, GLint value)
|
|||
|
||||
*compare = value;
|
||||
|
||||
qglUniform1iARB(uniforms[uniformNum], value);
|
||||
qglProgramUniform1i(program->program, uniforms[uniformNum], value);
|
||||
}
|
||||
|
||||
void GLSL_SetUniformFloat(shaderProgram_t *program, int uniformNum, GLfloat value)
|
||||
|
@ -727,7 +725,7 @@ void GLSL_SetUniformFloat(shaderProgram_t *program, int uniformNum, GLfloat valu
|
|||
|
||||
*compare = value;
|
||||
|
||||
qglUniform1fARB(uniforms[uniformNum], value);
|
||||
qglProgramUniform1f(program->program, uniforms[uniformNum], value);
|
||||
}
|
||||
|
||||
void GLSL_SetUniformVec2(shaderProgram_t *program, int uniformNum, const vec2_t v)
|
||||
|
@ -752,7 +750,7 @@ void GLSL_SetUniformVec2(shaderProgram_t *program, int uniformNum, const vec2_t
|
|||
compare[0] = v[0];
|
||||
compare[1] = v[1];
|
||||
|
||||
qglUniform2fARB(uniforms[uniformNum], v[0], v[1]);
|
||||
qglProgramUniform2f(program->program, uniforms[uniformNum], v[0], v[1]);
|
||||
}
|
||||
|
||||
void GLSL_SetUniformVec3(shaderProgram_t *program, int uniformNum, const vec3_t v)
|
||||
|
@ -776,7 +774,7 @@ void GLSL_SetUniformVec3(shaderProgram_t *program, int uniformNum, const vec3_t
|
|||
|
||||
VectorCopy(v, compare);
|
||||
|
||||
qglUniform3fARB(uniforms[uniformNum], v[0], v[1], v[2]);
|
||||
qglProgramUniform3f(program->program, uniforms[uniformNum], v[0], v[1], v[2]);
|
||||
}
|
||||
|
||||
void GLSL_SetUniformVec4(shaderProgram_t *program, int uniformNum, const vec4_t v)
|
||||
|
@ -800,7 +798,7 @@ void GLSL_SetUniformVec4(shaderProgram_t *program, int uniformNum, const vec4_t
|
|||
|
||||
VectorCopy4(v, compare);
|
||||
|
||||
qglUniform4fARB(uniforms[uniformNum], v[0], v[1], v[2], v[3]);
|
||||
qglProgramUniform4f(program->program, uniforms[uniformNum], v[0], v[1], v[2], v[3]);
|
||||
}
|
||||
|
||||
void GLSL_SetUniformFloat5(shaderProgram_t *program, int uniformNum, const vec5_t v)
|
||||
|
@ -824,7 +822,7 @@ void GLSL_SetUniformFloat5(shaderProgram_t *program, int uniformNum, const vec5_
|
|||
|
||||
VectorCopy5(v, compare);
|
||||
|
||||
qglUniform1fvARB(uniforms[uniformNum], 5, v);
|
||||
qglProgramUniform1fv(program->program, uniforms[uniformNum], 5, v);
|
||||
}
|
||||
|
||||
void GLSL_SetUniformMat4(shaderProgram_t *program, int uniformNum, const mat4_t matrix)
|
||||
|
@ -848,7 +846,7 @@ void GLSL_SetUniformMat4(shaderProgram_t *program, int uniformNum, const mat4_t
|
|||
|
||||
Mat4Copy(matrix, compare);
|
||||
|
||||
qglUniformMatrix4fvARB(uniforms[uniformNum], 1, GL_FALSE, matrix);
|
||||
qglProgramUniformMatrix4fv(program->program, uniforms[uniformNum], 1, GL_FALSE, matrix);
|
||||
}
|
||||
|
||||
void GLSL_DeleteGPUShader(shaderProgram_t *program)
|
||||
|
@ -925,10 +923,8 @@ void GLSL_InitGPUShaders(void)
|
|||
|
||||
GLSL_InitUniforms(&tr.genericShader[i]);
|
||||
|
||||
qglUseProgramObjectARB(tr.genericShader[i].program);
|
||||
GLSL_SetUniformInt(&tr.genericShader[i], UNIFORM_DIFFUSEMAP, TB_DIFFUSEMAP);
|
||||
GLSL_SetUniformInt(&tr.genericShader[i], UNIFORM_LIGHTMAP, TB_LIGHTMAP);
|
||||
qglUseProgramObjectARB(0);
|
||||
|
||||
GLSL_FinishGPUShader(&tr.genericShader[i]);
|
||||
|
||||
|
@ -945,9 +941,7 @@ void GLSL_InitGPUShaders(void)
|
|||
|
||||
GLSL_InitUniforms(&tr.textureColorShader);
|
||||
|
||||
qglUseProgramObjectARB(tr.textureColorShader.program);
|
||||
GLSL_SetUniformInt(&tr.textureColorShader, UNIFORM_TEXTUREMAP, TB_DIFFUSEMAP);
|
||||
qglUseProgramObjectARB(0);
|
||||
|
||||
GLSL_FinishGPUShader(&tr.textureColorShader);
|
||||
|
||||
|
@ -993,9 +987,7 @@ void GLSL_InitGPUShaders(void)
|
|||
|
||||
GLSL_InitUniforms(&tr.dlightShader[i]);
|
||||
|
||||
qglUseProgramObjectARB(tr.dlightShader[i].program);
|
||||
GLSL_SetUniformInt(&tr.dlightShader[i], UNIFORM_DIFFUSEMAP, TB_DIFFUSEMAP);
|
||||
qglUseProgramObjectARB(0);
|
||||
|
||||
GLSL_FinishGPUShader(&tr.dlightShader[i]);
|
||||
|
||||
|
@ -1022,16 +1014,10 @@ void GLSL_InitGPUShaders(void)
|
|||
|
||||
extradefines[0] = '\0';
|
||||
|
||||
if (r_deluxeSpecular->value > 0.000001f)
|
||||
Q_strcat(extradefines, 1024, va("#define r_deluxeSpecular %f\n", r_deluxeSpecular->value));
|
||||
|
||||
if (r_specularIsMetallic->value)
|
||||
Q_strcat(extradefines, 1024, "#define SPECULAR_IS_METALLIC\n");
|
||||
|
||||
if (r_dlightMode->integer >= 2)
|
||||
Q_strcat(extradefines, 1024, "#define USE_SHADOWMAP\n");
|
||||
|
||||
if (1)
|
||||
if (glRefConfig.swizzleNormalmap)
|
||||
Q_strcat(extradefines, 1024, "#define SWIZZLE_NORMALMAP\n");
|
||||
|
||||
if (r_hdr->integer && !glRefConfig.floatLightmap)
|
||||
|
@ -1067,12 +1053,6 @@ void GLSL_InitGPUShaders(void)
|
|||
{
|
||||
Q_strcat(extradefines, 1024, "#define USE_NORMALMAP\n");
|
||||
|
||||
if (r_normalMapping->integer == 2)
|
||||
Q_strcat(extradefines, 1024, "#define USE_OREN_NAYAR\n");
|
||||
|
||||
if (r_normalMapping->integer == 3)
|
||||
Q_strcat(extradefines, 1024, "#define USE_TRIACE_OREN_NAYAR\n");
|
||||
|
||||
#ifdef USE_VERT_TANGENT_SPACE
|
||||
Q_strcat(extradefines, 1024, "#define USE_VERT_TANGENT_SPACE\n");
|
||||
attribs |= ATTR_TANGENT;
|
||||
|
@ -1087,36 +1067,27 @@ void GLSL_InitGPUShaders(void)
|
|||
}
|
||||
|
||||
if (r_specularMapping->integer)
|
||||
{
|
||||
Q_strcat(extradefines, 1024, "#define USE_SPECULARMAP\n");
|
||||
|
||||
switch (r_specularMapping->integer)
|
||||
{
|
||||
case 1:
|
||||
default:
|
||||
Q_strcat(extradefines, 1024, "#define USE_BLINN\n");
|
||||
break;
|
||||
|
||||
case 2:
|
||||
Q_strcat(extradefines, 1024, "#define USE_BLINN_FRESNEL\n");
|
||||
break;
|
||||
|
||||
case 3:
|
||||
Q_strcat(extradefines, 1024, "#define USE_MCAULEY\n");
|
||||
break;
|
||||
|
||||
case 4:
|
||||
Q_strcat(extradefines, 1024, "#define USE_GOTANDA\n");
|
||||
break;
|
||||
|
||||
case 5:
|
||||
Q_strcat(extradefines, 1024, "#define USE_LAZAROV\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (r_cubeMapping->integer)
|
||||
Q_strcat(extradefines, 1024, "#define USE_CUBEMAP\n");
|
||||
|
||||
switch (r_glossType->integer)
|
||||
{
|
||||
case 0:
|
||||
default:
|
||||
Q_strcat(extradefines, 1024, "#define GLOSS_IS_GLOSS\n");
|
||||
break;
|
||||
case 1:
|
||||
Q_strcat(extradefines, 1024, "#define GLOSS_IS_SMOOTHNESS\n");
|
||||
break;
|
||||
case 2:
|
||||
Q_strcat(extradefines, 1024, "#define GLOSS_IS_ROUGHNESS\n");
|
||||
break;
|
||||
case 3:
|
||||
Q_strcat(extradefines, 1024, "#define GLOSS_IS_SHININESS\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i & LIGHTDEF_USE_SHADOWMAP)
|
||||
|
@ -1155,7 +1126,6 @@ void GLSL_InitGPUShaders(void)
|
|||
|
||||
GLSL_InitUniforms(&tr.lightallShader[i]);
|
||||
|
||||
qglUseProgramObjectARB(tr.lightallShader[i].program);
|
||||
GLSL_SetUniformInt(&tr.lightallShader[i], UNIFORM_DIFFUSEMAP, TB_DIFFUSEMAP);
|
||||
GLSL_SetUniformInt(&tr.lightallShader[i], UNIFORM_LIGHTMAP, TB_LIGHTMAP);
|
||||
GLSL_SetUniformInt(&tr.lightallShader[i], UNIFORM_NORMALMAP, TB_NORMALMAP);
|
||||
|
@ -1163,7 +1133,6 @@ void GLSL_InitGPUShaders(void)
|
|||
GLSL_SetUniformInt(&tr.lightallShader[i], UNIFORM_SPECULARMAP, TB_SPECULARMAP);
|
||||
GLSL_SetUniformInt(&tr.lightallShader[i], UNIFORM_SHADOWMAP, TB_SHADOWMAP);
|
||||
GLSL_SetUniformInt(&tr.lightallShader[i], UNIFORM_CUBEMAP, TB_CUBEMAP);
|
||||
qglUseProgramObjectARB(0);
|
||||
|
||||
GLSL_FinishGPUShader(&tr.lightallShader[i]);
|
||||
|
||||
|
@ -1196,9 +1165,7 @@ void GLSL_InitGPUShaders(void)
|
|||
|
||||
GLSL_InitUniforms(&tr.pshadowShader);
|
||||
|
||||
qglUseProgramObjectARB(tr.pshadowShader.program);
|
||||
GLSL_SetUniformInt(&tr.pshadowShader, UNIFORM_SHADOWMAP, TB_DIFFUSEMAP);
|
||||
qglUseProgramObjectARB(0);
|
||||
|
||||
GLSL_FinishGPUShader(&tr.pshadowShader);
|
||||
|
||||
|
@ -1215,9 +1182,7 @@ void GLSL_InitGPUShaders(void)
|
|||
|
||||
GLSL_InitUniforms(&tr.down4xShader);
|
||||
|
||||
qglUseProgramObjectARB(tr.down4xShader.program);
|
||||
GLSL_SetUniformInt(&tr.down4xShader, UNIFORM_TEXTUREMAP, TB_DIFFUSEMAP);
|
||||
qglUseProgramObjectARB(0);
|
||||
|
||||
GLSL_FinishGPUShader(&tr.down4xShader);
|
||||
|
||||
|
@ -1234,9 +1199,7 @@ void GLSL_InitGPUShaders(void)
|
|||
|
||||
GLSL_InitUniforms(&tr.bokehShader);
|
||||
|
||||
qglUseProgramObjectARB(tr.bokehShader.program);
|
||||
GLSL_SetUniformInt(&tr.bokehShader, UNIFORM_TEXTUREMAP, TB_DIFFUSEMAP);
|
||||
qglUseProgramObjectARB(0);
|
||||
|
||||
GLSL_FinishGPUShader(&tr.bokehShader);
|
||||
|
||||
|
@ -1253,10 +1216,8 @@ void GLSL_InitGPUShaders(void)
|
|||
|
||||
GLSL_InitUniforms(&tr.tonemapShader);
|
||||
|
||||
qglUseProgramObjectARB(tr.tonemapShader.program);
|
||||
GLSL_SetUniformInt(&tr.tonemapShader, UNIFORM_TEXTUREMAP, TB_COLORMAP);
|
||||
GLSL_SetUniformInt(&tr.tonemapShader, UNIFORM_LEVELSMAP, TB_LEVELSMAP);
|
||||
qglUseProgramObjectARB(0);
|
||||
|
||||
GLSL_FinishGPUShader(&tr.tonemapShader);
|
||||
|
||||
|
@ -1278,9 +1239,7 @@ void GLSL_InitGPUShaders(void)
|
|||
|
||||
GLSL_InitUniforms(&tr.calclevels4xShader[i]);
|
||||
|
||||
qglUseProgramObjectARB(tr.calclevels4xShader[i].program);
|
||||
GLSL_SetUniformInt(&tr.calclevels4xShader[i], UNIFORM_TEXTUREMAP, TB_DIFFUSEMAP);
|
||||
qglUseProgramObjectARB(0);
|
||||
|
||||
GLSL_FinishGPUShader(&tr.calclevels4xShader[i]);
|
||||
|
||||
|
@ -1311,13 +1270,11 @@ void GLSL_InitGPUShaders(void)
|
|||
|
||||
GLSL_InitUniforms(&tr.shadowmaskShader);
|
||||
|
||||
qglUseProgramObjectARB(tr.shadowmaskShader.program);
|
||||
GLSL_SetUniformInt(&tr.shadowmaskShader, UNIFORM_SCREENDEPTHMAP, TB_COLORMAP);
|
||||
GLSL_SetUniformInt(&tr.shadowmaskShader, UNIFORM_SHADOWMAP, TB_SHADOWMAP);
|
||||
GLSL_SetUniformInt(&tr.shadowmaskShader, UNIFORM_SHADOWMAP2, TB_SHADOWMAP2);
|
||||
GLSL_SetUniformInt(&tr.shadowmaskShader, UNIFORM_SHADOWMAP3, TB_SHADOWMAP3);
|
||||
GLSL_SetUniformInt(&tr.shadowmaskShader, UNIFORM_SHADOWMAP4, TB_SHADOWMAP4);
|
||||
qglUseProgramObjectARB(0);
|
||||
|
||||
GLSL_FinishGPUShader(&tr.shadowmaskShader);
|
||||
|
||||
|
@ -1334,16 +1291,14 @@ void GLSL_InitGPUShaders(void)
|
|||
|
||||
GLSL_InitUniforms(&tr.ssaoShader);
|
||||
|
||||
qglUseProgramObjectARB(tr.ssaoShader.program);
|
||||
GLSL_SetUniformInt(&tr.ssaoShader, UNIFORM_SCREENDEPTHMAP, TB_COLORMAP);
|
||||
qglUseProgramObjectARB(0);
|
||||
|
||||
GLSL_FinishGPUShader(&tr.ssaoShader);
|
||||
|
||||
numEtcShaders++;
|
||||
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
attribs = ATTR_POSITION | ATTR_TEXCOORD;
|
||||
extradefines[0] = '\0';
|
||||
|
@ -1353,6 +1308,9 @@ void GLSL_InitGPUShaders(void)
|
|||
else
|
||||
Q_strcat(extradefines, 1024, "#define USE_HORIZONTAL_BLUR\n");
|
||||
|
||||
if (!(i & 2))
|
||||
Q_strcat(extradefines, 1024, "#define USE_DEPTH\n");
|
||||
|
||||
|
||||
if (!GLSL_InitGPUShader(&tr.depthBlurShader[i], "depthBlur", attribs, qtrue, extradefines, qtrue, fallbackShader_depthblur_vp, fallbackShader_depthblur_fp))
|
||||
{
|
||||
|
@ -1361,10 +1319,8 @@ void GLSL_InitGPUShaders(void)
|
|||
|
||||
GLSL_InitUniforms(&tr.depthBlurShader[i]);
|
||||
|
||||
qglUseProgramObjectARB(tr.depthBlurShader[i].program);
|
||||
GLSL_SetUniformInt(&tr.depthBlurShader[i], UNIFORM_SCREENIMAGEMAP, TB_COLORMAP);
|
||||
GLSL_SetUniformInt(&tr.depthBlurShader[i], UNIFORM_SCREENDEPTHMAP, TB_LIGHTMAP);
|
||||
qglUseProgramObjectARB(0);
|
||||
|
||||
GLSL_FinishGPUShader(&tr.depthBlurShader[i]);
|
||||
|
||||
|
@ -1382,9 +1338,7 @@ void GLSL_InitGPUShaders(void)
|
|||
|
||||
GLSL_InitUniforms(&tr.testcubeShader);
|
||||
|
||||
qglUseProgramObjectARB(tr.testcubeShader.program);
|
||||
GLSL_SetUniformInt(&tr.testcubeShader, UNIFORM_TEXTUREMAP, TB_COLORMAP);
|
||||
qglUseProgramObjectARB(0);
|
||||
|
||||
GLSL_FinishGPUShader(&tr.testcubeShader);
|
||||
|
||||
|
@ -1408,7 +1362,7 @@ void GLSL_ShutdownGPUShaders(void)
|
|||
for (i = 0; i < ATTR_INDEX_COUNT; i++)
|
||||
qglDisableVertexAttribArrayARB(i);
|
||||
|
||||
GLSL_BindNullProgram();
|
||||
GL_BindNullProgram();
|
||||
|
||||
for ( i = 0; i < GENERICDEF_COUNT; i++)
|
||||
GLSL_DeleteGPUShader(&tr.genericShader[i]);
|
||||
|
@ -1436,49 +1390,24 @@ void GLSL_ShutdownGPUShaders(void)
|
|||
GLSL_DeleteGPUShader(&tr.shadowmaskShader);
|
||||
GLSL_DeleteGPUShader(&tr.ssaoShader);
|
||||
|
||||
for ( i = 0; i < 2; i++)
|
||||
for ( i = 0; i < 4; i++)
|
||||
GLSL_DeleteGPUShader(&tr.depthBlurShader[i]);
|
||||
|
||||
glState.currentProgram = 0;
|
||||
qglUseProgramObjectARB(0);
|
||||
}
|
||||
|
||||
|
||||
void GLSL_BindProgram(shaderProgram_t * program)
|
||||
{
|
||||
if(!program)
|
||||
{
|
||||
GLSL_BindNullProgram();
|
||||
return;
|
||||
}
|
||||
GLuint programObject = program ? program->program : 0;
|
||||
char *name = program ? program->name : "NULL";
|
||||
|
||||
if(r_logFile->integer)
|
||||
{
|
||||
// don't just call LogComment, or we will get a call to va() every frame!
|
||||
GLimp_LogComment(va("--- GL_BindProgram( %s ) ---\n", program->name));
|
||||
GLimp_LogComment(va("--- GLSL_BindProgram( %s ) ---\n", name));
|
||||
}
|
||||
|
||||
if(glState.currentProgram != program)
|
||||
{
|
||||
qglUseProgramObjectARB(program->program);
|
||||
glState.currentProgram = program;
|
||||
if (GL_UseProgramObject(programObject))
|
||||
backEnd.pc.c_glslShaderBinds++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GLSL_BindNullProgram(void)
|
||||
{
|
||||
if(r_logFile->integer)
|
||||
{
|
||||
GLimp_LogComment("--- GL_BindNullProgram ---\n");
|
||||
}
|
||||
|
||||
if(glState.currentProgram)
|
||||
{
|
||||
qglUseProgramObjectARB(0);
|
||||
glState.currentProgram = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
498
code/renderergl2/tr_image_dds.c
Normal file
498
code/renderergl2/tr_image_dds.c
Normal file
|
@ -0,0 +1,498 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
2015 James Canete
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Quake III Arena source code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#include "../renderercommon/tr_common.h"
|
||||
|
||||
typedef unsigned int ui32_t;
|
||||
|
||||
typedef struct ddsHeader_s
|
||||
{
|
||||
ui32_t headerSize;
|
||||
ui32_t flags;
|
||||
ui32_t height;
|
||||
ui32_t width;
|
||||
ui32_t pitchOrFirstMipSize;
|
||||
ui32_t volumeDepth;
|
||||
ui32_t numMips;
|
||||
ui32_t reserved1[11];
|
||||
ui32_t always_0x00000020;
|
||||
ui32_t pixelFormatFlags;
|
||||
ui32_t fourCC;
|
||||
ui32_t rgbBitCount;
|
||||
ui32_t rBitMask;
|
||||
ui32_t gBitMask;
|
||||
ui32_t bBitMask;
|
||||
ui32_t aBitMask;
|
||||
ui32_t caps;
|
||||
ui32_t caps2;
|
||||
ui32_t caps3;
|
||||
ui32_t caps4;
|
||||
ui32_t reserved2;
|
||||
}
|
||||
ddsHeader_t;
|
||||
|
||||
// flags:
|
||||
#define _DDSFLAGS_REQUIRED 0x001007
|
||||
#define _DDSFLAGS_PITCH 0x8
|
||||
#define _DDSFLAGS_MIPMAPCOUNT 0x20000
|
||||
#define _DDSFLAGS_FIRSTMIPSIZE 0x80000
|
||||
#define _DDSFLAGS_VOLUMEDEPTH 0x800000
|
||||
|
||||
// pixelFormatFlags:
|
||||
#define DDSPF_ALPHAPIXELS 0x1
|
||||
#define DDSPF_ALPHA 0x2
|
||||
#define DDSPF_FOURCC 0x4
|
||||
#define DDSPF_RGB 0x40
|
||||
#define DDSPF_YUV 0x200
|
||||
#define DDSPF_LUMINANCE 0x20000
|
||||
|
||||
// caps:
|
||||
#define DDSCAPS_COMPLEX 0x8
|
||||
#define DDSCAPS_MIPMAP 0x400000
|
||||
#define DDSCAPS_REQUIRED 0x1000
|
||||
|
||||
// caps2:
|
||||
#define DDSCAPS2_CUBEMAP 0xFE00
|
||||
#define DDSCAPS2_VOLUME 0x200000
|
||||
|
||||
typedef struct ddsHeaderDxt10_s
|
||||
{
|
||||
ui32_t dxgiFormat;
|
||||
ui32_t dimensions;
|
||||
ui32_t miscFlags;
|
||||
ui32_t arraySize;
|
||||
ui32_t miscFlags2;
|
||||
}
|
||||
ddsHeaderDxt10_t;
|
||||
|
||||
// dxgiFormat
|
||||
// from http://msdn.microsoft.com/en-us/library/windows/desktop/bb173059%28v=vs.85%29.aspx
|
||||
typedef enum DXGI_FORMAT {
|
||||
DXGI_FORMAT_UNKNOWN = 0,
|
||||
DXGI_FORMAT_R32G32B32A32_TYPELESS = 1,
|
||||
DXGI_FORMAT_R32G32B32A32_FLOAT = 2,
|
||||
DXGI_FORMAT_R32G32B32A32_UINT = 3,
|
||||
DXGI_FORMAT_R32G32B32A32_SINT = 4,
|
||||
DXGI_FORMAT_R32G32B32_TYPELESS = 5,
|
||||
DXGI_FORMAT_R32G32B32_FLOAT = 6,
|
||||
DXGI_FORMAT_R32G32B32_UINT = 7,
|
||||
DXGI_FORMAT_R32G32B32_SINT = 8,
|
||||
DXGI_FORMAT_R16G16B16A16_TYPELESS = 9,
|
||||
DXGI_FORMAT_R16G16B16A16_FLOAT = 10,
|
||||
DXGI_FORMAT_R16G16B16A16_UNORM = 11,
|
||||
DXGI_FORMAT_R16G16B16A16_UINT = 12,
|
||||
DXGI_FORMAT_R16G16B16A16_SNORM = 13,
|
||||
DXGI_FORMAT_R16G16B16A16_SINT = 14,
|
||||
DXGI_FORMAT_R32G32_TYPELESS = 15,
|
||||
DXGI_FORMAT_R32G32_FLOAT = 16,
|
||||
DXGI_FORMAT_R32G32_UINT = 17,
|
||||
DXGI_FORMAT_R32G32_SINT = 18,
|
||||
DXGI_FORMAT_R32G8X24_TYPELESS = 19,
|
||||
DXGI_FORMAT_D32_FLOAT_S8X24_UINT = 20,
|
||||
DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS = 21,
|
||||
DXGI_FORMAT_X32_TYPELESS_G8X24_UINT = 22,
|
||||
DXGI_FORMAT_R10G10B10A2_TYPELESS = 23,
|
||||
DXGI_FORMAT_R10G10B10A2_UNORM = 24,
|
||||
DXGI_FORMAT_R10G10B10A2_UINT = 25,
|
||||
DXGI_FORMAT_R11G11B10_FLOAT = 26,
|
||||
DXGI_FORMAT_R8G8B8A8_TYPELESS = 27,
|
||||
DXGI_FORMAT_R8G8B8A8_UNORM = 28,
|
||||
DXGI_FORMAT_R8G8B8A8_UNORM_SRGB = 29,
|
||||
DXGI_FORMAT_R8G8B8A8_UINT = 30,
|
||||
DXGI_FORMAT_R8G8B8A8_SNORM = 31,
|
||||
DXGI_FORMAT_R8G8B8A8_SINT = 32,
|
||||
DXGI_FORMAT_R16G16_TYPELESS = 33,
|
||||
DXGI_FORMAT_R16G16_FLOAT = 34,
|
||||
DXGI_FORMAT_R16G16_UNORM = 35,
|
||||
DXGI_FORMAT_R16G16_UINT = 36,
|
||||
DXGI_FORMAT_R16G16_SNORM = 37,
|
||||
DXGI_FORMAT_R16G16_SINT = 38,
|
||||
DXGI_FORMAT_R32_TYPELESS = 39,
|
||||
DXGI_FORMAT_D32_FLOAT = 40,
|
||||
DXGI_FORMAT_R32_FLOAT = 41,
|
||||
DXGI_FORMAT_R32_UINT = 42,
|
||||
DXGI_FORMAT_R32_SINT = 43,
|
||||
DXGI_FORMAT_R24G8_TYPELESS = 44,
|
||||
DXGI_FORMAT_D24_UNORM_S8_UINT = 45,
|
||||
DXGI_FORMAT_R24_UNORM_X8_TYPELESS = 46,
|
||||
DXGI_FORMAT_X24_TYPELESS_G8_UINT = 47,
|
||||
DXGI_FORMAT_R8G8_TYPELESS = 48,
|
||||
DXGI_FORMAT_R8G8_UNORM = 49,
|
||||
DXGI_FORMAT_R8G8_UINT = 50,
|
||||
DXGI_FORMAT_R8G8_SNORM = 51,
|
||||
DXGI_FORMAT_R8G8_SINT = 52,
|
||||
DXGI_FORMAT_R16_TYPELESS = 53,
|
||||
DXGI_FORMAT_R16_FLOAT = 54,
|
||||
DXGI_FORMAT_D16_UNORM = 55,
|
||||
DXGI_FORMAT_R16_UNORM = 56,
|
||||
DXGI_FORMAT_R16_UINT = 57,
|
||||
DXGI_FORMAT_R16_SNORM = 58,
|
||||
DXGI_FORMAT_R16_SINT = 59,
|
||||
DXGI_FORMAT_R8_TYPELESS = 60,
|
||||
DXGI_FORMAT_R8_UNORM = 61,
|
||||
DXGI_FORMAT_R8_UINT = 62,
|
||||
DXGI_FORMAT_R8_SNORM = 63,
|
||||
DXGI_FORMAT_R8_SINT = 64,
|
||||
DXGI_FORMAT_A8_UNORM = 65,
|
||||
DXGI_FORMAT_R1_UNORM = 66,
|
||||
DXGI_FORMAT_R9G9B9E5_SHAREDEXP = 67,
|
||||
DXGI_FORMAT_R8G8_B8G8_UNORM = 68,
|
||||
DXGI_FORMAT_G8R8_G8B8_UNORM = 69,
|
||||
DXGI_FORMAT_BC1_TYPELESS = 70,
|
||||
DXGI_FORMAT_BC1_UNORM = 71,
|
||||
DXGI_FORMAT_BC1_UNORM_SRGB = 72,
|
||||
DXGI_FORMAT_BC2_TYPELESS = 73,
|
||||
DXGI_FORMAT_BC2_UNORM = 74,
|
||||
DXGI_FORMAT_BC2_UNORM_SRGB = 75,
|
||||
DXGI_FORMAT_BC3_TYPELESS = 76,
|
||||
DXGI_FORMAT_BC3_UNORM = 77,
|
||||
DXGI_FORMAT_BC3_UNORM_SRGB = 78,
|
||||
DXGI_FORMAT_BC4_TYPELESS = 79,
|
||||
DXGI_FORMAT_BC4_UNORM = 80,
|
||||
DXGI_FORMAT_BC4_SNORM = 81,
|
||||
DXGI_FORMAT_BC5_TYPELESS = 82,
|
||||
DXGI_FORMAT_BC5_UNORM = 83,
|
||||
DXGI_FORMAT_BC5_SNORM = 84,
|
||||
DXGI_FORMAT_B5G6R5_UNORM = 85,
|
||||
DXGI_FORMAT_B5G5R5A1_UNORM = 86,
|
||||
DXGI_FORMAT_B8G8R8A8_UNORM = 87,
|
||||
DXGI_FORMAT_B8G8R8X8_UNORM = 88,
|
||||
DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM = 89,
|
||||
DXGI_FORMAT_B8G8R8A8_TYPELESS = 90,
|
||||
DXGI_FORMAT_B8G8R8A8_UNORM_SRGB = 91,
|
||||
DXGI_FORMAT_B8G8R8X8_TYPELESS = 92,
|
||||
DXGI_FORMAT_B8G8R8X8_UNORM_SRGB = 93,
|
||||
DXGI_FORMAT_BC6H_TYPELESS = 94,
|
||||
DXGI_FORMAT_BC6H_UF16 = 95,
|
||||
DXGI_FORMAT_BC6H_SF16 = 96,
|
||||
DXGI_FORMAT_BC7_TYPELESS = 97,
|
||||
DXGI_FORMAT_BC7_UNORM = 98,
|
||||
DXGI_FORMAT_BC7_UNORM_SRGB = 99,
|
||||
DXGI_FORMAT_AYUV = 100,
|
||||
DXGI_FORMAT_Y410 = 101,
|
||||
DXGI_FORMAT_Y416 = 102,
|
||||
DXGI_FORMAT_NV12 = 103,
|
||||
DXGI_FORMAT_P010 = 104,
|
||||
DXGI_FORMAT_P016 = 105,
|
||||
DXGI_FORMAT_420_OPAQUE = 106,
|
||||
DXGI_FORMAT_YUY2 = 107,
|
||||
DXGI_FORMAT_Y210 = 108,
|
||||
DXGI_FORMAT_Y216 = 109,
|
||||
DXGI_FORMAT_NV11 = 110,
|
||||
DXGI_FORMAT_AI44 = 111,
|
||||
DXGI_FORMAT_IA44 = 112,
|
||||
DXGI_FORMAT_P8 = 113,
|
||||
DXGI_FORMAT_A8P8 = 114,
|
||||
DXGI_FORMAT_B4G4R4A4_UNORM = 115,
|
||||
DXGI_FORMAT_FORCE_UINT = 0xffffffffUL
|
||||
} DXGI_FORMAT;
|
||||
|
||||
#define EncodeFourCC(x) ((((ui32_t)((x)[0])) ) | \
|
||||
(((ui32_t)((x)[1])) << 8 ) | \
|
||||
(((ui32_t)((x)[2])) << 16) | \
|
||||
(((ui32_t)((x)[3])) << 24) )
|
||||
|
||||
|
||||
void R_LoadDDS ( const char *filename, byte **pic, int *width, int *height, GLenum *picFormat, int *numMips )
|
||||
{
|
||||
union {
|
||||
byte *b;
|
||||
void *v;
|
||||
} buffer;
|
||||
int len;
|
||||
ddsHeader_t *ddsHeader = NULL;
|
||||
ddsHeaderDxt10_t *ddsHeaderDxt10 = NULL;
|
||||
byte *data;
|
||||
|
||||
if (!picFormat)
|
||||
{
|
||||
ri.Printf(PRINT_ERROR, "R_LoadDDS() called without picFormat parameter!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (width)
|
||||
*width = 0;
|
||||
if (height)
|
||||
*height = 0;
|
||||
if (picFormat)
|
||||
*picFormat = GL_RGBA8;
|
||||
if (numMips)
|
||||
*numMips = 1;
|
||||
|
||||
*pic = NULL;
|
||||
|
||||
//
|
||||
// load the file
|
||||
//
|
||||
len = ri.FS_ReadFile( ( char * ) filename, &buffer.v);
|
||||
if (!buffer.b || len < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// reject files that are too small to hold even a header
|
||||
//
|
||||
if (len < 4 + sizeof(*ddsHeader))
|
||||
{
|
||||
ri.Printf(PRINT_ALL, "File %s is too small to be a DDS file.\n", filename);
|
||||
ri.FS_FreeFile(buffer.v);
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// reject files that don't start with "DDS "
|
||||
//
|
||||
if (*((ui32_t *)(buffer.b)) != EncodeFourCC("DDS "))
|
||||
{
|
||||
ri.Printf(PRINT_ALL, "File %s is not a DDS file.\n", filename);
|
||||
ri.FS_FreeFile(buffer.v);
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// parse header and dx10 header if available
|
||||
//
|
||||
ddsHeader = (ddsHeader_t *)(buffer.b + 4);
|
||||
if ((ddsHeader->pixelFormatFlags & DDSPF_FOURCC) && ddsHeader->fourCC == EncodeFourCC("DX10"))
|
||||
{
|
||||
if (len < 4 + sizeof(*ddsHeader) + sizeof(*ddsHeaderDxt10))
|
||||
{
|
||||
ri.Printf(PRINT_ALL, "File %s indicates a DX10 header it is too small to contain.\n", filename);
|
||||
ri.FS_FreeFile(buffer.v);
|
||||
return;
|
||||
}
|
||||
|
||||
ddsHeaderDxt10 = (ddsHeaderDxt10_t *)(buffer.b + 4 + sizeof(ddsHeader_t));
|
||||
data = buffer.b + 4 + sizeof(*ddsHeader) + sizeof(*ddsHeaderDxt10);
|
||||
len -= 4 + sizeof(*ddsHeader) + sizeof(*ddsHeaderDxt10);
|
||||
}
|
||||
else
|
||||
{
|
||||
data = buffer.b + 4 + sizeof(*ddsHeader);
|
||||
len -= 4 + sizeof(*ddsHeader);
|
||||
}
|
||||
|
||||
if (width)
|
||||
*width = ddsHeader->width;
|
||||
if (height)
|
||||
*height = ddsHeader->height;
|
||||
|
||||
if (numMips)
|
||||
{
|
||||
if (ddsHeader->flags & _DDSFLAGS_MIPMAPCOUNT)
|
||||
*numMips = ddsHeader->numMips;
|
||||
else
|
||||
*numMips = 1;
|
||||
}
|
||||
|
||||
// FIXME: handle cube map
|
||||
//if ((ddsHeader->caps2 & DDSCAPS2_CUBEMAP) == DDSCAPS2_CUBEMAP)
|
||||
|
||||
//
|
||||
// Convert DXGI format/FourCC into OpenGL format
|
||||
//
|
||||
if (ddsHeaderDxt10)
|
||||
{
|
||||
switch (ddsHeaderDxt10->dxgiFormat)
|
||||
{
|
||||
case DXGI_FORMAT_BC1_TYPELESS:
|
||||
case DXGI_FORMAT_BC1_UNORM:
|
||||
// FIXME: check for GL_COMPRESSED_RGBA_S3TC_DXT1_EXT
|
||||
*picFormat = GL_COMPRESSED_RGB_S3TC_DXT1_EXT;
|
||||
break;
|
||||
|
||||
case DXGI_FORMAT_BC1_UNORM_SRGB:
|
||||
// FIXME: check for GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT
|
||||
*picFormat = GL_COMPRESSED_SRGB_S3TC_DXT1_EXT;
|
||||
break;
|
||||
|
||||
case DXGI_FORMAT_BC2_TYPELESS:
|
||||
case DXGI_FORMAT_BC2_UNORM:
|
||||
*picFormat = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT;
|
||||
break;
|
||||
|
||||
case DXGI_FORMAT_BC2_UNORM_SRGB:
|
||||
*picFormat = GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;
|
||||
break;
|
||||
|
||||
case DXGI_FORMAT_BC3_TYPELESS:
|
||||
case DXGI_FORMAT_BC3_UNORM:
|
||||
*picFormat = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
|
||||
break;
|
||||
|
||||
case DXGI_FORMAT_BC3_UNORM_SRGB:
|
||||
*picFormat = GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT;
|
||||
break;
|
||||
|
||||
case DXGI_FORMAT_BC4_TYPELESS:
|
||||
case DXGI_FORMAT_BC4_UNORM:
|
||||
*picFormat = GL_COMPRESSED_RED_RGTC1;
|
||||
break;
|
||||
|
||||
case DXGI_FORMAT_BC4_SNORM:
|
||||
*picFormat = GL_COMPRESSED_SIGNED_RED_RGTC1;
|
||||
break;
|
||||
|
||||
case DXGI_FORMAT_BC5_TYPELESS:
|
||||
case DXGI_FORMAT_BC5_UNORM:
|
||||
*picFormat = GL_COMPRESSED_RG_RGTC2;
|
||||
break;
|
||||
|
||||
case DXGI_FORMAT_BC5_SNORM:
|
||||
*picFormat = GL_COMPRESSED_SIGNED_RG_RGTC2;
|
||||
break;
|
||||
|
||||
case DXGI_FORMAT_BC6H_TYPELESS:
|
||||
case DXGI_FORMAT_BC6H_UF16:
|
||||
*picFormat = GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB;
|
||||
break;
|
||||
|
||||
case DXGI_FORMAT_BC6H_SF16:
|
||||
*picFormat = GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB;
|
||||
break;
|
||||
|
||||
case DXGI_FORMAT_BC7_TYPELESS:
|
||||
case DXGI_FORMAT_BC7_UNORM:
|
||||
*picFormat = GL_COMPRESSED_RGBA_BPTC_UNORM_ARB;
|
||||
break;
|
||||
|
||||
case DXGI_FORMAT_BC7_UNORM_SRGB:
|
||||
*picFormat = GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB;
|
||||
break;
|
||||
|
||||
case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB:
|
||||
*picFormat = GL_SRGB8_ALPHA8_EXT;
|
||||
break;
|
||||
|
||||
case DXGI_FORMAT_R8G8B8A8_UNORM:
|
||||
case DXGI_FORMAT_R8G8B8A8_SNORM:
|
||||
*picFormat = GL_RGBA8;
|
||||
break;
|
||||
|
||||
default:
|
||||
ri.Printf(PRINT_ALL, "DDS File %s has unsupported DXGI format %d.", filename, ddsHeaderDxt10->dxgiFormat);
|
||||
ri.FS_FreeFile(buffer.v);
|
||||
return;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ddsHeader->pixelFormatFlags & DDSPF_FOURCC)
|
||||
{
|
||||
if (ddsHeader->fourCC == EncodeFourCC("DXT1"))
|
||||
*picFormat = GL_COMPRESSED_RGB_S3TC_DXT1_EXT;
|
||||
else if (ddsHeader->fourCC == EncodeFourCC("DXT2"))
|
||||
*picFormat = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT;
|
||||
else if (ddsHeader->fourCC == EncodeFourCC("DXT3"))
|
||||
*picFormat = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT;
|
||||
else if (ddsHeader->fourCC == EncodeFourCC("DXT4"))
|
||||
*picFormat = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
|
||||
else if (ddsHeader->fourCC == EncodeFourCC("DXT5"))
|
||||
*picFormat = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
|
||||
else if (ddsHeader->fourCC == EncodeFourCC("ATI1"))
|
||||
*picFormat = GL_COMPRESSED_RED_RGTC1;
|
||||
else if (ddsHeader->fourCC == EncodeFourCC("BC4U"))
|
||||
*picFormat = GL_COMPRESSED_RED_RGTC1;
|
||||
else if (ddsHeader->fourCC == EncodeFourCC("BC4S"))
|
||||
*picFormat = GL_COMPRESSED_SIGNED_RED_RGTC1;
|
||||
else if (ddsHeader->fourCC == EncodeFourCC("ATI2"))
|
||||
*picFormat = GL_COMPRESSED_RG_RGTC2;
|
||||
else if (ddsHeader->fourCC == EncodeFourCC("BC5U"))
|
||||
*picFormat = GL_COMPRESSED_RG_RGTC2;
|
||||
else if (ddsHeader->fourCC == EncodeFourCC("BC5S"))
|
||||
*picFormat = GL_COMPRESSED_SIGNED_RG_RGTC2;
|
||||
else
|
||||
{
|
||||
ri.Printf(PRINT_ALL, "DDS File %s has unsupported FourCC.", filename);
|
||||
ri.FS_FreeFile(buffer.v);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (ddsHeader->pixelFormatFlags == (DDSPF_RGB | DDSPF_ALPHAPIXELS)
|
||||
&& ddsHeader->rgbBitCount == 32
|
||||
&& ddsHeader->rBitMask == 0x000000ff
|
||||
&& ddsHeader->gBitMask == 0x0000ff00
|
||||
&& ddsHeader->bBitMask == 0x00ff0000
|
||||
&& ddsHeader->aBitMask == 0xff000000)
|
||||
{
|
||||
*picFormat = GL_RGBA8;
|
||||
}
|
||||
else
|
||||
{
|
||||
ri.Printf(PRINT_ALL, "DDS File %s has unsupported RGBA format.", filename);
|
||||
ri.FS_FreeFile(buffer.v);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
*pic = ri.Malloc(len);
|
||||
Com_Memcpy(*pic, data, len);
|
||||
|
||||
ri.FS_FreeFile(buffer.v);
|
||||
}
|
||||
|
||||
void R_SaveDDS(const char *filename, byte *pic, int width, int height, int depth)
|
||||
{
|
||||
byte *data;
|
||||
ddsHeader_t *ddsHeader;
|
||||
int picSize, size;
|
||||
|
||||
if (!depth)
|
||||
depth = 1;
|
||||
|
||||
picSize = width * height * depth * 4;
|
||||
size = 4 + sizeof(*ddsHeader) + picSize;
|
||||
data = ri.Malloc(size);
|
||||
|
||||
data[0] = 'D';
|
||||
data[1] = 'D';
|
||||
data[2] = 'S';
|
||||
data[3] = ' ';
|
||||
|
||||
ddsHeader = (ddsHeader_t *)(data + 4);
|
||||
memset(ddsHeader, 0, sizeof(ddsHeader_t));
|
||||
|
||||
ddsHeader->headerSize = 0x7c;
|
||||
ddsHeader->flags = _DDSFLAGS_REQUIRED;
|
||||
ddsHeader->height = height;
|
||||
ddsHeader->width = width;
|
||||
ddsHeader->always_0x00000020 = 0x00000020;
|
||||
ddsHeader->caps = DDSCAPS_COMPLEX | DDSCAPS_REQUIRED;
|
||||
|
||||
if (depth == 6)
|
||||
ddsHeader->caps2 = DDSCAPS2_CUBEMAP;
|
||||
|
||||
ddsHeader->pixelFormatFlags = DDSPF_RGB | DDSPF_ALPHAPIXELS;
|
||||
ddsHeader->rgbBitCount = 32;
|
||||
ddsHeader->rBitMask = 0x000000ff;
|
||||
ddsHeader->gBitMask = 0x0000ff00;
|
||||
ddsHeader->bBitMask = 0x00ff0000;
|
||||
ddsHeader->aBitMask = 0xff000000;
|
||||
|
||||
Com_Memcpy(data + 4 + sizeof(*ddsHeader), pic, picSize);
|
||||
|
||||
ri.FS_WriteFile(filename, data, size);
|
||||
|
||||
ri.Free(data);
|
||||
}
|
|
@ -23,6 +23,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
|
||||
#include "tr_local.h"
|
||||
|
||||
#include "tr_dsa.h"
|
||||
|
||||
glconfig_t glConfig;
|
||||
glRefConfig_t glRefConfig;
|
||||
qboolean textureFilterAnisotropic = qfalse;
|
||||
|
@ -109,6 +111,7 @@ cvar_t *r_ext_framebuffer_multisample;
|
|||
cvar_t *r_arb_seamless_cube_map;
|
||||
cvar_t *r_arb_vertex_type_2_10_10_10_rev;
|
||||
cvar_t *r_arb_vertex_array_object;
|
||||
cvar_t *r_ext_direct_state_access;
|
||||
|
||||
cvar_t *r_mergeMultidraws;
|
||||
cvar_t *r_mergeLeafSurfaces;
|
||||
|
@ -132,11 +135,6 @@ cvar_t *r_forceAutoExposure;
|
|||
cvar_t *r_forceAutoExposureMin;
|
||||
cvar_t *r_forceAutoExposureMax;
|
||||
|
||||
cvar_t *r_materialGamma;
|
||||
cvar_t *r_lightGamma;
|
||||
cvar_t *r_framebufferGamma;
|
||||
cvar_t *r_tonemapGamma;
|
||||
|
||||
cvar_t *r_depthPrepass;
|
||||
cvar_t *r_ssao;
|
||||
|
||||
|
@ -145,13 +143,14 @@ cvar_t *r_specularMapping;
|
|||
cvar_t *r_deluxeMapping;
|
||||
cvar_t *r_parallaxMapping;
|
||||
cvar_t *r_cubeMapping;
|
||||
cvar_t *r_deluxeSpecular;
|
||||
cvar_t *r_specularIsMetallic;
|
||||
cvar_t *r_cubemapSize;
|
||||
cvar_t *r_pbr;
|
||||
cvar_t *r_baseNormalX;
|
||||
cvar_t *r_baseNormalY;
|
||||
cvar_t *r_baseParallax;
|
||||
cvar_t *r_baseSpecular;
|
||||
cvar_t *r_baseGloss;
|
||||
cvar_t *r_glossType;
|
||||
cvar_t *r_mergeLightmaps;
|
||||
cvar_t *r_dlightMode;
|
||||
cvar_t *r_pshadowDist;
|
||||
|
@ -167,6 +166,7 @@ cvar_t *r_sunlightMode;
|
|||
cvar_t *r_drawSunRays;
|
||||
cvar_t *r_sunShadows;
|
||||
cvar_t *r_shadowFilter;
|
||||
cvar_t *r_shadowBlur;
|
||||
cvar_t *r_shadowMapSize;
|
||||
cvar_t *r_shadowCascadeZNear;
|
||||
cvar_t *r_shadowCascadeZFar;
|
||||
|
@ -462,6 +462,7 @@ byte *RB_ReadPixels(int x, int y, int width, int height, size_t *offset, int *pa
|
|||
buffer = ri.Hunk_AllocateTempMemory(padwidth * height + *offset + packAlign - 1);
|
||||
|
||||
bufstart = PADP((intptr_t) buffer + *offset, packAlign);
|
||||
|
||||
qglReadPixels(x, y, width, height, GL_RGB, GL_UNSIGNED_BYTE, bufstart);
|
||||
|
||||
*offset = bufstart - buffer;
|
||||
|
@ -837,6 +838,35 @@ void R_ScreenShotJPEG_f (void) {
|
|||
|
||||
//============================================================================
|
||||
|
||||
/*
|
||||
==================
|
||||
R_ExportCubemaps
|
||||
==================
|
||||
*/
|
||||
void R_ExportCubemaps(void)
|
||||
{
|
||||
exportCubemapsCommand_t *cmd;
|
||||
|
||||
cmd = R_GetCommandBuffer(sizeof(*cmd));
|
||||
if (!cmd) {
|
||||
return;
|
||||
}
|
||||
cmd->commandId = RC_EXPORT_CUBEMAPS;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
==================
|
||||
R_ExportCubemaps_f
|
||||
==================
|
||||
*/
|
||||
void R_ExportCubemaps_f(void)
|
||||
{
|
||||
R_ExportCubemaps();
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
|
||||
/*
|
||||
==================
|
||||
RB_TakeVideoFrameCmd
|
||||
|
@ -931,19 +961,11 @@ void GL_SetDefaultState( void )
|
|||
|
||||
qglColor4f (1,1,1,1);
|
||||
|
||||
// initialize downstream texture unit if we're running
|
||||
// in a multitexture environment
|
||||
if ( qglActiveTextureARB ) {
|
||||
GL_SelectTexture( 1 );
|
||||
GL_TextureMode( r_textureMode->string );
|
||||
GL_TexEnv( GL_MODULATE );
|
||||
qglDisable( GL_TEXTURE_2D );
|
||||
GL_SelectTexture( 0 );
|
||||
}
|
||||
GL_BindNullTextures();
|
||||
GL_BindNullFramebuffers();
|
||||
|
||||
qglEnable(GL_TEXTURE_2D);
|
||||
GL_TextureMode( r_textureMode->string );
|
||||
GL_TexEnv( GL_MODULATE );
|
||||
|
||||
//qglShadeModel( GL_SMOOTH );
|
||||
qglDepthFunc( GL_LEQUAL );
|
||||
|
@ -956,8 +978,7 @@ void GL_SetDefaultState( void )
|
|||
glState.faceCulling = CT_TWO_SIDED;
|
||||
glState.faceCullFront = qtrue;
|
||||
|
||||
glState.currentProgram = 0;
|
||||
qglUseProgramObjectARB(0);
|
||||
GL_BindNullProgram();
|
||||
|
||||
if (glRefConfig.vertexArrayObject)
|
||||
qglBindVertexArrayARB(0);
|
||||
|
@ -1160,6 +1181,7 @@ void R_Register( void )
|
|||
r_arb_seamless_cube_map = ri.Cvar_Get( "r_arb_seamless_cube_map", "0", CVAR_ARCHIVE | CVAR_LATCH);
|
||||
r_arb_vertex_type_2_10_10_10_rev = ri.Cvar_Get( "r_arb_vertex_type_2_10_10_10_rev", "1", CVAR_ARCHIVE | CVAR_LATCH);
|
||||
r_arb_vertex_array_object = ri.Cvar_Get( "r_arb_vertex_array_object", "1", CVAR_ARCHIVE | CVAR_LATCH);
|
||||
r_ext_direct_state_access = ri.Cvar_Get("r_ext_direct_state_access", "1", CVAR_ARCHIVE | CVAR_LATCH);
|
||||
|
||||
r_ext_texture_filter_anisotropic = ri.Cvar_Get( "r_ext_texture_filter_anisotropic",
|
||||
"0", CVAR_ARCHIVE | CVAR_LATCH );
|
||||
|
@ -1198,7 +1220,7 @@ void R_Register( void )
|
|||
r_floatLightmap = ri.Cvar_Get( "r_floatLightmap", "0", CVAR_ARCHIVE | CVAR_LATCH );
|
||||
r_postProcess = ri.Cvar_Get( "r_postProcess", "1", CVAR_ARCHIVE );
|
||||
|
||||
r_toneMap = ri.Cvar_Get( "r_toneMap", "1", CVAR_ARCHIVE | CVAR_LATCH );
|
||||
r_toneMap = ri.Cvar_Get( "r_toneMap", "1", CVAR_ARCHIVE );
|
||||
r_forceToneMap = ri.Cvar_Get( "r_forceToneMap", "0", CVAR_CHEAT );
|
||||
r_forceToneMapMin = ri.Cvar_Get( "r_forceToneMapMin", "-8.0", CVAR_CHEAT );
|
||||
r_forceToneMapAvg = ri.Cvar_Get( "r_forceToneMapAvg", "-2.0", CVAR_CHEAT );
|
||||
|
@ -1211,11 +1233,6 @@ void R_Register( void )
|
|||
|
||||
r_cameraExposure = ri.Cvar_Get( "r_cameraExposure", "0", CVAR_CHEAT );
|
||||
|
||||
r_materialGamma = ri.Cvar_Get( "r_materialGamma", "1.0", CVAR_ARCHIVE | CVAR_LATCH );
|
||||
r_lightGamma = ri.Cvar_Get( "r_lightGamma", "1.0", CVAR_ARCHIVE | CVAR_LATCH );
|
||||
r_framebufferGamma = ri.Cvar_Get( "r_framebufferGamma", "1.0", CVAR_ARCHIVE | CVAR_LATCH );
|
||||
r_tonemapGamma = ri.Cvar_Get( "r_tonemapGamma", "1.0", CVAR_ARCHIVE | CVAR_LATCH );
|
||||
|
||||
r_depthPrepass = ri.Cvar_Get( "r_depthPrepass", "1", CVAR_ARCHIVE );
|
||||
r_ssao = ri.Cvar_Get( "r_ssao", "0", CVAR_LATCH | CVAR_ARCHIVE );
|
||||
|
||||
|
@ -1224,13 +1241,14 @@ void R_Register( void )
|
|||
r_deluxeMapping = ri.Cvar_Get( "r_deluxeMapping", "1", CVAR_ARCHIVE | CVAR_LATCH );
|
||||
r_parallaxMapping = ri.Cvar_Get( "r_parallaxMapping", "0", CVAR_ARCHIVE | CVAR_LATCH );
|
||||
r_cubeMapping = ri.Cvar_Get( "r_cubeMapping", "0", CVAR_ARCHIVE | CVAR_LATCH );
|
||||
r_deluxeSpecular = ri.Cvar_Get( "r_deluxeSpecular", "0.3", CVAR_ARCHIVE | CVAR_LATCH );
|
||||
r_specularIsMetallic = ri.Cvar_Get( "r_specularIsMetallic", "0", CVAR_ARCHIVE | CVAR_LATCH );
|
||||
r_cubemapSize = ri.Cvar_Get( "r_cubemapSize", "128", CVAR_ARCHIVE | CVAR_LATCH );
|
||||
r_pbr = ri.Cvar_Get("r_pbr", "0", CVAR_ARCHIVE | CVAR_LATCH);
|
||||
r_baseNormalX = ri.Cvar_Get( "r_baseNormalX", "1.0", CVAR_ARCHIVE | CVAR_LATCH );
|
||||
r_baseNormalY = ri.Cvar_Get( "r_baseNormalY", "1.0", CVAR_ARCHIVE | CVAR_LATCH );
|
||||
r_baseParallax = ri.Cvar_Get( "r_baseParallax", "0.05", CVAR_ARCHIVE | CVAR_LATCH );
|
||||
r_baseSpecular = ri.Cvar_Get( "r_baseSpecular", "0.04", CVAR_ARCHIVE | CVAR_LATCH );
|
||||
r_baseGloss = ri.Cvar_Get( "r_baseGloss", "0.3", CVAR_ARCHIVE | CVAR_LATCH );
|
||||
r_glossType = ri.Cvar_Get("r_glossType", "1", CVAR_ARCHIVE | CVAR_LATCH);
|
||||
r_dlightMode = ri.Cvar_Get( "r_dlightMode", "0", CVAR_ARCHIVE | CVAR_LATCH );
|
||||
r_pshadowDist = ri.Cvar_Get( "r_pshadowDist", "128", CVAR_ARCHIVE );
|
||||
r_mergeLightmaps = ri.Cvar_Get( "r_mergeLightmaps", "1", CVAR_ARCHIVE | CVAR_LATCH );
|
||||
|
@ -1248,7 +1266,8 @@ void R_Register( void )
|
|||
|
||||
r_sunShadows = ri.Cvar_Get( "r_sunShadows", "1", CVAR_ARCHIVE | CVAR_LATCH );
|
||||
r_shadowFilter = ri.Cvar_Get( "r_shadowFilter", "1", CVAR_ARCHIVE | CVAR_LATCH );
|
||||
r_shadowMapSize = ri.Cvar_Get( "r_shadowMapSize", "1024", CVAR_ARCHIVE | CVAR_LATCH );
|
||||
r_shadowBlur = ri.Cvar_Get("r_shadowBlur", "0", CVAR_ARCHIVE | CVAR_LATCH);
|
||||
r_shadowMapSize = ri.Cvar_Get("r_shadowMapSize", "1024", CVAR_ARCHIVE | CVAR_LATCH);
|
||||
r_shadowCascadeZNear = ri.Cvar_Get( "r_shadowCascadeZNear", "8", CVAR_ARCHIVE | CVAR_LATCH );
|
||||
r_shadowCascadeZFar = ri.Cvar_Get( "r_shadowCascadeZFar", "1024", CVAR_ARCHIVE | CVAR_LATCH );
|
||||
r_shadowCascadeZBias = ri.Cvar_Get( "r_shadowCascadeZBias", "0", CVAR_ARCHIVE | CVAR_LATCH );
|
||||
|
@ -1370,6 +1389,7 @@ void R_Register( void )
|
|||
ri.Cmd_AddCommand( "gfxinfo", GfxInfo_f );
|
||||
ri.Cmd_AddCommand( "minimize", GLimp_Minimize );
|
||||
ri.Cmd_AddCommand( "gfxmeminfo", GfxMemInfo_f );
|
||||
ri.Cmd_AddCommand( "exportCubemaps", R_ExportCubemaps_f );
|
||||
}
|
||||
|
||||
void R_InitQueries(void)
|
||||
|
@ -1523,6 +1543,7 @@ void RE_Shutdown( qboolean destroyWindow ) {
|
|||
ri.Cmd_RemoveCommand( "modelist" );
|
||||
ri.Cmd_RemoveCommand( "shaderstate" );
|
||||
ri.Cmd_RemoveCommand( "gfxmeminfo" );
|
||||
ri.Cmd_RemoveCommand( "exportCubemaps" );
|
||||
|
||||
|
||||
if ( tr.registered ) {
|
||||
|
|
|
@ -485,7 +485,7 @@ int R_CubemapForPoint( vec3_t point )
|
|||
vec3_t diff;
|
||||
vec_t length;
|
||||
|
||||
VectorSubtract(point, tr.cubemapOrigins[i], diff);
|
||||
VectorSubtract(point, tr.cubemaps[i].origin, diff);
|
||||
length = DotProduct(diff, diff);
|
||||
|
||||
if (shortest > length)
|
||||
|
|
|
@ -54,10 +54,16 @@ typedef unsigned int glIndex_t;
|
|||
#define MAX_CALC_PSHADOWS 64
|
||||
#define MAX_DRAWN_PSHADOWS 16 // do not increase past 32, because bit flags are used on surfaces
|
||||
#define PSHADOW_MAP_SIZE 512
|
||||
#define CUBE_MAP_MIPS 7
|
||||
#define CUBE_MAP_SIZE (1 << CUBE_MAP_MIPS)
|
||||
|
||||
#define USE_VERT_TANGENT_SPACE
|
||||
#define USE_OVERBRIGHT
|
||||
|
||||
typedef struct cubemap_s {
|
||||
char name[MAX_QPATH];
|
||||
vec3_t origin;
|
||||
float parallaxRadius;
|
||||
image_t *image;
|
||||
} cubemap_t;
|
||||
|
||||
typedef struct dlight_s {
|
||||
vec3_t origin;
|
||||
|
@ -1342,8 +1348,6 @@ typedef struct {
|
|||
|
||||
// the renderer front end should never modify glstate_t
|
||||
typedef struct {
|
||||
int currenttextures[NUM_TEXTURE_BUNDLES];
|
||||
int currenttmu;
|
||||
qboolean finishCalled;
|
||||
int texEnv[2];
|
||||
int faceCulling;
|
||||
|
@ -1353,7 +1357,6 @@ typedef struct {
|
|||
float vertexAttribsInterpolation;
|
||||
qboolean vertexAnimation;
|
||||
uint32_t vertexAttribsEnabled; // global if no VAOs, tess only otherwise
|
||||
shaderProgram_t *currentProgram;
|
||||
FBO_t *currentFBO;
|
||||
vao_t *currentVao;
|
||||
mat4_t modelview;
|
||||
|
@ -1369,7 +1372,7 @@ typedef enum {
|
|||
|
||||
typedef enum {
|
||||
TCR_NONE = 0x0000,
|
||||
TCR_LATC = 0x0001,
|
||||
TCR_RGTC = 0x0001,
|
||||
TCR_BPTC = 0x0002,
|
||||
} textureCompressionRef_t;
|
||||
|
||||
|
@ -1393,7 +1396,9 @@ typedef struct {
|
|||
qboolean textureFloat;
|
||||
qboolean halfFloatPixel;
|
||||
qboolean packedDepthStencil;
|
||||
qboolean arbTextureCompression;
|
||||
textureCompressionRef_t textureCompression;
|
||||
qboolean swizzleNormalmap;
|
||||
|
||||
qboolean framebufferMultisample;
|
||||
qboolean framebufferBlit;
|
||||
|
@ -1409,6 +1414,7 @@ typedef struct {
|
|||
|
||||
qboolean floatLightmap;
|
||||
qboolean vertexArrayObject;
|
||||
qboolean directStateAccess;
|
||||
} glRefConfig_t;
|
||||
|
||||
|
||||
|
@ -1510,6 +1516,7 @@ typedef struct {
|
|||
image_t *sunRaysImage;
|
||||
image_t *renderDepthImage;
|
||||
image_t *pshadowMaps[MAX_DRAWN_PSHADOWS];
|
||||
image_t *screenScratchImage;
|
||||
image_t *textureScratchImage[2];
|
||||
image_t *quarterImage[2];
|
||||
image_t *calcLevelsImage;
|
||||
|
@ -1528,6 +1535,7 @@ typedef struct {
|
|||
FBO_t *sunRaysFbo;
|
||||
FBO_t *depthFbo;
|
||||
FBO_t *pshadowFbos[MAX_DRAWN_PSHADOWS];
|
||||
FBO_t *screenScratchFbo;
|
||||
FBO_t *textureScratchFbo[2];
|
||||
FBO_t *quarterFbo[2];
|
||||
FBO_t *calcLevelsFbo;
|
||||
|
@ -1555,8 +1563,7 @@ typedef struct {
|
|||
int fatLightmapStep;
|
||||
|
||||
int numCubemaps;
|
||||
vec3_t *cubemapOrigins;
|
||||
image_t **cubemaps;
|
||||
cubemap_t *cubemaps;
|
||||
|
||||
trRefEntity_t *currentEntity;
|
||||
trRefEntity_t worldEntity; // point currentEntity at this when rendering world
|
||||
|
@ -1580,7 +1587,7 @@ typedef struct {
|
|||
shaderProgram_t calclevels4xShader[2];
|
||||
shaderProgram_t shadowmaskShader;
|
||||
shaderProgram_t ssaoShader;
|
||||
shaderProgram_t depthBlurShader[2];
|
||||
shaderProgram_t depthBlurShader[4];
|
||||
shaderProgram_t testcubeShader;
|
||||
|
||||
|
||||
|
@ -1712,6 +1719,7 @@ extern cvar_t *r_ext_framebuffer_multisample;
|
|||
extern cvar_t *r_arb_seamless_cube_map;
|
||||
extern cvar_t *r_arb_vertex_type_2_10_10_10_rev;
|
||||
extern cvar_t *r_arb_vertex_array_object;
|
||||
extern cvar_t *r_ext_direct_state_access;
|
||||
|
||||
extern cvar_t *r_nobind; // turns off binding to appropriate textures
|
||||
extern cvar_t *r_singleShader; // make most world faces use default shader
|
||||
|
@ -1771,11 +1779,6 @@ extern cvar_t *r_forceAutoExposureMax;
|
|||
|
||||
extern cvar_t *r_cameraExposure;
|
||||
|
||||
extern cvar_t *r_materialGamma;
|
||||
extern cvar_t *r_lightGamma;
|
||||
extern cvar_t *r_framebufferGamma;
|
||||
extern cvar_t *r_tonemapGamma;
|
||||
|
||||
extern cvar_t *r_depthPrepass;
|
||||
extern cvar_t *r_ssao;
|
||||
|
||||
|
@ -1784,13 +1787,14 @@ extern cvar_t *r_specularMapping;
|
|||
extern cvar_t *r_deluxeMapping;
|
||||
extern cvar_t *r_parallaxMapping;
|
||||
extern cvar_t *r_cubeMapping;
|
||||
extern cvar_t *r_deluxeSpecular;
|
||||
extern cvar_t *r_specularIsMetallic;
|
||||
extern cvar_t *r_cubemapSize;
|
||||
extern cvar_t *r_pbr;
|
||||
extern cvar_t *r_baseNormalX;
|
||||
extern cvar_t *r_baseNormalY;
|
||||
extern cvar_t *r_baseParallax;
|
||||
extern cvar_t *r_baseSpecular;
|
||||
extern cvar_t *r_baseGloss;
|
||||
extern cvar_t *r_glossType;
|
||||
extern cvar_t *r_dlightMode;
|
||||
extern cvar_t *r_pshadowDist;
|
||||
extern cvar_t *r_mergeLightmaps;
|
||||
|
@ -1806,6 +1810,7 @@ extern cvar_t *r_sunlightMode;
|
|||
extern cvar_t *r_drawSunRays;
|
||||
extern cvar_t *r_sunShadows;
|
||||
extern cvar_t *r_shadowFilter;
|
||||
extern cvar_t *r_shadowBlur;
|
||||
extern cvar_t *r_shadowMapSize;
|
||||
extern cvar_t *r_shadowCascadeZNear;
|
||||
extern cvar_t *r_shadowCascadeZFar;
|
||||
|
@ -1875,17 +1880,14 @@ void R_RotateForEntity( const trRefEntity_t *ent, const viewParms_t *viewParms,
|
|||
/*
|
||||
** GL wrapper/helper functions
|
||||
*/
|
||||
void GL_Bind( image_t *image );
|
||||
void GL_BindToTMU( image_t *image, int tmu );
|
||||
void GL_SetDefaultState (void);
|
||||
void GL_SelectTexture( int unit );
|
||||
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(mat4_t matrix);
|
||||
void GL_SetModelviewMatrix(mat4_t matrix);
|
||||
void GL_TexEnv( int env );
|
||||
void GL_Cull( int cullType );
|
||||
|
||||
#define GLS_SRCBLEND_ZERO 0x00000001
|
||||
|
@ -2209,7 +2211,6 @@ void GLSL_InitGPUShaders(void);
|
|||
void GLSL_ShutdownGPUShaders(void);
|
||||
void GLSL_VertexAttribPointers(uint32_t attribBits);
|
||||
void GLSL_BindProgram(shaderProgram_t * program);
|
||||
void GLSL_BindNullProgram(void);
|
||||
|
||||
void GLSL_SetUniformInt(shaderProgram_t *program, int uniformNum, GLint value);
|
||||
void GLSL_SetUniformFloat(shaderProgram_t *program, int uniformNum, GLfloat value);
|
||||
|
@ -2411,6 +2412,10 @@ typedef struct {
|
|||
viewParms_t viewParms;
|
||||
} postProcessCommand_t;
|
||||
|
||||
typedef struct {
|
||||
int commandId;
|
||||
} exportCubemapsCommand_t;
|
||||
|
||||
typedef enum {
|
||||
RC_END_OF_LIST,
|
||||
RC_SET_COLOR,
|
||||
|
@ -2423,7 +2428,8 @@ typedef enum {
|
|||
RC_COLORMASK,
|
||||
RC_CLEARDEPTH,
|
||||
RC_CAPSHADOWMAP,
|
||||
RC_POSTPROCESS
|
||||
RC_POSTPROCESS,
|
||||
RC_EXPORT_CUBEMAPS
|
||||
} renderCommand_t;
|
||||
|
||||
|
||||
|
|
|
@ -1827,13 +1827,6 @@ void R_SortDrawSurfs( drawSurf_t *drawSurfs, int numDrawSurfs ) {
|
|||
return;
|
||||
}
|
||||
|
||||
// if we overflowed MAX_DRAWSURFS, the drawsurfs
|
||||
// wrapped around in the buffer and we will be missing
|
||||
// the first surfaces, not the last ones
|
||||
if ( numDrawSurfs > MAX_DRAWSURFS ) {
|
||||
numDrawSurfs = MAX_DRAWSURFS;
|
||||
}
|
||||
|
||||
// sort the drawsurfs by sort type, then orientation, then shader
|
||||
R_RadixSort( drawSurfs, numDrawSurfs );
|
||||
|
||||
|
@ -2056,7 +2049,7 @@ void R_DebugGraphics( void ) {
|
|||
|
||||
R_IssuePendingRenderCommands();
|
||||
|
||||
GL_Bind( tr.whiteImage);
|
||||
GL_BindToTMU(tr.whiteImage, TB_COLORMAP);
|
||||
GL_Cull( CT_FRONT_SIDED );
|
||||
ri.CM_DrawDebugSurface( R_DebugPolygon );
|
||||
}
|
||||
|
@ -2072,6 +2065,7 @@ or a mirror / remote location
|
|||
*/
|
||||
void R_RenderView (viewParms_t *parms) {
|
||||
int firstDrawSurf;
|
||||
int numDrawSurfs;
|
||||
|
||||
if ( parms->viewportWidth <= 0 || parms->viewportHeight <= 0 ) {
|
||||
return;
|
||||
|
@ -2094,7 +2088,15 @@ void R_RenderView (viewParms_t *parms) {
|
|||
|
||||
R_GenerateDrawSurfs();
|
||||
|
||||
R_SortDrawSurfs( tr.refdef.drawSurfs + firstDrawSurf, tr.refdef.numDrawSurfs - firstDrawSurf );
|
||||
// if we overflowed MAX_DRAWSURFS, the drawsurfs
|
||||
// wrapped around in the buffer and we will be missing
|
||||
// the first surfaces, not the last ones
|
||||
numDrawSurfs = tr.refdef.numDrawSurfs;
|
||||
if ( numDrawSurfs > MAX_DRAWSURFS ) {
|
||||
numDrawSurfs = MAX_DRAWSURFS;
|
||||
}
|
||||
|
||||
R_SortDrawSurfs( tr.refdef.drawSurfs + firstDrawSurf, numDrawSurfs - firstDrawSurf );
|
||||
|
||||
// draw main system development information (surface outlines, etc)
|
||||
R_DebugGraphics();
|
||||
|
@ -2879,7 +2881,7 @@ void R_RenderCubemapSide( int cubemapIndex, int cubemapSide, qboolean subscene )
|
|||
|
||||
memset( &refdef, 0, sizeof( refdef ) );
|
||||
refdef.rdflags = 0;
|
||||
VectorCopy(tr.cubemapOrigins[cubemapIndex], refdef.vieworg);
|
||||
VectorCopy(tr.cubemaps[cubemapIndex].origin, refdef.vieworg);
|
||||
|
||||
switch(cubemapSide)
|
||||
{
|
||||
|
@ -2948,12 +2950,16 @@ void R_RenderCubemapSide( int cubemapIndex, int cubemapSide, qboolean subscene )
|
|||
|
||||
{
|
||||
vec3_t ambient, directed, lightDir;
|
||||
float scale;
|
||||
|
||||
R_LightForPoint(tr.refdef.vieworg, ambient, directed, lightDir);
|
||||
tr.refdef.colorScale = 1.0f; //766.0f / (directed[0] + directed[1] + directed[2] + 1.0f);
|
||||
scale = directed[0] + directed[1] + directed[2] + ambient[0] + ambient[1] + ambient[2] + 1.0f;
|
||||
|
||||
tr.refdef.colorScale = 1.0f; //766.0f / scale;
|
||||
// only print message for first side
|
||||
if (directed[0] + directed[1] + directed[2] == 0 && cubemapSide == 0)
|
||||
if (scale < 1.0001f && cubemapSide == 0)
|
||||
{
|
||||
ri.Printf(PRINT_ALL, "cubemap %d (%f, %f, %f) is outside the lightgrid!\n", cubemapIndex, tr.refdef.vieworg[0], tr.refdef.vieworg[1], tr.refdef.vieworg[2]);
|
||||
ri.Printf(PRINT_ALL, "cubemap %d %s (%f, %f, %f) is outside the lightgrid or inside a wall!\n", cubemapIndex, tr.cubemaps[cubemapIndex].name, tr.refdef.vieworg[0], tr.refdef.vieworg[1], tr.refdef.vieworg[2]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -183,7 +183,7 @@ void RB_BokehBlur(FBO_t *src, ivec4_t srcBox, FBO_t *dst, ivec4_t dstBox, float
|
|||
FBO_Blit(tr.textureScratchFbo[0], NULL, blurTexScale, tr.textureScratchFbo[1], NULL, &tr.bokehShader, color, 0);
|
||||
}
|
||||
|
||||
FBO_Blit(tr.textureScratchFbo[1], NULL, NULL, dst, dstBox, &tr.textureColorShader, NULL, 0);
|
||||
FBO_Blit(tr.textureScratchFbo[1], NULL, NULL, dst, dstBox, NULL, NULL, 0);
|
||||
}
|
||||
#else // higher quality blur, but slower
|
||||
else if (blur > 1.0f)
|
||||
|
@ -217,7 +217,7 @@ void RB_BokehBlur(FBO_t *src, ivec4_t srcBox, FBO_t *dst, ivec4_t dstBox, float
|
|||
FBO_Blit(tr.quarterFbo[0], NULL, blurTexScale, tr.quarterFbo[1], NULL, &tr.bokehShader, color, GLS_SRCBLEND_SRC_ALPHA | GLS_DSTBLEND_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
|
||||
FBO_Blit(tr.quarterFbo[1], NULL, NULL, dst, dstBox, &tr.textureColorShader, NULL, 0);
|
||||
FBO_Blit(tr.quarterFbo[1], NULL, NULL, dst, dstBox, NULL, NULL, 0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -227,54 +227,40 @@ void RB_BokehBlur(FBO_t *src, ivec4_t srcBox, FBO_t *dst, ivec4_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)
|
||||
{
|
||||
ivec4_t srcBox, dstBox;
|
||||
int srcWidth, srcHeight;
|
||||
vec4_t color;
|
||||
const float inc = 1.f / passes;
|
||||
const float mul = powf(stretch, inc);
|
||||
float scale;
|
||||
|
||||
alpha *= inc;
|
||||
VectorSet4(color, alpha, alpha, alpha, 1.0f);
|
||||
|
||||
srcWidth = srcFbo ? srcFbo->width : glConfig.vidWidth;
|
||||
srcHeight = srcFbo ? srcFbo->height : glConfig.vidHeight;
|
||||
|
||||
VectorSet4(srcBox, 0, 0, srcWidth, srcHeight);
|
||||
|
||||
VectorSet4(dstBox, x, y, w, h);
|
||||
FBO_Blit(srcFbo, srcBox, NULL, dstFbo, dstBox, NULL, color, 0);
|
||||
|
||||
--passes;
|
||||
scale = mul;
|
||||
while (passes > 0)
|
||||
{
|
||||
vec2_t texScale;
|
||||
float iscale = 1.f / scale;
|
||||
float s0 = xcenter * (1.f - iscale);
|
||||
float t0 = (1.0f - ycenter) * (1.f - iscale);
|
||||
|
||||
texScale[0] =
|
||||
texScale[1] = 1.0f;
|
||||
|
||||
alpha *= inc;
|
||||
VectorSet4(color, alpha, alpha, alpha, 1.0f);
|
||||
|
||||
VectorSet4(srcBox, 0, 0, srcFbo->width, srcFbo->height);
|
||||
VectorSet4(dstBox, x, y, w, h);
|
||||
FBO_Blit(srcFbo, srcBox, texScale, dstFbo, dstBox, &tr.textureColorShader, color, 0);
|
||||
|
||||
--passes;
|
||||
scale = mul;
|
||||
while (passes > 0)
|
||||
{
|
||||
float iscale = 1.f / scale;
|
||||
float s0 = xcenter * (1.f - iscale);
|
||||
float t0 = (1.0f - ycenter) * (1.f - iscale);
|
||||
float s1 = iscale + s0;
|
||||
float t1 = iscale + t0;
|
||||
|
||||
if (srcFbo)
|
||||
{
|
||||
srcBox[0] = s0 * srcFbo->width;
|
||||
srcBox[1] = t0 * srcFbo->height;
|
||||
srcBox[2] = (s1 - s0) * srcFbo->width;
|
||||
srcBox[3] = (t1 - t0) * srcFbo->height;
|
||||
}
|
||||
else
|
||||
{
|
||||
srcBox[0] = s0 * glConfig.vidWidth;
|
||||
srcBox[1] = t0 * glConfig.vidHeight;
|
||||
srcBox[2] = (s1 - s0) * glConfig.vidWidth;
|
||||
srcBox[3] = (t1 - t0) * glConfig.vidHeight;
|
||||
}
|
||||
srcBox[0] = s0 * srcWidth;
|
||||
srcBox[1] = t0 * srcHeight;
|
||||
srcBox[2] = iscale * srcWidth;
|
||||
srcBox[3] = iscale * srcHeight;
|
||||
|
||||
FBO_Blit(srcFbo, srcBox, texScale, dstFbo, dstBox, &tr.textureColorShader, color, GLS_SRCBLEND_ONE | GLS_DSTBLEND_ONE );
|
||||
FBO_Blit(srcFbo, srcBox, NULL, dstFbo, dstBox, NULL, color, GLS_SRCBLEND_ONE | GLS_DSTBLEND_ONE );
|
||||
|
||||
scale *= mul;
|
||||
--passes;
|
||||
}
|
||||
scale *= mul;
|
||||
--passes;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -329,7 +315,7 @@ void RB_SunRays(FBO_t *srcFbo, ivec4_t srcBox, FBO_t *dstFbo, ivec4_t dstBox)
|
|||
// From RB_DrawSun()
|
||||
{
|
||||
float dist;
|
||||
mat4_t trans, model, mvp;
|
||||
mat4_t trans, model;
|
||||
|
||||
Mat4Translation( backEnd.viewParms.or.origin, trans );
|
||||
Mat4Multiply( backEnd.viewParms.world.modelMatrix, trans, model );
|
||||
|
@ -353,28 +339,16 @@ void RB_SunRays(FBO_t *srcFbo, ivec4_t srcBox, FBO_t *dstFbo, ivec4_t dstBox)
|
|||
// initialize quarter buffers
|
||||
{
|
||||
float mul = 1.f;
|
||||
vec2_t texScale;
|
||||
ivec4_t rayBox, quarterBox;
|
||||
|
||||
texScale[0] =
|
||||
texScale[1] = 1.0f;
|
||||
int srcWidth = srcFbo ? srcFbo->width : glConfig.vidWidth;
|
||||
int srcHeight = srcFbo ? srcFbo->height : glConfig.vidHeight;
|
||||
|
||||
VectorSet4(color, mul, mul, mul, 1);
|
||||
|
||||
if (srcFbo)
|
||||
{
|
||||
rayBox[0] = srcBox[0] * tr.sunRaysFbo->width / srcFbo->width;
|
||||
rayBox[1] = srcBox[1] * tr.sunRaysFbo->height / srcFbo->height;
|
||||
rayBox[2] = srcBox[2] * tr.sunRaysFbo->width / srcFbo->width;
|
||||
rayBox[3] = srcBox[3] * tr.sunRaysFbo->height / srcFbo->height;
|
||||
}
|
||||
else
|
||||
{
|
||||
rayBox[0] = srcBox[0] * tr.sunRaysFbo->width / glConfig.vidWidth;
|
||||
rayBox[1] = srcBox[1] * tr.sunRaysFbo->height / glConfig.vidHeight;
|
||||
rayBox[2] = srcBox[2] * tr.sunRaysFbo->width / glConfig.vidWidth;
|
||||
rayBox[3] = srcBox[3] * tr.sunRaysFbo->height / glConfig.vidHeight;
|
||||
}
|
||||
rayBox[0] = srcBox[0] * tr.sunRaysFbo->width / srcWidth;
|
||||
rayBox[1] = srcBox[1] * tr.sunRaysFbo->height / srcHeight;
|
||||
rayBox[2] = srcBox[2] * tr.sunRaysFbo->width / srcWidth;
|
||||
rayBox[3] = srcBox[3] * tr.sunRaysFbo->height / srcHeight;
|
||||
|
||||
quarterBox[0] = 0;
|
||||
quarterBox[1] = tr.quarterFbo[0]->height;
|
||||
|
@ -408,14 +382,10 @@ void RB_SunRays(FBO_t *srcFbo, ivec4_t srcBox, FBO_t *dstFbo, ivec4_t dstBox)
|
|||
// add result back on top of the main buffer
|
||||
{
|
||||
float mul = 1.f;
|
||||
vec2_t texScale;
|
||||
|
||||
texScale[0] =
|
||||
texScale[1] = 1.0f;
|
||||
|
||||
VectorSet4(color, mul, mul, mul, 1);
|
||||
|
||||
FBO_Blit(tr.quarterFbo[0], NULL, texScale, dstFbo, dstBox, &tr.textureColorShader, color, GLS_SRCBLEND_ONE | GLS_DSTBLEND_ONE);
|
||||
FBO_Blit(tr.quarterFbo[0], NULL, NULL, dstFbo, dstBox, NULL, color, GLS_SRCBLEND_ONE | GLS_DSTBLEND_ONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -443,31 +413,27 @@ static void RB_BlurAxis(FBO_t *srcFbo, FBO_t *dstFbo, float strength, qboolean h
|
|||
{
|
||||
ivec4_t srcBox, dstBox;
|
||||
vec4_t color;
|
||||
vec2_t texScale;
|
||||
|
||||
texScale[0] =
|
||||
texScale[1] = 1.0f;
|
||||
|
||||
VectorSet4(color, weights[0], weights[0], weights[0], 1.0f);
|
||||
VectorSet4(srcBox, 0, 0, srcFbo->width, srcFbo->height);
|
||||
VectorSet4(dstBox, 0, 0, dstFbo->width, dstFbo->height);
|
||||
FBO_Blit(srcFbo, srcBox, texScale, dstFbo, dstBox, &tr.textureColorShader, color, 0 );
|
||||
FBO_Blit(srcFbo, srcBox, NULL, dstFbo, dstBox, NULL, color, 0);
|
||||
|
||||
VectorSet4(color, weights[1], weights[1], weights[1], 1.0f);
|
||||
dx = offsets[1] * xmul;
|
||||
dy = offsets[1] * ymul;
|
||||
VectorSet4(srcBox, dx, dy, srcFbo->width, srcFbo->height);
|
||||
FBO_Blit(srcFbo, srcBox, texScale, dstFbo, dstBox, &tr.textureColorShader, color, GLS_SRCBLEND_ONE | GLS_DSTBLEND_ONE );
|
||||
FBO_Blit(srcFbo, srcBox, NULL, dstFbo, dstBox, NULL, color, GLS_SRCBLEND_ONE | GLS_DSTBLEND_ONE);
|
||||
VectorSet4(srcBox, -dx, -dy, srcFbo->width, srcFbo->height);
|
||||
FBO_Blit(srcFbo, srcBox, texScale, dstFbo, dstBox, &tr.textureColorShader, color, GLS_SRCBLEND_ONE | GLS_DSTBLEND_ONE );
|
||||
FBO_Blit(srcFbo, srcBox, NULL, dstFbo, dstBox, NULL, color, GLS_SRCBLEND_ONE | GLS_DSTBLEND_ONE);
|
||||
|
||||
VectorSet4(color, weights[2], weights[2], weights[2], 1.0f);
|
||||
dx = offsets[2] * xmul;
|
||||
dy = offsets[2] * ymul;
|
||||
VectorSet4(srcBox, dx, dy, srcFbo->width, srcFbo->height);
|
||||
FBO_Blit(srcFbo, srcBox, texScale, dstFbo, dstBox, &tr.textureColorShader, color, GLS_SRCBLEND_ONE | GLS_DSTBLEND_ONE );
|
||||
FBO_Blit(srcFbo, srcBox, NULL, dstFbo, dstBox, NULL, color, GLS_SRCBLEND_ONE | GLS_DSTBLEND_ONE);
|
||||
VectorSet4(srcBox, -dx, -dy, srcFbo->width, srcFbo->height);
|
||||
FBO_Blit(srcFbo, srcBox, texScale, dstFbo, dstBox, &tr.textureColorShader, color, GLS_SRCBLEND_ONE | GLS_DSTBLEND_ONE );
|
||||
FBO_Blit(srcFbo, srcBox, NULL, dstFbo, dstBox, NULL, color, GLS_SRCBLEND_ONE | GLS_DSTBLEND_ONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -492,10 +458,6 @@ void RB_GaussianBlur(float blur)
|
|||
{
|
||||
ivec4_t srcBox, dstBox;
|
||||
vec4_t color;
|
||||
vec2_t texScale;
|
||||
|
||||
texScale[0] =
|
||||
texScale[1] = 1.0f;
|
||||
|
||||
VectorSet4(color, 1, 1, 1, 1);
|
||||
|
||||
|
@ -504,10 +466,8 @@ void RB_GaussianBlur(float blur)
|
|||
FBO_FastBlit(tr.quarterFbo[0], NULL, tr.textureScratchFbo[0], NULL, GL_COLOR_BUFFER_BIT, GL_LINEAR);
|
||||
|
||||
// set the alpha channel
|
||||
VectorSet4(srcBox, 0, 0, tr.whiteImage->width, tr.whiteImage->height);
|
||||
VectorSet4(dstBox, 0, 0, tr.textureScratchFbo[0]->width, tr.textureScratchFbo[0]->height);
|
||||
qglColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE);
|
||||
FBO_BlitFromTexture(tr.whiteImage, srcBox, texScale, tr.textureScratchFbo[0], dstBox, &tr.textureColorShader, color, GLS_DEPTHTEST_DISABLE);
|
||||
FBO_BlitFromTexture(tr.whiteImage, NULL, NULL, tr.textureScratchFbo[0], NULL, NULL, color, GLS_DEPTHTEST_DISABLE);
|
||||
qglColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
||||
|
||||
// blur the tiny buffer horizontally and vertically
|
||||
|
@ -518,6 +478,6 @@ void RB_GaussianBlur(float blur)
|
|||
VectorSet4(srcBox, 0, 0, tr.textureScratchFbo[0]->width, tr.textureScratchFbo[0]->height);
|
||||
VectorSet4(dstBox, 0, 0, glConfig.vidWidth, glConfig.vidHeight);
|
||||
color[3] = factor;
|
||||
FBO_Blit(tr.textureScratchFbo[0], srcBox, texScale, NULL, dstBox, &tr.textureColorShader, color, GLS_SRCBLEND_SRC_ALPHA | GLS_DSTBLEND_ONE_MINUS_SRC_ALPHA);
|
||||
FBO_Blit(tr.textureScratchFbo[0], srcBox, NULL, NULL, dstBox, NULL, color, GLS_SRCBLEND_SRC_ALPHA | GLS_DSTBLEND_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -337,31 +337,30 @@ void RE_BeginScene(const refdef_t *fd)
|
|||
}
|
||||
else
|
||||
{
|
||||
#if defined(USE_OVERBRIGHT)
|
||||
float scale = (1 << (r_mapOverBrightBits->integer - tr.overbrightBits)) / 255.0f;
|
||||
#else
|
||||
float scale = (1 << r_mapOverBrightBits->integer) / 255.0f;
|
||||
#endif
|
||||
tr.refdef.colorScale = r_forceSun->integer ? r_forceSunMapLightScale->value : tr.mapLightScale;
|
||||
|
||||
if (r_forceSun->integer)
|
||||
VectorScale(tr.sunLight, scale * r_forceSunLightScale->value, tr.refdef.sunCol);
|
||||
else
|
||||
VectorScale(tr.sunLight, scale, tr.refdef.sunCol);
|
||||
|
||||
if (r_sunlightMode->integer == 1)
|
||||
{
|
||||
tr.refdef.sunCol[0] =
|
||||
tr.refdef.sunCol[1] =
|
||||
tr.refdef.sunCol[2] = 1.0f;
|
||||
|
||||
tr.refdef.sunAmbCol[0] =
|
||||
tr.refdef.sunAmbCol[1] =
|
||||
tr.refdef.sunAmbCol[2] = r_forceSun->integer ? r_forceSunAmbientScale->value : tr.sunShadowScale;
|
||||
}
|
||||
else
|
||||
{
|
||||
float scale = pow(2, r_mapOverBrightBits->integer - tr.overbrightBits - 8);
|
||||
if (r_forceSun->integer)
|
||||
{
|
||||
VectorScale(tr.sunLight, scale * r_forceSunLightScale->value, tr.refdef.sunCol);
|
||||
VectorScale(tr.sunLight, scale * r_forceSunAmbientScale->value, tr.refdef.sunAmbCol);
|
||||
}
|
||||
else
|
||||
{
|
||||
VectorScale(tr.sunLight, scale, tr.refdef.sunCol);
|
||||
VectorScale(tr.sunLight, scale * tr.sunShadowScale, tr.refdef.sunAmbCol);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
// tr_shade.c
|
||||
|
||||
#include "tr_local.h"
|
||||
#if idppc_altivec && !defined(MACOS_X)
|
||||
#if idppc_altivec && !defined(__APPLE__)
|
||||
#include <altivec.h>
|
||||
#endif
|
||||
|
||||
|
@ -101,11 +101,9 @@ static void R_BindAnimatedImageToTMU( textureBundle_t *bundle, int tmu ) {
|
|||
int index;
|
||||
|
||||
if ( bundle->isVideoMap ) {
|
||||
int oldtmu = glState.currenttmu;
|
||||
GL_SelectTexture(tmu);
|
||||
ri.CIN_RunCinematic(bundle->videoMapHandle);
|
||||
ri.CIN_UploadCinematic(bundle->videoMapHandle);
|
||||
GL_SelectTexture(oldtmu);
|
||||
GL_BindToTMU(tr.scratchImage[bundle->videoMapHandle], tmu);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -136,7 +134,7 @@ Draws triangle outlines for debugging
|
|||
================
|
||||
*/
|
||||
static void DrawTris (shaderCommands_t *input) {
|
||||
GL_Bind( tr.whiteImage );
|
||||
GL_BindToTMU( tr.whiteImage, TB_COLORMAP );
|
||||
|
||||
GL_State( GLS_POLYMODE_LINE | GLS_DEPTHMASK_TRUE );
|
||||
qglDepthRange( 0, 0 );
|
||||
|
@ -414,7 +412,7 @@ static void ProjectDlightTexture( void ) {
|
|||
vector[3] = scale;
|
||||
GLSL_SetUniformVec4(sp, UNIFORM_DLIGHTINFO, vector);
|
||||
|
||||
GL_Bind( tr.dlightImage );
|
||||
GL_BindToTMU( tr.dlightImage, TB_COLORMAP );
|
||||
|
||||
// include GLS_DEPTHFUNC_EQUAL so alpha tested surfaces don't add light
|
||||
// where they aren't rendered
|
||||
|
@ -444,9 +442,22 @@ static void ProjectDlightTexture( void ) {
|
|||
|
||||
static void ComputeShaderColors( shaderStage_t *pStage, vec4_t baseColor, vec4_t vertColor, int blend )
|
||||
{
|
||||
qboolean isBlend = ((blend & GLS_SRCBLEND_BITS) == GLS_SRCBLEND_DST_COLOR)
|
||||
|| ((blend & GLS_SRCBLEND_BITS) == GLS_SRCBLEND_ONE_MINUS_DST_COLOR)
|
||||
|| ((blend & GLS_DSTBLEND_BITS) == GLS_DSTBLEND_SRC_COLOR)
|
||||
|| ((blend & GLS_DSTBLEND_BITS) == GLS_DSTBLEND_ONE_MINUS_SRC_COLOR);
|
||||
qboolean isWorldDraw = !(backEnd.refdef.rdflags & RDF_NOWORLDMODEL);
|
||||
float scale = 1.0f;
|
||||
|
||||
#if defined(USE_OVERBRIGHT)
|
||||
float exactLight = 1.0f;
|
||||
#else
|
||||
float exactLight = (isBlend || !isWorldDraw) ? 1.0f : (float)(1 << r_mapOverBrightBits->integer);
|
||||
#endif
|
||||
|
||||
baseColor[0] =
|
||||
baseColor[1] =
|
||||
baseColor[2] =
|
||||
baseColor[2] = exactLight;
|
||||
baseColor[3] = 1.0f;
|
||||
|
||||
vertColor[0] =
|
||||
|
@ -473,7 +484,7 @@ static void ComputeShaderColors( shaderStage_t *pStage, vec4_t baseColor, vec4_t
|
|||
|
||||
vertColor[0] =
|
||||
vertColor[1] =
|
||||
vertColor[2] =
|
||||
vertColor[2] = exactLight;
|
||||
vertColor[3] = 1.0f;
|
||||
break;
|
||||
case CGEN_CONST:
|
||||
|
@ -600,21 +611,16 @@ static void ComputeShaderColors( shaderStage_t *pStage, vec4_t baseColor, vec4_t
|
|||
break;
|
||||
}
|
||||
|
||||
// multiply color by overbrightbits if this isn't a blend
|
||||
if (tr.overbrightBits
|
||||
&& !((blend & GLS_SRCBLEND_BITS) == GLS_SRCBLEND_DST_COLOR)
|
||||
&& !((blend & GLS_SRCBLEND_BITS) == GLS_SRCBLEND_ONE_MINUS_DST_COLOR)
|
||||
&& !((blend & GLS_DSTBLEND_BITS) == GLS_DSTBLEND_SRC_COLOR)
|
||||
&& !((blend & GLS_DSTBLEND_BITS) == GLS_DSTBLEND_ONE_MINUS_SRC_COLOR))
|
||||
{
|
||||
float scale = 1 << tr.overbrightBits;
|
||||
if (tr.overbrightBits && !isBlend)
|
||||
scale *= 1 << tr.overbrightBits;
|
||||
|
||||
baseColor[0] *= scale;
|
||||
baseColor[1] *= scale;
|
||||
baseColor[2] *= scale;
|
||||
vertColor[0] *= scale;
|
||||
vertColor[1] *= scale;
|
||||
vertColor[2] *= scale;
|
||||
if ((backEnd.refdef.colorScale != 1.0f) && !isBlend && isWorldDraw)
|
||||
scale *= backEnd.refdef.colorScale;
|
||||
|
||||
if (scale != 1.0f)
|
||||
{
|
||||
VectorScale(baseColor, scale, baseColor);
|
||||
VectorScale(vertColor, scale, vertColor);
|
||||
}
|
||||
|
||||
// FIXME: find some way to implement this.
|
||||
|
@ -854,11 +860,7 @@ static void ForwardDlight( void ) {
|
|||
}
|
||||
|
||||
if (r_dlightMode->integer >= 2)
|
||||
{
|
||||
GL_SelectTexture(TB_SHADOWMAP);
|
||||
GL_Bind(tr.shadowCubemaps[l]);
|
||||
GL_SelectTexture(0);
|
||||
}
|
||||
GL_BindToTMU(tr.shadowCubemaps[l], TB_SHADOWMAP);
|
||||
|
||||
ComputeTexMods( pStage, TB_DIFFUSEMAP, texMatrix, texOffTurb );
|
||||
GLSL_SetUniformVec4(sp, UNIFORM_DIFFUSETEXMATRIX, texMatrix);
|
||||
|
@ -1074,6 +1076,8 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input )
|
|||
int deformGen;
|
||||
vec5_t deformParams;
|
||||
|
||||
qboolean renderToCubemap = tr.renderCubeFbo && glState.currentFBO == tr.renderCubeFbo;
|
||||
|
||||
ComputeDeformValues(&deformGen, deformParams);
|
||||
|
||||
ComputeFogValues(fogDistanceVector, fogDepthVector, &eyeT);
|
||||
|
@ -1165,9 +1169,9 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input )
|
|||
index |= LIGHTDEF_USE_SHADOWMAP;
|
||||
}
|
||||
|
||||
if (r_lightmap->integer && index & LIGHTDEF_USE_LIGHTMAP)
|
||||
if (r_lightmap->integer && ((index & LIGHTDEF_LIGHTTYPE_MASK) == LIGHTDEF_USE_LIGHTMAP))
|
||||
{
|
||||
index = LIGHTDEF_USE_LIGHTMAP;
|
||||
index = LIGHTDEF_USE_TCGEN_AND_TCMOD;
|
||||
}
|
||||
|
||||
sp = &pStage->glslShaderGroup[index];
|
||||
|
@ -1210,13 +1214,6 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input )
|
|||
|
||||
ComputeShaderColors(pStage, baseColor, vertColor, pStage->stateBits);
|
||||
|
||||
if ((backEnd.refdef.colorScale != 1.0f) && !(backEnd.refdef.rdflags & RDF_NOWORLDMODEL))
|
||||
{
|
||||
// use VectorScale to only scale first three values, not alpha
|
||||
VectorScale(baseColor, backEnd.refdef.colorScale, baseColor);
|
||||
VectorScale(vertColor, backEnd.refdef.colorScale, vertColor);
|
||||
}
|
||||
|
||||
GLSL_SetUniformVec4(sp, UNIFORM_BASECOLOR, baseColor);
|
||||
GLSL_SetUniformVec4(sp, UNIFORM_VERTCOLOR, vertColor);
|
||||
}
|
||||
|
@ -1256,25 +1253,51 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input )
|
|||
GLSL_SetUniformVec4(sp, UNIFORM_FOGCOLORMASK, fogColorMask);
|
||||
}
|
||||
|
||||
ComputeTexMods( pStage, TB_DIFFUSEMAP, texMatrix, texOffTurb );
|
||||
GLSL_SetUniformVec4(sp, UNIFORM_DIFFUSETEXMATRIX, texMatrix);
|
||||
GLSL_SetUniformVec4(sp, UNIFORM_DIFFUSETEXOFFTURB, texOffTurb);
|
||||
|
||||
GLSL_SetUniformInt(sp, UNIFORM_TCGEN0, pStage->bundle[0].tcGen);
|
||||
if (pStage->bundle[0].tcGen == TCGEN_VECTOR)
|
||||
if (r_lightmap->integer)
|
||||
{
|
||||
vec3_t vec;
|
||||
vec4_t v;
|
||||
VectorSet4(v, 1.0f, 0.0f, 0.0f, 1.0f);
|
||||
GLSL_SetUniformVec4(sp, UNIFORM_DIFFUSETEXMATRIX, v);
|
||||
VectorSet4(v, 0.0f, 0.0f, 0.0f, 0.0f);
|
||||
GLSL_SetUniformVec4(sp, UNIFORM_DIFFUSETEXOFFTURB, v);
|
||||
|
||||
VectorCopy(pStage->bundle[0].tcGenVectors[0], vec);
|
||||
GLSL_SetUniformVec3(sp, UNIFORM_TCGEN0VECTOR0, vec);
|
||||
VectorCopy(pStage->bundle[0].tcGenVectors[1], vec);
|
||||
GLSL_SetUniformVec3(sp, UNIFORM_TCGEN0VECTOR1, vec);
|
||||
GLSL_SetUniformInt(sp, UNIFORM_TCGEN0, TCGEN_LIGHTMAP);
|
||||
}
|
||||
else
|
||||
{
|
||||
ComputeTexMods(pStage, TB_DIFFUSEMAP, texMatrix, texOffTurb);
|
||||
GLSL_SetUniformVec4(sp, UNIFORM_DIFFUSETEXMATRIX, texMatrix);
|
||||
GLSL_SetUniformVec4(sp, UNIFORM_DIFFUSETEXOFFTURB, texOffTurb);
|
||||
|
||||
GLSL_SetUniformInt(sp, UNIFORM_TCGEN0, pStage->bundle[0].tcGen);
|
||||
if (pStage->bundle[0].tcGen == TCGEN_VECTOR)
|
||||
{
|
||||
vec3_t vec;
|
||||
|
||||
VectorCopy(pStage->bundle[0].tcGenVectors[0], vec);
|
||||
GLSL_SetUniformVec3(sp, UNIFORM_TCGEN0VECTOR0, vec);
|
||||
VectorCopy(pStage->bundle[0].tcGenVectors[1], vec);
|
||||
GLSL_SetUniformVec3(sp, UNIFORM_TCGEN0VECTOR1, vec);
|
||||
}
|
||||
}
|
||||
|
||||
GLSL_SetUniformMat4(sp, UNIFORM_MODELMATRIX, backEnd.or.transformMatrix);
|
||||
|
||||
GLSL_SetUniformVec4(sp, UNIFORM_NORMALSCALE, pStage->normalScale);
|
||||
GLSL_SetUniformVec4(sp, UNIFORM_SPECULARSCALE, pStage->specularScale);
|
||||
|
||||
{
|
||||
vec4_t specularScale;
|
||||
Vector4Copy(pStage->specularScale, specularScale);
|
||||
|
||||
if (renderToCubemap)
|
||||
{
|
||||
// force specular to nonmetal if rendering cubemaps
|
||||
if (r_pbr->integer)
|
||||
specularScale[1] = 0.0f;
|
||||
}
|
||||
|
||||
GLSL_SetUniformVec4(sp, UNIFORM_SPECULARSCALE, specularScale);
|
||||
}
|
||||
|
||||
//GLSL_SetUniformFloat(sp, UNIFORM_MAPLIGHTSCALE, backEnd.refdef.mapLightScale);
|
||||
|
||||
|
@ -1284,7 +1307,7 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input )
|
|||
if ( backEnd.depthFill )
|
||||
{
|
||||
if (!(pStage->stateBits & GLS_ATEST_BITS))
|
||||
GL_BindToTMU( tr.whiteImage, 0 );
|
||||
GL_BindToTMU( tr.whiteImage, TB_COLORMAP );
|
||||
else if ( pStage->bundle[TB_COLORMAP].image[0] != 0 )
|
||||
R_BindAnimatedImageToTMU( &pStage->bundle[TB_COLORMAP], TB_COLORMAP );
|
||||
}
|
||||
|
@ -1297,7 +1320,19 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input )
|
|||
{
|
||||
GL_BindToTMU(tr.screenShadowImage, TB_SHADOWMAP);
|
||||
GLSL_SetUniformVec3(sp, UNIFORM_PRIMARYLIGHTAMBIENT, backEnd.refdef.sunAmbCol);
|
||||
GLSL_SetUniformVec3(sp, UNIFORM_PRIMARYLIGHTCOLOR, backEnd.refdef.sunCol);
|
||||
if (r_pbr->integer)
|
||||
{
|
||||
vec3_t color;
|
||||
|
||||
color[0] = backEnd.refdef.sunCol[0] * backEnd.refdef.sunCol[0];
|
||||
color[1] = backEnd.refdef.sunCol[1] * backEnd.refdef.sunCol[1];
|
||||
color[2] = backEnd.refdef.sunCol[2] * backEnd.refdef.sunCol[2];
|
||||
GLSL_SetUniformVec3(sp, UNIFORM_PRIMARYLIGHTCOLOR, color);
|
||||
}
|
||||
else
|
||||
{
|
||||
GLSL_SetUniformVec3(sp, UNIFORM_PRIMARYLIGHTCOLOR, backEnd.refdef.sunCol);
|
||||
}
|
||||
GLSL_SetUniformVec4(sp, UNIFORM_PRIMARYLIGHTORIGIN, backEnd.refdef.sunDir);
|
||||
}
|
||||
|
||||
|
@ -1306,7 +1341,7 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input )
|
|||
{
|
||||
for (i = 0; i < NUM_TEXTURE_BUNDLES; i++)
|
||||
{
|
||||
if (i == TB_LIGHTMAP)
|
||||
if (i == TB_COLORMAP)
|
||||
R_BindAnimatedImageToTMU( &pStage->bundle[TB_LIGHTMAP], i);
|
||||
else
|
||||
GL_BindToTMU( tr.whiteImage, i );
|
||||
|
@ -1316,7 +1351,7 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input )
|
|||
{
|
||||
for (i = 0; i < NUM_TEXTURE_BUNDLES; i++)
|
||||
{
|
||||
if (i == TB_LIGHTMAP)
|
||||
if (i == TB_COLORMAP)
|
||||
R_BindAnimatedImageToTMU( &pStage->bundle[TB_DELUXEMAP], i);
|
||||
else
|
||||
GL_BindToTMU( tr.whiteImage, i );
|
||||
|
@ -1393,15 +1428,14 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input )
|
|||
if (!(tr.viewParms.flags & VPF_NOCUBEMAPS) && input->cubemapIndex && r_cubeMapping->integer)
|
||||
{
|
||||
vec4_t vec;
|
||||
cubemap_t *cubemap = &tr.cubemaps[input->cubemapIndex - 1];
|
||||
|
||||
GL_BindToTMU( tr.cubemaps[input->cubemapIndex - 1], TB_CUBEMAP);
|
||||
GL_BindToTMU( cubemap->image, TB_CUBEMAP);
|
||||
|
||||
vec[0] = tr.cubemapOrigins[input->cubemapIndex - 1][0] - backEnd.viewParms.or.origin[0];
|
||||
vec[1] = tr.cubemapOrigins[input->cubemapIndex - 1][1] - backEnd.viewParms.or.origin[1];
|
||||
vec[2] = tr.cubemapOrigins[input->cubemapIndex - 1][2] - backEnd.viewParms.or.origin[2];
|
||||
VectorSubtract(cubemap->origin, backEnd.viewParms.or.origin, vec);
|
||||
vec[3] = 1.0f;
|
||||
|
||||
VectorScale4(vec, 1.0f / 1000.0f, vec);
|
||||
VectorScale4(vec, 1.0f / cubemap->parallaxRadius, vec);
|
||||
|
||||
GLSL_SetUniformVec4(sp, UNIFORM_CUBEMAPINFO, vec);
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
// tr_shade_calc.c
|
||||
|
||||
#include "tr_local.h"
|
||||
#if idppc_altivec && !defined(MACOS_X)
|
||||
#if idppc_altivec && !defined(__APPLE__)
|
||||
#include <altivec.h>
|
||||
#endif
|
||||
|
||||
|
|
|
@ -944,9 +944,18 @@ static qboolean ParseStage( shaderStage_t *stage, char **text )
|
|||
ri.Printf( PRINT_WARNING, "WARNING: missing parameter for specular reflectance in shader '%s'\n", shader.name );
|
||||
continue;
|
||||
}
|
||||
stage->specularScale[0] =
|
||||
stage->specularScale[1] =
|
||||
stage->specularScale[2] = atof( token );
|
||||
|
||||
if (r_pbr->integer)
|
||||
{
|
||||
// interpret specularReflectance < 0.5 as nonmetal
|
||||
stage->specularScale[1] = (atof(token) < 0.5f) ? 0.0f : 1.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
stage->specularScale[0] =
|
||||
stage->specularScale[1] =
|
||||
stage->specularScale[2] = atof( token );
|
||||
}
|
||||
}
|
||||
//
|
||||
// specularExponent <value>
|
||||
|
@ -964,17 +973,23 @@ static qboolean ParseStage( shaderStage_t *stage, char **text )
|
|||
|
||||
exponent = atof( token );
|
||||
|
||||
// Change shininess to gloss
|
||||
// FIXME: assumes max exponent of 8192 and min of 1, must change here if altered in lightall_fp.glsl
|
||||
exponent = CLAMP(exponent, 1.0, 8192.0);
|
||||
|
||||
stage->specularScale[3] = log(exponent) / log(8192.0);
|
||||
if (r_pbr->integer)
|
||||
stage->specularScale[0] = 1.0f - powf(2.0f / (exponent + 2.0), 0.25);
|
||||
else
|
||||
{
|
||||
// Change shininess to gloss
|
||||
// Assumes max exponent of 8190 and min of 0, must change here if altered in lightall_fp.glsl
|
||||
exponent = CLAMP(exponent, 0.0f, 8190.0f);
|
||||
stage->specularScale[3] = (log2f(exponent + 2.0f) - 1.0f) / 12.0f;
|
||||
}
|
||||
}
|
||||
//
|
||||
// gloss <value>
|
||||
//
|
||||
else if (!Q_stricmp(token, "gloss"))
|
||||
{
|
||||
float gloss;
|
||||
|
||||
token = COM_ParseExt(text, qfalse);
|
||||
if ( token[0] == 0 )
|
||||
{
|
||||
|
@ -982,7 +997,38 @@ static qboolean ParseStage( shaderStage_t *stage, char **text )
|
|||
continue;
|
||||
}
|
||||
|
||||
stage->specularScale[3] = atof( token );
|
||||
gloss = atof(token);
|
||||
|
||||
if (r_pbr->integer)
|
||||
stage->specularScale[0] = 1.0f - exp2f(-3.0f * gloss);
|
||||
else
|
||||
stage->specularScale[3] = gloss;
|
||||
}
|
||||
//
|
||||
// roughness <value>
|
||||
//
|
||||
else if (!Q_stricmp(token, "roughness"))
|
||||
{
|
||||
float roughness;
|
||||
|
||||
token = COM_ParseExt(text, qfalse);
|
||||
if (token[0] == 0)
|
||||
{
|
||||
ri.Printf(PRINT_WARNING, "WARNING: missing parameter for roughness in shader '%s'\n", shader.name);
|
||||
continue;
|
||||
}
|
||||
|
||||
roughness = atof(token);
|
||||
|
||||
if (r_pbr->integer)
|
||||
stage->specularScale[0] = 1.0 - roughness;
|
||||
else
|
||||
{
|
||||
if (roughness >= 0.125)
|
||||
stage->specularScale[3] = log2f(1.0f / roughness) / 3.0f;
|
||||
else
|
||||
stage->specularScale[3] = 1.0f;
|
||||
}
|
||||
}
|
||||
//
|
||||
// parallaxDepth <value>
|
||||
|
@ -1035,6 +1081,7 @@ static qboolean ParseStage( shaderStage_t *stage, char **text )
|
|||
}
|
||||
//
|
||||
// specularScale <rgb> <gloss>
|
||||
// or specularScale <metallic> <smoothness> with r_pbr 1
|
||||
// or specularScale <r> <g> <b>
|
||||
// or specularScale <r> <g> <b> <gloss>
|
||||
//
|
||||
|
@ -1061,10 +1108,19 @@ static qboolean ParseStage( shaderStage_t *stage, char **text )
|
|||
token = COM_ParseExt(text, qfalse);
|
||||
if ( token[0] == 0 )
|
||||
{
|
||||
// two values, rgb then gloss
|
||||
stage->specularScale[3] = stage->specularScale[1];
|
||||
stage->specularScale[1] =
|
||||
stage->specularScale[2] = stage->specularScale[0];
|
||||
if (r_pbr->integer)
|
||||
{
|
||||
// two values, metallic then smoothness
|
||||
float smoothness = stage->specularScale[1];
|
||||
stage->specularScale[1] = (stage->specularScale[0] < 0.5f) ? 0.0f : 1.0f;
|
||||
stage->specularScale[0] = smoothness;
|
||||
}
|
||||
{
|
||||
// two values, rgb then gloss
|
||||
stage->specularScale[3] = stage->specularScale[1];
|
||||
stage->specularScale[1] =
|
||||
stage->specularScale[2] = stage->specularScale[0];
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -2222,12 +2278,33 @@ static void CollapseStagesToLightall(shaderStage_t *diffuse,
|
|||
|
||||
if (r_specularMapping->integer)
|
||||
{
|
||||
image_t *diffuseImg;
|
||||
if (specular)
|
||||
{
|
||||
//ri.Printf(PRINT_ALL, ", specularmap %s", specular->bundle[0].image[0]->imgName);
|
||||
diffuse->bundle[TB_SPECULARMAP] = specular->bundle[0];
|
||||
VectorCopy4(specular->specularScale, diffuse->specularScale);
|
||||
}
|
||||
else if ((lightmap || useLightVector || useLightVertex) && (diffuseImg = diffuse->bundle[TB_DIFFUSEMAP].image[0]))
|
||||
{
|
||||
char specularName[MAX_QPATH];
|
||||
image_t *specularImg;
|
||||
imgFlags_t specularFlags = (diffuseImg->flags & ~(IMGFLAG_GENNORMALMAP | IMGFLAG_SRGB)) | IMGFLAG_NOLIGHTSCALE;
|
||||
|
||||
COM_StripExtension(diffuseImg->imgName, specularName, MAX_QPATH);
|
||||
Q_strcat(specularName, MAX_QPATH, "_s");
|
||||
|
||||
specularImg = R_FindImageFile(specularName, IMGTYPE_COLORALPHA, specularFlags);
|
||||
|
||||
if (specularImg)
|
||||
{
|
||||
diffuse->bundle[TB_SPECULARMAP] = diffuse->bundle[0];
|
||||
diffuse->bundle[TB_SPECULARMAP].numImageAnimations = 0;
|
||||
diffuse->bundle[TB_SPECULARMAP].image[0] = specularImg;
|
||||
|
||||
VectorSet4(diffuse->specularScale, 1.0f, 1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (tcgen || diffuse->bundle[0].numTexMods)
|
||||
|
@ -2809,10 +2886,17 @@ static void InitShader( const char *name, int lightmapIndex ) {
|
|||
|
||||
// default normal/specular
|
||||
VectorSet4(stages[i].normalScale, 0.0f, 0.0f, 0.0f, 0.0f);
|
||||
stages[i].specularScale[0] =
|
||||
stages[i].specularScale[1] =
|
||||
stages[i].specularScale[2] = r_baseSpecular->value;
|
||||
stages[i].specularScale[3] = r_baseGloss->value;
|
||||
if (r_pbr->integer)
|
||||
{
|
||||
stages[i].specularScale[0] = r_baseGloss->value;
|
||||
}
|
||||
else
|
||||
{
|
||||
stages[i].specularScale[0] =
|
||||
stages[i].specularScale[1] =
|
||||
stages[i].specularScale[2] = r_baseSpecular->value;
|
||||
stages[i].specularScale[3] = r_baseGloss->value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -206,7 +206,7 @@ void RB_ShadowTessEnd( void ) {
|
|||
|
||||
// draw the silhouette edges
|
||||
|
||||
GL_Bind( tr.whiteImage );
|
||||
GL_BindToTMU( tr.whiteImage, TB_COLORMAP );
|
||||
GL_State( GLS_SRCBLEND_ONE | GLS_DSTBLEND_ZERO );
|
||||
qglColor3f( 0.2f, 0.2f, 0.2f );
|
||||
|
||||
|
@ -256,7 +256,7 @@ void RB_ShadowFinish( void ) {
|
|||
qglDisable (GL_CLIP_PLANE0);
|
||||
GL_Cull( CT_TWO_SIDED );
|
||||
|
||||
GL_Bind( tr.whiteImage );
|
||||
GL_BindToTMU( tr.whiteImage, TB_COLORMAP );
|
||||
|
||||
qglLoadIdentity ();
|
||||
|
||||
|
|
|
@ -374,7 +374,7 @@ static void DrawSkySide( struct image_s *image, const int mins[2], const int max
|
|||
//tess.numIndexes = 0;
|
||||
tess.firstIndex = tess.numIndexes;
|
||||
|
||||
GL_Bind( image );
|
||||
GL_BindToTMU( image, TB_COLORMAP );
|
||||
GL_Cull( CT_TWO_SIDED );
|
||||
|
||||
for ( t = mins[1]+HALF_SKY_SUBDIVISIONS; t <= maxs[1]+HALF_SKY_SUBDIVISIONS; t++ )
|
||||
|
@ -871,6 +871,7 @@ void RB_StageIteratorSky( void ) {
|
|||
mat4_t oldmodelview;
|
||||
|
||||
GL_State( 0 );
|
||||
GL_Cull( CT_FRONT_SIDED );
|
||||
//qglTranslatef (backEnd.viewParms.or.origin[0], backEnd.viewParms.or.origin[1], backEnd.viewParms.or.origin[2]);
|
||||
|
||||
{
|
||||
|
|
|
@ -21,7 +21,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
*/
|
||||
// tr_surf.c
|
||||
#include "tr_local.h"
|
||||
#if idppc_altivec && !defined(MACOS_X)
|
||||
#if idppc_altivec && !defined(__APPLE__)
|
||||
#include <altivec.h>
|
||||
#endif
|
||||
|
||||
|
@ -1157,7 +1157,7 @@ static void RB_SurfaceBeam( void )
|
|||
VectorAdd( start_points[i], direction, end_points[i] );
|
||||
}
|
||||
|
||||
GL_Bind( tr.whiteImage );
|
||||
GL_BindToTMU( tr.whiteImage, TB_COLORMAP );
|
||||
|
||||
GL_State( GLS_SRCBLEND_ONE | GLS_DSTBLEND_ONE );
|
||||
|
||||
|
@ -2100,7 +2100,7 @@ Draws x/y/z lines from the origin for orientation debugging
|
|||
static void RB_SurfaceAxis( void ) {
|
||||
// FIXME: implement this
|
||||
#if 0
|
||||
GL_Bind( tr.whiteImage );
|
||||
GL_BindToTMU( tr.whiteImage, TB_COLORMAP );
|
||||
GL_State( GLS_DEFAULT );
|
||||
qglLineWidth( 3 );
|
||||
qglBegin( GL_LINES );
|
||||
|
|
|
@ -247,7 +247,7 @@ static keyNum_t IN_TranslateSDLToQ3Key( SDL_Keysym *keysym, qboolean down )
|
|||
case SDLK_LCTRL:
|
||||
case SDLK_RCTRL: key = K_CTRL; break;
|
||||
|
||||
#ifdef MACOS_X
|
||||
#ifdef __APPLE__
|
||||
case SDLK_RGUI:
|
||||
case SDLK_LGUI: key = K_COMMAND; break;
|
||||
#else
|
||||
|
|
|
@ -44,7 +44,7 @@ typedef struct voipServerPacket_s
|
|||
int len;
|
||||
int sender;
|
||||
int flags;
|
||||
byte data[1024];
|
||||
byte data[4000];
|
||||
} voipServerPacket_t;
|
||||
#endif
|
||||
|
||||
|
@ -299,6 +299,7 @@ extern int serverBansCount;
|
|||
|
||||
#ifdef USE_VOIP
|
||||
extern cvar_t *sv_voip;
|
||||
extern cvar_t *sv_voipProtocol;
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -1303,6 +1303,71 @@ static void SV_ConTell_f(void) {
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
==================
|
||||
SV_ConSayto_f
|
||||
==================
|
||||
*/
|
||||
static void SV_ConSayto_f(void) {
|
||||
char *p;
|
||||
char text[1024];
|
||||
client_t *cl;
|
||||
char *rawname;
|
||||
char name[MAX_NAME_LENGTH];
|
||||
char cleanName[MAX_NAME_LENGTH];
|
||||
client_t *saytocl;
|
||||
int i;
|
||||
|
||||
// make sure server is running
|
||||
if ( !com_sv_running->integer ) {
|
||||
Com_Printf( "Server is not running.\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( Cmd_Argc() < 3 ) {
|
||||
Com_Printf ("Usage: sayto <player name> <text>\n");
|
||||
return;
|
||||
}
|
||||
|
||||
rawname = Cmd_Argv(1);
|
||||
|
||||
//allowing special characters in the console
|
||||
//with hex strings for player names
|
||||
Com_FieldStringToPlayerName( name, MAX_NAME_LENGTH, rawname );
|
||||
|
||||
saytocl = NULL;
|
||||
for ( i=0, cl=svs.clients ; i < sv_maxclients->integer ; i++,cl++ ) {
|
||||
if ( !cl->state ) {
|
||||
continue;
|
||||
}
|
||||
Q_strncpyz( cleanName, cl->name, sizeof(cleanName) );
|
||||
Q_CleanStr( cleanName );
|
||||
|
||||
if ( !Q_stricmp( cleanName, name ) ) {
|
||||
saytocl = cl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if( !saytocl )
|
||||
{
|
||||
Com_Printf ("No such player name: %s.\n", name);
|
||||
return;
|
||||
}
|
||||
|
||||
strcpy (text, "console_sayto: ");
|
||||
p = Cmd_ArgsFrom(2);
|
||||
|
||||
if ( *p == '"' ) {
|
||||
p++;
|
||||
p[strlen(p)-1] = 0;
|
||||
}
|
||||
|
||||
strcat(text, p);
|
||||
|
||||
SV_SendServerCommand(saytocl, "chat \"%s\"", text);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
==================
|
||||
SV_Heartbeat_f
|
||||
|
@ -1407,6 +1472,43 @@ static void SV_CompleteMapName( char *args, int argNum ) {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
SV_CompletePlayerName
|
||||
==================
|
||||
*/
|
||||
static void SV_CompletePlayerName( char *args, int argNum ) {
|
||||
if( argNum == 2 ) {
|
||||
char names[MAX_CLIENTS][MAX_NAME_LENGTH];
|
||||
const char *namesPtr[MAX_CLIENTS];
|
||||
client_t *cl;
|
||||
int i;
|
||||
int nameCount;
|
||||
int clientCount;
|
||||
|
||||
nameCount = 0;
|
||||
clientCount = sv_maxclients->integer;
|
||||
|
||||
for ( i=0, cl=svs.clients ; i < clientCount; i++,cl++ ) {
|
||||
if ( !cl->state ) {
|
||||
continue;
|
||||
}
|
||||
if( i >= MAX_CLIENTS ) {
|
||||
break;
|
||||
}
|
||||
Q_strncpyz( names[nameCount], cl->name, sizeof(names[nameCount]) );
|
||||
Q_CleanStr( names[nameCount] );
|
||||
|
||||
namesPtr[nameCount] = names[nameCount];
|
||||
|
||||
nameCount++;
|
||||
}
|
||||
qsort( (void*)namesPtr, nameCount, sizeof( namesPtr[0] ), Com_strCompare );
|
||||
|
||||
Field_CompletePlayerName( namesPtr, nameCount );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
SV_AddOperatorCommands
|
||||
|
@ -1453,6 +1555,8 @@ void SV_AddOperatorCommands( void ) {
|
|||
if( com_dedicated->integer ) {
|
||||
Cmd_AddCommand ("say", SV_ConSay_f);
|
||||
Cmd_AddCommand ("tell", SV_ConTell_f);
|
||||
Cmd_AddCommand ("sayto", SV_ConSayto_f);
|
||||
Cmd_SetCommandCompletionFunc( "sayto", SV_CompletePlayerName );
|
||||
}
|
||||
|
||||
Cmd_AddCommand("rehashbans", SV_RehashBans_f);
|
||||
|
|
|
@ -1542,8 +1542,8 @@ void SV_UserinfoChanged( client_t *cl ) {
|
|||
else
|
||||
#endif
|
||||
{
|
||||
val = Info_ValueForKey(cl->userinfo, "cl_voip");
|
||||
cl->hasVoip = atoi(val);
|
||||
val = Info_ValueForKey(cl->userinfo, "cl_voipProtocol");
|
||||
cl->hasVoip = !Q_stricmp( val, "opus" );
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1887,7 +1887,7 @@ static qboolean SV_ShouldIgnoreVoipSender(const client_t *cl)
|
|||
}
|
||||
|
||||
static
|
||||
void SV_UserVoip(client_t *cl, msg_t *msg)
|
||||
void SV_UserVoip(client_t *cl, msg_t *msg, qboolean ignoreData)
|
||||
{
|
||||
int sender, generation, sequence, frames, packetsize;
|
||||
uint8_t recips[(MAX_CLIENTS + 7) / 8];
|
||||
|
@ -1922,12 +1922,12 @@ void SV_UserVoip(client_t *cl, msg_t *msg)
|
|||
|
||||
MSG_ReadData(msg, encoded, packetsize);
|
||||
|
||||
if (SV_ShouldIgnoreVoipSender(cl))
|
||||
if (ignoreData || SV_ShouldIgnoreVoipSender(cl))
|
||||
return; // Blacklisted, disabled, etc.
|
||||
|
||||
// !!! FIXME: see if we read past end of msg...
|
||||
|
||||
// !!! FIXME: reject if not speex narrowband codec.
|
||||
// !!! FIXME: reject if not opus data.
|
||||
// !!! FIXME: decide if this is bogus data?
|
||||
|
||||
// decide who needs this VoIP packet sent to them...
|
||||
|
@ -2082,10 +2082,18 @@ void SV_ExecuteClientMessage( client_t *cl, msg_t *msg ) {
|
|||
}
|
||||
} while ( 1 );
|
||||
|
||||
// read optional voip data
|
||||
if ( c == clc_voip ) {
|
||||
// skip legacy speex voip data
|
||||
if ( c == clc_voipSpeex ) {
|
||||
#ifdef USE_VOIP
|
||||
SV_UserVoip( cl, msg );
|
||||
SV_UserVoip( cl, msg, qtrue );
|
||||
c = MSG_ReadByte( msg );
|
||||
#endif
|
||||
}
|
||||
|
||||
// read optional voip data
|
||||
if ( c == clc_voipOpus ) {
|
||||
#ifdef USE_VOIP
|
||||
SV_UserVoip( cl, msg, qfalse );
|
||||
c = MSG_ReadByte( msg );
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -656,8 +656,9 @@ void SV_Init (void)
|
|||
sv_serverid = Cvar_Get ("sv_serverid", "0", CVAR_SYSTEMINFO | CVAR_ROM );
|
||||
sv_pure = Cvar_Get ("sv_pure", "1", CVAR_SYSTEMINFO );
|
||||
#ifdef USE_VOIP
|
||||
sv_voip = Cvar_Get("sv_voip", "1", CVAR_SYSTEMINFO | CVAR_LATCH);
|
||||
sv_voip = Cvar_Get("sv_voip", "1", CVAR_LATCH);
|
||||
Cvar_CheckRange(sv_voip, 0, 1, qtrue);
|
||||
sv_voipProtocol = Cvar_Get("sv_voipProtocol", sv_voip->integer ? "opus" : "", CVAR_SYSTEMINFO | CVAR_ROM );
|
||||
#endif
|
||||
Cvar_Get ("sv_paks", "", CVAR_SYSTEMINFO | CVAR_ROM );
|
||||
Cvar_Get ("sv_pakNames", "", CVAR_SYSTEMINFO | CVAR_ROM );
|
||||
|
|
|
@ -24,6 +24,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
|
||||
#ifdef USE_VOIP
|
||||
cvar_t *sv_voip;
|
||||
cvar_t *sv_voipProtocol;
|
||||
#endif
|
||||
|
||||
serverStatic_t svs; // persistant server info
|
||||
|
@ -674,8 +675,8 @@ void SVC_Info( netadr_t from ) {
|
|||
Info_SetValueForKey(infostring, "g_needpass", va("%d", Cvar_VariableIntegerValue("g_needpass")));
|
||||
|
||||
#ifdef USE_VOIP
|
||||
if (sv_voip->integer) {
|
||||
Info_SetValueForKey( infostring, "voip", va("%i", sv_voip->integer ) );
|
||||
if (sv_voipProtocol->string && *sv_voipProtocol->string) {
|
||||
Info_SetValueForKey( infostring, "voip", sv_voipProtocol->string );
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -557,7 +557,7 @@ static void SV_WriteVoipToClient(client_t *cl, msg_t *msg)
|
|||
if (totalbytes > (msg->maxsize - msg->cursize) / 2)
|
||||
break;
|
||||
|
||||
MSG_WriteByte(msg, svc_voip);
|
||||
MSG_WriteByte(msg, svc_voipOpus);
|
||||
MSG_WriteShort(msg, packet->sender);
|
||||
MSG_WriteByte(msg, (byte) packet->generation);
|
||||
MSG_WriteLong(msg, packet->sequence);
|
||||
|
|
|
@ -44,7 +44,7 @@ unsigned int CON_LogSize( void );
|
|||
unsigned int CON_LogWrite( const char *in );
|
||||
unsigned int CON_LogRead( char *out, unsigned int outSize );
|
||||
|
||||
#ifdef MACOS_X
|
||||
#ifdef __APPLE__
|
||||
char *Sys_StripAppBundle( char *pwd );
|
||||
#endif
|
||||
|
||||
|
|
|
@ -274,10 +274,12 @@ cpuFeatures_t Sys_GetProcessorFeatures( void )
|
|||
cpuFeatures_t features = 0;
|
||||
|
||||
#ifndef DEDICATED
|
||||
if( SDL_HasRDTSC( ) ) features |= CF_RDTSC;
|
||||
if( SDL_HasMMX( ) ) features |= CF_MMX;
|
||||
if( SDL_HasSSE( ) ) features |= CF_SSE;
|
||||
if( SDL_HasSSE2( ) ) features |= CF_SSE2;
|
||||
if( SDL_HasRDTSC( ) ) features |= CF_RDTSC;
|
||||
if( SDL_Has3DNow( ) ) features |= CF_3DNOW;
|
||||
if( SDL_HasMMX( ) ) features |= CF_MMX;
|
||||
if( SDL_HasSSE( ) ) features |= CF_SSE;
|
||||
if( SDL_HasSSE2( ) ) features |= CF_SSE2;
|
||||
if( SDL_HasAltiVec( ) ) features |= CF_ALTIVEC;
|
||||
#endif
|
||||
|
||||
return features;
|
||||
|
@ -563,7 +565,7 @@ void Sys_ParseArgs( int argc, char **argv )
|
|||
}
|
||||
|
||||
#ifndef DEFAULT_BASEDIR
|
||||
# ifdef MACOS_X
|
||||
# ifdef __APPLE__
|
||||
# define DEFAULT_BASEDIR Sys_StripAppBundle(Sys_BinaryPath())
|
||||
# else
|
||||
# define DEFAULT_BASEDIR Sys_BinaryPath()
|
||||
|
@ -644,7 +646,7 @@ int main( int argc, char **argv )
|
|||
// Set the initial time base
|
||||
Sys_Milliseconds( );
|
||||
|
||||
#ifdef MACOS_X
|
||||
#ifdef __APPLE__
|
||||
// This is passed if we are launched by double-clicking
|
||||
if ( argc >= 2 && Q_strncmp ( argv[1], "-psn", 4 ) == 0 )
|
||||
argc = 1;
|
||||
|
|
|
@ -20,7 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
===========================================================================
|
||||
*/
|
||||
|
||||
#ifndef MACOS_X
|
||||
#ifndef __APPLE__
|
||||
#error This file is for Mac OS X only. You probably should not compile it.
|
||||
#endif
|
||||
|
||||
|
|
|
@ -44,6 +44,9 @@ qboolean stdinIsATTY;
|
|||
// Used to determine where to store user-specific files
|
||||
static char homePath[ MAX_OSPATH ] = { 0 };
|
||||
|
||||
// Used to store the Steam Quake 3 installation path
|
||||
static char steamPath[ MAX_OSPATH ] = { 0 };
|
||||
|
||||
/*
|
||||
==================
|
||||
Sys_DefaultHomePath
|
||||
|
@ -58,7 +61,7 @@ char *Sys_DefaultHomePath(void)
|
|||
if( ( p = getenv( "HOME" ) ) != NULL )
|
||||
{
|
||||
Com_sprintf(homePath, sizeof(homePath), "%s%c", p, PATH_SEP);
|
||||
#ifdef MACOS_X
|
||||
#ifdef __APPLE__
|
||||
Q_strcat(homePath, sizeof(homePath),
|
||||
"Library/Application Support/");
|
||||
|
||||
|
@ -78,6 +81,31 @@ char *Sys_DefaultHomePath(void)
|
|||
return homePath;
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
Sys_SteamPath
|
||||
================
|
||||
*/
|
||||
char *Sys_SteamPath( void )
|
||||
{
|
||||
// Disabled since Steam doesn't let you install Quake 3 on Mac/Linux
|
||||
#if 0 //#ifdef STEAMPATH_NAME
|
||||
char *p;
|
||||
|
||||
if( ( p = getenv( "HOME" ) ) != NULL )
|
||||
{
|
||||
#ifdef __APPLE__
|
||||
char *steamPathEnd = "/Library/Application Support/Steam/SteamApps/common/" STEAMPATH_NAME;
|
||||
#else
|
||||
char *steamPathEnd = "/.steam/steam/SteamApps/common/" STEAMPATH_NAME;
|
||||
#endif
|
||||
Com_sprintf(steamPath, sizeof(steamPath), "%s%s", p, steamPathEnd);
|
||||
}
|
||||
#endif
|
||||
|
||||
return steamPath;
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
Sys_Milliseconds
|
||||
|
@ -123,6 +151,8 @@ qboolean Sys_RandomBytes( byte *string, int len )
|
|||
if( !fp )
|
||||
return qfalse;
|
||||
|
||||
setvbuf( fp, NULL, _IONBF, 0 ); // don't buffer reads from /dev/urandom
|
||||
|
||||
if( fread( string, sizeof( byte ), len, fp ) != len )
|
||||
{
|
||||
fclose( fp );
|
||||
|
@ -547,7 +577,7 @@ void Sys_ErrorDialog( const char *error )
|
|||
close( f );
|
||||
}
|
||||
|
||||
#ifndef MACOS_X
|
||||
#ifndef __APPLE__
|
||||
static char execBuffer[ 1024 ];
|
||||
static char *execBufferPointer;
|
||||
static char *execArgv[ 16 ];
|
||||
|
|
|
@ -42,6 +42,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
// Used to determine where to store user-specific files
|
||||
static char homePath[ MAX_OSPATH ] = { 0 };
|
||||
|
||||
// Used to store the Steam Quake 3 installation path
|
||||
static char steamPath[ MAX_OSPATH ] = { 0 };
|
||||
|
||||
#ifndef DEDICATED
|
||||
static UINT timerResolution = 0;
|
||||
#endif
|
||||
|
@ -126,6 +129,56 @@ char *Sys_DefaultHomePath( void )
|
|||
return homePath;
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
Sys_SteamPath
|
||||
================
|
||||
*/
|
||||
char *Sys_SteamPath( void )
|
||||
{
|
||||
#if defined(STEAMPATH_NAME) || defined(STEAMPATH_APPID)
|
||||
HKEY steamRegKey;
|
||||
DWORD pathLen = MAX_OSPATH;
|
||||
qboolean finishPath = qfalse;
|
||||
|
||||
#ifdef STEAMPATH_APPID
|
||||
// Assuming Steam is a 32-bit app
|
||||
if (!steamPath[0] && !RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Steam App " STEAMPATH_APPID, 0, KEY_QUERY_VALUE | KEY_WOW64_32KEY, &steamRegKey))
|
||||
{
|
||||
pathLen = MAX_OSPATH;
|
||||
if (RegQueryValueEx(steamRegKey, "InstallLocation", NULL, NULL, (LPBYTE)steamPath, &pathLen))
|
||||
steamPath[0] = '\0';
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef STEAMPATH_NAME
|
||||
if (!steamPath[0] && !RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\Valve\\Steam", 0, KEY_QUERY_VALUE, &steamRegKey))
|
||||
{
|
||||
pathLen = MAX_OSPATH;
|
||||
if (RegQueryValueEx(steamRegKey, "SteamPath", NULL, NULL, (LPBYTE)steamPath, &pathLen))
|
||||
if (RegQueryValueEx(steamRegKey, "InstallPath", NULL, NULL, (LPBYTE)steamPath, &pathLen))
|
||||
steamPath[0] = '\0';
|
||||
|
||||
if (steamPath[0])
|
||||
finishPath = qtrue;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (steamPath[0])
|
||||
{
|
||||
if (pathLen == MAX_OSPATH)
|
||||
pathLen--;
|
||||
|
||||
steamPath[pathLen] = '\0';
|
||||
|
||||
if (finishPath)
|
||||
Q_strcat(steamPath, MAX_OSPATH, "\\SteamApps\\common\\" STEAMPATH_NAME );
|
||||
}
|
||||
#endif
|
||||
|
||||
return steamPath;
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
Sys_Milliseconds
|
||||
|
|
|
@ -106,7 +106,7 @@ char *basepath( char *fname )
|
|||
all and others do a terrible job (like calling malloc) */
|
||||
// -- ouch, that hurts -- ln
|
||||
/* always use the system memmove() on Mac OS X. --ryan. */
|
||||
#if !defined(MACOS_X) && !defined(_MSC_VER)
|
||||
#if !defined(__APPLE__) && !defined(_MSC_VER)
|
||||
#ifdef memmove
|
||||
#undef memmove
|
||||
#endif
|
||||
|
|
|
@ -537,7 +537,7 @@ static void Text_Paint_Limit(float *maxX, float x, float y, float scale, vec4_t
|
|||
continue;
|
||||
} else {
|
||||
float yadj = useScale * glyph->top;
|
||||
if (Text_Width(s, useScale, 1) + x > max) {
|
||||
if (Text_Width(s, scale, 1) + x > max) {
|
||||
*maxX = 0;
|
||||
break;
|
||||
}
|
||||
|
@ -2260,79 +2260,78 @@ static qboolean UI_OwnerDrawVisible(int flags) {
|
|||
}
|
||||
|
||||
static qboolean UI_Handicap_HandleKey(int flags, float *special, int key) {
|
||||
if (key == K_MOUSE1 || key == K_MOUSE2 || key == K_ENTER || key == K_KP_ENTER) {
|
||||
int h;
|
||||
h = Com_Clamp( 5, 100, trap_Cvar_VariableValue("handicap") );
|
||||
if (key == K_MOUSE2) {
|
||||
h -= 5;
|
||||
} else {
|
||||
h += 5;
|
||||
}
|
||||
if (h > 100) {
|
||||
h = 5;
|
||||
} else if (h < 5) {
|
||||
int select = UI_SelectForKey(key);
|
||||
if (select != 0) {
|
||||
int h;
|
||||
|
||||
h = Com_Clamp( 5, 100, trap_Cvar_VariableValue("handicap") );
|
||||
h += 5 * select;
|
||||
|
||||
if (h > 100) {
|
||||
h = 5;
|
||||
} else if (h < 5) {
|
||||
h = 100;
|
||||
}
|
||||
trap_Cvar_Set( "handicap", va( "%i", h) );
|
||||
return qtrue;
|
||||
}
|
||||
return qfalse;
|
||||
|
||||
trap_Cvar_SetValue( "handicap", h );
|
||||
return qtrue;
|
||||
}
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
static qboolean UI_Effects_HandleKey(int flags, float *special, int key) {
|
||||
if (key == K_MOUSE1 || key == K_MOUSE2 || key == K_ENTER || key == K_KP_ENTER) {
|
||||
int select = UI_SelectForKey(key);
|
||||
if (select != 0) {
|
||||
uiInfo.effectsColor += select;
|
||||
|
||||
if (key == K_MOUSE2) {
|
||||
uiInfo.effectsColor--;
|
||||
} else {
|
||||
uiInfo.effectsColor++;
|
||||
}
|
||||
|
||||
if( uiInfo.effectsColor > 6 ) {
|
||||
uiInfo.effectsColor = 0;
|
||||
if( uiInfo.effectsColor > 6 ) {
|
||||
uiInfo.effectsColor = 0;
|
||||
} else if (uiInfo.effectsColor < 0) {
|
||||
uiInfo.effectsColor = 6;
|
||||
uiInfo.effectsColor = 6;
|
||||
}
|
||||
|
||||
trap_Cvar_SetValue( "color1", uitogamecode[uiInfo.effectsColor] );
|
||||
return qtrue;
|
||||
}
|
||||
return qfalse;
|
||||
trap_Cvar_SetValue( "color1", uitogamecode[uiInfo.effectsColor] );
|
||||
return qtrue;
|
||||
}
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
static qboolean UI_ClanName_HandleKey(int flags, float *special, int key) {
|
||||
if (key == K_MOUSE1 || key == K_MOUSE2 || key == K_ENTER || key == K_KP_ENTER) {
|
||||
int i;
|
||||
i = UI_TeamIndexFromName(UI_Cvar_VariableString("ui_teamName"));
|
||||
int select = UI_SelectForKey(key);
|
||||
if (select != 0) {
|
||||
int i;
|
||||
|
||||
i = UI_TeamIndexFromName(UI_Cvar_VariableString("ui_teamName"));
|
||||
|
||||
if (uiInfo.teamList[i].cinematic >= 0) {
|
||||
trap_CIN_StopCinematic(uiInfo.teamList[i].cinematic);
|
||||
trap_CIN_StopCinematic(uiInfo.teamList[i].cinematic);
|
||||
uiInfo.teamList[i].cinematic = -1;
|
||||
}
|
||||
if (key == K_MOUSE2) {
|
||||
i--;
|
||||
} else {
|
||||
i++;
|
||||
}
|
||||
if (i >= uiInfo.teamCount) {
|
||||
i = 0;
|
||||
} else if (i < 0) {
|
||||
|
||||
i += select;
|
||||
|
||||
if (i >= uiInfo.teamCount) {
|
||||
i = 0;
|
||||
} else if (i < 0) {
|
||||
i = uiInfo.teamCount - 1;
|
||||
}
|
||||
trap_Cvar_Set( "ui_teamName", uiInfo.teamList[i].teamName);
|
||||
UI_HeadCountByTeam();
|
||||
UI_FeederSelection(FEEDER_HEADS, 0);
|
||||
updateModel = qtrue;
|
||||
return qtrue;
|
||||
}
|
||||
return qfalse;
|
||||
|
||||
trap_Cvar_Set( "ui_teamName", uiInfo.teamList[i].teamName);
|
||||
UI_HeadCountByTeam();
|
||||
UI_FeederSelection(FEEDER_HEADS, 0);
|
||||
updateModel = qtrue;
|
||||
return qtrue;
|
||||
}
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
static qboolean UI_GameType_HandleKey(int flags, float *special, int key, qboolean resetMap) {
|
||||
if (key == K_MOUSE1 || key == K_MOUSE2 || key == K_ENTER || key == K_KP_ENTER) {
|
||||
int select = UI_SelectForKey(key);
|
||||
if (select != 0) {
|
||||
int oldCount = UI_MapCountByGameType(qtrue);
|
||||
|
||||
// hard coded mess here
|
||||
if (key == K_MOUSE2) {
|
||||
if (select < 0) {
|
||||
ui_gameType.integer--;
|
||||
if (ui_gameType.integer == 2) {
|
||||
ui_gameType.integer = 1;
|
||||
|
@ -2348,57 +2347,49 @@ static qboolean UI_GameType_HandleKey(int flags, float *special, int key, qboole
|
|||
}
|
||||
}
|
||||
|
||||
if (uiInfo.gameTypes[ui_gameType.integer].gtEnum == GT_TOURNAMENT) {
|
||||
trap_Cvar_Set("ui_Q3Model", "1");
|
||||
if (uiInfo.gameTypes[ui_gameType.integer].gtEnum < GT_TEAM) {
|
||||
trap_Cvar_SetValue( "ui_Q3Model", 1 );
|
||||
} else {
|
||||
trap_Cvar_Set("ui_Q3Model", "0");
|
||||
trap_Cvar_SetValue( "ui_Q3Model", 0 );
|
||||
}
|
||||
|
||||
trap_Cvar_Set("ui_gameType", va("%d", ui_gameType.integer));
|
||||
trap_Cvar_SetValue("ui_gameType", ui_gameType.integer);
|
||||
UI_SetCapFragLimits(qtrue);
|
||||
UI_LoadBestScores(uiInfo.mapList[ui_currentMap.integer].mapLoadName, uiInfo.gameTypes[ui_gameType.integer].gtEnum);
|
||||
if (resetMap && oldCount != UI_MapCountByGameType(qtrue)) {
|
||||
trap_Cvar_Set( "ui_currentMap", "0");
|
||||
trap_Cvar_SetValue( "ui_currentMap", 0);
|
||||
Menu_SetFeederSelection(NULL, FEEDER_MAPS, 0, NULL);
|
||||
}
|
||||
return qtrue;
|
||||
}
|
||||
return qfalse;
|
||||
return qtrue;
|
||||
}
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
static qboolean UI_NetGameType_HandleKey(int flags, float *special, int key) {
|
||||
if (key == K_MOUSE1 || key == K_MOUSE2 || key == K_ENTER || key == K_KP_ENTER) {
|
||||
int select = UI_SelectForKey(key);
|
||||
if (select != 0) {
|
||||
ui_netGameType.integer += select;
|
||||
|
||||
if (key == K_MOUSE2) {
|
||||
ui_netGameType.integer--;
|
||||
} else {
|
||||
ui_netGameType.integer++;
|
||||
if (ui_netGameType.integer < 0) {
|
||||
ui_netGameType.integer = uiInfo.numGameTypes - 1;
|
||||
} else if (ui_netGameType.integer >= uiInfo.numGameTypes) {
|
||||
ui_netGameType.integer = 0;
|
||||
}
|
||||
|
||||
if (ui_netGameType.integer < 0) {
|
||||
ui_netGameType.integer = uiInfo.numGameTypes - 1;
|
||||
} else if (ui_netGameType.integer >= uiInfo.numGameTypes) {
|
||||
ui_netGameType.integer = 0;
|
||||
}
|
||||
|
||||
trap_Cvar_Set( "ui_netGameType", va("%d", ui_netGameType.integer));
|
||||
trap_Cvar_Set( "ui_actualnetGameType", va("%d", uiInfo.gameTypes[ui_netGameType.integer].gtEnum));
|
||||
trap_Cvar_Set( "ui_currentNetMap", "0");
|
||||
trap_Cvar_SetValue( "ui_netGameType", ui_netGameType.integer);
|
||||
trap_Cvar_SetValue( "ui_actualnetGameType", uiInfo.gameTypes[ui_netGameType.integer].gtEnum);
|
||||
trap_Cvar_SetValue( "ui_currentNetMap", 0);
|
||||
UI_MapCountByGameType(qfalse);
|
||||
Menu_SetFeederSelection(NULL, FEEDER_ALLMAPS, 0, NULL);
|
||||
return qtrue;
|
||||
}
|
||||
return qfalse;
|
||||
return qtrue;
|
||||
}
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
static qboolean UI_JoinGameType_HandleKey(int flags, float *special, int key) {
|
||||
if (key == K_MOUSE1 || key == K_MOUSE2 || key == K_ENTER || key == K_KP_ENTER) {
|
||||
|
||||
if (key == K_MOUSE2) {
|
||||
ui_joinGameType.integer--;
|
||||
} else {
|
||||
ui_joinGameType.integer++;
|
||||
}
|
||||
int select = UI_SelectForKey(key);
|
||||
if (select != 0) {
|
||||
ui_joinGameType.integer += select;
|
||||
|
||||
if (ui_joinGameType.integer < 0) {
|
||||
ui_joinGameType.integer = uiInfo.numJoinGameTypes - 1;
|
||||
|
@ -2406,7 +2397,7 @@ static qboolean UI_JoinGameType_HandleKey(int flags, float *special, int key) {
|
|||
ui_joinGameType.integer = 0;
|
||||
}
|
||||
|
||||
trap_Cvar_Set( "ui_joinGameType", va("%d", ui_joinGameType.integer));
|
||||
trap_Cvar_SetValue( "ui_joinGameType", ui_joinGameType.integer);
|
||||
UI_BuildServerDisplayList(qtrue);
|
||||
return qtrue;
|
||||
}
|
||||
|
@ -2416,64 +2407,54 @@ static qboolean UI_JoinGameType_HandleKey(int flags, float *special, int key) {
|
|||
|
||||
|
||||
static qboolean UI_Skill_HandleKey(int flags, float *special, int key) {
|
||||
if (key == K_MOUSE1 || key == K_MOUSE2 || key == K_ENTER || key == K_KP_ENTER) {
|
||||
int i = trap_Cvar_VariableValue( "g_spSkill" );
|
||||
int select = UI_SelectForKey(key);
|
||||
if (select != 0) {
|
||||
int i = trap_Cvar_VariableValue( "g_spSkill" );
|
||||
|
||||
if (key == K_MOUSE2) {
|
||||
i--;
|
||||
} else {
|
||||
i++;
|
||||
}
|
||||
i += select;
|
||||
|
||||
if (i < 1) {
|
||||
if (i < 1) {
|
||||
i = numSkillLevels;
|
||||
} else if (i > numSkillLevels) {
|
||||
i = 1;
|
||||
}
|
||||
i = 1;
|
||||
}
|
||||
|
||||
trap_Cvar_Set("g_spSkill", va("%i", i));
|
||||
return qtrue;
|
||||
}
|
||||
return qfalse;
|
||||
trap_Cvar_SetValue("g_spSkill", i);
|
||||
return qtrue;
|
||||
}
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
static qboolean UI_TeamName_HandleKey(int flags, float *special, int key, qboolean blue) {
|
||||
if (key == K_MOUSE1 || key == K_MOUSE2 || key == K_ENTER || key == K_KP_ENTER) {
|
||||
int i;
|
||||
i = UI_TeamIndexFromName(UI_Cvar_VariableString((blue) ? "ui_blueTeam" : "ui_redTeam"));
|
||||
int select = UI_SelectForKey(key);
|
||||
if (select != 0) {
|
||||
int i;
|
||||
|
||||
if (key == K_MOUSE2) {
|
||||
i--;
|
||||
} else {
|
||||
i++;
|
||||
}
|
||||
i = UI_TeamIndexFromName(UI_Cvar_VariableString((blue) ? "ui_blueTeam" : "ui_redTeam"));
|
||||
i += select;
|
||||
|
||||
if (i >= uiInfo.teamCount) {
|
||||
i = 0;
|
||||
} else if (i < 0) {
|
||||
if (i >= uiInfo.teamCount) {
|
||||
i = 0;
|
||||
} else if (i < 0) {
|
||||
i = uiInfo.teamCount - 1;
|
||||
}
|
||||
|
||||
trap_Cvar_Set( (blue) ? "ui_blueTeam" : "ui_redTeam", uiInfo.teamList[i].teamName);
|
||||
|
||||
return qtrue;
|
||||
}
|
||||
return qfalse;
|
||||
trap_Cvar_Set( (blue) ? "ui_blueTeam" : "ui_redTeam", uiInfo.teamList[i].teamName);
|
||||
return qtrue;
|
||||
}
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
static qboolean UI_TeamMember_HandleKey(int flags, float *special, int key, qboolean blue, int num) {
|
||||
if (key == K_MOUSE1 || key == K_MOUSE2 || key == K_ENTER || key == K_KP_ENTER) {
|
||||
int select = UI_SelectForKey(key);
|
||||
if (select != 0) {
|
||||
// 0 - None
|
||||
// 1 - Human
|
||||
// 2..NumCharacters - Bot
|
||||
char *cvar = va(blue ? "ui_blueteam%i" : "ui_redteam%i", num);
|
||||
int value = trap_Cvar_VariableValue(cvar);
|
||||
|
||||
if (key == K_MOUSE2) {
|
||||
value--;
|
||||
} else {
|
||||
value++;
|
||||
}
|
||||
value += select;
|
||||
|
||||
if (ui_actualNetGameType.integer >= GT_TEAM) {
|
||||
if (value >= uiInfo.characterCount + 2) {
|
||||
|
@ -2489,20 +2470,16 @@ static qboolean UI_TeamMember_HandleKey(int flags, float *special, int key, qboo
|
|||
}
|
||||
}
|
||||
|
||||
trap_Cvar_Set(cvar, va("%i", value));
|
||||
return qtrue;
|
||||
}
|
||||
return qfalse;
|
||||
trap_Cvar_SetValue(cvar, value);
|
||||
return qtrue;
|
||||
}
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
static qboolean UI_NetSource_HandleKey(int flags, float *special, int key) {
|
||||
if (key == K_MOUSE1 || key == K_MOUSE2 || key == K_ENTER || key == K_KP_ENTER) {
|
||||
|
||||
if (key == K_MOUSE2) {
|
||||
ui_netSource.integer--;
|
||||
} else {
|
||||
ui_netSource.integer++;
|
||||
}
|
||||
int select = UI_SelectForKey(key);
|
||||
if (select != 0) {
|
||||
ui_netSource.integer += select;
|
||||
|
||||
if(ui_netSource.integer >= UIAS_GLOBAL1 && ui_netSource.integer <= UIAS_GLOBAL5)
|
||||
{
|
||||
|
@ -2514,12 +2491,8 @@ static qboolean UI_NetSource_HandleKey(int flags, float *special, int key) {
|
|||
trap_Cvar_VariableStringBuffer(cvarname, masterstr, sizeof(masterstr));
|
||||
if(*masterstr)
|
||||
break;
|
||||
|
||||
if (key == K_MOUSE2) {
|
||||
ui_netSource.integer--;
|
||||
} else {
|
||||
ui_netSource.integer++;
|
||||
}
|
||||
|
||||
ui_netSource.integer += select;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2533,54 +2506,48 @@ static qboolean UI_NetSource_HandleKey(int flags, float *special, int key) {
|
|||
if (!(ui_netSource.integer >= UIAS_GLOBAL1 && ui_netSource.integer <= UIAS_GLOBAL5)) {
|
||||
UI_StartServerRefresh(qtrue);
|
||||
}
|
||||
trap_Cvar_Set( "ui_netSource", va("%d", ui_netSource.integer));
|
||||
trap_Cvar_SetValue( "ui_netSource", ui_netSource.integer);
|
||||
return qtrue;
|
||||
}
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
static qboolean UI_NetFilter_HandleKey(int flags, float *special, int key) {
|
||||
if (key == K_MOUSE1 || key == K_MOUSE2 || key == K_ENTER || key == K_KP_ENTER) {
|
||||
int select = UI_SelectForKey(key);
|
||||
if (select != 0) {
|
||||
ui_serverFilterType.integer += select;
|
||||
|
||||
if (key == K_MOUSE2) {
|
||||
ui_serverFilterType.integer--;
|
||||
} else {
|
||||
ui_serverFilterType.integer++;
|
||||
}
|
||||
|
||||
if (ui_serverFilterType.integer >= numServerFilters) {
|
||||
ui_serverFilterType.integer = 0;
|
||||
} else if (ui_serverFilterType.integer < 0) {
|
||||
ui_serverFilterType.integer = numServerFilters - 1;
|
||||
if (ui_serverFilterType.integer >= numServerFilters) {
|
||||
ui_serverFilterType.integer = 0;
|
||||
} else if (ui_serverFilterType.integer < 0) {
|
||||
ui_serverFilterType.integer = numServerFilters - 1;
|
||||
}
|
||||
UI_BuildServerDisplayList(qtrue);
|
||||
return qtrue;
|
||||
}
|
||||
return qfalse;
|
||||
return qtrue;
|
||||
}
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
static qboolean UI_OpponentName_HandleKey(int flags, float *special, int key) {
|
||||
if (key == K_MOUSE1 || key == K_MOUSE2 || key == K_ENTER || key == K_KP_ENTER) {
|
||||
if (key == K_MOUSE2) {
|
||||
int select = UI_SelectForKey(key);
|
||||
if (select != 0) {
|
||||
if (select < 0) {
|
||||
UI_PriorOpponent();
|
||||
} else {
|
||||
UI_NextOpponent();
|
||||
}
|
||||
return qtrue;
|
||||
}
|
||||
return qfalse;
|
||||
return qtrue;
|
||||
}
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
static qboolean UI_BotName_HandleKey(int flags, float *special, int key) {
|
||||
if (key == K_MOUSE1 || key == K_MOUSE2 || key == K_ENTER || key == K_KP_ENTER) {
|
||||
int select = UI_SelectForKey(key);
|
||||
if (select != 0) {
|
||||
int game = trap_Cvar_VariableValue("g_gametype");
|
||||
int value = uiInfo.botIndex;
|
||||
|
||||
if (key == K_MOUSE2) {
|
||||
value--;
|
||||
} else {
|
||||
value++;
|
||||
}
|
||||
value += select;
|
||||
|
||||
if (game >= GT_TEAM) {
|
||||
if (value >= uiInfo.characterCount + 2) {
|
||||
|
@ -2596,30 +2563,29 @@ static qboolean UI_BotName_HandleKey(int flags, float *special, int key) {
|
|||
}
|
||||
}
|
||||
uiInfo.botIndex = value;
|
||||
return qtrue;
|
||||
}
|
||||
return qfalse;
|
||||
return qtrue;
|
||||
}
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
static qboolean UI_BotSkill_HandleKey(int flags, float *special, int key) {
|
||||
if (key == K_MOUSE1 || key == K_MOUSE2 || key == K_ENTER || key == K_KP_ENTER) {
|
||||
if (key == K_MOUSE2) {
|
||||
uiInfo.skillIndex--;
|
||||
} else {
|
||||
uiInfo.skillIndex++;
|
||||
}
|
||||
int select = UI_SelectForKey(key);
|
||||
if (select != 0) {
|
||||
uiInfo.skillIndex += select;
|
||||
|
||||
if (uiInfo.skillIndex >= numSkillLevels) {
|
||||
uiInfo.skillIndex = 0;
|
||||
} else if (uiInfo.skillIndex < 0) {
|
||||
uiInfo.skillIndex = numSkillLevels-1;
|
||||
}
|
||||
return qtrue;
|
||||
}
|
||||
return qtrue;
|
||||
}
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
static qboolean UI_RedBlue_HandleKey(int flags, float *special, int key) {
|
||||
if (key == K_MOUSE1 || key == K_MOUSE2 || key == K_ENTER || key == K_KP_ENTER) {
|
||||
int select = UI_SelectForKey(key);
|
||||
if (select != 0) {
|
||||
uiInfo.redBlue ^= 1;
|
||||
return qtrue;
|
||||
}
|
||||
|
@ -2627,19 +2593,16 @@ static qboolean UI_RedBlue_HandleKey(int flags, float *special, int key) {
|
|||
}
|
||||
|
||||
static qboolean UI_Crosshair_HandleKey(int flags, float *special, int key) {
|
||||
if (key == K_MOUSE1 || key == K_MOUSE2 || key == K_ENTER || key == K_KP_ENTER) {
|
||||
if (key == K_MOUSE2) {
|
||||
uiInfo.currentCrosshair--;
|
||||
} else {
|
||||
uiInfo.currentCrosshair++;
|
||||
}
|
||||
int select = UI_SelectForKey(key);
|
||||
if (select != 0) {
|
||||
uiInfo.currentCrosshair += select;
|
||||
|
||||
if (uiInfo.currentCrosshair >= NUM_CROSSHAIRS) {
|
||||
uiInfo.currentCrosshair = 0;
|
||||
} else if (uiInfo.currentCrosshair < 0) {
|
||||
uiInfo.currentCrosshair = NUM_CROSSHAIRS - 1;
|
||||
}
|
||||
trap_Cvar_Set("cg_drawCrosshair", va("%d", uiInfo.currentCrosshair));
|
||||
trap_Cvar_SetValue("cg_drawCrosshair", uiInfo.currentCrosshair);
|
||||
return qtrue;
|
||||
}
|
||||
return qfalse;
|
||||
|
@ -2648,7 +2611,8 @@ static qboolean UI_Crosshair_HandleKey(int flags, float *special, int key) {
|
|||
|
||||
|
||||
static qboolean UI_SelectedPlayer_HandleKey(int flags, float *special, int key) {
|
||||
if (key == K_MOUSE1 || key == K_MOUSE2 || key == K_ENTER || key == K_KP_ENTER) {
|
||||
int select = UI_SelectForKey(key);
|
||||
if (select != 0) {
|
||||
int selected;
|
||||
|
||||
UI_BuildPlayerList();
|
||||
|
@ -2656,12 +2620,8 @@ static qboolean UI_SelectedPlayer_HandleKey(int flags, float *special, int key)
|
|||
return qfalse;
|
||||
}
|
||||
selected = trap_Cvar_VariableValue("cg_selectedPlayer");
|
||||
|
||||
if (key == K_MOUSE2) {
|
||||
selected--;
|
||||
} else {
|
||||
selected++;
|
||||
}
|
||||
|
||||
selected += select;
|
||||
|
||||
if (selected > uiInfo.myTeamCount) {
|
||||
selected = 0;
|
||||
|
@ -2670,11 +2630,11 @@ static qboolean UI_SelectedPlayer_HandleKey(int flags, float *special, int key)
|
|||
}
|
||||
|
||||
if (selected == uiInfo.myTeamCount) {
|
||||
trap_Cvar_Set( "cg_selectedPlayerName", "Everyone");
|
||||
trap_Cvar_Set( "cg_selectedPlayerName", "Everyone");
|
||||
} else {
|
||||
trap_Cvar_Set( "cg_selectedPlayerName", uiInfo.teamNames[selected]);
|
||||
trap_Cvar_Set( "cg_selectedPlayerName", uiInfo.teamNames[selected]);
|
||||
}
|
||||
trap_Cvar_Set( "cg_selectedPlayer", va("%d", selected));
|
||||
trap_Cvar_SetValue( "cg_selectedPlayer", selected);
|
||||
}
|
||||
return qfalse;
|
||||
}
|
||||
|
|
|
@ -1932,12 +1932,20 @@ qboolean Item_ListBox_HandleKey(itemDef_t *item, int key, qboolean down, qboolea
|
|||
|
||||
qboolean Item_YesNo_HandleKey(itemDef_t *item, int key) {
|
||||
|
||||
if (Rect_ContainsPoint(&item->window.rect, DC->cursorx, DC->cursory) && item->window.flags & WINDOW_HASFOCUS && item->cvar) {
|
||||
if (key == K_MOUSE1 || key == K_ENTER || key == K_MOUSE2 || key == K_MOUSE3) {
|
||||
DC->setCVar(item->cvar, va("%i", !DC->getCVarValue(item->cvar)));
|
||||
return qtrue;
|
||||
if (item->cvar) {
|
||||
qboolean action = qfalse;
|
||||
if (key == K_MOUSE1 || key == K_MOUSE2 || key == K_MOUSE3) {
|
||||
if (Rect_ContainsPoint(&item->window.rect, DC->cursorx, DC->cursory) && item->window.flags & WINDOW_HASFOCUS) {
|
||||
action = qtrue;
|
||||
}
|
||||
} else if (UI_SelectForKey(key) != 0) {
|
||||
action = qtrue;
|
||||
}
|
||||
}
|
||||
if (action) {
|
||||
DC->setCVar(item->cvar, va("%i", !DC->getCVarValue(item->cvar)));
|
||||
return qtrue;
|
||||
}
|
||||
}
|
||||
|
||||
return qfalse;
|
||||
|
||||
|
@ -2006,11 +2014,21 @@ const char *Item_Multi_Setting(itemDef_t *item) {
|
|||
qboolean Item_Multi_HandleKey(itemDef_t *item, int key) {
|
||||
multiDef_t *multiPtr = (multiDef_t*)item->typeData;
|
||||
if (multiPtr) {
|
||||
if (Rect_ContainsPoint(&item->window.rect, DC->cursorx, DC->cursory) && item->window.flags & WINDOW_HASFOCUS && item->cvar) {
|
||||
if (key == K_MOUSE1 || key == K_ENTER || key == K_MOUSE2 || key == K_MOUSE3) {
|
||||
int current = Item_Multi_FindCvarByValue(item) + 1;
|
||||
if (item->cvar) {
|
||||
int select = 0;
|
||||
if (key == K_MOUSE1 || key == K_MOUSE2 || key == K_MOUSE3) {
|
||||
if (Rect_ContainsPoint(&item->window.rect, DC->cursorx, DC->cursory) && item->window.flags & WINDOW_HASFOCUS) {
|
||||
select = (key == K_MOUSE2) ? -1 : 1;
|
||||
}
|
||||
} else {
|
||||
select = UI_SelectForKey(key);
|
||||
}
|
||||
if (select != 0) {
|
||||
int current = Item_Multi_FindCvarByValue(item) + select;
|
||||
int max = Item_Multi_CountSettings(item);
|
||||
if ( current < 0 || current >= max ) {
|
||||
if ( current < 0 ) {
|
||||
current = max-1;
|
||||
} else if ( current >= max ) {
|
||||
current = 0;
|
||||
}
|
||||
if (multiPtr->strDef) {
|
||||
|
@ -2334,10 +2352,10 @@ qboolean Item_Slider_HandleKey(itemDef_t *item, int key, qboolean down) {
|
|||
float x, value, width, work;
|
||||
|
||||
//DC->Print("slider handle key\n");
|
||||
if (item->window.flags & WINDOW_HASFOCUS && item->cvar && Rect_ContainsPoint(&item->window.rect, DC->cursorx, DC->cursory)) {
|
||||
if (key == K_MOUSE1 || key == K_ENTER || key == K_MOUSE2 || key == K_MOUSE3) {
|
||||
if (item->cvar) {
|
||||
if (key == K_MOUSE1 || key == K_MOUSE2 || key == K_MOUSE3) {
|
||||
editFieldDef_t *editDef = item->typeData;
|
||||
if (editDef) {
|
||||
if (editDef && Rect_ContainsPoint(&item->window.rect, DC->cursorx, DC->cursory) && item->window.flags & WINDOW_HASFOCUS) {
|
||||
rectDef_t testRect;
|
||||
width = SLIDER_WIDTH;
|
||||
if (item->text) {
|
||||
|
@ -2364,6 +2382,23 @@ qboolean Item_Slider_HandleKey(itemDef_t *item, int key, qboolean down) {
|
|||
return qtrue;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
int select = UI_SelectForKey(key);
|
||||
if (select != 0) {
|
||||
editFieldDef_t *editDef = item->typeData;
|
||||
if (editDef) {
|
||||
// 20 is number of steps
|
||||
value = DC->getCVarValue(item->cvar) + (((editDef->maxVal - editDef->minVal)/20) * select);
|
||||
|
||||
if (value < editDef->minVal)
|
||||
value = editDef->minVal;
|
||||
else if (value > editDef->maxVal)
|
||||
value = editDef->maxVal;
|
||||
|
||||
DC->setCVar(item->cvar, va("%f", value));
|
||||
return qtrue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
DC->Print("slider handle key exit\n");
|
||||
|
@ -2594,6 +2629,32 @@ static rectDef_t *Item_CorrectedTextRect(itemDef_t *item) {
|
|||
return ▭
|
||||
}
|
||||
|
||||
// menu item key horizontal action: -1 = previous value, 1 = next value, 0 = no change
|
||||
int UI_SelectForKey(int key)
|
||||
{
|
||||
switch (key) {
|
||||
case K_MOUSE1:
|
||||
case K_MOUSE3:
|
||||
case K_ENTER:
|
||||
case K_KP_ENTER:
|
||||
case K_RIGHTARROW:
|
||||
case K_KP_RIGHTARROW:
|
||||
case K_JOY1:
|
||||
case K_JOY2:
|
||||
case K_JOY3:
|
||||
case K_JOY4:
|
||||
return 1; // next
|
||||
|
||||
case K_MOUSE2:
|
||||
case K_LEFTARROW:
|
||||
case K_KP_LEFTARROW:
|
||||
return -1; // previous
|
||||
}
|
||||
|
||||
// no change
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Menu_HandleKey(menuDef_t *menu, int key, qboolean down) {
|
||||
int i;
|
||||
itemDef_t *item = NULL;
|
||||
|
@ -2723,7 +2784,6 @@ void Menu_HandleKey(menuDef_t *menu, int key, qboolean down) {
|
|||
case K_AUX14:
|
||||
case K_AUX15:
|
||||
case K_AUX16:
|
||||
break;
|
||||
case K_KP_ENTER:
|
||||
case K_ENTER:
|
||||
if (item) {
|
||||
|
@ -3435,9 +3495,10 @@ qboolean Item_Bind_HandleKey(itemDef_t *item, int key, qboolean down) {
|
|||
int id;
|
||||
int i;
|
||||
|
||||
if (Rect_ContainsPoint(&item->window.rect, DC->cursorx, DC->cursory) && !g_waitingForKey)
|
||||
if (!g_waitingForKey)
|
||||
{
|
||||
if (down && (key == K_MOUSE1 || key == K_ENTER)) {
|
||||
if (down && ((key == K_MOUSE1 && Rect_ContainsPoint(&item->window.rect, DC->cursorx, DC->cursory))
|
||||
|| key == K_ENTER || key == K_KP_ENTER || key == K_JOY1 || key == K_JOY2 || key == K_JOY3 || key == K_JOY4)) {
|
||||
g_waitingForKey = qtrue;
|
||||
g_bindItem = item;
|
||||
}
|
||||
|
@ -3445,7 +3506,7 @@ qboolean Item_Bind_HandleKey(itemDef_t *item, int key, qboolean down) {
|
|||
}
|
||||
else
|
||||
{
|
||||
if (!g_waitingForKey || g_bindItem == NULL) {
|
||||
if (g_bindItem == NULL) {
|
||||
return qtrue;
|
||||
}
|
||||
|
||||
|
|
|
@ -417,6 +417,7 @@ void Menu_Reset( void );
|
|||
qboolean Menus_AnyFullScreenVisible( void );
|
||||
void Menus_Activate(menuDef_t *menu);
|
||||
|
||||
int UI_SelectForKey(int key);
|
||||
displayContextDef_t *Display_GetContext( void );
|
||||
void *Display_CaptureItem(int x, int y);
|
||||
qboolean Display_MouseMove(void *p, int x, int y);
|
||||
|
|
|
@ -13,9 +13,6 @@ Restart=on-abort
|
|||
# dedicated 0 is non-dedicted an not available with ioq3ded, 1 is LAN, 2 is Internet
|
||||
# sv_pure 1 prevents clients from using their own pk3-files
|
||||
# com_hunkmegs defaults to 56, should be 128/192/256 on a modern system(?)
|
||||
# rate 25000 defines the rate in which client & server communicate
|
||||
# snaps 40 defines gamestate-snapshots client & server exchange in secs
|
||||
# cl_maxpackets 125 max amount of FPS being counted on the server-side
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
#!/bin/sh
|
||||
echo "Edit this script to change the path to ioquake3's dedicated server executable and which binary if you aren't on x86_64.\n Set the sv_dlURL setting to a url like http://yoursite.com/ioquake3_path for ioquake3 clients to download extra data"
|
||||
~/ioquake3/ioq3ded.x86_64 +set dedicated 2 +set sv_allowDownload 1 +set sv_dlURL "" +set com_hunkmegs 64
|
||||
~/ioquake3/ioq3ded.x86_64 +set dedicated 2 +set sv_allowDownload 1 +set sv_dlURL "" +set com_hunkmegs 64 "$@"
|
||||
|
|
|
@ -42,34 +42,42 @@
|
|||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug TA|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug TA|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release TA|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release TA|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
|
@ -277,6 +285,7 @@
|
|||
</DataExecutionPrevention>
|
||||
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
|
@ -469,6 +478,7 @@
|
|||
</DataExecutionPrevention>
|
||||
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug TA|x64'">
|
||||
|
@ -1112,6 +1122,7 @@
|
|||
<ClInclude Include="..\..\code\cgame\cg_public.h" />
|
||||
<ClInclude Include="..\..\code\qcommon\q_shared.h" />
|
||||
<ClInclude Include="..\..\code\qcommon\surfaceflags.h" />
|
||||
<ClInclude Include="..\..\code\renderercommon\tr_types.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
|
|
|
@ -115,5 +115,8 @@
|
|||
<ClInclude Include="..\..\code\qcommon\surfaceflags.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\renderercommon\tr_types.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -1,3 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
</Project>
|
|
@ -41,34 +41,42 @@
|
|||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release TA|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release TA|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug TA|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug TA|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
|
@ -180,6 +188,7 @@
|
|||
</DataExecutionPrevention>
|
||||
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug TA|x64'">
|
||||
|
@ -276,6 +285,7 @@
|
|||
</DataExecutionPrevention>
|
||||
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
|
@ -1241,17 +1251,17 @@
|
|||
<ClInclude Include="..\..\code\game\ai_main.h" />
|
||||
<ClInclude Include="..\..\code\game\ai_team.h" />
|
||||
<ClInclude Include="..\..\code\game\ai_vcmd.h" />
|
||||
<ClInclude Include="..\..\code\game\be_aas.h" />
|
||||
<ClInclude Include="..\..\code\game\be_ai_char.h" />
|
||||
<ClInclude Include="..\..\code\game\be_ai_chat.h" />
|
||||
<ClInclude Include="..\..\code\game\be_ai_gen.h" />
|
||||
<ClInclude Include="..\..\code\game\be_ai_goal.h" />
|
||||
<ClInclude Include="..\..\code\game\be_ai_move.h" />
|
||||
<ClInclude Include="..\..\code\game\be_ai_weap.h" />
|
||||
<ClInclude Include="..\..\code\game\be_ea.h" />
|
||||
<ClInclude Include="..\..\code\botlib\be_aas.h" />
|
||||
<ClInclude Include="..\..\code\botlib\be_ai_char.h" />
|
||||
<ClInclude Include="..\..\code\botlib\be_ai_chat.h" />
|
||||
<ClInclude Include="..\..\code\botlib\be_ai_gen.h" />
|
||||
<ClInclude Include="..\..\code\botlib\be_ai_goal.h" />
|
||||
<ClInclude Include="..\..\code\botlib\be_ai_move.h" />
|
||||
<ClInclude Include="..\..\code\botlib\be_ai_weap.h" />
|
||||
<ClInclude Include="..\..\code\botlib\be_ea.h" />
|
||||
<ClInclude Include="..\..\code\game\bg_local.h" />
|
||||
<ClInclude Include="..\..\code\game\bg_public.h" />
|
||||
<ClInclude Include="..\..\code\game\botlib.h" />
|
||||
<ClInclude Include="..\..\code\botlib\botlib.h" />
|
||||
<ClInclude Include="..\..\code\game\chars.h" />
|
||||
<ClInclude Include="..\..\code\game\g_local.h" />
|
||||
<ClInclude Include="..\..\code\game\g_public.h" />
|
||||
|
|
|
@ -139,39 +139,12 @@
|
|||
<ClInclude Include="..\..\code\game\ai_vcmd.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\game\be_aas.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\game\be_ai_char.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\game\be_ai_chat.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\game\be_ai_gen.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\game\be_ai_goal.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\game\be_ai_move.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\game\be_ai_weap.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\game\be_ea.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\game\bg_local.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\game\bg_public.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\game\botlib.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\game\chars.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
|
@ -199,5 +172,32 @@
|
|||
<ClInclude Include="..\..\code\game\syn.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\botlib\be_aas.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\botlib\be_ai_char.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\botlib\be_ai_chat.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\botlib\be_ai_gen.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\botlib\be_ai_goal.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\botlib\be_ai_move.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\botlib\be_ai_weap.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\botlib\be_ea.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\botlib\botlib.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -1,3 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
</Project>
|
|
@ -41,42 +41,42 @@
|
|||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release TA|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release TA|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug TA|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug TA|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
|
@ -468,6 +468,7 @@
|
|||
</DataExecutionPrevention>
|
||||
<ImportLibrary>$(IntDir)uix86.lib</ImportLibrary>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
|
@ -1800,20 +1801,31 @@
|
|||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CustomBuildStep Include="..\..\code\q3_ui\keycodes.h">
|
||||
<CustomBuildStep Include="..\..\code\client\keycodes.h">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug TA|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug TA|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release TA|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release TA|x64'">true</ExcludedFromBuild>
|
||||
</CustomBuildStep>
|
||||
<ClInclude Include="..\..\code\qcommon\q_shared.h" />
|
||||
<ClInclude Include="..\..\code\game\bg_public.h">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug TA|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug TA|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release TA|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release TA|x64'">true</ExcludedFromBuild>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\qcommon\q_shared.h">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug TA|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug TA|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release TA|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release TA|x64'">true</ExcludedFromBuild>
|
||||
</ClInclude>
|
||||
<CustomBuildStep Include="..\..\code\q3_ui\ui_local.h">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug TA|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug TA|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release TA|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release TA|x64'">true</ExcludedFromBuild>
|
||||
</CustomBuildStep>
|
||||
<CustomBuildStep Include="..\..\code\q3_ui\ui_public.h">
|
||||
<CustomBuildStep Include="..\..\code\ui\ui_public.h">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug TA|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug TA|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release TA|Win32'">true</ExcludedFromBuild>
|
||||
|
|
|
@ -151,15 +151,18 @@
|
|||
<ClInclude Include="..\..\code\qcommon\q_shared.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\game\bg_public.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CustomBuildStep Include="..\..\code\q3_ui\keycodes.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</CustomBuildStep>
|
||||
<CustomBuildStep Include="..\..\code\q3_ui\ui_local.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</CustomBuildStep>
|
||||
<CustomBuildStep Include="..\..\code\q3_ui\ui_public.h">
|
||||
<CustomBuildStep Include="..\..\code\client\keycodes.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</CustomBuildStep>
|
||||
<CustomBuildStep Include="..\..\code\ui\ui_public.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</CustomBuildStep>
|
||||
</ItemGroup>
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
</Project>
|
|
@ -41,34 +41,42 @@
|
|||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug TA|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug TA|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseOfMfc>Static</UseOfMfc>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseOfMfc>Static</UseOfMfc>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release TA|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseOfMfc>Static</UseOfMfc>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release TA|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseOfMfc>Static</UseOfMfc>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
|
@ -154,10 +162,10 @@
|
|||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||
<AdditionalIncludeDirectories>..\..\code\SDL12\include;..\..\code\libcurl;..\..\code\AL;..\..\code\libspeex\include;..\..\code\zlib;..\..\code\jpeg-8c;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..\..\code\SDL2\include;..\..\code\libcurl-7.35.0;..\..\code\AL;..\..\code\libspeex\include;..\..\code\zlib;..\..\code\jpeg-8c;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_WIN32;WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;BOTLIB;USE_ICON;USE_CURL;USE_CURL_DLOPEN;USE_OPENAL;USE_OPENAL_DLOPEN;USE_VOIP;USE_INTERNAL_JPEG;HAVE_CONFIG_H;MISSIONPACK;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
|
@ -175,24 +183,26 @@
|
|||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>user32.lib;gdi32.lib;advapi32.lib;winmm.lib;psapi.lib;wsock32.lib;ws2_32.lib;dxguid.lib;SDLmain.lib;SDL.lib;OpenGL32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>user32.lib;gdi32.lib;advapi32.lib;winmm.lib;psapi.lib;wsock32.lib;ws2_32.lib;dxguid.lib;SDL2main.lib;SDL2.lib;OpenGL32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>$(IntDir)quake3.pdb</ProgramDatabaseFile>
|
||||
<GenerateMapFile>true</GenerateMapFile>
|
||||
<MapFileName>$(IntDir)quake3.map</MapFileName>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<StackReserveSize>8388608</StackReserveSize>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<IgnoreSpecificDefaultLibraries>libcmt.lib</IgnoreSpecificDefaultLibraries>
|
||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||
<AdditionalLibraryDirectories>..\..\code\libs\win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Message>Post build processing..</Message>
|
||||
<Command>rem bash -c "perl ./unix/cons -- release-TA"</Command>
|
||||
<Message>copy SDL2.dll</Message>
|
||||
<Command>xcopy /Y /S "$(SolutionDir)..\..\code\libs\win32\SDL2.dll" "$(TargetDir)"</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release TA|x64'">
|
||||
|
@ -207,7 +217,7 @@
|
|||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||
<AdditionalIncludeDirectories>..\..\code\SDL12\include;..\..\code\libcurl;..\..\code\AL;..\..\code\libspeex\include;..\..\code\zlib;..\..\code\jpeg-8c;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..\..\code\SDL2\include;..\..\code\libcurl-7.35.0;..\..\code\AL;..\..\code\libspeex\include;..\..\code\zlib;..\..\code\jpeg-8c;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_WIN32;WIN32;_WIN64;__WIN64__;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;BOTLIB;USE_ICON;USE_CURL;USE_CURL_DLOPEN;USE_OPENAL;USE_OPENAL_DLOPEN;USE_VOIP;USE_INTERNAL_JPEG;HAVE_CONFIG_H;MISSIONPACK;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
|
@ -228,24 +238,25 @@
|
|||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>user32.lib;gdi32.lib;advapi32.lib;winmm.lib;psapi.lib;wsock32.lib;ws2_32.lib;dxguid.lib;SDLmain.lib;SDL.lib;OpenGL32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>user32.lib;gdi32.lib;advapi32.lib;winmm.lib;psapi.lib;wsock32.lib;ws2_32.lib;dxguid.lib;SDL2main.lib;SDL2.lib;OpenGL32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>$(IntDir)quake3.pdb</ProgramDatabaseFile>
|
||||
<GenerateMapFile>true</GenerateMapFile>
|
||||
<MapFileName>$(IntDir)quake3.map</MapFileName>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<StackReserveSize>8388608</StackReserveSize>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
<IgnoreSpecificDefaultLibraries>libcmt.lib</IgnoreSpecificDefaultLibraries>
|
||||
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
|
||||
<AdditionalLibraryDirectories>..\..\code\libs\win64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Message>Post build processing..</Message>
|
||||
<Command>rem bash -c "perl ./unix/cons -- release-TA"</Command>
|
||||
<Message>copy SDL264.dll</Message>
|
||||
<Command>xcopy /Y /S "$(SolutionDir)..\..\code\libs\win64\SDL264.dll" "$(TargetDir)"</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
|
@ -260,7 +271,7 @@
|
|||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\code\SDL12\include;..\..\code\libcurl;..\..\code\AL;..\..\code\libspeex\include;..\..\code\zlib;..\..\code\jpeg-8c;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..\..\code\SDL2\include;..\..\code\libcurl-7.35.0;..\..\code\AL;..\..\code\libspeex\include;..\..\code\zlib;..\..\code\jpeg-8c;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_WIN32;WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;BOTLIB;USE_ICON;USE_CURL;USE_CURL_DLOPEN;USE_OPENAL;USE_OPENAL_DLOPEN;USE_VOIP;USE_INTERNAL_JPEG;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
|
@ -283,7 +294,7 @@
|
|||
<ResourceOutputFileName>..\winquake.res</ResourceOutputFileName>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>user32.lib;gdi32.lib;advapi32.lib;winmm.lib;psapi.lib;wsock32.lib;ws2_32.lib;dxguid.lib;SDLmain.lib;SDL.lib;OpenGL32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>user32.lib;gdi32.lib;advapi32.lib;winmm.lib;psapi.lib;wsock32.lib;ws2_32.lib;dxguid.lib;SDL2main.lib;SDL2.lib;OpenGL32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<IgnoreSpecificDefaultLibraries>
|
||||
|
@ -292,16 +303,18 @@
|
|||
<ProgramDatabaseFile>$(IntDir)quake3.pdb</ProgramDatabaseFile>
|
||||
<GenerateMapFile>true</GenerateMapFile>
|
||||
<MapFileName>$(IntDir)quake3.map</MapFileName>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<StackReserveSize>8388608</StackReserveSize>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||
<AdditionalLibraryDirectories>..\..\code\libs\win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Message>Post build processing..</Message>
|
||||
<Command>rem bash -c "perl ./unix/cons -- debug"</Command>
|
||||
<Message>copy SDL2.dll</Message>
|
||||
<Command>xcopy /Y /S "$(SolutionDir)..\..\code\libs\win32\SDL2.dll" "$(TargetDir)"</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
|
@ -315,7 +328,7 @@
|
|||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\code\SDL12\include;..\..\code\libcurl;..\..\code\AL;..\..\code\libspeex\include;..\..\code\zlib;..\..\code\jpeg-8c;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..\..\code\SDL2\include;..\..\code\libcurl-7.35.0;..\..\code\AL;..\..\code\libspeex\include;..\..\code\zlib;..\..\code\jpeg-8c;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_WIN32;WIN32;_WIN64;__WIN64__;_DEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;BOTLIB;USE_ICON;USE_CURL;USE_CURL_DLOPEN;USE_OPENAL;USE_OPENAL_DLOPEN;USE_VOIP;USE_INTERNAL_JPEG;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
|
@ -339,7 +352,7 @@
|
|||
<ResourceOutputFileName>..\winquake.res</ResourceOutputFileName>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>user32.lib;gdi32.lib;advapi32.lib;winmm.lib;psapi.lib;wsock32.lib;ws2_32.lib;dxguid.lib;SDLmain.lib;SDL.lib;OpenGL32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>user32.lib;gdi32.lib;advapi32.lib;winmm.lib;psapi.lib;wsock32.lib;ws2_32.lib;dxguid.lib;SDL2main.lib;SDL2.lib;OpenGL32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<IgnoreSpecificDefaultLibraries>
|
||||
|
@ -348,15 +361,16 @@
|
|||
<ProgramDatabaseFile>$(IntDir)quake3.pdb</ProgramDatabaseFile>
|
||||
<GenerateMapFile>true</GenerateMapFile>
|
||||
<MapFileName>$(IntDir)quake3.map</MapFileName>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<StackReserveSize>8388608</StackReserveSize>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
<AdditionalLibraryDirectories>..\..\code\libs\win64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Message>Post build processing..</Message>
|
||||
<Command>rem bash -c "perl ./unix/cons -- debug"</Command>
|
||||
<Message>copy SDL264.dll</Message>
|
||||
<Command>xcopy /Y /S "$(SolutionDir)..\..\code\libs\win64\SDL264.dll" "$(TargetDir)"</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
|
@ -372,10 +386,10 @@
|
|||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||
<AdditionalIncludeDirectories>..\..\code\SDL12\include;..\..\code\libcurl;..\..\code\AL;..\..\code\libspeex\include;..\..\code\zlib;..\..\code\jpeg-8c;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..\..\code\SDL2\include;..\..\code\libcurl-7.35.0;..\..\code\AL;..\..\code\libspeex\include;..\..\code\zlib;..\..\code\jpeg-8c;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_WIN32;WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;BOTLIB;USE_ICON;USE_CURL;USE_CURL_DLOPEN;USE_OPENAL;USE_OPENAL_DLOPEN;USE_VOIP;USE_INTERNAL_JPEG;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
|
@ -393,21 +407,27 @@
|
|||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>user32.lib;gdi32.lib;advapi32.lib;winmm.lib;psapi.lib;wsock32.lib;ws2_32.lib;dxguid.lib;SDLmain.lib;SDL.lib;OpenGL32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>user32.lib;gdi32.lib;advapi32.lib;winmm.lib;psapi.lib;wsock32.lib;ws2_32.lib;dxguid.lib;SDL2main.lib;SDL2.lib;OpenGL32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>$(IntDir)quake3.pdb</ProgramDatabaseFile>
|
||||
<GenerateMapFile>true</GenerateMapFile>
|
||||
<MapFileName>$(IntDir)quake3.map</MapFileName>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<StackReserveSize>8388608</StackReserveSize>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<IgnoreSpecificDefaultLibraries>libcmt.lib</IgnoreSpecificDefaultLibraries>
|
||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||
<AdditionalLibraryDirectories>..\..\code\libs\win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Message>copy SDL2.dll</Message>
|
||||
<Command>xcopy /Y /S "$(SolutionDir)..\..\code\libs\win32\SDL2.dll" "$(TargetDir)"</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Midl>
|
||||
|
@ -421,10 +441,10 @@
|
|||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||
<AdditionalIncludeDirectories>..\..\code\SDL12\include;..\..\code\libcurl;..\..\code\AL;..\..\code\libspeex\include;..\..\code\zlib;..\..\code\jpeg-8c;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..\..\code\SDL2\include;..\..\code\libcurl-7.35.0;..\..\code\AL;..\..\code\libspeex\include;..\..\code\zlib;..\..\code\jpeg-8c;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_WIN32;WIN32;_WIN64;__WIN64__;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;BOTLIB;USE_ICON;USE_CURL;USE_CURL_DLOPEN;USE_OPENAL;USE_OPENAL_DLOPEN;USE_VOIP;USE_INTERNAL_JPEG;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
|
@ -442,20 +462,25 @@
|
|||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>user32.lib;gdi32.lib;advapi32.lib;winmm.lib;psapi.lib;wsock32.lib;ws2_32.lib;dxguid.lib;SDLmain.lib;SDL.lib;OpenGL32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>user32.lib;gdi32.lib;advapi32.lib;winmm.lib;psapi.lib;wsock32.lib;ws2_32.lib;dxguid.lib;SDL2main.lib;SDL2.lib;OpenGL32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>$(IntDir)quake3.pdb</ProgramDatabaseFile>
|
||||
<GenerateMapFile>true</GenerateMapFile>
|
||||
<MapFileName>$(IntDir)quake3.map</MapFileName>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<StackReserveSize>8388608</StackReserveSize>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
<IgnoreSpecificDefaultLibraries>libcmt.lib</IgnoreSpecificDefaultLibraries>
|
||||
<AdditionalLibraryDirectories>..\..\code\libs\win64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Message>copy SDL264.dll</Message>
|
||||
<Command>xcopy /Y /S "$(SolutionDir)..\..\code\libs\win64\SDL264.dll" "$(TargetDir)"</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug TA|Win32'">
|
||||
<Midl>
|
||||
|
@ -469,7 +494,7 @@
|
|||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\code\SDL12\include;..\..\code\libcurl;..\..\code\AL;..\..\code\libspeex\include;..\..\code\zlib;..\..\code\jpeg-8c;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..\..\code\SDL2\include;..\..\code\libcurl-7.35.0;..\..\code\AL;..\..\code\libspeex\include;..\..\code\zlib;..\..\code\jpeg-8c;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_WIN32;WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;BOTLIB;USE_ICON;USE_CURL;USE_CURL_DLOPEN;USE_OPENAL;USE_OPENAL_DLOPEN;USE_VOIP;USE_INTERNAL_JPEG;HAVE_CONFIG_H;MISSIONPACK;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
|
@ -492,14 +517,14 @@
|
|||
<ResourceOutputFileName>..\winquake.res</ResourceOutputFileName>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>user32.lib;gdi32.lib;advapi32.lib;winmm.lib;psapi.lib;wsock32.lib;ws2_32.lib;dxguid.lib;SDLmain.lib;SDL.lib;OpenGL32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>user32.lib;gdi32.lib;advapi32.lib;winmm.lib;psapi.lib;wsock32.lib;ws2_32.lib;dxguid.lib;SDL2main.lib;SDL2.lib;OpenGL32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>$(IntDir)quake3.pdb</ProgramDatabaseFile>
|
||||
<GenerateMapFile>true</GenerateMapFile>
|
||||
<MapFileName>$(IntDir)quake3.map</MapFileName>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<StackReserveSize>8388608</StackReserveSize>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
|
@ -507,10 +532,12 @@
|
|||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<IgnoreSpecificDefaultLibraries>
|
||||
</IgnoreSpecificDefaultLibraries>
|
||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||
<AdditionalLibraryDirectories>..\..\code\libs\win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Message>Post build processing..</Message>
|
||||
<Command>rem bash -c "perl ./unix/cons -- debug-TA"</Command>
|
||||
<Message>copy SDL2.dll</Message>
|
||||
<Command>xcopy /Y /S "$(SolutionDir)..\..\code\libs\win32\SDL2.dll" "$(TargetDir)"</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug TA|x64'">
|
||||
|
@ -524,7 +551,7 @@
|
|||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\code\SDL12\include;..\..\code\libcurl;..\..\code\AL;..\..\code\libspeex\include;..\..\code\zlib;..\..\code\jpeg-8c;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..\..\code\SDL2\include;..\..\code\libcurl-7.35.0;..\..\code\AL;..\..\code\libspeex\include;..\..\code\zlib;..\..\code\jpeg-8c;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_WIN32;WIN32;_WIN64;__WIN64__;_DEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;BOTLIB;USE_ICON;USE_CURL;USE_CURL_DLOPEN;USE_OPENAL;USE_OPENAL_DLOPEN;USE_VOIP;USE_INTERNAL_JPEG;HAVE_CONFIG_H;MISSIONPACK;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
|
@ -547,22 +574,23 @@
|
|||
<ResourceOutputFileName>..\winquake.res</ResourceOutputFileName>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>user32.lib;gdi32.lib;advapi32.lib;winmm.lib;psapi.lib;wsock32.lib;ws2_32.lib;dxguid.lib;SDLmain.lib;SDL.lib;OpenGL32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>user32.lib;gdi32.lib;advapi32.lib;winmm.lib;psapi.lib;wsock32.lib;ws2_32.lib;dxguid.lib;SDL2main.lib;SDL2.lib;OpenGL32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>$(IntDir)quake3.pdb</ProgramDatabaseFile>
|
||||
<GenerateMapFile>true</GenerateMapFile>
|
||||
<MapFileName>$(IntDir)quake3.map</MapFileName>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<StackReserveSize>8388608</StackReserveSize>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
<AdditionalLibraryDirectories>..\..\code\libs\win64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Message>Post build processing..</Message>
|
||||
<Command>rem bash -c "perl ./unix/cons -- debug-TA"</Command>
|
||||
<Message>copy SDL264.dll</Message>
|
||||
<Command>xcopy /Y /S "$(SolutionDir)..\..\code\libs\win64\SDL264.dll" "$(TargetDir)"</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
|
@ -976,6 +1004,41 @@
|
|||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\code\renderercommon\tr_font.c" />
|
||||
<ClCompile Include="..\..\code\renderercommon\tr_image_bmp.c" />
|
||||
<ClCompile Include="..\..\code\renderercommon\tr_image_jpg.c" />
|
||||
<ClCompile Include="..\..\code\renderercommon\tr_image_pcx.c" />
|
||||
<ClCompile Include="..\..\code\renderercommon\tr_image_png.c" />
|
||||
<ClCompile Include="..\..\code\renderercommon\tr_image_tga.c" />
|
||||
<ClCompile Include="..\..\code\renderercommon\tr_noise.c" />
|
||||
<ClCompile Include="..\..\code\renderergl1\tr_animation.c" />
|
||||
<ClCompile Include="..\..\code\renderergl1\tr_backend.c" />
|
||||
<ClCompile Include="..\..\code\renderergl1\tr_bsp.c" />
|
||||
<ClCompile Include="..\..\code\renderergl1\tr_cmds.c" />
|
||||
<ClCompile Include="..\..\code\renderergl1\tr_curve.c" />
|
||||
<ClCompile Include="..\..\code\renderergl1\tr_flares.c" />
|
||||
<ClCompile Include="..\..\code\renderergl1\tr_image.c" />
|
||||
<ClCompile Include="..\..\code\renderergl1\tr_init.c" />
|
||||
<ClCompile Include="..\..\code\renderergl1\tr_light.c" />
|
||||
<ClCompile Include="..\..\code\renderergl1\tr_main.c" />
|
||||
<ClCompile Include="..\..\code\renderergl1\tr_marks.c" />
|
||||
<ClCompile Include="..\..\code\renderergl1\tr_mesh.c" />
|
||||
<ClCompile Include="..\..\code\renderergl1\tr_model.c" />
|
||||
<ClCompile Include="..\..\code\renderergl1\tr_model_iqm.c" />
|
||||
<ClCompile Include="..\..\code\renderergl1\tr_scene.c" />
|
||||
<ClCompile Include="..\..\code\renderergl1\tr_shade.c" />
|
||||
<ClCompile Include="..\..\code\renderergl1\tr_shader.c" />
|
||||
<ClCompile Include="..\..\code\renderergl1\tr_shade_calc.c" />
|
||||
<ClCompile Include="..\..\code\renderergl1\tr_shadows.c" />
|
||||
<ClCompile Include="..\..\code\renderergl1\tr_sky.c" />
|
||||
<ClCompile Include="..\..\code\renderergl1\tr_subs.c">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release TA|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug TA|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\code\renderergl1\tr_surface.c" />
|
||||
<ClCompile Include="..\..\code\renderergl1\tr_world.c" />
|
||||
<ClCompile Include="..\..\code\sys\con_log.c" />
|
||||
<ClCompile Include="..\..\code\sys\con_passive.c" />
|
||||
<ClCompile Include="..\..\code\qcommon\cvar.c">
|
||||
|
@ -1695,35 +1758,6 @@
|
|||
<ClCompile Include="..\..\code\botlib\l_precomp.c" />
|
||||
<ClCompile Include="..\..\code\botlib\l_script.c" />
|
||||
<ClCompile Include="..\..\code\botlib\l_struct.c" />
|
||||
<ClCompile Include="..\..\code\renderer\tr_animation.c" />
|
||||
<ClCompile Include="..\..\code\renderer\tr_backend.c" />
|
||||
<ClCompile Include="..\..\code\renderer\tr_bsp.c" />
|
||||
<ClCompile Include="..\..\code\renderer\tr_cmds.c" />
|
||||
<ClCompile Include="..\..\code\renderer\tr_curve.c" />
|
||||
<ClCompile Include="..\..\code\renderer\tr_flares.c" />
|
||||
<ClCompile Include="..\..\code\renderer\tr_font.c" />
|
||||
<ClCompile Include="..\..\code\renderer\tr_image.c" />
|
||||
<ClCompile Include="..\..\code\renderer\tr_image_bmp.c" />
|
||||
<ClCompile Include="..\..\code\renderer\tr_image_jpg.c" />
|
||||
<ClCompile Include="..\..\code\renderer\tr_image_pcx.c" />
|
||||
<ClCompile Include="..\..\code\renderer\tr_image_png.c" />
|
||||
<ClCompile Include="..\..\code\renderer\tr_image_tga.c" />
|
||||
<ClCompile Include="..\..\code\renderer\tr_init.c" />
|
||||
<ClCompile Include="..\..\code\renderer\tr_light.c" />
|
||||
<ClCompile Include="..\..\code\renderer\tr_main.c" />
|
||||
<ClCompile Include="..\..\code\renderer\tr_marks.c" />
|
||||
<ClCompile Include="..\..\code\renderer\tr_mesh.c" />
|
||||
<ClCompile Include="..\..\code\renderer\tr_model.c" />
|
||||
<ClCompile Include="..\..\code\renderer\tr_model_iqm.c" />
|
||||
<ClCompile Include="..\..\code\renderer\tr_noise.c" />
|
||||
<ClCompile Include="..\..\code\renderer\tr_scene.c" />
|
||||
<ClCompile Include="..\..\code\renderer\tr_shade.c" />
|
||||
<ClCompile Include="..\..\code\renderer\tr_shade_calc.c" />
|
||||
<ClCompile Include="..\..\code\renderer\tr_shader.c" />
|
||||
<ClCompile Include="..\..\code\renderer\tr_shadows.c" />
|
||||
<ClCompile Include="..\..\code\renderer\tr_sky.c" />
|
||||
<ClCompile Include="..\..\code\renderer\tr_surface.c" />
|
||||
<ClCompile Include="..\..\code\renderer\tr_world.c" />
|
||||
<ClCompile Include="..\..\code\libspeex\bits.c" />
|
||||
<ClCompile Include="..\..\code\libspeex\buffer.c" />
|
||||
<ClCompile Include="..\..\code\libspeex\cb_search.c" />
|
||||
|
@ -1781,38 +1815,35 @@
|
|||
<ClInclude Include="..\..\code\qcommon\cm_polylib.h" />
|
||||
<ClInclude Include="..\..\code\qcommon\cm_public.h" />
|
||||
<ClInclude Include="..\..\code\game\g_public.h" />
|
||||
<ClInclude Include="..\..\code\ui\keycodes.h" />
|
||||
<ClInclude Include="..\..\code\renderercommon\iqm.h" />
|
||||
<ClInclude Include="..\..\code\renderercommon\tr_common.h" />
|
||||
<ClInclude Include="..\..\code\renderercommon\tr_public.h" />
|
||||
<ClInclude Include="..\..\code\renderercommon\tr_types.h" />
|
||||
<ClInclude Include="..\..\code\client\keycodes.h" />
|
||||
<ClInclude Include="..\..\code\client\keys.h" />
|
||||
<ClInclude Include="..\..\code\qcommon\puff.h" />
|
||||
<ClInclude Include="..\..\code\qcommon\q_shared.h" />
|
||||
<ClInclude Include="..\..\code\client\qal.h" />
|
||||
<ClInclude Include="..\..\code\qcommon\qcommon.h" />
|
||||
<ClInclude Include="..\..\code\qcommon\qfiles.h" />
|
||||
<ClInclude Include="..\..\code\renderer\qgl.h" />
|
||||
<ClInclude Include="..\..\code\win32\resource.h" />
|
||||
<ClInclude Include="..\..\code\server\server.h" />
|
||||
<ClInclude Include="..\..\code\client\snd_local.h" />
|
||||
<ClInclude Include="..\..\code\client\snd_public.h" />
|
||||
<ClInclude Include="..\..\code\qcommon\surfaceflags.h" />
|
||||
<ClInclude Include="..\..\code\renderer\tr_local.h" />
|
||||
<ClInclude Include="..\..\code\renderer\tr_public.h" />
|
||||
<ClInclude Include="..\..\code\cgame\tr_types.h" />
|
||||
<ClInclude Include="..\..\code\renderergl1\tr_local.h" />
|
||||
<ClInclude Include="..\..\code\ui\ui_public.h" />
|
||||
<ClInclude Include="..\..\code\qcommon\unzip.h" />
|
||||
<ClInclude Include="..\..\code\qcommon\vm_local.h" />
|
||||
<ClInclude Include="..\..\code\win32\win_local.h" />
|
||||
<ClInclude Include="..\..\code\sys\win_resource.h" />
|
||||
<ClInclude Include="..\..\code\jpeg-6b\jchuff.h" />
|
||||
<ClInclude Include="..\..\code\jpeg-6b\jconfig.h" />
|
||||
<ClInclude Include="..\..\code\jpeg-6b\jdct.h" />
|
||||
<ClInclude Include="..\..\code\jpeg-6b\jdhuff.h" />
|
||||
<ClInclude Include="..\..\code\jpeg-6b\jerror.h" />
|
||||
<ClInclude Include="..\..\code\jpeg-6b\jinclude.h" />
|
||||
<ClInclude Include="..\..\code\jpeg-6b\jmemsys.h" />
|
||||
<ClInclude Include="..\..\code\jpeg-6b\jmorecfg.h" />
|
||||
<ClInclude Include="..\..\code\jpeg-6b\jpegint.h" />
|
||||
<ClInclude Include="..\..\code\jpeg-6b\jpeglib.h" />
|
||||
<ClInclude Include="..\..\code\jpeg-6b\jversion.h" />
|
||||
<ClInclude Include="..\..\code\sys\sys_local.h" />
|
||||
<ClInclude Include="..\..\code\jpeg-8c\jconfig.h" />
|
||||
<ClInclude Include="..\..\code\jpeg-8c\jdct.h" />
|
||||
<ClInclude Include="..\..\code\jpeg-8c\jerror.h" />
|
||||
<ClInclude Include="..\..\code\jpeg-8c\jinclude.h" />
|
||||
<ClInclude Include="..\..\code\jpeg-8c\jmemsys.h" />
|
||||
<ClInclude Include="..\..\code\jpeg-8c\jmorecfg.h" />
|
||||
<ClInclude Include="..\..\code\jpeg-8c\jpegint.h" />
|
||||
<ClInclude Include="..\..\code\jpeg-8c\jpeglib.h" />
|
||||
<ClInclude Include="..\..\code\jpeg-8c\jversion.h" />
|
||||
<ClInclude Include="..\..\code\botlib\aasfile.h" />
|
||||
<ClInclude Include="..\..\code\botlib\be_aas_bsp.h" />
|
||||
<ClInclude Include="..\..\code\botlib\be_aas_cluster.h" />
|
||||
|
|
|
@ -31,18 +31,18 @@
|
|||
<Filter Include="botlib\Header Files">
|
||||
<UniqueIdentifier>{e35bc6f6-1102-4c5c-a650-b7139842f45e}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="renderer">
|
||||
<UniqueIdentifier>{c82e323c-9a35-41ea-9f28-ee0c1e15c7ba}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="renderer\Source Files">
|
||||
<UniqueIdentifier>{0ee0a9cb-f315-480b-b7c7-9b1f0d15db54}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="speex">
|
||||
<UniqueIdentifier>{78e83da0-aef9-489d-a068-e484f9f114da}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="zlib">
|
||||
<UniqueIdentifier>{89531515-ab90-4808-b464-28319ea749c5}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="renderercommon">
|
||||
<UniqueIdentifier>{6df83ba6-3829-4dba-be13-b88e502e2643}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="renderergl1">
|
||||
<UniqueIdentifier>{a0272781-b682-44ec-919d-b349861756d3}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\code\client\cl_avi.c">
|
||||
|
@ -456,93 +456,6 @@
|
|||
<ClCompile Include="..\..\code\botlib\l_struct.c">
|
||||
<Filter>botlib\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\code\renderer\tr_animation.c">
|
||||
<Filter>renderer\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\code\renderer\tr_backend.c">
|
||||
<Filter>renderer\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\code\renderer\tr_bsp.c">
|
||||
<Filter>renderer\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\code\renderer\tr_cmds.c">
|
||||
<Filter>renderer\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\code\renderer\tr_curve.c">
|
||||
<Filter>renderer\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\code\renderer\tr_flares.c">
|
||||
<Filter>renderer\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\code\renderer\tr_font.c">
|
||||
<Filter>renderer\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\code\renderer\tr_image.c">
|
||||
<Filter>renderer\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\code\renderer\tr_image_bmp.c">
|
||||
<Filter>renderer\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\code\renderer\tr_image_jpg.c">
|
||||
<Filter>renderer\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\code\renderer\tr_image_pcx.c">
|
||||
<Filter>renderer\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\code\renderer\tr_image_png.c">
|
||||
<Filter>renderer\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\code\renderer\tr_image_tga.c">
|
||||
<Filter>renderer\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\code\renderer\tr_init.c">
|
||||
<Filter>renderer\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\code\renderer\tr_light.c">
|
||||
<Filter>renderer\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\code\renderer\tr_main.c">
|
||||
<Filter>renderer\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\code\renderer\tr_marks.c">
|
||||
<Filter>renderer\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\code\renderer\tr_mesh.c">
|
||||
<Filter>renderer\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\code\renderer\tr_model.c">
|
||||
<Filter>renderer\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\code\renderer\tr_model_iqm.c">
|
||||
<Filter>renderer\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\code\renderer\tr_noise.c">
|
||||
<Filter>renderer\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\code\renderer\tr_scene.c">
|
||||
<Filter>renderer\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\code\renderer\tr_shade.c">
|
||||
<Filter>renderer\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\code\renderer\tr_shade_calc.c">
|
||||
<Filter>renderer\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\code\renderer\tr_shader.c">
|
||||
<Filter>renderer\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\code\renderer\tr_shadows.c">
|
||||
<Filter>renderer\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\code\renderer\tr_sky.c">
|
||||
<Filter>renderer\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\code\renderer\tr_surface.c">
|
||||
<Filter>renderer\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\code\renderer\tr_world.c">
|
||||
<Filter>renderer\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\code\libspeex\bits.c">
|
||||
<Filter>speex</Filter>
|
||||
</ClCompile>
|
||||
|
@ -681,6 +594,96 @@
|
|||
<ClCompile Include="..\..\code\zlib\zutil.c">
|
||||
<Filter>zlib</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\code\renderercommon\tr_font.c">
|
||||
<Filter>renderercommon</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\code\renderercommon\tr_image_bmp.c">
|
||||
<Filter>renderercommon</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\code\renderercommon\tr_image_jpg.c">
|
||||
<Filter>renderercommon</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\code\renderercommon\tr_image_pcx.c">
|
||||
<Filter>renderercommon</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\code\renderercommon\tr_image_png.c">
|
||||
<Filter>renderercommon</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\code\renderercommon\tr_image_tga.c">
|
||||
<Filter>renderercommon</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\code\renderercommon\tr_noise.c">
|
||||
<Filter>renderercommon</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\code\renderergl1\tr_animation.c">
|
||||
<Filter>renderergl1</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\code\renderergl1\tr_backend.c">
|
||||
<Filter>renderergl1</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\code\renderergl1\tr_bsp.c">
|
||||
<Filter>renderergl1</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\code\renderergl1\tr_cmds.c">
|
||||
<Filter>renderergl1</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\code\renderergl1\tr_curve.c">
|
||||
<Filter>renderergl1</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\code\renderergl1\tr_flares.c">
|
||||
<Filter>renderergl1</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\code\renderergl1\tr_image.c">
|
||||
<Filter>renderergl1</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\code\renderergl1\tr_init.c">
|
||||
<Filter>renderergl1</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\code\renderergl1\tr_light.c">
|
||||
<Filter>renderergl1</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\code\renderergl1\tr_main.c">
|
||||
<Filter>renderergl1</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\code\renderergl1\tr_marks.c">
|
||||
<Filter>renderergl1</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\code\renderergl1\tr_mesh.c">
|
||||
<Filter>renderergl1</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\code\renderergl1\tr_model.c">
|
||||
<Filter>renderergl1</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\code\renderergl1\tr_model_iqm.c">
|
||||
<Filter>renderergl1</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\code\renderergl1\tr_scene.c">
|
||||
<Filter>renderergl1</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\code\renderergl1\tr_shade.c">
|
||||
<Filter>renderergl1</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\code\renderergl1\tr_shade_calc.c">
|
||||
<Filter>renderergl1</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\code\renderergl1\tr_shader.c">
|
||||
<Filter>renderergl1</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\code\renderergl1\tr_shadows.c">
|
||||
<Filter>renderergl1</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\code\renderergl1\tr_sky.c">
|
||||
<Filter>renderergl1</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\code\renderergl1\tr_subs.c">
|
||||
<Filter>renderergl1</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\code\renderergl1\tr_surface.c">
|
||||
<Filter>renderergl1</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\code\renderergl1\tr_world.c">
|
||||
<Filter>renderergl1</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\code\game\bg_public.h">
|
||||
|
@ -710,9 +713,6 @@
|
|||
<ClInclude Include="..\..\code\game\g_public.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\ui\keycodes.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\client\keys.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
|
@ -731,12 +731,6 @@
|
|||
<ClInclude Include="..\..\code\qcommon\qfiles.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\renderer\qgl.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\win32\resource.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\server\server.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
|
@ -749,15 +743,6 @@
|
|||
<ClInclude Include="..\..\code\qcommon\surfaceflags.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\renderer\tr_local.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\renderer\tr_public.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\cgame\tr_types.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\ui\ui_public.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
|
@ -767,45 +752,9 @@
|
|||
<ClInclude Include="..\..\code\qcommon\vm_local.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\win32\win_local.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\sys\win_resource.h">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\jpeg-6b\jchuff.h">
|
||||
<Filter>jpeg\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\jpeg-6b\jconfig.h">
|
||||
<Filter>jpeg\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\jpeg-6b\jdct.h">
|
||||
<Filter>jpeg\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\jpeg-6b\jdhuff.h">
|
||||
<Filter>jpeg\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\jpeg-6b\jerror.h">
|
||||
<Filter>jpeg\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\jpeg-6b\jinclude.h">
|
||||
<Filter>jpeg\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\jpeg-6b\jmemsys.h">
|
||||
<Filter>jpeg\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\jpeg-6b\jmorecfg.h">
|
||||
<Filter>jpeg\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\jpeg-6b\jpegint.h">
|
||||
<Filter>jpeg\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\jpeg-6b\jpeglib.h">
|
||||
<Filter>jpeg\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\jpeg-6b\jversion.h">
|
||||
<Filter>jpeg\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\botlib\aasfile.h">
|
||||
<Filter>botlib\Header Files</Filter>
|
||||
</ClInclude>
|
||||
|
@ -884,6 +833,57 @@
|
|||
<ClInclude Include="..\..\code\libspeex\config.h">
|
||||
<Filter>speex</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\renderercommon\iqm.h">
|
||||
<Filter>renderercommon</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\renderercommon\qgl.h">
|
||||
<Filter>renderercommon</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\renderercommon\tr_common.h">
|
||||
<Filter>renderercommon</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\renderercommon\tr_public.h">
|
||||
<Filter>renderercommon</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\renderercommon\tr_types.h">
|
||||
<Filter>renderercommon</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\renderergl1\tr_local.h">
|
||||
<Filter>renderergl1</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\client\keycodes.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\sys\sys_local.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\jpeg-8c\jconfig.h">
|
||||
<Filter>jpeg\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\jpeg-8c\jdct.h">
|
||||
<Filter>jpeg\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\jpeg-8c\jerror.h">
|
||||
<Filter>jpeg\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\jpeg-8c\jinclude.h">
|
||||
<Filter>jpeg\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\jpeg-8c\jmemsys.h">
|
||||
<Filter>jpeg\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\jpeg-8c\jmorecfg.h">
|
||||
<Filter>jpeg\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\jpeg-8c\jpegint.h">
|
||||
<Filter>jpeg\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\jpeg-8c\jpeglib.h">
|
||||
<Filter>jpeg\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\code\jpeg-8c\jversion.h">
|
||||
<Filter>jpeg\Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="..\..\code\sys\win_resource.rc">
|
||||
|
|
|
@ -1,55 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LocalDebuggerCommandArguments>
|
||||
</LocalDebuggerCommandArguments>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LocalDebuggerWorkingDirectory>$(ProjectDir)</LocalDebuggerWorkingDirectory>
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LocalDebuggerCommandArguments>
|
||||
</LocalDebuggerCommandArguments>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LocalDebuggerWorkingDirectory>$(ProjectDir)</LocalDebuggerWorkingDirectory>
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug TA|Win32'">
|
||||
<LocalDebuggerWorkingDirectory>$(ProjectDir)</LocalDebuggerWorkingDirectory>
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
<LocalDebuggerCommandArguments>
|
||||
</LocalDebuggerCommandArguments>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release TA|Win32'">
|
||||
<LocalDebuggerWorkingDirectory>$(ProjectDir)</LocalDebuggerWorkingDirectory>
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
<LocalDebuggerCommandArguments>
|
||||
</LocalDebuggerCommandArguments>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LocalDebuggerWorkingDirectory>$(ProjectDir)</LocalDebuggerWorkingDirectory>
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
<LocalDebuggerCommandArguments>
|
||||
</LocalDebuggerCommandArguments>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug TA|x64'">
|
||||
<LocalDebuggerWorkingDirectory>$(ProjectDir)</LocalDebuggerWorkingDirectory>
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
<LocalDebuggerCommandArguments>
|
||||
</LocalDebuggerCommandArguments>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release TA|x64'">
|
||||
<LocalDebuggerWorkingDirectory>$(ProjectDir)</LocalDebuggerWorkingDirectory>
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
<LocalDebuggerCommandArguments>
|
||||
</LocalDebuggerCommandArguments>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LocalDebuggerWorkingDirectory>$(ProjectDir)</LocalDebuggerWorkingDirectory>
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
<LocalDebuggerCommandArguments>
|
||||
</LocalDebuggerCommandArguments>
|
||||
</PropertyGroup>
|
||||
</Project>
|
|
@ -41,42 +41,42 @@
|
|||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug TA|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug TA|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release TA|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release TA|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
|
@ -472,6 +472,7 @@
|
|||
</DataExecutionPrevention>
|
||||
<ImportLibrary>$(IntDir)uix86.lib</ImportLibrary>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug TA|x64'">
|
||||
|
@ -784,7 +785,7 @@
|
|||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</CustomBuildStep>
|
||||
<CustomBuildStep Include="..\..\code\ui\keycodes.h">
|
||||
<CustomBuildStep Include="..\..\code\client\keycodes.h">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
|
@ -796,19 +797,13 @@
|
|||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</CustomBuildStep>
|
||||
<CustomBuildStep Include="..\..\code\game\q_shared.h">
|
||||
<CustomBuildStep Include="..\..\code\qcommon\q_shared.h">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</CustomBuildStep>
|
||||
<CustomBuildStep Include="..\..\code\game\surfaceflags.h">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</CustomBuildStep>
|
||||
<CustomBuildStep Include="..\..\code\cgame\tr_types.h">
|
||||
<CustomBuildStep Include="..\..\code\renderercommon\tr_types.h">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
|
|
|
@ -49,21 +49,9 @@
|
|||
<CustomBuildStep Include="..\..\code\game\bg_public.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</CustomBuildStep>
|
||||
<CustomBuildStep Include="..\..\code\ui\keycodes.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</CustomBuildStep>
|
||||
<CustomBuildStep Include="..\..\ui\menudef.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</CustomBuildStep>
|
||||
<CustomBuildStep Include="..\..\code\game\q_shared.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</CustomBuildStep>
|
||||
<CustomBuildStep Include="..\..\code\game\surfaceflags.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</CustomBuildStep>
|
||||
<CustomBuildStep Include="..\..\code\cgame\tr_types.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</CustomBuildStep>
|
||||
<CustomBuildStep Include="..\..\code\ui\ui_local.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</CustomBuildStep>
|
||||
|
@ -73,5 +61,14 @@
|
|||
<CustomBuildStep Include="..\..\code\ui\ui_shared.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</CustomBuildStep>
|
||||
<CustomBuildStep Include="..\..\code\client\keycodes.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</CustomBuildStep>
|
||||
<CustomBuildStep Include="..\..\code\renderercommon\tr_types.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</CustomBuildStep>
|
||||
<CustomBuildStep Include="..\..\code\qcommon\q_shared.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</CustomBuildStep>
|
||||
</ItemGroup>
|
||||
</Project>
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue