initial import: tesseract r2280

This commit is contained in:
q66 2020-04-15 18:39:17 +02:00
commit 10515f5f63
364 changed files with 107883 additions and 0 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
*.o
src/build

83
README Normal file
View file

@ -0,0 +1,83 @@
Tesseract is a fork of the Cube 2: Sauerbraten engine. The goal of Tesseract
is to make mapping more fun by using modern dynamic rendering techniques, so
that you can get instant feedback on lighting changes, not just geometry.
No more long calclight pauses... just plop down the light, move it, change its
color, or do whatever else with it. It all happens in real-time now.
Tesseract removes the static lightmapping system of Sauerbraten and replaces
it with completely dynamic lighting system based on deferred shading and
shadowmapping.
It provides a bunch of new rendering features such as:
* deferred shading
* omnidirectional point lights using cubemap shadowmaps
* perspective projection spotlight shadowmaps
* orthographic projection sunlight using cascaded shadowmaps
* HDR rendering with tonemapping and bloom
* real-time diffuse global illumination for sunlight (radiance hints)
* volumetric lighting
* screen-space ambient occlusion
* screen-space reflections and refractions for water and glass (use as many water planes as you want now!)
* screen-space refractive alpha cubes
* deferred MSAA, subpixel morphological anti-aliasing (SMAA 1x, T2x, S2x, and 4x), FXAA, and temporal AA
* runs on both OpenGL Core (3.0+) and legacy (2.0+) contexts
Editing:
To make shadowmapped point lights, just make light entities as normal. Optionally you can control the shadowing properties of the light using attribute 5: 0 = shadows, 1 = no shadows, 2 = static shadows - world and mapmodels only (no playermodels or pickups). Shadowmaps are cached from frame to frame if no dynamic entities such as playermodels are rendered into them, so static lights (2) will generally be much faster than normal lights (0) during gameplay and should be used where possible. Unshadowed lights (1) are even faster as they further reduce shading costs, so they should also be used where possible.
To make cascaded shadowmapped sunlight, just use the normal sunlight commands:
sunlight
sunlightyaw
sunlightpitch
You can also set sunlightyaw and sunlightpitch from your current direction with the following command:
getsundir
You can control the diffuse global illumination of sunlight using the following parameters:
giscale - scales the contribution of indirect light
gidist - limits the distance which indirect light travels (smaller values are more intense, but higher values allow farther travel)
giaoscale - controls the contribution of atmospheric light
skylight - controls the color of atmospheric light
Screen-space ambient occlusion affects mostly ambient light and to a lesser degree sunlight,
but it does not affect point lights. If you want to make use of SSAO in your map, just use
the ambient command to set an appropriate ambient light color/intensity.
To make refractive alpha cubes:
First mark the cubes with the alpha material. Use valpha or texalpha to set the transparency level as normal.
Then use either of the following commands:
vrefract K [R G B]
K is the strength of the refraction, on a scale of 0 to 1, 1 meaning distortion spanning the entire screen, 0.5 spanning half the screen, etc.
The direction of the distortion is taken from the normal-map of the texture.
R G B are optional and specify a color for the refraction, with each component being on a scale of 0 to 1 as well.
After editing operations your map may be full of small cubes and triangles, and you will notice that your map looks faceted.
To fix this you still need to use the calclight command, however, it no longer generates lightmaps anymore.
It just does a remip optimization pass as well as calculates smoothed normals to make things look better.
Eventually this may be done differently using some sort of background optimization while editing.
To make decals:
newent decal SLOT YAW PITCH ROLL SIZE
If you don't specify the yaw, pitch, and roll, or leave them all 0, then newent will fill them with current direction you are looking at.
The slot refers to a decal slot in the map configuration, starting at offset 0.
The size is specified in cube units.
To make decal slots:
decelreset // functions like texture reset, clears all decal texture slots
setshader bumpspecmapdecal // shaders work like for world shaders, but with the -decal suffix instead of -world
texture decal "diffuse.png" // all decal slots start with the "decal" sub-slot instead of "0", and this texture must have an alpha-channel
texture n "normals.png"
texture s "spec.png"
To make volumetric lights:
Set attribute 5 of a light entity to 4.
The intensity of the volumetric lighting medium can be controlled by volscale and the color can by controlled by volcolour.

101
bin_unix/readme.txt Normal file
View file

@ -0,0 +1,101 @@
* Installing and Running Tesseract
*nix versions of Tesseract clients and standalone servers.
The clients function identical to the win32 client, see config.html for more
information about command-line options if necessary.
Please run "tesseract_unix" from the root Tesseract dir (NOT from inside the "bin_unix"
directory) to launch these, or set the TESS_DATA variable at the top of the "tesseract_unix"
script to an absolute path to allow it to be run from any location. Note that the "tesseract_unix"
script is set up to write any files (saved maps, configs, etc.) into the user's home
directory at "~/.tesseract".
Clients will need the following dynamic link libraries present:
* libGL (OpenGL)
* SDL2 (>= 2.0.0)
* SDL2_image
* SDL2_mixer
* libpng
* libjpeg
* zlib
If native binaries for your platform are not included, then try the following:
1) Ensure you have the DEVELOPMENT VERSIONS of the above libraries installed.
2) Type "make -C src install".
3) Re-run the "tesseract_unix" script if it succeeded.
The servers (bin_unix/linux_server or bin_unix/native_server) should need no libs
other than libstdc++ and zlib. Note that for the server to see the "config/server-init.cfg",
it must be run from the root Tesseract directory. If you run a server with the
"tesseract_unix -d" command, this happens automatically. However, if you wish to
run the standalone servers instead, then you may need to write an appropriate wrapper
script to change to the appropriate data directory before running the standalone
server binary, as described below in the packaging guide.
* Packaging Guide for Unix-like Operating System Developers/Maintainers
If you are packaging Tesseract up for redistribution in a Linux distribution or other
similar OS, please avoid using the "tesseract_unix" script in its default/unmodified form.
You should at least set the TESS_DATA variable to appropriately find the common Tesseract
data files, or better yet replace it with a more appropriate way of starting Tesseract using
the script as a basis. If the distribution happens to place program binaries in a specific
directory separate from data files, such as "/usr/bin", then much of the lines within the script
that deal with finding an appropriate binary can be removed, as they only exist to help people
running from the original Tesseract tarball. An example run script is shown further
below.
Also, please note, that if your distribution chooses to package the binaries and game data
as separate packages due to whatever licensing rules or cross-architecture package sharing,
that client binaries from newer Tesseract editions are NOT compatible with older versions of
game data, on whole, nor obviously compatible with newer versions of game data. Game data, as a
whole, and client binaries are only roughly compatible within individual Tesseract editions,
though patches to individual Tesseract editions generally always retain compatibility with
the game data.
For those writing custom Tesseract run scripts for packaging, they should adhere to the following
guidelines:
Tesseract finds all game files relative to the current directory from which Tesseract is run,
so any script running Tesseract should set its current directory to where the Tesseract data
files are located before it runs the Tesseract client binaries. No silly symlinking tricks should
be at all necessary.
When running the Tesseract client, one command-line switch should ALWAYS be supplied to
the client binary. This is "-u${HOME}/.tesseract", which will instruct Tesseract to
write any user private files such as saved maps and configurations to a private ".tesseract"
directory within each user's home directory. Tesseract will automatically create this
directory and any subdirectories for each user running it, so do not pre-create this directory
or install any symlinks within it - as some Linux distribution packages have erroneously done.
All command-line switches supplied to the Tesseract run script should be passed to the
Tesseract client after the "-u${HOME}/.tesseract" switch.
A simple script such as the following (with directory/file names set as appropriate) would
ultimately suffice for the client:
#!/bin/sh
TESS_DATA=/usr/share/games/tesseract
TESS_BIN=/usr/bin/tesseract_client
TESS_OPTIONS="-u${HOME}/.tesseract"
cd ${TESS_DATA}
exec ${TESS_BIN} ${TESS_OPTIONS} "$@"
A simple script for the server, which assumes a global default "config/server-init.cfg" in TESS_DATA,
but allows per-user overriding via the home directory, might be:
#!/bin/sh
TESS_DATA=/usr/share/games/tesseract
TESS_SERV_BIN=/usr/bin/tesseract_server
TESS_SERV_OPTIONS="-u${HOME}/.tesseract"
cd ${TESS_DATA}
exec ${TESS_SERV_BIN} ${TESS_SERV_OPTIONS} "$@"
With respect to libraries, make sure that you do not link Tesseract against any other ENet package
than the one that comes included with the Tesseract, as it may be different from the official ENet
releases and might fail to compile or communicate properly.

