Compare commits

...

No commits in common. "master" and "gl4" have entirely different histories.
master ... gl4

242 changed files with 40782 additions and 10220 deletions

3
.gitignore vendored
View file

@ -1,3 +1,2 @@
*.o
build
bin_unix/native_*
build

View file

@ -1,80 +0,0 @@
# OctaCore license
All new OctaCore code is provided to you under the terms of the BSD-2-Clause
license, while the original Tesseract/Sauerbraten portions retain their original
license. OctaCore only ships the altered source code of the original projects,
without the media content.
Copyright (c) 2020 Daniel "q66" Kolesa
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimers.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimers in the
documentation and/or other materials provided with the distribution.
**THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.**
# Tesseract
OctaCore is derived from the Tesseract codebase:
Tesseract game engine source code, any release.
Copyright (C) 2001-2020 Wouter van Oortmerssen, Lee Salzman, Mike Dysart,
Robert Pointon, Quinton Reeves, and Benjamin Segovia
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
# Sauerbraten
Tesseract is based on Sauerbraten:
Sauerbraten game engine source code, any release.
Copyright (C) 2001-2020 Wouter van Oortmerssen, Lee Salzman, Mike Dysart,
Robert Pointon, and Quinton Reeves
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.

16
README
View file

@ -18,7 +18,6 @@ It provides a bunch of new rendering features such as:
* HDR rendering with tonemapping and bloom
* real-time diffuse global illumination for sunlight (radiance hints)
* volumetric lighting
* transparent shadows
* 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
@ -82,18 +81,3 @@ 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.
To make transparent shadows:
This is toggled on a per-map basis by setting "alphashadow" to 0 (off), 1 (sunlight), or 2 (sunlight and point lights).
If set to 1, you must set attribute 5 of a light entity to 16 to enable transparent shadows for that point light.
If set to 2, all point lights automatically cast transparent shadows.
If a light is volumetric, regardless of "alphashadow" setting, the light entity's attribute 5 must be set to 20 (4 | 16) for it
to cast a volumetric transparent shadow.
To make a cube cast transparent shadows, use the "alpha" material. The texalpha/valpha commands can be then used to control the alpha
of the cube, which then is used to determine the intensity of the transparent shadow. This intensity can be further scaled by setting
the global map variable "alphashadowscale" (0..2).
If a texture slot has an alpha texture (slot "a"), this can be used to mask the alpha of the cube. This masked alpha will then be used
to further mask the transparent shadow.

View file

@ -1,9 +1,3 @@
# OctaCore
**Last Tesseract SVN import:** 2425
This is the work in progress engine part of the newly revived OctaForge
project.
Nothing much to see here yet, besides a stripped down, partially refactored
Tesseract codebase.
OctaCore is the engine component of OctaForge 2.0.

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.

View file

@ -11,7 +11,7 @@ name "unnamed"
///////////////////////////////////////////////////////////////////////////////
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
fullconsole = 0
///////////////////////////////////////////////////////////////////////////////
// Universal Mouse Scrollwheel //

View file

