Merge remote-tracking branch 'upstream/master'
5
.gitignore
vendored
@@ -1,4 +1,4 @@
|
||||
bld/
|
||||
bld*/
|
||||
build/
|
||||
build-32/
|
||||
build-64/
|
||||
@@ -18,6 +18,9 @@ data/textures
|
||||
data/tracks
|
||||
data/.svn
|
||||
|
||||
# Ignore doxygen output
|
||||
src/html
|
||||
|
||||
*.o
|
||||
*.d
|
||||
*.a
|
||||
|
||||
22
.travis.yml
@@ -6,20 +6,26 @@
|
||||
language: cpp
|
||||
compiler:
|
||||
- gcc
|
||||
#- clang
|
||||
git:
|
||||
submodules: false
|
||||
# - clang
|
||||
#branches:
|
||||
# only:
|
||||
# - master
|
||||
before_install:
|
||||
# UPDATE REPOS
|
||||
# Update repos
|
||||
- sudo apt-get update -qq
|
||||
# INSTALL DEPENDENCIES
|
||||
- sudo apt-get install autoconf automake build-essential cmake libogg-dev libvorbis-dev libopenal-dev libxxf86vm-dev libgl1-mesa-dev libglu1-mesa-dev libcurl4-openssl-dev libfribidi-dev libbluetooth-dev
|
||||
# Install dependencies
|
||||
- sudo apt-get install build-essential cmake libogg-dev libvorbis-dev libopenal-dev libxxf86vm-dev libcurl4-openssl-dev libfribidi-dev libbluetooth-dev
|
||||
# Install mesa from an other repo (a newer version is required)
|
||||
- sudo apt-add-repository "deb http://archive.ubuntu.com/ubuntu quantal main restricted"
|
||||
- sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 3B4FE6ACC0B21F32
|
||||
- sudo apt-get update -qq
|
||||
- sudo apt-get install libgl1-mesa-dev libglu1-mesa-dev
|
||||
script:
|
||||
# BUILD COMMANDS
|
||||
- ./tools/build-linux-travis.sh
|
||||
# Build commands
|
||||
- mkdir build
|
||||
- cd build
|
||||
- cmake .. -DCMAKE_BUILD_TYPE=Debug -DCHECK_ASSETS=off
|
||||
- make VERBOSE=1 -j 4
|
||||
notifications:
|
||||
irc:
|
||||
channels:
|
||||
|
||||
@@ -3,7 +3,7 @@ project(SuperTuxKart)
|
||||
set(PROJECT_VERSION "0.8.1")
|
||||
|
||||
cmake_minimum_required(VERSION 2.8.1)
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake)
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake")
|
||||
|
||||
include(BuildTypeSTKRelease)
|
||||
if (NOT CMAKE_BUILD_TYPE)
|
||||
@@ -13,8 +13,11 @@ endif()
|
||||
|
||||
option(USE_WIIUSE "Support for wiimote input devices" ON)
|
||||
option(USE_FRIBIDI "Support for right-to-left languages" ON)
|
||||
option(CHECK_ASSETS "Check if assets are installed in ../stk-assets" ON)
|
||||
|
||||
if(UNIX)
|
||||
option(USE_CPP2011 "Activate C++ 2011 mode (GCC only)" OFF)
|
||||
option(USE_XRANDR "Use xrandr instead of vidmode" OFF)
|
||||
endif()
|
||||
if(MSVC)
|
||||
# Normally hide the option to build wiiuse on VS, since it depends
|
||||
@@ -115,9 +118,14 @@ if(USE_FRIBIDI)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Xrandr
|
||||
if(UNIX AND USE_XRANDR)
|
||||
find_package(Xrandr REQUIRED)
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
if(USE_CPP2011)
|
||||
add_definitions("-std=gnu++11")
|
||||
add_definitions("-std=c++0x")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -276,12 +284,18 @@ if(USE_WIIUSE)
|
||||
|
||||
endif()
|
||||
|
||||
# Xrandr
|
||||
if(UNIX AND USE_XRANDR)
|
||||
target_link_libraries(supertuxkart ${XRANDR_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
target_link_libraries(supertuxkart iphlpapi.lib)
|
||||
add_custom_command(TARGET supertuxkart POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||
"${PROJECT_SOURCE_DIR}/dependencies/dll"
|
||||
$<TARGET_FILE_DIR:supertuxkart>)
|
||||
add_custom_target(stkshaders SOURCES ${STK_SHADERS})
|
||||
endif()
|
||||
|
||||
# Optional tools
|
||||
@@ -312,6 +326,21 @@ install(FILES ${PROJECT_BINARY_DIR}/supertuxkart.desktop DESTINATION share/appli
|
||||
install(FILES data/supertuxkart_32.png data/supertuxkart_128.png DESTINATION share/pixmaps)
|
||||
install(FILES data/supertuxkart.appdata DESTINATION share/appdata)
|
||||
|
||||
# ==== Checking if data folder exists ====
|
||||
if(NOT IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data)
|
||||
message( FATAL_ERROR "${CMAKE_CURRENT_SOURCE_DIR}/data folder doesn't exist" )
|
||||
endif()
|
||||
|
||||
# ==== Checking if stk-assets folder exists ====
|
||||
if(CHECK_ASSETS)
|
||||
if(NOT IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../stk-assets)
|
||||
set (CUR_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
get_filename_component(PARENT_DIR ${CUR_DIR} PATH)
|
||||
message( FATAL_ERROR "${PARENT_DIR}/stk-assets folder doesn't exist. "
|
||||
"Please download the stk-assets, or disable this test with -DCHECK_ASSETS=off." )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(PREFIX ${CMAKE_INSTALL_PREFIX})
|
||||
configure_file(data/supertuxkart_desktop.template supertuxkart.desktop)
|
||||
add_dependencies(supertuxkart supertuxkart.desktop)
|
||||
|
||||
15
README.md
@@ -26,13 +26,16 @@ Hope you enjoy the game.
|
||||
##Compiling SuperTuxKart
|
||||
|
||||
###Windows
|
||||
A project file for Visual Studio 9 (e.g. the free 2008 express
|
||||
edition) is included in the sources in `src/ide/vc9`. A separate
|
||||
dependency package is available on SuperTuxKart's sourceforge
|
||||
page, which includes all necessary libraries, header files,
|
||||
and dlls to compile and run the source code.
|
||||
1. Install VS 2012 or later. The free express versions work fine.
|
||||
2. Download and install a source package - either a released package or from our [git/svn repositories](http://supertuxkart.sourceforge.net/Source_control)
|
||||
3. Download the latest dependency package depdendencies_for_0.8.2.zip from [here](https://sourceforge.net/projects/supertuxkart/files/SuperTuxKart%20Dependencies/Windows/). Unzip it in the root directory, so that the dependencies directory is next to the src and data directory (if you are updating from a previous dependency package, you can delete the .dll files in the root directory, they are not needed anymore).
|
||||
4. Download cmake and install it. Then start cmake-gui and select the STK root directory as 'Where is the source code', and a new directory in the root directory (next to src, data etc) as build directory (for now I assume that this directory is called bld).
|
||||
5. Click on configure. You will be asked to create the directory (yes), then for your VS version. Make sure to select the right version (be aware of the easy to confuse version numbers: VS 2012 = version 11; VS 2013 = version 12). Click on configure, then generate. This will create the directory 'bld', and a VS solution in that directory.
|
||||
6. In Visual Studio open the project file generated in the 'bld' folder
|
||||
7. Right click on the supertuxkart project in the solution explorer, and select "Set as StartUp Project".
|
||||
8. Select Build->Build Solution (or press F7) to compile.
|
||||
|
||||
While compilation with cygwin is not officially supported,
|
||||
Compilation with cygwin is not officially supported, but
|
||||
this has been done (check with the forum for details).
|
||||
|
||||
###Mac OS X
|
||||
|
||||
2
TODO.md
@@ -20,7 +20,7 @@ no particular order):
|
||||
- Esp. different platforms
|
||||
6. Package creators
|
||||
- Create packages for
|
||||
- most common Linux Distributors
|
||||
- most common Linux distributions
|
||||
- Windows
|
||||
7. Writers
|
||||
- Write documentation, ranging from man page, to
|
||||
|
||||
18
cmake/FindXrandr.cmake
Normal file
@@ -0,0 +1,18 @@
|
||||
find_path(XRANDR_INCLUDE_DIR NAMES X11/extensions/Xrandr.h
|
||||
PATH_SUFFIXES X11/extensions
|
||||
DOC "The XRANDR include directory"
|
||||
)
|
||||
|
||||
find_library(XRANDR_LIBRARY NAMES Xrandr
|
||||
DOC "The XRANDR library"
|
||||
)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(XRANDR DEFAULT_MSG XRANDR_LIBRARY XRANDR_INCLUDE_DIR)
|
||||
|
||||
if(XRANDR_FOUND)
|
||||
set( XRANDR_LIBRARIES ${XRANDR_LIBRARY} )
|
||||
set( XRANDR_INCLUDE_DIRS ${XRANDR_INCLUDE_DIR} )
|
||||
endif()
|
||||
|
||||
mark_as_advanced(XRANDR_INCLUDE_DIR XRANDR_LIBRARY)
|
||||
BIN
data/CREDITS
@@ -1,17 +1,51 @@
|
||||
<?xml version="1.0"?>
|
||||
<achievements>
|
||||
<achievement id="1" type="map" title="Christoffel Columbus" description="Play every official track at least once." >
|
||||
<entry key="farm" goal="1"/>
|
||||
<entry key="scotland" goal="1"/>
|
||||
<entry key="lighthouse" goal="1"/>
|
||||
<entry key="sandtrack" goal="1"/>
|
||||
<entry key="olivermath" goal="1"/>
|
||||
<entry key="subsea" goal="1"/>
|
||||
<entry key="mansion" goal="1"/>
|
||||
<entry key="minigolf" goal="1"/>
|
||||
<entry key="hacienda" goal="1"/>
|
||||
<entry key="jungle" goal="1"/>
|
||||
<achievement id="1" check-type="all-at-least" reset-type="never"
|
||||
title="Christoffel Columbus" description="Play every official track at least once." >
|
||||
<farm goal="1"/>
|
||||
<scotland goal="1"/>
|
||||
<lighthouse goal="1"/>
|
||||
<sandtrack goal="1"/>
|
||||
<olivermath goal="1"/>
|
||||
<subsea goal="1"/>
|
||||
<mansion goal="1"/>
|
||||
<minigolf goal="1"/>
|
||||
<hacienda goal="1"/>
|
||||
<jungle goal="1"/>
|
||||
</achievement>
|
||||
<achievement id="2" check-type="all-at-least" reset-type="never"
|
||||
title="Strike!" description="Hit 10 karts with a bowling-ball.">
|
||||
<ball goal="10"/>
|
||||
</achievement>
|
||||
<achievement id="3" check-type="one-at-least" reset-type="race"
|
||||
title="Arch Enemy" description="Hit the same kart at least 5 times in one race.">
|
||||
<hit goal="5"/>
|
||||
</achievement>
|
||||
<achievement id="4" check-type="all-at-least" reset-type="race"
|
||||
title="Marathoner" description="Make a race with 5 laps or more.">
|
||||
<laps goal="5"/>
|
||||
</achievement>
|
||||
<achievement id="5" check-type="all-at-least" reset-type="lap"
|
||||
title="Skid-row" description="Make 5 skidding in a single lap.">
|
||||
<skidding goal="5"/>
|
||||
</achievement>
|
||||
<achievement id="6" check-type="all-at-least" reset-type="never"
|
||||
title="Gold driver" description="Win in all single player modes, against at least 3 opponents.">
|
||||
<standard goal="1"/>
|
||||
<std_timetrial goal="1"/>
|
||||
<follow_leader goal="1"/>
|
||||
<opponents goal="3"/>
|
||||
</achievement>
|
||||
<achievement id="7" check-type="all-at-least" reset-type="race"
|
||||
title="Powerup Love" description="Use 10 or more powerups in a race.">
|
||||
<poweruplover goal="10"/>
|
||||
</achievement>
|
||||
<achievement id="8" check-type="all-at-least" reset-type="never"
|
||||
title="Unstoppable" description="Win 5 single races in a row.">
|
||||
<wins goal="5"/>
|
||||
</achievement>
|
||||
<achievement id="9" check-type="all-at-least" reset-after-race="yes"
|
||||
title="Banana Lover" description="Collect at least 5 bananas in one race.">
|
||||
<banana goal="5"/>
|
||||
</achievement>
|
||||
<achievement id="2" type="single" goal="10" title="Strike!" description="Hit 10 karts with a bowling-ball." />
|
||||
</achievements>
|
||||
|
||||
|
||||
32
data/gfx/droplet.xml
Normal file
@@ -0,0 +1,32 @@
|
||||
<?xml version="1.0"?>
|
||||
<particles emitter="sphere" radius="5">
|
||||
|
||||
<spreading angle="45" />
|
||||
|
||||
<velocity x="0.000"
|
||||
y="0.005"
|
||||
z="0.000" />
|
||||
|
||||
<material file="particle_water.png" />
|
||||
|
||||
<!-- Amount of particles emitted per second -->
|
||||
<rate min="5"
|
||||
max="10" />
|
||||
|
||||
<!-- Minimal and maximal lifetime of a particle, in milliseconds. -->
|
||||
<lifetime min="1000"
|
||||
max="2000" />
|
||||
|
||||
<!-- Size of the particles -->
|
||||
<size min="4.0"
|
||||
max="7.2"
|
||||
x-increase-factor="2.6"
|
||||
y-increase-factor="2.6" />
|
||||
|
||||
<color min="255 255 255"
|
||||
max="255 255 255" />
|
||||
|
||||
<fadeout time="3000" />
|
||||
|
||||
|
||||
</particles>
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0"?>
|
||||
<particles emitter="point">
|
||||
<particles emitter="box" box_x="12.0" box_y="0.5" box_z="12.0">
|
||||
|
||||
<spreading angle="24" />
|
||||
|
||||
@@ -10,21 +10,23 @@
|
||||
<material file="waterparticles.png" />
|
||||
|
||||
<!-- Amount of particles emitted per second -->
|
||||
<rate min="10"
|
||||
max="30" />
|
||||
<rate min="5"
|
||||
max="20" />
|
||||
|
||||
<!-- Minimal and maximal lifetime of a particle, in milliseconds. -->
|
||||
<lifetime min="500"
|
||||
max="1000" />
|
||||
<lifetime min="1000"
|
||||
max="4000" />
|
||||
|
||||
<!-- Size of the particles -->
|
||||
<size min="0.6"
|
||||
max="6.2" />
|
||||
<size min="5.0"
|
||||
max="10.0"
|
||||
x-increase-factor="2.6"
|
||||
y-increase-factor="2.6" />
|
||||
|
||||
<color min="255 255 255"
|
||||
max="255 255 255" />
|
||||
|
||||
<fadeout time="300" />
|
||||
<fadeout time="5000" />
|
||||
|
||||
|
||||
</particles>
|
||||
|
||||
@@ -6,65 +6,152 @@
|
||||
|
||||
<spacer height="20" width="10" />
|
||||
|
||||
<!--
|
||||
<div layout="horizontal-row" width="100%" height="fit">
|
||||
<checkbox id="pixelshaders"/>
|
||||
<spacer width="10" height="10"/>
|
||||
<label text="Pixel Shaders (requires restart)" I18N="Video settings"/>
|
||||
<label text="Pixel Shaders" I18N="Video settings"/>
|
||||
</div>
|
||||
|
||||
<spacer height="4" width="10" />
|
||||
|
||||
-->
|
||||
|
||||
<div layout="horizontal-row" width="100%" height="fit">
|
||||
<spacer width="50" height="10" />
|
||||
<checkbox id="motionblur"/>
|
||||
<checkbox id="dynamiclight"/>
|
||||
<spacer width="10" height="10"/>
|
||||
<label text="Motion blur" I18N="Video settings"/>
|
||||
<label text="Advanced pipeline (lights, etc.)" I18N="Video settings"/>
|
||||
</div>
|
||||
|
||||
<spacer height="4" width="10" />
|
||||
|
||||
<div layout="horizontal-row" width="100%" height="fit">
|
||||
<spacer width="50" height="10" />
|
||||
<checkbox id="mlaa"/>
|
||||
<spacer width="10" height="10"/>
|
||||
<label text="Anti-aliasing" I18N="Video settings"/>
|
||||
</div>
|
||||
|
||||
<spacer height="4" width="10" />
|
||||
|
||||
<div layout="horizontal-row" width="100%" height="fit">
|
||||
<spacer width="50" height="10" />
|
||||
<label text="Ambient Occlusion" I18N="Video settings"/>
|
||||
<spacer width="10" height="10"/>
|
||||
<gauge id="ssao" min_value="0" max_value="2" width="50%"/>
|
||||
</div>
|
||||
|
||||
<spacer height="4" width="10" />
|
||||
|
||||
<div layout="horizontal-row" width="100%" height="fit">
|
||||
<spacer width="50" height="10" />
|
||||
<label text="Shadows (requires restart)" I18N="Video settings"/>
|
||||
<spacer width="70" height="10" />
|
||||
<label text="Shadows" I18N="Video settings"/>
|
||||
<spacer width="10" height="10"/>
|
||||
<gauge id="shadows" min_value="0" max_value="2" width="50%"/>
|
||||
</div>
|
||||
|
||||
<spacer height="4" width="10" />
|
||||
|
||||
|
||||
<div layout="horizontal-row" width="100%" height="fit">
|
||||
<checkbox id="weather_gfx"/>
|
||||
<spacer width="10" height="10"/>
|
||||
<label text="Weather Effects" I18N="Video settings"/>
|
||||
<spacer width="70" height="10"/>
|
||||
|
||||
<div layout="horizontal-row" proportion="1" height="fit">
|
||||
<checkbox id="bloom"/>
|
||||
<spacer width="10" height="10"/>
|
||||
<label text="Bloom" I18N="Video settings"/>
|
||||
</div>
|
||||
|
||||
<spacer height="4" width="10" />
|
||||
|
||||
<div layout="horizontal-row" proportion="1" height="fit">
|
||||
<checkbox id="lightshaft"/>
|
||||
<spacer width="10" height="10"/>
|
||||
<label text="Light shaft (God rays)" I18N="Video settings"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<spacer height="4" width="10" />
|
||||
|
||||
<div layout="horizontal-row" width="100%" height="fit">
|
||||
<checkbox id="anim_gfx"/>
|
||||
<spacer width="70" height="10"/>
|
||||
<checkbox id="ssao"/>
|
||||
<spacer width="10" height="10"/>
|
||||
<label text="Animated Scenery" I18N="Video settings"/>
|
||||
<label text="Ambient Occlusion" I18N="Video settings"/>
|
||||
</div>
|
||||
|
||||
<spacer height="20" width="10" />
|
||||
|
||||
<div layout="horizontal-row" width="100%" height="fit">
|
||||
<div layout="horizontal-row" proportion="1" height="fit">
|
||||
<checkbox id="motionblur"/>
|
||||
<spacer width="10" height="10"/>
|
||||
<label text="Motion blur" I18N="Video settings"/>
|
||||
</div>
|
||||
|
||||
<spacer height="4" width="10" />
|
||||
|
||||
<div layout="horizontal-row" proportion="1" height="fit">
|
||||
<checkbox id="texture_compression"/>
|
||||
<spacer width="10" height="10"/>
|
||||
<label text="Texture compression" I18N="Video settings"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<spacer height="4" width="10" />
|
||||
|
||||
<div layout="horizontal-row" width="100%" height="fit">
|
||||
<div layout="horizontal-row" proportion="1" height="fit">
|
||||
<checkbox id="glow"/>
|
||||
<spacer width="10" height="10"/>
|
||||
<label text="Glow (outlines)" I18N="Video settings"/>
|
||||
</div>
|
||||
|
||||
<spacer height="4" width="10" />
|
||||
|
||||
<div layout="horizontal-row" proportion="1" height="fit">
|
||||
<checkbox id="mlaa"/>
|
||||
<spacer width="10" height="10"/>
|
||||
<label text="Anti-aliasing" I18N="Video settings"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<spacer height="4" width="10" />
|
||||
|
||||
<div layout="horizontal-row" width="100%" height="fit">
|
||||
<div layout="horizontal-row" proportion="1" height="fit">
|
||||
<checkbox id="weather_gfx"/>
|
||||
<spacer width="10" height="10"/>
|
||||
<label text="Weather Effects" I18N="Video settings"/>
|
||||
</div>
|
||||
|
||||
<spacer height="4" width="10" />
|
||||
|
||||
<div layout="horizontal-row" proportion="1" height="fit">
|
||||
<checkbox id="anim_gfx"/>
|
||||
<spacer width="10" height="10"/>
|
||||
<label text="Animated Scenery" I18N="Video settings"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<spacer height="4" width="10" />
|
||||
|
||||
<div layout="horizontal-row" width="100%" height="fit">
|
||||
<div layout="horizontal-row" proportion="1" height="fit">
|
||||
<checkbox id="ubo"/>
|
||||
<spacer width="10" height="10"/>
|
||||
<label text="Uniform buffer objects" I18N="Video settings"/>
|
||||
</div>
|
||||
|
||||
<spacer height="4" width="10" />
|
||||
|
||||
<div layout="horizontal-row" proportion="1" height="fit">
|
||||
<checkbox id="dof"/>
|
||||
<spacer width="10" height="10"/>
|
||||
<label text="Depth of field" I18N="Video settings"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<spacer height="4" width="10" />
|
||||
|
||||
<div layout="horizontal-row" width="100%" height="fit">
|
||||
<div layout="horizontal-row" proportion="1" height="fit">
|
||||
<checkbox id="hd-textures"/>
|
||||
<spacer width="10" height="10"/>
|
||||
<label text="Use high definition textures" I18N="Video settings"/>
|
||||
</div>
|
||||
|
||||
<spacer height="4" width="10" />
|
||||
<!--
|
||||
<div layout="horizontal-row" proportion="1" height="fit">
|
||||
<checkbox id="anim_gfx"/>
|
||||
<spacer width="10" height="10"/>
|
||||
<label text="Animated Scenery" I18N="Video settings"/>
|
||||
</div>
|
||||
-->
|
||||
</div>
|
||||
|
||||
<spacer height="20" width="10" />
|
||||
|
||||
<div layout="horizontal-row" width="100%" height="fit">
|
||||
<label text="Animated Characters" I18N="Video settings" width="40%"/>
|
||||
@@ -80,20 +167,13 @@
|
||||
<gauge id="filtering" min_value="0" max_value="5" width="50%" />
|
||||
</div>
|
||||
|
||||
<!--
|
||||
<div layout="horizontal-row" width="100%" height="fit">
|
||||
<label text="Anti-aliasing (requires restart)" I18N="Video settings" width="40%" />
|
||||
<spacer width="10" height="10"/>
|
||||
<gauge id="antialiasing" min_value="0" max_value="3" width="50%"/>
|
||||
</div>
|
||||
|
||||
<spacer height="4" width="10" />
|
||||
-->
|
||||
<spacer height="10" width="10" />
|
||||
|
||||
<label text="* Restart STK to apply new settings" width="100%" text_align="center" I18N="Video settings"/>
|
||||
|
||||
<spacer proportion="1"/>
|
||||
|
||||
<button id="close" text="Close" align="center"/>
|
||||
<button id="close" text="Apply" align="center"/>
|
||||
</div>
|
||||
|
||||
</stkgui>
|
||||
|
||||
6
data/gui/debug_slider.stkgui
Normal file
@@ -0,0 +1,6 @@
|
||||
<stkgui>
|
||||
<div x="2%" y="10%" width="96%" height="80%" layout="vertical-row" >
|
||||
<label id="title" width="100%"/>
|
||||
<gauge id="value_slider" min_value="0" max_value="100" width="100%" />
|
||||
</div>
|
||||
</stkgui>
|
||||
BIN
data/gui/down.png
Normal file
|
After Width: | Height: | Size: 4.0 KiB |
54
data/gui/edit_track.stkgui
Normal file
@@ -0,0 +1,54 @@
|
||||
<stkgui>
|
||||
|
||||
<div x="2%" y="1%" width="96%" height="98%" layout="vertical-row" padding="10">
|
||||
|
||||
<header id="selected_track" width="80%" height="30"
|
||||
I18N="No neeed to translate this, it will be overwritten by the track name"
|
||||
text="" align="center" text_align="center" />
|
||||
|
||||
<spacer height="20" />
|
||||
|
||||
<!-- Track selection -->
|
||||
<box width="100%" height="60%" layout="vertical-row">
|
||||
<ribbon_grid id="tracks" proportion="1" width="100%" height="100%" square_items="true"
|
||||
label_location="each" align="center" child_width="240" child_height="160" />
|
||||
</box>
|
||||
|
||||
<!-- Populated dynamically at runtime -->
|
||||
<tabs width="100%" height="30" id="trackgroups"> </tabs>
|
||||
|
||||
<spacer height="50" />
|
||||
|
||||
<!-- Laps and reverse -->
|
||||
<div width="100%" height="100" layout="horizontal-row" align="center">
|
||||
|
||||
<spacer proportion="1" />
|
||||
|
||||
<label id="laps_label" text_align="left"
|
||||
I18N="In the edit track screen" text="Number of laps:" />
|
||||
<spacer width="20" />
|
||||
<spinner id="laps" proportion="1" width="100" min_value="1"
|
||||
max_value="99" wrap_around="false" />
|
||||
|
||||
<spacer proportion="1" />
|
||||
|
||||
<label id="reverse_label" text_align="left"
|
||||
I18N="In the edit track screen" text="Reverse:" />
|
||||
<spacer width="20" />
|
||||
<checkbox id="reverse" />
|
||||
|
||||
<spacer proportion="1" />
|
||||
</div>
|
||||
|
||||
<!-- Dialog buttons -->
|
||||
<div width="100%" height="60" layout="horizontal-row">
|
||||
<spacer proportion="2" />
|
||||
<button id="ok" text="OK" proportion="1" />
|
||||
<spacer proportion="1" />
|
||||
<button id="cancel" text="Cancel" proportion="1" />
|
||||
<spacer proportion="2" />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</stkgui>
|
||||
21
data/gui/enter_gp_name_dialog.stkgui
Normal file
@@ -0,0 +1,21 @@
|
||||
<stkgui>
|
||||
|
||||
<div x="2%" y="10%" width="96%" height="80%" layout="vertical-row" >
|
||||
|
||||
<label id="title" width="100%" text_align="center" word_wrap="true"
|
||||
I18N="In the 'add new grand prix' dialog"
|
||||
text="Please enter the name of the grand prix" proportion="1" />
|
||||
|
||||
<spacer height="25" width="10" />
|
||||
|
||||
<textbox id="textfield" width="75%" I18N="In the 'add new grand prix' dialog" align="center"/>
|
||||
|
||||
<spacer height="20" width="20" />
|
||||
|
||||
<button id="cancel" I18N="When configuring input" text="Press ESC to cancel" align="center"/>
|
||||
|
||||
<spacer height="15" width="20" />
|
||||
|
||||
</div>
|
||||
|
||||
</stkgui>
|
||||
BIN
data/gui/gp_add_track.png
Normal file
|
After Width: | Height: | Size: 6.1 KiB |
BIN
data/gui/gp_copy.png
Normal file
|
After Width: | Height: | Size: 19 KiB |
BIN
data/gui/gp_edit.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
data/gui/gp_edit_track.png
Normal file
|
After Width: | Height: | Size: 9.3 KiB |
BIN
data/gui/gp_new.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
data/gui/gp_remove.png
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
data/gui/gp_remove_track.png
Normal file
|
After Width: | Height: | Size: 3.9 KiB |
BIN
data/gui/gp_rename.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
data/gui/gp_save.png
Normal file
|
After Width: | Height: | Size: 5.5 KiB |
35
data/gui/gpedit.stkgui
Normal file
@@ -0,0 +1,35 @@
|
||||
<stkgui>
|
||||
|
||||
<icon-button id="back" x="0" y="0" height="8%" icon="gui/back.png" />
|
||||
|
||||
<div x="2%" y="1%" width="96%" height="98%" layout="vertical-row">
|
||||
|
||||
<header id="title" width="80%" I18N="Title in edit grand prix screen"
|
||||
text="Edit Grand Prix" align="center" text_align="center" />
|
||||
|
||||
<spacer width="100%" height="2%" />
|
||||
|
||||
<box proportion="5" width="98%" align="center" layout="vertical-row" padding="6">
|
||||
<list id="tracks" x="0" y="0" width="100%" height="100%" keep_selection="true" />
|
||||
</box>
|
||||
|
||||
<spacer width="100%" height="2%" />
|
||||
|
||||
<buttonbar proportion="1" id="menu" height="135" width="100%" align="center">
|
||||
<icon-button id="up" width="128" height="128" icon="gui/up.png"
|
||||
I18N="Menu item" text="Move up" />
|
||||
<icon-button id="down" width="128" height="128" icon="gui/down.png"
|
||||
I18N="Menu item" text="Move down" />
|
||||
<icon-button id="add" width="128" height="128" icon="gui/gp_add_track.png"
|
||||
I18N="Menu item" text="Add" />
|
||||
<icon-button id="edit" width="128" height="128" icon="gui/gp_edit_track.png"
|
||||
I18N="Menu item" text="Edit" />
|
||||
<icon-button id="remove" width="128" height="128" icon="gui/gp_remove_track.png"
|
||||
I18N="Menu item" text="Remove" />
|
||||
<icon-button id="save" width="128" height="128" icon="gui/gp_save.png"
|
||||
I18N="Menu item" text="Save" />
|
||||
</buttonbar>
|
||||
|
||||
</div>
|
||||
|
||||
</stkgui>
|
||||
BIN
data/gui/gpeditor.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
45
data/gui/gpeditor.stkgui
Normal file
@@ -0,0 +1,45 @@
|
||||
<stkgui>
|
||||
|
||||
<icon-button id="back" x="0" y="0" height="8%" icon="gui/back.png"/>
|
||||
|
||||
<div x="2%" y="1%" width="96%" height="98%" layout="vertical-row" >
|
||||
|
||||
<header width="80%" I18N="Title in grand prix editor screen" text="Grand Prix editor"
|
||||
align="center" text_align="center" />
|
||||
|
||||
<spacer height="20" />
|
||||
|
||||
<box proportion="4" width="100%" layout="vertical-row">
|
||||
<ribbon_grid id="gplist" proportion="1" width="100%" square_items="true"
|
||||
label_location="each" align="left" max_rows="2" child_width="160"
|
||||
child_height="120" keep_selection="true" />
|
||||
</box>
|
||||
|
||||
<spacer height="10" />
|
||||
|
||||
<box proportion="2" width="100%" layout="vertical-row">
|
||||
<label id="gpname" text_align="center" width="100%"
|
||||
I18N="In the grand prix editor screen" text="" />
|
||||
<ribbon_grid id="tracks" proportion="1" width="100%" square_items="true"
|
||||
label_location="each" align="left" max_rows="1"
|
||||
child_width="160" child_height="120" />
|
||||
</box>
|
||||
|
||||
<spacer height="20" />
|
||||
|
||||
<buttonbar proportion="1" id="menu" height="135" width="100%" align="center">
|
||||
<icon-button id="new" width="128" height="128" icon="gui/gp_new.png"
|
||||
I18N="Menu item" text="New" />
|
||||
<icon-button id="copy" width="128" height="128" icon="gui/gp_copy.png"
|
||||
I18N="Menu item" text="Copy" />
|
||||
<icon-button id="edit" width="128" height="128" icon="gui/gp_edit.png"
|
||||
I18N="Menu item" text="Edit" />
|
||||
<icon-button id="remove" width="128" height="128" icon="gui/gp_remove.png"
|
||||
I18N="Menu item" text="Remove" />
|
||||
<icon-button id="rename" width="128" height="128" icon="gui/gp_rename.png"
|
||||
I18N="Menu item" text="Rename" />
|
||||
</buttonbar>
|
||||
|
||||
</div>
|
||||
|
||||
</stkgui>
|
||||
@@ -1,9 +1,9 @@
|
||||
<stkgui>
|
||||
|
||||
|
||||
<div x="0" y="0" width="100%" height="100%" layout="vertical-row" >
|
||||
|
||||
<icon id="logo" align="center" proportion="5" width="100%" icon="gui/logo.png"/>
|
||||
|
||||
|
||||
<buttonbar id="menu_toprow" proportion="3" width="90%" align="center">
|
||||
<icon-button id="story" width="128" height="128"
|
||||
icon="gui/menu_story.png" focus_icon="gui/menu_story_focus.png"
|
||||
@@ -21,35 +21,37 @@
|
||||
icon="gui/menu_addons.png" focus_icon="gui/menu_addons_focus.png"
|
||||
I18N="Main menu button" text="Addons"/>
|
||||
</buttonbar>
|
||||
|
||||
|
||||
<spacer width="10" height="7%"/>
|
||||
|
||||
|
||||
<bottombar width="100%" height="10%" layout="horizontal-row">
|
||||
|
||||
<spacer width="10" height="10" />
|
||||
|
||||
|
||||
<label proportion="3" height="100%" id="info_addons"
|
||||
I18N="In the main screen"
|
||||
text=""
|
||||
align="center" text_align="left" />
|
||||
|
||||
|
||||
<spacer width="10" height="10" />
|
||||
|
||||
<buttonbar id="menu_bottomrow" x="0" y="0" width="30%" height="100%" align="center">
|
||||
|
||||
<buttonbar id="menu_bottomrow" x="0" y="0" width="38%" height="100%" align="center">
|
||||
<icon-button id="options" width="64" height="64" icon="gui/main_options.png" extend_label="50"
|
||||
I18N="Main menu button" text="Options" label_location="hover"/>
|
||||
<icon-button id="help" width="64" height="64" icon="gui/main_help.png" extend_label="50"
|
||||
I18N="Main menu button" text="Help" label_location="hover"/>
|
||||
<icon-button id="startTutorial" width="64" height="64" icon="gui/tutorial.png" extend_label="150"
|
||||
I18N="Main menu button" text="Tutorial" label_location="hover"/>
|
||||
<icon-button id="gpEditor" width="64" height="64" icon="gui/gpeditor.png" extend_label="150"
|
||||
I18N="Main menu button" text="Grand Prix Editor" label_location="hover"/>
|
||||
<icon-button id="about" width="64" height="64" icon="gui/main_about.png" extend_label="50"
|
||||
I18N="Main menu button" text="About" label_location="hover"/>
|
||||
<icon-button id="quit" width="64" height="64" icon="gui/main_quit.png" extend_label="50"
|
||||
I18N="Main menu button" text="Quit" label_location="hover"/>
|
||||
</buttonbar>
|
||||
|
||||
|
||||
</bottombar>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</stkgui>
|
||||
|
||||
@@ -39,6 +39,6 @@ or collect any achievements while being online."
|
||||
</box>
|
||||
</div>
|
||||
|
||||
<icon-button id="back" x="0" y="0" height="15%" icon="gui/back.png"/>
|
||||
<icon-button id="back" x="0" y="0" height="8%" icon="gui/back.png"/>
|
||||
|
||||
</stkgui>
|
||||
|
||||
BIN
data/gui/scroll_down.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
data/gui/scroll_up.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
data/gui/up.png
Normal file
|
After Width: | Height: | Size: 4.0 KiB |
|
Before Width: | Height: | Size: 111 KiB |
@@ -1,10 +1,16 @@
|
||||
#version 330
|
||||
uniform sampler2D tex;
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
in vec2 uv;
|
||||
out vec4 FragColor;
|
||||
#else
|
||||
varying vec2 uv;
|
||||
#define FragColor gl_FragColor
|
||||
#endif
|
||||
|
||||
|
||||
void main(void)
|
||||
{
|
||||
FragColor = texture(tex, uv);
|
||||
vec4 color = texture(tex, uv);
|
||||
FragColor = vec4(color.rgb, color.a);
|
||||
}
|
||||
|
||||
@@ -1,12 +1,18 @@
|
||||
#version 330
|
||||
uniform mat4 ModelViewMatrix;
|
||||
uniform mat4 ProjectionMatrix;
|
||||
uniform vec3 Position;
|
||||
uniform vec2 Size;
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
in vec2 Corner;
|
||||
in vec2 Texcoord;
|
||||
out vec2 uv;
|
||||
#else
|
||||
attribute vec2 Corner;
|
||||
attribute vec2 Texcoord;
|
||||
varying vec2 uv;
|
||||
#endif
|
||||
|
||||
|
||||
void main(void)
|
||||
{
|
||||
|
||||
@@ -1,17 +1,22 @@
|
||||
#version 330
|
||||
uniform sampler2D tex;
|
||||
uniform float low;
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
in vec2 uv;
|
||||
out vec4 FragColor;
|
||||
#else
|
||||
varying vec2 uv;
|
||||
#define FragColor gl_FragColor
|
||||
#endif
|
||||
|
||||
vec3 getCIEYxy(vec3 rgbColor);
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 weights = vec3(0.2126, 0.7152, 0.0722); // ITU-R BT. 709
|
||||
vec3 col = texture(tex, uv).xyz;
|
||||
float luma = dot(weights, col);
|
||||
float luma = getCIEYxy(col).x;
|
||||
|
||||
col *= smoothstep(1., 2., luma);
|
||||
col *= smoothstep(1., 10., luma);
|
||||
|
||||
FragColor = vec4(col, 1.0);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
#version 330
|
||||
uniform sampler2D tex;
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
in vec2 uv;
|
||||
out vec4 FragColor;
|
||||
#else
|
||||
varying vec2 uv;
|
||||
#define FragColor gl_FragColor
|
||||
#endif
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#version 330 compatibility
|
||||
uniform float power;
|
||||
uniform sampler2D tex;
|
||||
|
||||
|
||||
@@ -14,14 +14,22 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#version 330
|
||||
|
||||
uniform sampler2D tex;
|
||||
uniform float transparency;
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
in vec2 uv;
|
||||
out vec4 FragColor;
|
||||
#else
|
||||
varying vec2 uv;
|
||||
#define FragColor gl_FragColor
|
||||
#endif
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
FragColor = texture(tex, uv);
|
||||
FragColor.a *= transparency;
|
||||
vec4 Color = texture(tex, uv);
|
||||
Color.a *= transparency;
|
||||
FragColor = vec4(Color.rgb * Color.a, Color.a);
|
||||
}
|
||||
|
||||
@@ -17,13 +17,21 @@
|
||||
|
||||
|
||||
// Creates a bubble (wave) effect by distorting the texture depending on time
|
||||
#version 330
|
||||
|
||||
uniform mat4 ModelViewProjectionMatrix;
|
||||
uniform float time;
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
in vec3 Position;
|
||||
in vec2 Texcoord;
|
||||
out vec2 uv;
|
||||
#else
|
||||
attribute vec3 Position;
|
||||
attribute vec2 Texcoord;
|
||||
varying vec2 uv;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
|
||||
@@ -1,20 +1,24 @@
|
||||
#version 330 compatibility
|
||||
uniform sampler2D tex;
|
||||
uniform sampler2D Albedo;
|
||||
uniform sampler2D caustictex;
|
||||
uniform vec2 dir;
|
||||
uniform vec2 dir2;
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
in vec2 uv;
|
||||
out vec4 FragColor;
|
||||
#else
|
||||
varying vec2 uv;
|
||||
#define FragColor gl_FragColor
|
||||
#endif
|
||||
|
||||
vec3 getLightFactor(float specMapValue);
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 tc = gl_TexCoord[0].xy;
|
||||
vec4 color = texture(Albedo, uv);
|
||||
float caustic = texture(caustictex, uv + dir).x;
|
||||
float caustic2 = texture(caustictex, (uv.yx + dir2 * vec2(-0.6, 0.3)) * vec2(0.6)).x;
|
||||
|
||||
vec3 col = texture(tex, tc).xyz;
|
||||
float caustic = texture(caustictex, tc + dir).x;
|
||||
float caustic2 = texture(caustictex, (tc.yx + dir2 * vec2(-0.6, 0.3)) * vec2(0.6)).x;
|
||||
|
||||
col += caustic * caustic2 * 10.0;
|
||||
|
||||
FragColor = vec4(col, 1.0);
|
||||
vec3 LightFactor = getLightFactor(1.) + caustic * caustic2 * 10;
|
||||
FragColor = vec4(color.xyz * LightFactor, 1.);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#version 330 compatibility
|
||||
uniform sampler2D tex;
|
||||
uniform sampler2D oldtex;
|
||||
uniform vec2 pixel;
|
||||
|
||||
@@ -1,11 +1,167 @@
|
||||
#version 330
|
||||
//#define DOF_ENABLED
|
||||
|
||||
#ifdef DOF_ENABLED
|
||||
|
||||
uniform sampler2D tex;
|
||||
uniform sampler2D dtex;
|
||||
uniform vec3 inlevel;
|
||||
uniform vec2 outlevel;
|
||||
uniform mat4 invprojm;
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
in vec2 uv;
|
||||
out vec4 FragColor;
|
||||
#else
|
||||
varying vec2 uv;
|
||||
#define FragColor gl_FragColor
|
||||
#endif
|
||||
|
||||
#define PI 3.14159265
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
// TEST
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
float width = 1920; //texture width
|
||||
float height = 1080; //texture height
|
||||
|
||||
vec2 texel = vec2(1.0/width,1.0/height);
|
||||
|
||||
//------------------------------------------
|
||||
//user variables
|
||||
|
||||
int samples = 3; //samples on the first ring
|
||||
int rings = 5; //ring count
|
||||
|
||||
bool autofocus = false; //use autofocus in shader? disable if you use external focalDepth value
|
||||
float focalDepth = 0.1;
|
||||
vec2 focus = vec2(0.5,0.5); // autofocus point on screen (0.0,0.0 - left lower corner, 1.0,1.0 - upper right)
|
||||
float range = 150.0; //focal range
|
||||
float maxblur = 1.25; //clamp value of max blur
|
||||
|
||||
float threshold = 0.9; //highlight threshold;
|
||||
float gain = 10.0; //highlight gain;
|
||||
|
||||
float bias = 0.4; //bokeh edge bias
|
||||
float fringe = 0.5; //bokeh chromatic aberration/fringing
|
||||
|
||||
bool noise = true; //use noise instead of pattern for sample dithering
|
||||
float namount = 0.0001; //dither amount
|
||||
|
||||
bool depthblur = false; //blur the depth buffer?
|
||||
float dbsize = 2.0; //depthblursize
|
||||
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
// Function
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
vec3 color(vec2 coords,float blur) //processing the sample
|
||||
{
|
||||
vec3 col = vec3(0.0);
|
||||
|
||||
col.r = texture2D(tex,coords + vec2(0.0,1.0)*texel*fringe*blur).r;
|
||||
col.g = texture2D(tex,coords + vec2(-0.866,-0.5)*texel*fringe*blur).g;
|
||||
col.b = texture2D(tex,coords + vec2(0.866,-0.5)*texel*fringe*blur).b;
|
||||
|
||||
vec3 lumcoeff = vec3(0.299,0.587,0.114);
|
||||
float lum = dot(col.rgb, lumcoeff);
|
||||
float thresh = max((lum-threshold)*gain, 0.0);
|
||||
return col+mix(vec3(0.0),col,thresh*blur);
|
||||
}
|
||||
|
||||
vec2 rand(in vec2 coord) //generating noise/pattern texture for dithering
|
||||
{
|
||||
float noiseX = ((fract(1.0-coord.s*(width/2.0))*0.25)+(fract(coord.t*(height/2.0))*0.75))*2.0-1.0;
|
||||
float noiseY = ((fract(1.0-coord.s*(width/2.0))*0.75)+(fract(coord.t*(height/2.0))*0.25))*2.0-1.0;
|
||||
|
||||
if (noise)
|
||||
{
|
||||
noiseX = clamp(fract(sin(dot(coord ,vec2(12.9898,78.233))) * 43758.5453),0.0,1.0)*2.0-1.0;
|
||||
noiseY = clamp(fract(sin(dot(coord ,vec2(12.9898,78.233)*2.0)) * 43758.5453),0.0,1.0)*2.0-1.0;
|
||||
}
|
||||
return vec2(noiseX,noiseY);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
|
||||
//float depth = texture2D(dtex,uv).x;
|
||||
|
||||
float curdepth = texture(dtex, uv).x;
|
||||
vec4 FragPos = invprojm * (2.0f * vec4(uv, curdepth, 1.0f) - 1.0f);
|
||||
FragPos /= FragPos.w;
|
||||
|
||||
float depth = clamp((FragPos.z/180), 0., 1.);
|
||||
|
||||
|
||||
float blur = 0.0;
|
||||
|
||||
|
||||
blur = clamp((abs(depth - focalDepth)/range)*100.0,-maxblur,maxblur);
|
||||
|
||||
vec2 noise = rand(uv)*namount*blur;
|
||||
|
||||
float w = (1.0/width)*blur+noise.x;
|
||||
float h = (1.0/height)*blur+noise.y;
|
||||
|
||||
vec3 col = texture2D(tex, uv).rgb;
|
||||
vec3 colDof = col;
|
||||
float s = 1.0;
|
||||
|
||||
int ringsamples;
|
||||
|
||||
for (int i = 1; i <= rings; i += 1)
|
||||
{
|
||||
ringsamples = i * samples;
|
||||
|
||||
for (int j = 0 ; j < ringsamples ; j += 1)
|
||||
{
|
||||
float step = PI*2.0 / float(ringsamples);
|
||||
float pw = (cos(float(j)*step)*float(i));
|
||||
float ph = (sin(float(j)*step)*float(i));
|
||||
float p = 1.0;
|
||||
|
||||
colDof += color(uv + vec2(pw*w,ph*h),blur)*mix(1.0,(float(i))/(float(rings)),bias)*p;
|
||||
s += 1.0*mix(1.0,(float(i))/(float(rings)),bias)*p;
|
||||
}
|
||||
}
|
||||
colDof /= s;
|
||||
|
||||
// get color correction values
|
||||
float inBlack = inlevel.x;
|
||||
float inWhite = inlevel.z;
|
||||
float inGamma = inlevel.y;
|
||||
|
||||
float outBlack = outlevel.x;
|
||||
float outWhite = outlevel.y;
|
||||
|
||||
vec3 colOut = (pow(((col.rgb * 255.0) - inBlack) / (inWhite - inBlack),
|
||||
vec3(1.0 / inGamma)) * (outWhite - outBlack) + outBlack) / 255.0;
|
||||
|
||||
depth = (1 - depth);
|
||||
vec3 final = colOut * depth + colDof.rgb * (1 - depth);
|
||||
|
||||
vec2 inTex = uv - 0.5;
|
||||
float vignette = 1 - dot(inTex, inTex);
|
||||
|
||||
vignette = clamp(pow(vignette, 0.8), 0., 1.) ;
|
||||
vignette = vignette + vignette - 0.5;
|
||||
final.rgb *= clamp(vignette, 0., 1.15);
|
||||
|
||||
FragColor.rgb = final;
|
||||
FragColor.a = 1.0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
void main()
|
||||
{
|
||||
vec2 texc = uv;
|
||||
@@ -13,6 +169,13 @@ void main()
|
||||
|
||||
|
||||
vec4 col = texture(tex, texc);
|
||||
float curdepth = texture(dtex, uv).x;
|
||||
|
||||
vec2 inTex = uv - 0.5;
|
||||
float vignette = 1 - dot(inTex, inTex);
|
||||
|
||||
vec4 FragPos = invprojm * (2.0f * vec4(uv, curdepth, 1.0f) - 1.0f);
|
||||
FragPos /= FragPos.w;
|
||||
|
||||
//col = col / (1 - col);
|
||||
|
||||
@@ -23,8 +186,63 @@ void main()
|
||||
float outBlack = outlevel.x;
|
||||
float outWhite = outlevel.y;
|
||||
|
||||
col.rgb = (pow(((col.rgb * 255.0) - inBlack) / (inWhite - inBlack),
|
||||
float depth1 = clamp((FragPos.z/180), 0., 1.);
|
||||
|
||||
vec3 colOut = (pow(((col.rgb * 255.0) - inBlack) / (inWhite - inBlack),
|
||||
vec3(1.0 / inGamma)) * (outWhite - outBlack) + outBlack) / 255.0;
|
||||
|
||||
FragColor = vec4(col.rgb, 1.0);
|
||||
depth1 = (1 - depth1);
|
||||
vec3 final = colOut * depth1 + col.rgb * (1 - depth1);
|
||||
|
||||
vignette = clamp(pow(vignette, 0.8), 0., 1.) ;
|
||||
vignette = vignette + vignette - 0.5;
|
||||
final.rgb *= clamp(vignette, 0., 1.15);
|
||||
FragColor = vec4(final, 1.0);
|
||||
|
||||
|
||||
}*/
|
||||
|
||||
#else
|
||||
|
||||
|
||||
uniform sampler2D tex;
|
||||
uniform sampler2D dtex;
|
||||
uniform vec3 inlevel;
|
||||
uniform vec2 outlevel;
|
||||
uniform mat4 invprojm;
|
||||
|
||||
in vec2 uv;
|
||||
out vec4 FragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 col = texture(tex, uv);
|
||||
|
||||
float curdepth = texture(dtex, uv).x;
|
||||
vec4 FragPos = invprojm * (2.0 * vec4(uv, curdepth, 1.0f) - 1.0f);
|
||||
FragPos /= FragPos.w;
|
||||
float depth = clamp(FragPos.z / 180, 0., 1.);
|
||||
depth = (1 - depth);
|
||||
|
||||
// Compute the vignette
|
||||
vec2 inside = uv - 0.5;
|
||||
float vignette = 1 - dot(inside, inside);
|
||||
vignette = clamp(pow(vignette, 0.8), 0., 1.);
|
||||
vignette = clamp(vignette + vignette - 0.5, 0., 1.15);
|
||||
|
||||
float inBlack = inlevel.x;
|
||||
float inWhite = inlevel.z;
|
||||
float inGamma = inlevel.y;
|
||||
|
||||
float outBlack = outlevel.x;
|
||||
float outWhite = outlevel.y;
|
||||
|
||||
vec3 colSat = (pow(((col.rgb * 255.0) - inBlack) / (inWhite - inBlack),
|
||||
vec3(1.0 / inGamma)) * (outWhite - outBlack) + outBlack) / 255.0;
|
||||
|
||||
vec3 colFinal = colSat * depth + col.rgb * (1 - depth);
|
||||
|
||||
FragColor = vec4(colFinal * vignette, 1.0);
|
||||
//FragColor = vec4(vec3(depth), 1.0);
|
||||
}
|
||||
#endif
|
||||
@@ -1,7 +1,11 @@
|
||||
#version 330
|
||||
uniform ivec4 color;
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
out vec4 FragColor;
|
||||
#else
|
||||
#define FragColor gl_FragColor
|
||||
#endif
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
#version 330
|
||||
uniform vec2 center;
|
||||
uniform vec2 size;
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
in vec2 position;
|
||||
#else
|
||||
attribute vec2 position;
|
||||
#endif
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
#version 330
|
||||
uniform vec3 col;
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
out vec4 FragColor;
|
||||
#else
|
||||
#define FragColor gl_FragColor
|
||||
#endif
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
#version 130
|
||||
uniform vec3 col;
|
||||
uniform sampler2D tex;
|
||||
|
||||
out vec4 FragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
float alpha = texture(tex, gl_TexCoord[0].xy).a;
|
||||
if (alpha < 0.5)
|
||||
discard;
|
||||
|
||||
FragColor = vec4(col, 1.0);
|
||||
}
|
||||
@@ -1,9 +1,16 @@
|
||||
#version 330
|
||||
uniform sampler2D tex;
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
in vec2 uv;
|
||||
in vec4 col;
|
||||
out vec4 FragColor;
|
||||
#else
|
||||
varying vec2 uv;
|
||||
varying vec4 col;
|
||||
#define FragColor gl_FragColor
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
|
||||
@@ -1,14 +1,22 @@
|
||||
#version 330
|
||||
uniform vec2 center;
|
||||
uniform vec2 size;
|
||||
uniform vec2 texcenter;
|
||||
uniform vec2 texsize;
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
in vec2 position;
|
||||
in vec2 texcoord;
|
||||
in uvec4 color;
|
||||
out vec2 uv;
|
||||
out vec4 col;
|
||||
#else
|
||||
attribute vec2 position;
|
||||
attribute vec2 texcoord;
|
||||
attribute uvec4 color;
|
||||
varying vec2 uv;
|
||||
varying vec4 col;
|
||||
#endif
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
|
||||
@@ -1,24 +1,23 @@
|
||||
#version 330
|
||||
uniform sampler2D Albedo;
|
||||
uniform sampler2D Detail;
|
||||
uniform sampler2D DiffuseMap;
|
||||
uniform sampler2D SpecularMap;
|
||||
uniform sampler2D SSAO;
|
||||
uniform vec2 screen;
|
||||
uniform vec3 ambient;
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
in vec2 uv;
|
||||
in vec2 uv_bis;
|
||||
out vec4 FragColor;
|
||||
#else
|
||||
varying vec2 uv;
|
||||
varying vec2 uv_bis;
|
||||
#define FragColor gl_FragColor
|
||||
#endif
|
||||
|
||||
vec3 getLightFactor(float specMapValue);
|
||||
|
||||
void main(void)
|
||||
{
|
||||
vec2 tc = gl_FragCoord.xy / screen;
|
||||
vec4 color = texture(Albedo, uv);
|
||||
vec4 detail = texture(Detail, uv_bis);
|
||||
color *= detail;
|
||||
vec3 DiffuseComponent = texture(DiffuseMap, tc).xyz;
|
||||
vec3 SpecularComponent = texture(SpecularMap, tc).xyz;
|
||||
float ao = texture(SSAO, tc).x;
|
||||
vec3 LightFactor = ao * ambient + DiffuseComponent + SpecularComponent * (1. - color.a);
|
||||
FragColor = vec4(color.xyz * LightFactor * ao, 1.);
|
||||
vec4 detail = texture(Detail, uv_bis);
|
||||
color *= detail;
|
||||
vec3 LightFactor = getLightFactor(1. - color.a);
|
||||
FragColor = vec4(color.xyz * LightFactor, 1.);
|
||||
}
|
||||
|
||||
47
data/shaders/diffuseenvmap.frag
Normal file
@@ -0,0 +1,47 @@
|
||||
uniform float blueLmn[9];
|
||||
uniform float greenLmn[9];
|
||||
uniform float redLmn[9];
|
||||
uniform sampler2D ntex;
|
||||
uniform mat4 TransposeViewMatrix;
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
in vec2 uv;
|
||||
out vec4 Diff;
|
||||
out vec4 Spec;
|
||||
#else
|
||||
varying vec2 uv;
|
||||
#define Diff gl_FragData[0]
|
||||
#define Spec gl_FragData[1]
|
||||
#endif
|
||||
|
||||
vec3 DecodeNormal(vec2 n);
|
||||
|
||||
mat4 getMatrix(float L[9])
|
||||
{
|
||||
float c1 = 0.429043, c2 = 0.511664, c3 = 0.743125, c4 = 0.886227, c5 = 0.247708;
|
||||
|
||||
return mat4(
|
||||
c1 * L[8] /*L22*/, c1 * L[4] /*L2-2*/, c1 * L[7] /*L21*/, c2 * L[3] /*L11*/,
|
||||
c1 * L[4], - c1 * L[8], c1 * L[5] /*L2-1*/, c2 * L[1] /*L1-1*/,
|
||||
c1 * L[7], c1 * L[5], c3 * L[6] /*L20*/, c2 * L[2] /*L10*/,
|
||||
c2 * L[3], c2 * L[1], c2 * L[2], c4 * L[0] /*L00*/ - c5 * L[6]
|
||||
);
|
||||
}
|
||||
|
||||
void main(void)
|
||||
{
|
||||
vec3 normal = normalize(DecodeNormal(2. * texture(ntex, uv).xy - 1.));
|
||||
// Convert normal in world space (where SH coordinates were computed)
|
||||
vec4 extendednormal = TransposeViewMatrix * vec4(normal, 1.);
|
||||
extendednormal.w = 1.;
|
||||
mat4 rmat = getMatrix(redLmn);
|
||||
mat4 gmat = getMatrix(greenLmn);
|
||||
mat4 bmat = getMatrix(blueLmn);
|
||||
|
||||
float r = dot(extendednormal, rmat * extendednormal);
|
||||
float g = dot(extendednormal, gmat * extendednormal);
|
||||
float b = dot(extendednormal, bmat * extendednormal);
|
||||
|
||||
Diff = max(0.25 * vec4(r, g, b, .1), vec4(0.));
|
||||
Spec = vec4(0.);
|
||||
}
|
||||
@@ -1,19 +1,29 @@
|
||||
#version 330
|
||||
uniform sampler2D tex;
|
||||
uniform sampler2D displacement_tex;
|
||||
uniform sampler2D mask_tex;
|
||||
uniform sampler2D color_tex;
|
||||
uniform vec2 screen;
|
||||
uniform vec2 dir;
|
||||
uniform vec2 dir2;
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
in vec2 uv;
|
||||
in vec2 uv_bis;
|
||||
in float camdist;
|
||||
|
||||
out vec4 FragColor;
|
||||
#else
|
||||
varying vec2 uv;
|
||||
varying vec2 uv_bis;
|
||||
varying float camdist;
|
||||
#define FragColor gl_FragColor
|
||||
#endif
|
||||
|
||||
const float maxlen = 0.02;
|
||||
|
||||
void main()
|
||||
{
|
||||
float horiz = texture(tex, uv + dir).x;
|
||||
float vert = texture(tex, (uv.yx + dir2) * vec2(0.9)).x;
|
||||
float horiz = texture(displacement_tex, uv + dir).x;
|
||||
float vert = texture(displacement_tex, (uv.yx + dir2) * vec2(0.9)).x;
|
||||
|
||||
vec2 offset = vec2(horiz, vert);
|
||||
offset *= 2.0;
|
||||
@@ -30,11 +40,20 @@ void main()
|
||||
|
||||
offset *= 50.0 * fade * maxlen;
|
||||
|
||||
vec4 col;
|
||||
col.r = step(offset.x, 0.0) * -offset.x;
|
||||
col.g = step(0.0, offset.x) * offset.x;
|
||||
col.b = step(offset.y, 0.0) * -offset.y;
|
||||
col.a = step(0.0, offset.y) * offset.y;
|
||||
vec4 shiftval;
|
||||
shiftval.r = step(offset.x, 0.0) * -offset.x;
|
||||
shiftval.g = step(0.0, offset.x) * offset.x;
|
||||
shiftval.b = step(offset.y, 0.0) * -offset.y;
|
||||
shiftval.a = step(0.0, offset.y) * offset.y;
|
||||
|
||||
FragColor = col;
|
||||
vec2 shift;
|
||||
shift.x = -shiftval.x + shiftval.y;
|
||||
shift.y = -shiftval.z + shiftval.w;
|
||||
shift /= 50.;
|
||||
|
||||
vec2 tc = gl_FragCoord.xy / screen;
|
||||
float mask = texture(mask_tex, tc + shift).x;
|
||||
tc += (mask < 1.) ? vec2(0.) : shift;
|
||||
|
||||
FragColor = texture(color_tex, tc);
|
||||
}
|
||||
|
||||
@@ -1,13 +1,23 @@
|
||||
#version 330
|
||||
uniform mat4 ModelViewProjectionMatrix;
|
||||
uniform mat4 ModelViewMatrix;
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
in vec3 Position;
|
||||
in vec2 Texcoord;
|
||||
in vec2 SecondTexcoord;
|
||||
out vec2 uv;
|
||||
out vec2 uv_bis;
|
||||
out float camdist;
|
||||
#else
|
||||
attribute vec3 Position;
|
||||
attribute vec2 Texcoord;
|
||||
attribute vec2 SecondTexcoord;
|
||||
varying vec2 uv;
|
||||
varying vec2 uv_bis;
|
||||
varying float camdist;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
void main() {
|
||||
gl_Position = ModelViewProjectionMatrix * vec4(Position, 1.);
|
||||
|
||||
82
data/shaders/dof.frag
Normal file
@@ -0,0 +1,82 @@
|
||||
uniform sampler2D tex;
|
||||
uniform sampler2D dtex;
|
||||
uniform mat4 invprojm;
|
||||
uniform vec2 screen;
|
||||
|
||||
in vec2 uv;
|
||||
out vec4 FragColor;
|
||||
|
||||
float focalDepth = 10.;
|
||||
float maxblur = 1.;
|
||||
float range = 100.;
|
||||
|
||||
void main()
|
||||
{
|
||||
float curdepth = texture(dtex, uv).x;
|
||||
vec4 FragPos = invprojm * (2.0f * vec4(uv, curdepth, 1.0f) - 1.0f);
|
||||
FragPos /= FragPos.w;
|
||||
|
||||
float depth = FragPos.z;
|
||||
float blur = clamp(abs(depth - focalDepth) / range, -maxblur, maxblur);
|
||||
|
||||
vec2 offset = 10. / screen;
|
||||
|
||||
vec4 col = texture2D(tex, uv);
|
||||
vec4 colOriginal = col;
|
||||
// Weight from here http://artmartinsh.blogspot.fr/2010/02/glsl-lens-blur-filter-with-bokeh.html
|
||||
|
||||
col += texture2D(tex, uv + (vec2(0.0, 0.4) * offset) * blur);
|
||||
col += texture2D(tex, uv + (vec2(0.15, 0.37) * offset) * blur);
|
||||
col += texture2D(tex, uv + (vec2(0.29,0.29) * offset) * blur);
|
||||
col += texture2D(tex, uv + (vec2(-0.37,0.15) * offset) * blur);
|
||||
col += texture2D(tex, uv + (vec2(0.4, 0.0) * offset) * blur);
|
||||
col += texture2D(tex, uv + (vec2(0.37, -0.15) * offset) * blur);
|
||||
col += texture2D(tex, uv + (vec2(0.29, -0.29) * offset) * blur);
|
||||
col += texture2D(tex, uv + (vec2(-0.15, -0.37) * offset) * blur);
|
||||
col += texture2D(tex, uv + (vec2(0.0, -0.4) * offset) * blur);
|
||||
col += texture2D(tex, uv + (vec2(-0.15, 0.37) * offset) * blur);
|
||||
col += texture2D(tex, uv + (vec2(-0.29, 0.29) * offset) * blur);
|
||||
col += texture2D(tex, uv + (vec2(0.37, 0.15) * offset) * blur);
|
||||
col += texture2D(tex, uv + (vec2(-0.4, 0.0) * offset) * blur);
|
||||
col += texture2D(tex, uv + (vec2(-0.37, -0.15) * offset) * blur);
|
||||
col += texture2D(tex, uv + (vec2(-0.29, -0.29) * offset) * blur);
|
||||
col += texture2D(tex, uv + (vec2(0.15, -0.37) * offset) * blur);
|
||||
|
||||
col += texture2D(tex, uv + (vec2(0.15, 0.37) * offset) * blur * 0.9);
|
||||
col += texture2D(tex, uv + (vec2(-0.37, 0.15) * offset) * blur * 0.9);
|
||||
col += texture2D(tex, uv + (vec2(0.37, -0.15) * offset) * blur * 0.9);
|
||||
col += texture2D(tex, uv + (vec2(-0.15, -0.37) * offset) * blur * 0.9);
|
||||
col += texture2D(tex, uv + (vec2(-0.15, 0.37) * offset) * blur * 0.9);
|
||||
col += texture2D(tex, uv + (vec2(0.37, 0.15) * offset) * blur * 0.9);
|
||||
col += texture2D(tex, uv + (vec2(-0.37, -0.15) * offset) * blur * 0.9);
|
||||
col += texture2D(tex, uv + (vec2(0.15, -0.37) * offset) * blur * 0.9);
|
||||
|
||||
col += texture2D(tex, uv + (vec2(0.29, 0.29) * offset) * blur * 0.7);
|
||||
col += texture2D(tex, uv + (vec2(0.4, 0.0) * offset) * blur * 0.7);
|
||||
col += texture2D(tex, uv + (vec2(0.29, -0.29) * offset) * blur * 0.7);
|
||||
col += texture2D(tex, uv + (vec2(0.0, -0.4) * offset) * blur * 0.7);
|
||||
col += texture2D(tex, uv + (vec2(-0.29, 0.29) * offset) * blur * 0.7);
|
||||
col += texture2D(tex, uv + (vec2(-0.4, 0.0) * offset) * blur * 0.7);
|
||||
col += texture2D(tex, uv + (vec2(-0.29, -0.29) * offset) * blur * 0.7);
|
||||
col += texture2D(tex, uv + (vec2(0.0, 0.4) * offset) * blur *0.7);
|
||||
|
||||
col += texture2D(tex, uv + (vec2(0.29, 0.29) * offset) * blur * 0.4);
|
||||
col += texture2D(tex, uv + (vec2(0.4, 0.0) * offset) * blur * 0.4);
|
||||
col += texture2D(tex, uv + (vec2(0.29, -0.29) * offset) * blur * 0.4);
|
||||
col += texture2D(tex, uv + (vec2(0.0, -0.4) * offset) * blur * 0.4);
|
||||
col += texture2D(tex, uv + (vec2(-0.29, 0.29) * offset) * blur * 0.4);
|
||||
col += texture2D(tex, uv + (vec2(-0.4, 0.0) * offset) * blur * 0.4);
|
||||
col += texture2D(tex, uv + (vec2(-0.29, -0.29) * offset) * blur * 0.4);
|
||||
col += texture2D(tex, uv + (vec2(0.0, 0.4) * offset) * blur * 0.4);
|
||||
|
||||
col = vec4(col.rgb / 41.0, col.a);
|
||||
depth = clamp((FragPos.z/280), 0., 1.);
|
||||
depth = (1 - depth);
|
||||
vec3 final = colOriginal.rgb * depth + col.rgb * (1 - depth);
|
||||
|
||||
/*
|
||||
FragColor.xyz = vec3(depth);
|
||||
FragColor.a = 1.0;
|
||||
*/
|
||||
FragColor = vec4(final, 1.);
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
#version 330 compatibility
|
||||
uniform mat4 ModelViewProjectionMatrix;
|
||||
|
||||
void main() {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#version 330
|
||||
uniform mat4 ProjectionMatrix;
|
||||
uniform mat4 ViewMatrix;
|
||||
|
||||
@@ -13,6 +12,7 @@ in float anglespeed;
|
||||
|
||||
out float lf;
|
||||
out vec2 tc;
|
||||
out vec3 pc;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
@@ -58,4 +58,5 @@ void main(void)
|
||||
|
||||
vec4 viewpos = ViewMatrix * vec4(newposition + newquadcorner, 1.0);
|
||||
gl_Position = ProjectionMatrix * viewpos;
|
||||
pc = vec3(1.);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#version 330
|
||||
uniform sampler2D tex;
|
||||
|
||||
uniform float fogmax;
|
||||
@@ -7,21 +6,33 @@ uniform float endH;
|
||||
uniform float start;
|
||||
uniform float end;
|
||||
uniform vec3 col;
|
||||
uniform mat4 ipvmat;
|
||||
|
||||
#ifdef UBO_DISABLED
|
||||
uniform mat4 ViewMatrix;
|
||||
uniform mat4 ProjectionMatrix;
|
||||
uniform mat4 InverseViewMatrix;
|
||||
uniform mat4 InverseProjectionMatrix;
|
||||
#else
|
||||
layout (std140) uniform MatrixesData
|
||||
{
|
||||
mat4 ViewMatrix;
|
||||
mat4 ProjectionMatrix;
|
||||
mat4 InverseViewMatrix;
|
||||
mat4 InverseProjectionMatrix;
|
||||
mat4 ShadowViewProjMatrixes[4];
|
||||
};
|
||||
#endif
|
||||
|
||||
in vec2 uv;
|
||||
out vec4 FragColor;
|
||||
|
||||
|
||||
vec4 getPosFromUVDepth(vec3 uvDepth, mat4 InverseProjectionMatrix);
|
||||
|
||||
void main()
|
||||
{
|
||||
float z = texture(tex, uv).x;
|
||||
|
||||
vec3 tmp = vec3(uv, z);
|
||||
tmp = tmp * 2.0 - 1.0;
|
||||
|
||||
vec4 xpos = vec4(tmp, 1.0);
|
||||
xpos = ipvmat * xpos;
|
||||
xpos.xyz /= xpos.w;
|
||||
vec4 xpos = getPosFromUVDepth(vec3(uv, z), InverseProjectionMatrix);
|
||||
|
||||
float dist = length(xpos.xyz);
|
||||
float fog = smoothstep(start, end, dist);
|
||||
|
||||
31
data/shaders/gaussian17taph.frag
Normal file
@@ -0,0 +1,31 @@
|
||||
// From http://http.developer.nvidia.com/GPUGems3/gpugems3_ch40.html
|
||||
|
||||
uniform sampler2D tex;
|
||||
uniform vec2 pixel;
|
||||
uniform float sigma = 5.;
|
||||
|
||||
in vec2 uv;
|
||||
out vec4 FragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
float X = uv.x;
|
||||
float Y = uv.y;
|
||||
|
||||
|
||||
float g0, g1, g2;
|
||||
g0 = 1.0 / (sqrt(2.0 * 3.14) * sigma);
|
||||
g1 = exp(-0.5 / (sigma * sigma));
|
||||
g2 = g1 * g1;
|
||||
vec4 sum = texture(tex, vec2(X, Y)) * g0;
|
||||
g0 *= g1;
|
||||
g1 *= g2;
|
||||
for (int i = 1; i < 9; i++) {
|
||||
sum += texture(tex, vec2(X - i * pixel.x, Y)) * g0;
|
||||
sum += texture(tex, vec2(X + i * pixel.x, Y)) * g0;
|
||||
g0 *= g1;
|
||||
g1 *= g2;
|
||||
}
|
||||
|
||||
FragColor = sum;
|
||||
}
|
||||
32
data/shaders/gaussian17tapv.frag
Normal file
@@ -0,0 +1,32 @@
|
||||
// From http://http.developer.nvidia.com/GPUGems3/gpugems3_ch40.html
|
||||
|
||||
uniform sampler2D tex;
|
||||
uniform vec2 pixel;
|
||||
uniform float sigma = 5.;
|
||||
|
||||
in vec2 uv;
|
||||
out vec4 FragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
float X = uv.x;
|
||||
float Y = uv.y;
|
||||
|
||||
|
||||
float g0, g1, g2;
|
||||
g0 = 1.0 / (sqrt(2.0 * 3.14) * sigma);
|
||||
g1 = exp(-0.5 / (sigma * sigma));
|
||||
g2 = g1 * g1;
|
||||
vec4 sum = texture(tex, vec2(X, Y)) * g0;
|
||||
g0 *= g1;
|
||||
g1 *= g2;
|
||||
for (int i = 1; i < 9; i++) {
|
||||
sum += texture(tex, vec2(X, Y - i * pixel.y)) * g0;
|
||||
sum += texture(tex, vec2(X, Y + i * pixel.y)) * g0;
|
||||
g0 *= g1;
|
||||
g1 *= g2;
|
||||
}
|
||||
|
||||
FragColor = sum;
|
||||
}
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
#version 330
|
||||
uniform sampler2D tex;
|
||||
uniform vec2 pixel;
|
||||
|
||||
// Gaussian separated blur with radius 3.
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
in vec2 uv;
|
||||
out vec4 FragColor;
|
||||
#else
|
||||
varying vec2 uv;
|
||||
#define FragColor gl_FragColor
|
||||
#endif
|
||||
|
||||
void main()
|
||||
{
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
#version 330
|
||||
uniform sampler2D tex;
|
||||
uniform vec2 pixel;
|
||||
|
||||
// Gaussian separated blur with radius 3.
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
in vec2 uv;
|
||||
out vec4 FragColor;
|
||||
#else
|
||||
varying vec2 uv;
|
||||
#define FragColor gl_FragColor
|
||||
#endif
|
||||
|
||||
void main()
|
||||
{
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
#version 330
|
||||
uniform sampler2D tex;
|
||||
uniform vec2 pixel;
|
||||
|
||||
// Gaussian separated blur with radius 6.
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
in vec2 uv;
|
||||
out vec4 FragColor;
|
||||
#else
|
||||
varying vec2 uv;
|
||||
#define FragColor gl_FragColor
|
||||
#endif
|
||||
|
||||
void main()
|
||||
{
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
#version 330
|
||||
uniform sampler2D tex;
|
||||
uniform vec2 pixel;
|
||||
|
||||
// Gaussian separated blur with radius 6.
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
in vec2 uv;
|
||||
out vec4 FragColor;
|
||||
#else
|
||||
varying vec2 uv;
|
||||
#define FragColor gl_FragColor
|
||||
#endif
|
||||
|
||||
void main()
|
||||
{
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
#version 330
|
||||
uniform sampler2D tex;
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
in vec2 uv;
|
||||
out vec4 FragColor;
|
||||
#else
|
||||
varying vec2 uv;
|
||||
#define FragColor gl_FragColor
|
||||
#endif
|
||||
|
||||
void main()
|
||||
{
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
#version 330 compatibility
|
||||
uniform sampler2D tex;
|
||||
uniform vec3 col;
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
in vec2 uv;
|
||||
out vec4 FragColor;
|
||||
#else
|
||||
varying vec2 uv;
|
||||
#define FragColor gl_FragColor
|
||||
#endif
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 res = texture(tex, gl_TexCoord[0].xy);
|
||||
vec4 res = texture(tex, uv);
|
||||
|
||||
// Keep the sun fully bright, but fade the sky
|
||||
float mul = distance(res.xyz, col);
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#version 330 compatibility
|
||||
uniform sampler2D tex;
|
||||
uniform vec2 sunpos;
|
||||
|
||||
@@ -6,14 +5,20 @@ uniform vec2 sunpos;
|
||||
|
||||
const float decaystep = 0.88;
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
in vec2 uv;
|
||||
out vec4 FragColor;
|
||||
#else
|
||||
varying vec2 uv;
|
||||
#define FragColor gl_FragColor
|
||||
#endif
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 texc = gl_TexCoord[0].xy;
|
||||
vec2 texc = uv;
|
||||
vec2 tosun = sunpos - texc;
|
||||
|
||||
if (dot(tosun, tosun) > 0.49) discard;
|
||||
// if (dot(tosun, tosun) > 0.49) discard;
|
||||
|
||||
vec2 dist = tosun * 1.0/(float(SAMPLES) * 1.12);
|
||||
|
||||
|
||||
@@ -1,14 +1,24 @@
|
||||
#version 330
|
||||
uniform vec3 windDir;
|
||||
uniform mat4 ModelViewProjectionMatrix;
|
||||
uniform mat4 TransposeInverseModelView;
|
||||
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
in vec3 Position;
|
||||
in vec3 Normal;
|
||||
in vec2 Texcoord;
|
||||
in vec4 Color;
|
||||
noperspective out vec3 nor;
|
||||
out vec3 nor;
|
||||
out vec2 uv;
|
||||
#else
|
||||
attribute vec3 Position;
|
||||
attribute vec3 Normal;
|
||||
attribute vec2 Texcoord;
|
||||
attribute vec4 Color;
|
||||
varying vec3 nor;
|
||||
varying vec2 uv;
|
||||
#endif
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
34
data/shaders/grass_pass2.frag
Normal file
@@ -0,0 +1,34 @@
|
||||
uniform sampler2D Albedo;
|
||||
uniform vec3 SunDir;
|
||||
uniform mat4 invproj;
|
||||
uniform sampler2D dtex;
|
||||
uniform vec2 screen;
|
||||
|
||||
in vec3 nor;
|
||||
in vec2 uv;
|
||||
out vec4 FragColor;
|
||||
|
||||
vec3 getLightFactor(float specMapValue);
|
||||
|
||||
void main(void)
|
||||
{
|
||||
vec2 texc = gl_FragCoord.xy / screen;
|
||||
float z = texture(dtex, texc).x;
|
||||
|
||||
vec4 xpos = 2.0 * vec4(texc, z, 1.0) - 1.0f;
|
||||
xpos = invproj * xpos;
|
||||
xpos /= xpos.w;
|
||||
vec3 eyedir = normalize(xpos.xyz);
|
||||
|
||||
// Inspired from http://http.developer.nvidia.com/GPUGems3/gpugems3_ch16.html
|
||||
float fEdotL = max(0., dot(SunDir, eyedir));
|
||||
float fPowEdotL = pow(fEdotL, 4.);
|
||||
|
||||
float fLdotNBack = max(0., - dot(nor, SunDir) * 0.6 + 0.4);
|
||||
float scattering = mix(fPowEdotL, fLdotNBack, .5);
|
||||
|
||||
vec4 color = texture(Albedo, uv);
|
||||
if (color.a < 0.5) discard;
|
||||
vec3 LightFactor = scattering + getLightFactor(1.);
|
||||
FragColor = vec4(color.xyz * LightFactor, 1.);
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
#version 330
|
||||
uniform vec3 windDir;
|
||||
uniform mat4 ModelViewProjectionMatrix;
|
||||
|
||||
in vec3 Position;
|
||||
in vec2 Texcoord;
|
||||
in vec4 Color;
|
||||
out vec2 uv;
|
||||
|
||||
void main()
|
||||
{
|
||||
uv = Texcoord;
|
||||
gl_Position = ModelViewProjectionMatrix * vec4(Position + windDir * Color.r, 1.);
|
||||
}
|
||||
35
data/shaders/instanced_grass.vert
Normal file
@@ -0,0 +1,35 @@
|
||||
layout (std140) uniform MatrixesData
|
||||
{
|
||||
mat4 ViewMatrix;
|
||||
mat4 ProjectionMatrix;
|
||||
mat4 InverseViewMatrix;
|
||||
mat4 InverseProjectionMatrix;
|
||||
mat4 ShadowViewProjMatrixes[4];
|
||||
};
|
||||
|
||||
uniform vec3 windDir;
|
||||
|
||||
|
||||
in vec3 Origin;
|
||||
in vec3 Orientation;
|
||||
in vec3 Scale;
|
||||
|
||||
in vec3 Position;
|
||||
in vec3 Normal;
|
||||
in vec2 Texcoord;
|
||||
in vec4 Color;
|
||||
|
||||
out vec3 nor;
|
||||
out vec2 uv;
|
||||
|
||||
mat4 getWorldMatrix(vec3 translation, vec3 rotation, vec3 scale);
|
||||
mat4 getInverseWorldMatrix(vec3 translation, vec3 rotation, vec3 scale);
|
||||
|
||||
void main()
|
||||
{
|
||||
mat4 ModelMatrix = getWorldMatrix(Origin + windDir * Color.r, Orientation, Scale);
|
||||
mat4 TransposeInverseModelView = transpose(getInverseWorldMatrix(Origin + windDir * Color.r, Orientation, Scale) * InverseViewMatrix);
|
||||
gl_Position = ProjectionMatrix * ViewMatrix * ModelMatrix * vec4(Position, 1.);
|
||||
nor = (TransposeInverseModelView * vec4(Normal, 0.)).xyz;
|
||||
uv = Texcoord;
|
||||
}
|
||||
38
data/shaders/instanced_object_pass.vert
Normal file
@@ -0,0 +1,38 @@
|
||||
#ifdef UBO_DISABLED
|
||||
uniform mat4 ViewMatrix;
|
||||
uniform mat4 ProjectionMatrix;
|
||||
uniform mat4 InverseViewMatrix;
|
||||
uniform mat4 InverseProjectionMatrix;
|
||||
#else
|
||||
layout (std140) uniform MatrixesData
|
||||
{
|
||||
mat4 ViewMatrix;
|
||||
mat4 ProjectionMatrix;
|
||||
mat4 InverseViewMatrix;
|
||||
mat4 InverseProjectionMatrix;
|
||||
mat4 ShadowViewProjMatrixes[4];
|
||||
};
|
||||
#endif
|
||||
|
||||
in vec3 Origin;
|
||||
in vec3 Orientation;
|
||||
in vec3 Scale;
|
||||
|
||||
in vec3 Position;
|
||||
in vec3 Normal;
|
||||
in vec2 Texcoord;
|
||||
|
||||
out vec3 nor;
|
||||
out vec2 uv;
|
||||
|
||||
mat4 getWorldMatrix(vec3 translation, vec3 rotation, vec3 scale);
|
||||
mat4 getInverseWorldMatrix(vec3 translation, vec3 rotation, vec3 scale);
|
||||
|
||||
void main(void)
|
||||
{
|
||||
mat4 ModelMatrix = getWorldMatrix(Origin, Orientation, Scale);
|
||||
mat4 TransposeInverseModelView = transpose(getInverseWorldMatrix(Origin, Orientation, Scale) * InverseViewMatrix);
|
||||
gl_Position = ProjectionMatrix * ViewMatrix * ModelMatrix * vec4(Position, 1.);
|
||||
nor = (TransposeInverseModelView * vec4(Normal, 0.)).xyz;
|
||||
uv = Texcoord;
|
||||
}
|
||||
39
data/shaders/instanciedshadow.vert
Normal file
@@ -0,0 +1,39 @@
|
||||
layout (std140) uniform MatrixesData
|
||||
{
|
||||
mat4 ViewMatrix;
|
||||
mat4 ProjectionMatrix;
|
||||
mat4 InverseViewMatrix;
|
||||
mat4 InverseProjectionMatrix;
|
||||
mat4 ShadowViewProjMatrixes[4];
|
||||
};
|
||||
|
||||
in vec3 Origin;
|
||||
in vec3 Orientation;
|
||||
in vec3 Scale;
|
||||
|
||||
in vec3 Position;
|
||||
in vec2 Texcoord;
|
||||
|
||||
#ifdef VSLayer
|
||||
out vec2 uv;
|
||||
#else
|
||||
out vec2 tc;
|
||||
out int layerId;
|
||||
#endif
|
||||
|
||||
mat4 getWorldMatrix(vec3 translation, vec3 rotation, vec3 scale);
|
||||
mat4 getInverseWorldMatrix(vec3 translation, vec3 rotation, vec3 scale);
|
||||
|
||||
void main(void)
|
||||
{
|
||||
mat4 ModelMatrix = getWorldMatrix(Origin, Orientation, Scale);
|
||||
#ifdef VSLayer
|
||||
gl_Layer = gl_InstanceID & 3;
|
||||
gl_Position = ShadowViewProjMatrixes[gl_Layer] * ModelMatrix * vec4(Position, 1.);
|
||||
uv = Texcoord;
|
||||
#else
|
||||
layerId = gl_InstanceID & 3;
|
||||
gl_Position = ShadowViewProjMatrixes[layerId] * ModelMatrix * vec4(Position, 1.);
|
||||
tc = Texcoord;
|
||||
#endif
|
||||
}
|
||||
14
data/shaders/logluminance.frag
Normal file
@@ -0,0 +1,14 @@
|
||||
uniform sampler2D tex;
|
||||
|
||||
in vec2 uv;
|
||||
out vec4 FragColor;
|
||||
|
||||
float delta = .0001;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 weight = vec3(0.2125f, 0.7154f, 0.0721f);
|
||||
vec3 col = texture(tex, uv).xyz;
|
||||
float luma = dot(col, weight);
|
||||
FragColor = vec4(log(luma + delta));
|
||||
}
|
||||
@@ -1,5 +1,3 @@
|
||||
#version 330 compatibility
|
||||
|
||||
uniform sampler2D tex;
|
||||
uniform vec2 texsize;
|
||||
uniform int notex;
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
#version 330 compatibility
|
||||
#define MAX_SEARCH_STEPS 8.0
|
||||
#define MAX_DISTANCE 33.0
|
||||
|
||||
#extension GL_ARB_shader_texture_lod: enable
|
||||
|
||||
uniform sampler2D edgesMap;
|
||||
uniform sampler2D areaMap;
|
||||
|
||||
uniform vec2 PIXEL_SIZE;
|
||||
|
||||
#define MAX_SEARCH_STEPS 8.0
|
||||
#define MAX_DISTANCE 33.0
|
||||
|
||||
in vec2 uv;
|
||||
|
||||
out vec4 FragColor;
|
||||
|
||||
/**
|
||||
@@ -17,7 +16,7 @@ out vec4 FragColor;
|
||||
* bit.
|
||||
*/
|
||||
vec4 tex2Doffset(sampler2D map, vec2 texcoord, vec2 offset) {
|
||||
return texture2DLod(map, texcoord + PIXEL_SIZE * offset, 0.0);
|
||||
return textureLod(map, texcoord + PIXEL_SIZE * offset, 0.0);
|
||||
}
|
||||
|
||||
float SearchXLeft(vec2 texcoord) {
|
||||
@@ -73,24 +72,24 @@ vec2 Area(vec2 distance, float e1, float e2) {
|
||||
float areaSize = MAX_DISTANCE * 5.0;
|
||||
vec2 pixcoord = MAX_DISTANCE * round(4.0 * vec2(e1, e2)) + distance;
|
||||
vec2 texcoord = pixcoord / (areaSize - 1.0);
|
||||
return texture2DLod(areaMap, texcoord, 0.0).ra;
|
||||
return textureLod(areaMap, texcoord, 0.0).ra;
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec4 areas = vec4(0.0);
|
||||
|
||||
vec2 e = texture(edgesMap, gl_TexCoord[0].xy).rg;
|
||||
vec2 e = texture(edgesMap, uv).rg;
|
||||
|
||||
if (e.g != 0.0) { // Edge at north
|
||||
|
||||
// Search distances to the left and to the right:
|
||||
vec2 d = vec2(SearchXLeft(gl_TexCoord[0].xy), SearchXRight(gl_TexCoord[0].xy));
|
||||
vec2 d = vec2(SearchXLeft(uv), SearchXRight(uv));
|
||||
|
||||
// Now fetch the crossing edges. Instead of sampling between edgels, we
|
||||
// sample at 0.25, to be able to discern what value has each edgel:
|
||||
vec4 coords = vec4(d.x, 0.25, d.y + 1.0, 0.25) * PIXEL_SIZE.xyxy + gl_TexCoord[0].xyxy;
|
||||
float e1 = texture2DLod(edgesMap, coords.xy, 0.0).r;
|
||||
float e2 = texture2DLod(edgesMap, coords.zw, 0.0).r;
|
||||
vec4 coords = vec4(d.x, 0.25, d.y + 1.0, 0.25) * PIXEL_SIZE.xyxy + uv.xyxy;
|
||||
float e1 = textureLod(edgesMap, coords.xy, 0.0).r;
|
||||
float e2 = textureLod(edgesMap, coords.zw, 0.0).r;
|
||||
|
||||
// Ok, we know how this pattern looks like, now it is time for getting
|
||||
// the actual area:
|
||||
@@ -100,12 +99,12 @@ void main() {
|
||||
if (e.r != 0.0) { // Edge at west
|
||||
|
||||
// Search distances to the top and to the bottom:
|
||||
vec2 d = vec2(SearchYUp(gl_TexCoord[0].xy), SearchYDown(gl_TexCoord[0].xy));
|
||||
vec2 d = vec2(SearchYUp(uv), SearchYDown(uv));
|
||||
|
||||
// Now fetch the crossing edges (yet again):
|
||||
vec4 coords = vec4(-0.25, d.x, -0.25, d.y - 1.0) * PIXEL_SIZE.xyxy + gl_TexCoord[0].xyxy;
|
||||
float e1 = texture2DLod(edgesMap, coords.xy, 0.0).g;
|
||||
float e2 = texture2DLod(edgesMap, coords.zw, 0.0).g;
|
||||
vec4 coords = vec4(-0.25, d.x, -0.25, d.y - 1.0) * PIXEL_SIZE.xyxy + uv.xyxy;
|
||||
float e1 = textureLod(edgesMap, coords.xy, 0.0).g;
|
||||
float e2 = textureLod(edgesMap, coords.zw, 0.0).g;
|
||||
|
||||
// Get the area for this direction:
|
||||
areas.ba = Area(abs(d), e1, e2);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#version 330 compatibility
|
||||
uniform sampler2D colorMapG;
|
||||
|
||||
in vec4 offset[2];
|
||||
in vec2 uv;
|
||||
|
||||
uniform sampler2D colorMapG;
|
||||
const float threshold = 0.1;
|
||||
|
||||
out vec4 FragColor;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#version 330 compatibility
|
||||
in vec4 offset[2];
|
||||
in vec2 uv;
|
||||
out vec4 FragColor;
|
||||
|
||||
uniform sampler2D blendMap;
|
||||
uniform sampler2D colorMap;
|
||||
|
||||
in vec4 offset[2];
|
||||
in vec2 uv;
|
||||
|
||||
out vec4 FragColor;
|
||||
|
||||
void main() {
|
||||
// Fetch the blending weights for current pixel:
|
||||
vec4 topLeft = texture(blendMap, uv);
|
||||
@@ -37,5 +37,5 @@ void main() {
|
||||
color = mix(C, Cright, a.a) * w.a + color;
|
||||
|
||||
// Normalize the resulting color and we are finished!
|
||||
FragColor = color / sum;
|
||||
FragColor = vec4(color / sum);
|
||||
}
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
#version 330 compatibility
|
||||
uniform vec2 PIXEL_SIZE;
|
||||
uniform mat4 ModelViewProjectionMatrix;
|
||||
|
||||
in vec2 Position;
|
||||
in vec2 Texcoord;
|
||||
|
||||
out vec4 offset[2];
|
||||
out vec2 uv;
|
||||
|
||||
void main() {
|
||||
gl_Position = ModelViewProjectionMatrix * gl_Vertex;
|
||||
vec4 invy = gl_MultiTexCoord0;
|
||||
gl_Position = vec4(Position, 0., 1.);
|
||||
vec4 invy = vec4(Texcoord, Texcoord);
|
||||
// invy.y = 1.0 - invy.y;
|
||||
uv = invy.st;
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
// The actual boost amount (which linearly scales the blur to be shown).
|
||||
// should be in the range [0.0, 1.0], though a larger value might make
|
||||
// the blurring too string. Atm we are using [0, 0.5].
|
||||
#version 330 compatibility
|
||||
uniform float boost_amount;
|
||||
|
||||
// The color buffer to use.
|
||||
@@ -41,14 +40,20 @@ uniform float mask_radius;
|
||||
// Maximum height of texture used
|
||||
uniform float max_tex_height;
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
in vec2 uv;
|
||||
out vec4 FragColor;
|
||||
#else
|
||||
varying vec2 uv;
|
||||
#define FragColor gl_FragColor
|
||||
#endif
|
||||
|
||||
// Number of samples used for blurring
|
||||
#define NB_SAMPLES 8
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 texcoords = gl_TexCoord[0].st;
|
||||
vec2 texcoords = uv;
|
||||
|
||||
// Sample the color buffer
|
||||
vec3 color = texture(color_buffer, texcoords).rgb;
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2013 the SuperTuxKart team
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
|
||||
// motion_blur.vert
|
||||
#version 330 compatibility
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_TexCoord[0].st = vec2(gl_MultiTexCoord0.s, gl_MultiTexCoord0.t);
|
||||
gl_Position = gl_Vertex;
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
#version 330 compatibility
|
||||
uniform sampler2D tex1;
|
||||
uniform sampler2D tex2;
|
||||
|
||||
|
||||
@@ -1,26 +1,24 @@
|
||||
#version 330
|
||||
uniform sampler2D normalMap;
|
||||
uniform sampler2D DiffuseForAlpha;
|
||||
|
||||
noperspective in vec3 tangent;
|
||||
noperspective in vec3 bitangent;
|
||||
in vec3 tangent;
|
||||
in vec3 bitangent;
|
||||
in vec2 uv;
|
||||
out vec2 EncodedNormal;
|
||||
out vec3 EncodedNormal;
|
||||
|
||||
// from Crytek "a bit more deferred CryEngine"
|
||||
vec2 EncodeNormal(vec3 n)
|
||||
{
|
||||
return normalize(n.xy) * sqrt(n.z * 0.5 + 0.5);
|
||||
}
|
||||
vec2 EncodeNormal(vec3 n);
|
||||
|
||||
void main()
|
||||
{
|
||||
// normal in Tangent Space
|
||||
vec3 TS_normal = 2.0 * texture (normalMap, uv).rgb - 1.0;
|
||||
// Because of interpolation, we need to renormalize
|
||||
vec3 Frag_tangent = normalize(tangent);
|
||||
vec3 Frag_normal = normalize(cross(Frag_tangent, bitangent));
|
||||
vec3 Frag_bitangent = cross(Frag_normal, Frag_tangent);
|
||||
// normal in Tangent Space
|
||||
vec3 TS_normal = 2.0 * texture(normalMap, uv).rgb - 1.0;
|
||||
float alpha = texture(DiffuseForAlpha, uv).a;
|
||||
// Because of interpolation, we need to renormalize
|
||||
vec3 Frag_tangent = normalize(tangent);
|
||||
vec3 Frag_normal = normalize(cross(Frag_tangent, bitangent));
|
||||
vec3 Frag_bitangent = cross(Frag_normal, Frag_tangent);
|
||||
|
||||
vec3 FragmentNormal = TS_normal.x * Frag_tangent + TS_normal.y * Frag_bitangent - TS_normal.z * Frag_normal;
|
||||
EncodedNormal = 0.5 * EncodeNormal(normalize(FragmentNormal)) + 0.5;
|
||||
vec3 FragmentNormal = TS_normal.x * Frag_tangent + TS_normal.y * Frag_bitangent - TS_normal.z * Frag_normal;
|
||||
EncodedNormal.xy = 0.5 * EncodeNormal(normalize(FragmentNormal)) + 0.5;
|
||||
EncodedNormal.z = exp2(10. * (1. - alpha) + 1.);
|
||||
}
|
||||
|
||||
@@ -1,17 +1,38 @@
|
||||
#version 330
|
||||
uniform mat4 ModelViewProjectionMatrix;
|
||||
uniform mat4 TransposeInverseModelView;
|
||||
layout (std140) uniform MatrixesData
|
||||
{
|
||||
mat4 ViewMatrix;
|
||||
mat4 ProjectionMatrix;
|
||||
mat4 InverseViewMatrix;
|
||||
mat4 InverseProjectionMatrix;
|
||||
mat4 ShadowViewProjMatrixes[4];
|
||||
};
|
||||
|
||||
uniform mat4 ModelMatrix;
|
||||
uniform mat4 InverseModelMatrix;
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
in vec3 Position;
|
||||
in vec2 Texcoord;
|
||||
in vec3 Tangent;
|
||||
in vec3 Bitangent;
|
||||
noperspective out vec3 tangent;
|
||||
noperspective out vec3 bitangent;
|
||||
out vec3 tangent;
|
||||
out vec3 bitangent;
|
||||
out vec2 uv;
|
||||
#else
|
||||
attribute vec3 Position;
|
||||
attribute vec2 Texcoord;
|
||||
attribute vec3 Tangent;
|
||||
attribute vec3 Bitangent;
|
||||
varying vec3 tangent;
|
||||
varying vec3 bitangent;
|
||||
varying vec2 uv;
|
||||
#endif
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
mat4 ModelViewProjectionMatrix = ProjectionMatrix * ViewMatrix * ModelMatrix;
|
||||
mat4 TransposeInverseModelView = transpose(InverseModelMatrix * InverseViewMatrix);
|
||||
uv = Texcoord;
|
||||
tangent = (TransposeInverseModelView * vec4(Tangent, 1.)).xyz;
|
||||
bitangent = (TransposeInverseModelView * vec4(Bitangent, 1.)).xyz;
|
||||
|
||||
56
data/shaders/object_pass.vert
Normal file
@@ -0,0 +1,56 @@
|
||||
#ifdef UBO_DISABLED
|
||||
uniform mat4 ViewMatrix;
|
||||
uniform mat4 ProjectionMatrix;
|
||||
uniform mat4 InverseViewMatrix;
|
||||
uniform mat4 InverseProjectionMatrix;
|
||||
#else
|
||||
layout (std140) uniform MatrixesData
|
||||
{
|
||||
mat4 ViewMatrix;
|
||||
mat4 ProjectionMatrix;
|
||||
mat4 InverseViewMatrix;
|
||||
mat4 InverseProjectionMatrix;
|
||||
mat4 ShadowViewProjMatrixes[4];
|
||||
};
|
||||
#endif
|
||||
|
||||
uniform mat4 ModelMatrix;
|
||||
uniform mat4 InverseModelMatrix;
|
||||
|
||||
uniform mat4 TextureMatrix =
|
||||
mat4(1., 0., 0., 0.,
|
||||
0., 1., 0., 0.,
|
||||
0., 0., 1., 0.,
|
||||
0., 0., 0., 1.);
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
in vec3 Position;
|
||||
in vec2 Texcoord;
|
||||
in vec2 SecondTexcoord;
|
||||
in vec3 Normal;
|
||||
in vec4 Color;
|
||||
out vec3 nor;
|
||||
out vec2 uv;
|
||||
out vec2 uv_bis;
|
||||
out vec4 color;
|
||||
#else
|
||||
attribute vec3 Position;
|
||||
attribute vec3 Normal;
|
||||
attribute vec2 Texcoord;
|
||||
attribute vec2 SecondTexcoord;
|
||||
varying vec3 nor;
|
||||
varying vec2 uv;
|
||||
varying vec2 uv_bis;
|
||||
#endif
|
||||
|
||||
|
||||
void main(void)
|
||||
{
|
||||
color = Color.zyxw;
|
||||
mat4 ModelViewProjectionMatrix = ProjectionMatrix * ViewMatrix * ModelMatrix;
|
||||
mat4 TransposeInverseModelView = transpose(InverseModelMatrix * InverseViewMatrix);
|
||||
gl_Position = ModelViewProjectionMatrix * vec4(Position, 1.);
|
||||
nor = (TransposeInverseModelView * vec4(Normal, 0.)).xyz;
|
||||
uv = (TextureMatrix * vec4(Texcoord, 1., 1.)).xy;
|
||||
uv_bis = SecondTexcoord;
|
||||
}
|
||||
@@ -1,14 +1,19 @@
|
||||
#version 330
|
||||
noperspective in vec3 nor;
|
||||
out vec2 EncodedNormal;
|
||||
uniform sampler2D tex;
|
||||
|
||||
// from Crytek "a bit more deferred CryEngine"
|
||||
vec2 EncodeNormal(vec3 n)
|
||||
{
|
||||
return normalize(n.xy) * sqrt(n.z * 0.5 + 0.5);
|
||||
}
|
||||
#if __VERSION__ >= 130
|
||||
in vec3 nor;
|
||||
in vec2 uv;
|
||||
out vec3 EncodedNormal;
|
||||
#else
|
||||
varying vec3 nor;
|
||||
#define EncodedNormal gl_FragColor.xy
|
||||
#endif
|
||||
|
||||
vec2 EncodeNormal(vec3 n);
|
||||
|
||||
void main(void)
|
||||
{
|
||||
EncodedNormal = 0.5 * EncodeNormal(normalize(nor)) + 0.5;
|
||||
vec4 col = texture(tex, uv);
|
||||
EncodedNormal.xy = 0.5 * EncodeNormal(normalize(nor)) + 0.5;
|
||||
EncodedNormal.z = exp2(10. * (1. - col.a) + 1.);
|
||||
}
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
#version 330
|
||||
uniform mat4 ModelViewProjectionMatrix;
|
||||
uniform mat4 TransposeInverseModelView;
|
||||
|
||||
in vec3 Position;
|
||||
in vec3 Normal;
|
||||
noperspective out vec3 nor;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
gl_Position = ModelViewProjectionMatrix * vec4(Position, 1.);
|
||||
nor = (TransposeInverseModelView * vec4(Normal, 0.)).xyz;
|
||||
}
|
||||
@@ -1,22 +1,18 @@
|
||||
#version 330
|
||||
uniform sampler2D Albedo;
|
||||
uniform sampler2D DiffuseMap;
|
||||
uniform sampler2D SpecularMap;
|
||||
uniform sampler2D SSAO;
|
||||
uniform vec2 screen;
|
||||
uniform vec3 ambient;
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
in vec2 uv;
|
||||
out vec4 FragColor;
|
||||
#else
|
||||
varying vec2 uv;
|
||||
#define FragColor gl_FragColor
|
||||
#endif
|
||||
|
||||
vec3 getLightFactor(float specMapValue);
|
||||
|
||||
void main(void)
|
||||
{
|
||||
vec2 tc = gl_FragCoord.xy / screen;
|
||||
vec4 color = texture(Albedo, uv);
|
||||
vec3 DiffuseComponent = texture(DiffuseMap, tc).xyz;
|
||||
vec3 SpecularComponent = texture(SpecularMap, tc).xyz;
|
||||
float ao = texture(SSAO, tc).x;
|
||||
vec3 LightFactor = ao * ambient + DiffuseComponent + SpecularComponent * (1. - color.a);
|
||||
FragColor = vec4(color.xyz * LightFactor * (0.4 + ao*0.6), 1.);
|
||||
//FragColor = vec4(color.xyz * LightFactor, 1.);
|
||||
vec3 LightFactor = getLightFactor(1.);
|
||||
FragColor = vec4(color.xyz * LightFactor, 1.);
|
||||
}
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
#version 330
|
||||
uniform mat4 ModelViewProjectionMatrix;
|
||||
|
||||
in vec3 Position;
|
||||
in vec2 Texcoord;
|
||||
in vec2 SecondTexcoord;
|
||||
out vec2 uv;
|
||||
out vec2 uv_bis;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
uv = Texcoord;
|
||||
uv_bis = SecondTexcoord;
|
||||
gl_Position = ModelViewProjectionMatrix * vec4(Position, 1.);
|
||||
}
|
||||
@@ -1,7 +1,13 @@
|
||||
#version 330
|
||||
uniform sampler2D tex;
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
in vec2 uv;
|
||||
out vec4 FragColor;
|
||||
#else
|
||||
varying vec2 uv;
|
||||
#define FragColor gl_FragColor
|
||||
#endif
|
||||
|
||||
|
||||
void main(void)
|
||||
{
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
#version 330
|
||||
uniform sampler2D tex;
|
||||
uniform sampler2D lighttex;
|
||||
uniform int hastex;
|
||||
uniform int haslightmap;
|
||||
|
||||
noperspective in vec3 nor;
|
||||
in vec4 color;
|
||||
in vec2 uv0;
|
||||
in vec2 uv1;
|
||||
out vec4 Albedo;
|
||||
out vec4 NormalDepth;
|
||||
out vec4 Specular;
|
||||
|
||||
void main() {
|
||||
vec4 light = vec4(1.0);
|
||||
vec4 col;
|
||||
|
||||
if (haslightmap != 0) {
|
||||
light = texture(lighttex, uv1);
|
||||
}
|
||||
|
||||
if (hastex != 0)
|
||||
col = texture(tex, uv0) * light;
|
||||
else
|
||||
col = color;
|
||||
|
||||
Albedo = vec4(col.xyz, 1.);
|
||||
NormalDepth = vec4(0.5 * normalize(nor) + 0.5, gl_FragCoord.z);
|
||||
Specular = vec4(1. - col.a);
|
||||
}
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
#version 330
|
||||
uniform mat4 ModelViewProjectionMatrix;
|
||||
uniform mat4 TransposeInverseModelView;
|
||||
uniform mat4 TextureMatrix0;
|
||||
uniform mat4 TextureMatrix1;
|
||||
|
||||
noperspective out vec3 nor;
|
||||
out vec4 color;
|
||||
out vec2 uv0;
|
||||
out vec2 uv1;
|
||||
|
||||
void main() {
|
||||
|
||||
nor = (TransposeInverseModelView * vec4(gl_Normal, 1.)).xyz;
|
||||
uv0 = (gl_TextureMatrix[0] * gl_MultiTexCoord0).st;
|
||||
uv1 = (gl_TextureMatrix[1] * gl_MultiTexCoord1).st;
|
||||
gl_Position = ModelViewProjectionMatrix * gl_Vertex;
|
||||
color = gl_Color;
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
#version 330
|
||||
uniform sampler2D tex;
|
||||
uniform int hastex;
|
||||
uniform float objectid;
|
||||
|
||||
noperspective in vec3 nor;
|
||||
in vec2 uv0;
|
||||
in vec2 uv1;
|
||||
out vec4 Albedo;
|
||||
out vec4 NormalDepth;
|
||||
out vec4 Specular;
|
||||
|
||||
void main() {
|
||||
|
||||
//if (hastex != 0) {
|
||||
vec4 col = texture(tex, uv0);
|
||||
|
||||
if (col.a < 0.5)
|
||||
discard;
|
||||
|
||||
Albedo = vec4(col.xyz, 1.);
|
||||
//} else {
|
||||
// Albedo = gl_Color;
|
||||
//}
|
||||
|
||||
NormalDepth = vec4(0.5 * normalize(nor) + 0.5, gl_FragCoord.z);
|
||||
Specular = vec4(1. - col.a);
|
||||
}
|
||||
|
||||