47
config/blendbrush.cfg Normal file
View file

@ -0,0 +1,47 @@
///////////////////////////////////////////////////////////////////////////////
// Texture-Blending Brush List //
///////////////////////////////////////////////////////////////////////////////
looplist2 n p [
"Dot 1px Soft" dot_1_soft
"Dot 1px Hard" dot_1_hard
"Dot 1px Solid" dot_1_solid
"Circle 8px Soft" circle_8_soft
"Circle 8px Hard" circle_8_hard
"Circle 8px Solid" circle_8_solid
"Circle 16px Soft" circle_16_soft
"Circle 16px Hard" circle_16_hard
"Circle 16px Solid" circle_16_solid
"Circle 32px Soft" circle_32_soft
"Circle 32px Hard" circle_32_hard
"Circle 32px Solid" circle_32_solid
"Circle 64px Soft" circle_64_soft
"Circle 64px Hard" circle_64_hard
"Circle 64px Solid" circle_64_solid
"Circle 128px Soft" circle_128_soft
"Circle 128px Hard" circle_128_hard
"Circle 128px Solid" circle_128_solid
"Circle 256px Soft" circle_256_soft
"Circle 256px Hard" circle_256_hard
"Circle 256px Solid" circle_256_solid
"Noise 64px Soft" noise_64_soft
"Noise 64px Hard" noise_64_hard
"Noise 128px Soft" noise_128_soft
"Noise 128px Hard" noise_128_hard
"Noise 256px Soft" noise_256_soft
"Noise 256px Hard" noise_256_hard
"Noise 512px Soft" noise_512_soft
"Noise 512px Hard" noise_512_hard
"Noise 1024px Soft" noise_1024_soft
"Noise 1024px Hard" noise_1024_hard
"Square 16px Hard" square_16_hard
"Square 16px Solid" square_16_solid
"Square 32px Hard" square_32_hard
"Square 32px Solid" square_32_solid
"Square 64px Hard" square_64_hard
"Square 64px Solid" square_64_solid
"Gradient 16px" gradient_16
"Gradient 32px" gradient_32
"Gradient 64px" gradient_64
"Gradient 128px" gradient_128
] [addblendbrush $n (concatword "media/blendbrush/" $p ".png")]

192
config/default.cfg Normal file
View file

@ -0,0 +1,192 @@
// These default settings are executed whenever "saved.cfg" is not available.
// Do not modify anything below, instead change settings in game, or add to autoexec.cfg
///////////////////////////////////////////////////////////////////////////////
// Settings //
///////////////////////////////////////////////////////////////////////////////
name "unnamed"
///////////////////////////////////////////////////////////////////////////////
// Console //
///////////////////////////////////////////////////////////////////////////////
miniconfilter 0x300 // display chat and team chat in mini-console
confilter (&~ 0xFFF $miniconfilter) // don't display other player frags or mini-console stuff in console
///////////////////////////////////////////////////////////////////////////////
// Universal Mouse Scrollwheel //
///////////////////////////////////////////////////////////////////////////////
ums_modifier = 0
ums_setmodifier = [ums_modifier = $arg1; onrelease [ums_modifier = 0]]
ums_delta = [[ums_delta_@(? $editing "edit" "game")_@ums_modifier] $arg1]
bind "MOUSEWHEELUP" [ums_delta 1]
bind "MOUSEWHEELDOWN" [ums_delta -1]
///////////////////////////////////////////////////////////////////////////////
// Game Binds //
///////////////////////////////////////////////////////////////////////////////
bind "MOUSELEFT" [shoot]
bind "MOUSERIGHT" [dozoom]
bind "MOUSEMIDDLE" [melee]
bind "MOUSEBACK" [melee]
bind "MOUSEFORWARD" [melee]
// Movement
bind "W" [forward]
bind "A" [left]
bind "S" [backward]
bind "D" [right]
bind "UP" [forward]
bind "DOWN" [backward]
bind "RIGHT" [right]
bind "LEFT" [left]
bind "F6" [toggleui "map_browser"]
bindvar "F8" [hidehud]
bind "F10" [toggleui "gamebind_reference"]
bind "F11" [toggleconsole; conskip -1000]
bind "F12" [screenshot]
bindvarquiet "PAUSE" [paused]
bind "INSERT" [addbot]
bind "DELETE" [delbot]
bind "PAGEUP" [conskip 5]
bind "PAGEDOWN" [conskip -1000]
bind "BACKQUOTE" [saycommand /]
bind "SLASH" [saycommand /]
bind "TAB" [holdui scoreboard]
bind "LSHIFT" [crouch]
bind "LCTRL" [crouch]
bind "SPACE" [jump]
bind "RETURN" [saycommand]
bind "E" [edittoggle]
bind "F" [melee]
bind "J" [taunt]
bind "R" [dropflag]
bind "T" [saycommand]
bind "Y" [sayteamcommand]
bind "1" [setweapon rail]
bind "2" [setweapon pulse]
bindvar "9" [thirdperson]
bind "0" [menu_master]
// Console scroll -or- Weapon change
ums_delta_game_0 = [if $fullconsole [conskip (* $arg1 3)] [nextweapon $arg1]]
///////////////////////////////////////////////////////////////////////////////
// Specatator Binds //
///////////////////////////////////////////////////////////////////////////////
specbind "MOUSELEFT" [nextfollow]
specbind "MOUSERIGHT" [nextfollow -1]
specbind "MOUSEMIDDLE" [nextspecmode]
specbind "SPACE" [nextspecmode]
specbind "LSHIFT" [floatspeed 1000;onrelease [floatspeed 100]]
specbind "LCTRL" [floatspeed 25;onrelease [floatspeed 100]]
///////////////////////////////////////////////////////////////////////////////
// Edit Binds //
///////////////////////////////////////////////////////////////////////////////
editbind "MOUSELEFT" [if $blendpaintmode [paintblendmap] [editdrag]]
editbind "MOUSEMIDDLE" [selcorners]
editbind "MOUSERIGHT" [if $blendpaintmode [rotateblendbrush] [editextend]]
editbind "MOUSEBACK" [toggleeditmovecut]
editbind "MOUSEFORWARD" [toggleeditmovecut]
editbind "LSHIFT" [floatspeed $editfloatspeed; onrelease [floatspeed 100]]
editbind "COMMA" [ums_setmodifier 9] // vSlot: rotate
editbind "PERIOD" [ums_setmodifier 10] // vSlot: scale
editbindmod "LCTRL" [passthrough]
editbind "SPACE" [cancelsel]
editbind "DELETE" [editdel]
editbind "HOME" [gotosel]
editbind "END" [ums_setmodifier 16; onrelease entautoview] // Hold and scroll to goto selected entities
editbind "1" [ums_setmodifier 11] // Entity attribute modifier 0
editbind "2" [ums_setmodifier 12] // Entity attribute modifier 1
editbind "3" [ums_setmodifier 13] // Entity attribute modifier 2
editbind "4" [ums_setmodifier 14] // Entity attribute modifier 3
editbind "5" [ums_setmodifier 15] // Entity attribute modifier 4
editbindvar "6" [allfaces]
editbindvar "7" [entselsnap]
editbindvar "8" [entediting]
editbind "9" [selentedit]
editbindvar "MINUS" [outline]
editbindvar "EQUALS" [wireframe]
// Editing Menus
editbind "F1" [menu_entity] // Add/Edit Entity
editbind "F2" [toggleui "texture_browser"] // Texture List
editbind "F3" [toggleui "mapmodel"] // Add Mapmodel
editbind "F4" [toggleui "material"] // Edit Material
editbind "F5" [menu_savemap] // Savemap
editbind "F7" [toggleui "env_settings"] // Environment Settings
editbind "F8" [toggleui "geo_prefab"] // World Geometry Prefab
editbind "F9" [toggleui "misc_editing"] // Miscellaneous Editing
editbind "F10" [toggleui "editbind_reference"] // Default Editbind Quick Reference
// Number Keypad
editbind "KP0" [blendpaintmode 0] // Exit paint blendmap mode
editbind "KP1" [blendpaintmode 1]
editbind "KP2" [blendpaintmode 2] // Paint
editbind "KP3" [blendpaintmode 3]
editbind "KP4" [blendpaintmode 4]
editbind "KP5" [blendpaintmode 5] // Erase
editbind "KP8" [nextblendbrush -1] // Select brush -
editbind "KP9" [nextblendbrush 1] // Select brush +
editbind "KP_DIVIDE" [floatspeed 10; echo [floatspeed @floatspeed]]
editbind "KP_MULTIPLY" [floatspeed 50; echo [floatspeed @floatspeed]]
editbind "KP_MINUS" [floatspeed 100; echo [floatspeed @floatspeed]]
editbind "KP_PLUS" [toggleeditmovecut] // Toggle MOUSERIGHT to move selection with or without contents
editbind "KP_ENTER" [entselect insel] // Select entities within area selection
editbind "B" [ums_setmodifier 6] // Change heightmap brush
editbind "C" [editcopy]
editbind "F" [ums_setmodifier 2] // Push face/corners selected
editbind "G" [ums_setmodifier 1] // Grid size
editbind "H" [if $hmapedit [editface 1 -1] [hmapedit 1]]
editbind "I" [redo]
editbind "K" [calclight]
editbindvar "L" [fullbright]
editbindvar "M" [showmat]
editbind "N" [selentfindall]
editbind "O" [ums_setmodifier 7] // vSlot: offset H
editbind "P" [ums_setmodifier 8] // vSlot: offset V
editbind "Q" [ums_setmodifier 3] // Push corner pointed at by cursor
editbind "R" [ums_setmodifier 4] // Geometry rotate -or- blend brush rotate
editbind "U" [undo; passthroughsel 0]
editbind "V" [editpaste]
editbind "X" [editflip] // Geometry flip
editbind "Y" [ums_setmodifier 5] // Change textures
editbind "Z" [history 0] // Repeat last saycommand
ums_delta_edit_0 = [if $fullconsole [conskip (* $arg1 3)] [if $blendpaintmode [nextblendbrush $arg1] [editfacewsel $arg1 1]]] // Console scroll -or- Change blend brush -or- Push/pull geometry
ums_delta_edit_1 = [nodebug [gridpower (+ $arg1 $gridpower)]] // Grid size
ums_delta_edit_2 = [editfacewsel $arg1 0] // Push face/corners selected
ums_delta_edit_3 = [editfacewsel $arg1 2] // Push corner pointed at by cursor
ums_delta_edit_4 = [if $blendpaintmode [rotateblendbrush $arg1] [editrotate $arg1]] // Geometry rotate -or- blend brush rotate
ums_delta_edit_5 = [edittex $arg1] // Change textures
ums_delta_edit_6 = [selecthbrush $arg1] // Change heightmap brush
ums_delta_edit_7 = [vdelta [voffset (* $arg1 $delta_multiplier2) 0]] // vSlot: offset H
ums_delta_edit_8 = [vdelta [voffset 0 (* $arg1 $delta_multiplier2)]] // vSlot: offset V
ums_delta_edit_9 = [vdelta [vrotate $arg1]] // vSlot: rotate
ums_delta_edit_10 = [vdelta [vscale (if (< $arg1 0) 0.5 2)]] // vSlot: scale
ums_delta_edit_11 = [entproperty 0 (* $arg1 $delta_multiplier1)]
ums_delta_edit_12 = [entproperty 1 (* $arg1 $delta_multiplier1)]
ums_delta_edit_13 = [entproperty 2 (* $arg1 $delta_multiplier1)]
ums_delta_edit_14 = [entproperty 3 (* $arg1 $delta_multiplier1)]
ums_delta_edit_15 = [entproperty 4 (* $arg1 $delta_multiplier1)]
ums_delta_edit_16 = [entautoview $arg1]
editbind "LALT" [delta_multiplier1 = 10;onrelease [delta_multiplier1 = 1]] // Entity attribute multiplier
editbind "RALT" [delta_multiplier2 = 32;onrelease [delta_multiplier2 = 16]] // vSlot: offset multiplier
delta_multiplier1 = 1
delta_multiplier2 = 16

