Codebase list iortcw / 258e98b
Imported Upstream version 1.42b+20150713+dfsg1 Simon McVittie 8 years ago
103 changed file(s) with 2190 addition(s) and 1386 deletion(s). Raw diff Collapse all Expand all
5151 4.) mingw64-x86_64-gcc-g++ (For 64bit, same as above)
5252 5.) make
5353 6.) bison
54 7.) subversion
54 7.) git-core
5555
5656 When you search for your packages you'll see category listings. These packages would all be under the 'Devel' category.
5757
6868 After the install has completed you should have a 'Cygwin Terminal' icon on your Desktop. This is the bash shell for Cygwin, so go ahead and run it.
6969
7070 At the command prompt type:
71 svn co http://iortcw.googlecode.com/svn/trunk iortcw
71 git clone https://github.com/iortcw/iortcw.git iortcw
7272
7373 This will pull the iortcw trunk source.
7474
7878 or
7979 cd iortcw/SP (Single-Player)
8080
81 ./cross-make-mingw.sh (to build 32bit binaries)
81 ARCH=x86 make (to build 32bit binaries)
8282 or
83 ./cross-make-mingw64.sh (for 64bit binaries)
83 ARCH=x86_64 make (for 64bit binaries)
8484
8585 Wait for build to complete.
8686
6060 endif
6161 export PLATFORM
6262
63 ifeq ($(PLATFORM),mingw32)
64 MINGW=1
65 endif
66 ifeq ($(PLATFORM),mingw64)
67 MINGW=1
68 endif
69
6370 ifeq ($(COMPILE_ARCH),i386)
6471 COMPILE_ARCH=x86
6572 endif
97104 # For historical compatibility reasons on non-windows
98105 # platform output files use i386 instead of x86
99106 ifeq ($(ARCH),x86)
100 ifneq ($(PLATFORM),mingw32)
107 ifndef MINGW
101108 FILE_ARCH=i386
102109 endif
103110 endif
123130 endif
124131
125132 ifndef CLIENTBIN
126 ifeq ($(PLATFORM),mingw32)
133 ifdef MINGW
127134 CLIENTBIN=ioWolfMP
128135 else
129136 CLIENTBIN=iowolfmp
131138 endif
132139
133140 ifndef SERVERBIN
134 ifeq ($(PLATFORM),mingw32)
141 ifdef MINGW
135142 SERVERBIN=ioWolfDED
136143 else
137144 SERVERBIN=iowolfded
183190 endif
184191
185192 ifndef USE_CURL_DLOPEN
186 ifeq ($(PLATFORM),mingw32)
193 ifdef MINGW
187194 USE_CURL_DLOPEN=0
188195 else
189196 USE_CURL_DLOPEN=1
232239
233240 ifndef USE_INTERNAL_JPEG
234241 USE_INTERNAL_JPEG=$(USE_INTERNAL_LIBS)
242 endif
243
244 ifndef USE_INTERNAL_FREETYPE
245 USE_INTERNAL_FREETYPE=$(USE_INTERNAL_LIBS)
235246 endif
236247
237248 ifndef USE_LOCAL_HEADERS
290301 OPUSDIR=$(MOUNT_DIR)/opus-1.1
291302 OPUSFILEDIR=$(MOUNT_DIR)/opusfile-0.6
292303 ZDIR=$(MOUNT_DIR)/zlib
304 FTDIR=$(MOUNT_DIR)/freetype-2.5.5
293305 SPLDIR=$(MOUNT_DIR)/splines
294306 Q3ASMDIR=$(MOUNT_DIR)/tools/asm
295307 LBURGDIR=$(MOUNT_DIR)/tools/lcc/lburg
312324 OPENAL_LIBS ?= $(shell pkg-config --silence-errors --libs openal)
313325 SDL_CFLAGS ?= $(shell pkg-config --silence-errors --cflags sdl2|sed 's/-Dmain=SDL_main//')
314326 SDL_LIBS ?= $(shell pkg-config --silence-errors --libs sdl2)
315 FREETYPE_CFLAGS ?= $(shell pkg-config --silence-errors --cflags freetype2)
316327 else
317328 # assume they're in the system default paths (no -I or -L needed)
318329 CURL_LIBS ?= -lcurl
350361 EXTRA_FILES=
351362 CLIENT_EXTRA_FILES=
352363
353 ifneq (,$(findstring "$(PLATFORM)", "linux" "gnu_kfreebsd" "kfreebsd-gnu"))
364 ifneq (,$(findstring "$(PLATFORM)", "linux" "gnu_kfreebsd" "kfreebsd-gnu" "gnu"))
354365
355366 ifeq ($(ARCH),x86_64)
356367 LIB=lib64
360371 else
361372 ifeq ($(ARCH),s390x)
362373 LIB=lib64
374 else
375 ifeq ($(ARCH),aarch64)
376 LIB=lib64
377 endif
363378 endif
364379 endif
365380 endif
368383 -pipe -DUSE_ICON
369384 CLIENT_CFLAGS += $(SDL_CFLAGS)
370385
371 OPTIMIZEVM = -O3 -funroll-loops -fomit-frame-pointer
386 OPTIMIZEVM = -O3
372387 OPTIMIZE = $(OPTIMIZEVM) -ffast-math
373388
374389 ifeq ($(ARCH),x86_64)
375 OPTIMIZEVM = -O3 -fomit-frame-pointer -funroll-loops
376 # clang 3.5 doesn't support this
377 ifneq ("$(CC)", $(findstring "$(CC)", "clang" "clang++"))
378 OPTIMIZEVM += -falign-functions=2 -fstrength-reduce
379 endif
390 OPTIMIZEVM = -O3
380391 OPTIMIZE = $(OPTIMIZEVM) -ffast-math
381392 HAVE_VM_COMPILED = true
382393 else
383394 ifeq ($(ARCH),x86)
384 OPTIMIZEVM = -O3 -march=i586 -fomit-frame-pointer -funroll-loops
385 # clang 3.5 doesn't support this
386 ifneq ("$(CC)", $(findstring "$(CC)", "clang" "clang++"))
387 OPTIMIZEVM += -falign-functions=2 -fstrength-reduce
388 endif
395 OPTIMIZEVM = -O3 -march=i586
389396 OPTIMIZE = $(OPTIMIZEVM) -ffast-math
390397 HAVE_VM_COMPILED=true
391398 else
523530
524531 ifeq ($(USE_OPENAL),1)
525532 ifneq ($(USE_OPENAL_DLOPEN),1)
526 CLIENT_LIBS += -framework OpenAL
533 ifneq ($(USE_INTERNAL_LIBS),1)
534 CLIENT_CFLAGS += $(OPENAL_CFLAGS)
535 CLIENT_LIBS += $(THREAD_LIBS) $(OPENAL_LIBS)
536 else
537 CLIENT_LIBS += -framework OpenAL
538 endif
527539 endif
528540 endif
529541
538550
539551 ifeq ($(USE_LOCAL_HEADERS),1)
540552 BASE_CFLAGS += -I$(SDLHDIR)/include
553 else
554 BASE_CFLAGS += $(SDL_CFLAGS)
541555 endif
542556
543557 # We copy sdlmain before ranlib'ing it so that subversion doesn't think
544558 # the file has been modified by each build.
545 LIBSDLMAIN=$(B)/libSDL2main.a
546 LIBSDLMAINSRC=$(LIBSDIR)/macosx/libSDL2main.a
547 CLIENT_LIBS += -framework IOKit \
548 $(LIBSDIR)/macosx/libSDL2-2.0.0.dylib
549 RENDERER_LIBS += -framework OpenGL $(LIBSDIR)/macosx/libSDL2-2.0.0.dylib
550 CLIENT_EXTRA_FILES += $(LIBSDIR)/macosx/libSDL2-2.0.0.dylib $(LIBSDIR)/macosx/libopenal.dylib
559 ifeq ($(USE_INTERNAL_LIBS),1)
560 LIBSDLMAIN=$(B)/libSDL2main.a
561 LIBSDLMAINSRC=$(LIBSDIR)/macosx/libSDL2main.a
562 CLIENT_LIBS += -framework IOKit $(LIBSDIR)/macosx/libSDL2-2.0.0.dylib
563 RENDERER_LIBS += -framework OpenGL $(LIBSDIR)/macosx/libSDL2-2.0.0.dylib
564 else
565 CLIENT_LIBS += -framework IOKit $(SDL_LIBS)
566 RENDERER_LIBS += -framework OpenGL $(SDL_LIBS)
567 endif
568
569 ifeq ($(USE_INTERNAL_LIBS),1)
570 CLIENT_EXTRA_FILES += $(LIBSDIR)/macosx/libSDL2-2.0.0.dylib $(LIBSDIR)/macosx/libopenal.dylib
571 endif
551572
552573 OPTIMIZE = $(OPTIMIZEVM) -ffast-math
553574
564585 # SETUP AND BUILD -- MINGW32
565586 #############################################################################
566587
567 ifeq ($(PLATFORM),mingw32)
588 ifdef MINGW
568589
569590 ifeq ($(CROSS_COMPILING),1)
570591 # If CC is already set to something generic, we probably want to use
581602 MINGW_PREFIXES=amd64-mingw32msvc x86_64-w64-mingw32
582603 endif
583604 ifeq ($(ARCH),x86)
584 MINGW_PREFIXES=i586-mingw32msvc i686-w64-mingw32
605 MINGW_PREFIXES=i586-mingw32msvc i686-w64-mingw32 i686-pc-mingw32
585606 endif
586607
587608 ifndef CC
634655 endif
635656
636657 ifeq ($(ARCH),x86_64)
637 OPTIMIZEVM = -O3 -fno-omit-frame-pointer -funroll-loops
638 # clang 3.5 doesn't support this
639 ifneq ("$(CC)", $(findstring "$(CC)", "clang" "clang++"))
640 OPTIMIZEVM += -falign-functions=2 -fstrength-reduce
641 endif
658 OPTIMIZEVM = -O3
642659 OPTIMIZE = $(OPTIMIZEVM) -ffast-math
643660 HAVE_VM_COMPILED = true
644661 FILE_ARCH=x64
645662 endif
646663 ifeq ($(ARCH),x86)
647 OPTIMIZEVM = -O3 -march=i586 -fno-omit-frame-pointer -funroll-loops
648 # clang 3.5 doesn't support this
649 ifneq ("$(CC)", $(findstring "$(CC)", "clang" "clang++"))
650 OPTIMIZEVM += -falign-functions=2 -fstrength-reduce
651 endif
664 OPTIMIZEVM = -O3 -march=i586
652665 OPTIMIZE = $(OPTIMIZEVM) -ffast-math
653666 HAVE_VM_COMPILED = true
654667 endif
677690 RENDERER_LIBS = -lgdi32 -lole32 -lopengl32
678691
679692 ifeq ($(USE_FREETYPE),1)
680 FREETYPE_CFLAGS = -Ifreetype2
693 ifneq ($(USE_INTERNAL_FREETYPE),1)
694 FREETYPE_CFLAGS = -Ifreetype2
695 endif
681696 endif
682697
683698 ifeq ($(USE_CURL),1)
731746 SDLDLL=SDL2.dll
732747 endif
733748
734 else # ifeq mingw32
749 else # ifdef MINGW
735750
736751 #############################################################################
737752 # SETUP AND BUILD -- FREEBSD
746761 CLIENT_CFLAGS += $(SDL_CFLAGS)
747762 HAVE_VM_COMPILED = true
748763
749 OPTIMIZEVM = -O3 -funroll-loops -fomit-frame-pointer
764 OPTIMIZEVM = -O3
750765 OPTIMIZE = $(OPTIMIZEVM) -ffast-math
751766
752767 SHLIBEXT=so
799814 -pipe -DUSE_ICON -DMAP_ANONYMOUS=MAP_ANON
800815 CLIENT_CFLAGS += $(SDL_CFLAGS)
801816
802 OPTIMIZEVM = -O3 -funroll-loops -fomit-frame-pointer
817 OPTIMIZEVM = -O3
803818 OPTIMIZE = $(OPTIMIZEVM) -ffast-math
804819
805820 ifeq ($(ARCH),x86_64)
806 OPTIMIZEVM = -O3 -fomit-frame-pointer -funroll-loops
807 # clang 3.5 doesn't support this
808 ifneq ("$(CC)", $(findstring "$(CC)", "clang" "clang++"))
809 OPTIMIZEVM += -falign-functions=2 -fstrength-reduce
810 endif
821 OPTIMIZEVM = -O3
811822 OPTIMIZE = $(OPTIMIZEVM) -ffast-math
812823 HAVE_VM_COMPILED = true
813824 else
814825 ifeq ($(ARCH),x86)
815 OPTIMIZEVM = -O3 -march=i586 -fomit-frame-pointer -funroll-loops
816 # clang 3.5 doesn't support this
817 ifneq ("$(CC)", $(findstring "$(CC)", "clang" "clang++"))
818 OPTIMIZEVM += -falign-functions=2 -fstrength-reduce
819 endif
826 OPTIMIZEVM = -O3 -march=i586
820827 OPTIMIZE = $(OPTIMIZEVM) -ffast-math
821828 HAVE_VM_COMPILED=true
822829 else
944951 -pipe -DUSE_ICON
945952 CLIENT_CFLAGS += $(SDL_CFLAGS)
946953
947 OPTIMIZEVM = -O3 -funroll-loops
954 OPTIMIZEVM = -O3
948955
949956 ifeq ($(ARCH),sparc)
950957 OPTIMIZEVM += -O3 -mtune=ultrasparc3 -mv8plus -mno-faster-structs
951 # clang 3.5 doesn't support this
952 ifneq ("$(CC)", $(findstring "$(CC)", "clang" "clang++"))
953 OPTIMIZEVM += -falign-functions=2 -fstrength-reduce
954 endif
955958 HAVE_VM_COMPILED=true
956959 else
957960 ifeq ($(ARCH),x86)
958 OPTIMIZEVM += -march=i586 -fomit-frame-pointer
959 # clang 3.5 doesn't support this
960 ifneq ("$(CC)", $(findstring "$(CC)", "clang" "clang++"))
961 OPTIMIZEVM += -falign-functions=2 -fstrength-reduce
962 endif
961 OPTIMIZEVM += -march=i586
963962 HAVE_VM_COMPILED=true
964963 BASE_CFLAGS += -m32
965964 CLIENT_CFLAGS += -I/usr/X11/include/NVIDIA
995994
996995 endif #Linux
997996 endif #darwin
998 endif #mingw32
997 endif #MINGW
999998 endif #FreeBSD
1000999 endif #OpenBSD
10011000 endif #NetBSD
10451044
10461045 ifneq ($(BUILD_GAME_SO),0)
10471046 ifneq ($(BUILD_BASEGAME),0)
1048 ifeq ($(PLATFORM),mingw32)
1047 ifdef MINGW
10491048 TARGETS += \
10501049 $(B)/$(BASEGAME)/cgame_mp_$(SHLIBNAME) \
10511050 $(B)/$(BASEGAME)/qagame_mp_$(SHLIBNAME) \
11521151 BASE_CFLAGS += -DUSE_INTERNAL_JPEG
11531152 BASE_CFLAGS += -I$(JPDIR)
11541153 else
1155 # libjpeg doesn't have pkg-config yet, but let users override with
1156 # "make JPEG_CFLAGS=-I/opt/jpeg/include JPEG_LIBS='-L/opt/jpeg/lib -ljpeg'"
1157 # if they need to
1158 JPEG_CFLAGS ?=
1159 JPEG_LIBS ?= -ljpeg
1154 # IJG libjpeg doesn't have pkg-config, but libjpeg-turbo uses libjpeg.pc;
1155 # we fall back to hard-coded answers if libjpeg.pc is unavailable
1156 JPEG_CFLAGS ?= $(shell pkg-config --silence-errors --cflags libjpeg || true)
1157 JPEG_LIBS ?= $(shell pkg-config --silence-errors --libs libjpeg || echo -ljpeg)
11601158 BASE_CFLAGS += $(JPEG_CFLAGS)
11611159 RENDERER_LIBS += $(JPEG_LIBS)
11621160 endif
11631161
11641162 ifeq ($(USE_FREETYPE),1)
1165 FREETYPE_CFLAGS ?= $(shell pkg-config --silence-errors --cflags freetype2 || true)
1166 FREETYPE_LIBS ?= $(shell pkg-config --silence-errors --libs freetype2 || echo -lfreetype)
1167
1163 ifeq ($(USE_INTERNAL_FREETYPE),1)
1164 FREETYPE_CFLAGS += -I$(FTDIR)/include -DFT2_BUILD_LIBRARY
1165 else
1166 FREETYPE_CFLAGS ?= $(shell pkg-config --silence-errors --cflags freetype2 || true)
1167 FREETYPE_LIBS ?= $(shell pkg-config --silence-errors --libs freetype2 || echo -lfreetype)
1168 endif
11681169 BASE_CFLAGS += -DBUILD_FREETYPE $(FREETYPE_CFLAGS)
11691170 RENDERER_LIBS += $(FREETYPE_LIBS)
11701171 endif
13691370 @echo " COMPILE_ARCH: $(COMPILE_ARCH)"
13701371 @echo " CC: $(CC)"
13711372 @echo " CXX: $(CXX)"
1372 ifeq ($(PLATFORM),mingw32)
1373 ifdef MINGW
13731374 @echo " WINDRES: $(WINDRES)"
13741375 endif
13751376 @echo ""
17091710 $(B)/client/con_log.o \
17101711 $(B)/client/sys_main.o
17111712
1712 ifeq ($(PLATFORM),mingw32)
1713 ifdef MINGW
17131714 Q3OBJ += \
17141715 $(B)/client/con_passive.o
17151716 else
17301731 $(B)/rend2/tr_font.o \
17311732 $(B)/rend2/tr_glsl.o \
17321733 $(B)/rend2/tr_image.o \
1734 $(B)/rend2/tr_image_bmp.o \
1735 $(B)/rend2/tr_image_jpg.o \
1736 $(B)/rend2/tr_image_pcx.o \
17331737 $(B)/rend2/tr_image_png.o \
1734 $(B)/rend2/tr_image_jpg.o \
1735 $(B)/rend2/tr_image_bmp.o \
17361738 $(B)/rend2/tr_image_tga.o \
1737 $(B)/rend2/tr_image_pcx.o \
17381739 $(B)/rend2/tr_init.o \
17391740 $(B)/rend2/tr_light.o \
17401741 $(B)/rend2/tr_main.o \
17971798 $(B)/renderer/tr_flares.o \
17981799 $(B)/renderer/tr_font.o \
17991800 $(B)/renderer/tr_image.o \
1801 $(B)/renderer/tr_image_bmp.o \
1802 $(B)/renderer/tr_image_jpg.o \
1803 $(B)/renderer/tr_image_pcx.o \
18001804 $(B)/renderer/tr_image_png.o \
1801 $(B)/renderer/tr_image_jpg.o \
1802 $(B)/renderer/tr_image_bmp.o \
18031805 $(B)/renderer/tr_image_tga.o \
1804 $(B)/renderer/tr_image_pcx.o \
18051806 $(B)/renderer/tr_init.o \
18061807 $(B)/renderer/tr_light.o \
18071808 $(B)/renderer/tr_main.o \
18881889 $(B)/renderer/jquant1.o \
18891890 $(B)/renderer/jquant2.o \
18901891 $(B)/renderer/jutils.o
1892 endif
1893
1894 ifeq ($(USE_FREETYPE),1)
1895 ifneq ($(USE_INTERNAL_FREETYPE),0)
1896 FTOBJ += \
1897 $(B)/renderer/ftsystem.o \
1898 $(B)/renderer/ftdebug.o \
1899 $(B)/renderer/ftinit.o \
1900 $(B)/renderer/ftbase.o \
1901 $(B)/renderer/ftbbox.o \
1902 $(B)/renderer/ftbdf.o \
1903 $(B)/renderer/ftbitmap.o \
1904 $(B)/renderer/ftcid.o \
1905 $(B)/renderer/ftfstype.o \
1906 $(B)/renderer/ftgasp.o \
1907 $(B)/renderer/ftglyph.o \
1908 $(B)/renderer/ftgxval.o \
1909 $(B)/renderer/ftlcdfil.o \
1910 $(B)/renderer/ftmm.o \
1911 $(B)/renderer/ftotval.o \
1912 $(B)/renderer/ftpatent.o \
1913 $(B)/renderer/ftpfr.o \
1914 $(B)/renderer/ftstroke.o \
1915 $(B)/renderer/ftsynth.o \
1916 $(B)/renderer/fttype1.o \
1917 $(B)/renderer/ftwinfnt.o \
1918 $(B)/renderer/ftxf86.o \
1919 $(B)/renderer/truetype.o \
1920 $(B)/renderer/type1.o \
1921 $(B)/renderer/cff.o \
1922 $(B)/renderer/type1cid.o \
1923 $(B)/renderer/pfr.o \
1924 $(B)/renderer/type42.o \
1925 $(B)/renderer/winfnt.o \
1926 $(B)/renderer/pcf.o \
1927 $(B)/renderer/bdf.o \
1928 $(B)/renderer/sfnt.o \
1929 $(B)/renderer/autofit.o \
1930 $(B)/renderer/pshinter.o \
1931 $(B)/renderer/raster.o \
1932 $(B)/renderer/smooth.o \
1933 $(B)/renderer/ftcache.o \
1934 $(B)/renderer/ftgzip.o \
1935 $(B)/renderer/ftlzw.o \
1936 $(B)/renderer/ftbzip2.o \
1937 $(B)/renderer/psaux.o \
1938 $(B)/renderer/psnames.o
1939 endif
18911940 endif
18921941
18931942 ifeq ($(ARCH),x86)
20502099 $(B)/client/internal.o \
20512100 $(B)/client/opusfile.o \
20522101 $(B)/client/stream.o
2053 ifeq ($(PLATFORM),mingw32)
2102 ifdef MINGW
20542103 Q3OBJ += \
20552104 $(B)/client/wincerts.o
20562105 endif
21202169 endif
21212170 endif
21222171
2123 ifeq ($(PLATFORM),mingw32)
2172 ifdef MINGW
21242173 Q3OBJ += \
21252174 $(B)/client/win_resource.o \
21262175 $(B)/client/sys_win32.o
21462195 -o $@ $(Q3OBJ) \
21472196 $(LIBSDLMAIN) $(CLIENT_LIBS) $(LIBS)
21482197
2149 $(B)/renderer_mp_opengl1_$(SHLIBNAME): $(Q3ROBJ) $(JPGOBJ)
2198 $(B)/renderer_mp_opengl1_$(SHLIBNAME): $(Q3ROBJ) $(JPGOBJ) $(FTOBJ)
21502199 $(echo_cmd) "LD $@"
2151 $(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(Q3ROBJ) $(JPGOBJ) \
2200 $(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(Q3ROBJ) $(JPGOBJ) $(FTOBJ) \
21522201 $(THREAD_LIBS) $(LIBSDLMAIN) $(RENDERER_LIBS) $(LIBS)
21532202
2154 $(B)/renderer_mp_rend2_$(SHLIBNAME): $(Q3R2OBJ) $(Q3R2STRINGOBJ) $(JPGOBJ)
2203 $(B)/renderer_mp_rend2_$(SHLIBNAME): $(Q3R2OBJ) $(Q3R2STRINGOBJ) $(JPGOBJ) $(FTOBJ)
21552204 $(echo_cmd) "LD $@"
2156 $(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(Q3R2OBJ) $(Q3R2STRINGOBJ) $(JPGOBJ) \
2205 $(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(Q3R2OBJ) $(Q3R2STRINGOBJ) $(JPGOBJ) $(FTOBJ) \
21572206 $(THREAD_LIBS) $(LIBSDLMAIN) $(RENDERER_LIBS) $(LIBS)
21582207 else
2159 $(B)/$(CLIENTBIN)$(FULLBINEXT): $(Q3OBJ) $(Q3ROBJ) $(JPGOBJ) $(LIBSDLMAIN)
2208 $(B)/$(CLIENTBIN)$(FULLBINEXT): $(Q3OBJ) $(Q3ROBJ) $(JPGOBJ) $(FTOBJ) $(LIBSDLMAIN)
21602209 $(echo_cmd) "LD $@"
21612210 $(Q)$(CXX) $(CLIENT_CFLAGS) $(CFLAGS) $(CLIENT_LDFLAGS) $(LDFLAGS) \
2162 -o $@ $(Q3OBJ) $(Q3ROBJ) $(JPGOBJ) \
2211 -o $@ $(Q3OBJ) $(Q3ROBJ) $(JPGOBJ) $(FTOBJ) \
21632212 $(LIBSDLMAIN) $(CLIENT_LIBS) $(RENDERER_LIBS) $(LIBS)
21642213
2165 $(B)/$(CLIENTBIN)_rend2$(FULLBINEXT): $(Q3OBJ) $(Q3R2OBJ) $(Q3R2STRINGOBJ) $(JPGOBJ) $(LIBSDLMAIN)
2214 $(B)/$(CLIENTBIN)_rend2$(FULLBINEXT): $(Q3OBJ) $(Q3R2OBJ) $(Q3R2STRINGOBJ) $(JPGOBJ) $(FTOBJ) $(LIBSDLMAIN)
21662215 $(echo_cmd) "LD $@"
21672216 $(Q)$(CXX) $(CLIENT_CFLAGS) $(CFLAGS) $(CLIENT_LDFLAGS) $(LDFLAGS) \
2168 -o $@ $(Q3OBJ) $(Q3R2OBJ) $(Q3R2STRINGOBJ) $(JPGOBJ) \
2217 -o $@ $(Q3OBJ) $(Q3R2OBJ) $(Q3R2STRINGOBJ) $(JPGOBJ) $(FTOBJ) \
21692218 $(LIBSDLMAIN) $(CLIENT_LIBS) $(RENDERER_LIBS) $(LIBS)
21702219 endif
21712220
22932342 endif
22942343 endif
22952344
2296 ifeq ($(PLATFORM),mingw32)
2345 ifdef MINGW
22972346 Q3DOBJ += \
22982347 $(B)/ded/win_resource.o \
22992348 $(B)/ded/sys_win32.o \
23572406 Q3CGOBJ = $(Q3CGOBJ_) $(B)/$(BASEGAME)/cgame/cg_syscalls.o
23582407 Q3CGVMOBJ = $(Q3CGOBJ_:%.o=%.asm)
23592408
2360 ifeq ($(PLATFORM),mingw32)
2409 ifdef MINGW
23612410 $(B)/$(BASEGAME)/cgame_mp_$(SHLIBNAME): $(Q3CGOBJ)
23622411 $(echo_cmd) "LD $@"
23632412 $(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(Q3CGOBJ)
24322481 Q3GOBJ = $(Q3GOBJ_) $(B)/$(BASEGAME)/game/g_syscalls.o
24332482 Q3GVMOBJ = $(Q3GOBJ_:%.o=%.asm)
24342483
2435 ifeq ($(PLATFORM),mingw32)
2484 ifdef MINGW
24362485 $(B)/$(BASEGAME)/qagame_mp_$(SHLIBNAME): $(Q3GOBJ)
24372486 $(echo_cmd) "LD $@"
24382487 $(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(Q3GOBJ)
24662515 Q3UIOBJ = $(Q3UIOBJ_) $(B)/$(BASEGAME)/ui/ui_syscalls.o
24672516 Q3UIVMOBJ = $(Q3UIOBJ_:%.o=%.asm)
24682517
2469 ifeq ($(PLATFORM),mingw32)
2518 ifdef MINGW
24702519 $(B)/$(BASEGAME)/ui_mp_$(SHLIBNAME): $(Q3UIOBJ)
24712520 $(echo_cmd) "LD $@"
24722521 $(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(Q3UIOBJ)
25632612 $(B)/rend2/%.o: $(R2DIR)/%.c
25642613 $(DO_REF_CC)
25652614
2615 $(B)/renderer/%.o: $(FTDIR)/src/autofit/%.c
2616 $(DO_REF_CC)
2617
2618 $(B)/renderer/%.o: $(FTDIR)/src/base/%.c
2619 $(DO_REF_CC)
2620
2621 $(B)/renderer/%.o: $(FTDIR)/src/bdf/%.c
2622 $(DO_REF_CC)
2623
2624 $(B)/renderer/%.o: $(FTDIR)/src/bzip2/%.c
2625 $(DO_REF_CC)
2626
2627 $(B)/renderer/%.o: $(FTDIR)/src/cache/%.c
2628 $(DO_REF_CC)
2629
2630 $(B)/renderer/%.o: $(FTDIR)/src/cff/%.c
2631 $(DO_REF_CC)
2632
2633 $(B)/renderer/%.o: $(FTDIR)/src/cid/%.c
2634 $(DO_REF_CC)
2635
2636 $(B)/renderer/%.o: $(FTDIR)/src/gxvalid/%.c
2637 $(DO_REF_CC)
2638
2639 $(B)/renderer/%.o: $(FTDIR)/src/gzip/%.c
2640 $(DO_REF_CC)
2641
2642 $(B)/renderer/%.o: $(FTDIR)/src/lzw/%.c
2643 $(DO_REF_CC)
2644
2645 $(B)/renderer/%.o: $(FTDIR)/src/otvalid/%.c
2646 $(DO_REF_CC)
2647
2648 $(B)/renderer/%.o: $(FTDIR)/src/pcf/%.c
2649 $(DO_REF_CC)
2650
2651 $(B)/renderer/%.o: $(FTDIR)/src/pfr/%.c
2652 $(DO_REF_CC)
2653
2654 $(B)/renderer/%.o: $(FTDIR)/src/psaux/%.c
2655 $(DO_REF_CC)
2656
2657 $(B)/renderer/%.o: $(FTDIR)/src/pshinter/%.c
2658 $(DO_REF_CC)
2659
2660 $(B)/renderer/%.o: $(FTDIR)/src/psnames/%.c
2661 $(DO_REF_CC)
2662
2663 $(B)/renderer/%.o: $(FTDIR)/src/raster/%.c
2664 $(DO_REF_CC)
2665
2666 $(B)/renderer/%.o: $(FTDIR)/src/sfnt/%.c
2667 $(DO_REF_CC)
2668
2669 $(B)/renderer/%.o: $(FTDIR)/src/smooth/%.c
2670 $(DO_REF_CC)
2671
2672 $(B)/renderer/%.o: $(FTDIR)/src/tools/%.c
2673 $(DO_REF_CC)
2674
2675 $(B)/renderer/%.o: $(FTDIR)/src/truetype/%.c
2676 $(DO_REF_CC)
2677
2678 $(B)/renderer/%.o: $(FTDIR)/src/type1/%.c
2679 $(DO_REF_CC)
2680
2681 $(B)/renderer/%.o: $(FTDIR)/src/type42/%.c
2682 $(DO_REF_CC)
2683
2684 $(B)/renderer/%.o: $(FTDIR)/src/winfonts/%.c
2685 $(DO_REF_CC)
25662686
25672687 $(B)/ded/%.o: $(ASMDIR)/%.s
25682688 $(DO_AS)
26482768 # MISC
26492769 #############################################################################
26502770
2651 OBJ = $(Q3OBJ) $(Q3ROBJ) $(Q3R2OBJ) $(Q3DOBJ) $(JPGOBJ) \
2771 OBJ = $(Q3OBJ) $(Q3ROBJ) $(Q3R2OBJ) $(Q3DOBJ) $(JPGOBJ) $(FTOBJ) \
26522772 $(Q3GOBJ) $(Q3CGOBJ) $(Q3UIOBJ) \
26532773 $(Q3GVMOBJ) $(Q3CGVMOBJ) $(Q3UIVMOBJ)
26542774 TOOLSOBJ = $(LBURGOBJ) $(Q3CPPOBJ) $(Q3RCCOBJ) $(Q3LCCOBJ) $(Q3ASMOBJ)
0 To run iortcw on the Raspberry Pi requires SDL2.
0 To run iortcw on the Raspberry Pi requires SDL2 and at least 128M for GPU memory.
1
2 (Under Raspbian, you can set the GPU memory using the raspi-config tool under Advanced Options->Memory Split)
13
24 SDL2 will need to be built in a particular way to have hardware accelerated
35 graphics.
1820
1921 ./configure --disable-video-x11 --disable-video-opengl
2022
23 Note: On the newer Raspberry Pi 2 (due to a change in the toolchain naming) use:
24
25 ./configure --host=armv7l-raspberry-linux-gnueabihf --disable-video-x11 --disable-video-opengl
26
2127 After that has completed, type:
2228 make
2329
3434 ALIGN 16
3535 ssemask DWORD 0FFFFFFFFh, 0FFFFFFFFh, 0FFFFFFFFh, 00000000h
3636 ssecw DWORD 00001F80h
37
38 IFNDEF idx64
39 fpucw WORD 037Fh
40 ENDIF
4137
4238 .code
4339
17081708 }
17091709 }
17101710 // -NERVE - SMF
1711
1712 trap_R_SetColor( NULL );
17111713 }
17121714
17131715
587587 int CG_WaterLevel(centity_t *cent) {
588588 vec3_t point;
589589 int contents, sample1, sample2, anim, waterlevel;
590
590 int viewheight;
591
592 anim = cent->currentState.legsAnim & ~ANIM_TOGGLEBIT;
593
594 if (anim == LEGS_WALKCR || anim == LEGS_IDLECR) {
595 viewheight = CROUCH_VIEWHEIGHT;
596 } else {
597 viewheight = DEFAULT_VIEWHEIGHT;
598 }
599
600 //
591601 // get waterlevel, accounting for ducking
602 //
592603 waterlevel = 0;
593 VectorCopy(cent->lerpOrigin, point);
594 point[2] += MINS_Z + 1;
595 anim = cent->currentState.legsAnim & ~ANIM_TOGGLEBIT;
596
597 if (anim == LEGS_WALKCR || anim == LEGS_IDLECR) {
598 point[2] += CROUCH_VIEWHEIGHT;
599 } else {
600 point[2] += DEFAULT_VIEWHEIGHT;
601 }
602
604
605 point[0] = cent->lerpOrigin[0];
606 point[1] = cent->lerpOrigin[1];
607 point[2] = cent->lerpOrigin[2] + MINS_Z + 1;
603608 contents = CG_PointContents(point, -1);
604609
605610 if (contents & MASK_WATER) {
606 sample2 = point[2] - MINS_Z;
611 sample2 = viewheight - MINS_Z;
607612 sample1 = sample2 / 2;
608613 waterlevel = 1;
609614 point[2] = cent->lerpOrigin[2] + MINS_Z + sample1;
743748 }
744749
745750 // play a gurp sound instead of a normal pain sound
746 if (CG_WaterLevel(cent) >= 1) {
751 if (CG_WaterLevel(cent) == 3) {
747752 if (rand()&1) {
748753 trap_S_StartSound(NULL, cent->currentState.number, CHAN_VOICE, CG_CustomSound(cent->currentState.number, "sound/player/gurp1.wav"));
749754 } else {
23012306 case EV_DEATH3:
23022307 DEBUGNAME( "EV_DEATHx" );
23032308
2304 if (CG_WaterLevel(cent) >= 1) {
2309 if (CG_WaterLevel(cent) == 3) {
23052310 trap_S_StartSound(NULL, es->number, CHAN_VOICE, CG_CustomSound(es->number, "*drown.wav"));
23062311 } else {
23072312 trap_S_StartSound(NULL, es->number, CHAN_VOICE, CG_CustomSound(es->number, va("*death%i.wav", event - EV_DEATH1 + 1)));
16591659 extern vmCvar_t cg_ignore;
16601660 extern vmCvar_t cg_simpleItems;
16611661 extern vmCvar_t cg_fov;
1662 extern vmCvar_t cg_fixedAspect;
16621663 extern vmCvar_t cg_zoomFov;
16631664 extern vmCvar_t cg_zoomDefaultBinoc;
16641665 extern vmCvar_t cg_zoomDefaultSniper;
163163 vmCvar_t cg_ignore;
164164 vmCvar_t cg_simpleItems;
165165 vmCvar_t cg_fov;
166 vmCvar_t cg_fixedAspect;
166167 vmCvar_t cg_zoomFov;
167168 vmCvar_t cg_zoomStepBinoc;
168169 vmCvar_t cg_zoomStepSniper;
303304 { &cg_zoomStepSnooper, "cg_zoomStepSnooper", "5", CVAR_ARCHIVE },
304305 { &cg_zoomStepFG, "cg_zoomStepFG", "10", CVAR_ARCHIVE }, //----(SA) added
305306 { &cg_fov, "cg_fov", "90", CVAR_ARCHIVE },
307 { &cg_fixedAspect, "cg_fixedAspect", "0", CVAR_ARCHIVE }, // Essentially the same as setting DF_FIXED_FOV for widescreen aspects
306308 { &cg_viewsize, "cg_viewsize", "100", CVAR_ARCHIVE },
307309 { &cg_letterbox, "cg_letterbox", "0", CVAR_TEMP }, //----(SA) added
308310 { &cg_shadows, "cg_shadows", "1", CVAR_ARCHIVE },
406406 cgs.teamVoteNo[num - CS_TEAMVOTE_NO] = atoi( str );
407407 cgs.teamVoteModified[num - CS_TEAMVOTE_NO] = qtrue;
408408 } else if ( num >= CS_TEAMVOTE_STRING && num <= CS_TEAMVOTE_STRING + 1 ) {
409 Q_strncpyz( cgs.teamVoteString[num - CS_TEAMVOTE_STRING], str, sizeof( cgs.teamVoteString ) );
409 Q_strncpyz( cgs.teamVoteString[num - CS_TEAMVOTE_STRING], str, sizeof( cgs.teamVoteString[0] ) );
410410 trap_S_StartLocalSound( cgs.media.voteNow, CHAN_ANNOUNCER );
411411 #endif
412412 } else if ( num == CS_INTERMISSION ) {
763763 #ifdef MISSIONPACK
764764 if ( cg_singlePlayerActive.integer ) {
765765 trap_Cvar_Set( "ui_matchStartTime", va( "%i", cg.time ) );
766 if ( cg_recordSPDemo.integer && cg_recordSPDemoName.string && *cg_recordSPDemoName.string ) {
766 if ( cg_recordSPDemo.integer && *cg_recordSPDemoName.string ) {
767767 trap_SendConsoleCommand( va( "set g_synchronousclients 1 ; record %s \n", cg_recordSPDemoName.string ) );
768768 }
769769 }
804804 */
805805 #define WAVE_AMPLITUDE 1
806806 #define WAVE_FREQUENCY 0.4
807 #define STANDARD_ASPECT_RATIO ( (float)640 / (float)480 )
807808
808809 static int CG_CalcFov( void ) {
809810 static float lastfov = 90; // for transitions back from zoomed in modes
829830 fov_x = 90;
830831 } else {
831832 // user selectable
832 if ( cgs.dmflags & DF_FIXED_FOV ) {
833 if ( ( cgs.dmflags & DF_FIXED_FOV ) || cg_fixedAspect.value ) {
833834 // dmflag to prevent wide fov for all clients
834835 fov_x = 90;
835836 } else {
892893 fov_x = 55;
893894 }
894895
896 if ( cg_fixedAspect.value ) {
897 float aspectRatio = (float)cg.refdef.width / (float)cg.refdef.height;
898
899 if ( aspectRatio > STANDARD_ASPECT_RATIO )
900 fov_x = RAD2DEG( 2 * atan2( ( aspectRatio / STANDARD_ASPECT_RATIO ) * tan( DEG2RAD( fov_x ) * 0.5 ), 1 ) );
901 fov_x = min( fov_x, 160 );
902 }
903
895904 x = cg.refdef.width / tan( fov_x / 360 * M_PI );
896905 fov_y = atan2( cg.refdef.height, x );
897906 fov_y = fov_y * 360 / M_PI;
11221131 angles[PITCH] = -angles[PITCH]; // (SA) compensate for reversed pitch (this makes the game match the editor, however I'm guessing the real fix is to be done there)
11231132 VectorCopy( angles, cg.refdefViewAngles );
11241133 AnglesToAxis( cg.refdefViewAngles, cg.refdef.viewaxis );
1134
1135 if ( cg_fixedAspect.value ) {
1136 float aspectRatio = (float)cg.refdef.width / (float)cg.refdef.height;
1137
1138 if ( aspectRatio > STANDARD_ASPECT_RATIO )
1139 fov = RAD2DEG( 2 * atan2( ( aspectRatio / STANDARD_ASPECT_RATIO ) * tan( DEG2RAD( fov ) * 0.5 ), 1 ) );
1140 fov = min( fov, 160 );
1141 }
11251142
11261143 x = cg.refdef.width / tan( fov / 360 * M_PI );
11271144 cg.refdef.fov_y = atan2( cg.refdef.height, x );
14021419 fov_x = 90;
14031420 } else {
14041421 // user selectable
1405 if ( cgs.dmflags & DF_FIXED_FOV ) {
1422 if ( ( cgs.dmflags & DF_FIXED_FOV ) || cg_fixedAspect.value ) {
14061423 // dmflag to prevent wide fov for all clients
14071424 fov_x = 90;
14081425 } else {
14571474 fov_x = 55;
14581475 }
14591476
1477 if ( cg_fixedAspect.value ) {
1478 float aspectRatio = (float)cg.refdef.width / (float)cg.refdef.height;
1479
1480 if ( aspectRatio > STANDARD_ASPECT_RATIO )
1481 fov_x = RAD2DEG( 2 * atan2( ( aspectRatio / STANDARD_ASPECT_RATIO ) * tan( DEG2RAD( fov_x ) * 0.5 ), 1 ) );
1482 fov_x = min( fov_x, 160 );
1483 }
1484
14601485 cg.refdef.time = cg.time;
14611486
14621487 x = cg.refdef.width / tan( fov_x / 360 * M_PI );
28162816 }
28172817
28182818 // drop gun lower at higher fov
2819 if ( cg_fov.integer > 90 ) {
2819 if ( cg_fov.integer > 90 && !cg_fixedAspect.value ) {
28202820 fovOffset = -0.2 * ( cg_fov.integer - 90 );
28212821 } else {
28222822 fovOffset = 0;
119119 buffer[ bufIndex + 1 ] = (byte)( ( x >> 8 ) & 0xFF );
120120 bufIndex += 2;
121121 }
122
123 /*
124 ===============
125 WRITE_1BYTES
126 ===============
127 */
128 #if 0
129 static ID_INLINE void WRITE_1BYTES( int x ) {
130 buffer[ bufIndex ] = x;
131 bufIndex += 1;
132 }
133 #endif
134122
135123 /*
136124 ===============
106106 qboolean looping, holdAtEnd, dirty, alterGameState, silent, shader;
107107 fileHandle_t iFile;
108108 e_status status;
109 unsigned int startTime;
110 unsigned int lastTime;
109 int startTime;
110 int lastTime;
111111 long tfps;
112112 long RoQPlayed;
113113 long ROQSize;
178178 } serverStatus_t;
179179
180180 serverStatus_t cl_serverStatusList[MAX_SERVERSTATUSREQUESTS];
181 int serverStatusCount;
182181
183182 // DHM - Nerve :: Have we heard from the auto-update server this session?
184183 qboolean autoupdateChecked;
24782477 =================
24792478 */
24802479 void CL_CheckForResend( void ) {
2481 int port, i;
2480 int port;
24822481 char info[MAX_INFO_STRING];
2483 char data[MAX_INFO_STRING];
2482 char data[MAX_INFO_STRING + 10];
24842483
24852484 // don't send anything if playing back a demo
24862485 if ( clc.demoplaying ) {
25342533 Info_SetValueForKey( info, "qport", va("%i", port ) );
25352534 Info_SetValueForKey( info, "challenge", va("%i", clc.challenge ) );
25362535
2537 strcpy(data, "connect ");
2538 // TTimo adding " " around the userinfo string to avoid truncated userinfo on the server
2539 // (Com_TokenizeString tokenizes around spaces)
2540 data[8] = '"';
2541
2542 for(i=0;i<strlen(info);i++) {
2543 data[9+i] = info[i]; // + (clc.challenge)&0x3;
2544 }
2545 data[9+i] = '"';
2546 data[10+i] = 0;
2547
2548 // NOTE TTimo don't forget to set the right data length!
2549 NET_OutOfBandData( NS_CLIENT, clc.serverAddress, (byte *) &data[0], i+10 );
2536 Com_sprintf( data, sizeof(data), "connect \"%s\"", info );
2537 NET_OutOfBandData( NS_CLIENT, clc.serverAddress, (byte *) data, strlen ( data ) );
25502538 // the most current userinfo has been sent, so watch for any
25512539 // newer changes to userinfo variables
25522540 cvar_modifiedFlags &= ~CVAR_USERINFO;
45784566 oldestTime = cl_serverStatusList[i].startTime;
45794567 }
45804568 }
4581 if (oldest != -1) {
4582 return &cl_serverStatusList[oldest];
4583 }
4584 serverStatusCount++;
4585 return &cl_serverStatusList[serverStatusCount & (MAX_SERVERSTATUSREQUESTS-1)];
4569 return &cl_serverStatusList[oldest];
45864570 }
45874571
45884572 /*
13611361 BotAI_Trace( &trace, start, NULL, NULL, end, passent, contents_mask );
13621362 //if water was hit
13631363 waterfactor = 1.0;
1364 //note: trace.contents is always 0, see BotAI_Trace
13641365 if ( trace.contents & ( CONTENTS_LAVA | CONTENTS_SLIME | CONTENTS_WATER ) ) {
13651366 //if the water surface is translucent
13661367 if ( 1 ) {
890890 }
891891
892892 if ( i == facet->numBorders ) {
893 if ( facet->numBorders > 4 + 6 + 16 ) {
893 if ( facet->numBorders >= 4 + 6 + 16 ) {
894894 Com_Printf( "ERROR: too many bevels\n" );
895 continue;
895896 }
896897 facet->borderPlanes[facet->numBorders] = CM_FindPlane2( plane, &flipped );
897898 facet->borderNoAdjust[facet->numBorders] = 0;
960961 }
961962
962963 if ( i == facet->numBorders ) {
963 if ( facet->numBorders > 4 + 6 + 16 ) {
964 if ( facet->numBorders >= 4 + 6 + 16 ) {
964965 Com_Printf( "ERROR: too many bevels\n" );
966 continue;
965967 }
966968 facet->borderPlanes[facet->numBorders] = CM_FindPlane2( plane, &flipped );
967969
10011003
10021004 #ifndef BSPC
10031005 //add opposite plane
1006 if ( facet->numBorders >= 4 + 6 + 16 ) {
1007 Com_Printf( "ERROR: too many bevels\n" );
1008 return;
1009 }
10041010 facet->borderPlanes[facet->numBorders] = facet->surfacePlane;
10051011 facet->borderNoAdjust[facet->numBorders] = 0;
10061012 facet->borderInward[facet->numBorders] = qtrue;
36373637
36383638 Com_Printf( "Com_RandomBytes: using weak randomization\n" );
36393639 for( i = 0; i < len; i++ )
3640 string[i] = (unsigned char)( rand() % 255 );
3640 string[i] = (unsigned char)( rand() % 256 );
36413641 }
36423642
36433643
539539
540540 // Skip creation of the root directory as it will always be there
541541 ofs = strchr( path, PATH_SEP );
542 ofs++;
542 if ( ofs != NULL ) {
543 ofs++;
544 }
543545
544546 for (; ofs != NULL && *ofs ; ofs++) {
545547 if (*ofs == PATH_SEP) {
37113713 Com_Printf("\n\n"
37123714 "**************************************************\n"
37133715 "WARNING: " BASEGAME "/mp_pak0.pk3 is present but its checksum (%u)\n"
3714 "is not correct. Please re-copy pak0.pk3 from your\n"
3716 "is not correct. Please re-copy mp_pak0.pk3 from your\n"
37153717 "legitimate RTCW CDROM.\n"
37163718 "**************************************************\n\n\n",
37173719 curpack->checksum );
168168
169169 //================================================================= LINUX ===
170170
171 #if defined(__linux__) || defined(__FreeBSD_kernel__)
171 #if defined(__linux__) || defined(__FreeBSD_kernel__) || defined(__GNU__)
172172
173173 #include <endian.h>
174174
175175 #if defined(__linux__)
176176 #define OS_STRING "linux"
177 #else
177 #elif defined(__FreeBSD_kernel__)
178178 #define OS_STRING "kFreeBSD"
179 #else
180 #define OS_STRING "GNU"
179181 #endif
180182
181183 #define ID_INLINE inline
204206 #define ARCH_STRING "sparc"
205207 #elif defined __arm__
206208 #define ARCH_STRING "arm"
209 #elif defined __aarch64__
210 #define ARCH_STRING "aarch64"
207211 #elif defined __cris__
208212 #define ARCH_STRING "cris"
209213 #elif defined __hppa__
13851385 *o = 0;
13861386
13871387 if ( !strcmp( key, pkey ) ) {
1388 strcpy( start, s ); // remove this part
1388 memmove(start, s, strlen(s) + 1); // remove this part
13891389 return;
13901390 }
13911391
00 /* unzip.c -- IO for uncompress .zip files using zlib
1
2 Modified for Quake III Arena to use the Z_Malloc() memory pool;
3 this means a system copy of minizip is not a suitable replacement.
4
5 Based on minizip:
6
17 Version 1.01e, February 12th, 2005
28
39 Copyright (C) 1998-2005 Gilles Vollant
712718
713719 if (lSeek!=0)
714720 {
715 if (ZSEEK(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)!=0)
716 err=UNZ_ERRNO;
721 if (ZSEEK(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)!=0)
722 err=UNZ_ERRNO;
717723 }
718724 if ((file_info.size_file_comment>0) && (commentBufferSize>0))
719725 if (ZREAD(s->z_filefunc, s->filestream,szComment,uSizeRead)!=uSizeRead)
11391145 pfile_in_zip_read_info->stream.avail_in = 0;
11401146
11411147 if (inflateInit2(&pfile_in_zip_read_info->stream, -MAX_WBITS) == Z_OK)
1142 pfile_in_zip_read_info->stream_initialised=1;
1148 pfile_in_zip_read_info->stream_initialised=1;
11431149 else
11441150 {
11451151 TRYFREE(pfile_in_zip_read_info);
202202
203203
204204 #define MASK_REG(modrm, mask) \
205 EmitString("81"); \
206 EmitString((modrm)); \
207 Emit4((mask))
205 do { \
206 EmitString("81"); \
207 EmitString((modrm)); \
208 Emit4((mask)); \
209 } while(0)
208210
209211 // add bl, bytes
210212 #define STACK_PUSH(bytes) \
211 EmitString("80 C3"); \
212 Emit1(bytes)
213 do { \
214 EmitString("80 C3"); \
215 Emit1(bytes); \
216 } while(0)
213217
214218 // sub bl, bytes
215219 #define STACK_POP(bytes) \
216 EmitString("80 EB"); \
217 Emit1(bytes)
220 do { \
221 EmitString("80 EB"); \
222 Emit1(bytes); \
223 } while(0)
218224
219225 static void EmitCommand(ELastCommand command)
220226 {
411417
412418 if(vm_syscallNum < 0)
413419 {
414 int *data;
420 int *data, *ret;
415421 #if idx64
416422 int index;
417423 intptr_t args[MAX_VMSYSCALL_ARGS];
418424 #endif
419425
420426 data = (int *) (savedVM->dataBase + vm_programStack + 4);
427 ret = &vm_opStackBase[vm_opStackOfs + 1];
421428
422429 #if idx64
423430 args[0] = ~vm_syscallNum;
424431 for(index = 1; index < ARRAY_LEN(args); index++)
425432 args[index] = data[index];
426433
427 vm_opStackBase[vm_opStackOfs + 1] = savedVM->systemCall(args);
434 *ret = savedVM->systemCall(args);
428435 #else
429436 data[0] = ~vm_syscallNum;
430 vm_opStackBase[vm_opStackOfs + 1] = savedVM->systemCall((intptr_t *) data);
437 *ret = savedVM->systemCall((intptr_t *) data);
431438 #endif
432439 }
433440 else
4141 uniform mat4 u_ModelViewProjectionMatrix;
4242 uniform vec4 u_BaseColor;
4343 uniform vec4 u_VertColor;
44
45 #if defined(USE_DEFORM_VERTEXES) || defined(USE_RGBAGEN)
46 uniform vec3 u_FireRiseDir;
47 #endif
4448
4549 #if defined(USE_RGBAGEN)
4650 uniform int u_ColorGen;
4953 uniform vec3 u_DirectedLight;
5054 uniform vec3 u_ModelLightDir;
5155 uniform float u_PortalRange;
56 uniform float u_ZFadeLowest;
57 uniform float u_ZFadeHighest;
5258 #endif
5359
5460 #if defined(USE_VERTEX_ANIMATION)
6773 float frequency = u_DeformParams[3];
6874 float spread = u_DeformParams[4];
6975
76 // a negative frequency is for Z deformation based on normal
77 float zDeformScale = 0;
78 if (frequency < 0)
79 {
80 zDeformScale = 1;
81 frequency *= -1;
82
83 if (frequency > 999)
84 {
85 frequency -= 999;
86 zDeformScale = -1;
87 }
88 }
89
7090 if (u_DeformGen == DGEN_BULGE)
7191 {
7292 phase *= st.x;
102122 else // if (u_DeformGen == DGEN_BULGE)
103123 {
104124 func = sin(value);
125 }
126
127 if (zDeformScale != 0)
128 {
129 vec3 dir = u_FireRiseDir * (0.4 + 0.6 * u_FireRiseDir.z);
130 float nDot = dot(dir, normal);
131 float scale = base + func * amplitude;
132
133 if (nDot * scale > 0)
134 {
135 return pos + dir * nDot * scale * zDeformScale;
136 }
137
138 return pos;
105139 }
106140
107141 return pos + normal * (base + func * amplitude);
176210 else if (u_AlphaGen == AGEN_PORTAL)
177211 {
178212 color.a = clamp(length(viewer) / u_PortalRange, 0.0, 1.0);
213 }
214 else if (u_AlphaGen == AGEN_NORMALZFADE)
215 {
216 float nDot = dot(normal, u_FireRiseDir);
217 float halfRange = (u_ZFadeHighest - u_ZFadeLowest) / 2.0;
218
219 if (nDot < u_ZFadeHighest) {
220 if (nDot > u_ZFadeLowest) {
221 float frac;
222 if (nDot < u_ZFadeLowest + halfRange) {
223 frac = ( nDot - u_ZFadeLowest ) / halfRange;
224 } else {
225 frac = 1.0 - ( nDot - u_ZFadeLowest - halfRange ) / halfRange;
226 }
227 color.a *= clamp(frac, 0.0, 1.0);
228 } else {
229 color.a = 0;
230 }
231 } else {
232 color.a = 0;
233 }
179234 }
180235
181236 return color;
3030 #else
3131 # include <SDL_opengl.h>
3232 #endif
33
34 extern void ( APIENTRY * qglActiveTextureARB )( GLenum texture );
35 extern void ( APIENTRY * qglClientActiveTextureARB )( GLenum texture );
36 extern void ( APIENTRY * qglMultiTexCoord2fARB )( GLenum texture, GLfloat s, GLfloat t );
37
38 extern void ( APIENTRY * qglLockArraysEXT )( GLint, GLint );
39 extern void ( APIENTRY * qglUnlockArraysEXT )( void );
3340
3441 //===========================================================================
3542
7784 typedef void ( APIENTRY * PFNGLPNTRIANGLESFATIPROC )( GLenum pname, GLfloat param );
7885 #endif
7986
87 //----(SA) added
88 extern void ( APIENTRY * qglPNTrianglesiATI )( GLenum pname, GLint param );
89 extern void ( APIENTRY * qglPNTrianglesfATI )( GLenum pname, GLfloat param );
90 //----(SA) end
91
8092 // for NV fog distance
8193 #ifndef GL_NV_fog_distance
8294 #define GL_FOG_DISTANCE_MODE_NV 0x855A
101113 #define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
102114 #endif
103115
116
104117 // extensions will be function pointers on all platforms
105
106 extern void ( APIENTRY * qglMultiTexCoord2fARB )( GLenum texture, GLfloat s, GLfloat t );
107 extern void ( APIENTRY * qglActiveTextureARB )( GLenum texture );
108 extern void ( APIENTRY * qglClientActiveTextureARB )( GLenum texture );
109
110 extern void ( APIENTRY * qglLockArraysEXT )( GLint, GLint );
111 extern void ( APIENTRY * qglUnlockArraysEXT )( void );
112
113 //----(SA) added
114 extern void ( APIENTRY * qglPNTrianglesiATI )( GLenum pname, GLint param );
115 extern void ( APIENTRY * qglPNTrianglesfATI )( GLenum pname, GLfloat param );
116 //----(SA) end
117
118 // GL_EXT_draw_range_elements
119 extern void (APIENTRY * qglDrawRangeElementsEXT) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
120
121 // rend2
122
123 // GL_EXT_multi_draw_arrays
124 extern void (APIENTRY * qglMultiDrawArraysEXT) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount);
125 extern void (APIENTRY * qglMultiDrawElementsEXT) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount);
126
127 // GL_ARB_shading_language_100
128 #ifndef GL_ARB_shading_language_100
129 #define GL_ARB_shading_language_100
130 #define GL_SHADING_LANGUAGE_VERSION_ARB 0x8B8C
131 #endif
132
133 // GL_ARB_vertex_program
134 extern void (APIENTRY * qglVertexAttrib4fARB) (GLuint, GLfloat, GLfloat, GLfloat, GLfloat);
135 extern void (APIENTRY * qglVertexAttrib4fvARB) (GLuint, const GLfloat *);
136 extern void (APIENTRY * qglVertexAttribPointerARB) (GLuint index, GLint size, GLenum type, GLboolean normalized,
137 GLsizei stride, const GLvoid * pointer);
138 extern void (APIENTRY * qglEnableVertexAttribArrayARB) (GLuint index);
139 extern void (APIENTRY * qglDisableVertexAttribArrayARB) (GLuint index);
140
141 // GL_ARB_vertex_buffer_object
142 extern void (APIENTRY * qglBindBufferARB) (GLenum target, GLuint buffer);
143 extern void (APIENTRY * qglDeleteBuffersARB) (GLsizei n, const GLuint * buffers);
144 extern void (APIENTRY * qglGenBuffersARB) (GLsizei n, GLuint * buffers);
145 extern GLboolean(APIENTRY * qglIsBufferARB) (GLuint buffer);
146 extern void (APIENTRY * qglBufferDataARB) (GLenum target, GLsizeiptrARB size, const GLvoid * data, GLenum usage);
147 extern void (APIENTRY * qglBufferSubDataARB) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid * data);
148 extern void (APIENTRY * qglGetBufferSubDataARB) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid * data);
149 extern void (APIENTRY * qglGetBufferParameterivARB) (GLenum target, GLenum pname, GLint * params);
150 extern void (APIENTRY * qglGetBufferPointervARB) (GLenum target, GLenum pname, GLvoid * *params);
151
152 // GL_ARB_shader_objects
153 extern void (APIENTRY * qglDeleteObjectARB) (GLhandleARB obj);
154 extern GLhandleARB(APIENTRY * qglGetHandleARB) (GLenum pname);
155 extern void (APIENTRY * qglDetachObjectARB) (GLhandleARB containerObj, GLhandleARB attachedObj);
156 extern GLhandleARB(APIENTRY * qglCreateShaderObjectARB) (GLenum shaderType);
157 extern void (APIENTRY * qglShaderSourceARB) (GLhandleARB shaderObj, GLsizei count, const GLcharARB * *string,
158 const GLint * length);
159 extern void (APIENTRY * qglCompileShaderARB) (GLhandleARB shaderObj);
160 extern GLhandleARB(APIENTRY * qglCreateProgramObjectARB) (void);
161 extern void (APIENTRY * qglAttachObjectARB) (GLhandleARB containerObj, GLhandleARB obj);
162 extern void (APIENTRY * qglLinkProgramARB) (GLhandleARB programObj);
163 extern void (APIENTRY * qglUseProgramObjectARB) (GLhandleARB programObj);
164 extern void (APIENTRY * qglValidateProgramARB) (GLhandleARB programObj);
165 extern void (APIENTRY * qglUniform1fARB) (GLint location, GLfloat v0);
166 extern void (APIENTRY * qglUniform2fARB) (GLint location, GLfloat v0, GLfloat v1);
167 extern void (APIENTRY * qglUniform3fARB) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
168 extern void (APIENTRY * qglUniform4fARB) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
169 extern void (APIENTRY * qglUniform1iARB) (GLint location, GLint v0);
170 extern void (APIENTRY * qglUniform2iARB) (GLint location, GLint v0, GLint v1);
171 extern void (APIENTRY * qglUniform3iARB) (GLint location, GLint v0, GLint v1, GLint v2);
172 extern void (APIENTRY * qglUniform4iARB) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
173 extern void (APIENTRY * qglUniform1fvARB) (GLint location, GLsizei count, const GLfloat * value);
174 extern void (APIENTRY * qglUniform2fvARB) (GLint location, GLsizei count, const GLfloat * value);
175 extern void (APIENTRY * qglUniform3fvARB) (GLint location, GLsizei count, const GLfloat * value);
176 extern void (APIENTRY * qglUniform4fvARB) (GLint location, GLsizei count, const GLfloat * value);
177 extern void (APIENTRY * qglUniform2ivARB) (GLint location, GLsizei count, const GLint * value);
178 extern void (APIENTRY * qglUniform3ivARB) (GLint location, GLsizei count, const GLint * value);
179 extern void (APIENTRY * qglUniform4ivARB) (GLint location, GLsizei count, const GLint * value);
180 extern void (APIENTRY * qglUniformMatrix2fvARB) (GLint location, GLsizei count, GLboolean transpose, const GLfloat * value);
181 extern void (APIENTRY * qglUniformMatrix3fvARB) (GLint location, GLsizei count, GLboolean transpose, const GLfloat * value);
182 extern void (APIENTRY * qglUniformMatrix4fvARB) (GLint location, GLsizei count, GLboolean transpose, const GLfloat * value);
183 extern void (APIENTRY * qglGetObjectParameterfvARB) (GLhandleARB obj, GLenum pname, GLfloat * params);
184 extern void (APIENTRY * qglGetObjectParameterivARB) (GLhandleARB obj, GLenum pname, GLint * params);
185 extern void (APIENTRY * qglGetInfoLogARB) (GLhandleARB obj, GLsizei maxLength, GLsizei * length, GLcharARB * infoLog);
186 extern void (APIENTRY * qglGetAttachedObjectsARB) (GLhandleARB containerObj, GLsizei maxCount, GLsizei * count,
187 GLhandleARB * obj);
188 extern GLint(APIENTRY * qglGetUniformLocationARB) (GLhandleARB programObj, const GLcharARB * name);
189 extern void (APIENTRY * qglGetActiveUniformARB) (GLhandleARB programObj, GLuint index, GLsizei maxIndex, GLsizei * length,
190 GLint * size, GLenum * type, GLcharARB * name);
191 extern void (APIENTRY * qglGetUniformfvARB) (GLhandleARB programObj, GLint location, GLfloat * params);
192 extern void (APIENTRY * qglGetUniformivARB) (GLhandleARB programObj, GLint location, GLint * params);
193 extern void (APIENTRY * qglGetShaderSourceARB) (GLhandleARB obj, GLsizei maxLength, GLsizei * length, GLcharARB * source);
194
195 // GL_ARB_vertex_shader
196 extern void (APIENTRY * qglBindAttribLocationARB) (GLhandleARB programObj, GLuint index, const GLcharARB * name);
197 extern void (APIENTRY * qglGetActiveAttribARB) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei * length,
198 GLint * size, GLenum * type, GLcharARB * name);
199 extern GLint(APIENTRY * qglGetAttribLocationARB) (GLhandleARB programObj, const GLcharARB * name);
200
201 // GL_ARB_texture_compression
202 extern void (APIENTRY * qglCompressedTexImage3DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height,
203 GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);
204 extern void (APIENTRY * qglCompressedTexImage2DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height,
205 GLint border, GLsizei imageSize, const GLvoid *data);
206 extern void (APIENTRY * qglCompressedTexImage1DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border,
207 GLsizei imageSize, const GLvoid *data);
208 extern void (APIENTRY * qglCompressedTexSubImage3DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset,
209 GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);
210 extern void (APIENTRY * qglCompressedTexSubImage2DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width,
211 GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
212 extern void (APIENTRY * qglCompressedTexSubImage1DARB)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format,
213 GLsizei imageSize, const GLvoid *data);
214 extern void (APIENTRY * qglGetCompressedTexImageARB)(GLenum target, GLint lod,
215 GLvoid *img);
216
217 // GL_NVX_gpu_memory_info
218 #ifndef GL_NVX_gpu_memory_info
219 #define GL_NVX_gpu_memory_info
220 #define GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX 0x9047
221 #define GL_GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX 0x9048
222 #define GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX 0x9049
223 #define GL_GPU_MEMORY_INFO_EVICTION_COUNT_NVX 0x904A
224 #define GL_GPU_MEMORY_INFO_EVICTED_MEMORY_NVX 0x904B
225 #endif
226
227 // GL_ATI_meminfo
228 #ifndef GL_ATI_meminfo
229 #define GL_ATI_meminfo
230 #define GL_VBO_FREE_MEMORY_ATI 0x87FB
231 #define GL_TEXTURE_FREE_MEMORY_ATI 0x87FC
232 #define GL_RENDERBUFFER_FREE_MEMORY_ATI 0x87FD
233 #endif
234
235 // GL_ARB_texture_float
236 #ifndef GL_ARB_texture_float
237 #define GL_ARB_texture_float
238 #define GL_TEXTURE_RED_TYPE_ARB 0x8C10
239 #define GL_TEXTURE_GREEN_TYPE_ARB 0x8C11
240 #define GL_TEXTURE_BLUE_TYPE_ARB 0x8C12
241 #define GL_TEXTURE_ALPHA_TYPE_ARB 0x8C13
242 #define GL_TEXTURE_LUMINANCE_TYPE_ARB 0x8C14
243 #define GL_TEXTURE_INTENSITY_TYPE_ARB 0x8C15
244 #define GL_TEXTURE_DEPTH_TYPE_ARB 0x8C16
245 #define GL_UNSIGNED_NORMALIZED_ARB 0x8C17
246 #define GL_RGBA32F_ARB 0x8814
247 #define GL_RGB32F_ARB 0x8815
248 #define GL_ALPHA32F_ARB 0x8816
249 #define GL_INTENSITY32F_ARB 0x8817
250 #define GL_LUMINANCE32F_ARB 0x8818
251 #define GL_LUMINANCE_ALPHA32F_ARB 0x8819
252 #define GL_RGBA16F_ARB 0x881A
253 #define GL_RGB16F_ARB 0x881B
254 #define GL_ALPHA16F_ARB 0x881C
255 #define GL_INTENSITY16F_ARB 0x881D
256 #define GL_LUMINANCE16F_ARB 0x881E
257 #define GL_LUMINANCE_ALPHA16F_ARB 0x881F
258 #endif
259
260 #ifndef GL_ARB_half_float_pixel
261 #define GL_ARB_half_float_pixel
262 #define GL_HALF_FLOAT_ARB 0x140B
263 #endif
264
265 // GL_EXT_framebuffer_object
266 extern GLboolean (APIENTRY * qglIsRenderbufferEXT)(GLuint renderbuffer);
267 extern void (APIENTRY * qglBindRenderbufferEXT)(GLenum target, GLuint renderbuffer);
268 extern void (APIENTRY * qglDeleteRenderbuffersEXT)(GLsizei n, const GLuint *renderbuffers);
269 extern void (APIENTRY * qglGenRenderbuffersEXT)(GLsizei n, GLuint *renderbuffers);
270 extern void (APIENTRY * qglRenderbufferStorageEXT)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
271 extern void (APIENTRY * qglGetRenderbufferParameterivEXT)(GLenum target, GLenum pname, GLint *params);
272 extern GLboolean (APIENTRY * qglIsFramebufferEXT)(GLuint framebuffer);
273 extern void (APIENTRY * qglBindFramebufferEXT)(GLenum target, GLuint framebuffer);
274 extern void (APIENTRY * qglDeleteFramebuffersEXT)(GLsizei n, const GLuint *framebuffers);
275 extern void (APIENTRY * qglGenFramebuffersEXT)(GLsizei n, GLuint *framebuffers);
276 extern GLenum (APIENTRY * qglCheckFramebufferStatusEXT)(GLenum target);
277 extern void (APIENTRY * qglFramebufferTexture1DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture,
278 GLint level);
279 extern void (APIENTRY * qglFramebufferTexture2DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture,
280 GLint level);
281 extern void (APIENTRY * qglFramebufferTexture3DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture,
282 GLint level, GLint zoffset);
283 extern void (APIENTRY * qglFramebufferRenderbufferEXT)(GLenum target, GLenum attachment, GLenum renderbuffertarget,
284 GLuint renderbuffer);
285 extern void (APIENTRY * qglGetFramebufferAttachmentParameterivEXT)(GLenum target, GLenum attachment, GLenum pname, GLint *params);
286 extern void (APIENTRY * qglGenerateMipmapEXT)(GLenum target);
287
288 #ifndef GL_EXT_framebuffer_object
289 #define GL_EXT_framebuffer_object
290 #define GL_FRAMEBUFFER_EXT 0x8D40
291 #define GL_RENDERBUFFER_EXT 0x8D41
292 #define GL_STENCIL_INDEX1_EXT 0x8D46
293 #define GL_STENCIL_INDEX4_EXT 0x8D47
294 #define GL_STENCIL_INDEX8_EXT 0x8D48
295 #define GL_STENCIL_INDEX16_EXT 0x8D49
296 #define GL_RENDERBUFFER_WIDTH_EXT 0x8D42
297 #define GL_RENDERBUFFER_HEIGHT_EXT 0x8D43
298 #define GL_RENDERBUFFER_INTERNAL_FORMAT_EXT 0x8D44
299 #define GL_RENDERBUFFER_RED_SIZE_EXT 0x8D50
300 #define GL_RENDERBUFFER_GREEN_SIZE_EXT 0x8D51
301 #define GL_RENDERBUFFER_BLUE_SIZE_EXT 0x8D52
302 #define GL_RENDERBUFFER_ALPHA_SIZE_EXT 0x8D53
303 #define GL_RENDERBUFFER_DEPTH_SIZE_EXT 0x8D54
304 #define GL_RENDERBUFFER_STENCIL_SIZE_EXT 0x8D55
305 #define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT 0x8CD0
306 #define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT 0x8CD1
307 #define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT 0x8CD2
308 #define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT 0x8CD3
309 #define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT 0x8CD4
310 #define GL_COLOR_ATTACHMENT0_EXT 0x8CE0
311 #define GL_COLOR_ATTACHMENT1_EXT 0x8CE1
312 #define GL_COLOR_ATTACHMENT2_EXT 0x8CE2
313 #define GL_COLOR_ATTACHMENT3_EXT 0x8CE3
314 #define GL_COLOR_ATTACHMENT4_EXT 0x8CE4
315 #define GL_COLOR_ATTACHMENT5_EXT 0x8CE5
316 #define GL_COLOR_ATTACHMENT6_EXT 0x8CE6
317 #define GL_COLOR_ATTACHMENT7_EXT 0x8CE7
318 #define GL_COLOR_ATTACHMENT8_EXT 0x8CE8
319 #define GL_COLOR_ATTACHMENT9_EXT 0x8CE9
320 #define GL_COLOR_ATTACHMENT10_EXT 0x8CEA
321 #define GL_COLOR_ATTACHMENT11_EXT 0x8CEB
322 #define GL_COLOR_ATTACHMENT12_EXT 0x8CEC
323 #define GL_COLOR_ATTACHMENT13_EXT 0x8CED
324 #define GL_COLOR_ATTACHMENT14_EXT 0x8CEE
325 #define GL_COLOR_ATTACHMENT15_EXT 0x8CEF
326 #define GL_DEPTH_ATTACHMENT_EXT 0x8D00
327 #define GL_STENCIL_ATTACHMENT_EXT 0x8D20
328 #define GL_FRAMEBUFFER_COMPLETE_EXT 0x8CD5
329 #define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT 0x8CD6
330 #define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT 0x8CD7
331 #define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT 0x8CD9
332 #define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT 0x8CDA
333 #define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT 0x8CDB
334 #define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT 0x8CDC
335 #define GL_FRAMEBUFFER_UNSUPPORTED_EXT 0x8CDD
336 #define GL_FRAMEBUFFER_BINDING_EXT 0x8CA6
337 #define GL_RENDERBUFFER_BINDING_EXT 0x8CA7
338 #define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF
339 #define GL_MAX_RENDERBUFFER_SIZE_EXT 0x84E8
340 #define GL_INVALID_FRAMEBUFFER_OPERATION_EXT 0x0506
341 #endif
342
343 // GL_EXT_packed_depth_stencil
344 #ifndef GL_EXT_packed_depth_stencil
345 #define GL_EXT_packed_depth_stencil
346 #define GL_DEPTH_STENCIL_EXT 0x84F9
347 #define GL_UNSIGNED_INT_24_8_EXT 0x84FA
348 #define GL_DEPTH24_STENCIL8_EXT 0x88F0
349 #define GL_TEXTURE_STENCIL_SIZE_EXT 0x88F1
350 #endif
351
352 // GL_ARB_occlusion_query
353 extern void (APIENTRY * qglGenQueriesARB)(GLsizei n, GLuint *ids);
354 extern void (APIENTRY * qglDeleteQueriesARB)(GLsizei n, const GLuint *ids);
355 extern GLboolean (APIENTRY * qglIsQueryARB)(GLuint id);
356 extern void (APIENTRY * qglBeginQueryARB)(GLenum target, GLuint id);
357 extern void (APIENTRY * qglEndQueryARB)(GLenum target);
358 extern void (APIENTRY * qglGetQueryivARB)(GLenum target, GLenum pname, GLint *params);
359 extern void (APIENTRY * qglGetQueryObjectivARB)(GLuint id, GLenum pname, GLint *params);
360 extern void (APIENTRY * qglGetQueryObjectuivARB)(GLuint id, GLenum pname, GLuint *params);
361
362 #ifndef GL_ARB_occlusion_query
363 #define GL_ARB_occlusion_query
364 #define GL_SAMPLES_PASSED_ARB 0x8914
365 #define GL_QUERY_COUNTER_BITS_ARB 0x8864
366 #define GL_CURRENT_QUERY_ARB 0x8865
367 #define GL_QUERY_RESULT_ARB 0x8866
368 #define GL_QUERY_RESULT_AVAILABLE_ARB 0x8867
369 #endif
370
371 // GL_EXT_framebuffer_blit
372 extern void (APIENTRY * qglBlitFramebufferEXT)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
373 GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
374 GLbitfield mask, GLenum filter);
375
376 #ifndef GL_EXT_framebuffer_blit
377 #define GL_EXT_framebuffer_blit
378 #define GL_READ_FRAMEBUFFER_EXT 0x8CA8
379 #define GL_DRAW_FRAMEBUFFER_EXT 0x8CA9
380 #define GL_DRAW_FRAMEBUFFER_BINDING_EXT 0x8CA6
381 #define GL_READ_FRAMEBUFFER_BINDING_EXT 0x8CAA
382 #endif
383
384 // GL_EXT_framebuffer_multisample
385 extern void (APIENTRY * qglRenderbufferStorageMultisampleEXT)(GLenum target, GLsizei samples,
386 GLenum internalformat, GLsizei width, GLsizei height);
387
388 #ifndef GL_EXT_framebuffer_multisample
389 #define GL_EXT_framebuffer_multisample
390 #define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB
391 #define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56
392 #define GL_MAX_SAMPLES_EXT 0x8D57
393 #endif
394
395 #ifndef GL_EXT_texture_sRGB
396 #define GL_EXT_texture_sRGB
397 #define GL_SRGB_EXT 0x8C40
398 #define GL_SRGB8_EXT 0x8C41
399 #define GL_SRGB_ALPHA_EXT 0x8C42
400 #define GL_SRGB8_ALPHA8_EXT 0x8C43
401 #define GL_SLUMINANCE_ALPHA_EXT 0x8C44
402 #define GL_SLUMINANCE8_ALPHA8_EXT 0x8C45
403 #define GL_SLUMINANCE_EXT 0x8C46
404 #define GL_SLUMINANCE8_EXT 0x8C47
405 #define GL_COMPRESSED_SRGB_EXT 0x8C48
406 #define GL_COMPRESSED_SRGB_ALPHA_EXT 0x8C49
407 #define GL_COMPRESSED_SLUMINANCE_EXT 0x8C4A
408 #define GL_COMPRESSED_SLUMINANCE_ALPHA_EXT 0x8C4B
409 #define GL_COMPRESSED_SRGB_S3TC_DXT1_EXT 0x8C4C
410 #define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT 0x8C4D
411 #define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 0x8C4E
412 #define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F
413 #endif
414
415 #ifndef GL_EXT_framebuffer_sRGB
416 #define GL_EXT_framebuffer_sRGB
417 #define GL_FRAMEBUFFER_SRGB_EXT 0x8DB9
418 #endif
419
420 #ifndef GL_EXT_texture_compression_latc
421 #define GL_EXT_texture_compression_latc
422 #define GL_COMPRESSED_LUMINANCE_LATC1_EXT 0x8C70
423 #define GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT 0x8C71
424 #define GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT 0x8C72
425 #define GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT 0x8C73
426 #endif
427
428 #ifndef GL_ARB_texture_compression_bptc
429 #define GL_ARB_texture_compression_bptc
430 #define GL_COMPRESSED_RGBA_BPTC_UNORM_ARB 0x8E8C
431 #define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB 0x8E8D
432 #define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB 0x8E8E
433 #define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB 0x8E8F
434 #endif
435
436 // GL_ARB_draw_buffers
437 extern void (APIENTRY * qglDrawBuffersARB)(GLsizei n, const GLenum *bufs);
438 #ifndef GL_ARB_draw_buffers
439 #define GL_ARB_draw_buffers
440 #define GL_MAX_DRAW_BUFFERS_ARB 0x8824
441 #define GL_DRAW_BUFFER0_ARB 0x8825
442 #define GL_DRAW_BUFFER1_ARB 0x8826
443 #define GL_DRAW_BUFFER2_ARB 0x8827
444 #define GL_DRAW_BUFFER3_ARB 0x8828
445 #define GL_DRAW_BUFFER4_ARB 0x8829
446 #define GL_DRAW_BUFFER5_ARB 0x882A
447 #define GL_DRAW_BUFFER6_ARB 0x882B
448 #define GL_DRAW_BUFFER7_ARB 0x882C
449 #define GL_DRAW_BUFFER8_ARB 0x882D
450 #define GL_DRAW_BUFFER9_ARB 0x882E
451 #define GL_DRAW_BUFFER10_ARB 0x882F
452 #define GL_DRAW_BUFFER11_ARB 0x8830
453 #define GL_DRAW_BUFFER12_ARB 0x8831
454 #define GL_DRAW_BUFFER13_ARB 0x8832
455 #define GL_DRAW_BUFFER14_ARB 0x8833
456 #define GL_DRAW_BUFFER15_ARB 0x8834
457 #endif
458
459 #ifndef GL_ARB_depth_clamp
460 #define GL_ARB_depth_clamp
461 #define GL_DEPTH_CLAMP 0x864F
462 #endif
463
464 #ifndef GL_ARB_seamless_cube_map
465 #define GL_ARB_seamless_cube_map
466 #define GL_TEXTURE_CUBE_MAP_SEAMLESS 0x884F
467 #endif
468
469 // GL_ARB_vertex_array_object
470 extern void (APIENTRY * qglBindVertexArrayARB)(GLuint array);
471 extern void (APIENTRY * qglDeleteVertexArraysARB)(GLsizei n, const GLuint *arrays);
472 extern void (APIENTRY * qglGenVertexArraysARB)(GLsizei n, GLuint *arrays);
473 extern GLboolean (APIENTRY * qglIsVertexArrayARB)(GLuint array);
474 #ifndef GL_ARB_vertex_array_object
475 #define GL_ARB_vertex_array_object
476 #define GL_VERTEX_ARRAY_BINDING_ARB 0x85B5
477 #endif
478
479 #if defined(WIN32)
480 // WGL_ARB_create_context
481 #ifndef WGL_ARB_create_context
482 #define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091
483 #define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092
484 #define WGL_CONTEXT_LAYER_PLANE_ARB 0x2093
485 #define WGL_CONTEXT_FLAGS_ARB 0x2094
486 #define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126
487 #define WGL_CONTEXT_DEBUG_BIT_ARB 0x0001
488 #define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002
489 #define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
490 #define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002
491 #define ERROR_INVALID_VERSION_ARB 0x2095
492 #define ERROR_INVALID_PROFILE_ARB 0x2096
493 #endif
494
495 extern HGLRC(APIENTRY * qwglCreateContextAttribsARB) (HDC hdC, HGLRC hShareContext, const int *attribList);
496 #endif
497
498 #if 0 //defined(__linux__)
499 // GLX_ARB_create_context
500 #ifndef GLX_ARB_create_context
501 #define GLX_CONTEXT_DEBUG_BIT_ARB 0x00000001
502 #define GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002
503 #define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091
504 #define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092
505 #define GLX_CONTEXT_FLAGS_ARB 0x2094
506 #endif
507
508 extern GLXContext (APIENTRY * qglXCreateContextAttribsARB) (Display *dpy, GLXFBConfig config, GLXContext share_context, Bool direct, const int *attrib_list);
509 #endif
510
511118 //===========================================================================
512119
513120 #define qglAccum glAccum
845452 #define qglVertexPointer glVertexPointer
846453 #define qglViewport glViewport
847454
848 #endif
455 // GL_EXT_draw_range_elements
456 extern void (APIENTRY * qglDrawRangeElementsEXT) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
457
458 // GL_EXT_multi_draw_arrays
459 extern void (APIENTRY * qglMultiDrawArraysEXT) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount);
460 extern void (APIENTRY * qglMultiDrawElementsEXT) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount);
461
462 // rend2
463
464 // GL_ARB_shading_language_100
465 #ifndef GL_ARB_shading_language_100
466 #define GL_ARB_shading_language_100
467 #define GL_SHADING_LANGUAGE_VERSION_ARB 0x8B8C
468 #endif
469
470 // GL_ARB_vertex_program
471 extern void (APIENTRY * qglVertexAttrib4fARB) (GLuint, GLfloat, GLfloat, GLfloat, GLfloat);
472 extern void (APIENTRY * qglVertexAttrib4fvARB) (GLuint, const GLfloat *);
473 extern void (APIENTRY * qglVertexAttribPointerARB) (GLuint index, GLint size, GLenum type, GLboolean normalized,
474 GLsizei stride, const GLvoid * pointer);
475 extern void (APIENTRY * qglEnableVertexAttribArrayARB) (GLuint index);
476 extern void (APIENTRY * qglDisableVertexAttribArrayARB) (GLuint index);
477
478 // GL_ARB_vertex_buffer_object
479 extern void (APIENTRY * qglBindBufferARB) (GLenum target, GLuint buffer);
480 extern void (APIENTRY * qglDeleteBuffersARB) (GLsizei n, const GLuint * buffers);
481 extern void (APIENTRY * qglGenBuffersARB) (GLsizei n, GLuint * buffers);
482 extern GLboolean(APIENTRY * qglIsBufferARB) (GLuint buffer);
483 extern void (APIENTRY * qglBufferDataARB) (GLenum target, GLsizeiptrARB size, const GLvoid * data, GLenum usage);
484 extern void (APIENTRY * qglBufferSubDataARB) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid * data);
485 extern void (APIENTRY * qglGetBufferSubDataARB) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid * data);
486 extern void (APIENTRY * qglGetBufferParameterivARB) (GLenum target, GLenum pname, GLint * params);
487 extern void (APIENTRY * qglGetBufferPointervARB) (GLenum target, GLenum pname, GLvoid * *params);
488
489 // GL_ARB_shader_objects
490 extern void (APIENTRY * qglDeleteObjectARB) (GLhandleARB obj);
491 extern GLhandleARB(APIENTRY * qglGetHandleARB) (GLenum pname);
492 extern void (APIENTRY * qglDetachObjectARB) (GLhandleARB containerObj, GLhandleARB attachedObj);
493 extern GLhandleARB(APIENTRY * qglCreateShaderObjectARB) (GLenum shaderType);
494 extern void (APIENTRY * qglShaderSourceARB) (GLhandleARB shaderObj, GLsizei count, const GLcharARB * *string,
495 const GLint * length);
496 extern void (APIENTRY * qglCompileShaderARB) (GLhandleARB shaderObj);
497 extern GLhandleARB(APIENTRY * qglCreateProgramObjectARB) (void);
498 extern void (APIENTRY * qglAttachObjectARB) (GLhandleARB containerObj, GLhandleARB obj);
499 extern void (APIENTRY * qglLinkProgramARB) (GLhandleARB programObj);
500 extern void (APIENTRY * qglUseProgramObjectARB) (GLhandleARB programObj);
501 extern void (APIENTRY * qglValidateProgramARB) (GLhandleARB programObj);
502 extern void (APIENTRY * qglUniform1fARB) (GLint location, GLfloat v0);
503 extern void (APIENTRY * qglUniform2fARB) (GLint location, GLfloat v0, GLfloat v1);
504 extern void (APIENTRY * qglUniform3fARB) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
505 extern void (APIENTRY * qglUniform4fARB) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
506 extern void (APIENTRY * qglUniform1iARB) (GLint location, GLint v0);
507 extern void (APIENTRY * qglUniform2iARB) (GLint location, GLint v0, GLint v1);
508 extern void (APIENTRY * qglUniform3iARB) (GLint location, GLint v0, GLint v1, GLint v2);
509 extern void (APIENTRY * qglUniform4iARB) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
510 extern void (APIENTRY * qglUniform1fvARB) (GLint location, GLsizei count, const GLfloat * value);
511 extern void (APIENTRY * qglUniform2fvARB) (GLint location, GLsizei count, const GLfloat * value);
512 extern void (APIENTRY * qglUniform3fvARB) (GLint location, GLsizei count, const GLfloat * value);
513 extern void (APIENTRY * qglUniform4fvARB) (GLint location, GLsizei count, const GLfloat * value);
514 extern void (APIENTRY * qglUniform2ivARB) (GLint location, GLsizei count, const GLint * value);
515 extern void (APIENTRY * qglUniform3ivARB) (GLint location, GLsizei count, const GLint * value);
516 extern void (APIENTRY * qglUniform4ivARB) (GLint location, GLsizei count, const GLint * value);
517 extern void (APIENTRY * qglUniformMatrix2fvARB) (GLint location, GLsizei count, GLboolean transpose, const GLfloat * value);
518 extern void (APIENTRY * qglUniformMatrix3fvARB) (GLint location, GLsizei count, GLboolean transpose, const GLfloat * value);
519 extern void (APIENTRY * qglUniformMatrix4fvARB) (GLint location, GLsizei count, GLboolean transpose, const GLfloat * value);
520 extern void (APIENTRY * qglGetObjectParameterfvARB) (GLhandleARB obj, GLenum pname, GLfloat * params);
521 extern void (APIENTRY * qglGetObjectParameterivARB) (GLhandleARB obj, GLenum pname, GLint * params);
522 extern void (APIENTRY * qglGetInfoLogARB) (GLhandleARB obj, GLsizei maxLength, GLsizei * length, GLcharARB * infoLog);
523 extern void (APIENTRY * qglGetAttachedObjectsARB) (GLhandleARB containerObj, GLsizei maxCount, GLsizei * count,
524 GLhandleARB * obj);
525 extern GLint(APIENTRY * qglGetUniformLocationARB) (GLhandleARB programObj, const GLcharARB * name);
526 extern void (APIENTRY * qglGetActiveUniformARB) (GLhandleARB programObj, GLuint index, GLsizei maxIndex, GLsizei * length,
527 GLint * size, GLenum * type, GLcharARB * name);
528 extern void (APIENTRY * qglGetUniformfvARB) (GLhandleARB programObj, GLint location, GLfloat * params);
529 extern void (APIENTRY * qglGetUniformivARB) (GLhandleARB programObj, GLint location, GLint * params);
530 extern void (APIENTRY * qglGetShaderSourceARB) (GLhandleARB obj, GLsizei maxLength, GLsizei * length, GLcharARB * source);
531
532 // GL_ARB_vertex_shader
533 extern void (APIENTRY * qglBindAttribLocationARB) (GLhandleARB programObj, GLuint index, const GLcharARB * name);
534 extern void (APIENTRY * qglGetActiveAttribARB) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei * length,
535 GLint * size, GLenum * type, GLcharARB * name);
536 extern GLint(APIENTRY * qglGetAttribLocationARB) (GLhandleARB programObj, const GLcharARB * name);
537
538 // GL_ARB_texture_compression
539 extern void (APIENTRY * qglCompressedTexImage3DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height,
540 GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);
541 extern void (APIENTRY * qglCompressedTexImage2DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height,
542 GLint border, GLsizei imageSize, const GLvoid *data);
543 extern void (APIENTRY * qglCompressedTexImage1DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border,
544 GLsizei imageSize, const GLvoid *data);
545 extern void (APIENTRY * qglCompressedTexSubImage3DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset,
546 GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);
547 extern void (APIENTRY * qglCompressedTexSubImage2DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width,
548 GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
549 extern void (APIENTRY * qglCompressedTexSubImage1DARB)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format,
550 GLsizei imageSize, const GLvoid *data);
551 extern void (APIENTRY * qglGetCompressedTexImageARB)(GLenum target, GLint lod,
552 GLvoid *img);
553
554 // GL_NVX_gpu_memory_info
555 #ifndef GL_NVX_gpu_memory_info
556 #define GL_NVX_gpu_memory_info
557 #define GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX 0x9047
558 #define GL_GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX 0x9048
559 #define GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX 0x9049
560 #define GL_GPU_MEMORY_INFO_EVICTION_COUNT_NVX 0x904A
561 #define GL_GPU_MEMORY_INFO_EVICTED_MEMORY_NVX 0x904B
562 #endif
563
564 // GL_ATI_meminfo
565 #ifndef GL_ATI_meminfo
566 #define GL_ATI_meminfo
567 #define GL_VBO_FREE_MEMORY_ATI 0x87FB
568 #define GL_TEXTURE_FREE_MEMORY_ATI 0x87FC
569 #define GL_RENDERBUFFER_FREE_MEMORY_ATI 0x87FD
570 #endif
571
572 // GL_ARB_texture_float
573 #ifndef GL_ARB_texture_float
574 #define GL_ARB_texture_float
575 #define GL_TEXTURE_RED_TYPE_ARB 0x8C10
576 #define GL_TEXTURE_GREEN_TYPE_ARB 0x8C11
577 #define GL_TEXTURE_BLUE_TYPE_ARB 0x8C12
578 #define GL_TEXTURE_ALPHA_TYPE_ARB 0x8C13
579 #define GL_TEXTURE_LUMINANCE_TYPE_ARB 0x8C14
580 #define GL_TEXTURE_INTENSITY_TYPE_ARB 0x8C15
581 #define GL_TEXTURE_DEPTH_TYPE_ARB 0x8C16
582 #define GL_UNSIGNED_NORMALIZED_ARB 0x8C17
583 #define GL_RGBA32F_ARB 0x8814
584 #define GL_RGB32F_ARB 0x8815
585 #define GL_ALPHA32F_ARB 0x8816
586 #define GL_INTENSITY32F_ARB 0x8817
587 #define GL_LUMINANCE32F_ARB 0x8818
588 #define GL_LUMINANCE_ALPHA32F_ARB 0x8819
589 #define GL_RGBA16F_ARB 0x881A
590 #define GL_RGB16F_ARB 0x881B
591 #define GL_ALPHA16F_ARB 0x881C
592 #define GL_INTENSITY16F_ARB 0x881D
593 #define GL_LUMINANCE16F_ARB 0x881E
594 #define GL_LUMINANCE_ALPHA16F_ARB 0x881F
595 #endif
596
597 #ifndef GL_ARB_half_float_pixel
598 #define GL_ARB_half_float_pixel
599 #define GL_HALF_FLOAT_ARB 0x140B
600 #endif
601
602 // GL_EXT_framebuffer_object
603 extern GLboolean (APIENTRY * qglIsRenderbufferEXT)(GLuint renderbuffer);
604 extern void (APIENTRY * qglBindRenderbufferEXT)(GLenum target, GLuint renderbuffer);
605 extern void (APIENTRY * qglDeleteRenderbuffersEXT)(GLsizei n, const GLuint *renderbuffers);
606 extern void (APIENTRY * qglGenRenderbuffersEXT)(GLsizei n, GLuint *renderbuffers);
607 extern void (APIENTRY * qglRenderbufferStorageEXT)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
608 extern void (APIENTRY * qglGetRenderbufferParameterivEXT)(GLenum target, GLenum pname, GLint *params);
609 extern GLboolean (APIENTRY * qglIsFramebufferEXT)(GLuint framebuffer);
610 extern void (APIENTRY * qglBindFramebufferEXT)(GLenum target, GLuint framebuffer);
611 extern void (APIENTRY * qglDeleteFramebuffersEXT)(GLsizei n, const GLuint *framebuffers);
612 extern void (APIENTRY * qglGenFramebuffersEXT)(GLsizei n, GLuint *framebuffers);
613 extern GLenum (APIENTRY * qglCheckFramebufferStatusEXT)(GLenum target);
614 extern void (APIENTRY * qglFramebufferTexture1DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture,
615 GLint level);
616 extern void (APIENTRY * qglFramebufferTexture2DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture,
617 GLint level);
618 extern void (APIENTRY * qglFramebufferTexture3DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture,
619 GLint level, GLint zoffset);
620 extern void (APIENTRY * qglFramebufferRenderbufferEXT)(GLenum target, GLenum attachment, GLenum renderbuffertarget,
621 GLuint renderbuffer);
622 extern void (APIENTRY * qglGetFramebufferAttachmentParameterivEXT)(GLenum target, GLenum attachment, GLenum pname, GLint *params);
623 extern void (APIENTRY * qglGenerateMipmapEXT)(GLenum target);
624
625 #ifndef GL_EXT_framebuffer_object
626 #define GL_EXT_framebuffer_object
627 #define GL_FRAMEBUFFER_EXT 0x8D40
628 #define GL_RENDERBUFFER_EXT 0x8D41
629 #define GL_STENCIL_INDEX1_EXT 0x8D46
630 #define GL_STENCIL_INDEX4_EXT 0x8D47
631 #define GL_STENCIL_INDEX8_EXT 0x8D48
632 #define GL_STENCIL_INDEX16_EXT 0x8D49
633 #define GL_RENDERBUFFER_WIDTH_EXT 0x8D42
634 #define GL_RENDERBUFFER_HEIGHT_EXT 0x8D43
635 #define GL_RENDERBUFFER_INTERNAL_FORMAT_EXT 0x8D44
636 #define GL_RENDERBUFFER_RED_SIZE_EXT 0x8D50
637 #define GL_RENDERBUFFER_GREEN_SIZE_EXT 0x8D51
638 #define GL_RENDERBUFFER_BLUE_SIZE_EXT 0x8D52
639 #define GL_RENDERBUFFER_ALPHA_SIZE_EXT 0x8D53
640 #define GL_RENDERBUFFER_DEPTH_SIZE_EXT 0x8D54
641 #define GL_RENDERBUFFER_STENCIL_SIZE_EXT 0x8D55
642 #define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT 0x8CD0
643 #define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT 0x8CD1
644 #define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT 0x8CD2
645 #define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT 0x8CD3
646 #define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT 0x8CD4
647 #define GL_COLOR_ATTACHMENT0_EXT 0x8CE0
648 #define GL_COLOR_ATTACHMENT1_EXT 0x8CE1
649 #define GL_COLOR_ATTACHMENT2_EXT 0x8CE2
650 #define GL_COLOR_ATTACHMENT3_EXT 0x8CE3
651 #define GL_COLOR_ATTACHMENT4_EXT 0x8CE4
652 #define GL_COLOR_ATTACHMENT5_EXT 0x8CE5
653 #define GL_COLOR_ATTACHMENT6_EXT 0x8CE6
654 #define GL_COLOR_ATTACHMENT7_EXT 0x8CE7
655 #define GL_COLOR_ATTACHMENT8_EXT 0x8CE8
656 #define GL_COLOR_ATTACHMENT9_EXT 0x8CE9
657 #define GL_COLOR_ATTACHMENT10_EXT 0x8CEA
658 #define GL_COLOR_ATTACHMENT11_EXT 0x8CEB
659 #define GL_COLOR_ATTACHMENT12_EXT 0x8CEC
660 #define GL_COLOR_ATTACHMENT13_EXT 0x8CED
661 #define GL_COLOR_ATTACHMENT14_EXT 0x8CEE
662 #define GL_COLOR_ATTACHMENT15_EXT 0x8CEF
663 #define GL_DEPTH_ATTACHMENT_EXT 0x8D00
664 #define GL_STENCIL_ATTACHMENT_EXT 0x8D20
665 #define GL_FRAMEBUFFER_COMPLETE_EXT 0x8CD5
666 #define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT 0x8CD6
667 #define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT 0x8CD7
668 #define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT 0x8CD9
669 #define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT 0x8CDA
670 #define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT 0x8CDB
671 #define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT 0x8CDC
672 #define GL_FRAMEBUFFER_UNSUPPORTED_EXT 0x8CDD
673 #define GL_FRAMEBUFFER_BINDING_EXT 0x8CA6
674 #define GL_RENDERBUFFER_BINDING_EXT 0x8CA7
675 #define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF
676 #define GL_MAX_RENDERBUFFER_SIZE_EXT 0x84E8
677 #define GL_INVALID_FRAMEBUFFER_OPERATION_EXT 0x0506
678 #endif
679
680 // GL_EXT_packed_depth_stencil
681 #ifndef GL_EXT_packed_depth_stencil
682 #define GL_EXT_packed_depth_stencil
683 #define GL_DEPTH_STENCIL_EXT 0x84F9
684 #define GL_UNSIGNED_INT_24_8_EXT 0x84FA
685 #define GL_DEPTH24_STENCIL8_EXT 0x88F0
686 #define GL_TEXTURE_STENCIL_SIZE_EXT 0x88F1
687 #endif
688
689 // GL_ARB_occlusion_query
690 extern void (APIENTRY * qglGenQueriesARB)(GLsizei n, GLuint *ids);
691 extern void (APIENTRY * qglDeleteQueriesARB)(GLsizei n, const GLuint *ids);
692 extern GLboolean (APIENTRY * qglIsQueryARB)(GLuint id);
693 extern void (APIENTRY * qglBeginQueryARB)(GLenum target, GLuint id);
694 extern void (APIENTRY * qglEndQueryARB)(GLenum target);
695 extern void (APIENTRY * qglGetQueryivARB)(GLenum target, GLenum pname, GLint *params);
696 extern void (APIENTRY * qglGetQueryObjectivARB)(GLuint id, GLenum pname, GLint *params);
697 extern void (APIENTRY * qglGetQueryObjectuivARB)(GLuint id, GLenum pname, GLuint *params);
698
699 #ifndef GL_ARB_occlusion_query
700 #define GL_ARB_occlusion_query
701 #define GL_SAMPLES_PASSED_ARB 0x8914
702 #define GL_QUERY_COUNTER_BITS_ARB 0x8864
703 #define GL_CURRENT_QUERY_ARB 0x8865
704 #define GL_QUERY_RESULT_ARB 0x8866
705 #define GL_QUERY_RESULT_AVAILABLE_ARB 0x8867
706 #endif
707
708 // GL_EXT_framebuffer_blit
709 extern void (APIENTRY * qglBlitFramebufferEXT)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
710 GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
711 GLbitfield mask, GLenum filter);
712
713 #ifndef GL_EXT_framebuffer_blit
714 #define GL_EXT_framebuffer_blit
715 #define GL_READ_FRAMEBUFFER_EXT 0x8CA8
716 #define GL_DRAW_FRAMEBUFFER_EXT 0x8CA9
717 #define GL_DRAW_FRAMEBUFFER_BINDING_EXT 0x8CA6
718 #define GL_READ_FRAMEBUFFER_BINDING_EXT 0x8CAA
719 #endif
720
721 // GL_EXT_framebuffer_multisample
722 extern void (APIENTRY * qglRenderbufferStorageMultisampleEXT)(GLenum target, GLsizei samples,
723 GLenum internalformat, GLsizei width, GLsizei height);
724
725 #ifndef GL_EXT_framebuffer_multisample
726 #define GL_EXT_framebuffer_multisample
727 #define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB
728 #define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56
729 #define GL_MAX_SAMPLES_EXT 0x8D57
730 #endif
731
732 #ifndef GL_EXT_texture_sRGB
733 #define GL_EXT_texture_sRGB
734 #define GL_SRGB_EXT 0x8C40
735 #define GL_SRGB8_EXT 0x8C41
736 #define GL_SRGB_ALPHA_EXT 0x8C42
737 #define GL_SRGB8_ALPHA8_EXT 0x8C43
738 #define GL_SLUMINANCE_ALPHA_EXT 0x8C44
739 #define GL_SLUMINANCE8_ALPHA8_EXT 0x8C45
740 #define GL_SLUMINANCE_EXT 0x8C46
741 #define GL_SLUMINANCE8_EXT 0x8C47
742 #define GL_COMPRESSED_SRGB_EXT 0x8C48
743 #define GL_COMPRESSED_SRGB_ALPHA_EXT 0x8C49
744 #define GL_COMPRESSED_SLUMINANCE_EXT 0x8C4A
745 #define GL_COMPRESSED_SLUMINANCE_ALPHA_EXT 0x8C4B
746 #define GL_COMPRESSED_SRGB_S3TC_DXT1_EXT 0x8C4C
747 #define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT 0x8C4D
748 #define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 0x8C4E
749 #define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F
750 #endif
751
752 #ifndef GL_EXT_framebuffer_sRGB
753 #define GL_EXT_framebuffer_sRGB
754 #define GL_FRAMEBUFFER_SRGB_EXT 0x8DB9
755 #endif
756
757 #ifndef GL_EXT_texture_compression_latc
758 #define GL_EXT_texture_compression_latc
759 #define GL_COMPRESSED_LUMINANCE_LATC1_EXT 0x8C70
760 #define GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT 0x8C71
761 #define GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT 0x8C72
762 #define GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT 0x8C73
763 #endif
764
765 #ifndef GL_ARB_texture_compression_bptc
766 #define GL_ARB_texture_compression_bptc
767 #define GL_COMPRESSED_RGBA_BPTC_UNORM_ARB 0x8E8C
768 #define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB 0x8E8D
769 #define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB 0x8E8E
770 #define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB 0x8E8F
771 #endif
772
773 // GL_ARB_draw_buffers
774 extern void (APIENTRY * qglDrawBuffersARB)(GLsizei n, const GLenum *bufs);
775 #ifndef GL_ARB_draw_buffers
776 #define GL_ARB_draw_buffers
777 #define GL_MAX_DRAW_BUFFERS_ARB 0x8824
778 #define GL_DRAW_BUFFER0_ARB 0x8825
779 #define GL_DRAW_BUFFER1_ARB 0x8826
780 #define GL_DRAW_BUFFER2_ARB 0x8827
781 #define GL_DRAW_BUFFER3_ARB 0x8828
782 #define GL_DRAW_BUFFER4_ARB 0x8829
783 #define GL_DRAW_BUFFER5_ARB 0x882A
784 #define GL_DRAW_BUFFER6_ARB 0x882B
785 #define GL_DRAW_BUFFER7_ARB 0x882C
786 #define GL_DRAW_BUFFER8_ARB 0x882D
787 #define GL_DRAW_BUFFER9_ARB 0x882E
788 #define GL_DRAW_BUFFER10_ARB 0x882F
789 #define GL_DRAW_BUFFER11_ARB 0x8830
790 #define GL_DRAW_BUFFER12_ARB 0x8831
791 #define GL_DRAW_BUFFER13_ARB 0x8832
792 #define GL_DRAW_BUFFER14_ARB 0x8833
793 #define GL_DRAW_BUFFER15_ARB 0x8834
794 #endif
795
796 #ifndef GL_ARB_depth_clamp
797 #define GL_ARB_depth_clamp
798 #define GL_DEPTH_CLAMP 0x864F
799 #endif
800
801 #ifndef GL_ARB_seamless_cube_map
802 #define GL_ARB_seamless_cube_map
803 #define GL_TEXTURE_CUBE_MAP_SEAMLESS 0x884F
804 #endif
805
806 // GL_ARB_vertex_array_object
807 extern void (APIENTRY * qglBindVertexArrayARB)(GLuint array);
808 extern void (APIENTRY * qglDeleteVertexArraysARB)(GLsizei n, const GLuint *arrays);
809 extern void (APIENTRY * qglGenVertexArraysARB)(GLsizei n, GLuint *arrays);
810 extern GLboolean (APIENTRY * qglIsVertexArrayARB)(GLuint array);
811 #ifndef GL_ARB_vertex_array_object
812 #define GL_ARB_vertex_array_object
813 #define GL_VERTEX_ARRAY_BINDING_ARB 0x85B5
814 #endif
815
816 #if defined(WIN32)
817 // WGL_ARB_create_context
818 #ifndef WGL_ARB_create_context
819 #define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091
820 #define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092
821 #define WGL_CONTEXT_LAYER_PLANE_ARB 0x2093
822 #define WGL_CONTEXT_FLAGS_ARB 0x2094
823 #define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126
824 #define WGL_CONTEXT_DEBUG_BIT_ARB 0x0001
825 #define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002
826 #define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
827 #define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002
828 #define ERROR_INVALID_VERSION_ARB 0x2095
829 #define ERROR_INVALID_PROFILE_ARB 0x2096
830 #endif
831
832 extern HGLRC(APIENTRY * qwglCreateContextAttribsARB) (HDC hdC, HGLRC hShareContext, const int *attribList);
833 #endif
834
835 #if 0 //defined(__linux__)
836 // GLX_ARB_create_context
837 #ifndef GLX_ARB_create_context
838 #define GLX_CONTEXT_DEBUG_BIT_ARB 0x00000001
839 #define GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002
840 #define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091
841 #define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092
842 #define GLX_CONTEXT_FLAGS_ARB 0x2094
843 #endif
844
845 extern GLXContext (APIENTRY * qglXCreateContextAttribsARB) (Display *dpy, GLXFBConfig config, GLXContext share_context, Bool direct, const int *attrib_list);
846 #endif
847
848 #endif // __QGL_H__
849
10921092 render_count = surface->numVerts;
10931093 }
10941094
1095 RB_CheckOverflow( render_count, surface->numTriangles );
1096
10971095 //DBG_SHOWTIME
10981096
10991097 //
11001098 // setup triangle list
11011099 //
1102 RB_CheckOverflow( surface->numVerts, surface->numTriangles * 3 );
1100 RB_CHECKOVERFLOW( render_count, surface->numTriangles * 3 );
11031101
11041102 //DBG_SHOWTIME
11051103
16891687 oldFrame = (mdrFrame_t *)((byte *)header + header->ofsFrames +
16901688 backEnd.currentEntity->e.oldframe * frameSize );
16911689
1692 RB_CheckOverflow( surface->numVerts, surface->numTriangles * 3 );
1690 RB_CHECKOVERFLOW( surface->numVerts, surface->numTriangles * 3 );
16931691
16941692 triangles = (int *) ((byte *)surface + surface->ofsTriangles);
16951693 indexes = surface->numTriangles * 3;
224224
225225 f32.f = in;
226226
227 f16.pack.exponent = CLAMP(f32.pack.exponent - 112, 0, 31);
227 f16.pack.exponent = CLAMP((int)(f32.pack.exponent) - 112, 0, 31);
228228 f16.pack.fraction = f32.pack.fraction >> 13;
229229 f16.pack.sign = f32.pack.sign;
230230
4646 // an error occured
4747 switch (code)
4848 {
49 case GL_FRAMEBUFFER_COMPLETE_EXT:
50 break;
51
5249 case GL_FRAMEBUFFER_UNSUPPORTED_EXT:
5350 ri.Printf(PRINT_WARNING, "R_CheckFBO: (%s) Unsupported framebuffer format\n", fbo->name);
5451 break;
9999
100100 #ifdef BUILD_FREETYPE
101101 void R_GetGlyphInfo( FT_GlyphSlot glyph, int *left, int *right, int *width, int *top, int *bottom, int *height, int *pitch ) {
102
103102 *left = _FLOOR( glyph->metrics.horiBearingX );
104103 *right = _CEIL( glyph->metrics.horiBearingX + glyph->metrics.width );
105104 *width = _TRUNC( *right - *left );
112111
113112
114113 FT_Bitmap *R_RenderGlyph( FT_GlyphSlot glyph, glyphInfo_t* glyphOut ) {
115
116114 FT_Bitmap *bit2;
117115 int left, right, width, top, bottom, height, pitch, size;
118116
167165
168166 // swap rgb to bgr
169167 c = 18 + width * height * 4;
170 for (i=18 ; i<c ; i+=4)
168 for ( i = 18 ; i < c ; i += 4 )
171169 {
172 buffer[i] = data[i-18+2]; // blue
173 buffer[i+1] = data[i-18+1]; // green
174 buffer[i+2] = data[i-18+0]; // red
175 buffer[i+3] = data[i-18+3]; // alpha
170 buffer[i] = data[i - 18 + 2]; // blue
171 buffer[i + 1] = data[i - 18 + 1]; // green
172 buffer[i + 2] = data[i - 18 + 0]; // red
173 buffer[i + 3] = data[i - 18 + 3]; // alpha
176174 }
177175
178176 // flip upside down
194192 //fwrite (buffer, 1, c, f);
195193 //fclose (f);
196194
197 ri.Free (buffer);
195 ri.Free( buffer );
198196 }
199197
200198 static glyphInfo_t *RE_ConstructGlyphInfo( unsigned char *imageOut, int *xOut, int *yOut, int *maxHeight, FT_Face face, const unsigned char c, qboolean calcHeight ) {
246244 if (*yOut + *maxHeight + 1 >= 255) {
247245 *yOut = -1;
248246 *xOut = -1;
249 ri.Free(bitmap->buffer);
250 ri.Free(bitmap);
247 ri.Free( bitmap->buffer );
248 ri.Free( bitmap );
251249 return &glyph;
252250 }
253251
278276
279277 src += glyph.pitch;
280278 dst += 256;
281
282279 }
283280 } else {
284281 for ( i = 0; i < glyph.height; i++ ) {
285 memcpy( dst, src, glyph.pitch );
282 Com_Memcpy( dst, src, glyph.pitch );
286283 src += glyph.pitch;
287284 dst += 256;
288285 }
309306 #endif
310307
311308 static int fdOffset;
312 static byte *fdFile;
309 static byte *fdFile;
313310
314311 int readInt( void ) {
315312 int i = fdFile[fdOffset] + ( fdFile[fdOffset + 1] << 8 ) + ( fdFile[fdOffset + 2] << 16 ) + ( fdFile[fdOffset + 3] << 24 );
318315 }
319316
320317 typedef union {
321 byte fred[4];
322 float ffred;
318 byte fred[4];
319 float ffred;
323320 } poor;
324321
325322 float readFloat( void ) {
375372 Com_sprintf( name, sizeof( name ), "fonts/fontImage_%i.dat",pointSize );
376373 for ( i = 0; i < registeredFontCount; i++ ) {
377374 if ( Q_stricmp( name, registeredFont[i].name ) == 0 ) {
378 memcpy( font, &registeredFont[i], sizeof( fontInfo_t ) );
375 Com_Memcpy( font, &registeredFont[i], sizeof( fontInfo_t ) );
379376 return;
380377 }
381378 }
402399 fdOffset += sizeof(font->glyphs[i].shaderName);
403400 }
404401 font->glyphScale = readFloat();
405 memcpy( font->name, &fdFile[fdOffset], MAX_QPATH );
406
407 // memcpy(font, faceData, sizeof(fontInfo_t));
402 Com_Memcpy( font->name, &fdFile[fdOffset], MAX_QPATH );
403
404 // Com_Memcpy(font, faceData, sizeof(fontInfo_t));
408405 Q_strncpyz( font->name, name, sizeof( font->name ) );
409406 for ( i = GLYPH_START; i <= GLYPH_END; i++ ) {
410407 font->glyphs[i].glyph = RE_RegisterShaderNoMip( font->glyphs[i].shaderName );
411408 }
412 memcpy( &registeredFont[registeredFontCount++], font, sizeof( fontInfo_t ) );
409 Com_Memcpy( &registeredFont[registeredFontCount++], font, sizeof( fontInfo_t ) );
413410 ri.FS_FreeFile(faceData);
414411 return;
415412 }
507504 }
508505
509506 //Com_sprintf (name, sizeof(name), "fonts/fontImage_%i_%i", imageNumber++, pointSize);
510 image = R_CreateImage(name, imageBuff, 256, 256, IMGTYPE_COLORALPHA, IMGFLAG_CLAMPTOEDGE, 0 );
507 image = R_CreateImage( name, imageBuff, 256, 256, IMGTYPE_COLORALPHA, IMGFLAG_CLAMPTOEDGE, 0 );
511508 h = RE_RegisterShaderFromImage( name, LIGHTMAP_2D, image, qfalse );
512509 for ( j = lastStart; j < i; j++ ) {
513510 font->glyphs[j].glyph = h;
521518 if ( i == GLYPH_END + 1 )
522519 i++;
523520 } else {
524 memcpy( &font->glyphs[i], glyph, sizeof( glyphInfo_t ) );
521 Com_Memcpy( &font->glyphs[i], glyph, sizeof( glyphInfo_t ) );
525522 i++;
526523 }
527524 }
534531
535532 registeredFont[registeredFontCount].glyphScale = glyphScale;
536533 font->glyphScale = glyphScale;
537 memcpy( &registeredFont[registeredFontCount++], font, sizeof( fontInfo_t ) );
534 Com_Memcpy( &registeredFont[registeredFontCount++], font, sizeof( fontInfo_t ) );
538535
539536 if ( r_saveFontData->integer ) {
540537 ri.FS_WriteFile( va( "fonts/fontImage_%i.dat", pointSize ), font, sizeof( fontInfo_t ) );
548545
549546
550547
551 void R_InitFreeType(void) {
548 void R_InitFreeType( void ) {
552549 #ifdef BUILD_FREETYPE
553550 if ( FT_Init_FreeType( &ftLibrary ) ) {
554551 ri.Printf(PRINT_WARNING, "R_InitFreeType: Unable to initialize FreeType.\n");
558555 }
559556
560557
561 void R_DoneFreeType(void) {
558 void R_DoneFreeType( void ) {
562559 #ifdef BUILD_FREETYPE
563560 if ( ftLibrary ) {
564561 FT_Done_FreeType( ftLibrary );
145145 { "u_PrimaryLightRadius", GLSL_FLOAT },
146146
147147 { "u_CubeMapInfo", GLSL_VEC4 },
148
149 { "u_FireRiseDir", GLSL_VEC3 },
150 { "u_ZFadeLowest", GLSL_FLOAT },
151 { "u_ZFadeHighest", GLSL_FLOAT },
148152 };
149153
150154
301305 "#define alphaGen_t\n"
302306 "#define AGEN_LIGHTING_SPECULAR %i\n"
303307 "#define AGEN_PORTAL %i\n"
308 "#define AGEN_NORMALZFADE %i\n"
304309 "#endif\n",
305310 AGEN_LIGHTING_SPECULAR,
306 AGEN_PORTAL));
311 AGEN_PORTAL,
312 AGEN_NORMALZFADE));
307313
308314 Q_strcat(dest, size,
309315 va("#ifndef texenv_t\n"
15271533 {
15281534 case AGEN_LIGHTING_SPECULAR:
15291535 case AGEN_PORTAL:
1536 case AGEN_NORMALZFADE:
15301537 shaderAttribs |= GENERICDEF_USE_RGBAGEN;
15311538 break;
15321539 default:
28872887 {
28882888 for( x = 0; x < MAX_DLIGHTS; x++)
28892889 {
2890 tr.shadowCubemaps[x] = R_CreateImage(va("*shadowcubemap%i", x), (byte *)data, DEFAULT_SIZE, DEFAULT_SIZE, IMGTYPE_COLORALPHA, IMGFLAG_CLAMPTOEDGE | IMGFLAG_CUBEMAP, 0);
2890 tr.shadowCubemaps[x] = R_CreateImage(va("*shadowcubemap%i", x), NULL, PSHADOW_MAP_SIZE, PSHADOW_MAP_SIZE, IMGTYPE_COLORALPHA, IMGFLAG_CLAMPTOEDGE | IMGFLAG_CUBEMAP, 0);
28912891 }
28922892 }
28932893
33823382 skin->numSurfaces = 0;
33833383 skin->numModels = 0; //----(SA) added
33843384 skin->numSurfaces = 1;
3385 skin->surfaces[0] = ri.Hunk_Alloc( sizeof( skin->surfaces[0] ), h_low );
3385 skin->surfaces[0] = ri.Hunk_Alloc( sizeof( *skin->surfaces[0] ), h_low );
33863386 skin->surfaces[0]->shader = R_FindShader( name, LIGHTMAP_NONE, qtrue );
33873387 return hSkin;
33883388 }
34953495 skin = tr.skins[0] = ri.Hunk_Alloc( sizeof( skin_t ), h_low );
34963496 Q_strncpyz( skin->name, "<default skin>", sizeof( skin->name ) );
34973497 skin->numSurfaces = 1;
3498 skin->surfaces[0] = ri.Hunk_Alloc( sizeof( *skin->surfaces ), h_low );
3498 skin->surfaces[0] = ri.Hunk_Alloc( sizeof( *skin->surfaces[0] ), h_low );
34993499 skin->surfaces[0]->shader = tr.defaultShader;
35003500 }
35013501
170170 frac[i] = v - pos[i];
171171 if ( pos[i] < 0 ) {
172172 pos[i] = 0;
173 } else if ( pos[i] >= world->lightGridBounds[i] - 1 ) {
173 } else if ( pos[i] > world->lightGridBounds[i] - 1 ) {
174174 pos[i] = world->lightGridBounds[i] - 1;
175175 }
176176 }
194194 byte *data;
195195 int lat, lng;
196196 vec3_t normal;
197 qboolean ignore;
198197 factor = 1.0;
199198 data = gridData;
200 ignore = qfalse;
201199 for ( j = 0 ; j < 3 ; j++ ) {
202200 if ( i & ( 1 << j ) ) {
203 if ((pos[j] + 1) >= world->lightGridBounds[j] - 1)
204 {
205 ignore = qtrue; // ignore values outside lightgrid
201 if ( pos[j] + 1 > world->lightGridBounds[j] - 1 ) {
202 break; // ignore values outside lightgrid
206203 }
207204 factor *= frac[j];
208205 data += gridStep[j];
211208 }
212209 }
213210
214 if ( ignore )
211 if ( j != 3 )
215212 continue;
216213
217214 if (world->hdrLightGrid)
777777 UNIFORM_PRIMARYLIGHTRADIUS,
778778
779779 UNIFORM_CUBEMAPINFO,
780
781 UNIFORM_FIRERISEDIR,
782 UNIFORM_ZFADELOWEST,
783 UNIFORM_ZFADEHIGHEST,
780784
781785 UNIFORM_COUNT
782786 } uniform_t;
19321932 fog_t *fog;
19331933
19341934 if ( tr.refdef.rdflags & RDF_NOWORLDMODEL ) {
1935 return 0;
1936 }
1937
1938 if ( ent->e.renderfx & RF_CROSSHAIR ) {
19351939 return 0;
19361940 }
19371941
417417 {
418418 GLSL_SetUniformFloat5(sp, UNIFORM_DEFORMPARAMS, deformParams);
419419 GLSL_SetUniformFloat(sp, UNIFORM_TIME, tess.shaderTime);
420
421 if (tess.shader->deforms[0].deformationWave.frequency < 0)
422 {
423 vec3_t worldUp;
424
425 if ( VectorCompare( backEnd.currentEntity->e.fireRiseDir, vec3_origin ) ) {
426 VectorSet( backEnd.currentEntity->e.fireRiseDir, 0, 0, 1 );
427 }
428
429 if ( backEnd.currentEntity->e.hModel ) { // world surfaces dont have an axis
430 VectorRotate( backEnd.currentEntity->e.fireRiseDir, backEnd.currentEntity->e.axis, worldUp );
431 } else {
432 VectorCopy( backEnd.currentEntity->e.fireRiseDir, worldUp );
433 }
434
435 GLSL_SetUniformVec3(sp, UNIFORM_FIRERISEDIR, worldUp);
436 }
420437 }
421438
422439 vector[0] = dl->color[0];
601618 vertColor[3] = 0.0f;
602619 break;
603620 case AGEN_NORMALZFADE:
621 baseColor[3] = pStage->constantColor[3] / 255.0f;
622 if (backEnd.currentEntity && backEnd.currentEntity->e.hModel)
623 {
624 baseColor[3] *= ((unsigned char *)backEnd.currentEntity->e.shaderRGBA)[3] / 255.0f;
625 }
626 vertColor[3] = 0.0f;
627 break;
604628 case AGEN_VERTEX:
605629 baseColor[3] = 0.0f;
606630 vertColor[3] = 1.0f;
796820
797821 GLSL_SetUniformFloat(sp, UNIFORM_VERTEXLERP, glState.vertexAttribsInterpolation);
798822
823 if ((deformGen != DGEN_NONE && tess.shader->deforms[0].deformationWave.frequency < 0 )
824 || pStage->alphaGen == AGEN_NORMALZFADE)
825 {
826 vec3_t worldUp;
827
828 if ( VectorCompare( backEnd.currentEntity->e.fireRiseDir, vec3_origin ) ) {
829 VectorSet( backEnd.currentEntity->e.fireRiseDir, 0, 0, 1 );
830 }
831
832 if ( backEnd.currentEntity->e.hModel ) { // world surfaces dont have an axis
833 VectorRotate( backEnd.currentEntity->e.fireRiseDir, backEnd.currentEntity->e.axis, worldUp );
834 } else {
835 VectorCopy( backEnd.currentEntity->e.fireRiseDir, worldUp );
836 }
837
838 GLSL_SetUniformVec3(sp, UNIFORM_FIRERISEDIR, worldUp);
839 }
840
799841 GLSL_SetUniformInt(sp, UNIFORM_DEFORMGEN, deformGen);
800842 if (deformGen != DGEN_NONE)
801843 {
828870 if (pStage->alphaGen == AGEN_PORTAL)
829871 {
830872 GLSL_SetUniformFloat(sp, UNIFORM_PORTALRANGE, tess.shader->portalRange);
873 }
874 else if (pStage->alphaGen == AGEN_NORMALZFADE)
875 {
876 float lowest, highest;
877 //qboolean zombieEffect = qfalse;
878
879 lowest = pStage->zFadeBounds[0];
880 if ( lowest == -1000 ) { // use entity alpha
881 lowest = backEnd.currentEntity->e.shaderTime;
882 //zombieEffect = qtrue;
883 }
884 highest = pStage->zFadeBounds[1];
885 if ( highest == -1000 ) { // use entity alpha
886 highest = backEnd.currentEntity->e.shaderTime;
887 //zombieEffect = qtrue;
888 }
889
890 // TODO: Handle normalzfade zombie effect
891
892 GLSL_SetUniformFloat(sp, UNIFORM_ZFADELOWEST, lowest);
893 GLSL_SetUniformFloat(sp, UNIFORM_ZFADEHIGHEST, highest);
831894 }
832895
833896 GLSL_SetUniformInt(sp, UNIFORM_COLORGEN, pStage->rgbGen);
10861149 {
10871150 GLSL_SetUniformFloat5(sp, UNIFORM_DEFORMPARAMS, deformParams);
10881151 GLSL_SetUniformFloat(sp, UNIFORM_TIME, tess.shaderTime);
1152
1153 if (tess.shader->deforms[0].deformationWave.frequency < 0)
1154 {
1155 vec3_t worldUp;
1156
1157 if ( VectorCompare( backEnd.currentEntity->e.fireRiseDir, vec3_origin ) ) {
1158 VectorSet( backEnd.currentEntity->e.fireRiseDir, 0, 0, 1 );
1159 }
1160
1161 if ( backEnd.currentEntity->e.hModel ) { // world surfaces dont have an axis
1162 VectorRotate( backEnd.currentEntity->e.fireRiseDir, backEnd.currentEntity->e.axis, worldUp );
1163 } else {
1164 VectorCopy( backEnd.currentEntity->e.fireRiseDir, worldUp );
1165 }
1166
1167 GLSL_SetUniformVec3(sp, UNIFORM_FIRERISEDIR, worldUp);
1168 }
10891169 }
10901170
10911171 if (wolfFog)
12721352 GLSL_SetUniformVec3(sp, UNIFORM_LOCALVIEWORIGIN, backEnd.or.viewOrigin);
12731353
12741354 GLSL_SetUniformFloat(sp, UNIFORM_VERTEXLERP, glState.vertexAttribsInterpolation);
1355
1356 if ((deformGen != DGEN_NONE && tess.shader->deforms[0].deformationWave.frequency < 0 )
1357 || pStage->alphaGen == AGEN_NORMALZFADE)
1358 {
1359 vec3_t worldUp;
1360
1361 if ( VectorCompare( backEnd.currentEntity->e.fireRiseDir, vec3_origin ) ) {
1362 VectorSet( backEnd.currentEntity->e.fireRiseDir, 0, 0, 1 );
1363 }
1364
1365 if ( backEnd.currentEntity->e.hModel ) { // world surfaces dont have an axis
1366 VectorRotate( backEnd.currentEntity->e.fireRiseDir, backEnd.currentEntity->e.axis, worldUp );
1367 } else {
1368 VectorCopy( backEnd.currentEntity->e.fireRiseDir, worldUp );
1369 }
1370
1371 GLSL_SetUniformVec3(sp, UNIFORM_FIRERISEDIR, worldUp);
1372 }
12751373
12761374 GLSL_SetUniformInt(sp, UNIFORM_DEFORMGEN, deformGen);
12771375 if (deformGen != DGEN_NONE)
13431441 if (pStage->alphaGen == AGEN_PORTAL)
13441442 {
13451443 GLSL_SetUniformFloat(sp, UNIFORM_PORTALRANGE, tess.shader->portalRange);
1444 }
1445 else if (pStage->alphaGen == AGEN_NORMALZFADE)
1446 {
1447 float lowest, highest;
1448 //qboolean zombieEffect = qfalse;
1449
1450 lowest = pStage->zFadeBounds[0];
1451 if ( lowest == -1000 ) { // use entity alpha
1452 lowest = backEnd.currentEntity->e.shaderTime;
1453 //zombieEffect = qtrue;
1454 }
1455 highest = pStage->zFadeBounds[1];
1456 if ( highest == -1000 ) { // use entity alpha
1457 highest = backEnd.currentEntity->e.shaderTime;
1458 //zombieEffect = qtrue;
1459 }
1460
1461 // TODO: Handle normalzfade zombie effect
1462
1463 GLSL_SetUniformFloat(sp, UNIFORM_ZFADELOWEST, lowest);
1464 GLSL_SetUniformFloat(sp, UNIFORM_ZFADEHIGHEST, highest);
13461465 }
13471466
13481467 GLSL_SetUniformInt(sp, UNIFORM_COLORGEN, pStage->rgbGen);
15571676 {
15581677 GLSL_SetUniformFloat5(sp, UNIFORM_DEFORMPARAMS, deformParams);
15591678 GLSL_SetUniformFloat(sp, UNIFORM_TIME, tess.shaderTime);
1679
1680 if (tess.shader->deforms[0].deformationWave.frequency < 0)
1681 {
1682 vec3_t worldUp;
1683
1684 if ( VectorCompare( backEnd.currentEntity->e.fireRiseDir, vec3_origin ) ) {
1685 VectorSet( backEnd.currentEntity->e.fireRiseDir, 0, 0, 1 );
1686 }
1687
1688 if ( backEnd.currentEntity->e.hModel ) { // world surfaces dont have an axis
1689 VectorRotate( backEnd.currentEntity->e.fireRiseDir, backEnd.currentEntity->e.axis, worldUp );
1690 } else {
1691 VectorCopy( backEnd.currentEntity->e.fireRiseDir, worldUp );
1692 }
1693
1694 GLSL_SetUniformVec3(sp, UNIFORM_FIRERISEDIR, worldUp);
1695 }
15601696 }
15611697
15621698 VectorCopy(backEnd.viewParms.or.origin, vector);
18011801 return qfalse;
18021802 }
18031803
1804 if ( r_greyscale->integer )
1805 {
1806 float luminance;
1807
1808 luminance = LUMA( shader.fogParms.color[0], shader.fogParms.color[1], shader.fogParms.color[2] );
1809 VectorSet( shader.fogParms.color, luminance, luminance, luminance );
1810 }
1811 else if ( r_greyscale->value )
1812 {
1813 float luminance;
1814
1815 luminance = LUMA( shader.fogParms.color[0], shader.fogParms.color[1], shader.fogParms.color[2] );
1816 shader.fogParms.color[0] = LERP( shader.fogParms.color[0], luminance, r_greyscale->value );
1817 shader.fogParms.color[1] = LERP( shader.fogParms.color[1], luminance, r_greyscale->value );
1818 shader.fogParms.color[2] = LERP( shader.fogParms.color[2], luminance, r_greyscale->value );
1819 }
1820
18041821 token = COM_ParseExt( text, qfalse );
18051822 if ( !token[0] ) {
18061823 ri.Printf( PRINT_WARNING, "WARNING: missing parm for 'fogParms' keyword in shader '%s'\n", shader.name );
23622379 {
23632380 case AGEN_LIGHTING_SPECULAR:
23642381 case AGEN_PORTAL:
2382 case AGEN_NORMALZFADE:
23652383 skip = qtrue;
23662384 break;
23672385 default:
453453 int clip;
454454 model_t *pModel;
455455 int i;
456 int fognum;
456457
457458 pModel = R_GetModelByHandle( ent->e.hModel );
458459
466467 R_SetupEntityLighting( &tr.refdef, ent );
467468 R_DlightBmodel( bmodel );
468469
470 //----(SA) modified
471 // determine if in fog
472 fognum = R_BmodelFogNum( ent, bmodel );
473
469474 for ( i = 0 ; i < bmodel->numSurfaces ; i++ ) {
470475 int surf = bmodel->firstSurface + i;
471476
472477 if (tr.world->surfacesViewCount[surf] != tr.viewCount)
473478 {
474479 tr.world->surfacesViewCount[surf] = tr.viewCount;
480 tr.world->surfaces[surf].fogIndex = fognum;
475481 R_AddWorldSurface( tr.world->surfaces + surf, tr.currentEntity->needDlights, 0 );
476482 }
477483 }
484 //----(SA) end
478485 }
479486
480487 /*
10931093 render_count = surface->numVerts;
10941094 }
10951095
1096 RB_CheckOverflow( render_count, surface->numTriangles );
1097
10981096 //DBG_SHOWTIME
10991097
11001098 //
11011099 // setup triangle list
11021100 //
1103 RB_CheckOverflow( surface->numVerts, surface->numTriangles * 3 );
1101 RB_CHECKOVERFLOW( render_count, surface->numTriangles * 3 );
11041102
11051103 //DBG_SHOWTIME
11061104
16871685 oldFrame = (mdrFrame_t *)((byte *)header + header->ofsFrames +
16881686 backEnd.currentEntity->e.oldframe * frameSize );
16891687
1690 RB_CheckOverflow( surface->numVerts, surface->numTriangles * 3 );
1688 RB_CHECKOVERFLOW( surface->numVerts, surface->numTriangles * 3 );
16911689
16921690 triangles = (int *) ((byte *)surface + surface->ofsTriangles);
16931691 indexes = surface->numTriangles * 3;
9999
100100 #ifdef BUILD_FREETYPE
101101 void R_GetGlyphInfo( FT_GlyphSlot glyph, int *left, int *right, int *width, int *top, int *bottom, int *height, int *pitch ) {
102
103102 *left = _FLOOR( glyph->metrics.horiBearingX );
104103 *right = _CEIL( glyph->metrics.horiBearingX + glyph->metrics.width );
105104 *width = _TRUNC( *right - *left );
112111
113112
114113 FT_Bitmap *R_RenderGlyph( FT_GlyphSlot glyph, glyphInfo_t* glyphOut ) {
115
116114 FT_Bitmap *bit2;
117115 int left, right, width, top, bottom, height, pitch, size;
118116
167165
168166 // swap rgb to bgr
169167 c = 18 + width * height * 4;
170 for (i=18 ; i<c ; i+=4)
168 for ( i = 18 ; i < c ; i += 4 )
171169 {
172 buffer[i] = data[i-18+2]; // blue
173 buffer[i+1] = data[i-18+1]; // green
174 buffer[i+2] = data[i-18+0]; // red
175 buffer[i+3] = data[i-18+3]; // alpha
170 buffer[i] = data[i - 18 + 2]; // blue
171 buffer[i + 1] = data[i - 18 + 1]; // green
172 buffer[i + 2] = data[i - 18 + 0]; // red
173 buffer[i + 3] = data[i - 18 + 3]; // alpha
176174 }
177175
178176 // flip upside down
194192 //fwrite (buffer, 1, c, f);
195193 //fclose (f);
196194
197 ri.Free (buffer);
195 ri.Free( buffer );
198196 }
199197
200198 static glyphInfo_t *RE_ConstructGlyphInfo( unsigned char *imageOut, int *xOut, int *yOut, int *maxHeight, FT_Face face, const unsigned char c, qboolean calcHeight ) {
246244 if (*yOut + *maxHeight + 1 >= 255) {
247245 *yOut = -1;
248246 *xOut = -1;
249 ri.Free(bitmap->buffer);
250 ri.Free(bitmap);
247 ri.Free( bitmap->buffer );
248 ri.Free( bitmap );
251249 return &glyph;
252250 }
253251
278276
279277 src += glyph.pitch;
280278 dst += 256;
281
282279 }
283280 } else {
284281 for ( i = 0; i < glyph.height; i++ ) {
285 memcpy( dst, src, glyph.pitch );
282 Com_Memcpy( dst, src, glyph.pitch );
286283 src += glyph.pitch;
287284 dst += 256;
288285 }
309306 #endif
310307
311308 static int fdOffset;
312 static byte *fdFile;
309 static byte *fdFile;
313310
314311 int readInt( void ) {
315312 int i = fdFile[fdOffset] + ( fdFile[fdOffset + 1] << 8 ) + ( fdFile[fdOffset + 2] << 16 ) + ( fdFile[fdOffset + 3] << 24 );
318315 }
319316
320317 typedef union {
321 byte fred[4];
322 float ffred;
318 byte fred[4];
319 float ffred;
323320 } poor;
324321
325322 float readFloat( void ) {
375372 Com_sprintf( name, sizeof( name ), "fonts/fontImage_%i.dat",pointSize );
376373 for ( i = 0; i < registeredFontCount; i++ ) {
377374 if ( Q_stricmp( name, registeredFont[i].name ) == 0 ) {
378 memcpy( font, &registeredFont[i], sizeof( fontInfo_t ) );
375 Com_Memcpy( font, &registeredFont[i], sizeof( fontInfo_t ) );
379376 return;
380377 }
381378 }
402399 fdOffset += sizeof(font->glyphs[i].shaderName);
403400 }
404401 font->glyphScale = readFloat();
405 memcpy( font->name, &fdFile[fdOffset], MAX_QPATH );
406
407 // memcpy(font, faceData, sizeof(fontInfo_t));
402 Com_Memcpy( font->name, &fdFile[fdOffset], MAX_QPATH );
403
404 // Com_Memcpy(font, faceData, sizeof(fontInfo_t));
408405 Q_strncpyz( font->name, name, sizeof( font->name ) );
409406 for ( i = GLYPH_START; i <= GLYPH_END; i++ ) {
410407 font->glyphs[i].glyph = RE_RegisterShaderNoMip( font->glyphs[i].shaderName );
411408 }
412 memcpy( &registeredFont[registeredFontCount++], font, sizeof( fontInfo_t ) );
409 Com_Memcpy( &registeredFont[registeredFontCount++], font, sizeof( fontInfo_t ) );
413410 ri.FS_FreeFile(faceData);
414411 return;
415412 }
507504 }
508505
509506 //Com_sprintf (name, sizeof(name), "fonts/fontImage_%i_%i", imageNumber++, pointSize);
510 image = R_CreateImage( name, imageBuff, 256, 256, qfalse, qfalse, GL_CLAMP_TO_EDGE );
507 image = R_CreateImage( name, imageBuff, 256, 256, IMGTYPE_COLORALPHA, IMGFLAG_CLAMPTOEDGE, 0 );
511508 h = RE_RegisterShaderFromImage( name, LIGHTMAP_2D, image, qfalse );
512509 for ( j = lastStart; j < i; j++ ) {
513510 font->glyphs[j].glyph = h;
521518 if ( i == GLYPH_END + 1 )
522519 i++;
523520 } else {
524 memcpy( &font->glyphs[i], glyph, sizeof( glyphInfo_t ) );
521 Com_Memcpy( &font->glyphs[i], glyph, sizeof( glyphInfo_t ) );
525522 i++;
526523 }
527524 }
534531
535532 registeredFont[registeredFontCount].glyphScale = glyphScale;
536533 font->glyphScale = glyphScale;
537 memcpy( &registeredFont[registeredFontCount++], font, sizeof( fontInfo_t ) );
534 Com_Memcpy( &registeredFont[registeredFontCount++], font, sizeof( fontInfo_t ) );
538535
539536 if ( r_saveFontData->integer ) {
540537 ri.FS_WriteFile( va( "fonts/fontImage_%i.dat", pointSize ), font, sizeof( fontInfo_t ) );
548545
549546
550547
551 void R_InitFreeType(void) {
548 void R_InitFreeType( void ) {
552549 #ifdef BUILD_FREETYPE
553550 if ( FT_Init_FreeType( &ftLibrary ) ) {
554551 ri.Printf(PRINT_WARNING, "R_InitFreeType: Unable to initialize FreeType.\n");
558555 }
559556
560557
561 void R_DoneFreeType(void) {
558 void R_DoneFreeType( void ) {
562559 #ifdef BUILD_FREETYPE
563560 if ( ftLibrary ) {
564561 FT_Done_FreeType( ftLibrary );
19321932 skin->numSurfaces = 0;
19331933 skin->numModels = 0; //----(SA) added
19341934 skin->numSurfaces = 1;
1935 skin->surfaces[0] = ri.Hunk_Alloc( sizeof( skin->surfaces[0] ), h_low );
1935 skin->surfaces[0] = ri.Hunk_Alloc( sizeof( *skin->surfaces[0] ), h_low );
19361936 skin->surfaces[0]->shader = R_FindShader( name, LIGHTMAP_NONE, qtrue );
19371937 return hSkin;
19381938 }
20452045 skin = tr.skins[0] = ri.Hunk_Alloc( sizeof( skin_t ), h_low );
20462046 Q_strncpyz( skin->name, "<default skin>", sizeof( skin->name ) );
20472047 skin->numSurfaces = 1;
2048 skin->surfaces[0] = ri.Hunk_Alloc( sizeof( *skin->surfaces ), h_low );
2048 skin->surfaces[0] = ri.Hunk_Alloc( sizeof( *skin->surfaces[0] ), h_low );
20492049 skin->surfaces[0]->shader = tr.defaultShader;
20502050 }
20512051
165165 frac[i] = v - pos[i];
166166 if ( pos[i] < 0 ) {
167167 pos[i] = 0;
168 } else if ( pos[i] >= tr.world->lightGridBounds[i] - 1 ) {
168 } else if ( pos[i] > tr.world->lightGridBounds[i] - 1 ) {
169169 pos[i] = tr.world->lightGridBounds[i] - 1;
170170 }
171171 }
194194 data = gridData;
195195 for ( j = 0 ; j < 3 ; j++ ) {
196196 if ( i & ( 1 << j ) ) {
197 if ( pos[j] + 1 > tr.world->lightGridBounds[j] - 1 ) {
198 break; // ignore values outside lightgrid
199 }
197200 factor *= frac[j];
198201 data += gridStep[j];
199202 } else {
201204 }
202205 }
203206
207 if ( j != 3 ) {
208 continue;
209 }
204210 if ( !( data[0] + data[1] + data[2] ) ) {
205211 continue; // ignore samples in walls
206212 }
12911291 fog_t *fog;
12921292
12931293 if ( tr.refdef.rdflags & RDF_NOWORLDMODEL ) {
1294 return 0;
1295 }
1296
1297 if ( ent->e.renderfx & RF_CROSSHAIR ) {
12941298 return 0;
12951299 }
12961300
15231523 else if ( !Q_stricmp( token, "fogParms" ) ) {
15241524 if ( !ParseVector( text, 3, shader.fogParms.color ) ) {
15251525 return qfalse;
1526 }
1527
1528 if ( r_greyscale->integer )
1529 {
1530 float luminance;
1531
1532 luminance = LUMA( shader.fogParms.color[0], shader.fogParms.color[1], shader.fogParms.color[2] );
1533 VectorSet( shader.fogParms.color, luminance, luminance, luminance );
1534 }
1535 else if ( r_greyscale->value )
1536 {
1537 float luminance;
1538
1539 luminance = LUMA( shader.fogParms.color[0], shader.fogParms.color[1], shader.fogParms.color[2] );
1540 shader.fogParms.color[0] = LERP( shader.fogParms.color[0], luminance, r_greyscale->value );
1541 shader.fogParms.color[1] = LERP( shader.fogParms.color[1], luminance, r_greyscale->value );
1542 shader.fogParms.color[2] = LERP( shader.fogParms.color[2], luminance, r_greyscale->value );
15261543 }
15271544
15281545 token = COM_ParseExt( text, qfalse );
156156 {
157157 int i, j;
158158 char buf[ MAX_STRING_CHARS ] = { 0 };
159 SDL_Rect modes[ 128 ];
159 int numSDLModes;
160 SDL_Rect *modes;
160161 int numModes = 0;
161162
163 SDL_DisplayMode windowMode;
162164 int display = SDL_GetWindowDisplayIndex( SDL_window );
163 SDL_DisplayMode windowMode;
164
165 if( SDL_GetWindowDisplayMode( SDL_window, &windowMode ) < 0 )
165 numSDLModes = SDL_GetNumDisplayModes( display );
166
167 if( SDL_GetWindowDisplayMode( SDL_window, &windowMode ) < 0 || numSDLModes <= 0 )
166168 {
167169 ri.Printf( PRINT_WARNING, "Couldn't get window display mode, no resolutions detected\n" );
168170 return;
169171 }
170172
171 for( i = 0; i < SDL_GetNumDisplayModes( display ); i++ )
173 modes = SDL_calloc( (size_t)numSDLModes, sizeof( SDL_Rect ) );
174 if ( !modes )
175 {
176 ri.Error( ERR_FATAL, "Out of memory" );
177 }
178
179 for( i = 0; i < numSDLModes; i++ )
172180 {
173181 SDL_DisplayMode mode;
174182
178186 if( !mode.w || !mode.h )
179187 {
180188 ri.Printf( PRINT_ALL, "Display supports any resolution\n" );
189 SDL_free( modes );
181190 return;
182191 }
183192
219228 ri.Printf( PRINT_ALL, "Available modes: '%s'\n", buf );
220229 ri.Cvar_Set( "r_availableModes", buf );
221230 }
231 SDL_free( modes );
222232 }
223233
224234 /*
832832 Com_QueueEvent( 0, SE_KEY, K_MWHEELUP, qtrue, 0, NULL );
833833 Com_QueueEvent( 0, SE_KEY, K_MWHEELUP, qfalse, 0, NULL );
834834 }
835 else
835 else if( e.wheel.y < 0 )
836836 {
837837 Com_QueueEvent( 0, SE_KEY, K_MWHEELDOWN, qtrue, 0, NULL );
838838 Com_QueueEvent( 0, SE_KEY, K_MWHEELDOWN, qfalse, 0, NULL );
812812 signal( SIGHUP, Sys_SigHandler );
813813 signal( SIGQUIT, Sys_SigHandler );
814814 signal( SIGTRAP, Sys_SigHandler );
815 signal( SIGIOT, Sys_SigHandler );
815 signal( SIGABRT, Sys_SigHandler );
816816 signal( SIGBUS, Sys_SigHandler );
817817
818818 Sys_SetFloatEnv();
469469 intptr_t findhandle;
470470 int flag;
471471 int i;
472 int extLen;
472473
473474 if (filter) {
474475
502503 flag = _A_SUBDIR;
503504 }
504505
506 extLen = strlen( extension );
507
505508 Com_sprintf( search, sizeof(search), "%s\\*%s", directory, extension );
506509
507510 // search
515518
516519 do {
517520 if ( (!wantsubs && flag ^ ( findinfo.attrib & _A_SUBDIR )) || (wantsubs && findinfo.attrib & _A_SUBDIR) ) {
521 if (*extension) {
522 if ( strlen( findinfo.name ) < extLen ||
523 Q_stricmp(
524 findinfo.name + strlen( findinfo.name ) - extLen,
525 extension ) ) {
526 continue; // didn't match
527 }
528 }
518529 if ( nfiles == MAX_FOUND_FILES - 1 ) {
519530 break;
520531 }
5757
5858 unset X86_64_SDK
5959 unset X86_64_CFLAGS
60 unset X86_64_LDFLAGS
6160 unset X86_SDK
6261 unset X86_CFLAGS
63 unset X86_LDFLAGS
6462 unset PPC_64_SDK
6563 unset PPC_CFLAGS
66 unset PPC_LDFLAGS
6764
6865 if [ -d /Developer/SDKs/MacOSX10.5.sdk ]; then
6966 X86_64_SDK=/Developer/SDKs/MacOSX10.5.sdk
70 X86_64_CFLAGS="-arch x86_64 -isysroot /Developer/SDKs/MacOSX10.5.sdk \
71 -DMAC_OS_X_VERSION_MIN_REQUIRED=1050"
72 X86_64_LDFLAGS=" -mmacosx-version-min=10.5"
67 X86_64_CFLAGS="-arch x86_64 -isysroot /Developer/SDKs/MacOSX10.5.sdk"
7368
7469 X86_SDK=/Developer/SDKs/MacOSX10.5.sdk
75 X86_CFLAGS="-arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk \
76 -DMAC_OS_X_VERSION_MIN_REQUIRED=1050"
77 X86_LDFLAGS=" -mmacosx-version-min=10.5"
70 X86_CFLAGS="-arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk"
7871
7972 PPC_SDK=/Developer/SDKs/MacOSX10.5.sdk
80 PPC_CFLAGS="-arch ppc -isysroot /Developer/SDKs/MacOSX10.5.sdk \
81 -DMAC_OS_X_VERSION_MIN_REQUIRED=1050"
82 PPC_LDFLAGS=" -mmacosx-version-min=10.5"
73 PPC_CFLAGS="-arch ppc -isysroot /Developer/SDKs/MacOSX10.5.sdk"
8374 fi
8475
8576 if [ -z $X86_64_SDK ] || [ -z $X86_SDK ] || [ -z $PPC_SDK ]; then
116107 if [ -d build/release-release-x86_64 ]; then
117108 rm -r build/release-darwin-x86_64
118109 fi
119 (ARCH=x86_64 CC=gcc-4.0 CFLAGS=$X86_64_CFLAGS LDFLAGS=$X86_64_LDFLAGS make -j$NCPU) || exit 1;
110 (ARCH=x86_64 CC=gcc-4.0 CFLAGS=$X86_64_CFLAGS make -j$NCPU) || exit 1;
120111
121112 echo;echo
122113
124115 if [ -d build/release-darwin-x86 ]; then
125116 rm -r build/release-darwin-x86
126117 fi
127 (ARCH=x86 CC=gcc-4.0 CFLAGS=$X86_CFLAGS LDFLAGS=$X86_LDFLAGS make -j$NCPU) || exit 1;
118 (ARCH=x86 CC=gcc-4.0 CFLAGS=$X86_CFLAGS make -j$NCPU) || exit 1;
128119
129120 echo;echo
130121
132123 if [ -d build/release-darwin-ppc ]; then
133124 rm -r build/release-darwin-ppc
134125 fi
135 (ARCH=ppc CC=gcc-4.0 CFLAGS=$PPC_CFLAGS LDFLAGS=$PPC_LDFLAGS make -j$NCPU) || exit 1;
126 (ARCH=ppc CC=gcc-4.0 CFLAGS=$PPC_CFLAGS make -j$NCPU) || exit 1;
136127
137128 echo;echo
138129
7171
7272 unset ARCH_SDK
7373 unset ARCH_CFLAGS
74 unset ARCH_LDFLAGS
7574
7675 if [ -d /Developer/SDKs/MacOSX10.5.sdk ]; then
7776 ARCH_SDK=/Developer/SDKs/MacOSX10.5.sdk
78 ARCH_CFLAGS="-arch ${ARCH} -isysroot /Developer/SDKs/MacOSX10.5.sdk \
79 -DMAC_OS_X_VERSION_MIN_REQUIRED=1050"
80 ARCH_LDFLAGS=" -mmacosx-version-min=10.5"
77 ARCH_CFLAGS="-arch ${ARCH} -isysroot /Developer/SDKs/MacOSX10.5.sdk"
8178 fi
8279
8380
9693 if [ -d build/release-darwin-${BUILDARCH} ]; then
9794 rm -r build/release-darwin-${BUILDARCH}
9895 fi
99 (CC=${CC} ARCH=${BUILDARCH} CFLAGS=$ARCH_CFLAGS LDFLAGS=$ARCH_LDFLAGS make -j$NCPU) || exit 1;
96 (CC=${CC} ARCH=${BUILDARCH} CFLAGS=$ARCH_CFLAGS make -j$NCPU) || exit 1;
10097
10198 echo "Creating .app bundle $DESTDIR/$APPBUNDLE"
10299 if [ ! -d $DESTDIR/$APPBUNDLE/Contents/MacOS/$BASEDIR ]; then
6060 # "8" is the Darwin major kernel version.
6161 TIGERHOST=`uname -r |perl -w -p -e 's/\A(\d+)\..*\Z/$1/; $_ = (($_ >= 8) ? "1" : "0");'`
6262
63 # we want to use the oldest available SDK (10.6) for max compatiblity.
63 unset ARCH_CFLAGS
6464
65 unset ARCH_CFLAGS
66 unset ARCH_LDFLAGS
67
68 ARCH_CFLAGS="-arch ${ARCH} -DMAC_OS_X_VERSION_MIN_REQUIRED=1060"
69 ARCH_LDFLAGS=" -mmacosx-version-min=10.6"
65 ARCH_CFLAGS="-arch ${ARCH}"
7066
7167 if [ ! -d $DESTDIR ]; then
7268 mkdir -p $DESTDIR
8076 if [ -d build/release-darwin-${BUILDARCH} ]; then
8177 rm -r build/release-darwin-${BUILDARCH}
8278 fi
83 (CC=${CC} ARCH=${BUILDARCH} CFLAGS=$ARCH_CFLAGS LDFLAGS=$ARCH_LDFLAGS make -j$NCPU) || exit 1;
79 (CC=${CC} ARCH=${BUILDARCH} CFLAGS=$ARCH_CFLAGS make -j$NCPU) || exit 1;
8480
8581 echo "Creating .app bundle $DESTDIR/$APPBUNDLE"
8682 if [ ! -d $DESTDIR/$APPBUNDLE/Contents/MacOS/$BASEDIR ]; then
6060 # "8" is the Darwin major kernel version.
6161 TIGERHOST=`uname -r |perl -w -p -e 's/\A(\d+)\..*\Z/$1/; $_ = (($_ >= 8) ? "1" : "0");'`
6262
63 # we want to use the oldest available SDK (10.6) for max compatiblity.
63 unset ARCH_CFLAGS
6464
65 unset ARCH_CFLAGS
66 unset ARCH_LDFLAGS
67
68 ARCH_CFLAGS="-arch ${ARCH} -DMAC_OS_X_VERSION_MIN_REQUIRED=1060"
69 ARCH_LDFLAGS=" -mmacosx-version-min=10.6"
65 ARCH_CFLAGS="-arch ${ARCH}"
7066
7167 if [ ! -d $DESTDIR ]; then
7268 mkdir -p $DESTDIR
8076 if [ -d build/release-darwin-${BUILDARCH} ]; then
8177 rm -r build/release-darwin-${BUILDARCH}
8278 fi
83 (CC=${CC} ARCH=${BUILDARCH} CFLAGS=$ARCH_CFLAGS LDFLAGS=$ARCH_LDFLAGS make -j$NCPU) || exit 1;
79 (CC=${CC} ARCH=${BUILDARCH} CFLAGS=$ARCH_CFLAGS make -j$NCPU) || exit 1;
8480
8581 echo "Creating .app bundle $DESTDIR/$APPBUNDLE"
8682 if [ ! -d $DESTDIR/$APPBUNDLE/Contents/MacOS/$BASEDIR ]; then
5151 4.) mingw64-x86_64-gcc-g++ (For 64bit, same as above)
5252 5.) make
5353 6.) bison
54 7.) subversion
54 7.) git-core
5555
5656 When you search for your packages you'll see category listings. These packages would all be under the 'Devel' category.
5757
6868 After the install has completed you should have a 'Cygwin Terminal' icon on your Desktop. This is the bash shell for Cygwin, so go ahead and run it.
6969
7070 At the command prompt type:
71 svn co http://iortcw.googlecode.com/svn/trunk iortcw
71 git clone https://github.com/iortcw/iortcw.git iortcw
7272
7373 This will pull the iortcw trunk source.
7474
7878 or
7979 cd iortcw/SP (Single-Player)
8080
81 ./cross-make-mingw.sh (to build 32bit binaries)
81 ARCH=x86 make (to build 32bit binaries)
8282 or
83 ./cross-make-mingw64.sh (for 64bit binaries)
83 ARCH=x86_64 make (for 64bit binaries)
8484
8585 Wait for build to complete.
8686
6060 endif
6161 export PLATFORM
6262
63 ifeq ($(PLATFORM),mingw32)
64 MINGW=1
65 endif
66 ifeq ($(PLATFORM),mingw64)
67 MINGW=1
68 endif
69
6370 ifeq ($(COMPILE_ARCH),i386)
6471 COMPILE_ARCH=x86
6572 endif
97104 # For historical compatibility reasons on non-windows
98105 # platform output files use i386 instead of x86
99106 ifeq ($(ARCH),x86)
100 ifneq ($(PLATFORM),mingw32)
107 ifndef MINGW
101108 FILE_ARCH=i386
102109 endif
103110 endif
123130 endif
124131
125132 ifndef CLIENTBIN
126 ifeq ($(PLATFORM),mingw32)
133 ifdef MINGW
127134 CLIENTBIN=ioWolfSP
128135 else
129136 CLIENTBIN=iowolfsp
131138 endif
132139
133140 ifndef SERVERBIN
134 ifeq ($(PLATFORM),mingw32)
141 ifdef MINGW
135142 SERVERBIN=ioWolfSPDED
136143 else
137144 SERVERBIN=iowolfspded
183190 endif
184191
185192 ifndef USE_CURL_DLOPEN
186 ifeq ($(PLATFORM),mingw32)
193 ifdef MINGW
187194 USE_CURL_DLOPEN=0
188195 else
189196 USE_CURL_DLOPEN=1
232239
233240 ifndef USE_INTERNAL_JPEG
234241 USE_INTERNAL_JPEG=$(USE_INTERNAL_LIBS)
242 endif
243
244 ifndef USE_INTERNAL_FREETYPE
245 USE_INTERNAL_FREETYPE=$(USE_INTERNAL_LIBS)
235246 endif
236247
237248 ifndef USE_LOCAL_HEADERS
282293 OPUSDIR=$(MOUNT_DIR)/opus-1.1
283294 OPUSFILEDIR=$(MOUNT_DIR)/opusfile-0.6
284295 ZDIR=$(MOUNT_DIR)/zlib
296 FTDIR=$(MOUNT_DIR)/freetype-2.5.5
285297 SPLDIR=$(MOUNT_DIR)/splines
286298 Q3ASMDIR=$(MOUNT_DIR)/tools/asm
287299 LBURGDIR=$(MOUNT_DIR)/tools/lcc/lburg
304316 OPENAL_LIBS ?= $(shell pkg-config --silence-errors --libs openal)
305317 SDL_CFLAGS ?= $(shell pkg-config --silence-errors --cflags sdl2|sed 's/-Dmain=SDL_main//')
306318 SDL_LIBS ?= $(shell pkg-config --silence-errors --libs sdl2)
307 FREETYPE_CFLAGS ?= $(shell pkg-config --silence-errors --cflags freetype2)
308319 else
309320 # assume they're in the system default paths (no -I or -L needed)
310321 CURL_LIBS ?= -lcurl
342353 EXTRA_FILES=
343354 CLIENT_EXTRA_FILES=
344355
345 ifneq (,$(findstring "$(PLATFORM)", "linux" "gnu_kfreebsd" "kfreebsd-gnu"))
356 ifneq (,$(findstring "$(PLATFORM)", "linux" "gnu_kfreebsd" "kfreebsd-gnu" "gnu"))
346357
347358 ifeq ($(ARCH),x86_64)
348359 LIB=lib64
352363 else
353364 ifeq ($(ARCH),s390x)
354365 LIB=lib64
366 else
367 ifeq ($(ARCH),aarch64)
368 LIB=lib64
369 endif
355370 endif
356371 endif
357372 endif
360375 -pipe -DUSE_ICON
361376 CLIENT_CFLAGS += $(SDL_CFLAGS)
362377
363 OPTIMIZEVM = -O3 -funroll-loops -fomit-frame-pointer
378 OPTIMIZEVM = -O3
364379 OPTIMIZE = $(OPTIMIZEVM) -ffast-math
365380
366381 ifeq ($(ARCH),x86_64)
367 OPTIMIZEVM = -O3 -fomit-frame-pointer -funroll-loops
368 # clang 3.5 doesn't support this
369 ifneq ("$(CC)", $(findstring "$(CC)", "clang" "clang++"))
370 OPTIMIZEVM += -falign-functions=2 -fstrength-reduce
371 endif
382 OPTIMIZEVM = -O3
372383 OPTIMIZE = $(OPTIMIZEVM) -ffast-math
373384 HAVE_VM_COMPILED = true
374385 else
375386 ifeq ($(ARCH),x86)
376 OPTIMIZEVM = -O3 -march=i586 -fomit-frame-pointer -funroll-loops
377 # clang 3.5 doesn't support this
378 ifneq ("$(CC)", $(findstring "$(CC)", "clang" "clang++"))
379 OPTIMIZEVM += -falign-functions=2 -fstrength-reduce
380 endif
387 OPTIMIZEVM = -O3 -march=i586
381388 OPTIMIZE = $(OPTIMIZEVM) -ffast-math
382389 HAVE_VM_COMPILED=true
383390 else
515522
516523 ifeq ($(USE_OPENAL),1)
517524 ifneq ($(USE_OPENAL_DLOPEN),1)
518 CLIENT_LIBS += -framework OpenAL
525 ifneq ($(USE_INTERNAL_LIBS),1)
526 CLIENT_CFLAGS += $(OPENAL_CFLAGS)
527 CLIENT_LIBS += $(THREAD_LIBS) $(OPENAL_LIBS)
528 else
529 CLIENT_LIBS += -framework OpenAL
530 endif
519531 endif
520532 endif
521533
530542
531543 ifeq ($(USE_LOCAL_HEADERS),1)
532544 BASE_CFLAGS += -I$(SDLHDIR)/include
545 else
546 BASE_CFLAGS += $(SDL_CFLAGS)
533547 endif
534548
535549 # We copy sdlmain before ranlib'ing it so that subversion doesn't think
536550 # the file has been modified by each build.
537 LIBSDLMAIN=$(B)/libSDL2main.a
538 LIBSDLMAINSRC=$(LIBSDIR)/macosx/libSDL2main.a
539 CLIENT_LIBS += -framework IOKit \
540 $(LIBSDIR)/macosx/libSDL2-2.0.0.dylib
541 RENDERER_LIBS += -framework OpenGL $(LIBSDIR)/macosx/libSDL2-2.0.0.dylib
542 CLIENT_EXTRA_FILES += $(LIBSDIR)/macosx/libSDL2-2.0.0.dylib $(LIBSDIR)/macosx/libopenal.dylib
551 ifeq ($(USE_INTERNAL_LIBS),1)
552 LIBSDLMAIN=$(B)/libSDL2main.a
553 LIBSDLMAINSRC=$(LIBSDIR)/macosx/libSDL2main.a
554 CLIENT_LIBS += -framework IOKit $(LIBSDIR)/macosx/libSDL2-2.0.0.dylib
555 RENDERER_LIBS += -framework OpenGL $(LIBSDIR)/macosx/libSDL2-2.0.0.dylib
556 else
557 CLIENT_LIBS += -framework IOKit $(SDL_LIBS)
558 RENDERER_LIBS += -framework OpenGL $(SDL_LIBS)
559 endif
560
561 ifeq ($(USE_INTERNAL_LIBS),1)
562 CLIENT_EXTRA_FILES += $(LIBSDIR)/macosx/libSDL2-2.0.0.dylib $(LIBSDIR)/macosx/libopenal.dylib
563 endif
543564
544565 OPTIMIZE = $(OPTIMIZEVM) -ffast-math
545566
556577 # SETUP AND BUILD -- MINGW32
557578 #############################################################################
558579
559 ifeq ($(PLATFORM),mingw32)
580 ifdef MINGW
560581
561582 ifeq ($(CROSS_COMPILING),1)
562583 # If CC is already set to something generic, we probably want to use
573594 MINGW_PREFIXES=amd64-mingw32msvc x86_64-w64-mingw32
574595 endif
575596 ifeq ($(ARCH),x86)
576 MINGW_PREFIXES=i586-mingw32msvc i686-w64-mingw32
597 MINGW_PREFIXES=i586-mingw32msvc i686-w64-mingw32 i686-pc-mingw32
577598 endif
578599
579600 ifndef CC
626647 endif
627648
628649 ifeq ($(ARCH),x86_64)
629 OPTIMIZEVM = -O3 -fno-omit-frame-pointer -funroll-loops
630 # clang 3.5 doesn't support this
631 ifneq ("$(CC)", $(findstring "$(CC)", "clang" "clang++"))
632 OPTIMIZEVM += -falign-functions=2 -fstrength-reduce
633 endif
650 OPTIMIZEVM = -O3
634651 OPTIMIZE = $(OPTIMIZEVM) -ffast-math
635652 HAVE_VM_COMPILED = true
636653 FILE_ARCH=x64
637654 endif
638655 ifeq ($(ARCH),x86)
639 OPTIMIZEVM = -O3 -march=i586 -fno-omit-frame-pointer -funroll-loops
640 # clang 3.5 doesn't support this
641 ifneq ("$(CC)", $(findstring "$(CC)", "clang" "clang++"))
642 OPTIMIZEVM += -falign-functions=2 -fstrength-reduce
643 endif
656 OPTIMIZEVM = -O3 -march=i586
644657 OPTIMIZE = $(OPTIMIZEVM) -ffast-math
645658 HAVE_VM_COMPILED = true
646659 endif
669682 RENDERER_LIBS = -lgdi32 -lole32 -lopengl32
670683
671684 ifeq ($(USE_FREETYPE),1)
672 FREETYPE_CFLAGS = -Ifreetype2
685 ifneq ($(USE_INTERNAL_FREETYPE),1)
686 FREETYPE_CFLAGS = -Ifreetype2
687 endif
673688 endif
674689
675690 ifeq ($(USE_CURL),1)
723738 SDLDLL=SDL2.dll
724739 endif
725740
726 else # ifeq mingw32
741 else # ifdef MINGW
727742
728743 #############################################################################
729744 # SETUP AND BUILD -- FREEBSD
738753 CLIENT_CFLAGS += $(SDL_CFLAGS)
739754 HAVE_VM_COMPILED = true
740755
741 OPTIMIZEVM = -O3 -funroll-loops -fomit-frame-pointer
756 OPTIMIZEVM = -O3
742757 OPTIMIZE = $(OPTIMIZEVM) -ffast-math
743758
744759 SHLIBEXT=so
791806 -pipe -DUSE_ICON -DMAP_ANONYMOUS=MAP_ANON
792807 CLIENT_CFLAGS += $(SDL_CFLAGS)
793808
794 OPTIMIZEVM = -O3 -funroll-loops -fomit-frame-pointer
809 OPTIMIZEVM = -O3
795810 OPTIMIZE = $(OPTIMIZEVM) -ffast-math
796811
797812 ifeq ($(ARCH),x86_64)
798 OPTIMIZEVM = -O3 -fomit-frame-pointer -funroll-loops
799 # clang 3.5 doesn't support this
800 ifneq ("$(CC)", $(findstring "$(CC)", "clang" "clang++"))
801 OPTIMIZEVM += -falign-functions=2 -fstrength-reduce
802 endif
813 OPTIMIZEVM = -O3
803814 OPTIMIZE = $(OPTIMIZEVM) -ffast-math
804815 HAVE_VM_COMPILED = true
805816 else
806817 ifeq ($(ARCH),x86)
807 OPTIMIZEVM = -O3 -march=i586 -fomit-frame-pointer -funroll-loops
808 # clang 3.5 doesn't support this
809 ifneq ("$(CC)", $(findstring "$(CC)", "clang" "clang++"))
810 OPTIMIZEVM += -falign-functions=2 -fstrength-reduce
811 endif
818 OPTIMIZEVM = -O3 -march=i586
812819 OPTIMIZE = $(OPTIMIZEVM) -ffast-math
813820 HAVE_VM_COMPILED=true
814821 else
936943 -pipe -DUSE_ICON
937944 CLIENT_CFLAGS += $(SDL_CFLAGS)
938945
939 OPTIMIZEVM = -O3 -funroll-loops
946 OPTIMIZEVM = -O3
940947
941948 ifeq ($(ARCH),sparc)
942949 OPTIMIZEVM += -O3 -mtune=ultrasparc3 -mv8plus -mno-faster-structs
943 # clang 3.5 doesn't support this
944 ifneq ("$(CC)", $(findstring "$(CC)", "clang" "clang++"))
945 OPTIMIZEVM += -falign-functions=2 -fstrength-reduce
946 endif
947950 HAVE_VM_COMPILED=true
948951 else
949952 ifeq ($(ARCH),x86)
950 OPTIMIZEVM += -march=i586 -fomit-frame-pointer
951 # clang 3.5 doesn't support this
952 ifneq ("$(CC)", $(findstring "$(CC)", "clang" "clang++"))
953 OPTIMIZEVM += -falign-functions=2 -fstrength-reduce
954 endif
953 OPTIMIZEVM += -march=i586
955954 HAVE_VM_COMPILED=true
956955 BASE_CFLAGS += -m32
957956 CLIENT_CFLAGS += -I/usr/X11/include/NVIDIA
987986
988987 endif #Linux
989988 endif #darwin
990 endif #mingw32
989 endif #MINGW
991990 endif #FreeBSD
992991 endif #OpenBSD
993992 endif #NetBSD
10371036
10381037 ifneq ($(BUILD_GAME_SO),0)
10391038 ifneq ($(BUILD_BASEGAME),0)
1040 ifeq ($(PLATFORM),mingw32)
1039 ifdef MINGW
10411040 TARGETS += \
10421041 $(B)/$(BASEGAME)/cgame_sp_$(SHLIBNAME) \
10431042 $(B)/$(BASEGAME)/qagame_sp_$(SHLIBNAME) \
11441143 BASE_CFLAGS += -DUSE_INTERNAL_JPEG
11451144 BASE_CFLAGS += -I$(JPDIR)
11461145 else
1147 # libjpeg doesn't have pkg-config yet, but let users override with
1148 # "make JPEG_CFLAGS=-I/opt/jpeg/include JPEG_LIBS='-L/opt/jpeg/lib -ljpeg'"
1149 # if they need to
1150 JPEG_CFLAGS ?=
1151 JPEG_LIBS ?= -ljpeg
1146 # IJG libjpeg doesn't have pkg-config, but libjpeg-turbo uses libjpeg.pc;
1147 # we fall back to hard-coded answers if libjpeg.pc is unavailable
1148 JPEG_CFLAGS ?= $(shell pkg-config --silence-errors --cflags libjpeg || true)
1149 JPEG_LIBS ?= $(shell pkg-config --silence-errors --libs libjpeg || echo -ljpeg)
11521150 BASE_CFLAGS += $(JPEG_CFLAGS)
11531151 RENDERER_LIBS += $(JPEG_LIBS)
11541152 endif
11551153
11561154 ifeq ($(USE_FREETYPE),1)
1157 FREETYPE_CFLAGS ?= $(shell pkg-config --silence-errors --cflags freetype2 || true)
1158 FREETYPE_LIBS ?= $(shell pkg-config --silence-errors --libs freetype2 || echo -lfreetype)
1159
1155 ifeq ($(USE_INTERNAL_FREETYPE),1)
1156 FREETYPE_CFLAGS += -I$(FTDIR)/include -DFT2_BUILD_LIBRARY
1157 else
1158 FREETYPE_CFLAGS ?= $(shell pkg-config --silence-errors --cflags freetype2 || true)
1159 FREETYPE_LIBS ?= $(shell pkg-config --silence-errors --libs freetype2 || echo -lfreetype)
1160 endif
11601161 BASE_CFLAGS += -DBUILD_FREETYPE $(FREETYPE_CFLAGS)
11611162 RENDERER_LIBS += $(FREETYPE_LIBS)
11621163 endif
13531354 @echo " COMPILE_ARCH: $(COMPILE_ARCH)"
13541355 @echo " CC: $(CC)"
13551356 @echo " CXX: $(CXX)"
1356 ifeq ($(PLATFORM),mingw32)
1357 ifdef MINGW
13571358 @echo " WINDRES: $(WINDRES)"
13581359 endif
13591360 @echo ""
16921693 $(B)/client/con_log.o \
16931694 $(B)/client/sys_main.o
16941695
1695 ifeq ($(PLATFORM),mingw32)
1696 ifdef MINGW
16961697 Q3OBJ += \
16971698 $(B)/client/con_passive.o
16981699 else
17131714 $(B)/rend2/tr_font.o \
17141715 $(B)/rend2/tr_glsl.o \
17151716 $(B)/rend2/tr_image.o \
1717 $(B)/rend2/tr_image_bmp.o \
1718 $(B)/rend2/tr_image_jpg.o \
1719 $(B)/rend2/tr_image_pcx.o \
17161720 $(B)/rend2/tr_image_png.o \
1717 $(B)/rend2/tr_image_jpg.o \
1718 $(B)/rend2/tr_image_bmp.o \
17191721 $(B)/rend2/tr_image_tga.o \
1720 $(B)/rend2/tr_image_pcx.o \
17211722 $(B)/rend2/tr_init.o \
17221723 $(B)/rend2/tr_light.o \
17231724 $(B)/rend2/tr_main.o \
17801781 $(B)/renderer/tr_flares.o \
17811782 $(B)/renderer/tr_font.o \
17821783 $(B)/renderer/tr_image.o \
1784 $(B)/renderer/tr_image_bmp.o \
1785 $(B)/renderer/tr_image_jpg.o \
1786 $(B)/renderer/tr_image_pcx.o \
17831787 $(B)/renderer/tr_image_png.o \
1784 $(B)/renderer/tr_image_jpg.o \
1785 $(B)/renderer/tr_image_bmp.o \
17861788 $(B)/renderer/tr_image_tga.o \
1787 $(B)/renderer/tr_image_pcx.o \
17881789 $(B)/renderer/tr_init.o \
17891790 $(B)/renderer/tr_light.o \
17901791 $(B)/renderer/tr_main.o \
18711872 $(B)/renderer/jquant1.o \
18721873 $(B)/renderer/jquant2.o \
18731874 $(B)/renderer/jutils.o
1875 endif
1876
1877 ifeq ($(USE_FREETYPE),1)
1878 ifneq ($(USE_INTERNAL_FREETYPE),0)
1879 FTOBJ += \
1880 $(B)/renderer/ftsystem.o \
1881 $(B)/renderer/ftdebug.o \
1882 $(B)/renderer/ftinit.o \
1883 $(B)/renderer/ftbase.o \
1884 $(B)/renderer/ftbbox.o \
1885 $(B)/renderer/ftbdf.o \
1886 $(B)/renderer/ftbitmap.o \
1887 $(B)/renderer/ftcid.o \
1888 $(B)/renderer/ftfstype.o \
1889 $(B)/renderer/ftgasp.o \
1890 $(B)/renderer/ftglyph.o \
1891 $(B)/renderer/ftgxval.o \
1892 $(B)/renderer/ftlcdfil.o \
1893 $(B)/renderer/ftmm.o \
1894 $(B)/renderer/ftotval.o \
1895 $(B)/renderer/ftpatent.o \
1896 $(B)/renderer/ftpfr.o \
1897 $(B)/renderer/ftstroke.o \
1898 $(B)/renderer/ftsynth.o \
1899 $(B)/renderer/fttype1.o \
1900 $(B)/renderer/ftwinfnt.o \
1901 $(B)/renderer/ftxf86.o \
1902 $(B)/renderer/truetype.o \
1903 $(B)/renderer/type1.o \
1904 $(B)/renderer/cff.o \
1905 $(B)/renderer/type1cid.o \
1906 $(B)/renderer/pfr.o \
1907 $(B)/renderer/type42.o \
1908 $(B)/renderer/winfnt.o \
1909 $(B)/renderer/pcf.o \
1910 $(B)/renderer/bdf.o \
1911 $(B)/renderer/sfnt.o \
1912 $(B)/renderer/autofit.o \
1913 $(B)/renderer/pshinter.o \
1914 $(B)/renderer/raster.o \
1915 $(B)/renderer/smooth.o \
1916 $(B)/renderer/ftcache.o \
1917 $(B)/renderer/ftgzip.o \
1918 $(B)/renderer/ftlzw.o \
1919 $(B)/renderer/ftbzip2.o \
1920 $(B)/renderer/psaux.o \
1921 $(B)/renderer/psnames.o
1922 endif
18741923 endif
18751924
18761925 ifeq ($(ARCH),x86)
20332082 $(B)/client/internal.o \
20342083 $(B)/client/opusfile.o \
20352084 $(B)/client/stream.o
2036 ifeq ($(PLATFORM),mingw32)
2085 ifdef MINGW
20372086 Q3OBJ += \
20382087 $(B)/client/wincerts.o
20392088 endif
20982147 endif
20992148 endif
21002149
2101 ifeq ($(PLATFORM),mingw32)
2150 ifdef MINGW
21022151 Q3OBJ += \
21032152 $(B)/client/win_resource.o \
21042153 $(B)/client/sys_win32.o
21242173 -o $@ $(Q3OBJ) \
21252174 $(LIBSDLMAIN) $(CLIENT_LIBS) $(LIBS)
21262175
2127 $(B)/renderer_sp_opengl1_$(SHLIBNAME): $(Q3ROBJ) $(JPGOBJ)
2176 $(B)/renderer_sp_opengl1_$(SHLIBNAME): $(Q3ROBJ) $(JPGOBJ) $(FTOBJ)
21282177 $(echo_cmd) "LD $@"
2129 $(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(Q3ROBJ) $(JPGOBJ) \
2178 $(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(Q3ROBJ) $(JPGOBJ) $(FTOBJ) \
21302179 $(THREAD_LIBS) $(LIBSDLMAIN) $(RENDERER_LIBS) $(LIBS)
21312180
2132 $(B)/renderer_sp_rend2_$(SHLIBNAME): $(Q3R2OBJ) $(Q3R2STRINGOBJ) $(JPGOBJ)
2181 $(B)/renderer_sp_rend2_$(SHLIBNAME): $(Q3R2OBJ) $(Q3R2STRINGOBJ) $(JPGOBJ) $(FTOBJ)
21332182 $(echo_cmd) "LD $@"
2134 $(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(Q3R2OBJ) $(Q3R2STRINGOBJ) $(JPGOBJ) \
2183 $(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(Q3R2OBJ) $(Q3R2STRINGOBJ) $(JPGOBJ) $(FTOBJ) \
21352184 $(THREAD_LIBS) $(LIBSDLMAIN) $(RENDERER_LIBS) $(LIBS)
21362185 else
2137 $(B)/$(CLIENTBIN)$(FULLBINEXT): $(Q3OBJ) $(Q3ROBJ) $(JPGOBJ) $(LIBSDLMAIN)
2186 $(B)/$(CLIENTBIN)$(FULLBINEXT): $(Q3OBJ) $(Q3ROBJ) $(JPGOBJ) $(FTOBJ) $(LIBSDLMAIN)
21382187 $(echo_cmd) "LD $@"
21392188 $(Q)$(CXX) $(CLIENT_CFLAGS) $(CFLAGS) $(CLIENT_LDFLAGS) $(LDFLAGS) \
2140 -o $@ $(Q3OBJ) $(Q3ROBJ) $(JPGOBJ) \
2189 -o $@ $(Q3OBJ) $(Q3ROBJ) $(JPGOBJ) $(FTOBJ) \
21412190 $(LIBSDLMAIN) $(CLIENT_LIBS) $(RENDERER_LIBS) $(LIBS)
21422191
2143 $(B)/$(CLIENTBIN)_rend2$(FULLBINEXT): $(Q3OBJ) $(Q3R2OBJ) $(Q3R2STRINGOBJ) $(JPGOBJ) $(LIBSDLMAIN)
2192 $(B)/$(CLIENTBIN)_rend2$(FULLBINEXT): $(Q3OBJ) $(Q3R2OBJ) $(Q3R2STRINGOBJ) $(JPGOBJ) $(FTOBJ) $(LIBSDLMAIN)
21442193 $(echo_cmd) "LD $@"
21452194 $(Q)$(CXX) $(CLIENT_CFLAGS) $(CFLAGS) $(CLIENT_LDFLAGS) $(LDFLAGS) \
2146 -o $@ $(Q3OBJ) $(Q3R2OBJ) $(Q3R2STRINGOBJ) $(JPGOBJ) \
2195 -o $@ $(Q3OBJ) $(Q3R2OBJ) $(Q3R2STRINGOBJ) $(JPGOBJ) $(FTOBJ) \
21472196 $(LIBSDLMAIN) $(CLIENT_LIBS) $(RENDERER_LIBS) $(LIBS)
21482197 endif
21492198
22672316 endif
22682317 endif
22692318
2270 ifeq ($(PLATFORM),mingw32)
2319 ifdef MINGW
22712320 Q3DOBJ += \
22722321 $(B)/ded/win_resource.o \
22732322 $(B)/ded/sys_win32.o \
23302379 Q3CGOBJ = $(Q3CGOBJ_) $(B)/$(BASEGAME)/cgame/cg_syscalls.o
23312380 Q3CGVMOBJ = $(Q3CGOBJ_:%.o=%.asm)
23322381
2333 ifeq ($(PLATFORM),mingw32)
2382 ifdef MINGW
23342383 $(B)/$(BASEGAME)/cgame_sp_$(SHLIBNAME): $(Q3CGOBJ)
23352384 $(echo_cmd) "LD $@"
23362385 $(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(Q3CGOBJ)
24052454 Q3GOBJ = $(Q3GOBJ_) $(B)/$(BASEGAME)/game/g_syscalls.o
24062455 Q3GVMOBJ = $(Q3GOBJ_:%.o=%.asm)
24072456
2408 ifeq ($(PLATFORM),mingw32)
2457 ifdef MINGW
24092458 $(B)/$(BASEGAME)/qagame_sp_$(SHLIBNAME): $(Q3GOBJ)
24102459 $(echo_cmd) "LD $@"
24112460 $(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(Q3GOBJ)
24392488 Q3UIOBJ = $(Q3UIOBJ_) $(B)/$(BASEGAME)/ui/ui_syscalls.o
24402489 Q3UIVMOBJ = $(Q3UIOBJ_:%.o=%.asm)
24412490
2442 ifeq ($(PLATFORM),mingw32)
2491 ifdef MINGW
24432492 $(B)/$(BASEGAME)/ui_sp_$(SHLIBNAME): $(Q3UIOBJ)
24442493 $(echo_cmd) "LD $@"
24452494 $(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(Q3UIOBJ)
25362585 $(B)/rend2/%.o: $(R2DIR)/%.c
25372586 $(DO_REF_CC)
25382587
2588 $(B)/renderer/%.o: $(FTDIR)/src/autofit/%.c
2589 $(DO_REF_CC)
2590
2591 $(B)/renderer/%.o: $(FTDIR)/src/base/%.c
2592 $(DO_REF_CC)
2593
2594 $(B)/renderer/%.o: $(FTDIR)/src/bdf/%.c
2595 $(DO_REF_CC)
2596
2597 $(B)/renderer/%.o: $(FTDIR)/src/bzip2/%.c
2598 $(DO_REF_CC)
2599
2600 $(B)/renderer/%.o: $(FTDIR)/src/cache/%.c
2601 $(DO_REF_CC)
2602
2603 $(B)/renderer/%.o: $(FTDIR)/src/cff/%.c
2604 $(DO_REF_CC)
2605
2606 $(B)/renderer/%.o: $(FTDIR)/src/cid/%.c
2607 $(DO_REF_CC)
2608
2609 $(B)/renderer/%.o: $(FTDIR)/src/gxvalid/%.c
2610 $(DO_REF_CC)
2611
2612 $(B)/renderer/%.o: $(FTDIR)/src/gzip/%.c
2613 $(DO_REF_CC)
2614
2615 $(B)/renderer/%.o: $(FTDIR)/src/lzw/%.c
2616 $(DO_REF_CC)
2617
2618 $(B)/renderer/%.o: $(FTDIR)/src/otvalid/%.c
2619 $(DO_REF_CC)
2620
2621 $(B)/renderer/%.o: $(FTDIR)/src/pcf/%.c
2622 $(DO_REF_CC)
2623
2624 $(B)/renderer/%.o: $(FTDIR)/src/pfr/%.c
2625 $(DO_REF_CC)
2626
2627 $(B)/renderer/%.o: $(FTDIR)/src/psaux/%.c
2628 $(DO_REF_CC)
2629
2630 $(B)/renderer/%.o: $(FTDIR)/src/pshinter/%.c
2631 $(DO_REF_CC)
2632
2633 $(B)/renderer/%.o: $(FTDIR)/src/psnames/%.c
2634 $(DO_REF_CC)
2635
2636 $(B)/renderer/%.o: $(FTDIR)/src/raster/%.c
2637 $(DO_REF_CC)
2638
2639 $(B)/renderer/%.o: $(FTDIR)/src/sfnt/%.c
2640 $(DO_REF_CC)
2641
2642 $(B)/renderer/%.o: $(FTDIR)/src/smooth/%.c
2643 $(DO_REF_CC)
2644
2645 $(B)/renderer/%.o: $(FTDIR)/src/tools/%.c
2646 $(DO_REF_CC)
2647
2648 $(B)/renderer/%.o: $(FTDIR)/src/truetype/%.c
2649 $(DO_REF_CC)
2650
2651 $(B)/renderer/%.o: $(FTDIR)/src/type1/%.c
2652 $(DO_REF_CC)
2653
2654 $(B)/renderer/%.o: $(FTDIR)/src/type42/%.c
2655 $(DO_REF_CC)
2656
2657 $(B)/renderer/%.o: $(FTDIR)/src/winfonts/%.c
2658 $(DO_REF_CC)
25392659
25402660 $(B)/ded/%.o: $(ASMDIR)/%.s
25412661 $(DO_AS)
26212741 # MISC
26222742 #############################################################################
26232743
2624 OBJ = $(Q3OBJ) $(Q3ROBJ) $(Q3R2OBJ) $(Q3DOBJ) $(JPGOBJ) \
2744 OBJ = $(Q3OBJ) $(Q3ROBJ) $(Q3R2OBJ) $(Q3DOBJ) $(JPGOBJ) $(FTOBJ) \
26252745 $(Q3GOBJ) $(Q3CGOBJ) $(Q3UIOBJ) \
26262746 $(Q3GVMOBJ) $(Q3CGVMOBJ) $(Q3UIVMOBJ)
26272747 TOOLSOBJ = $(LBURGOBJ) $(Q3CPPOBJ) $(Q3RCCOBJ) $(Q3LCCOBJ) $(Q3ASMOBJ)
0 To run iortcw on the Raspberry Pi requires SDL2.
0 To run iortcw on the Raspberry Pi requires SDL2 and at least 128M for GPU memory.
1
2 (Under Raspbian, you can set the GPU memory using the raspi-config tool under Advanced Options->Memory Split)
13
24 SDL2 will need to be built in a particular way to have hardware accelerated
35 graphics.
1820
1921 ./configure --disable-video-x11 --disable-video-opengl
2022
23 Note: On the newer Raspberry Pi 2 (due to a change in the toolchain naming) use:
24
25 ./configure --host=armv7l-raspberry-linux-gnueabihf --disable-video-x11 --disable-video-opengl
26
2127 After that has completed, type:
2228 make
2329
3434 ALIGN 16
3535 ssemask DWORD 0FFFFFFFFh, 0FFFFFFFFh, 0FFFFFFFFh, 00000000h
3636 ssecw DWORD 00001F80h
37
38 IFNDEF idx64
39 fpucw WORD 037Fh
40 ENDIF
4137
4238 .code
4339
897897 return y;
898898 }
899899
900 if ( !cgs.clientinfo[clientNum].infoValid ) {
901 cg.attackerTime = 0;
902 return y;
903 }
904
900905 t = cg.time - cg.attackerTime;
901906 if ( t > ATTACKER_HEAD_TIME ) {
902907 cg.attackerTime = 0;
23172322 trap_R_DrawStretchPic( x + cg.refdef.x + 0.5 * ( cg.refdef.width - w ),
23182323 y + cg.refdef.y + 0.5 * ( cg.refdef.height - h ),
23192324 w, h, 0, 0, 1, 1, hShader );
2325
2326 trap_R_SetColor( NULL );
23202327 }
23212328
23222329 /*
545545 int CG_WaterLevel(centity_t *cent) {
546546 vec3_t point;
547547 int contents, sample1, sample2, anim, waterlevel;
548
548 int viewheight;
549
550 anim = cent->currentState.legsAnim & ~ANIM_TOGGLEBIT;
551
552 if (anim == LEGS_WALKCR || anim == LEGS_IDLECR) {
553 viewheight = CROUCH_VIEWHEIGHT;
554 } else {
555 viewheight = DEFAULT_VIEWHEIGHT;
556 }
557
558 //
549559 // get waterlevel, accounting for ducking
560 //
550561 waterlevel = 0;
551 VectorCopy(cent->lerpOrigin, point);
552 point[2] += MINS_Z + 1;
553 anim = cent->currentState.legsAnim & ~ANIM_TOGGLEBIT;
554
555 if (anim == LEGS_WALKCR || anim == LEGS_IDLECR) {
556 point[2] += CROUCH_VIEWHEIGHT;
557 } else {
558 point[2] += DEFAULT_VIEWHEIGHT;
559 }
560
562
563 point[0] = cent->lerpOrigin[0];
564 point[1] = cent->lerpOrigin[1];
565 point[2] = cent->lerpOrigin[2] + MINS_Z + 1;
561566 contents = CG_PointContents(point, -1);
562567
563568 if (contents & MASK_WATER) {
564 sample2 = point[2] - MINS_Z;
569 sample2 = viewheight - MINS_Z;
565570 sample1 = sample2 / 2;
566571 waterlevel = 1;
567572 point[2] = cent->lerpOrigin[2] + MINS_Z + sample1;
701706 }
702707
703708 // play a gurp sound instead of a normal pain sound
704 if (CG_WaterLevel(cent) >= 1) {
709 if (CG_WaterLevel(cent) == 3) {
705710 if (rand()&1) {
706711 trap_S_StartSound(NULL, cent->currentState.number, CHAN_VOICE, CG_CustomSound(cent->currentState.number, "sound/player/gurp1.wav"));
707712 } else {
23632368 case EV_DEATH3:
23642369 DEBUGNAME( "EV_DEATHx" );
23652370
2366 if (CG_WaterLevel(cent) >= 1) {
2371 if (CG_WaterLevel(cent) == 3) {
23672372 trap_S_StartSound(NULL, es->number, CHAN_VOICE, CG_CustomSound(es->number, "sound/player/gurp1.wav"));
23682373 } else {
23692374 trap_S_StartSound(NULL, es->number, CHAN_VOICE, CG_CustomSound(es->number, va("*death%i.wav", event - EV_DEATH1 + 1)));
16771677 extern vmCvar_t cg_ignore;
16781678 extern vmCvar_t cg_simpleItems;
16791679 extern vmCvar_t cg_fov;
1680 extern vmCvar_t cg_fixedAspect;
16801681 extern vmCvar_t cg_zoomFov;
16811682 extern vmCvar_t cg_zoomDefaultBinoc;
16821683 extern vmCvar_t cg_zoomDefaultSniper;
163163 vmCvar_t cg_ignore;
164164 vmCvar_t cg_simpleItems;
165165 vmCvar_t cg_fov;
166 vmCvar_t cg_fixedAspect;
166167 vmCvar_t cg_zoomFov;
167168 vmCvar_t cg_zoomStepBinoc;
168169 vmCvar_t cg_zoomStepSniper;
294295 { &cg_zoomStepSnooper, "cg_zoomStepSnooper", "5", CVAR_ARCHIVE },
295296 { &cg_zoomStepFG, "cg_zoomStepFG", "10", CVAR_ARCHIVE }, //----(SA) added
296297 { &cg_fov, "cg_fov", "90", CVAR_ARCHIVE }, // NOTE: there is already a dmflag (DF_FIXED_FOV) to allow server control of this cheat
298 { &cg_fixedAspect, "cg_fixedAspect", "0", CVAR_ARCHIVE }, // Essentially the same as setting DF_FIXED_FOV for widescreen aspects
297299 { &cg_viewsize, "cg_viewsize", "100", CVAR_ARCHIVE },
298300 { &cg_letterbox, "cg_letterbox", "0", CVAR_TEMP }, //----(SA) added
299301 { &cg_shadows, "cg_shadows", "1", CVAR_ARCHIVE },
435435 cgs.teamVoteNo[num - CS_TEAMVOTE_NO] = atoi( str );
436436 cgs.teamVoteModified[num - CS_TEAMVOTE_NO] = qtrue;
437437 } else if ( num >= CS_TEAMVOTE_STRING && num <= CS_TEAMVOTE_STRING + 1 ) {
438 Q_strncpyz( cgs.teamVoteString[num - CS_TEAMVOTE_STRING], str, sizeof( cgs.teamVoteString ) );
438 Q_strncpyz( cgs.teamVoteString[num - CS_TEAMVOTE_STRING], str, sizeof( cgs.teamVoteString[0] ) );
439439 trap_S_StartLocalSound( cgs.media.voteNow, CHAN_ANNOUNCER );
440440 #endif
441441 } else if ( num == CS_INTERMISSION ) {
750750 #ifdef MISSIONPACK
751751 if ( cg_singlePlayerActive.integer ) {
752752 trap_Cvar_Set( "ui_matchStartTime", va( "%i", cg.time ) );
753 if ( cg_recordSPDemo.integer && cg_recordSPDemoName.string && *cg_recordSPDemoName.string ) {
753 if ( cg_recordSPDemo.integer && *cg_recordSPDemoName.string ) {
754754 trap_SendConsoleCommand( va( "set g_synchronousclients 1 ; record %s \n", cg_recordSPDemoName.string ) );
755755 }
756756 }
774774 */
775775 #define WAVE_AMPLITUDE 1
776776 #define WAVE_FREQUENCY 0.4
777 #define STANDARD_ASPECT_RATIO ( (float)640 / (float)480 )
777778
778779 static int CG_CalcFov( void ) {
779780 static float lastfov = 90; // for transitions back from zoomed in modes
803804 fov_x = 90;
804805 } else {
805806 // user selectable
806 if ( cgs.dmflags & DF_FIXED_FOV ) {
807 if ( ( cgs.dmflags & DF_FIXED_FOV ) || cg_fixedAspect.value ) {
807808 // dmflag to prevent wide fov for all clients
808809 fov_x = 90;
809810 } else {
866867 fov_x = 55;
867868 }
868869
870 if ( cg_fixedAspect.value ) {
871 float aspectRatio = (float)cg.refdef.width / (float)cg.refdef.height;
872
873 if ( aspectRatio > STANDARD_ASPECT_RATIO )
874 fov_x = RAD2DEG( 2 * atan2( ( aspectRatio / STANDARD_ASPECT_RATIO ) * tan( DEG2RAD( fov_x ) * 0.5 ), 1 ) );
875 fov_x = min( fov_x, 160 );
876 }
877
869878 x = cg.refdef.width / tan( fov_x / 360 * M_PI );
870879 fov_y = atan2( cg.refdef.height, x );
871880 fov_y = fov_y * 360 / M_PI;
10491058 VectorCopy( angles, cg.refdefViewAngles );
10501059 AnglesToAxis( cg.refdefViewAngles, cg.refdef.viewaxis );
10511060
1061 if ( cg_fixedAspect.value ) {
1062 float aspectRatio = (float)cg.refdef.width / (float)cg.refdef.height;
1063
1064 if ( aspectRatio > STANDARD_ASPECT_RATIO )
1065 fov = RAD2DEG( 2 * atan2( ( aspectRatio / STANDARD_ASPECT_RATIO ) * tan( DEG2RAD( fov ) * 0.5 ), 1 ) );
1066 fov = min( fov, 160 );
1067 }
1068
10521069 x = cg.refdef.width / tan( fov / 360 * M_PI );
10531070 cg.refdef.fov_y = atan2( cg.refdef.height, x );
10541071 cg.refdef.fov_y = cg.refdef.fov_y * 360 / M_PI;
12981315 fov_x = 90;
12991316 } else {
13001317 // user selectable
1301 if ( cgs.dmflags & DF_FIXED_FOV ) {
1318 if ( ( cgs.dmflags & DF_FIXED_FOV ) || cg_fixedAspect.value ) {
13021319 // dmflag to prevent wide fov for all clients
13031320 fov_x = 90;
13041321 } else {
13531370 fov_x = 55;
13541371 }
13551372
1373 if ( cg_fixedAspect.value ) {
1374 float aspectRatio = (float)cg.refdef.width / (float)cg.refdef.height;
1375
1376 if ( aspectRatio > STANDARD_ASPECT_RATIO )
1377 fov_x = RAD2DEG( 2 * atan2( ( aspectRatio / STANDARD_ASPECT_RATIO ) * tan( DEG2RAD( fov_x ) * 0.5 ), 1 ) );
1378 fov_x = min( fov_x, 160 );
1379 }
1380
13561381 x = cg.refdef.width / tan( fov_x / 360 * M_PI );
13571382 fov_y = atan2( cg.refdef.height, x );
13581383 fov_y = fov_y * 360 / M_PI;
29962996
29972997
29982998 // drop gun lower at higher fov
2999 if ( cg_fov.integer > 90 ) {
2999 if ( cg_fov.integer > 90 && !cg_fixedAspect.value ) {
30003000 fovOffset = -0.2 * ( cg_fov.integer - 90 );
30013001 } else {
30023002 fovOffset = 0;
119119 buffer[ bufIndex + 1 ] = (byte)( ( x >> 8 ) & 0xFF );
120120 bufIndex += 2;
121121 }
122
123 /*
124 ===============
125 WRITE_1BYTES
126 ===============
127 */
128 #if 0
129 static ID_INLINE void WRITE_1BYTES( int x ) {
130 buffer[ bufIndex ] = x;
131 bufIndex += 1;
132 }
133 #endif
134122
135123 /*
136124 ===============
111111 qboolean looping, holdAtEnd, dirty, alterGameState, silent, shader, letterBox, sound;
112112 fileHandle_t iFile;
113113 e_status status;
114 unsigned int startTime;
115 unsigned int lastTime;
114 int startTime;
115 int lastTime;
116116 long tfps;
117117 long RoQPlayed;
118118 long ROQSize;
165165 } serverStatus_t;
166166
167167 serverStatus_t cl_serverStatusList[MAX_SERVERSTATUSREQUESTS];
168 int serverStatusCount;
169168
170169 #if 0 // MrE defined __USEA3D && defined __A3D_GEOM
171170 void hA3Dg_ExportRenderGeom( refexport_t *incoming_re );
23352334 =================
23362335 */
23372336 void CL_CheckForResend( void ) {
2338 int port, i;
2337 int port;
23392338 char info[MAX_INFO_STRING];
2340 char data[MAX_INFO_STRING];
2339 char data[MAX_INFO_STRING + 10];
23412340
23422341 // don't send anything if playing back a demo
23432342 if ( clc.demoplaying ) {
23902389 Info_SetValueForKey( info, "qport", va( "%i", port ) );
23912390 Info_SetValueForKey( info, "challenge", va( "%i", clc.challenge ) );
23922391
2393 strcpy(data, "connect ");
2394 // TTimo adding " " around the userinfo string to avoid truncated userinfo on the server
2395 // (Com_TokenizeString tokenizes around spaces)
2396 data[8] = '"';
2397
2398 for(i=0;i<strlen(info);i++) {
2399 data[9+i] = info[i]; // + (clc.challenge)&0x3;
2400 }
2401 data[9+i] = '"';
2402 data[10+i] = 0;
2403
2404 // NOTE TTimo don't forget to set the right data length!
2405 NET_OutOfBandData( NS_CLIENT, clc.serverAddress, (byte *) &data[0], i+10 );
2392 Com_sprintf( data, sizeof(data), "connect \"%s\"", info );
2393 NET_OutOfBandData( NS_CLIENT, clc.serverAddress, (byte *) data, strlen ( data ) );
24062394 // the most current userinfo has been sent, so watch for any
24072395 // newer changes to userinfo variables
24082396 cvar_modifiedFlags &= ~CVAR_USERINFO;
41544142 oldestTime = cl_serverStatusList[i].startTime;
41554143 }
41564144 }
4157 if ( oldest != -1 ) {
4158 return &cl_serverStatusList[oldest];
4159 }
4160 serverStatusCount++;
4161 return &cl_serverStatusList[serverStatusCount & ( MAX_SERVERSTATUSREQUESTS - 1 )];
4145 return &cl_serverStatusList[oldest];
41624146 }
41634147
41644148 /*
13591359 BotAI_Trace( &trace, start, NULL, NULL, end, passent, contents_mask );
13601360 //if water was hit
13611361 waterfactor = 1.0;
1362 //note: trace.contents is always 0, see BotAI_Trace
13621363 if ( trace.contents & ( CONTENTS_LAVA | CONTENTS_SLIME | CONTENTS_WATER ) ) {
13631364 //if the water surface is translucent
13641365 if ( 1 ) {
5151 extern int Q_strncmp ( const char * s1 , const char * s2 , int n ) ;
5252 extern int Q_stricmpn ( const char * s1 , const char * s2 , int n ) ;
5353 extern void Q_strncpyz ( char * dest , const char * src , int destsize ) ;
54 #ifdef _MSC_VER
5455 extern int Q_vsnprintf ( char * str , size_t size , const char * format , va_list ap ) ;
56 #endif
5557 extern qboolean Q_isintegral ( float f ) ;
5658 extern qboolean Q_isanumber ( const char * s ) ;
5759 extern int Q_isforfilename ( int c ) ;
5151 {"Q_strncmp", (byte *)Q_strncmp},
5252 {"Q_stricmpn", (byte *)Q_stricmpn},
5353 {"Q_strncpyz", (byte *)Q_strncpyz},
54 #ifdef _MSC_VER
5455 {"Q_vsnprintf", (byte *)Q_vsnprintf},
56 #endif
5557 {"Q_isintegral", (byte *)Q_isintegral},
5658 {"Q_isanumber", (byte *)Q_isanumber},
5759 {"Q_isforfilename", (byte *)Q_isforfilename},
883883 }
884884
885885 if ( i == facet->numBorders ) {
886 if ( facet->numBorders > 4 + 6 + 16 ) {
886 if ( facet->numBorders >= 4 + 6 + 16 ) {
887887 Com_Printf( "ERROR: too many bevels\n" );
888 continue;
888889 }
889890 facet->borderPlanes[facet->numBorders] = CM_FindPlane2( plane, &flipped );
890891 facet->borderNoAdjust[facet->numBorders] = 0;
953954 }
954955
955956 if ( i == facet->numBorders ) {
956 if ( facet->numBorders > 4 + 6 + 16 ) {
957 if ( facet->numBorders >= 4 + 6 + 16 ) {
957958 Com_Printf( "ERROR: too many bevels\n" );
959 continue;
958960 }
959961 facet->borderPlanes[facet->numBorders] = CM_FindPlane2( plane, &flipped );
960962
993995
994996 #ifndef BSPC
995997 //add opposite plane
998 if ( facet->numBorders >= 4 + 6 + 16 ) {
999 Com_Printf( "ERROR: too many bevels\n" );
1000 return;
1001 }
9961002 facet->borderPlanes[facet->numBorders] = facet->surfacePlane;
9971003 facet->borderNoAdjust[facet->numBorders] = 0;
9981004 facet->borderInward[facet->numBorders] = qtrue;
31783178
31793179 Com_Printf( "Com_RandomBytes: using weak randomization\n" );
31803180 for( i = 0; i < len; i++ )
3181 string[i] = (unsigned char)( rand() % 255 );
3181 string[i] = (unsigned char)( rand() % 256 );
31823182 }
31833183
31843184
543543
544544 // Skip creation of the root directory as it will always be there
545545 ofs = strchr( path, PATH_SEP );
546 ofs++;
546 if ( ofs != NULL ) {
547 ofs++;
548 }
547549
548550 for (; ofs != NULL && *ofs ; ofs++) {
549551 if (*ofs == PATH_SEP) {
168168
169169 //================================================================= LINUX ===
170170
171 #if defined(__linux__) || defined(__FreeBSD_kernel__)
171 #if defined(__linux__) || defined(__FreeBSD_kernel__) || defined(__GNU__)
172172
173173 #include <endian.h>
174174
175175 #if defined(__linux__)
176176 #define OS_STRING "linux"
177 #else
177 #elif defined(__FreeBSD_kernel__)
178178 #define OS_STRING "kFreeBSD"
179 #else
180 #define OS_STRING "GNU"
179181 #endif
180182
181183 #define ID_INLINE inline
204206 #define ARCH_STRING "sparc"
205207 #elif defined __arm__
206208 #define ARCH_STRING "arm"
209 #elif defined __aarch64__
210 #define ARCH_STRING "aarch64"
207211 #elif defined __cris__
208212 #define ARCH_STRING "cris"
209213 #elif defined __hppa__
14801480 *o = 0;
14811481
14821482 if ( !strcmp( key, pkey ) ) {
1483 strcpy( start, s ); // remove this part
1483 memmove(start, s, strlen(s) + 1); // remove this part
14841484 return;
14851485 }
14861486
00 /* unzip.c -- IO for uncompress .zip files using zlib
1
2 Modified for Quake III Arena to use the Z_Malloc() memory pool;
3 this means a system copy of minizip is not a suitable replacement.
4
5 Based on minizip:
6
17 Version 1.01e, February 12th, 2005
28
39 Copyright (C) 1998-2005 Gilles Vollant
712718
713719 if (lSeek!=0)
714720 {
715 if (ZSEEK(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)!=0)
716 err=UNZ_ERRNO;
721 if (ZSEEK(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)!=0)
722 err=UNZ_ERRNO;
717723 }
718724 if ((file_info.size_file_comment>0) && (commentBufferSize>0))
719725 if (ZREAD(s->z_filefunc, s->filestream,szComment,uSizeRead)!=uSizeRead)
11391145 pfile_in_zip_read_info->stream.avail_in = 0;
11401146
11411147 if (inflateInit2(&pfile_in_zip_read_info->stream, -MAX_WBITS) == Z_OK)
1142 pfile_in_zip_read_info->stream_initialised=1;
1148 pfile_in_zip_read_info->stream_initialised=1;
11431149 else
11441150 {
11451151 TRYFREE(pfile_in_zip_read_info);
202202
203203
204204 #define MASK_REG(modrm, mask) \
205 EmitString("81"); \
206 EmitString((modrm)); \
207 Emit4((mask))
205 do { \
206 EmitString("81"); \
207 EmitString((modrm)); \
208 Emit4((mask)); \
209 } while(0)
208210
209211 // add bl, bytes
210212 #define STACK_PUSH(bytes) \
211 EmitString("80 C3"); \
212 Emit1(bytes)
213 do { \
214 EmitString("80 C3"); \
215 Emit1(bytes); \
216 } while(0)
213217
214218 // sub bl, bytes
215219 #define STACK_POP(bytes) \
216 EmitString("80 EB"); \
217 Emit1(bytes)
220 do { \
221 EmitString("80 EB"); \
222 Emit1(bytes); \
223 } while(0)
218224
219225 static void EmitCommand(ELastCommand command)
220226 {
411417
412418 if(vm_syscallNum < 0)
413419 {
414 int *data;
420 int *data, *ret;
415421 #if idx64
416422 int index;
417423 intptr_t args[MAX_VMSYSCALL_ARGS];
418424 #endif
419425
420426 data = (int *) (savedVM->dataBase + vm_programStack + 4);
427 ret = &vm_opStackBase[vm_opStackOfs + 1];
421428
422429 #if idx64
423430 args[0] = ~vm_syscallNum;
424431 for(index = 1; index < ARRAY_LEN(args); index++)
425432 args[index] = data[index];
426433
427 vm_opStackBase[vm_opStackOfs + 1] = savedVM->systemCall(args);
434 *ret = savedVM->systemCall(args);
428435 #else
429436 data[0] = ~vm_syscallNum;
430 vm_opStackBase[vm_opStackOfs + 1] = savedVM->systemCall((intptr_t *) data);
437 *ret = savedVM->systemCall((intptr_t *) data);
431438 #endif
432439 }
433440 else
4141 uniform mat4 u_ModelViewProjectionMatrix;
4242 uniform vec4 u_BaseColor;
4343 uniform vec4 u_VertColor;
44
45 #if defined(USE_DEFORM_VERTEXES) || defined(USE_RGBAGEN)
46 uniform vec3 u_FireRiseDir;
47 #endif
4448
4549 #if defined(USE_RGBAGEN)
4650 uniform int u_ColorGen;
4953 uniform vec3 u_DirectedLight;
5054 uniform vec3 u_ModelLightDir;
5155 uniform float u_PortalRange;
56 uniform float u_ZFadeLowest;
57 uniform float u_ZFadeHighest;
5258 #endif
5359
5460 #if defined(USE_VERTEX_ANIMATION)
6773 float frequency = u_DeformParams[3];
6874 float spread = u_DeformParams[4];
6975
76 // a negative frequency is for Z deformation based on normal
77 float zDeformScale = 0;
78 if (frequency < 0)
79 {
80 zDeformScale = 1;
81 frequency *= -1;
82
83 if (frequency > 999)
84 {
85 frequency -= 999;
86 zDeformScale = -1;
87 }
88 }
89
7090 if (u_DeformGen == DGEN_BULGE)
7191 {
7292 phase *= st.x;
102122 else // if (u_DeformGen == DGEN_BULGE)
103123 {
104124 func = sin(value);
125 }
126
127 if (zDeformScale != 0)
128 {
129 vec3 dir = u_FireRiseDir * (0.4 + 0.6 * u_FireRiseDir.z);
130 float nDot = dot(dir, normal);
131 float scale = base + func * amplitude;
132
133 if (nDot * scale > 0)
134 {
135 return pos + dir * nDot * scale * zDeformScale;
136 }
137
138 return pos;
105139 }
106140
107141 return pos + normal * (base + func * amplitude);
176210 else if (u_AlphaGen == AGEN_PORTAL)
177211 {
178212 color.a = clamp(length(viewer) / u_PortalRange, 0.0, 1.0);
213 }
214 else if (u_AlphaGen == AGEN_NORMALZFADE)
215 {
216 float nDot = dot(normal, u_FireRiseDir);
217 float halfRange = (u_ZFadeHighest - u_ZFadeLowest) / 2.0;
218
219 if (nDot < u_ZFadeHighest) {
220 if (nDot > u_ZFadeLowest) {
221 float frac;
222 if (nDot < u_ZFadeLowest + halfRange) {
223 frac = ( nDot - u_ZFadeLowest ) / halfRange;
224 } else {
225 frac = 1.0 - ( nDot - u_ZFadeLowest - halfRange ) / halfRange;
226 }
227 color.a *= clamp(frac, 0.0, 1.0);
228 } else {
229 color.a = 0;
230 }
231 } else {
232 color.a = 0;
233 }
179234 }
180235
181236 return color;
3030 #else
3131 # include <SDL_opengl.h>
3232 #endif
33
34 extern void ( APIENTRY * qglActiveTextureARB )( GLenum texture );
35 extern void ( APIENTRY * qglClientActiveTextureARB )( GLenum texture );
36 extern void ( APIENTRY * qglMultiTexCoord2fARB )( GLenum texture, GLfloat s, GLfloat t );
37
38 extern void ( APIENTRY * qglLockArraysEXT )( GLint, GLint );
39 extern void ( APIENTRY * qglUnlockArraysEXT )( void );
3340
3441 //===========================================================================
3542
7784 typedef void ( APIENTRY * PFNGLPNTRIANGLESFATIPROC )( GLenum pname, GLfloat param );
7885 #endif
7986
87 //----(SA) added
88 extern void ( APIENTRY * qglPNTrianglesiATI )( GLenum pname, GLint param );
89 extern void ( APIENTRY * qglPNTrianglesfATI )( GLenum pname, GLfloat param );
90 //----(SA) end
91
8092 // for NV fog distance
8193 #ifndef GL_NV_fog_distance
8294 #define GL_FOG_DISTANCE_MODE_NV 0x855A
101113 #define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
102114 #endif
103115
116
104117 // extensions will be function pointers on all platforms
105
106 extern void ( APIENTRY * qglMultiTexCoord2fARB )( GLenum texture, GLfloat s, GLfloat t );
107 extern void ( APIENTRY * qglActiveTextureARB )( GLenum texture );
108 extern void ( APIENTRY * qglClientActiveTextureARB )( GLenum texture );
109
110 extern void ( APIENTRY * qglLockArraysEXT )( GLint, GLint );
111 extern void ( APIENTRY * qglUnlockArraysEXT )( void );
112
113 //----(SA) added
114 extern void ( APIENTRY * qglPNTrianglesiATI )( GLenum pname, GLint param );
115 extern void ( APIENTRY * qglPNTrianglesfATI )( GLenum pname, GLfloat param );
116 //----(SA) end
117
118 // GL_EXT_draw_range_elements
119 extern void (APIENTRY * qglDrawRangeElementsEXT) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
120
121 // rend2
122
123 // GL_EXT_multi_draw_arrays
124 extern void (APIENTRY * qglMultiDrawArraysEXT) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount);
125 extern void (APIENTRY * qglMultiDrawElementsEXT) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount);
126
127 // GL_ARB_shading_language_100
128 #ifndef GL_ARB_shading_language_100
129 #define GL_ARB_shading_language_100
130 #define GL_SHADING_LANGUAGE_VERSION_ARB 0x8B8C
131 #endif
132
133 // GL_ARB_vertex_program
134 extern void (APIENTRY * qglVertexAttrib4fARB) (GLuint, GLfloat, GLfloat, GLfloat, GLfloat);
135 extern void (APIENTRY * qglVertexAttrib4fvARB) (GLuint, const GLfloat *);
136 extern void (APIENTRY * qglVertexAttribPointerARB) (GLuint index, GLint size, GLenum type, GLboolean normalized,
137 GLsizei stride, const GLvoid * pointer);
138 extern void (APIENTRY * qglEnableVertexAttribArrayARB) (GLuint index);
139 extern void (APIENTRY * qglDisableVertexAttribArrayARB) (GLuint index);
140
141 // GL_ARB_vertex_buffer_object
142 extern void (APIENTRY * qglBindBufferARB) (GLenum target, GLuint buffer);
143 extern void (APIENTRY * qglDeleteBuffersARB) (GLsizei n, const GLuint * buffers);
144 extern void (APIENTRY * qglGenBuffersARB) (GLsizei n, GLuint * buffers);
145 extern GLboolean(APIENTRY * qglIsBufferARB) (GLuint buffer);
146 extern void (APIENTRY * qglBufferDataARB) (GLenum target, GLsizeiptrARB size, const GLvoid * data, GLenum usage);
147 extern void (APIENTRY * qglBufferSubDataARB) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid * data);
148 extern void (APIENTRY * qglGetBufferSubDataARB) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid * data);
149 extern void (APIENTRY * qglGetBufferParameterivARB) (GLenum target, GLenum pname, GLint * params);
150 extern void (APIENTRY * qglGetBufferPointervARB) (GLenum target, GLenum pname, GLvoid * *params);
151
152 // GL_ARB_shader_objects
153 extern void (APIENTRY * qglDeleteObjectARB) (GLhandleARB obj);
154 extern GLhandleARB(APIENTRY * qglGetHandleARB) (GLenum pname);
155 extern void (APIENTRY * qglDetachObjectARB) (GLhandleARB containerObj, GLhandleARB attachedObj);
156 extern GLhandleARB(APIENTRY * qglCreateShaderObjectARB) (GLenum shaderType);
157 extern void (APIENTRY * qglShaderSourceARB) (GLhandleARB shaderObj, GLsizei count, const GLcharARB * *string,
158 const GLint * length);
159 extern void (APIENTRY * qglCompileShaderARB) (GLhandleARB shaderObj);
160 extern GLhandleARB(APIENTRY * qglCreateProgramObjectARB) (void);
161 extern void (APIENTRY * qglAttachObjectARB) (GLhandleARB containerObj, GLhandleARB obj);
162 extern void (APIENTRY * qglLinkProgramARB) (GLhandleARB programObj);
163 extern void (APIENTRY * qglUseProgramObjectARB) (GLhandleARB programObj);
164 extern void (APIENTRY * qglValidateProgramARB) (GLhandleARB programObj);
165 extern void (APIENTRY * qglUniform1fARB) (GLint location, GLfloat v0);
166 extern void (APIENTRY * qglUniform2fARB) (GLint location, GLfloat v0, GLfloat v1);
167 extern void (APIENTRY * qglUniform3fARB) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
168 extern void (APIENTRY * qglUniform4fARB) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
169 extern void (APIENTRY * qglUniform1iARB) (GLint location, GLint v0);
170 extern void (APIENTRY * qglUniform2iARB) (GLint location, GLint v0, GLint v1);
171 extern void (APIENTRY * qglUniform3iARB) (GLint location, GLint v0, GLint v1, GLint v2);
172 extern void (APIENTRY * qglUniform4iARB) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
173 extern void (APIENTRY * qglUniform1fvARB) (GLint location, GLsizei count, const GLfloat * value);
174 extern void (APIENTRY * qglUniform2fvARB) (GLint location, GLsizei count, const GLfloat * value);
175 extern void (APIENTRY * qglUniform3fvARB) (GLint location, GLsizei count, const GLfloat * value);
176 extern void (APIENTRY * qglUniform4fvARB) (GLint location, GLsizei count, const GLfloat * value);
177 extern void (APIENTRY * qglUniform2ivARB) (GLint location, GLsizei count, const GLint * value);
178 extern void (APIENTRY * qglUniform3ivARB) (GLint location, GLsizei count, const GLint * value);
179 extern void (APIENTRY * qglUniform4ivARB) (GLint location, GLsizei count, const GLint * value);
180 extern void (APIENTRY * qglUniformMatrix2fvARB) (GLint location, GLsizei count, GLboolean transpose, const GLfloat * value);
181 extern void (APIENTRY * qglUniformMatrix3fvARB) (GLint location, GLsizei count, GLboolean transpose, const GLfloat * value);
182 extern void (APIENTRY * qglUniformMatrix4fvARB) (GLint location, GLsizei count, GLboolean transpose, const GLfloat * value);
183 extern void (APIENTRY * qglGetObjectParameterfvARB) (GLhandleARB obj, GLenum pname, GLfloat * params);
184 extern void (APIENTRY * qglGetObjectParameterivARB) (GLhandleARB obj, GLenum pname, GLint * params);
185 extern void (APIENTRY * qglGetInfoLogARB) (GLhandleARB obj, GLsizei maxLength, GLsizei * length, GLcharARB * infoLog);
186 extern void (APIENTRY * qglGetAttachedObjectsARB) (GLhandleARB containerObj, GLsizei maxCount, GLsizei * count,
187 GLhandleARB * obj);
188 extern GLint(APIENTRY * qglGetUniformLocationARB) (GLhandleARB programObj, const GLcharARB * name);
189 extern void (APIENTRY * qglGetActiveUniformARB) (GLhandleARB programObj, GLuint index, GLsizei maxIndex, GLsizei * length,
190 GLint * size, GLenum * type, GLcharARB * name);
191 extern void (APIENTRY * qglGetUniformfvARB) (GLhandleARB programObj, GLint location, GLfloat * params);
192 extern void (APIENTRY * qglGetUniformivARB) (GLhandleARB programObj, GLint location, GLint * params);
193 extern void (APIENTRY * qglGetShaderSourceARB) (GLhandleARB obj, GLsizei maxLength, GLsizei * length, GLcharARB * source);
194
195 // GL_ARB_vertex_shader
196 extern void (APIENTRY * qglBindAttribLocationARB) (GLhandleARB programObj, GLuint index, const GLcharARB * name);
197 extern void (APIENTRY * qglGetActiveAttribARB) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei * length,
198 GLint * size, GLenum * type, GLcharARB * name);
199 extern GLint(APIENTRY * qglGetAttribLocationARB) (GLhandleARB programObj, const GLcharARB * name);
200
201 // GL_ARB_texture_compression
202 extern void (APIENTRY * qglCompressedTexImage3DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height,
203 GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);
204 extern void (APIENTRY * qglCompressedTexImage2DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height,
205 GLint border, GLsizei imageSize, const GLvoid *data);
206 extern void (APIENTRY * qglCompressedTexImage1DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border,
207 GLsizei imageSize, const GLvoid *data);
208 extern void (APIENTRY * qglCompressedTexSubImage3DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset,
209 GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);
210 extern void (APIENTRY * qglCompressedTexSubImage2DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width,
211 GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
212 extern void (APIENTRY * qglCompressedTexSubImage1DARB)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format,
213 GLsizei imageSize, const GLvoid *data);
214 extern void (APIENTRY * qglGetCompressedTexImageARB)(GLenum target, GLint lod,
215 GLvoid *img);
216
217 // GL_NVX_gpu_memory_info
218 #ifndef GL_NVX_gpu_memory_info
219 #define GL_NVX_gpu_memory_info
220 #define GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX 0x9047
221 #define GL_GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX 0x9048
222 #define GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX 0x9049
223 #define GL_GPU_MEMORY_INFO_EVICTION_COUNT_NVX 0x904A
224 #define GL_GPU_MEMORY_INFO_EVICTED_MEMORY_NVX 0x904B
225 #endif
226
227 // GL_ATI_meminfo
228 #ifndef GL_ATI_meminfo
229 #define GL_ATI_meminfo
230 #define GL_VBO_FREE_MEMORY_ATI 0x87FB
231 #define GL_TEXTURE_FREE_MEMORY_ATI 0x87FC
232 #define GL_RENDERBUFFER_FREE_MEMORY_ATI 0x87FD
233 #endif
234
235 // GL_ARB_texture_float
236 #ifndef GL_ARB_texture_float
237 #define GL_ARB_texture_float
238 #define GL_TEXTURE_RED_TYPE_ARB 0x8C10
239 #define GL_TEXTURE_GREEN_TYPE_ARB 0x8C11
240 #define GL_TEXTURE_BLUE_TYPE_ARB 0x8C12
241 #define GL_TEXTURE_ALPHA_TYPE_ARB 0x8C13
242 #define GL_TEXTURE_LUMINANCE_TYPE_ARB 0x8C14
243 #define GL_TEXTURE_INTENSITY_TYPE_ARB 0x8C15
244 #define GL_TEXTURE_DEPTH_TYPE_ARB 0x8C16
245 #define GL_UNSIGNED_NORMALIZED_ARB 0x8C17
246 #define GL_RGBA32F_ARB 0x8814
247 #define GL_RGB32F_ARB 0x8815
248 #define GL_ALPHA32F_ARB 0x8816
249 #define GL_INTENSITY32F_ARB 0x8817
250 #define GL_LUMINANCE32F_ARB 0x8818
251 #define GL_LUMINANCE_ALPHA32F_ARB 0x8819
252 #define GL_RGBA16F_ARB 0x881A
253 #define GL_RGB16F_ARB 0x881B
254 #define GL_ALPHA16F_ARB 0x881C
255 #define GL_INTENSITY16F_ARB 0x881D
256 #define GL_LUMINANCE16F_ARB 0x881E
257 #define GL_LUMINANCE_ALPHA16F_ARB 0x881F
258 #endif
259
260 #ifndef GL_ARB_half_float_pixel
261 #define GL_ARB_half_float_pixel
262 #define GL_HALF_FLOAT_ARB 0x140B
263 #endif
264
265 // GL_EXT_framebuffer_object
266 extern GLboolean (APIENTRY * qglIsRenderbufferEXT)(GLuint renderbuffer);
267 extern void (APIENTRY * qglBindRenderbufferEXT)(GLenum target, GLuint renderbuffer);
268 extern void (APIENTRY * qglDeleteRenderbuffersEXT)(GLsizei n, const GLuint *renderbuffers);
269 extern void (APIENTRY * qglGenRenderbuffersEXT)(GLsizei n, GLuint *renderbuffers);
270 extern void (APIENTRY * qglRenderbufferStorageEXT)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
271 extern void (APIENTRY * qglGetRenderbufferParameterivEXT)(GLenum target, GLenum pname, GLint *params);
272 extern GLboolean (APIENTRY * qglIsFramebufferEXT)(GLuint framebuffer);
273 extern void (APIENTRY * qglBindFramebufferEXT)(GLenum target, GLuint framebuffer);
274 extern void (APIENTRY * qglDeleteFramebuffersEXT)(GLsizei n, const GLuint *framebuffers);
275 extern void (APIENTRY * qglGenFramebuffersEXT)(GLsizei n, GLuint *framebuffers);
276 extern GLenum (APIENTRY * qglCheckFramebufferStatusEXT)(GLenum target);
277 extern void (APIENTRY * qglFramebufferTexture1DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture,
278 GLint level);
279 extern void (APIENTRY * qglFramebufferTexture2DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture,
280 GLint level);
281 extern void (APIENTRY * qglFramebufferTexture3DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture,
282 GLint level, GLint zoffset);
283 extern void (APIENTRY * qglFramebufferRenderbufferEXT)(GLenum target, GLenum attachment, GLenum renderbuffertarget,
284 GLuint renderbuffer);
285 extern void (APIENTRY * qglGetFramebufferAttachmentParameterivEXT)(GLenum target, GLenum attachment, GLenum pname, GLint *params);
286 extern void (APIENTRY * qglGenerateMipmapEXT)(GLenum target);
287
288 #ifndef GL_EXT_framebuffer_object
289 #define GL_EXT_framebuffer_object
290 #define GL_FRAMEBUFFER_EXT 0x8D40
291 #define GL_RENDERBUFFER_EXT 0x8D41
292 #define GL_STENCIL_INDEX1_EXT 0x8D46
293 #define GL_STENCIL_INDEX4_EXT 0x8D47
294 #define GL_STENCIL_INDEX8_EXT 0x8D48
295 #define GL_STENCIL_INDEX16_EXT 0x8D49
296 #define GL_RENDERBUFFER_WIDTH_EXT 0x8D42
297 #define GL_RENDERBUFFER_HEIGHT_EXT 0x8D43
298 #define GL_RENDERBUFFER_INTERNAL_FORMAT_EXT 0x8D44
299 #define GL_RENDERBUFFER_RED_SIZE_EXT 0x8D50
300 #define GL_RENDERBUFFER_GREEN_SIZE_EXT 0x8D51
301 #define GL_RENDERBUFFER_BLUE_SIZE_EXT 0x8D52
302 #define GL_RENDERBUFFER_ALPHA_SIZE_EXT 0x8D53
303 #define GL_RENDERBUFFER_DEPTH_SIZE_EXT 0x8D54
304 #define GL_RENDERBUFFER_STENCIL_SIZE_EXT 0x8D55
305 #define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT 0x8CD0
306 #define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT 0x8CD1
307 #define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT 0x8CD2
308 #define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT 0x8CD3
309 #define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT 0x8CD4
310 #define GL_COLOR_ATTACHMENT0_EXT 0x8CE0
311 #define GL_COLOR_ATTACHMENT1_EXT 0x8CE1
312 #define GL_COLOR_ATTACHMENT2_EXT 0x8CE2
313 #define GL_COLOR_ATTACHMENT3_EXT 0x8CE3
314 #define GL_COLOR_ATTACHMENT4_EXT 0x8CE4
315 #define GL_COLOR_ATTACHMENT5_EXT 0x8CE5
316 #define GL_COLOR_ATTACHMENT6_EXT 0x8CE6
317 #define GL_COLOR_ATTACHMENT7_EXT 0x8CE7
318 #define GL_COLOR_ATTACHMENT8_EXT 0x8CE8
319 #define GL_COLOR_ATTACHMENT9_EXT 0x8CE9
320 #define GL_COLOR_ATTACHMENT10_EXT 0x8CEA
321 #define GL_COLOR_ATTACHMENT11_EXT 0x8CEB
322 #define GL_COLOR_ATTACHMENT12_EXT 0x8CEC
323 #define GL_COLOR_ATTACHMENT13_EXT 0x8CED
324 #define GL_COLOR_ATTACHMENT14_EXT 0x8CEE
325 #define GL_COLOR_ATTACHMENT15_EXT 0x8CEF
326 #define GL_DEPTH_ATTACHMENT_EXT 0x8D00
327 #define GL_STENCIL_ATTACHMENT_EXT 0x8D20
328 #define GL_FRAMEBUFFER_COMPLETE_EXT 0x8CD5
329 #define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT 0x8CD6
330 #define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT 0x8CD7
331 #define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT 0x8CD9
332 #define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT 0x8CDA
333 #define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT 0x8CDB
334 #define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT 0x8CDC
335 #define GL_FRAMEBUFFER_UNSUPPORTED_EXT 0x8CDD
336 #define GL_FRAMEBUFFER_BINDING_EXT 0x8CA6
337 #define GL_RENDERBUFFER_BINDING_EXT 0x8CA7
338 #define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF
339 #define GL_MAX_RENDERBUFFER_SIZE_EXT 0x84E8
340 #define GL_INVALID_FRAMEBUFFER_OPERATION_EXT 0x0506
341 #endif
342
343 // GL_EXT_packed_depth_stencil
344 #ifndef GL_EXT_packed_depth_stencil
345 #define GL_EXT_packed_depth_stencil
346 #define GL_DEPTH_STENCIL_EXT 0x84F9
347 #define GL_UNSIGNED_INT_24_8_EXT 0x84FA
348 #define GL_DEPTH24_STENCIL8_EXT 0x88F0
349 #define GL_TEXTURE_STENCIL_SIZE_EXT 0x88F1
350 #endif
351
352 // GL_ARB_occlusion_query
353 extern void (APIENTRY * qglGenQueriesARB)(GLsizei n, GLuint *ids);
354 extern void (APIENTRY * qglDeleteQueriesARB)(GLsizei n, const GLuint *ids);
355 extern GLboolean (APIENTRY * qglIsQueryARB)(GLuint id);
356 extern void (APIENTRY * qglBeginQueryARB)(GLenum target, GLuint id);
357 extern void (APIENTRY * qglEndQueryARB)(GLenum target);
358 extern void (APIENTRY * qglGetQueryivARB)(GLenum target, GLenum pname, GLint *params);
359 extern void (APIENTRY * qglGetQueryObjectivARB)(GLuint id, GLenum pname, GLint *params);
360 extern void (APIENTRY * qglGetQueryObjectuivARB)(GLuint id, GLenum pname, GLuint *params);
361
362 #ifndef GL_ARB_occlusion_query
363 #define GL_ARB_occlusion_query
364 #define GL_SAMPLES_PASSED_ARB 0x8914
365 #define GL_QUERY_COUNTER_BITS_ARB 0x8864
366 #define GL_CURRENT_QUERY_ARB 0x8865
367 #define GL_QUERY_RESULT_ARB 0x8866
368 #define GL_QUERY_RESULT_AVAILABLE_ARB 0x8867
369 #endif
370
371 // GL_EXT_framebuffer_blit
372 extern void (APIENTRY * qglBlitFramebufferEXT)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
373 GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
374 GLbitfield mask, GLenum filter);
375
376 #ifndef GL_EXT_framebuffer_blit
377 #define GL_EXT_framebuffer_blit
378 #define GL_READ_FRAMEBUFFER_EXT 0x8CA8
379 #define GL_DRAW_FRAMEBUFFER_EXT 0x8CA9
380 #define GL_DRAW_FRAMEBUFFER_BINDING_EXT 0x8CA6
381 #define GL_READ_FRAMEBUFFER_BINDING_EXT 0x8CAA
382 #endif
383
384 // GL_EXT_framebuffer_multisample
385 extern void (APIENTRY * qglRenderbufferStorageMultisampleEXT)(GLenum target, GLsizei samples,
386 GLenum internalformat, GLsizei width, GLsizei height);
387
388 #ifndef GL_EXT_framebuffer_multisample
389 #define GL_EXT_framebuffer_multisample
390 #define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB
391 #define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56
392 #define GL_MAX_SAMPLES_EXT 0x8D57
393 #endif
394
395 #ifndef GL_EXT_texture_sRGB
396 #define GL_EXT_texture_sRGB
397 #define GL_SRGB_EXT 0x8C40
398 #define GL_SRGB8_EXT 0x8C41
399 #define GL_SRGB_ALPHA_EXT 0x8C42
400 #define GL_SRGB8_ALPHA8_EXT 0x8C43
401 #define GL_SLUMINANCE_ALPHA_EXT 0x8C44
402 #define GL_SLUMINANCE8_ALPHA8_EXT 0x8C45
403 #define GL_SLUMINANCE_EXT 0x8C46
404 #define GL_SLUMINANCE8_EXT 0x8C47
405 #define GL_COMPRESSED_SRGB_EXT 0x8C48
406 #define GL_COMPRESSED_SRGB_ALPHA_EXT 0x8C49
407 #define GL_COMPRESSED_SLUMINANCE_EXT 0x8C4A
408 #define GL_COMPRESSED_SLUMINANCE_ALPHA_EXT 0x8C4B
409 #define GL_COMPRESSED_SRGB_S3TC_DXT1_EXT 0x8C4C
410 #define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT 0x8C4D
411 #define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 0x8C4E
412 #define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F
413 #endif
414
415 #ifndef GL_EXT_framebuffer_sRGB
416 #define GL_EXT_framebuffer_sRGB
417 #define GL_FRAMEBUFFER_SRGB_EXT 0x8DB9
418 #endif
419
420 #ifndef GL_EXT_texture_compression_latc
421 #define GL_EXT_texture_compression_latc
422 #define GL_COMPRESSED_LUMINANCE_LATC1_EXT 0x8C70
423 #define GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT 0x8C71
424 #define GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT 0x8C72
425 #define GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT 0x8C73
426 #endif
427
428 #ifndef GL_ARB_texture_compression_bptc
429 #define GL_ARB_texture_compression_bptc
430 #define GL_COMPRESSED_RGBA_BPTC_UNORM_ARB 0x8E8C
431 #define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB 0x8E8D
432 #define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB 0x8E8E
433 #define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB 0x8E8F
434 #endif
435
436 // GL_ARB_draw_buffers
437 extern void (APIENTRY * qglDrawBuffersARB)(GLsizei n, const GLenum *bufs);
438 #ifndef GL_ARB_draw_buffers
439 #define GL_ARB_draw_buffers
440 #define GL_MAX_DRAW_BUFFERS_ARB 0x8824
441 #define GL_DRAW_BUFFER0_ARB 0x8825
442 #define GL_DRAW_BUFFER1_ARB 0x8826
443 #define GL_DRAW_BUFFER2_ARB 0x8827
444 #define GL_DRAW_BUFFER3_ARB 0x8828
445 #define GL_DRAW_BUFFER4_ARB 0x8829
446 #define GL_DRAW_BUFFER5_ARB 0x882A
447 #define GL_DRAW_BUFFER6_ARB 0x882B
448 #define GL_DRAW_BUFFER7_ARB 0x882C
449 #define GL_DRAW_BUFFER8_ARB 0x882D
450 #define GL_DRAW_BUFFER9_ARB 0x882E
451 #define GL_DRAW_BUFFER10_ARB 0x882F
452 #define GL_DRAW_BUFFER11_ARB 0x8830
453 #define GL_DRAW_BUFFER12_ARB 0x8831
454 #define GL_DRAW_BUFFER13_ARB 0x8832
455 #define GL_DRAW_BUFFER14_ARB 0x8833
456 #define GL_DRAW_BUFFER15_ARB 0x8834
457 #endif
458
459 #ifndef GL_ARB_depth_clamp
460 #define GL_ARB_depth_clamp
461 #define GL_DEPTH_CLAMP 0x864F
462 #endif
463
464 #ifndef GL_ARB_seamless_cube_map
465 #define GL_ARB_seamless_cube_map
466 #define GL_TEXTURE_CUBE_MAP_SEAMLESS 0x884F
467 #endif
468
469 // GL_ARB_vertex_array_object
470 extern void (APIENTRY * qglBindVertexArrayARB)(GLuint array);
471 extern void (APIENTRY * qglDeleteVertexArraysARB)(GLsizei n, const GLuint *arrays);
472 extern void (APIENTRY * qglGenVertexArraysARB)(GLsizei n, GLuint *arrays);
473 extern GLboolean (APIENTRY * qglIsVertexArrayARB)(GLuint array);
474 #ifndef GL_ARB_vertex_array_object
475 #define GL_ARB_vertex_array_object
476 #define GL_VERTEX_ARRAY_BINDING_ARB 0x85B5
477 #endif
478
479 #if defined(WIN32)
480 // WGL_ARB_create_context
481 #ifndef WGL_ARB_create_context
482 #define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091
483 #define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092
484 #define WGL_CONTEXT_LAYER_PLANE_ARB 0x2093
485 #define WGL_CONTEXT_FLAGS_ARB 0x2094
486 #define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126
487 #define WGL_CONTEXT_DEBUG_BIT_ARB 0x0001
488 #define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002
489 #define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
490 #define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002
491 #define ERROR_INVALID_VERSION_ARB 0x2095
492 #define ERROR_INVALID_PROFILE_ARB 0x2096
493 #endif
494
495 extern HGLRC(APIENTRY * qwglCreateContextAttribsARB) (HDC hdC, HGLRC hShareContext, const int *attribList);
496 #endif
497
498 #if 0 //defined(__linux__)
499 // GLX_ARB_create_context
500 #ifndef GLX_ARB_create_context
501 #define GLX_CONTEXT_DEBUG_BIT_ARB 0x00000001
502 #define GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002
503 #define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091
504 #define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092
505 #define GLX_CONTEXT_FLAGS_ARB 0x2094
506 #endif
507
508 extern GLXContext (APIENTRY * qglXCreateContextAttribsARB) (Display *dpy, GLXFBConfig config, GLXContext share_context, Bool direct, const int *attrib_list);
509 #endif
510
511118 //===========================================================================
512119
513120 #define qglAccum glAccum
845452 #define qglVertexPointer glVertexPointer
846453 #define qglViewport glViewport
847454
848 #endif
455 // GL_EXT_draw_range_elements
456 extern void (APIENTRY * qglDrawRangeElementsEXT) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
457
458 // GL_EXT_multi_draw_arrays
459 extern void (APIENTRY * qglMultiDrawArraysEXT) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount);
460 extern void (APIENTRY * qglMultiDrawElementsEXT) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount);
461
462 // rend2
463
464 // GL_ARB_shading_language_100
465 #ifndef GL_ARB_shading_language_100
466 #define GL_ARB_shading_language_100
467 #define GL_SHADING_LANGUAGE_VERSION_ARB 0x8B8C
468 #endif
469
470 // GL_ARB_vertex_program
471 extern void (APIENTRY * qglVertexAttrib4fARB) (GLuint, GLfloat, GLfloat, GLfloat, GLfloat);
472 extern void (APIENTRY * qglVertexAttrib4fvARB) (GLuint, const GLfloat *);
473 extern void (APIENTRY * qglVertexAttribPointerARB) (GLuint index, GLint size, GLenum type, GLboolean normalized,
474 GLsizei stride, const GLvoid * pointer);
475 extern void (APIENTRY * qglEnableVertexAttribArrayARB) (GLuint index);
476 extern void (APIENTRY * qglDisableVertexAttribArrayARB) (GLuint index);
477
478 // GL_ARB_vertex_buffer_object
479 extern void (APIENTRY * qglBindBufferARB) (GLenum target, GLuint buffer);
480 extern void (APIENTRY * qglDeleteBuffersARB) (GLsizei n, const GLuint * buffers);
481 extern void (APIENTRY * qglGenBuffersARB) (GLsizei n, GLuint * buffers);
482 extern GLboolean(APIENTRY * qglIsBufferARB) (GLuint buffer);
483 extern void (APIENTRY * qglBufferDataARB) (GLenum target, GLsizeiptrARB size, const GLvoid * data, GLenum usage);
484 extern void (APIENTRY * qglBufferSubDataARB) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid * data);
485 extern void (APIENTRY * qglGetBufferSubDataARB) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid * data);
486 extern void (APIENTRY * qglGetBufferParameterivARB) (GLenum target, GLenum pname, GLint * params);
487 extern void (APIENTRY * qglGetBufferPointervARB) (GLenum target, GLenum pname, GLvoid * *params);
488
489 // GL_ARB_shader_objects
490 extern void (APIENTRY * qglDeleteObjectARB) (GLhandleARB obj);
491 extern GLhandleARB(APIENTRY * qglGetHandleARB) (GLenum pname);
492 extern void (APIENTRY * qglDetachObjectARB) (GLhandleARB containerObj, GLhandleARB attachedObj);
493 extern GLhandleARB(APIENTRY * qglCreateShaderObjectARB) (GLenum shaderType);
494 extern void (APIENTRY * qglShaderSourceARB) (GLhandleARB shaderObj, GLsizei count, const GLcharARB * *string,
495 const GLint * length);
496 extern void (APIENTRY * qglCompileShaderARB) (GLhandleARB shaderObj);
497 extern GLhandleARB(APIENTRY * qglCreateProgramObjectARB) (void);
498 extern void (APIENTRY * qglAttachObjectARB) (GLhandleARB containerObj, GLhandleARB obj);
499 extern void (APIENTRY * qglLinkProgramARB) (GLhandleARB programObj);
500 extern void (APIENTRY * qglUseProgramObjectARB) (GLhandleARB programObj);
501 extern void (APIENTRY * qglValidateProgramARB) (GLhandleARB programObj);
502 extern void (APIENTRY * qglUniform1fARB) (GLint location, GLfloat v0);
503 extern void (APIENTRY * qglUniform2fARB) (GLint location, GLfloat v0, GLfloat v1);
504 extern void (APIENTRY * qglUniform3fARB) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
505 extern void (APIENTRY * qglUniform4fARB) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
506 extern void (APIENTRY * qglUniform1iARB) (GLint location, GLint v0);
507 extern void (APIENTRY * qglUniform2iARB) (GLint location, GLint v0, GLint v1);
508 extern void (APIENTRY * qglUniform3iARB) (GLint location, GLint v0, GLint v1, GLint v2);
509 extern void (APIENTRY * qglUniform4iARB) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
510 extern void (APIENTRY * qglUniform1fvARB) (GLint location, GLsizei count, const GLfloat * value);
511 extern void (APIENTRY * qglUniform2fvARB) (GLint location, GLsizei count, const GLfloat * value);
512 extern void (APIENTRY * qglUniform3fvARB) (GLint location, GLsizei count, const GLfloat * value);
513 extern void (APIENTRY * qglUniform4fvARB) (GLint location, GLsizei count, const GLfloat * value);
514 extern void (APIENTRY * qglUniform2ivARB) (GLint location, GLsizei count, const GLint * value);
515 extern void (APIENTRY * qglUniform3ivARB) (GLint location, GLsizei count, const GLint * value);
516 extern void (APIENTRY * qglUniform4ivARB) (GLint location, GLsizei count, const GLint * value);
517 extern void (APIENTRY * qglUniformMatrix2fvARB) (GLint location, GLsizei count, GLboolean transpose, const GLfloat * value);
518 extern void (APIENTRY * qglUniformMatrix3fvARB) (GLint location, GLsizei count, GLboolean transpose, const GLfloat * value);
519 extern void (APIENTRY * qglUniformMatrix4fvARB) (GLint location, GLsizei count, GLboolean transpose, const GLfloat * value);
520 extern void (APIENTRY * qglGetObjectParameterfvARB) (GLhandleARB obj, GLenum pname, GLfloat * params);
521 extern void (APIENTRY * qglGetObjectParameterivARB) (GLhandleARB obj, GLenum pname, GLint * params);
522 extern void (APIENTRY * qglGetInfoLogARB) (GLhandleARB obj, GLsizei maxLength, GLsizei * length, GLcharARB * infoLog);
523 extern void (APIENTRY * qglGetAttachedObjectsARB) (GLhandleARB containerObj, GLsizei maxCount, GLsizei * count,
524 GLhandleARB * obj);
525 extern GLint(APIENTRY * qglGetUniformLocationARB) (GLhandleARB programObj, const GLcharARB * name);
526 extern void (APIENTRY * qglGetActiveUniformARB) (GLhandleARB programObj, GLuint index, GLsizei maxIndex, GLsizei * length,
527 GLint * size, GLenum * type, GLcharARB * name);
528 extern void (APIENTRY * qglGetUniformfvARB) (GLhandleARB programObj, GLint location, GLfloat * params);
529 extern void (APIENTRY * qglGetUniformivARB) (GLhandleARB programObj, GLint location, GLint * params);
530 extern void (APIENTRY * qglGetShaderSourceARB) (GLhandleARB obj, GLsizei maxLength, GLsizei * length, GLcharARB * source);
531
532 // GL_ARB_vertex_shader
533 extern void (APIENTRY * qglBindAttribLocationARB) (GLhandleARB programObj, GLuint index, const GLcharARB * name);
534 extern void (APIENTRY * qglGetActiveAttribARB) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei * length,
535 GLint * size, GLenum * type, GLcharARB * name);
536 extern GLint(APIENTRY * qglGetAttribLocationARB) (GLhandleARB programObj, const GLcharARB * name);
537
538 // GL_ARB_texture_compression
539 extern void (APIENTRY * qglCompressedTexImage3DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height,
540 GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);
541 extern void (APIENTRY * qglCompressedTexImage2DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height,
542 GLint border, GLsizei imageSize, const GLvoid *data);
543 extern void (APIENTRY * qglCompressedTexImage1DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border,
544 GLsizei imageSize, const GLvoid *data);
545 extern void (APIENTRY * qglCompressedTexSubImage3DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset,
546 GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);
547 extern void (APIENTRY * qglCompressedTexSubImage2DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width,
548 GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
549 extern void (APIENTRY * qglCompressedTexSubImage1DARB)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format,
550 GLsizei imageSize, const GLvoid *data);
551 extern void (APIENTRY * qglGetCompressedTexImageARB)(GLenum target, GLint lod,
552 GLvoid *img);
553
554 // GL_NVX_gpu_memory_info
555 #ifndef GL_NVX_gpu_memory_info
556 #define GL_NVX_gpu_memory_info
557 #define GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX 0x9047
558 #define GL_GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX 0x9048
559 #define GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX 0x9049
560 #define GL_GPU_MEMORY_INFO_EVICTION_COUNT_NVX 0x904A
561 #define GL_GPU_MEMORY_INFO_EVICTED_MEMORY_NVX 0x904B
562 #endif
563
564 // GL_ATI_meminfo
565 #ifndef GL_ATI_meminfo
566 #define GL_ATI_meminfo
567 #define GL_VBO_FREE_MEMORY_ATI 0x87FB
568 #define GL_TEXTURE_FREE_MEMORY_ATI 0x87FC
569 #define GL_RENDERBUFFER_FREE_MEMORY_ATI 0x87FD
570 #endif
571
572 // GL_ARB_texture_float
573 #ifndef GL_ARB_texture_float
574 #define GL_ARB_texture_float
575 #define GL_TEXTURE_RED_TYPE_ARB 0x8C10
576 #define GL_TEXTURE_GREEN_TYPE_ARB 0x8C11
577 #define GL_TEXTURE_BLUE_TYPE_ARB 0x8C12
578 #define GL_TEXTURE_ALPHA_TYPE_ARB 0x8C13
579 #define GL_TEXTURE_LUMINANCE_TYPE_ARB 0x8C14
580 #define GL_TEXTURE_INTENSITY_TYPE_ARB 0x8C15
581 #define GL_TEXTURE_DEPTH_TYPE_ARB 0x8C16
582 #define GL_UNSIGNED_NORMALIZED_ARB 0x8C17
583 #define GL_RGBA32F_ARB 0x8814
584 #define GL_RGB32F_ARB 0x8815
585 #define GL_ALPHA32F_ARB 0x8816
586 #define GL_INTENSITY32F_ARB 0x8817
587 #define GL_LUMINANCE32F_ARB 0x8818
588 #define GL_LUMINANCE_ALPHA32F_ARB 0x8819
589 #define GL_RGBA16F_ARB 0x881A
590 #define GL_RGB16F_ARB 0x881B
591 #define GL_ALPHA16F_ARB 0x881C
592 #define GL_INTENSITY16F_ARB 0x881D
593 #define GL_LUMINANCE16F_ARB 0x881E
594 #define GL_LUMINANCE_ALPHA16F_ARB 0x881F
595 #endif
596
597 #ifndef GL_ARB_half_float_pixel
598 #define GL_ARB_half_float_pixel
599 #define GL_HALF_FLOAT_ARB 0x140B
600 #endif
601
602 // GL_EXT_framebuffer_object
603 extern GLboolean (APIENTRY * qglIsRenderbufferEXT)(GLuint renderbuffer);
604 extern void (APIENTRY * qglBindRenderbufferEXT)(GLenum target, GLuint renderbuffer);
605 extern void (APIENTRY * qglDeleteRenderbuffersEXT)(GLsizei n, const GLuint *renderbuffers);
606 extern void (APIENTRY * qglGenRenderbuffersEXT)(GLsizei n, GLuint *renderbuffers);
607 extern void (APIENTRY * qglRenderbufferStorageEXT)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
608 extern void (APIENTRY * qglGetRenderbufferParameterivEXT)(GLenum target, GLenum pname, GLint *params);
609 extern GLboolean (APIENTRY * qglIsFramebufferEXT)(GLuint framebuffer);
610 extern void (APIENTRY * qglBindFramebufferEXT)(GLenum target, GLuint framebuffer);
611 extern void (APIENTRY * qglDeleteFramebuffersEXT)(GLsizei n, const GLuint *framebuffers);
612 extern void (APIENTRY * qglGenFramebuffersEXT)(GLsizei n, GLuint *framebuffers);
613 extern GLenum (APIENTRY * qglCheckFramebufferStatusEXT)(GLenum target);
614 extern void (APIENTRY * qglFramebufferTexture1DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture,
615 GLint level);
616 extern void (APIENTRY * qglFramebufferTexture2DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture,
617 GLint level);
618 extern void (APIENTRY * qglFramebufferTexture3DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture,
619 GLint level, GLint zoffset);
620 extern void (APIENTRY * qglFramebufferRenderbufferEXT)(GLenum target, GLenum attachment, GLenum renderbuffertarget,
621 GLuint renderbuffer);
622 extern void (APIENTRY * qglGetFramebufferAttachmentParameterivEXT)(GLenum target, GLenum attachment, GLenum pname, GLint *params);
623 extern void (APIENTRY * qglGenerateMipmapEXT)(GLenum target);
624
625 #ifndef GL_EXT_framebuffer_object
626 #define GL_EXT_framebuffer_object
627 #define GL_FRAMEBUFFER_EXT 0x8D40
628 #define GL_RENDERBUFFER_EXT 0x8D41
629 #define GL_STENCIL_INDEX1_EXT 0x8D46
630 #define GL_STENCIL_INDEX4_EXT 0x8D47
631 #define GL_STENCIL_INDEX8_EXT 0x8D48
632 #define GL_STENCIL_INDEX16_EXT 0x8D49
633 #define GL_RENDERBUFFER_WIDTH_EXT 0x8D42
634 #define GL_RENDERBUFFER_HEIGHT_EXT 0x8D43
635 #define GL_RENDERBUFFER_INTERNAL_FORMAT_EXT 0x8D44
636 #define GL_RENDERBUFFER_RED_SIZE_EXT 0x8D50
637 #define GL_RENDERBUFFER_GREEN_SIZE_EXT 0x8D51
638 #define GL_RENDERBUFFER_BLUE_SIZE_EXT 0x8D52
639 #define GL_RENDERBUFFER_ALPHA_SIZE_EXT 0x8D53
640 #define GL_RENDERBUFFER_DEPTH_SIZE_EXT 0x8D54
641 #define GL_RENDERBUFFER_STENCIL_SIZE_EXT 0x8D55
642 #define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT 0x8CD0
643 #define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT 0x8CD1
644 #define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT 0x8CD2
645 #define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT 0x8CD3
646 #define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT 0x8CD4
647 #define GL_COLOR_ATTACHMENT0_EXT 0x8CE0
648 #define GL_COLOR_ATTACHMENT1_EXT 0x8CE1
649 #define GL_COLOR_ATTACHMENT2_EXT 0x8CE2
650 #define GL_COLOR_ATTACHMENT3_EXT 0x8CE3
651 #define GL_COLOR_ATTACHMENT4_EXT 0x8CE4
652 #define GL_COLOR_ATTACHMENT5_EXT 0x8CE5
653 #define GL_COLOR_ATTACHMENT6_EXT 0x8CE6
654 #define GL_COLOR_ATTACHMENT7_EXT 0x8CE7
655 #define GL_COLOR_ATTACHMENT8_EXT 0x8CE8
656 #define GL_COLOR_ATTACHMENT9_EXT 0x8CE9
657 #define GL_COLOR_ATTACHMENT10_EXT 0x8CEA
658 #define GL_COLOR_ATTACHMENT11_EXT 0x8CEB
659 #define GL_COLOR_ATTACHMENT12_EXT 0x8CEC
660 #define GL_COLOR_ATTACHMENT13_EXT 0x8CED
661 #define GL_COLOR_ATTACHMENT14_EXT 0x8CEE
662 #define GL_COLOR_ATTACHMENT15_EXT 0x8CEF
663 #define GL_DEPTH_ATTACHMENT_EXT 0x8D00
664 #define GL_STENCIL_ATTACHMENT_EXT 0x8D20
665 #define GL_FRAMEBUFFER_COMPLETE_EXT 0x8CD5
666 #define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT 0x8CD6
667 #define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT 0x8CD7
668 #define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT 0x8CD9
669 #define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT 0x8CDA
670 #define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT 0x8CDB
671 #define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT 0x8CDC
672 #define GL_FRAMEBUFFER_UNSUPPORTED_EXT 0x8CDD
673 #define GL_FRAMEBUFFER_BINDING_EXT 0x8CA6
674 #define GL_RENDERBUFFER_BINDING_EXT 0x8CA7
675 #define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF
676 #define GL_MAX_RENDERBUFFER_SIZE_EXT 0x84E8
677 #define GL_INVALID_FRAMEBUFFER_OPERATION_EXT 0x0506
678 #endif
679
680 // GL_EXT_packed_depth_stencil
681 #ifndef GL_EXT_packed_depth_stencil
682 #define GL_EXT_packed_depth_stencil
683 #define GL_DEPTH_STENCIL_EXT 0x84F9
684 #define GL_UNSIGNED_INT_24_8_EXT 0x84FA
685 #define GL_DEPTH24_STENCIL8_EXT 0x88F0
686 #define GL_TEXTURE_STENCIL_SIZE_EXT 0x88F1
687 #endif
688
689 // GL_ARB_occlusion_query
690 extern void (APIENTRY * qglGenQueriesARB)(GLsizei n, GLuint *ids);
691 extern void (APIENTRY * qglDeleteQueriesARB)(GLsizei n, const GLuint *ids);
692 extern GLboolean (APIENTRY * qglIsQueryARB)(GLuint id);
693 extern void (APIENTRY * qglBeginQueryARB)(GLenum target, GLuint id);
694 extern void (APIENTRY * qglEndQueryARB)(GLenum target);
695 extern void (APIENTRY * qglGetQueryivARB)(GLenum target, GLenum pname, GLint *params);
696 extern void (APIENTRY * qglGetQueryObjectivARB)(GLuint id, GLenum pname, GLint *params);
697 extern void (APIENTRY * qglGetQueryObjectuivARB)(GLuint id, GLenum pname, GLuint *params);
698
699 #ifndef GL_ARB_occlusion_query
700 #define GL_ARB_occlusion_query
701 #define GL_SAMPLES_PASSED_ARB 0x8914
702 #define GL_QUERY_COUNTER_BITS_ARB 0x8864
703 #define GL_CURRENT_QUERY_ARB 0x8865
704 #define GL_QUERY_RESULT_ARB 0x8866
705 #define GL_QUERY_RESULT_AVAILABLE_ARB 0x8867
706 #endif
707
708 // GL_EXT_framebuffer_blit
709 extern void (APIENTRY * qglBlitFramebufferEXT)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
710 GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
711 GLbitfield mask, GLenum filter);
712
713 #ifndef GL_EXT_framebuffer_blit
714 #define GL_EXT_framebuffer_blit
715 #define GL_READ_FRAMEBUFFER_EXT 0x8CA8
716 #define GL_DRAW_FRAMEBUFFER_EXT 0x8CA9
717 #define GL_DRAW_FRAMEBUFFER_BINDING_EXT 0x8CA6
718 #define GL_READ_FRAMEBUFFER_BINDING_EXT 0x8CAA
719 #endif
720
721 // GL_EXT_framebuffer_multisample
722 extern void (APIENTRY * qglRenderbufferStorageMultisampleEXT)(GLenum target, GLsizei samples,
723 GLenum internalformat, GLsizei width, GLsizei height);
724
725 #ifndef GL_EXT_framebuffer_multisample
726 #define GL_EXT_framebuffer_multisample
727 #define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB
728 #define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56
729 #define GL_MAX_SAMPLES_EXT 0x8D57
730 #endif
731
732 #ifndef GL_EXT_texture_sRGB
733 #define GL_EXT_texture_sRGB
734 #define GL_SRGB_EXT 0x8C40
735 #define GL_SRGB8_EXT 0x8C41
736 #define GL_SRGB_ALPHA_EXT 0x8C42
737 #define GL_SRGB8_ALPHA8_EXT 0x8C43
738 #define GL_SLUMINANCE_ALPHA_EXT 0x8C44
739 #define GL_SLUMINANCE8_ALPHA8_EXT 0x8C45
740 #define GL_SLUMINANCE_EXT 0x8C46
741 #define GL_SLUMINANCE8_EXT 0x8C47
742 #define GL_COMPRESSED_SRGB_EXT 0x8C48
743 #define GL_COMPRESSED_SRGB_ALPHA_EXT 0x8C49
744 #define GL_COMPRESSED_SLUMINANCE_EXT 0x8C4A
745 #define GL_COMPRESSED_SLUMINANCE_ALPHA_EXT 0x8C4B
746 #define GL_COMPRESSED_SRGB_S3TC_DXT1_EXT 0x8C4C
747 #define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT 0x8C4D
748 #define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 0x8C4E
749 #define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F
750 #endif
751
752 #ifndef GL_EXT_framebuffer_sRGB
753 #define GL_EXT_framebuffer_sRGB
754 #define GL_FRAMEBUFFER_SRGB_EXT 0x8DB9
755 #endif
756
757 #ifndef GL_EXT_texture_compression_latc
758 #define GL_EXT_texture_compression_latc
759 #define GL_COMPRESSED_LUMINANCE_LATC1_EXT 0x8C70
760 #define GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT 0x8C71
761 #define GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT 0x8C72
762 #define GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT 0x8C73
763 #endif
764
765 #ifndef GL_ARB_texture_compression_bptc
766 #define GL_ARB_texture_compression_bptc
767 #define GL_COMPRESSED_RGBA_BPTC_UNORM_ARB 0x8E8C
768 #define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB 0x8E8D
769 #define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB 0x8E8E
770 #define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB 0x8E8F
771 #endif
772
773 // GL_ARB_draw_buffers
774 extern void (APIENTRY * qglDrawBuffersARB)(GLsizei n, const GLenum *bufs);
775 #ifndef GL_ARB_draw_buffers
776 #define GL_ARB_draw_buffers
777 #define GL_MAX_DRAW_BUFFERS_ARB 0x8824
778 #define GL_DRAW_BUFFER0_ARB 0x8825
779 #define GL_DRAW_BUFFER1_ARB 0x8826
780 #define GL_DRAW_BUFFER2_ARB 0x8827
781 #define GL_DRAW_BUFFER3_ARB 0x8828
782 #define GL_DRAW_BUFFER4_ARB 0x8829
783 #define GL_DRAW_BUFFER5_ARB 0x882A
784 #define GL_DRAW_BUFFER6_ARB 0x882B
785 #define GL_DRAW_BUFFER7_ARB 0x882C
786 #define GL_DRAW_BUFFER8_ARB 0x882D
787 #define GL_DRAW_BUFFER9_ARB 0x882E
788 #define GL_DRAW_BUFFER10_ARB 0x882F
789 #define GL_DRAW_BUFFER11_ARB 0x8830
790 #define GL_DRAW_BUFFER12_ARB 0x8831
791 #define GL_DRAW_BUFFER13_ARB 0x8832
792 #define GL_DRAW_BUFFER14_ARB 0x8833
793 #define GL_DRAW_BUFFER15_ARB 0x8834
794 #endif
795
796 #ifndef GL_ARB_depth_clamp
797 #define GL_ARB_depth_clamp
798 #define GL_DEPTH_CLAMP 0x864F
799 #endif
800
801 #ifndef GL_ARB_seamless_cube_map
802 #define GL_ARB_seamless_cube_map
803 #define GL_TEXTURE_CUBE_MAP_SEAMLESS 0x884F
804 #endif
805
806 // GL_ARB_vertex_array_object
807 extern void (APIENTRY * qglBindVertexArrayARB)(GLuint array);
808 extern void (APIENTRY * qglDeleteVertexArraysARB)(GLsizei n, const GLuint *arrays);
809 extern void (APIENTRY * qglGenVertexArraysARB)(GLsizei n, GLuint *arrays);
810 extern GLboolean (APIENTRY * qglIsVertexArrayARB)(GLuint array);
811 #ifndef GL_ARB_vertex_array_object
812 #define GL_ARB_vertex_array_object
813 #define GL_VERTEX_ARRAY_BINDING_ARB 0x85B5
814 #endif
815
816 #if defined(WIN32)
817 // WGL_ARB_create_context
818 #ifndef WGL_ARB_create_context
819 #define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091
820 #define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092
821 #define WGL_CONTEXT_LAYER_PLANE_ARB 0x2093
822 #define WGL_CONTEXT_FLAGS_ARB 0x2094
823 #define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126
824 #define WGL_CONTEXT_DEBUG_BIT_ARB 0x0001
825 #define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002
826 #define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
827 #define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002
828 #define ERROR_INVALID_VERSION_ARB 0x2095
829 #define ERROR_INVALID_PROFILE_ARB 0x2096
830 #endif
831
832 extern HGLRC(APIENTRY * qwglCreateContextAttribsARB) (HDC hdC, HGLRC hShareContext, const int *attribList);
833 #endif
834
835 #if 0 //defined(__linux__)
836 // GLX_ARB_create_context
837 #ifndef GLX_ARB_create_context
838 #define GLX_CONTEXT_DEBUG_BIT_ARB 0x00000001
839 #define GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002
840 #define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091
841 #define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092
842 #define GLX_CONTEXT_FLAGS_ARB 0x2094
843 #endif
844
845 extern GLXContext (APIENTRY * qglXCreateContextAttribsARB) (Display *dpy, GLXFBConfig config, GLXContext share_context, Bool direct, const int *attrib_list);
846 #endif
847
848 #endif // __QGL_H__
11041104 render_count = surface->numVerts;
11051105 }
11061106
1107 RB_CheckOverflow( render_count, surface->numTriangles );
1108
11091107 //DBG_SHOWTIME
11101108
11111109 //
11121110 // setup triangle list
11131111 //
1114 RB_CheckOverflow( surface->numVerts, surface->numTriangles * 3 );
1112 RB_CHECKOVERFLOW( render_count, surface->numTriangles * 3 );
11151113
11161114 //DBG_SHOWTIME
11171115
16811679 oldFrame = (mdrFrame_t *)((byte *)header + header->ofsFrames +
16821680 backEnd.currentEntity->e.oldframe * frameSize );
16831681
1684 RB_CheckOverflow( surface->numVerts, surface->numTriangles * 3 );
1682 RB_CHECKOVERFLOW( surface->numVerts, surface->numTriangles * 3 );
16851683
16861684 triangles = (int *) ((byte *)surface + surface->ofsTriangles);
16871685 indexes = surface->numTriangles * 3;
224224
225225 f32.f = in;
226226
227 f16.pack.exponent = CLAMP(f32.pack.exponent - 112, 0, 31);
227 f16.pack.exponent = CLAMP((int)(f32.pack.exponent) - 112, 0, 31);
228228 f16.pack.fraction = f32.pack.fraction >> 13;
229229 f16.pack.sign = f32.pack.sign;
230230
4646 // an error occured
4747 switch (code)
4848 {
49 case GL_FRAMEBUFFER_COMPLETE_EXT:
50 break;
51
5249 case GL_FRAMEBUFFER_UNSUPPORTED_EXT:
5350 ri.Printf(PRINT_WARNING, "R_CheckFBO: (%s) Unsupported framebuffer format\n", fbo->name);
5451 break;
9999
100100 #ifdef BUILD_FREETYPE
101101 void R_GetGlyphInfo( FT_GlyphSlot glyph, int *left, int *right, int *width, int *top, int *bottom, int *height, int *pitch ) {
102
103102 *left = _FLOOR( glyph->metrics.horiBearingX );
104103 *right = _CEIL( glyph->metrics.horiBearingX + glyph->metrics.width );
105104 *width = _TRUNC( *right - *left );
112111
113112
114113 FT_Bitmap *R_RenderGlyph( FT_GlyphSlot glyph, glyphInfo_t* glyphOut ) {
115
116114 FT_Bitmap *bit2;
117115 int left, right, width, top, bottom, height, pitch, size;
118116
250248 ri.Free( bitmap );
251249 return &glyph;
252250 }
253
254251
255252 src = bitmap->buffer;
256253 dst = imageOut + ( *yOut * 256 ) + *xOut;
279276
280277 src += glyph.pitch;
281278 dst += 256;
282
283279 }
284280 } else {
285281 for ( i = 0; i < glyph.height; i++ ) {
286 memcpy( dst, src, glyph.pitch );
282 Com_Memcpy( dst, src, glyph.pitch );
287283 src += glyph.pitch;
288284 dst += 256;
289285 }
310306 #endif
311307
312308 static int fdOffset;
313 static byte *fdFile;
309 static byte *fdFile;
314310
315311 int readInt( void ) {
316312 int i = fdFile[fdOffset] + ( fdFile[fdOffset + 1] << 8 ) + ( fdFile[fdOffset + 2] << 16 ) + ( fdFile[fdOffset + 3] << 24 );
319315 }
320316
321317 typedef union {
322 byte fred[4];
323 float ffred;
318 byte fred[4];
319 float ffred;
324320 } poor;
325321
326322 float readFloat( void ) {
376372 Com_sprintf( name, sizeof( name ), "fonts/fontImage_%i.dat",pointSize );
377373 for ( i = 0; i < registeredFontCount; i++ ) {
378374 if ( Q_stricmp( name, registeredFont[i].name ) == 0 ) {
379 memcpy( font, &registeredFont[i], sizeof( fontInfo_t ) );
375 Com_Memcpy( font, &registeredFont[i], sizeof( fontInfo_t ) );
380376 return;
381377 }
382378 }
403399 fdOffset += sizeof(font->glyphs[i].shaderName);
404400 }
405401 font->glyphScale = readFloat();
406 memcpy( font->name, &fdFile[fdOffset], MAX_QPATH );
407
408 // memcpy(font, faceData, sizeof(fontInfo_t));
402 Com_Memcpy( font->name, &fdFile[fdOffset], MAX_QPATH );
403
404 // Com_Memcpy(font, faceData, sizeof(fontInfo_t));
409405 Q_strncpyz( font->name, name, sizeof( font->name ) );
410406 for ( i = GLYPH_START; i <= GLYPH_END; i++ ) {
411407 font->glyphs[i].glyph = RE_RegisterShaderNoMip( font->glyphs[i].shaderName );
412408 }
413 memcpy( &registeredFont[registeredFontCount++], font, sizeof( fontInfo_t ) );
409 Com_Memcpy( &registeredFont[registeredFontCount++], font, sizeof( fontInfo_t ) );
414410 ri.FS_FreeFile(faceData);
415411 return;
416412 }
456452 maxHeight = 0;
457453
458454 for ( i = GLYPH_START; i <= GLYPH_END; i++ ) {
459 glyph = RE_ConstructGlyphInfo( out, &xOut, &yOut, &maxHeight, face, (unsigned char)i, qtrue );
455 RE_ConstructGlyphInfo( out, &xOut, &yOut, &maxHeight, face, (unsigned char)i, qtrue );
460456 }
461457
462458 xOut = 0;
508504 }
509505
510506 //Com_sprintf (name, sizeof(name), "fonts/fontImage_%i_%i", imageNumber++, pointSize);
511 image = R_CreateImage(name, imageBuff, 256, 256, IMGTYPE_COLORALPHA, IMGFLAG_CLAMPTOEDGE, 0 );
507 image = R_CreateImage( name, imageBuff, 256, 256, IMGTYPE_COLORALPHA, IMGFLAG_CLAMPTOEDGE, 0 );
512508 h = RE_RegisterShaderFromImage( name, LIGHTMAP_2D, image, qfalse );
513509 for ( j = lastStart; j < i; j++ ) {
514510 font->glyphs[j].glyph = h;
522518 if ( i == GLYPH_END + 1 )
523519 i++;
524520 } else {
525 memcpy( &font->glyphs[i], glyph, sizeof( glyphInfo_t ) );
521 Com_Memcpy( &font->glyphs[i], glyph, sizeof( glyphInfo_t ) );
526522 i++;
527523 }
528524 }
535531
536532 registeredFont[registeredFontCount].glyphScale = glyphScale;
537533 font->glyphScale = glyphScale;
538 memcpy( &registeredFont[registeredFontCount++], font, sizeof( fontInfo_t ) );
534 Com_Memcpy( &registeredFont[registeredFontCount++], font, sizeof( fontInfo_t ) );
539535
540536 if ( r_saveFontData->integer ) {
541537 ri.FS_WriteFile( va( "fonts/fontImage_%i.dat", pointSize ), font, sizeof( fontInfo_t ) );
145145 { "u_PrimaryLightRadius", GLSL_FLOAT },
146146
147147 { "u_CubeMapInfo", GLSL_VEC4 },
148
149 { "u_FireRiseDir", GLSL_VEC3 },
150 { "u_ZFadeLowest", GLSL_FLOAT },
151 { "u_ZFadeHighest", GLSL_FLOAT },
148152 };
149153
150154
301305 "#define alphaGen_t\n"
302306 "#define AGEN_LIGHTING_SPECULAR %i\n"
303307 "#define AGEN_PORTAL %i\n"
308 "#define AGEN_NORMALZFADE %i\n"
304309 "#endif\n",
305310 AGEN_LIGHTING_SPECULAR,
306 AGEN_PORTAL));
311 AGEN_PORTAL,
312 AGEN_NORMALZFADE));
307313
308314 Q_strcat(dest, size,
309315 va("#ifndef texenv_t\n"
15271533 {
15281534 case AGEN_LIGHTING_SPECULAR:
15291535 case AGEN_PORTAL:
1536 case AGEN_NORMALZFADE:
15301537 shaderAttribs |= GENERICDEF_USE_RGBAGEN;
15311538 break;
15321539 default:
29042904 {
29052905 for( x = 0; x < MAX_DLIGHTS; x++)
29062906 {
2907 tr.shadowCubemaps[x] = R_CreateImage(va("*shadowcubemap%i", x), (byte *)data, DEFAULT_SIZE, DEFAULT_SIZE, IMGTYPE_COLORALPHA, IMGFLAG_CLAMPTOEDGE | IMGFLAG_CUBEMAP, 0);
2907 tr.shadowCubemaps[x] = R_CreateImage(va("*shadowcubemap%i", x), NULL, PSHADOW_MAP_SIZE, PSHADOW_MAP_SIZE, IMGTYPE_COLORALPHA, IMGFLAG_CLAMPTOEDGE | IMGFLAG_CUBEMAP, 0);
29082908 }
29092909 }
29102910
33993399 skin->numSurfaces = 0;
34003400 skin->numModels = 0; //----(SA) added
34013401 skin->numSurfaces = 1;
3402 skin->surfaces[0] = ri.Hunk_Alloc( sizeof( skin->surfaces[0] ), h_low );
3402 skin->surfaces[0] = ri.Hunk_Alloc( sizeof( *skin->surfaces[0] ), h_low );
34033403 skin->surfaces[0]->shader = R_FindShader( name, LIGHTMAP_NONE, qtrue );
34043404 return hSkin;
34053405 }
35123512 skin = tr.skins[0] = ri.Hunk_Alloc( sizeof( skin_t ), h_low );
35133513 Q_strncpyz( skin->name, "<default skin>", sizeof( skin->name ) );
35143514 skin->numSurfaces = 1;
3515 skin->surfaces[0] = ri.Hunk_Alloc( sizeof( *skin->surfaces ), h_low );
3515 skin->surfaces[0] = ri.Hunk_Alloc( sizeof( *skin->surfaces[0] ), h_low );
35163516 skin->surfaces[0]->shader = tr.defaultShader;
35173517 }
35183518
170170 frac[i] = v - pos[i];
171171 if ( pos[i] < 0 ) {
172172 pos[i] = 0;
173 } else if ( pos[i] >= world->lightGridBounds[i] - 1 ) {
173 } else if ( pos[i] > world->lightGridBounds[i] - 1 ) {
174174 pos[i] = world->lightGridBounds[i] - 1;
175175 }
176176 }
194194 byte *data;
195195 int lat, lng;
196196 vec3_t normal;
197 qboolean ignore;
198197
199198 factor = 1.0;
200199 data = gridData;
201 ignore = qfalse;
202200 for ( j = 0 ; j < 3 ; j++ ) {
203201 if ( i & ( 1 << j ) ) {
204 if ((pos[j] + 1) >= world->lightGridBounds[j] - 1)
205 {
206 ignore = qtrue; // ignore values outside lightgrid
202 if ( pos[j] + 1 > world->lightGridBounds[j] - 1 ) {
203 break; // ignore values outside lightgrid
207204 }
208205 factor *= frac[j];
209206 data += gridStep[j];
212209 }
213210 }
214211
215 if ( ignore )
212 if ( j != 3 )
216213 continue;
217214
218215 if (world->hdrLightGrid)
782782 UNIFORM_PRIMARYLIGHTRADIUS,
783783
784784 UNIFORM_CUBEMAPINFO,
785
786 UNIFORM_FIRERISEDIR,
787 UNIFORM_ZFADELOWEST,
788 UNIFORM_ZFADEHIGHEST,
785789
786790 UNIFORM_COUNT
787791 } uniform_t;
19721972 fog_t *fog;
19731973
19741974 if ( tr.refdef.rdflags & RDF_NOWORLDMODEL ) {
1975 return 0;
1976 }
1977
1978 if ( ent->e.renderfx & RF_CROSSHAIR ) {
19751979 return 0;
19761980 }
19771981
411411 {
412412 GLSL_SetUniformFloat5(sp, UNIFORM_DEFORMPARAMS, deformParams);
413413 GLSL_SetUniformFloat(sp, UNIFORM_TIME, tess.shaderTime);
414
415 if (tess.shader->deforms[0].deformationWave.frequency < 0)
416 {
417 vec3_t worldUp;
418
419 if ( VectorCompare( backEnd.currentEntity->e.fireRiseDir, vec3_origin ) ) {
420 VectorSet( backEnd.currentEntity->e.fireRiseDir, 0, 0, 1 );
421 }
422
423 if ( backEnd.currentEntity->e.hModel ) { // world surfaces dont have an axis
424 VectorRotate( backEnd.currentEntity->e.fireRiseDir, backEnd.currentEntity->e.axis, worldUp );
425 } else {
426 VectorCopy( backEnd.currentEntity->e.fireRiseDir, worldUp );
427 }
428
429 GLSL_SetUniformVec3(sp, UNIFORM_FIRERISEDIR, worldUp);
430 }
414431 }
415432
416433 vector[0] = dl->color[0];
595612 vertColor[3] = 0.0f;
596613 break;
597614 case AGEN_NORMALZFADE:
615 baseColor[3] = pStage->constantColor[3] / 255.0f;
616 if (backEnd.currentEntity && backEnd.currentEntity->e.hModel)
617 {
618 baseColor[3] *= ((unsigned char *)backEnd.currentEntity->e.shaderRGBA)[3] / 255.0f;
619 }
620 vertColor[3] = 0.0f;
621 break;
598622 case AGEN_VERTEX:
599623 baseColor[3] = 0.0f;
600624 vertColor[3] = 1.0f;
790814
791815 GLSL_SetUniformFloat(sp, UNIFORM_VERTEXLERP, glState.vertexAttribsInterpolation);
792816
817 if ((deformGen != DGEN_NONE && tess.shader->deforms[0].deformationWave.frequency < 0 )
818 || pStage->alphaGen == AGEN_NORMALZFADE)
819 {
820 vec3_t worldUp;
821
822 if ( VectorCompare( backEnd.currentEntity->e.fireRiseDir, vec3_origin ) ) {
823 VectorSet( backEnd.currentEntity->e.fireRiseDir, 0, 0, 1 );
824 }
825
826 if ( backEnd.currentEntity->e.hModel ) { // world surfaces dont have an axis
827 VectorRotate( backEnd.currentEntity->e.fireRiseDir, backEnd.currentEntity->e.axis, worldUp );
828 } else {
829 VectorCopy( backEnd.currentEntity->e.fireRiseDir, worldUp );
830 }
831
832 GLSL_SetUniformVec3(sp, UNIFORM_FIRERISEDIR, worldUp);
833 }
834
793835 GLSL_SetUniformInt(sp, UNIFORM_DEFORMGEN, deformGen);
794836 if (deformGen != DGEN_NONE)
795837 {
822864 if (pStage->alphaGen == AGEN_PORTAL)
823865 {
824866 GLSL_SetUniformFloat(sp, UNIFORM_PORTALRANGE, tess.shader->portalRange);
867 }
868 else if (pStage->alphaGen == AGEN_NORMALZFADE)
869 {
870 float lowest, highest;
871 //qboolean zombieEffect = qfalse;
872
873 lowest = pStage->zFadeBounds[0];
874 if ( lowest == -1000 ) { // use entity alpha
875 lowest = backEnd.currentEntity->e.shaderTime;
876 //zombieEffect = qtrue;
877 }
878 highest = pStage->zFadeBounds[1];
879 if ( highest == -1000 ) { // use entity alpha
880 highest = backEnd.currentEntity->e.shaderTime;
881 //zombieEffect = qtrue;
882 }
883
884 // TODO: Handle normalzfade zombie effect
885
886 GLSL_SetUniformFloat(sp, UNIFORM_ZFADELOWEST, lowest);
887 GLSL_SetUniformFloat(sp, UNIFORM_ZFADEHIGHEST, highest);
825888 }
826889
827890 GLSL_SetUniformInt(sp, UNIFORM_COLORGEN, pStage->rgbGen);
10801143 {
10811144 GLSL_SetUniformFloat5(sp, UNIFORM_DEFORMPARAMS, deformParams);
10821145 GLSL_SetUniformFloat(sp, UNIFORM_TIME, tess.shaderTime);
1146
1147 if (tess.shader->deforms[0].deformationWave.frequency < 0)
1148 {
1149 vec3_t worldUp;
1150
1151 if ( VectorCompare( backEnd.currentEntity->e.fireRiseDir, vec3_origin ) ) {
1152 VectorSet( backEnd.currentEntity->e.fireRiseDir, 0, 0, 1 );
1153 }
1154
1155 if ( backEnd.currentEntity->e.hModel ) { // world surfaces dont have an axis
1156 VectorRotate( backEnd.currentEntity->e.fireRiseDir, backEnd.currentEntity->e.axis, worldUp );
1157 } else {
1158 VectorCopy( backEnd.currentEntity->e.fireRiseDir, worldUp );
1159 }
1160
1161 GLSL_SetUniformVec3(sp, UNIFORM_FIRERISEDIR, worldUp);
1162 }
10831163 }
10841164
10851165 if (wolfFog)
12661346 GLSL_SetUniformVec3(sp, UNIFORM_LOCALVIEWORIGIN, backEnd.or.viewOrigin);
12671347
12681348 GLSL_SetUniformFloat(sp, UNIFORM_VERTEXLERP, glState.vertexAttribsInterpolation);
1349
1350 if ((deformGen != DGEN_NONE && tess.shader->deforms[0].deformationWave.frequency < 0 )
1351 || pStage->alphaGen == AGEN_NORMALZFADE)
1352 {
1353 vec3_t worldUp;
1354
1355 if ( VectorCompare( backEnd.currentEntity->e.fireRiseDir, vec3_origin ) ) {
1356 VectorSet( backEnd.currentEntity->e.fireRiseDir, 0, 0, 1 );
1357 }
1358
1359 if ( backEnd.currentEntity->e.hModel ) { // world surfaces dont have an axis
1360 VectorRotate( backEnd.currentEntity->e.fireRiseDir, backEnd.currentEntity->e.axis, worldUp );
1361 } else {
1362 VectorCopy( backEnd.currentEntity->e.fireRiseDir, worldUp );
1363 }
1364
1365 GLSL_SetUniformVec3(sp, UNIFORM_FIRERISEDIR, worldUp);
1366 }
12691367
12701368 GLSL_SetUniformInt(sp, UNIFORM_DEFORMGEN, deformGen);
12711369 if (deformGen != DGEN_NONE)
13371435 if (pStage->alphaGen == AGEN_PORTAL)
13381436 {
13391437 GLSL_SetUniformFloat(sp, UNIFORM_PORTALRANGE, tess.shader->portalRange);
1438 }
1439 else if (pStage->alphaGen == AGEN_NORMALZFADE)
1440 {
1441 float lowest, highest;
1442 //qboolean zombieEffect = qfalse;
1443
1444 lowest = pStage->zFadeBounds[0];
1445 if ( lowest == -1000 ) { // use entity alpha
1446 lowest = backEnd.currentEntity->e.shaderTime;
1447 //zombieEffect = qtrue;
1448 }
1449 highest = pStage->zFadeBounds[1];
1450 if ( highest == -1000 ) { // use entity alpha
1451 highest = backEnd.currentEntity->e.shaderTime;
1452 //zombieEffect = qtrue;
1453 }
1454
1455 // TODO: Handle normalzfade zombie effect
1456
1457 GLSL_SetUniformFloat(sp, UNIFORM_ZFADELOWEST, lowest);
1458 GLSL_SetUniformFloat(sp, UNIFORM_ZFADEHIGHEST, highest);
13401459 }
13411460
13421461 GLSL_SetUniformInt(sp, UNIFORM_COLORGEN, pStage->rgbGen);
15521671 {
15531672 GLSL_SetUniformFloat5(sp, UNIFORM_DEFORMPARAMS, deformParams);
15541673 GLSL_SetUniformFloat(sp, UNIFORM_TIME, tess.shaderTime);
1674
1675 if (tess.shader->deforms[0].deformationWave.frequency < 0)
1676 {
1677 vec3_t worldUp;
1678
1679 if ( VectorCompare( backEnd.currentEntity->e.fireRiseDir, vec3_origin ) ) {
1680 VectorSet( backEnd.currentEntity->e.fireRiseDir, 0, 0, 1 );
1681 }
1682
1683 if ( backEnd.currentEntity->e.hModel ) { // world surfaces dont have an axis
1684 VectorRotate( backEnd.currentEntity->e.fireRiseDir, backEnd.currentEntity->e.axis, worldUp );
1685 } else {
1686 VectorCopy( backEnd.currentEntity->e.fireRiseDir, worldUp );
1687 }
1688
1689 GLSL_SetUniformVec3(sp, UNIFORM_FIRERISEDIR, worldUp);
1690 }
15551691 }
15561692
15571693 VectorCopy(backEnd.viewParms.or.origin, vector);
18111811 return qfalse;
18121812 }
18131813
1814 if ( r_greyscale->integer )
1815 {
1816 float luminance;
1817
1818 luminance = LUMA( shader.fogParms.color[0], shader.fogParms.color[1], shader.fogParms.color[2] );
1819 VectorSet( shader.fogParms.color, luminance, luminance, luminance );
1820 }
1821 else if ( r_greyscale->value )
1822 {
1823 float luminance;
1824
1825 luminance = LUMA( shader.fogParms.color[0], shader.fogParms.color[1], shader.fogParms.color[2] );
1826 shader.fogParms.color[0] = LERP( shader.fogParms.color[0], luminance, r_greyscale->value );
1827 shader.fogParms.color[1] = LERP( shader.fogParms.color[1], luminance, r_greyscale->value );
1828 shader.fogParms.color[2] = LERP( shader.fogParms.color[2], luminance, r_greyscale->value );
1829 }
1830
18141831 token = COM_ParseExt( text, qfalse );
18151832 if ( !token[0] ) {
18161833 ri.Printf( PRINT_WARNING, "WARNING: missing parm for 'fogParms' keyword in shader '%s'\n", shader.name );
23832400 {
23842401 case AGEN_LIGHTING_SPECULAR:
23852402 case AGEN_PORTAL:
2403 case AGEN_NORMALZFADE:
23862404 skip = qtrue;
23872405 break;
23882406 default:
454454 int clip;
455455 model_t *pModel;
456456 int i;
457 int fognum;
457458
458459 pModel = R_GetModelByHandle( ent->e.hModel );
459460
467468 R_SetupEntityLighting( &tr.refdef, ent );
468469 R_DlightBmodel( bmodel );
469470
471 //----(SA) modified
472 // determine if in fog
473 fognum = R_BmodelFogNum( ent, bmodel );
474
470475 for ( i = 0 ; i < bmodel->numSurfaces ; i++ ) {
471476 int surf = bmodel->firstSurface + i;
472477
473478 if (tr.world->surfacesViewCount[surf] != tr.viewCount)
474479 {
475480 tr.world->surfacesViewCount[surf] = tr.viewCount;
481 tr.world->surfaces[surf].fogIndex = fognum;
476482 R_AddWorldSurface( tr.world->surfaces + surf, tr.currentEntity->needDlights, 0 );
477483 }
478484 }
485 //----(SA) end
479486 }
480487
481488 /*
11051105 render_count = surface->numVerts;
11061106 }
11071107
1108 RB_CheckOverflow( render_count, surface->numTriangles );
1109
11101108 //DBG_SHOWTIME
11111109
11121110 //
11131111 // setup triangle list
11141112 //
1115 RB_CheckOverflow( surface->numVerts, surface->numTriangles * 3 );
1113 RB_CHECKOVERFLOW( render_count, surface->numTriangles * 3 );
11161114
11171115 //DBG_SHOWTIME
11181116
16771675 oldFrame = (mdrFrame_t *)((byte *)header + header->ofsFrames +
16781676 backEnd.currentEntity->e.oldframe * frameSize );
16791677
1680 RB_CheckOverflow( surface->numVerts, surface->numTriangles * 3 );
1678 RB_CHECKOVERFLOW( surface->numVerts, surface->numTriangles * 3 );
16811679
16821680 triangles = (int *) ((byte *)surface + surface->ofsTriangles);
16831681 indexes = surface->numTriangles * 3;
9999
100100 #ifdef BUILD_FREETYPE
101101 void R_GetGlyphInfo( FT_GlyphSlot glyph, int *left, int *right, int *width, int *top, int *bottom, int *height, int *pitch ) {
102
103102 *left = _FLOOR( glyph->metrics.horiBearingX );
104103 *right = _CEIL( glyph->metrics.horiBearingX + glyph->metrics.width );
105104 *width = _TRUNC( *right - *left );
112111
113112
114113 FT_Bitmap *R_RenderGlyph( FT_GlyphSlot glyph, glyphInfo_t* glyphOut ) {
115
116114 FT_Bitmap *bit2;
117115 int left, right, width, top, bottom, height, pitch, size;
118116
250248 ri.Free( bitmap );
251249 return &glyph;
252250 }
253
254251
255252 src = bitmap->buffer;
256253 dst = imageOut + ( *yOut * 256 ) + *xOut;
279276
280277 src += glyph.pitch;
281278 dst += 256;
282
283279 }
284280 } else {
285281 for ( i = 0; i < glyph.height; i++ ) {
286 memcpy( dst, src, glyph.pitch );
282 Com_Memcpy( dst, src, glyph.pitch );
287283 src += glyph.pitch;
288284 dst += 256;
289285 }
310306 #endif
311307
312308 static int fdOffset;
313 static byte *fdFile;
309 static byte *fdFile;
314310
315311 int readInt( void ) {
316312 int i = fdFile[fdOffset] + ( fdFile[fdOffset + 1] << 8 ) + ( fdFile[fdOffset + 2] << 16 ) + ( fdFile[fdOffset + 3] << 24 );
319315 }
320316
321317 typedef union {
322 byte fred[4];
323 float ffred;
318 byte fred[4];
319 float ffred;
324320 } poor;
325321
326322 float readFloat( void ) {
376372 Com_sprintf( name, sizeof( name ), "fonts/fontImage_%i.dat",pointSize );
377373 for ( i = 0; i < registeredFontCount; i++ ) {
378374 if ( Q_stricmp( name, registeredFont[i].name ) == 0 ) {
379 memcpy( font, &registeredFont[i], sizeof( fontInfo_t ) );
375 Com_Memcpy( font, &registeredFont[i], sizeof( fontInfo_t ) );
380376 return;
381377 }
382378 }
403399 fdOffset += sizeof(font->glyphs[i].shaderName);
404400 }
405401 font->glyphScale = readFloat();
406 memcpy( font->name, &fdFile[fdOffset], MAX_QPATH );
407
408 // memcpy(font, faceData, sizeof(fontInfo_t));
402 Com_Memcpy( font->name, &fdFile[fdOffset], MAX_QPATH );
403
404 // Com_Memcpy(font, faceData, sizeof(fontInfo_t));
409405 Q_strncpyz( font->name, name, sizeof( font->name ) );
410406 for ( i = GLYPH_START; i <= GLYPH_END; i++ ) {
411407 font->glyphs[i].glyph = RE_RegisterShaderNoMip( font->glyphs[i].shaderName );
412408 }
413 memcpy( &registeredFont[registeredFontCount++], font, sizeof( fontInfo_t ) );
409 Com_Memcpy( &registeredFont[registeredFontCount++], font, sizeof( fontInfo_t ) );
414410 ri.FS_FreeFile(faceData);
415411 return;
416412 }
456452 maxHeight = 0;
457453
458454 for ( i = GLYPH_START; i <= GLYPH_END; i++ ) {
459 glyph = RE_ConstructGlyphInfo( out, &xOut, &yOut, &maxHeight, face, (unsigned char)i, qtrue );
455 RE_ConstructGlyphInfo( out, &xOut, &yOut, &maxHeight, face, (unsigned char)i, qtrue );
460456 }
461457
462458 xOut = 0;
508504 }
509505
510506 //Com_sprintf (name, sizeof(name), "fonts/fontImage_%i_%i", imageNumber++, pointSize);
511 image = R_CreateImage( name, imageBuff, 256, 256, qfalse, qfalse, GL_CLAMP_TO_EDGE );
507 image = R_CreateImage( name, imageBuff, 256, 256, IMGTYPE_COLORALPHA, IMGFLAG_CLAMPTOEDGE, 0 );
512508 h = RE_RegisterShaderFromImage( name, LIGHTMAP_2D, image, qfalse );
513509 for ( j = lastStart; j < i; j++ ) {
514510 font->glyphs[j].glyph = h;
522518 if ( i == GLYPH_END + 1 )
523519 i++;
524520 } else {
525 memcpy( &font->glyphs[i], glyph, sizeof( glyphInfo_t ) );
521 Com_Memcpy( &font->glyphs[i], glyph, sizeof( glyphInfo_t ) );
526522 i++;
527523 }
528524 }
535531
536532 registeredFont[registeredFontCount].glyphScale = glyphScale;
537533 font->glyphScale = glyphScale;
538 memcpy( &registeredFont[registeredFontCount++], font, sizeof( fontInfo_t ) );
534 Com_Memcpy( &registeredFont[registeredFontCount++], font, sizeof( fontInfo_t ) );
539535
540536 if ( r_saveFontData->integer ) {
541537 ri.FS_WriteFile( va( "fonts/fontImage_%i.dat", pointSize ), font, sizeof( fontInfo_t ) );
20032003 skin->numSurfaces = 0;
20042004 skin->numModels = 0; //----(SA) added
20052005 skin->numSurfaces = 1;
2006 skin->surfaces[0] = ri.Hunk_Alloc( sizeof( skin->surfaces[0] ), h_low );
2006 skin->surfaces[0] = ri.Hunk_Alloc( sizeof( *skin->surfaces[0] ), h_low );
20072007 skin->surfaces[0]->shader = R_FindShader( name, LIGHTMAP_NONE, qtrue );
20082008 return hSkin;
20092009 }
21162116 skin = tr.skins[0] = ri.Hunk_Alloc( sizeof( skin_t ), h_low );
21172117 Q_strncpyz( skin->name, "<default skin>", sizeof( skin->name ) );
21182118 skin->numSurfaces = 1;
2119 skin->surfaces[0] = ri.Hunk_Alloc( sizeof( *skin->surfaces ), h_low );
2119 skin->surfaces[0] = ri.Hunk_Alloc( sizeof( *skin->surfaces[0] ), h_low );
21202120 skin->surfaces[0]->shader = tr.defaultShader;
21212121 }
21222122
165165 frac[i] = v - pos[i];
166166 if ( pos[i] < 0 ) {
167167 pos[i] = 0;
168 } else if ( pos[i] >= tr.world->lightGridBounds[i] - 1 ) {
168 } else if ( pos[i] > tr.world->lightGridBounds[i] - 1 ) {
169169 pos[i] = tr.world->lightGridBounds[i] - 1;
170170 }
171171 }
194194 data = gridData;
195195 for ( j = 0 ; j < 3 ; j++ ) {
196196 if ( i & ( 1 << j ) ) {
197 if ( pos[j] + 1 > tr.world->lightGridBounds[j] - 1 ) {
198 break; // ignore values outside lightgrid
199 }
197200 factor *= frac[j];
198201 data += gridStep[j];
199202 } else {
201204 }
202205 }
203206
207 if ( j != 3 ) {
208 continue;
209 }
204210 if ( !( data[0] + data[1] + data[2] ) ) {
205211 continue; // ignore samples in walls
206212 }
13421342 fog_t *fog;
13431343
13441344 if ( tr.refdef.rdflags & RDF_NOWORLDMODEL ) {
1345 return 0;
1346 }
1347
1348 if ( ent->e.renderfx & RF_CROSSHAIR ) {
13451349 return 0;
13461350 }
13471351
15281528 else if ( !Q_stricmp( token, "fogParms" ) ) {
15291529 if ( !ParseVector( text, 3, shader.fogParms.color ) ) {
15301530 return qfalse;
1531 }
1532
1533 if ( r_greyscale->integer )
1534 {
1535 float luminance;
1536
1537 luminance = LUMA( shader.fogParms.color[0], shader.fogParms.color[1], shader.fogParms.color[2] );
1538 VectorSet( shader.fogParms.color, luminance, luminance, luminance );
1539 }
1540 else if ( r_greyscale->value )
1541 {
1542 float luminance;
1543
1544 luminance = LUMA( shader.fogParms.color[0], shader.fogParms.color[1], shader.fogParms.color[2] );
1545 shader.fogParms.color[0] = LERP( shader.fogParms.color[0], luminance, r_greyscale->value );
1546 shader.fogParms.color[1] = LERP( shader.fogParms.color[1], luminance, r_greyscale->value );
1547 shader.fogParms.color[2] = LERP( shader.fogParms.color[2], luminance, r_greyscale->value );
15311548 }
15321549
15331550 token = COM_ParseExt( text, qfalse );
156156 {
157157 int i, j;
158158 char buf[ MAX_STRING_CHARS ] = { 0 };
159 SDL_Rect modes[ 128 ];
159 int numSDLModes;
160 SDL_Rect *modes;
160161 int numModes = 0;
161162
163 SDL_DisplayMode windowMode;
162164 int display = SDL_GetWindowDisplayIndex( SDL_window );
163 SDL_DisplayMode windowMode;
164
165 if( SDL_GetWindowDisplayMode( SDL_window, &windowMode ) < 0 )
165 numSDLModes = SDL_GetNumDisplayModes( display );
166
167 if( SDL_GetWindowDisplayMode( SDL_window, &windowMode ) < 0 || numSDLModes <= 0 )
166168 {
167169 ri.Printf( PRINT_WARNING, "Couldn't get window display mode, no resolutions detected\n" );
168170 return;
169171 }
170172
171 for( i = 0; i < SDL_GetNumDisplayModes( display ); i++ )
173 modes = SDL_calloc( (size_t)numSDLModes, sizeof( SDL_Rect ) );
174 if ( !modes )
175 {
176 ri.Error( ERR_FATAL, "Out of memory" );
177 }
178
179 for( i = 0; i < numSDLModes; i++ )
172180 {
173181 SDL_DisplayMode mode;
174182
178186 if( !mode.w || !mode.h )
179187 {
180188 ri.Printf( PRINT_ALL, "Display supports any resolution\n" );
189 SDL_free( modes );
181190 return;
182191 }
183192
219228 ri.Printf( PRINT_ALL, "Available modes: '%s'\n", buf );
220229 ri.Cvar_Set( "r_availableModes", buf );
221230 }
231 SDL_free( modes );
222232 }
223233
224234 /*
33 unsigned int width;
44 unsigned int height;
55 unsigned int bytes_per_pixel; /* 3:RGB, 4:RGBA */
6 unsigned char pixel_data[128 * 128 * 4 + 1];
6 unsigned char pixel_data[128 * 128 * 4];
77 } CLIENT_WINDOW_ICON = {
88 128, 128, 4,
99 "3\0\0\3773\0\0\3773\0\0\3773\0\0\3773\0\0\3773\0\0\3773\0\0\3773\0\0\377"
832832 Com_QueueEvent( 0, SE_KEY, K_MWHEELUP, qtrue, 0, NULL );
833833 Com_QueueEvent( 0, SE_KEY, K_MWHEELUP, qfalse, 0, NULL );
834834 }
835 else
835 else if( e.wheel.y < 0 )
836836 {
837837 Com_QueueEvent( 0, SE_KEY, K_MWHEELDOWN, qtrue, 0, NULL );
838838 Com_QueueEvent( 0, SE_KEY, K_MWHEELDOWN, qfalse, 0, NULL );
812812 signal( SIGHUP, Sys_SigHandler );
813813 signal( SIGQUIT, Sys_SigHandler );
814814 signal( SIGTRAP, Sys_SigHandler );
815 signal( SIGIOT, Sys_SigHandler );
815 signal( SIGABRT, Sys_SigHandler );
816816 signal( SIGBUS, Sys_SigHandler );
817817
818818 Sys_SetFloatEnv();
410410 intptr_t findhandle;
411411 int flag;
412412 int i;
413 int extLen;
413414
414415 if (filter) {
415416
443444 flag = _A_SUBDIR;
444445 }
445446
447 extLen = strlen( extension );
448
446449 Com_sprintf( search, sizeof(search), "%s\\*%s", directory, extension );
447450
448451 // search
456459
457460 do {
458461 if ( (!wantsubs && flag ^ ( findinfo.attrib & _A_SUBDIR )) || (wantsubs && findinfo.attrib & _A_SUBDIR) ) {
462 if (*extension) {
463 if ( strlen( findinfo.name ) < extLen ||
464 Q_stricmp(
465 findinfo.name + strlen( findinfo.name ) - extLen,
466 extension ) ) {
467 continue; // didn't match
468 }
469 }
459470 if ( nfiles == MAX_FOUND_FILES - 1 ) {
460471 break;
461472 }
5151
5252 unset X86_64_SDK
5353 unset X86_64_CFLAGS
54 unset X86_64_LDFLAGS
5554 unset X86_SDK
5655 unset X86_CFLAGS
57 unset X86_LDFLAGS
5856 unset PPC_64_SDK
5957 unset PPC_CFLAGS
60 unset PPC_LDFLAGS
6158
6259 if [ -d /Developer/SDKs/MacOSX10.5.sdk ]; then
6360 X86_64_SDK=/Developer/SDKs/MacOSX10.5.sdk
64 X86_64_CFLAGS="-arch x86_64 -isysroot /Developer/SDKs/MacOSX10.5.sdk \
65 -DMAC_OS_X_VERSION_MIN_REQUIRED=1050"
66 X86_64_LDFLAGS=" -mmacosx-version-min=10.5"
61 X86_64_CFLAGS="-arch x86_64 -isysroot /Developer/SDKs/MacOSX10.5.sdk"
6762
6863 X86_SDK=/Developer/SDKs/MacOSX10.5.sdk
69 X86_CFLAGS="-arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk \
70 -DMAC_OS_X_VERSION_MIN_REQUIRED=1050"
71 X86_LDFLAGS=" -mmacosx-version-min=10.5"
64 X86_CFLAGS="-arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk"
7265
7366 PPC_SDK=/Developer/SDKs/MacOSX10.5.sdk
74 PPC_CFLAGS="-arch ppc -isysroot /Developer/SDKs/MacOSX10.5.sdk \
75 -DMAC_OS_X_VERSION_MIN_REQUIRED=1050"
76 PPC_LDFLAGS=" -mmacosx-version-min=10.5"
67 PPC_CFLAGS="-arch ppc -isysroot /Developer/SDKs/MacOSX10.5.sdk"
7768 fi
7869
7970 if [ -z $X86_64_SDK ] || [ -z $X86_SDK ] || [ -z $PPC_SDK ]; then
110101 if [ -d build/release-release-x86_64 ]; then
111102 rm -r build/release-darwin-x86_64
112103 fi
113 (ARCH=x86_64 CC=gcc-4.0 CFLAGS=$X86_64_CFLAGS LDFLAGS=$X86_64_LDFLAGS make -j$NCPU) || exit 1;
104 (ARCH=x86_64 CC=gcc-4.0 CFLAGS=$X86_64_CFLAGS make -j$NCPU) || exit 1;
114105
115106 echo;echo
116107
118109 if [ -d build/release-darwin-x86 ]; then
119110 rm -r build/release-darwin-x86
120111 fi
121 (ARCH=x86 CC=gcc-4.0 CFLAGS=$X86_CFLAGS LDFLAGS=$X86_LDFLAGS make -j$NCPU) || exit 1;
112 (ARCH=x86 CC=gcc-4.0 CFLAGS=$X86_CFLAGS make -j$NCPU) || exit 1;
122113
123114 echo;echo
124115
126117 if [ -d build/release-darwin-ppc ]; then
127118 rm -r build/release-darwin-ppc
128119 fi
129 (ARCH=ppc CC=gcc-4.0 CFLAGS=$PPC_CFLAGS LDFLAGS=$PPC_LDFLAGS make -j$NCPU) || exit 1;
120 (ARCH=ppc CC=gcc-4.0 CFLAGS=$PPC_CFLAGS make -j$NCPU) || exit 1;
130121
131122 echo;echo
132123
6868
6969 unset ARCH_SDK
7070 unset ARCH_CFLAGS
71 unset ARCH_LDFLAGS
7271
7372 if [ -d /Developer/SDKs/MacOSX10.5.sdk ]; then
7473 ARCH_SDK=/Developer/SDKs/MacOSX10.5.sdk
75 ARCH_CFLAGS="-arch ${ARCH} -isysroot /Developer/SDKs/MacOSX10.5.sdk \
76 -DMAC_OS_X_VERSION_MIN_REQUIRED=1050"
77 ARCH_LDFLAGS=" -mmacosx-version-min=10.5"
74 ARCH_CFLAGS="-arch ${ARCH} -isysroot /Developer/SDKs/MacOSX10.5.sdk"
7875 fi
7976
8077
9390 if [ -d build/release-darwin-${BUILDARCH} ]; then
9491 rm -r build/release-darwin-${BUILDARCH}
9592 fi
96 (CC=${CC} CXX=${CXX} ARCH=${BUILDARCH} CFLAGS=$ARCH_CFLAGS LDFLAGS=$ARCH_LDFLAGS make -j$NCPU) || exit 1;
93 (CC=${CC} CXX=${CXX} ARCH=${BUILDARCH} CFLAGS=$ARCH_CFLAGS make -j$NCPU) || exit 1;
9794
9895 echo "Creating .app bundle $DESTDIR/$APPBUNDLE"
9996 if [ ! -d $DESTDIR/$APPBUNDLE/Contents/MacOS/$BASEDIR ]; then
5757 # "8" is the Darwin major kernel version.
5858 TIGERHOST=`uname -r |perl -w -p -e 's/\A(\d+)\..*\Z/$1/; $_ = (($_ >= 8) ? "1" : "0");'`
5959
60 # we want to use the oldest available SDK (10.6) for max compatiblity.
60 unset ARCH_CFLAGS
6161
62 unset ARCH_CFLAGS
63 unset ARCH_LDFLAGS
64
65 ARCH_CFLAGS="-arch ${ARCH} -DMAC_OS_X_VERSION_MIN_REQUIRED=1060"
66 ARCH_LDFLAGS=" -mmacosx-version-min=10.6"
62 ARCH_CFLAGS="-arch ${ARCH}"
6763
6864 if [ ! -d $DESTDIR ]; then
6965 mkdir -p $DESTDIR
7773 if [ -d build/release-darwin-${BUILDARCH} ]; then
7874 rm -r build/release-darwin-${BUILDARCH}
7975 fi
80 (CC=${CC} CXX=${CXX} ARCH=${BUILDARCH} CFLAGS=$ARCH_CFLAGS LDFLAGS=$ARCH_LDFLAGS make -j$NCPU) || exit 1;
76 (CC=${CC} CXX=${CXX} ARCH=${BUILDARCH} CFLAGS=$ARCH_CFLAGS make -j$NCPU) || exit 1;
8177
8278 echo "Creating .app bundle $DESTDIR/$APPBUNDLE"
8379 if [ ! -d $DESTDIR/$APPBUNDLE/Contents/MacOS/$BASEDIR ]; then
5757 # "8" is the Darwin major kernel version.
5858 TIGERHOST=`uname -r |perl -w -p -e 's/\A(\d+)\..*\Z/$1/; $_ = (($_ >= 8) ? "1" : "0");'`
5959
60 # we want to use the oldest available SDK (10.6) for max compatiblity.
60 unset ARCH_CFLAGS
6161
62 unset ARCH_CFLAGS
63 unset ARCH_LDFLAGS
64
65 ARCH_CFLAGS="-arch ${ARCH} -DMAC_OS_X_VERSION_MIN_REQUIRED=1060"
66 ARCH_LDFLAGS=" -mmacosx-version-min=10.6"
62 ARCH_CFLAGS="-arch ${ARCH}"
6763
6864 if [ ! -d $DESTDIR ]; then
6965 mkdir -p $DESTDIR
7773 if [ -d build/release-darwin-${BUILDARCH} ]; then
7874 rm -r build/release-darwin-${BUILDARCH}
7975 fi
80 (CC=${CC} CXX=${CXX} ARCH=${BUILDARCH} CFLAGS=$ARCH_CFLAGS LDFLAGS=$ARCH_LDFLAGS make -j$NCPU) || exit 1;
76 (CC=${CC} CXX=${CXX} ARCH=${BUILDARCH} CFLAGS=$ARCH_CFLAGS make -j$NCPU) || exit 1;
8177
8278 echo "Creating .app bundle $DESTDIR/$APPBUNDLE"
8379 if [ ! -d $DESTDIR/$APPBUNDLE/Contents/MacOS/$BASEDIR ]; then