@ -16,17 +16,20 @@ setdefaultenv = [
if $emptymap [setdefaultenv]
materialreset
texture glass "mat_glass/nieb/scratch2.png" // Glass Normals
texture water "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 "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
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
@ -37,4 +40,142 @@ texturereset // Start world texture list
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"

View file

@ -10,7 +10,6 @@ exec "config/glsl/gi.cfg"
exec "config/glsl/particle.cfg"
exec "config/glsl/stain.cfg"
exec "config/glsl/material.cfg"
exec "config/glsl/smfilter.cfg"
exec "config/glsl/deferred.cfg"
exec "config/glsl/tonemap.cfg"
exec "config/glsl/volumetric.cfg"

View file

@ -5,19 +5,15 @@
////////////////////////////////////////////////
lazyshader 0 "tqaaresolve" [
attribute vec4 vvertex;
in vec4 vvertex;
@(screentexcoord 0)
varying vec2 texcoord0;
@(? $tqaaresolvegather [
varying vec2 texcoord1;
])
out vec2 texcoord0;
out vec2 texcoord1;
void main(void)
{
gl_Position = vvertex;
texcoord0 = vtexcoord0;
@(? $tqaaresolvegather [
texcoord1 = vtexcoord0 - 0.5;
])
texcoord1 = vtexcoord0 - 0.5;
}
] [
@(gfetchdefs tex2)
@ -26,11 +22,9 @@ lazyshader 0 "tqaaresolve" [
uniform mat4 reprojectmatrix;
uniform vec2 maxvelocity;
uniform vec2 colorweight;
varying vec2 texcoord0;
@(? $tqaaresolvegather [
varying vec2 texcoord1;
])
fragdata(0) vec4 fragcolor;
in vec2 texcoord0;
in vec2 texcoord1;
layout(location = 0) out vec4 fragcolor;
void main(void)
{
@(gdepthunpack depth [gfetch(tex2, texcoord0)] [
@ -42,28 +36,19 @@ lazyshader 0 "tqaaresolve" [
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));
float mask = 1.0 - textureRect(tex0, texcoord0 + quincunx.xy).a;
vec4 color = textureRect(tex0, texcoord0 + mask*quincunx.xy);
vec4 prevcolor = textureRect(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)));
])
vec4 l0 = textureGather(tex0, texcoord1, 1);
vec4 l1 = textureGatherOffset(tex0, texcoord1, ivec2(1, 1), 1);
float l2 = textureRectOffset(tex0, texcoord0, ivec2(1, -1)).g;
float l3 = textureRectOffset(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 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);

View file

@ -25,10 +25,10 @@ ambientobscurancevariantshader = [
derivnormal = (>= (strstr $arg2 "d") 0)
maxaotaps = $arg3
shader 0 $arg1 [
attribute vec4 vvertex;
in vec4 vvertex;
@(screentexcoord 0)
@(screentexcoord 1)
varying vec2 texcoord0, texcoord1;
out vec2 texcoord0, texcoord1;
void main(void)
{
gl_Position = vvertex;
@ -53,8 +53,8 @@ ambientobscurancevariantshader = [
#define depthtc texcoord0
])
uniform vec3 gdepthpackparams;
varying vec2 texcoord0, texcoord1;
fragdata(0) vec4 fragcolor;
in vec2 texcoord0, texcoord1;
layout(location = 0) out vec4 fragcolor;
void main(void)
{
@(if (&& $derivnormal [= $aodepthformat 1]) [result [
@ -90,7 +90,7 @@ ambientobscurancevariantshader = [
normal *= normscale > 0.75 ? normscale : 0.0;
normal = normalmatrix * normal;
]])
vec2 noise = texture2D(tex2, texcoord1).rg*2.0-1.0;
vec2 noise = texture(tex2, texcoord1).rg*2.0-1.0;
float obscure = 0.0;
@(loopconcat i $maxaotaps [result [
vec2 offset@[i] = reflect(vec2(@(at $aotapoffsets $i)), noise);
@ -127,9 +127,9 @@ ambientobscuranceshader = [
]
shader 0 "linearizedepth" [
attribute vec4 vvertex;
in vec4 vvertex;
@(screentexcoord 0)
varying vec2 texcoord0;
out vec2 texcoord0;
void main(void)
{
gl_Position = vvertex;
@ -138,8 +138,8 @@ shader 0 "linearizedepth" [
] [
@(gfetchdefs tex0 $msaasamples)
uniform vec3 gdepthpackparams;
varying vec2 texcoord0;
fragdata(0) vec4 fragcolor;
in vec2 texcoord0;
layout(location = 0) out vec4 fragcolor;
void main(void)
{
@(if (! $aodepthformat) [
@ -165,14 +165,14 @@ bilateralvariantshader = [
reduced = $arg4
filterdir = $arg5
shader 0 $arg1 [
attribute vec4 vvertex;
in vec4 vvertex;
@(if $reduced [result [
@(screentexcoord 0)
varying vec2 texcoord0;
out vec2 texcoord0;
]])
@(if $upscaled [result [
@(screentexcoord 1)
varying vec2 texcoord1;
out vec2 texcoord1;
]])
void main(void)
{
@ -185,27 +185,27 @@ bilateralvariantshader = [
uniform sampler2DRect tex0;
uniform vec2 bilateralparams;
uniform vec3 gdepthpackparams;
@(? $reduced [varying vec2 texcoord0;])
@(? $upscaled [varying vec2 texcoord1;])
fragdata(0) vec4 fragcolor;
@(? $reduced [in vec2 texcoord0;])
@(? $upscaled [in vec2 texcoord1;])
layout(location = 0) out 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 texval(i) textureRect(tex0, tc + tapvec(vec2, i))
#define texvaloffset(i) textureRectOffset(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;
vec2 vals = textureRect(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);
vec4 vals = textureRect(tex0, tc);
#define color vals.a
@(if $upscaled [gdepthunpack depth [gfetch(tex1, depthtc)]] [result [
float depth = dot(vals.rgb, gdepthunpackparams);
@ -219,7 +219,7 @@ bilateralvariantshader = [
float depth = dot(gfetch(tex1, depthtc).rgb, gdepthunpackparams);
]])
]] [result [
float color = texture2DRect(tex0, tc).r;
float color = textureRect(tex0, tc).r;
@(gdepthunpack depth [gfetch(tex1, depthtc)])
]])
float weights = 1.0;

View file

@ -6,12 +6,12 @@
blurshader = [
shader 0 $arg1 [
attribute vec4 vvertex;
in vec4 vvertex;
@(screentexcoord 0)
uniform float offsets[8];
varying vec2 texcoord0, texcoordp1, texcoordn1;
out vec2 texcoord0, texcoordp1, texcoordn1;
@(loopconcat+ i 2 (min (- $arg2 1) 2) [result [
varying vec2 texcoordp@i, texcoordn@i;
out vec2 texcoordp@i, texcoordn@i;
]])
void main(void)
{
@ -33,11 +33,11 @@ blurshader = [
uniform float weights[8];
uniform float offsets[8];
uniform sampler@[arg4] tex0;
varying vec2 texcoord0, texcoordp1, texcoordn1;
in vec2 texcoord0, texcoordp1, texcoordn1;
@(loopconcat+ i 2 (min (- $arg2 1) 2) [result [
varying vec2 texcoordp@i, texcoordn@i;
in vec2 texcoordp@i, texcoordn@i;
]])
fragdata(0) vec4 fragcolor;
layout(location = 0) out vec4 fragcolor;
void main(void)
{
#define texval(coords) texture@[arg4](tex0, (coords))

View file

@ -51,22 +51,22 @@ decalvariantshader = [
defuniformparam "bumpblend" 1 // alpha-blend strength for normals
]
variantshader $stype $arg1 $srow [
attribute vec4 vvertex;
in vec4 vvertex;
@(? (dtopt "n") [
attribute vec4 vtangent;
varying mat3 world;
in vec4 vtangent;
out mat3 world;
] [
varying vec3 nvec;
out vec3 nvec;
])
attribute vec4 vnormal;
attribute vec3 vtexcoord0;
in vec4 vnormal;
in vec3 vtexcoord0;
uniform mat4 camprojmatrix;
varying vec4 texcoord0;
out vec4 texcoord0;
@(? (|| (dtopt "p") (dtopt "r")) [
uniform vec3 camera;
varying vec3 camvec;
out vec3 camvec;
])
@(? (dtopt "G") [uniform float millis; flat varying float pulse;])
@(? (dtopt "G") [uniform float millis; flat out float pulse;])
void main(void)
{
gl_Position = camprojmatrix * vvertex;
@ -91,38 +91,37 @@ decalvariantshader = [
}
] [
@(cond [dtopt "0"] [result [
fragdata(0) vec4 gcolor;
fragblend(0) vec4 gcolorblend;
layout(location = 0) out vec4 gcolor;
layout(location = 0, index = 1) out vec4 gcolorblend;
]] [dtopt "1"] [
? $usepacknorm [
fragdata(0) vec4 gnormal;
layout(location = 0) out vec4 gnormal;
] [
fragdata(0) vec4 gnormal;
fragblend(0) vec4 gnormalblend;
layout(location = 0) out vec4 gnormal;
layout(location = 0, index = 1) out vec4 gnormalblend;
]
] [result [
fragdata(0) vec4 gcolor;
fragdata(1) vec4 gnormal;
layout(location = 0) out vec4 gcolor;
layout(location = 1) out vec4 gnormal;
]])
uniform sampler2D diffusemap;
uniform vec4 colorparams;
varying vec4 texcoord0;
in vec4 texcoord0;
@(? (dtopt "n") [
uniform sampler2D normalmap;
varying mat3 world;
in mat3 world;
] [
varying vec3 nvec;
#define bumpblend vec4(1.0)
in vec3 nvec;
])
@(? (|| (dtopt "p") (dtopt "r")) [varying vec3 camvec;])
@(? (|| (dtopt "p") (dtopt "r")) [in vec3 camvec;])
@(? (|| (dtopt "g") (dtopt "S")) [uniform sampler2D glowmap;])
@(? (dtopt "G") [flat varying float pulse;])
@(? (dtopt "G") [flat in float pulse;])
@(? (dtopt "r") [uniform samplerCube envmap;])
void main(void)
{
@(if (dtopt "n") [result [
@(? (dtopt "p") [
float height = texture2D(normalmap, texcoord0.xy).a;
float height = texture(normalmap, texcoord0.xy).a;
vec3 camvecn = normalize(camvec);
vec2 dtc = texcoord0.xy + (camvecn * world).xy*(height*parallaxscale.x + parallaxscale.y);
] [
@ -130,7 +129,7 @@ decalvariantshader = [
])
@(? (|| (! (dtopt "0")) (dtopt "r")) [
vec3 bump = texture2D(normalmap, dtc).rgb*2.0 - 1.0;
vec3 bump = texture(normalmap, dtc).rgb*2.0 - 1.0;
vec3 bumpw = world * bump;
#define nvec bumpw
])
@ -138,10 +137,10 @@ decalvariantshader = [
#define dtc texcoord0.xy
]])
vec4 diffuse = texture2D(diffusemap, dtc);
vec4 diffuse = texture(diffusemap, dtc);
@(if (dtopt "g") [result [
vec4 glowspec = texture2D(glowmap, dtc);
vec4 glowspec = texture(glowmap, dtc);
#define glow glowspec.rgb
#define spec glowspec.a
glow *= @(? (dtopt "G") [mix(glowcolor.xyz, pulseglowcolor.xyz, pulse)] [glowcolor.xyz]);
@ -150,7 +149,7 @@ decalvariantshader = [
@(if (dtopt "0") [result [
@(if (&& (dtopt "S") [! (dtopt "g")]) [result [
float spec = @(? (|| (! (dtopt "n")) (dtopt "p")) [texture2D(glowmap, dtc).r] [texture2D(normalmap, dtc).a]);
float spec = @(? (|| (! (dtopt "n")) (dtopt "p")) [texture(glowmap, dtc).r] [texture(normalmap, dtc).a]);
]])
@(gspecpack [gloss.x] (if (dtopt "s") [? (dtopt "S") [spec * specscale.x] [specscale.x]]))
]])
@ -168,7 +167,7 @@ decalvariantshader = [
])
float invfresnel = dot(camvecn, nvec);
vec3 rvec = 2.0*nvec*invfresnel - camvecn;
vec3 reflect = textureCube(envmap, rvec).rgb * diffuse.a;
vec3 reflect = texture(envmap, rvec).rgb * diffuse.a;
@(? (dtopt "R") [
vec3 rmod = envscale.xyz*spec;
] [

View file

@ -36,7 +36,7 @@ msaadetectedges = [
]
lazyshader 0 msaaedgedetect [
attribute vec4 vvertex;
in vec4 vvertex;
void main(void)
{
gl_Position = vvertex;
@ -55,9 +55,7 @@ lazyshader 0 msaaedgedetect [
// deferredlighttype:
// p -> point-light shadow (default cubemap)
// P -> point-light color shadow
// c -> CSM
// C -> color CSM
// a -> AO
// A -> AO sun
// r -> radiance hints
@ -66,7 +64,6 @@ lazyshader 0 msaaedgedetect [
// E -> 5x5 weighted bilinear filter
// F -> 3x3 weighted bilinear filter
// f -> 4x rotated grid filter
// N -> no filtering
// m -> minimap
// M -> multisampled
// O -> sample 1
@ -119,21 +116,16 @@ deferredlightvariantshader = [
numlights = (+ $arg6 0)
baselight = (< (mod $arg2 4) 2)
spotlight = (>= (mod $arg2 8) 4)
transparent = (<= 8 $arg2 15)
avatar = (<= 24 $arg2 31)
local colorshadow
colorshadow = (|| (? (<= 16 $arg2 23) 2) [&& (dlopt "C") [! $transparent] [! $avatar]])
transparent = (<= 8 $arg2 16)
avatar = (<= 17 $arg2 31)
variantshader 0 $arg1 $arg2 (? (< $arg2 0) [
attribute vec4 vvertex;
in 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
])
@ -178,22 +170,6 @@ deferredlightvariantshader = [
uniform sampler3D tex6, tex7, tex8, tex9;
]])
]])
@(? $colorshadow [
uniform sampler2DRect tex10;
#define sunshadowtype vec3
#define filtersunshadow(tc) (filtershadow(tc) * filtercolorshadow(tex10, tc))
] [
#define sunshadowtype float
#define filtersunshadow filtershadow
])
@(? (> $colorshadow 1) [
uniform sampler2DRect tex11;
#define lightshadowtype vec3
#define filterlightshadow(tc) (filtershadow(tc) * filtercolorshadow(tex11, tc))
] [
#define lightshadowtype float
#define filterlightshadow filtershadow
])
uniform vec3 camera;
uniform mat4 worldmatrix;
uniform vec4 fogdir;
@ -204,7 +180,7 @@ deferredlightvariantshader = [
uniform vec4 lightscale;
@(? (&& (dlopt "a") [! $avatar] [! $transparent]) [uniform sampler2DRect tex5; uniform vec2 aoscale; uniform vec4 aoparams;])
@(gdepthunpackparams)
fragdata(0) vec4 fragcolor;
layout(location = 0) out vec4 fragcolor;
@(if (dlopt "p") [
? $spotlight [
@ -228,19 +204,104 @@ deferredlightvariantshader = [
])
@(if (|| (dlopt "p") [dlopt "c"]) [
cond [dlopt "G"] [
smfilterg5 $colorshadow
] [dlopt "g"] [
smfilterg3 $colorshadow
] [dlopt "E"] [
smfilterb5 $colorshadow
] [dlopt "F"] [
smfilterb3 $colorshadow
] [dlopt "f"] [
smfilterrg $colorshadow
] [
smfilternone $colorshadow
]
cond [dlopt "G"] [result [
@(? (> $usetexgather 1) [
#define shadowgather(center, xoff, yoff) textureGatherOffset(tex4, center, shadowtc.z, ivec2(xoff, yoff))
] [
#define shadowgather(center, xoff, yoff) step(shadowtc.z, textureGatherOffset(tex4, center, ivec2(xoff, yoff)))
])
float filtershadow(vec3 shadowtc)
{
vec2 offset = fract(shadowtc.xy - 0.5), center = (shadowtc.xy - offset)*shadowatlasscale;
vec4 group1 = shadowgather(center, -2, -2);
vec4 group2 = shadowgather(center, 0, -2);
vec4 group3 = shadowgather(center, 2, -2);
vec4 group4 = shadowgather(center, -2, 0);
vec4 group5 = shadowgather(center, 0, 0);
vec4 group6 = shadowgather(center, 2, 0);
vec4 group7 = shadowgather(center, -2, 2);
vec4 group8 = shadowgather(center, 0, 2);
vec4 group9 = shadowgather(center, 2, 2);
vec4 locols = vec4(group1.ab, group3.ab);
vec4 hicols = vec4(group7.rg, group9.rg);
locols.yz += group2.ab;
hicols.yz += group8.rg;
vec4 midcols = vec4(group1.rg, group3.rg) + vec4(group7.ab, group9.ab) +
vec4(group4.rg, group6.rg) + vec4(group4.ab, group6.ab) +
mix(locols, hicols, offset.y);
vec4 cols = group5 + vec4(group2.rg, group8.ab);
cols.xyz += mix(midcols.xyz, midcols.yzw, offset.x);
return dot(cols, vec4(1.0/25.0));
}
]] [dlopt "g"] [result [
@(? (> $usetexgather 1) [
#define shadowgather(center, xoff, yoff) textureGatherOffset(tex4, center, shadowtc.z, ivec2(xoff, yoff))
] [
#define shadowgather(center, xoff, yoff) step(shadowtc.z, textureGatherOffset(tex4, center, ivec2(xoff, yoff)))
])
float filtershadow(vec3 shadowtc)
{
vec2 offset = fract(shadowtc.xy - 0.5), center = (shadowtc.xy - offset)*shadowatlasscale;
vec4 group1 = shadowgather(center, -1, -1);
vec4 group2 = shadowgather(center, 1, -1);
vec4 group3 = shadowgather(center, -1, 1);
vec4 group4 = shadowgather(center, 1, 1);
vec4 cols = vec4(group1.rg, group2.rg) + vec4(group3.ab, group4.ab) + mix(vec4(group1.ab, group2.ab), vec4(group3.rg, group4.rg), offset.y);
return dot(mix(cols.xyz, cols.yzw, offset.x), vec3(1.0/9.0));
}
]] [dlopt "E"] [result [
#define shadowval(xy, xoff, yoff) float(textureRect(tex4, vec3(xy + vec2(xoff, yoff), shadowtc.z)))
float filtershadow(vec3 shadowtc)
{
vec2 offset = fract(shadowtc.xy - 0.5);
vec4 center = vec4(shadowtc.xy - offset + 0.5, shadowtc.xy - offset*0.5);
vec4 size = vec4(offset + 1.0, 2.0 - offset);
return (1.0/25.0)*dot(size.zxzx*size.wwyy,
vec4(shadowval(center.zw, -1.5, -1.5),
shadowval(center.zw, 2.0, -1.5),
shadowval(center.zw, -1.5, 2.0),
shadowval(center.zw, 2.0, 2.0))) +
(2.0/25.0)*dot(size,
vec4(shadowval(center.zy, 2.0, 0.0),
shadowval(center.xw, 0.0, 2.0),
shadowval(center.zy, -1.5, 0.0),
shadowval(center.xw, 0.0, -1.5))) +
(4.0/25.0)*shadowval(center.xy, 0.0, 0.0);
}
]] [dlopt "F"] [result [
#define shadowval(center, xoff, yoff) float(textureRect(tex4, center + vec3(xoff, yoff, 0.0)))
float filtershadow(vec3 shadowtc)
{
vec2 offset = fract(shadowtc.xy - 0.5);
vec3 center = shadowtc;
//center.xy -= offset;
//vec4 size = vec4(offset + 1.0, 2.0 - offset), weight = vec4(2.0 - 1.0 / size.xy, 1.0 / size.zw - 1.0);
//return (1.0/9.0)*dot(size.zxzx*size.wwyy,
// vec4(shadowval(center, weight.zw),
// shadowval(center, weight.xw),
// shadowval(center, weight.zy),
// shadowval(center, weight.xy)));
center.xy -= offset*0.5;
vec4 size = vec4(offset + 1.0, 2.0 - offset);
return (1.0/9.0)*dot(size.zxzx*size.wwyy,
vec4(shadowval(center, -0.5, -0.5),
shadowval(center, 1.0, -0.5),
shadowval(center, -0.5, 1.0),
shadowval(center, 1.0, 1.0)));
}
]] [dlopt "f"] [result [
#define shadowval(center, xoff, yoff) float(textureRect(tex4, center + vec3(xoff, yoff, 0.0)))
float filtershadow(vec3 shadowtc)
{
return dot(vec4(0.25),
vec4(shadowval(shadowtc, -0.4, 1.0),
shadowval(shadowtc, -1.0, -0.4),
shadowval(shadowtc, 0.4, -1.0),
shadowval(shadowtc, 1.0, 0.4)));
}
]] [result [
#define filtershadow(shadowtc) float(textureRect(tex4, shadowtc))
]]
])
@(if (dlopt "c") [result [
@ -281,7 +342,7 @@ deferredlightvariantshader = [
]])
tc.xy += 0.5;
tc.z = tc.z * @(divf 1 $numrh) + offset;
vec4 shr = texture3D(tex6, tc), shg = texture3D(tex7, tc), shb = texture3D(tex8, tc), sha = texture3D(tex9, tc);
vec4 shr = texture(tex6, tc), shg = texture(tex7, tc), shb = texture(tex8, tc), sha = texture(tex9, tc);
shr.rgb -= 0.5;
shg.rgb -= 0.5;
shb.rgb -= 0.5;
@ -308,7 +369,7 @@ deferredlightvariantshader = [
#define accumalpha(alpha) resolved.a += alpha
@(if (&& [dlopt "a"] [! $avatar] [! $transparent]) [result [
float ao = texture2DRect(tex5, gl_FragCoord.xy*aoscale).r;
float ao = textureRect(tex5, gl_FragCoord.xy*aoscale).r;
]])
for(int sampleidx = 0; sampleidx < @msaasamples; sampleidx++)
@ -322,7 +383,7 @@ deferredlightvariantshader = [
#define accumalpha(alpha) fragcolor.a = alpha
]]
] [result [
#define gfetch(sampler, coords) texture2DRect(sampler, coords)
#define gfetch(sampler, coords) textureRect(sampler, coords)
#define accumlight(light) fragcolor.rgb = light
#define accumalpha(alpha) fragcolor.a = alpha
@ -405,7 +466,7 @@ deferredlightvariantshader = [
@(if (&& (dlopt "a") [! $avatar] [! $transparent]) [result [
@(? (! (&& (dlopt "M") [dlopt "R"])) [
float ao = texture2DRect(tex5, gl_FragCoord.xy*aoscale).r;
float ao = textureRect(tex5, gl_FragCoord.xy*aoscale).r;
])
@(if (dlopt "d") [result [
#define aomask ao
@ -431,7 +492,7 @@ deferredlightvariantshader = [
{
@(if (= (+ (? (dlopt "p") $numlights) (dlopt "c")) 1) [unpackdistbias])
vec3 csmtc = getcsmtc(pos.xyz, distbias);
sunshadowtype sunoccluded = filtersunshadow(csmtc);
float sunoccluded = filtershadow(csmtc);
@(if (dlopt "m") [result [
light += diffuse.rgb*sunfacing * sunlightcolor * sunoccluded;
]] [result [
@ -491,16 +552,14 @@ deferredlightvariantshader = [
@(if $spotlight [
if (dlopt "p") [result [
vec3 spot@[j]tc = getspottc(light@[j]dir, spot@[j]dist, spotparams[@@j], shadowparams[@@j], shadowoffset[@@j], distbias * lightpos[@@j].w);
lightshadowtype light@[j]shadow = light@[j]atten * spot@[j]atten * filterlightshadow(spot@[j]tc);
light@[j]atten *= spot@[j]atten * filtershadow(spot@[j]tc);
]] [result [
float light@[j]shadow = light@[j]atten * spot@[j]atten;
light@[j]atten *= spot@[j]atten;
]]
] [
if (dlopt "p") [result [
vec3 shadow@[j]tc = getshadowtc(light@[j]dir, shadowparams[@@j], shadowoffset[@@j], distbias * lightpos[@@j].w);
lightshadowtype light@[j]shadow = light@[j]atten * filterlightshadow(shadow@[j]tc);
]] [result [
#define light@[j]shadow light@[j]atten
light@[j]atten *= filtershadow(shadow@[j]tc);
]]
])
@(if (= (+ $numlights $baselight) 1) [result [
@ -512,14 +571,14 @@ deferredlightvariantshader = [
]])
light@[j]facing *= light@[j]invdist;
@(if (dlopt "m") [result [
light += diffuse.rgb*light@[j]facing * lightcolor[@@j].rgb * light@[j]shadow;
light += diffuse.rgb*light@[j]facing * lightcolor[@@j].rgb * light@[j]atten;
]] [result [
@(if (= (+ $numlights (dlopt "c")) 1) [unpackspec])
float light@[j]spec = pow(clamp(light@[j]facing*facing - light@[j]invdist*dot(camdir, light@[j]dir), 0.0, 1.0), gloss) * specscale;
@(if (dlopt "z") [result [
light@[j]spec *= lightcolor[@@j].a;
]])
light += (diffuse.rgb*light@[j]facing + light@[j]spec) * lightcolor[@@j].rgb * light@[j]shadow;
light += (diffuse.rgb*light@[j]facing + light@[j]spec) * lightcolor[@@j].rgb * light@[j]atten;
@(? (= (+ $numlights $baselight) 1) [
float foglerp = clamp(exp2(fogcoord*fogdensity.x)*fogdensity.y, 0.0, 1.0);
light *= foglerp;
@ -567,14 +626,12 @@ deferredlightshader = [
maxvariants = $basevariants
if (dlopt "t") [maxvariants = (+ $maxvariants $basevariants 1)]
if (dlopt "d") [maxvariants = (+ $maxvariants $basevariants 1)]
if (dlopt "P") [maxvariants = (+ $maxvariants (* (max $arg6 1) (? (dlopt "s") 2 1)))]
deferredlightvariantshader $shadername -1 $arg1 $arg4 $arg5 0 $maxvariants // null base shader
deferredlightvariantshader $shadername 0 (concatword $arg1 $arg3) $arg4 $arg5 0 $maxvariants // row 0, base shader, sunlight
deferredlightvariantshader $shadername -1 (concatword $arg1 $arg3) $arg4 $arg5 0 $maxvariants // base shader, no points lights, sunlight
if (dlopt "t") [
deferredlightvariantshader $shadername 8 (concatword $arg1 $arg3) $arg4 $arg5 0 $maxvariants // row 8, transparency, base shader, sunlight
deferredlightvariantshader $shadername 16 (concatword $arg1 $arg3) $arg4 $arg5 0 $maxvariants // row 16, trasparency, base shader, no points lights, sunlight
]
if (dlopt "d") [
deferredlightvariantshader $shadername 24 (concatword $arg1 $arg3) $arg4 $arg5 0 $maxvariants // row 24, avatar, base shader, sunlight
deferredlightvariantshader $shadername 17 (concatword $arg1 $arg3) $arg4 $arg5 0 $maxvariants // row 17, avatar, base shader, no points lights, sunlight
]
loop+ i 1 (max $arg6 1) [
if (dlopt "b") [
@ -607,18 +664,6 @@ deferredlightshader = [
deferredlightvariantshader $shadername 15 (concatword $arg1 $arg2) $arg4 $arg5 $i $maxvariants // row 15, transparent, shadowed spot lights
]
]
if (dlopt "P") [
if (dlopt "b") [
deferredlightvariantshader $shadername 17 (concatword $arg1 $arg2 $arg3) $arg4 $arg5 $i $maxvariants // row 17, color shadow, shadowed point lights, sunlight
]
deferredlightvariantshader $shadername 19 (concatword $arg1 $arg2) $arg4 $arg5 $i $maxvariants // row 19, color shadow, shadowed point lights
if (dlopt "s") [
if (dlopt "b") [
deferredlightvariantshader $shadername 21 (concatword $arg1 $arg2 $arg3) $arg4 $arg5 $i $maxvariants // row 21, color shadow, shadowed spot lights, sunlight
]
deferredlightvariantshader $shadername 23 (concatword $arg1 $arg2) $arg4 $arg5 $i $maxvariants // row 23, color shadow, shadowed spot lights
]
]
if (dlopt "d") [
if (dlopt "b") [
deferredlightvariantshader $shadername 24 (concatword $arg1 $arg3) $arg4 $arg5 $i $maxvariants // row 24, avatar, point lights, sunlight

View file

@ -5,12 +5,12 @@
////////////////////////////////////////////////
shader 0 "blendbrush" [
attribute vec4 vvertex, vcolor;
in vec4 vvertex, vcolor;
uniform mat4 camprojmatrix;
uniform vec4 texgenS, texgenT;
uniform float ldrscale;
varying vec4 color;
varying vec2 texcoord0;
out vec4 color;
out vec2 texcoord0;
void main(void)
{
gl_Position = camprojmatrix * vvertex;
@ -19,22 +19,22 @@ shader 0 "blendbrush" [
}
] [
uniform sampler2D tex0;
varying vec4 color;
varying vec2 texcoord0;
fragdata(0) vec4 fragcolor;
in vec4 color;
in vec2 texcoord0;
layout(location = 0) out vec4 fragcolor;
void main(void)
{
fragcolor = texture2D(tex0, texcoord0).r * color;
fragcolor = texture(tex0, texcoord0).r * color;
}
]
lazyshader 0 "prefab" [
attribute vec4 vvertex, vcolor;
attribute vec3 vnormal;
in vec4 vvertex, vcolor;
in vec3 vnormal;
uniform mat4 prefabmatrix;
uniform mat3 prefabworld;
varying vec3 nvec;
varying vec4 color;
out vec3 nvec;
out vec4 color;
@(msaainterpvert)
void main(void)
@ -45,8 +45,8 @@ lazyshader 0 "prefab" [
@(msaapackvert)
}
] [
varying vec3 nvec;
varying vec4 color;
in vec3 nvec;
in vec4 color;
@(msaainterpfrag)
void main(void)

View file

@ -216,9 +216,9 @@ fxaadefs = [
]
shader 0 [fxaa@fxaapreset@fxaaopts] [
attribute vec4 vvertex;
in vec4 vvertex;
@(screentexcoord 0)
varying vec2 texcoord0;
out vec2 texcoord0;
void main(void)
{
gl_Position = vvertex;
@ -226,17 +226,17 @@ shader 0 [fxaa@fxaapreset@fxaaopts] [
}
] [
@fxaadefs
varying vec2 texcoord0;
in vec2 texcoord0;
uniform sampler2DRect tex0;
fragdata(0) vec4 fragcolor;
layout(location = 0) out vec4 fragcolor;
void main(void)
{
#define posM texcoord0
vec4 rgbyM = texture2DRect(tex0, posM);
float lumaS = FXAA_LUMA(texture2DRectOffset(tex0, posM, ivec2( 0, 1)));
float lumaE = FXAA_LUMA(texture2DRectOffset(tex0, posM, ivec2( 1, 0)));
float lumaN = FXAA_LUMA(texture2DRectOffset(tex0, posM, ivec2( 0, -1)));
float lumaW = FXAA_LUMA(texture2DRectOffset(tex0, posM, ivec2(-1, 0)));
vec4 rgbyM = textureRect(tex0, posM);
float lumaS = FXAA_LUMA(textureRectOffset(tex0, posM, ivec2( 0, 1)));
float lumaE = FXAA_LUMA(textureRectOffset(tex0, posM, ivec2( 1, 0)));
float lumaN = FXAA_LUMA(textureRectOffset(tex0, posM, ivec2( 0, -1)));
float lumaW = FXAA_LUMA(textureRectOffset(tex0, posM, ivec2(-1, 0)));
#define lumaM FXAA_LUMA(rgbyM)
float maxSM = max(lumaS, lumaM);
@ -258,10 +258,10 @@ shader 0 [fxaa@fxaapreset@fxaaopts] [
return;
}
float lumaNW = FXAA_LUMA(texture2DRectOffset(tex0, posM, ivec2(-1, -1)));
float lumaSE = FXAA_LUMA(texture2DRectOffset(tex0, posM, ivec2( 1, 1)));
float lumaNE = FXAA_LUMA(texture2DRectOffset(tex0, posM, ivec2( 1, -1)));
float lumaSW = FXAA_LUMA(texture2DRectOffset(tex0, posM, ivec2(-1, 1)));
float lumaNW = FXAA_LUMA(textureRectOffset(tex0, posM, ivec2(-1, -1)));
float lumaSE = FXAA_LUMA(textureRectOffset(tex0, posM, ivec2( 1, 1)));
float lumaNE = FXAA_LUMA(textureRectOffset(tex0, posM, ivec2( 1, -1)));
float lumaSW = FXAA_LUMA(textureRectOffset(tex0, posM, ivec2(-1, 1)));
float lumaNS = lumaN + lumaS;
float lumaWE = lumaW + lumaE;
@ -311,9 +311,9 @@ shader 0 [fxaa@fxaapreset@fxaaopts] [
vec2 posN = posB - offNP * FXAA_QUALITY_P0;
vec2 posP = posB + offNP * FXAA_QUALITY_P0;
float subpixD = ((-2.0)*subpixC) + 3.0;
float lumaEndN = FXAA_LUMA(texture2DRect(tex0, posN));
float lumaEndN = FXAA_LUMA(textureRect(tex0, posN));
float subpixE = subpixC * subpixC;
float lumaEndP = FXAA_LUMA(texture2DRect(tex0, posP));
float lumaEndP = FXAA_LUMA(textureRect(tex0, posP));
if(!pairN) lumaNN = lumaSS;
float gradientScaled = gradient * 1.0/4.0;
@ -332,8 +332,8 @@ shader 0 [fxaa@fxaapreset@fxaaopts] [
#if (FXAA_QUALITY_PS > @i)
if(contN || contP)
{
if(contN) lumaEndN = FXAA_LUMA(texture2DRect(tex0, posN));
if(contP) lumaEndP = FXAA_LUMA(texture2DRect(tex0, posP));
if(contN) lumaEndN = FXAA_LUMA(textureRect(tex0, posN));
if(contP) lumaEndP = FXAA_LUMA(textureRect(tex0, posP));
if(contN) lumaEndN = lumaEndN - lumaNN * 0.5;
if(contP) lumaEndP = lumaEndP - lumaNN * 0.5;
contN = abs(lumaEndN) < gradientScaled;
@ -369,7 +369,7 @@ shader 0 [fxaa@fxaapreset@fxaaopts] [
if(!horzSpan) posS.x += pixelOffsetSubpix * lengthSign;
if( horzSpan) posS.y += pixelOffsetSubpix * lengthSign;
fragcolor = texture2DRect(tex0, posS);
fragcolor = textureRect(tex0, posS);
}
]

View file

@ -5,15 +5,15 @@
////////////////////////////////////////////////
lazyshader 0 "rsmsky" [
attribute vec4 vvertex;
in vec4 vvertex;
uniform mat4 rsmmatrix;
void main(void)
{
gl_Position = rsmmatrix * vvertex;
}
] [
fragdata(0) vec4 gcolor;
fragdata(1) vec4 gnormal;
layout(location = 0) out vec4 gcolor;
layout(location = 1) out vec4 gnormal;
void main(void)
{
gcolor = vec4(0.0, 0.0, 0.0, 1.0);
@ -170,11 +170,11 @@ rsmtapoffsets32 = [
radiancehintsshader = [
numtaps = (cond [> $arg1 20] 32 [> $arg1 12] 20 12)
shader 0 [radiancehints@arg1] [
attribute vec4 vvertex;
attribute vec3 vtexcoord0;
in vec4 vvertex;
in vec3 vtexcoord0;
uniform mat4 rsmtcmatrix;
varying vec3 rhcenter;
varying vec2 rsmcenter;
out vec3 rhcenter;
out vec2 rsmcenter;
void main(void)
{
gl_Position = vvertex;
@ -187,20 +187,20 @@ radiancehintsshader = [
uniform vec2 rsmspread;
uniform float rhatten, rhspread, rhaothreshold, rhaoatten, rhaoheight;
uniform vec3 rsmdir;
varying vec3 rhcenter;
varying vec2 rsmcenter;
fragdata(0) vec4 rhr;
fragdata(1) vec4 rhg;
fragdata(2) vec4 rhb;
fragdata(3) vec4 rha;
in vec3 rhcenter;
in vec2 rsmcenter;
layout(location = 0) out vec4 rhr;
layout(location = 1) out vec4 rhg;
layout(location = 2) out vec4 rhb;
layout(location = 3) out vec4 rha;
void calcrhsample(vec3 rhtap, vec2 rsmtap, inout vec4 shr, inout vec4 shg, inout vec4 shb, inout vec4 sha)
{
vec3 rhpos = rhcenter + rhtap*rhspread;
vec2 rsmtc = rsmcenter + rsmtap*rsmspread;
float rsmdepth = texture2DRect(tex0, rsmtc).x;
vec3 rsmcolor = texture2DRect(tex1, rsmtc).rgb;
vec3 rsmnormal = texture2DRect(tex2, rsmtc).xyz*2.0 - 1.0;
float rsmdepth = textureRect(tex0, rsmtc).x;
vec3 rsmcolor = textureRect(tex1, rsmtc).rgb;
vec3 rsmnormal = textureRect(tex2, rsmtc).xyz*2.0 - 1.0;
vec3 rsmpos = (rsmworldmatrix * vec4(rsmtc, rsmdepth, 1.0)).xyz;
vec3 dir = rhpos - rsmpos;
@ -234,9 +234,9 @@ radiancehintsshader = [
]
lazyshader 0 radiancehintsborder [
attribute vec4 vvertex;
attribute vec3 vtexcoord0;
varying vec3 texcoord0;
in vec4 vvertex;
in vec3 vtexcoord0;
out vec3 texcoord0;
void main(void)
{
gl_Position = vvertex;
@ -245,27 +245,27 @@ lazyshader 0 radiancehintsborder [
] [
uniform sampler3D tex3, tex4, tex5, tex6;
uniform vec3 bordercenter, borderrange, borderscale;
varying vec3 texcoord0;
fragdata(0) vec4 rhr;
fragdata(1) vec4 rhg;
fragdata(2) vec4 rhb;
fragdata(3) vec4 rha;
in vec3 texcoord0;
layout(location = 0) out vec4 rhr;
layout(location = 1) out vec4 rhg;
layout(location = 2) out vec4 rhb;
layout(location = 3) out vec4 rha;
void main(void)
{
float outside = clamp(borderscale.z*(abs(texcoord0.z - bordercenter.z) - borderrange.z), 0.0, 1.0);
vec3 tc = vec3(texcoord0.xy, clamp(texcoord0.z, bordercenter.z - borderrange.z, bordercenter.z + borderrange.z));
rhr = mix(texture3D(tex3, tc), vec4(0.5, 0.5, 0.5, 0.0), outside);
rhg = mix(texture3D(tex4, tc), vec4(0.5, 0.5, 0.5, 0.0), outside);
rhb = mix(texture3D(tex5, tc), vec4(0.5, 0.5, 0.5, 0.0), outside);
rha = mix(texture3D(tex6, tc), vec4(0.5, 0.5, 0.5, 0.0), outside);
rhr = mix(texture(tex3, tc), vec4(0.5, 0.5, 0.5, 0.0), outside);
rhg = mix(texture(tex4, tc), vec4(0.5, 0.5, 0.5, 0.0), outside);
rhb = mix(texture(tex5, tc), vec4(0.5, 0.5, 0.5, 0.0), outside);
rha = mix(texture(tex6, tc), vec4(0.5, 0.5, 0.5, 0.0), outside);
}
]
lazyshader 0 radiancehintscached [
attribute vec4 vvertex;
attribute vec3 vtexcoord0;
varying vec3 texcoord0;
in vec4 vvertex;
in vec3 vtexcoord0;
out vec3 texcoord0;
void main(void)
{
gl_Position = vvertex;
@ -273,23 +273,23 @@ lazyshader 0 radiancehintscached [
}
] [
uniform sampler3D tex7, tex8, tex9, tex10;
varying vec3 texcoord0;
fragdata(0) vec4 rhr;
fragdata(1) vec4 rhg;
fragdata(2) vec4 rhb;
fragdata(3) vec4 rha;
in vec3 texcoord0;
layout(location = 0) out vec4 rhr;
layout(location = 1) out vec4 rhg;
layout(location = 2) out vec4 rhb;
layout(location = 3) out vec4 rha;
void main(void)
{
rhr = texture3D(tex7, texcoord0);
rhg = texture3D(tex8, texcoord0);
rhb = texture3D(tex9, texcoord0);
rha = texture3D(tex10, texcoord0);
rhr = texture(tex7, texcoord0);
rhg = texture(tex8, texcoord0);
rhb = texture(tex9, texcoord0);
rha = texture(tex10, texcoord0);
}
]
lazyshader 0 radiancehintsdisable [
attribute vec4 vvertex;
in vec4 vvertex;
uniform vec3 rhcenter;
uniform float rhbounds;
void main(void)
@ -297,10 +297,10 @@ lazyshader 0 radiancehintsdisable [
gl_Position = vec4((vvertex.xy - rhcenter.xy)/rhbounds, vvertex.zw);
}
] [
fragdata(0) vec4 rhr;
fragdata(1) vec4 rhg;
fragdata(2) vec4 rhb;
fragdata(3) vec4 rha;
layout(location = 0) out vec4 rhr;
layout(location = 1) out vec4 rhg;
layout(location = 2) out vec4 rhb;
layout(location = 3) out vec4 rha;
void main(void)
{

View file

@ -13,24 +13,18 @@ grassvariantshader = [
local grasstype
grasstype = $arg2
variantshader 0 $arg1 (? (grassopt "b") 0 -1) [
attribute vec4 vvertex, vcolor;
attribute vec2 vtexcoord0;
attribute vec4 vtangent;
in vec4 vvertex, vcolor;
in vec2 vtexcoord0;
uniform mat4 camprojmatrix;
uniform vec3 camera;
uniform vec3 grassmargin;
@(ginterpvert)
varying vec2 texcoord0;
varying vec4 colorscale;
varying vec2 bounds;
@(? (grassopt "b") [uniform vec4 blendmapparams; varying vec2 texcoord1;])
out vec2 texcoord0;
out vec4 colorscale;
@(? (grassopt "b") [uniform vec4 blendmapparams; out vec2 texcoord1;])
void main(void)
{
gl_Position = camprojmatrix * vvertex;
colorscale = vcolor;
texcoord0 = vtexcoord0;
vec2 camdir = (camera.xy - vvertex.xy) * grassmargin.y;
bounds = vec2(dot(camdir, vtangent.xy), dot(camdir, vtangent.zw)) + grassmargin.z;
texcoord0 = vtexcoord0;
@(? (grassopt "b") [
texcoord1 = (vvertex.xy - blendmapparams.xy)*blendmapparams.zw;
])
@ -40,20 +34,16 @@ grassvariantshader = [
uniform sampler2D tex0;
uniform float grasstest;
@(ginterpfrag)