View file

@ -0,0 +1,78 @@
// Notice: This list is dynamic and will change with every release.
// Please use a dedicated map.cfg.
mapmodelreset
mapmodel "obj_cube"
mapmodel "obj_sphere"
// Nieb/Complex
mapmodel "nieb/complex/bench/2"
mapmodel "nieb/complex/bench/3"
mapmodel "nieb/complex/box_copy-paper"
mapmodel "nieb/complex/box_large/label_0"
mapmodel "nieb/complex/box_large/label_a"
mapmodel "nieb/complex/box_large/label_b"
mapmodel "nieb/complex/box_small/label_0"
mapmodel "nieb/complex/box_small/label_a"
mapmodel "nieb/complex/box_small/label_b"
mapmodel "nieb/complex/box_small-open/label_0"
mapmodel "nieb/complex/box_small-open/label_a"
mapmodel "nieb/complex/box_small-open/label_b"
mapmodel "nieb/complex/chair_office"
mapmodel "nieb/complex/clock_wall"
mapmodel "nieb/complex/coffee_cup"
mapmodel "nieb/complex/computer_case_v/off"
mapmodel "nieb/complex/computer_case_v/on"
mapmodel "nieb/complex/computer_keyboard"
mapmodel "nieb/complex/computer_monitor"
mapmodel "nieb/complex/computer_mouse"
mapmodel "nieb/complex/cooling_fan"
mapmodel "nieb/complex/copy-machine"
mapmodel "nieb/complex/desk"
mapmodel "nieb/complex/desk/flip"
mapmodel "nieb/complex/door"
mapmodel "nieb/complex/door/flip"
mapmodel "nieb/complex/drinking_fountain"
mapmodel "nieb/complex/filing_cab1"
mapmodel "nieb/complex/filing_cab2"
mapmodel "nieb/complex/fire_alarm"
mapmodel "nieb/complex/fire_extinguisher"
mapmodel "nieb/complex/fire_sprinkler"
mapmodel "nieb/complex/garbage_bin"
mapmodel "nieb/complex/garbage_can"
mapmodel "nieb/complex/light_fluorescent/on"
mapmodel "nieb/complex/light_fluorescent/off"
mapmodel "nieb/complex/locker01"
mapmodel "nieb/complex/locker02"
mapmodel "nieb/complex/mop_bucket"
mapmodel "nieb/complex/pallet_lift"
mapmodel "nieb/complex/phone"
mapmodel "nieb/complex/picture/1"
mapmodel "nieb/complex/picture/2"
mapmodel "nieb/complex/picture/3"
mapmodel "nieb/complex/projector"
mapmodel "nieb/complex/projector_screen"
mapmodel "nieb/complex/safety_post"
mapmodel "nieb/complex/server_rack/1"
mapmodel "nieb/complex/server_rack/2"
mapmodel "nieb/complex/server_rack/3"
mapmodel "nieb/complex/shelf_storage"
mapmodel "nieb/complex/signage/1"
mapmodel "nieb/complex/signage/2"
mapmodel "nieb/complex/signage/3"
mapmodel "nieb/complex/sign_caution"
mapmodel "nieb/complex/sign_drinking"
mapmodel "nieb/complex/sign_exit"
mapmodel "nieb/complex/sign_fire_extinguisher"
mapmodel "nieb/complex/sign_restroom/f"
mapmodel "nieb/complex/sign_restroom/m"
mapmodel "nieb/complex/sign_room/conference"
mapmodel "nieb/complex/sign_room/office"
mapmodel "nieb/complex/sign_room/server"
mapmodel "nieb/complex/storage_tote"
mapmodel "nieb/complex/white_board"
// Nobiax
mapmodel "nobiax/cardboardbox1"
mapmodel "nobiax/gaz_tank"
mapmodel "nobiax/pallet2"

View file

@ -0,0 +1,181 @@
// Notice: This list is dynamic and will change with every release.
// Please use a dedicated map.cfg.
exec "config/default_map_models.cfg" // Default Mapmodel List
// Default Sky/Light Settings
setdefaultenv = [
skybox ""
atmo 1
sunlightpitch 50
sunlightyaw 30
sunlight 0xFFF8E0
skylight 0x7495B8
]
if $emptymap [setdefaultenv]
materialreset
loop+ i 1 4 [
texture [glass@i] "mat_glass/nieb/scratch2.png" // Glass Normals
texture [water@i] "mat_water/nieb/water.png" // Water (Unused)
texture 1 "mat_water/appleflap/water_normal.png" // Water Normals
texture 1 "mat_water/nieb/waterfall.png" // Waterfall Diffuse
texture 1 "mat_water/nieb/waterfall_normal.png" // Waterfall Normals
texture [lava@i] "mat_lava/nieb/lava.png" // Lava Diffuse
texture 1 "mat_lava/nieb/lava_normal.png" // Lava Normals
texture 1 "mat_lava/nieb/lava.png" // Lavafall Diffuse
texture 1 "mat_lava/nieb/lava_normal.png" // Lavafall Normals
]
decalreset
decalload "nieb/complex/loadingbay"
texturereset // Start world texture list
texsky // Dummy "sky" texture
texload "base/base1" // Default geometry texture
texload "base/base2"
texload "base/base3"
texload "base/base4"
texload "base/white"
texload "base/glow"
// Nieb/Complex
texload "nieb/complex/door_rail"
texload "nieb/complex/door_rail"; texrotate 1
texload "nieb/complex/electrical-outlet"
texload "nieb/complex/glass_2"
texload "nieb/complex/glass_subtle"
texload "nieb/complex/light-switch"
texload "nieb/complex/light01_off"
texload "nieb/complex/light01_on"
texload "nieb/complex/step01"
texload "nieb/complex/step01"; texrotate 1
texload "nieb/complex/step02"
texload "nieb/complex/step02"; texrotate 1
texload "nieb/complex/step03"
texload "nieb/complex/step03"; texrotate 1
texload "nieb/complex/tile01"
texload "nieb/complex/tile02"
texload "nieb/complex/vent"
texload "nieb/complex/wall01"
texload "nieb/complex/woodfloor01"
texload "nieb/complex/woodfloor02"
texload "nieb/complex/woodfloor03"
// CGTextures
texload "cgtextures/buildingshighrise0290"
texload "cgtextures/buildingshighrise0341"
texload "cgtextures/buildingshighrise0436"
texload "cgtextures/carpet01"
texload "cgtextures/ceilingtile01"
texload "cgtextures/tilesplain0119"
texload "cgtextures/tilesplain0119"; texrotate 1
// AGF81
texload "agf81/concrete1"
texload "agf81/concrete1w"
texload "agf81/concrete2"
texload "agf81/concrete2"; texrotate 1
texload "agf81/concrete3"
texload "agf81/concrete3"; texrotate 1
texload "agf81/concrete4"
texload "agf81/concrete5"
texload "agf81/door_texture_2"
texload "agf81/metal_a2"
// Nobiax
texload "nobiax/pattern019"
texload "nobiax/pattern037"
texload "nobiax/pattern042"
texload "nobiax/pattern044"
texload "nobiax/pattern045"
texload "nobiax/pattern047"
texload "nobiax/pattern055"
texload "nobiax/pattern056"
texload "nobiax/pattern057"
texload "nobiax/pattern205"
texload "nobiax/pattern208"
// philipk2
texload "philipk2/pk02_ceiling03"
texload "philipk2/pk02_door01"
texload "philipk2/pk02_door02"
texload "philipk2/pk02_door03"
texload "philipk2/pk02_floor01"
texload "philipk2/pk02_floor02"
texload "philipk2/pk02_floor03"
texload "philipk2/pk02_floor04"
texload "philipk2/pk02_floor05"
texload "philipk2/pk02_floor06a"
texload "philipk2/pk02_floor06b"
texload "philipk2/pk02_floor07"
texload "philipk2/pk02_floor08a"
texload "philipk2/pk02_floor08b"
texload "philipk2/pk02_floor09a"
texload "philipk2/pk02_floor09b"
texload "philipk2/pk02_floor10"
texload "philipk2/pk02_floor11"
texload "philipk2/pk02_floor12a"
texload "philipk2/pk02_floor12b"
texload "philipk2/pk02_floor13a"
texload "philipk2/pk02_floor13b"
texload "philipk2/pk02_floor_cyl01"
texload "philipk2/pk02_floor_cyl02"
texload "philipk2/pk02_generic01a"
texload "philipk2/pk02_generic01b"
texload "philipk2/pk02_light01a"
texload "philipk2/pk02_light01b"
texload "philipk2/pk02_panels01a"
texload "philipk2/pk02_panels01b"
texload "philipk2/pk02_panels01c"
texload "philipk2/pk02_plates01a"
texload "philipk2/pk02_plates01b"
texload "philipk2/pk02_rock01"
texload "philipk2/pk02_sand01"
texload "philipk2/pk02_switches01a"
texload "philipk2/pk02_trim01"
texload "philipk2/pk02_trim02"
texload "philipk2/pk02_trim03"
texload "philipk2/pk02_trim04a"
texload "philipk2/pk02_trim04b"
texload "philipk2/pk02_trim_set01a"
texload "philipk2/pk02_trim_set01b"
texload "philipk2/pk02_trim_set02a"
texload "philipk2/pk02_trim_set02b"
texload "philipk2/pk02_wall01"
texload "philipk2/pk02_wall03a"
texload "philipk2/pk02_wall03b"
texload "philipk2/pk02_wall04a"
texload "philipk2/pk02_wall04b"
texload "philipk2/pk02_wall05a"
texload "philipk2/pk02_wall05b"
texload "philipk2/pk02_wall05c"
texload "philipk2/pk02_wall06a"
texload "philipk2/pk02_wall06b"
texload "philipk2/pk02_wall07a"
texload "philipk2/pk02_wall07b"
texload "philipk2/pk02_wall_big01a"
texload "philipk2/pk02_wall_big01b"
texload "philipk2/pk02_wall_big02a"
texload "philipk2/pk02_wall_big02b"
texload "philipk2/pk02_wall08a"
texload "philipk2/pk02_wall08b"
texload "philipk2/pk02_ceiling02"
texload "philipk2/pk02_computer01a"
texload "philipk2/pk02_computer01b"
texload "philipk2/pk02_computer01c"
texload "philipk2/pk02_light02a"
texload "philipk2/pk02_light02b"
texload "philipk2/pk02_light02c"
texload "philipk2/pk02_light02"
texload "philipk2/pk02_light03"
texload "philipk2/pk02_pipes01"
texload "philipk2/pk02_switches01b"
texload "philipk2/pk02_switches01c"
texload "philipk2/pk02_wall02a"
texload "philipk2/pk02_wall02b"
texload "philipk2/pk02_wall02c"
setshader "stdworld"

3
config/font.cfg Normal file
View file

@ -0,0 +1,3 @@
loopfiles f "media/interface/font" cfg [
exec (concatword "media/interface/font/" $f ".cfg")
]

38
config/game.cfg Normal file
View file

@ -0,0 +1,38 @@
// Game specific config stuff goes here
// Scoreboard Options
defvarp showscore 0 1 1
defvarp showkills 0 1 1
defvarp showdeaths 0 0 1
defvarp showip 0 0 1
defvarp sbtransparent 0 1 1
nextspecmode = [
if $specmode [
specmode (mod (+ $specmode 1) 3)
] [
specmode (? (>= (getfollow) 0) 2 1)
]
]
defvarp zoomtoggle 0 0 1
dozoom = [if $zoomtoggle [zoom (? $zoom -1 1)] [zoom 1 ; onrelease [zoom -1]]]
sayteamcommand = [inputcommand $arg1 [sayteam $commandbuf] "[team]"]
mapcomplete = [complete $arg1 media/map ogz]
mapcomplete map
modenames = "edit rdm pdm rtdm ptdm rctf pctf"
loop i (listlen $modenames) [
mname = (at $modenames $i)
alias $mname [if (mode @i) [if (> $numargs 0) [map $arg1] [map]]]
mapcomplete $mname
]
demo = [stopdemo; if (mode -1) [map $arg1]]
complete demo . dmo
allowedittoggle = [result 1]

24
config/glsl.cfg Normal file
View file

@ -0,0 +1,24 @@
exec "config/glsl/shared.cfg"
exec "config/glsl/misc.cfg"
exec "config/glsl/hud.cfg"
exec "config/glsl/world.cfg"
exec "config/glsl/decal.cfg"
exec "config/glsl/grass.cfg"
exec "config/glsl/model.cfg"
exec "config/glsl/ao.cfg"
exec "config/glsl/gi.cfg"
exec "config/glsl/particle.cfg"
exec "config/glsl/stain.cfg"
exec "config/glsl/material.cfg"
exec "config/glsl/deferred.cfg"
exec "config/glsl/tonemap.cfg"
exec "config/glsl/volumetric.cfg"
exec "config/glsl/sky.cfg"
exec "config/glsl/aa.cfg"
exec "config/glsl/scale.cfg"
exec "config/glsl/blur.cfg"
exec "config/glsl/ui.cfg"
exec "config/glsl/postfx.cfg"
exec "config/glsl/edit.cfg"
exec "config/glsl/movie.cfg"

88
config/glsl/aa.cfg Normal file
View file

@ -0,0 +1,88 @@
////////////////////////////////////////////////
//
// anti-aliasing
//
////////////////////////////////////////////////
lazyshader 0 "tqaaresolve" [
attribute vec4 vvertex;
@(screentexcoord 0)
varying vec2 texcoord0;
@(? $tqaaresolvegather [
varying vec2 texcoord1;
])
void main(void)
{
gl_Position = vvertex;
texcoord0 = vtexcoord0;
@(? $tqaaresolvegather [
texcoord1 = vtexcoord0 - 0.5;
])
}
] [
@(gfetchdefs tex2)
uniform vec4 quincunx;
uniform sampler2DRect tex0, tex1;
uniform mat4 reprojectmatrix;
uniform vec2 maxvelocity;
uniform vec2 colorweight;
varying vec2 texcoord0;
@(? $tqaaresolvegather [
varying vec2 texcoord1;
])
fragdata(0) vec4 fragcolor;
void main(void)
{
@(gdepthunpack depth [gfetch(tex2, texcoord0)] [
vec4 prevtc = reprojectmatrix * vec4(depth*texcoord0, depth, 1.0);
] [
vec4 prevtc = reprojectmatrix * vec4(texcoord0, depth, 1.0);
])
vec2 vel = prevtc.xy/prevtc.w - texcoord0;
float scale = clamp(maxvelocity.x*inversesqrt(dot(vel, vel) + 1e-6), 0.0, 1.0);
float mask = 1.0 - texture2DRect(tex0, texcoord0 + quincunx.xy).a;
vec4 color = texture2DRect(tex0, texcoord0 + mask*quincunx.xy);
vec4 prevcolor = texture2DRect(tex1, texcoord0 + mask*(quincunx.zw + vel*scale));
@(? $tqaaresolvegather [
vec4 l0 = textureGather(tex0, texcoord1, 1);
vec4 l1 = textureGatherOffset(tex0, texcoord1, ivec2(1, 1), 1);
float l2 = texture2DRectOffset(tex0, texcoord0, ivec2(1, -1)).g;
float l3 = texture2DRectOffset(tex0, texcoord0, ivec2(-1, 1)).g;
vec4 l01min = min(l0, l1), l01max = max(l0, l1);
l01min.xy = min(l01min.xy, l01min.zw);
l01max.xy = max(l01max.xy, l01max.zw);
float lmin = min(min(l01min.x, l01min.y), min(l2, l3));
float lmax = max(max(l01max.x, l01max.y), max(l2, l3));
] [
float l0 = texture2DRect(tex0, texcoord0 + vec2(-1.0, -0.5)).g;
float l1 = texture2DRect(tex0, texcoord0 + vec2( 0.5, -1.0)).g;
float l2 = texture2DRect(tex0, texcoord0 + vec2( 1.0, 0.5)).g;
float l3 = texture2DRect(tex0, texcoord0 + vec2(-0.5, 1.0)).g;
float lmin = min(color.g, min(min(l0, l1), min(l2, l3)));
float lmax = max(color.g, max(max(l0, l1), max(l2, l3)));
])
float weight = 0.5 - 0.5*clamp((colorweight.x*max(prevcolor.g - lmax, lmin - prevcolor.g) + colorweight.y) / (lmax - lmin + 1e-4), 0.0, 1.0);
weight *= clamp(1.0 - 2.0*(prevcolor.a - color.a), 0.0, 1.0);
fragcolor.rgb = mix(color.rgb, prevcolor.rgb, weight);
fragcolor.a = color.a;
}
]
smaaopt = [ >= (strstr $smaaopts $arg1) 0 ]
smaashaders = [
smaapreset = $arg1
smaaopts = $arg2
exec "config/glsl/smaa.cfg"
]
fxaaopt = [ >= (strstr $fxaaopts $arg1) 0 ]
fxaashaders = [
fxaapreset = $arg1
fxaaopts = $arg2
exec "config/glsl/fxaa.cfg"
]

285
config/glsl/ao.cfg Normal file
View file

@ -0,0 +1,285 @@
////////////////////////////////////////////////
//
// ambient obscurance
//
////////////////////////////////////////////////
aotapoffsets = [
"-0.933103, 0.025116"
"-0.432784, -0.989868"
"0.432416, -0.413800"
"-0.117770, 0.970336"
"0.837276, 0.531114"
"-0.184912, 0.200232"
"-0.955748, 0.815118"
"0.946166, -0.998596"
"-0.897519, -0.581102"
"0.979248, -0.046602"
"-0.155736, -0.488204"
"0.460310, 0.982178"
]
ambientobscurancevariantshader = [
lineardepth = (>= (strstr $arg2 "l") 0)
packeddepth = (>= (strstr $arg2 "p") 0)
derivnormal = (>= (strstr $arg2 "d") 0)
maxaotaps = $arg3
shader 0 $arg1 [
attribute vec4 vvertex;
@(screentexcoord 0)
@(screentexcoord 1)
varying vec2 texcoord0, texcoord1;
void main(void)
{
gl_Position = vvertex;
texcoord0 = vtexcoord0;
texcoord1 = vtexcoord1;
}
] [
@(gfetchdefs tex0 (&& $msaasamples [! $lineardepth]) gdepthfetch)
@(gfetchdefs tex1 $msaasamples gnormfetch)
@(gdepthunpackparams)
uniform sampler2D tex2;
uniform vec3 tapparams;
uniform vec2 contrastparams;
uniform vec4 offsetscale;
uniform float prefilterdepth;
@(? (! $derivnormal) [
uniform mat3 normalmatrix;
])
@(? $lineardepth [
#define depthtc gl_FragCoord.xy
] [
#define depthtc texcoord0
])
uniform vec3 gdepthpackparams;
varying vec2 texcoord0, texcoord1;
fragdata(0) vec4 fragcolor;
void main(void)
{
@(if (&& $derivnormal [= $aodepthformat 1]) [result [
@(gdepthunpack depth [gnormfetch(tex1, texcoord0)] [
vec2 tapscale = tapparams.xy/depth;
] [
float w = depth*gdepthscale.y + gdepthscale.z;
depth = gdepthscale.x/w;
vec2 tapscale = tapparams.xy*w;
])
]] [result [
@(gdepthunpack depth [gdepthfetch(tex0, depthtc)] [
vec2 tapscale = tapparams.xy/depth;
] [
float w = depth*gdepthscale.y + gdepthscale.z;
depth = gdepthscale.x/w;
vec2 tapscale = tapparams.xy*w;
] $lineardepth (? $lineardepth (! $aodepthformat) (= $gdepthformat 1)) packdepth)
]])
vec2 dpos = depthtc*offsetscale.xy + offsetscale.zw, pos = depth*dpos;
@(if $derivnormal [result [
vec2 ddepth = vec2(dFdx(depth), dFdy(depth));
ddepth *= step(abs(ddepth), vec2(4.0));
vec3 normal;
normal.xy = (depth+ddepth.yx)*offsetscale.yx;
normal.z = normal.x*normal.y;
normal.xy *= -ddepth;
normal.z -= dot(dpos, normal.xy);
normal = normalize(normal);
]] [result [
vec3 normal = gnormfetch(tex1, texcoord0).rgb*2.0 - 1.0;
float normscale = inversesqrt(dot(normal, normal));
normal *= normscale > 0.75 ? normscale : 0.0;
normal = normalmatrix * normal;
]])
vec2 noise = texture2D(tex2, texcoord1).rg*2.0-1.0;
float obscure = 0.0;
@(loopconcat i $maxaotaps [result [
vec2 offset@[i] = reflect(vec2(@(at $aotapoffsets $i)), noise);
offset@[i] = depthtc + tapscale * offset@[i];
@(gdepthunpack [depth@[i]] [gdepthfetch(tex0, offset@[i])] [] [] $lineardepth (&& $lineardepth (! $aodepthformat)))
vec3 v@[i] = vec3(depth@[i]*(offset@[i]*offsetscale.xy + offsetscale.zw) - pos, depth@[i] - depth);
float dist2@[i] = dot(v@[i], v@[i]);
obscure += step(dist2@[i], tapparams.z) * max(0.0, dot(v@[i], normal) + depth*1.0e-2) / (dist2@[i] + 1.0e-5);
]])
obscure = pow(clamp(1.0 - contrastparams.x*obscure, 0.0, 1.0), contrastparams.y);
@(if $derivnormal [result [
vec2 weights = step(abs(ddepth), vec2(prefilterdepth)) * (2.0*fract((gl_FragCoord.xy - 0.5)*0.5) - 0.5);
]] [result [
vec2 weights = step(fwidth(depth), prefilterdepth) * (2.0*fract((gl_FragCoord.xy - 0.5)*0.5) - 0.5);
]])
obscure -= dFdx(obscure) * weights.x;
obscure -= dFdy(obscure) * weights.y;
@(if $packeddepth [
if $aodepthformat [result [
fragcolor.rg = vec2(obscure, depth);
]] [result [
@(if (&& (! $lineardepth) (!= $gdepthformat 1)) [gpackdepth packdepth depth])
fragcolor = vec4(packdepth, obscure);
]]
] [result [
fragcolor = vec4(obscure, 0.0, 0.0, 1.0);
]])
}
]
]
ambientobscuranceshader = [
ambientobscurancevariantshader (format "ambientobscurance%1%2" $arg1 $arg2) $arg1 $arg2
]
shader 0 "linearizedepth" [
attribute vec4 vvertex;
@(screentexcoord 0)
varying vec2 texcoord0;
void main(void)
{
gl_Position = vvertex;
texcoord0 = vtexcoord0;
}
] [
@(gfetchdefs tex0 $msaasamples)
uniform vec3 gdepthpackparams;
varying vec2 texcoord0;
fragdata(0) vec4 fragcolor;
void main(void)
{
@(if (! $aodepthformat) [
if (= $gdepthformat 1) [result [
fragcolor = gfetch(tex0, texcoord0);
]] [result [
@(gdepthunpack depth [gfetch(tex0, texcoord0)])
@(gpackdepth packdepth depth)
fragcolor = vec4(packdepth, 1.0);
]]
] [result [
@(gdepthunpack depth [gfetch(tex0, texcoord0)])
fragcolor.r = depth;
]])
}
]
bilateralvariantshader = [
linear = (>= (strstr $arg2 "l") 0)
packed = (>= (strstr $arg2 "p") 0)
upscaled = (>= (strstr $arg2 "u") 0)
numtaps = $arg3
reduced = $arg4
filterdir = $arg5
shader 0 $arg1 [
attribute vec4 vvertex;
@(if $reduced [result [
@(screentexcoord 0)
varying vec2 texcoord0;
]])
@(if $upscaled [result [
@(screentexcoord 1)
varying vec2 texcoord1;
]])
void main(void)
{
gl_Position = vvertex;
@(? $reduced [texcoord0 = vtexcoord0;])
@(? $upscaled [texcoord1 = vtexcoord1;])
}
] [
@(gfetchdefs tex1 (&& $msaasamples [! $linear]))
uniform sampler2DRect tex0;
uniform vec2 bilateralparams;
uniform vec3 gdepthpackparams;
@(? $reduced [varying vec2 texcoord0;])
@(? $upscaled [varying vec2 texcoord1;])
fragdata(0) vec4 fragcolor;
void main(void)
{
#define tc @(? $upscaled [texcoord1] [gl_FragCoord.xy])
#define depthtc @(? $reduced [texcoord0] [gl_FragCoord.xy])
#define tapvec(type, i) @(? (=s $filterdir "x") [type(i, 0.0)] [type(0.0, i)])
#define texval(i) texture2DRect(tex0, tc + tapvec(vec2, i))
#define texvaloffset(i) texture2DRectOffset(tex0, tc, tapvec(ivec2, i))
#define depthval(i) gfetch(tex1, depthtc + tapvec(vec2, i))
#define depthvaloffset(i) gfetchoffset(tex1, depthtc, tapvec(ivec2, i))
@(cond [$packed] [
if $aodepthformat [result [
vec2 vals = texture2DRect(tex0, tc).rg;
#define color vals.x
@(if $upscaled [gdepthunpack depth [gfetch(tex1, depthtc)]] [result [
#define depth vals.y
]])
]] [result [
vec4 vals = texture2DRect(tex0, tc);
#define color vals.a
@(if $upscaled [gdepthunpack depth [gfetch(tex1, depthtc)]] [result [
float depth = dot(vals.rgb, gdepthunpackparams);
]])
]]
] [$linear] [result [
float color = gfetch(tex0, tc).r;
@(if $aodepthformat [result [
float depth = gfetch(tex1, depthtc).r;
]] [result [
float depth = dot(gfetch(tex1, depthtc).rgb, gdepthunpackparams);
]])
]] [result [
float color = texture2DRect(tex0, tc).r;
@(gdepthunpack depth [gfetch(tex1, depthtc)])
]])
float weights = 1.0;
@(loopconcat i (* 2 $numtaps) [
curtap = (- $i $numtaps)
if (>= $curtap 0) [curtap = (+ $curtap 1)]
curtapoffset = (* $curtap 2)
curdepthoffset = (<< $curtapoffset $reduced)
curtexval = [texval@(? (<= $mintexrectoffset $curtapoffset $maxtexrectoffset) "offset")(@(+f $curtapoffset))]
curdepthval = [depthval@(? (<= $mintexrectoffset $curdepthoffset $maxtexrectoffset) "offset")(@(+f $curdepthoffset))]
result [
@(cond [$packed] [
if $aodepthformat [result [
vec2 vals@[i] = @[curtexval].rg;
#define color@[i] vals@[i].x
#define depth@[i] vals@[i].y
]] [result [
vec4 vals@[i] = @[curtexval];
#define color@[i] vals@[i].a
float depth@[i] = dot(vals@[i].rgb, gdepthunpackparams);
]]
] [$linear] [
result [
float color@[i] = @[curtexval].r;
@(if $aodepthformat [result [
float depth@[i] = @[curdepthval].r;
]] [result [
float depth@[i] = dot(@[curdepthval].rgb, gdepthunpackparams);
]])
]
] [
result [
float color@[i] = @[curtexval].r;
@(gdepthunpack [depth@[i]] $curdepthval)
]
])
depth@[i] -= depth;
float weight@[i] = exp2(@(-f 0 (* $curtap $curtap))*bilateralparams.x - depth@[i]*depth@[i]*bilateralparams.y);
weights += weight@[i];
color += weight@[i] * color@[i];
]
])
@(if (&& (=s $filterdir "x") $packed) [
if $aodepthformat [result [
fragcolor.rg = vec2(color / weights, depth);
]] [result [
@(if $upscaled [gpackdepth packdepth depth] [result [
#define packdepth vals.rgb
]])
fragcolor = vec4(packdepth, color / weights);
]]
] [result [
fragcolor = vec4(color / weights, 0.0, 0.0, 1.0);
]])
}
]
]
bilateralshader = [
bilateralvariantshader (format "bilateralx%1%2" $arg1 $arg2) $arg1 $arg2 $arg3 x
bilateralvariantshader (format "bilateraly%1%2" $arg1 $arg2) $arg1 $arg2 $arg3 y
]

68
config/glsl/blur.cfg Normal file
View file

@ -0,0 +1,68 @@
////////////////////////////////////////////////
//
// separable blur with up to 7 taps
//
////////////////////////////////////////////////
blurshader = [
shader 0 $arg1 [
attribute vec4 vvertex;
@(screentexcoord 0)
uniform float offsets[8];
varying vec2 texcoord0, texcoordp1, texcoordn1;
@(loopconcat+ i 2 (min (- $arg2 1) 2) [result [
varying vec2 texcoordp@i, texcoordn@i;
]])
void main(void)
{
gl_Position = vvertex;
texcoord0 = vtexcoord0;
vec2 tcp = vtexcoord0, tcn = vtexcoord0;
tcp.@arg3 += offsets[1];
tcn.@arg3 -= offsets[1];
texcoordp1 = tcp;
texcoordn1 = tcn;
@(loopconcat+ i 2 (min (- $arg2 1) 2) [result [
tcp.@arg3 = vtexcoord0.@arg3 + offsets[@@i];
tcn.@arg3 = vtexcoord0.@arg3 - offsets[@@i];
texcoordp@i = tcp;
texcoordn@i = tcn;
]])
}
] [
uniform float weights[8];
uniform float offsets[8];
uniform sampler@[arg4] tex0;
varying vec2 texcoord0, texcoordp1, texcoordn1;
@(loopconcat+ i 2 (min (- $arg2 1) 2) [result [
varying vec2 texcoordp@i, texcoordn@i;
]])
fragdata(0) vec4 fragcolor;
void main(void)
{
#define texval(coords) texture@[arg4](tex0, (coords))
vec4 val = texval(texcoord0) * weights[0];
@(loopconcat+ i 1 $arg2 [
if (< $i 4) [result [
val += weights[@@i] * (texval(texcoordp@i) + texval(texcoordn@i));
]] [result [
val += weights[@@i] *
@(if (=s $arg3 "x") [result [
(texval(vec2(texcoord0.x + offsets[@@i], texcoord0.y)) + texval(vec2(texcoord0.x - offsets[@@i], texcoord0.y)));
]] [result [
(texval(vec2(texcoord0.x, texcoord0.y + offsets[@@i])) + texval(vec2(texcoord0.x, texcoord0.y - offsets[@@i])));
]])
]]
])
fragcolor = val;
}
]
]
loop+ i 1 7 [
blurshader (format "blurx%1" $i) $i x 2D
blurshader (format "blury%1" $i) $i y 2D
blurshader (format "blurx%1rect" $i) $i x 2DRect
blurshader (format "blury%1rect" $i) $i y 2DRect
]

290
config/glsl/decal.cfg Normal file
View file

@ -0,0 +1,290 @@
////////////////////////////////////////////////
//
// decals
//
////////////////////////////////////////////////
// decaltype:
// e -> reserve envmap texture slot
// r -> envmap reflection
// R -> modulate envmap reflection with spec map
// s -> spec
// S -> spec map
// n -> normal map
// p -> parallax
// g -> glow
// G -> pulse glow
// b -> keep normals
// 0 -> pass 0
// 1 -> pass 1
dtopt = [ >= (strstr $decaltype $arg1) 0 ]
decalvariantshader = [
local decaltype
decaltype = $arg2
stype = (? (dtopt "e") 3 1)
srow = (? (dtopt "1") 0 -1)
if (dtopt "G") [
stype = (+ $stype 0x10)
defuniformparam "glowcolor" 1 1 1 // glow color
defuniformparam "pulseglowspeed" 1 // pulse frequency (Hz)
defuniformparam "pulseglowcolor" 0 0 0 // pulse glow color
] [if (dtopt "g") [
defuniformparam "glowcolor" 1 1 1 // glow color
]]
if (dtopt "R") [
defuniformparam "envscale" 1 1 1 // reflectivity map multiplier
] [if (dtopt "r") [
defuniformparam "envscale" 0.2 0.2 0.2 // reflectivity
]]
reuseuniformparam "gloss" 1 // glossiness
if (dtopt "S") [
defuniformparam "specscale" 2 2 2 // spec map multiplier
] [if (dtopt "s") [
defuniformparam "specscale" 1 1 1 // spec multiplier
]]
if (dtopt "p") [
defuniformparam "parallaxscale" 0.06 -0.03 // parallax scaling
]
if (dtopt "n") [
defuniformparam "bumpblend" 1 // alpha-blend strength for normals
]
variantshader $stype $arg1 $srow [
attribute vec4 vvertex;
@(? (dtopt "n") [
attribute vec4 vtangent;
varying mat3 world;
] [
varying vec3 nvec;
])
attribute vec4 vnormal;
attribute vec3 vtexcoord0;
uniform mat4 camprojmatrix;
varying vec4 texcoord0;
@(? (|| (dtopt "p") (dtopt "r")) [
uniform vec3 camera;
varying vec3 camvec;
])
@(? (dtopt "G") [uniform float millis; flat varying float pulse;])
void main(void)
{
gl_Position = camprojmatrix * vvertex;
texcoord0.xyz = vtexcoord0;
texcoord0.w = 3.0*vnormal.w;
@(? (dtopt "n") [
vec3 bitangent = cross(vnormal.xyz, vtangent.xyz) * vtangent.w;
// calculate tangent -> world transform
world = mat3(vtangent.xyz, bitangent, vnormal.xyz);
] [
nvec = vnormal.xyz;
])
@(? (|| (dtopt "p") (dtopt "r")) [
camvec = camera - vvertex.xyz;
])
@(? (dtopt "G") [
pulse = abs(fract(millis*pulseglowspeed.x)*2.0 - 1.0);
])
}
] [
@(cond [dtopt "0"] [result [
fragdata(0) vec4 gcolor;
fragblend(0) vec4 gcolorblend;
]] [dtopt "1"] [
? $usepacknorm [
fragdata(0) vec4 gnormal;
] [
fragdata(0) vec4 gnormal;
fragblend(0) vec4 gnormalblend;
]
] [result [
fragdata(0) vec4 gcolor;
fragdata(1) vec4 gnormal;
]])
uniform sampler2D diffusemap;
uniform vec4 colorparams;
varying vec4 texcoord0;
@(? (dtopt "n") [
uniform sampler2D normalmap;
varying mat3 world;
] [
varying vec3 nvec;
#define bumpblend vec4(1.0)
])
@(? (|| (dtopt "p") (dtopt "r")) [varying vec3 camvec;])
@(? (|| (dtopt "g") (dtopt "S")) [uniform sampler2D glowmap;])
@(? (dtopt "G") [flat varying float pulse;])
@(? (dtopt "r") [uniform samplerCube envmap;])
void main(void)
{
@(if (dtopt "n") [result [
@(? (dtopt "p") [
float height = texture2D(normalmap, texcoord0.xy).a;
vec3 camvecn = normalize(camvec);
vec2 dtc = texcoord0.xy + (camvecn * world).xy*(height*parallaxscale.x + parallaxscale.y);
] [
#define dtc texcoord0.xy
])
@(? (|| (! (dtopt "0")) (dtopt "r")) [
vec3 bump = texture2D(normalmap, dtc).rgb*2.0 - 1.0;
vec3 bumpw = world * bump;
#define nvec bumpw
])
]] [result [
#define dtc texcoord0.xy
]])
vec4 diffuse = texture2D(diffusemap, dtc);
@(if (dtopt "g") [result [
vec4 glowspec = texture2D(glowmap, dtc);
#define glow glowspec.rgb
#define spec glowspec.a
glow *= @(? (dtopt "G") [mix(glowcolor.xyz, pulseglowcolor.xyz, pulse)] [glowcolor.xyz]);
glow *= diffuse.a;
]])
@(if (dtopt "0") [result [
@(if (&& (dtopt "S") [! (dtopt "g")]) [result [
float spec = @(? (|| (! (dtopt "n")) (dtopt "p")) [texture2D(glowmap, dtc).r] [texture2D(normalmap, dtc).a]);
]])
@(gspecpack [gloss.x] (if (dtopt "s") [? (dtopt "S") [spec * specscale.x] [specscale.x]]))
]])
@(if (dtopt "1") [
? (dtopt "g") [
vec3 gcolor = diffuse.rgb*colorparams.rgb;
]
] [result [
gcolor.rgb = diffuse.rgb*colorparams.rgb;
@(if (dtopt "r") [result [
@(? (|| (! (dtopt "n")) (! (dtopt "p"))) [
vec3 camvecn = normalize(camvec);
])
float invfresnel = dot(camvecn, nvec);
vec3 rvec = 2.0*nvec*invfresnel - camvecn;
vec3 reflect = textureCube(envmap, rvec).rgb * diffuse.a;
@(? (dtopt "R") [
vec3 rmod = envscale.xyz*spec;
] [
#define rmod envscale.xyz
])
reflect *= diffuse.a;
gcolor.rgb = mix(gcolor.rgb, reflect, rmod*clamp(1.0 - invfresnel, 0.0, 1.0));
]])
]])
@(if (dtopt "g") [gglowpack glow packnorm])
@(if (! (dtopt "0")) [result [
vec3 normal = normalize(nvec);
@(gnormpackdef normal packnorm)
]])
float inside = clamp(texcoord0.z, 0.0, 1.0) * clamp(texcoord0.w, 0.0, 1.0);
float alpha = inside * diffuse.a;
@(cond [dtopt "0"] [result [
gcolor.rgb *= inside;
gcolor.a *= alpha;
gcolorblend = vec4(alpha);
]] [dtopt "1"] [
? $usepacknorm [
gnormal.a = alpha * bumpblend.x;
] [
gnormalblend = vec4(alpha * bumpblend.x);
]
] [result [
gcolor.rgb *= inside;
gcolor.a = alpha;
@(? (dtopt "b") [
gnormal = vec4(0.0);
] [
gnormal.rgb *= alpha * bumpblend.x;
gnormal.a = alpha * bumpblend.x;
])
]])
}
]
]
decalshader = [
decaltype = $arg2
stype = (? (dtopt "e") 3 1)
defershader $stype $arg1 [
if $maxdualdrawbufs [
decalvariantshader @@arg1 @@(concatword $arg2 "0")
if @@(! (dtopt "b")) [
decalvariantshader @@@arg1 @@@(concatword $arg2 "1")
]
] [
decalvariantshader @@arg1 @@arg2
]
]
]
decalshader "stddecal" "b"
decalshader "specdecal" "bs"
decalshader "specmapdecal" "bsS"
decalshader "glowdecal" "g"
decalshader "pulseglowdecal" "gG"
decalshader "envdecal" "ber"
decalshader "envspecdecal" "besr"
decalshader "envspecmapdecal" "besSrR"
decalshader "envglowdecal" "erg"
decalshader "envpulseglowdecal" "ergG"
decalshader "bumpdecal" "n"
decalshader "bumpspecdecal" "ns"
decalshader "bumpspecmapdecal" "nsS"
decalshader "bumpglowdecal" "ng"
decalshader "bumpspecglowdecal" "nsg"
decalshader "bumpspecmapglowdecal" "nsSg"
decalshader "bumppulseglowdecal" "ngG"
decalshader "bumpspecpulseglowdecal" "nsgG"
decalshader "bumpspecmappulseglowdecal" "nsSgG"
decalshader "bumpparallaxdecal" "np"
decalshader "bumpspecparallaxdecal" "nps"
decalshader "bumpspecmapparallaxdecal" "npsS"
decalshader "bumpparallaxglowdecal" "npg"
decalshader "bumpspecparallaxglowdecal" "npsg"
decalshader "bumpspecmapparallaxglowdecal" "npsSg"
decalshader "bumpparallaxpulseglowdecal" "npgG"
decalshader "bumpspecparallaxpulseglowdecal" "npsgG"
decalshader "bumpspecmapparallaxpulseglowdecal" "npsSgG"
decalshader "bumpenvdecal" "ner"
decalshader "bumpenvspecdecal" "nesr"
decalshader "bumpenvspecmapdecal" "nesSrR"
decalshader "bumpenvglowdecal" "nerg"
decalshader "bumpenvspecglowdecal" "neosrg"
decalshader "bumpenvspecmapglowdecal" "nesSrRg"
decalshader "bumpenvpulseglowdecal" "neorgG"
decalshader "bumpenvspecpulseglowdecal" "nesrgG"
decalshader "bumpenvspecmappulseglowdecal" "nesSrRgG"
decalshader "bumpenvparallaxdecal" "nepr"
decalshader "bumpenvspecparallaxdecal" "nepsr"
decalshader "bumpenvspecmapparallaxdecal" "nepsSrR"
decalshader "bumpenvparallaxglowdecal" "neprg"
decalshader "bumpenvspecparallaxglowdecal" "nepsrg"
decalshader "bumpenvspecmapparallaxglowdecal" "nepsSrRg"
decalshader "bumpenvparallaxpulseglowdecal" "neprgG"
decalshader "bumpenvspecparallaxpulseglowdecal" "nepsrgG"
decalshader "bumpenvspecmapparallaxpulseglowdecal" "nepsSrRgG"

688
config/glsl/deferred.cfg Normal file
View file

@ -0,0 +1,688 @@
////////////////////////////////////////////////
//
// deferred shading
//
////////////////////////////////////////////////
msaadetectedges = [
result [{
@(if (glext "GL_EXT_shader_samples_identical") [result [
if(textureSamplesIdenticalEXT(tex1, ivec2(gl_FragCoord.xy)))
{
@arg1
}
else
]])
{
vec4 e = texelFetch(tex1, ivec2(gl_FragCoord.xy), 0);
e.xyz -= 0.5;
float maxdiff = 0.98*0.98*dot(e.xyz, e.xyz);
@(loopconcat+ i 1 (- $msaasamples 1) [result [
vec4 e@i = texelFetch(tex1, ivec2(gl_FragCoord.xy), @i);
e@i.xyz -= 0.5;
if(abs(e.w-e@i.w) <= 2.0/255.0 && pow(dot(e@i.xyz, e.xyz), 2.0) >= maxdiff*dot(e@i.xyz, e@i.xyz))
{
]])
@arg1
@(loopconcat+ i 1 (- $msaasamples 1) [result [
}
]])
}
}]
]
lazyshader 0 msaaedgedetect [
attribute vec4 vvertex;
void main(void)
{
gl_Position = vvertex;
}
] [
@(? (glext "GL_EXT_shader_samples_identical") [
#extension GL_EXT_shader_samples_identical : enable
])
uniform sampler2DMS tex1;
void main(void)
{
@(msaadetectedges [discard;])
}
]
// deferredlighttype:
// p -> point-light shadow (default cubemap)
// c -> CSM
// a -> AO
// A -> AO sun
// r -> radiance hints
// G -> 5x5 weighted gather filter
// g -> 3x3 weighted gather filter
// E -> 5x5 weighted bilinear filter
// F -> 3x3 weighted bilinear filter
// f -> 4x rotated grid filter
// m -> minimap
// M -> multisampled
// O -> sample 1
// R -> manual resolve
// S -> sample shading
// T -> edge detection
// n -> tile batching
// s -> spotlights
// t -> transparent
// b -> combined base/light variants
// d -> avatar shadow dist bias variants
// D -> disable dist bias
// z -> spec toggle
dlopt = [ >= (strstr $deferredlighttype $arg1) 0 ]
unpacknormbias = 0.005
unpacknormscale = (+f 1 (*f 2 $unpacknormbias))
unpacknorm = [
result [
@arg1 = clamp(@arg1 * @(divf $unpacknormscale 0.5) - @(+f (*f $unpacknormscale (divf 0.25 0.5)) $unpacknormbias), 0.0, 1.0);
]
]
unpackspec = [
result [
vec3 camdir = normalize(camera - pos.xyz);
float facing = 2.0*dot(normal.xyz, camdir);
float specscale = min(3.0*(diffuse.a + 0.5/255.0), 2.999), gloss = floor(specscale);
specscale -= gloss;
specscale = (0.35 + 0.15*gloss) * specscale / (1.5 - specscale);
gloss = 5.0 + 17.0*gloss;
]
]
unpackdistbias = [
cond [$avatar] [result [
#define distbias -@avatarshadowbias
]] [|| $transparent [dlopt "d"] [dlopt "D"] [dlopt "m"]] [result [
#define distbias 0.0
]] [result [
float distbias = -@avatarshadowbias * @(? (dlopt "a") [avatarmask] [step(fogcoord, @avatarshadowdist) * @(? $msaasamples [step(0.75, normal.a)] [normal.a])]);
]]
]
deferredlightvariantshader = [
local deferredlighttype
deferredlighttype = $arg3
numsplits = (+ $arg4 0)
numrh = (+ $arg5 0)
numlights = (+ $arg6 0)
baselight = (< (mod $arg2 4) 2)
spotlight = (>= (mod $arg2 8) 4)
transparent = (<= 8 $arg2 16)
avatar = (<= 17 $arg2 31)
variantshader 0 $arg1 $arg2 (? (< $arg2 0) [
attribute vec4 vvertex;
uniform mat4 lightmatrix;
void main(void)
{
gl_Position = lightmatrix * vvertex;
}
]) [
@(? (&& (dlopt "S") [< $glslversion 400]) [
#extension GL_ARB_sample_shading : enable
])
@(? (&& (dlopt "T") [glext "GL_EXT_shader_samples_identical"]) [
#extension GL_EXT_shader_samples_identical : enable
])
@(if (dlopt "M") [result [
uniform sampler2DMS tex0, tex1, tex3 @(? $transparent [, tex2]);
]] [result [
uniform sampler2DRect tex0, tex1, tex3 @(? $transparent [, tex2]);
]])
@(if (|| (dlopt "p") (dlopt "c")) [
if (|| (dlopt "g") (dlopt "G")) [if (> $usetexgather 1) [result [
uniform sampler2DShadow tex4;
]] [result [
uniform sampler2D tex4;
]]] [result [
uniform sampler2DRectShadow tex4;
]]
])
@(if $numlights [result [
uniform vec4 lightpos[@@numlights];
uniform vec4 lightcolor[@@numlights];
@(if $spotlight [result [
uniform vec4 spotparams[@@numlights];
]])
@(if (dlopt "p") [result [
uniform vec4 shadowparams[@@numlights];
uniform vec2 shadowoffset[@@numlights];
]])
]])
@(if $numsplits [result [
uniform vec4 csmtc[@@numsplits];
uniform vec3 csmoffset[@@numsplits];
uniform vec2 csmz;
]])
@(if (dlopt "c") [result [
uniform mat3 csmmatrix;
uniform vec3 sunlightdir;
uniform vec3 sunlightcolor;
@(if (dlopt "r") [result [
uniform vec3 skylightcolor;
uniform float giscale, rhnudge, rhbounds;
uniform vec4 rhtc[@@numrh];
uniform sampler3D tex6, tex7, tex8, tex9;
<