Merged from master

This commit is contained in:
nixt 2014-01-23 03:17:32 +05:30
commit cc78233258
338 changed files with 12103 additions and 6856 deletions

33
.gitignore vendored Normal file
View File

@ -0,0 +1,33 @@
build/
build-32/
build-64/
build-win/
cmake_build/
dependencies/
.config/
supertuxkart-64
data/karts
data/library
data/music
data/sfx
data/textures
data/tracks
*.o
*.d
*.a
*.patch
*.diff
*.orig
*.rej
*.log
*.lib
*.dll
*.exe
*.vcxproj
*.vcxproj.filters
packets_log.txt
history.dat

View File

@ -1,5 +1,4 @@
SuperTuxkart 0.8.1 ##SuperTuxKart 0.8.1
~~~~~~~~~~~~~~~
* New track STK Enterprise * New track STK Enterprise
* Updated track The old mines * Updated track The old mines
* Updated Lighthouse track * Updated Lighthouse track
@ -20,8 +19,7 @@ SuperTuxkart 0.8.1
SuperTuxkart 0.8 ##SuperTuxKart 0.8
~~~~~~~~~~~~~~~
* Story mode and new challenge set * Story mode and new challenge set
* Improved AI * Improved AI
* Skidding and better collision physics * Skidding and better collision physics
@ -36,8 +34,7 @@ SuperTuxkart 0.8
* New music * New music
SuperTuxKart 0.7.3 ##SuperTuxKart 0.7.3
~~~~~~~~~~~~~~~~~~
* New Zen Garden and Subsea tracks * New Zen Garden and Subsea tracks
* New Island battle arena * New Island battle arena
* New Suzanne kart * New Suzanne kart
@ -53,8 +50,7 @@ SuperTuxKart 0.7.3
* Better placement of rescued karts * Better placement of rescued karts
* Transition track-making to blender 2.5/2.6 * Transition track-making to blender 2.5/2.6
SuperTuxKart 0.7.2 ##SuperTuxKart 0.7.2
~~~~~~~~~~~~~~~~~~
* Added in-game addon manager * Added in-game addon manager
* Fixed major memory leaks * Fixed major memory leaks
* New Snow Peak track by Samuncle * New Snow Peak track by Samuncle
@ -64,13 +60,11 @@ SuperTuxKart 0.7.2
* Improve gamepad configuration under Windows (add ability to tell gamepads apart) * Improve gamepad configuration under Windows (add ability to tell gamepads apart)
* Various other tweaks done and glitches fixed * Various other tweaks done and glitches fixed
SuperTuxkart 0.7.1b ##SuperTuxKart 0.7.1b
~~~~~~~~~~~~~~~~~~~
* Fix circular dependency in challenges * Fix circular dependency in challenges
* Updated translations * Updated translations
SuperTuxKart 0.7.1 ##SuperTuxKart 0.7.1
~~~~~~~~~~~~~~~~~~
* Particle (smoke, splash, fire) and weather effects * Particle (smoke, splash, fire) and weather effects
* New Fort Magma by Samuncle, new Shiny Suburbs track by Horace * New Fort Magma by Samuncle, new Shiny Suburbs track by Horace
* New Beagle kart by wolterh * New Beagle kart by wolterh
@ -89,9 +83,9 @@ SuperTuxKart 0.7.1
* Full RTL (right to left) support * Full RTL (right to left) support
* Various other tweaks done and glitches fixed * Various other tweaks done and glitches fixed
SuperTuxKart 0.7 (December 2010) ##SuperTuxKart 0.7 (December 2010)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Too many to list them all. Main points: Too many to list them all. Main points:
* Irrlicht: * Irrlicht:
- Ported from plib to irrlicht - Ported from plib to irrlicht
- Added animations to karts and some tracks - Added animations to karts and some tracks
@ -103,48 +97,34 @@ Too many to list them all. Main points:
* New art: * New art:
- New tracks farm, hacienda, scotland, secret garden - New tracks farm, hacienda, scotland, secret garden
SuperTuxKart 0.6.2a (October 2009) ##SuperTuxKart 0.6.2a (October 2009)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Bugfix: STK would crash while trying to save the config file * Bugfix: STK would crash while trying to save the config file
on Windows Vista. on Windows Vista.
SuperTuxKart 0.6.2 (July 2009) ##SuperTuxKart 0.6.2 (July 2009)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Bugfix: Game could crash in rare circumstances. * Bugfix: Game could crash in rare circumstances.
* Bugfix: Restarting a GP (with the in-race menu ESC) would * Bugfix: Restarting a GP (with the in-race menu ESC) would not subtract already allocated points.
not subtract already allocated points.
* Bugfix: A race could be finished with an invalid shortcut. * Bugfix: A race could be finished with an invalid shortcut.
* Bugfix: Playing a challenge after a splitscreen game would * Bugfix: Playing a challenge after a splitscreen game would play the challenge in split screen.
play the challenge in split screen.
* Bugfix: Items explode over void. * Bugfix: Items explode over void.
* Bugfix: Grass in castle arena slowed down the kart. * Bugfix: Grass in castle arena slowed down the kart.
* Bugfix: GP result showed kart identifier instead of name. * Bugfix: GP result showed kart identifier instead of name.
* Improvement: there is now 1 1 sec. wait period for the race * Improvement: there is now 1 1 sec. wait period for the race result screen, avoiding the problem that someone presses space/enter at the end of a race, immediately quitting the menu before it can be read.
result screen, avoiding the problem that someone
presses space/enter at the end of a race, immediately
quitting the menu before it can be read.
SuperTuxKart 0.6.1a (February 2009) ##SuperTuxKart 0.6.1a (February 2009)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Bugfix: battle mode would not display track groups. * Bugfix: battle mode would not display track groups.
SuperTuxKart 0.6.1 (February 2009) ##SuperTuxKart 0.6.1 (February 2009)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * Added new kart ("Puffy"), new battle map ("Cave"), and new music for Snow Mountain.
* Added new kart ("Puffy"), new battle map ("Cave"), and new music * Fixed bug in track selection screen that could cause a crash when track groups were used.
for Snow Mountain. * Fixed crash in character selection that could happen if an old user config file existed.
* Fixed bug in track selection screen that could cause a crash
when track groups were used.
* Fixed crash in character selection that could happen if an
old user config file existed.
* Fixed incorrect rescues in Fort Magma. * Fixed incorrect rescues in Fort Magma.
* Improved track selection screen to not display empty track * Improved track selection screen to not display empty track groups.
groups.
* A plunger in the face is now removed when restarting. * A plunger in the face is now removed when restarting.
* Added slow-down for karts driving backwards. * Added slow-down for karts driving backwards.
* Somewhat reduced 'shaking' of AI driven karts. * Somewhat reduced 'shaking' of AI driven karts.
SuperTuxKart 0.6 (January 2009) ##SuperTuxKart 0.6 (January 2009)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* New improved physics and kart handling * New improved physics and kart handling
* Added sharp turns and nitro speed boost (replacing wheelies and jump) * Added sharp turns and nitro speed boost (replacing wheelies and jump)
* Totally rewrote powerups (plunger, bowling ball, cake, bubblegum) and new look for bananas * Totally rewrote powerups (plunger, bowling ball, cake, bubblegum) and new look for bananas
@ -167,10 +147,8 @@ SuperTuxKart 0.6 (January 2009)
- Fixed 'joystick locks' (kart would turn even if the joystick is in neutral), - Fixed 'joystick locks' (kart would turn even if the joystick is in neutral),
thanks to Samjam for the patch. thanks to Samjam for the patch.
SuperTuxKart 0.5 (May 2008) ##SuperTuxKart 0.5 (May 2008)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * Six new tracks and one improved track: Fort Magma, SnowTux Peak, Amazonian Journey, City, Canyon, Crescent Crossing and StarTrack
* Six new tracks and one improved track: Fort Magma, SnowTux Peak, Amazonian Journey, City,
Canyon, Crescent Crossing and StarTrack
* Complete Challenges to unlock game modes, new tracks and a skidding preview * Complete Challenges to unlock game modes, new tracks and a skidding preview
* New Follow the Leader game mode * New Follow the Leader game mode
* New Grand Prix * New Grand Prix
@ -179,12 +157,11 @@ SuperTuxKart 0.5 (May 2008)
* German, French, Dutch, Spanish, Italian and Swedish translations * German, French, Dutch, Spanish, Italian and Swedish translations
* Additional music * Additional music
* Many Bugfixes including: * Many Bugfixes including:
a memory leak fix (Charlie Head) - a memory leak fix (Charlie Head)
an AI crash fix (Chris Morris) - an AI crash fix (Chris Morris)
SuperTuxKart 0.4 (February 2008) ##SuperTuxKart 0.4 (February 2008)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* New physics handling using the bullet physics engine * New physics handling using the bullet physics engine
* New kart: wilber * New kart: wilber
* Improved 'Shifting Sands' and 'Lighthouse' tracks * Improved 'Shifting Sands' and 'Lighthouse' tracks
@ -195,8 +172,7 @@ SuperTuxKart 0.4 (February 2008)
* Additional music and main theme * Additional music and main theme
SuperTuxKart 0.3 (May 2007) ##SuperTuxKart 0.3 (May 2007)
~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Highscore lists * Highscore lists
* Shortcut detection * Shortcut detection
* Improved AI * Improved AI
@ -226,8 +202,7 @@ SuperTuxKart 0.3 (May 2007)
- Fixed keyboard keys unable to work on the first key press bug - Fixed keyboard keys unable to work on the first key press bug
- And others - And others
SuperTuxKart 0.2 (22. Sep 2006) ##SuperTuxKart 0.2 (22. Sep 2006)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Significant performance improvement by using display lists * Significant performance improvement by using display lists
* Improved AI * Improved AI
* Support for different grand prixs * Support for different grand prixs
@ -245,83 +220,61 @@ SuperTuxKart 0.2 (22. Sep 2006)
* Added help and about screens, added credits to track designer * Added help and about screens, added credits to track designer
* Items were added to all tracks * Items were added to all tracks
SuperTuxKart 0.1 (04. May 2006) (not officially released) ##SuperTuxKart 0.1 (04. May 2006) (not officially released)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * Significant speedup by using a new HOT and collision algorithm --> all tracks are now playable
* Significant speedup by using a new HOT and collision algorithm
--> all tracks are now playable
* Removed all SDL dependencies, only plib is needed * Removed all SDL dependencies, only plib is needed
* Single and multi-window menu can be used * Single and multi-window menu can be used
* Code structure changes * Code structure changes
* Some bug fixes and small improvements * Some bug fixes and small improvements
* Added profile option to support automatic profiling * Added profile option to support automatic profiling
SuperTuxKart 0.0.0 (22. Dec 2004) ##SuperTuxKart 0.0.0 (22. Dec 2004)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* new tracks * new tracks
* new characters and karts * new characters and karts
* new user-interface * new user-interface
* some additional effects (skid-marks, smoke) * some additional effects (skid-marks, smoke)
TuxKart v0.4.0 (March 19th 2004) ##TuxKart v0.4.0 (March 19th 2004)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Changes for compatibility with PLIB 1.8.0 and later. * Changes for compatibility with PLIB 1.8.0 and later.
* Removed some features that were only there to support * Removed some features that were only there to support
truly ancient graphics cards like 3Dfx Voodoo-1/2. truly ancient graphics cards like 3Dfx Voodoo-1/2.
TuxKart v0.3.0 (??) ##TuxKart v0.3.0 (??)
~~~~~~~~~~~~~~~~~~~
* Converted to use the new PLIB/PW library and thus * Converted to use the new PLIB/PW library and thus
avoid the need to link to GLUT. avoid the need to link to GLUT.
TuxKart v0.2.0 (Sept 3rd 2002) ##TuxKart v0.2.0 (Sept 3rd 2002)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Changes for compatibility with PLIB 1.6.0 and later. * Changes for compatibility with PLIB 1.6.0 and later.
TuxKart v0.0.5 (??) ##TuxKart v0.0.5 (??)
~~~~~~~~~~~~~~~~~~~
* Changes for compatibility with PLIB 1.4.0 and later. * Changes for compatibility with PLIB 1.4.0 and later.
TuxKart v0.0.4 (??) ##TuxKart v0.0.4 (??)
~~~~~~~~~~~~~~~~~~~
* Changes to suit rassin-frassin-Windoze-junk. * Changes to suit rassin-frassin-Windoze-junk.
* Steady-cam camera - courtesy of cowtan@ysbl.york.ac.uk * Steady-cam camera - courtesy of cowtan@ysbl.york.ac.uk
* Changes for compatibility with PLIB 1.3.1 and later. * Changes for compatibility with PLIB 1.3.1 and later.
* Added new music courtesy of Matt Thomas. * Added new music courtesy of Matt Thomas.
TuxKart v0.0.3 (July 4th 2000) ##TuxKart v0.0.3 (July 4th 2000)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Fixed bug in Keyboard driver when no * Fixed bug in Keyboard driver when no
joystick driver is installed. joystick driver is installed.
* More CygWin fixes. * More CygWin fixes.
* Started new feature to allow you to be * Started new feature to allow you to be
rescued from lava, etc. rescued from lava, etc.
TuxKart v0.0.2 (July 2nd 2000) ##TuxKart v0.0.2 (July 2nd 2000)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Added ability to add new tracks without * Added ability to add new tracks without
recompiling. recompiling.
* Can now drive using keyboard only - no joystick * Can now drive using keyboard only - no joystick
required. required.
* Should compile and run under Windoze using CygWin. * Should compile and run under Windoze using CygWin.
TuxKart v0.0.1 (July 1st 2000) ##TuxKart v0.0.1 (July 1st 2000)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Fixed a couple of files missing in initial * Fixed a couple of files missing in initial
Distro. Distro.
TuxKart v0.0.0 (June 29th 2000) ##TuxKart v0.0.0 (June 29th 2000)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* First CVS release. * First CVS release.
TuxKart (unnumbered) (April 13th 2000) ##TuxKart (unnumbered) (April 13th 2000)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* First hack. * First hack.
# EOF #

View File

@ -1 +0,0 @@
See the ChangeLog file.

View File

@ -103,10 +103,6 @@ else()
include_directories(${OGGVORBIS_INCLUDE_DIRS}) include_directories(${OGGVORBIS_INCLUDE_DIRS})
endif() endif()
# CURL
find_package(CURL REQUIRED)
include_directories(${CURL_INCLUDE_DIRS})
# Fribidi # Fribidi
if(USE_FRIBIDI) if(USE_FRIBIDI)
find_package(Fribidi) find_package(Fribidi)
@ -149,17 +145,22 @@ if(WIN32)
# And shut up about unsafe stuff # And shut up about unsafe stuff
add_definitions(-D_CRT_SECURE_NO_WARNINGS) add_definitions(-D_CRT_SECURE_NO_WARNINGS)
# VS will automatically add NDEBUG for release mode, but only _DEBUG in debug mode.
# Since STK uses DEBUG, this is added for debug compilation only:
set_property(DIRECTORY PROPERTY COMPILE_DEFINITIONS_DEBUG DEBUG)
else()
# All non VS generators used create only a single compile mode, so
# compile flags can be simplye be added
if(CMAKE_BUILD_TYPE MATCHES Debug)
add_definitions(-DDEBUG)
else()
add_definitions(-DNDEBUG)
endif()
endif() endif()
# TODO: remove this switch # TODO: remove this switch
add_definitions(-DHAVE_OGGVORBIS) add_definitions(-DHAVE_OGGVORBIS)
if(CMAKE_BUILD_TYPE MATCHES Debug)
add_definitions(-DDEBUG)
else()
add_definitions(-DNDEBUG)
endif()
# Provides list of source and header files (STK_SOURCES and STK_HEADERS) # Provides list of source and header files (STK_SOURCES and STK_HEADERS)
include(sources.cmake) include(sources.cmake)
@ -219,6 +220,13 @@ else()
target_link_libraries(supertuxkart ${PTHREAD_LIBRARY}) target_link_libraries(supertuxkart ${PTHREAD_LIBRARY})
endif() endif()
# CURL
if(WIN32)
target_link_libraries(supertuxkart ${PROJECT_SOURCE_DIR}/dependencies/lib/libcurldll.a)
else()
find_package(CURL REQUIRED)
include_directories(${CURL_INCLUDE_DIRS})
endif()
# Common library dependencies # Common library dependencies
target_link_libraries(supertuxkart target_link_libraries(supertuxkart
@ -233,6 +241,7 @@ target_link_libraries(supertuxkart
${OPENAL_LIBRARY} ${OPENAL_LIBRARY}
${OPENGL_LIBRARIES}) ${OPENGL_LIBRARIES})
if(APPLE) if(APPLE)
# In theory it would be cleaner to let CMake detect the right dependencies. In practice, this means that if a OSX user has # In theory it would be cleaner to let CMake detect the right dependencies. In practice, this means that if a OSX user has
# unix-style installs of Vorbis/Ogg/OpenAL/etc. they will be picked up over our frameworks. This is blocking when I make releases : # unix-style installs of Vorbis/Ogg/OpenAL/etc. they will be picked up over our frameworks. This is blocking when I make releases :
@ -269,6 +278,10 @@ endif()
if(MSVC) if(MSVC)
target_link_libraries(supertuxkart iphlpapi.lib) 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>)
endif() endif()
# Optional tools # Optional tools

54
INSTALL
View File

@ -1,54 +0,0 @@
SUPERTUXKART INSTALLATION INSTRUCTIONS
======================================
General
-------
First, make sure that you have the following packages installed:
* OpenGL (or Mesa 3.0 or later)
* OpenAL (recommended: openal-soft-devel)
* Ogg (libogg-dev)
* Vorbis (libvorbis-dev)
* fribidi (fribidi-devel) - optional for right-to-left text
Unpack the files from the tarball like this:
tar xzf supertuxkart-*.tar.gz
cd supertuxkart-*
where '*' is the version of SuperTuxkart you downloaded - eg 0.8.0. Then:
* Build irrlicht (atm, this will be included in cmake soonish)
cd lib/irrlicht/source/Irrlicht
NDEBUG=1 make
* Compile SuperTuxKart:
mkdir cmake_build
cd cmake_build
cmake ..
make VERBOSE=1 -j2
To create a debug version of STK, use:
cmake .. -DCMAKE_BUILD_TYPE=Debug
To test the compilation, supertuxkart can be run from the build
directory by ./bin/supertuxkart
To install the file, as root execute:
make install
The default install location is /usr/local, i.e. the data files will
be written to /usr/local/share/games/supertuxkart, the executable
will be copied to /usr/local/bin. To change the default installation
location, specify CMAKE_INSTALL_PREFIX when running cmake, e.g.:
cmake .. -DCMAKE_INSTALL_PREFIX=/opt/stk
Building STK on OS X
--------------------
See http://supertuxkart.sourceforge.net/Building_and_packaging_on_OSX
Building STK on Windows
-----------------------
See http://supertuxkart.sourceforge.net/How_to_build_the_Windows_version

71
INSTALL.md Normal file
View File

@ -0,0 +1,71 @@
#SuperTuxKart Installation Instructions
Note : If you obtained this source code from github, you also need to download the game assets from sourceforge using SVN.
`svn checkout https://svn.code.sf.net/p/supertuxkart/code/stk-assets stk-assets`
Place the `stk-assets` folder next to the source root `stk-code` folder.
See <http://supertuxkart.sourceforge.net/Source_control> for more information
##Building STK on Linux
First, make sure that you have the following packages installed:
* OpenGL (mesa)
* OpenAL (recommended: openal-soft-devel)
* Ogg (libogg-dev)
* Vorbis (libvorbis-dev)
* libcurl (libcurl-devel)
* libbluetooth (bluez-devel)
Ubuntu command:
```
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
```
Unpack the files from the tarball like this:
```
tar xzf supertuxkart-*.tar.gz
cd supertuxkart-*
```
where `*` is the version of SuperTuxkart you downloaded - eg `0.8.0`. Then:
Compile SuperTuxKart:
```
mkdir cmake_build
cd cmake_build
cmake ..
make VERBOSE=1 -j2
```
To create a debug version of STK, use:
`cmake .. -DCMAKE_BUILD_TYPE=Debug`
To test the compilation, supertuxkart can be run from the build
directory by ./bin/supertuxkart
To install the file, as root execute:
`make install`
The default install location is `/usr/local`, i.e. the data files will
be written to `/usr/local/share/games/supertuxkart`, the executable
will be copied to `/usr/local/bin`. To change the default installation
location, specify `CMAKE_INSTALL_PREFIX` when running cmake, e.g.:
`cmake .. -DCMAKE_INSTALL_PREFIX=/opt/stk`
##Building STK on OS X
See <http://supertuxkart.sourceforge.net/Building_and_packaging_on_OSX>
##Building STK on Windows
See <http://supertuxkart.sourceforge.net/How_to_build_the_Windows_version>

View File

@ -1,37 +1,31 @@
SuperTuxKart #SuperTuxKart
============
SuperTuxKart is a free kart racing game. It is focusing on fun and SuperTuxKart is a free kart racing game. It is focusing on fun and
not on realistic kart physics. Instruction can be found on the not on realistic kart physics. Instruction can be found on the
in-game help page. in-game help page.
The SuperTuxKart homepage can be found at: The SuperTuxKart homepage can be found at: <http://supertuxkart.sourceforge.net>
http://supertuxkart.sourceforge.net The official SuperTuxKart forum is at <http://supertuxkart.sourceforge.net/forum>. If you need support,
The official SuperTuxKart forum is at. If you need support,
this would be the best place to start. this would be the best place to start.
http://supertuxkart.sourceforge.net/forum
Hope you enjoy the game. Hope you enjoy the game.
- The SuperTuxKart development team.
-- The SuperTuxKart development team.
HARDWARE REQUIREMENTS ##Hardware Requirements
===================== * You need a 3D graphics card. (NVIDIA GeForce 8xxx and higher, ATI Radeon HD 4xxx and higher or Intel HD 3000 and higher)
* You need a 3D graphics card that supports OpenGL or Mesa. * You should have a CPU that's running at 1GHz or better.
* You should have a CPU that's running at 450MHz or better. * You'll need at least 512 MB of free VRAM (video memory).
* You'll need at least 600 MB of free RAM. * Disk space: 400MB
* Ideally, you want a joystick with at least 6 buttons. * Ideally, you want a joystick with at least 6 buttons.
COMPILING SuperTuxkart ##Compiling SuperTuxKart
======================
WINDOWS ###Windows
-------
A project file for Visual Studio 9 (e.g. the free 2008 express 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 edition) is included in the sources in `src/ide/vc9`. A separate
dependency package is available on SuperTuxKart's sourceforge dependency package is available on SuperTuxKart's sourceforge
page, which includes all necessary libraries, header files, page, which includes all necessary libraries, header files,
and dlls to compile and run the source code. and dlls to compile and run the source code.
@ -39,36 +33,30 @@ and dlls to compile and run the source code.
While compilation with cygwin is not officially supported, While compilation with cygwin is not officially supported,
this has been done (check with the forum for details). this has been done (check with the forum for details).
MAC OSX ###Mac OS X
-------
The latest information about compilation on Mac are on our wiki: The latest information about compilation on Mac are on our wiki:
http://supertuxkart.sourceforge.net/Building_and_packaging_on_OSX <http://supertuxkart.sourceforge.net/Building_and_packaging_on_OSX>
The Xcode project file is in /src/ide/Xcode/, but it still The Xcode project file is in `/src/ide/Xcode/`, but it still
requires that all dependencies are installed as explained on the wiki. requires that all dependencies are installed as explained on the wiki.
UNIX ###UNIX
---- See `INSTALL` for details.
See INSTALL for details.
LICENSE ##License
=======
This software is released under the GNU General Public License (GPL) which This software is released under the GNU General Public License (GPL) which
can be found in the file 'LICENSE' in the same directory as this file. can be found in the file `LICENSE` in the same directory as this file.
Information about the licenses for artwork are contained in Information about the licenses for artwork are contained in
data/licenses. `data/licenses`.
3D COORDINATES ##3D coordinates
==============
A reminder for those looking at the code and 3d models: A reminder for those looking at the code and 3d models:
STK : X right, Y up, Z forwards STK : X right, Y up, Z forwards
Blender: X right, Y forwards, Z up Blender: X right, Y forwards, Z up
The exporters perform the needed transform, so in Blender you just work The exporters perform the needed transform, so in Blender you just work
with XY plane as ground, and things will appear fine in STK (using XZ with XY plane as ground, and things will appear fine in STK (using XZ
as ground in the code, obviously). as ground in the code, obviously).

View File

@ -1,43 +1,37 @@
##TODO
SuperTuxKart is looking for additional man power to make this SuperTuxKart is looking for additional man power to make this
one of the best free linux games out there :) We need (in one of the best free linux games out there :) We need (in
no particular order): no particular order):
1) Musicians/sound engineers 1. Musicians/sound engineers
- Create additional background soundtrack - Create additional background soundtrack
- Create sound effects - Create sound effects
2. Artists and track designer
2) Artists and track designer
- Create additional tracks - Create additional tracks
- Create additional art work for tracks, - Create additional art work for tracks,
background images background images
3. Developers
3) Developers
- See todo list below - it's rather long at the moment :) - See todo list below - it's rather long at the moment :)
4. Web master
4) Web master
- Extend the current web page, keep it up to date - Extend the current web page, keep it up to date
5. Tester
5) Tester
- For just about everything - For just about everything
- Esp. different platforms - Esp. different platforms
6. Package creators
6) Package creators
- Create packages for - Create packages for
- most common linux Distributors - most common Linux Distributors
- Windows - Windows
7. Writers
7) Writers
- Write documentation, ranging from man page, to - Write documentation, ranging from man page, to
a description for the web, to a design document, ... a description for the web, to a design document, ...
If you want to help the SuperTuxKart - Project, please If you want to help the SuperTuxKart - Project, please
contact us on the email list: contact us on the email list: [supertuxkart-devel@lists.sourceforge.net](mailto:supertuxkart-devel@lists.sourceforge.net)
supertuxkart-devel@lists.sourceforge.net
Thanks in advance! Thanks in advance!
The SuperTuxKart-Team
-- The SuperTuxKart-Team
For details, see For details, see <http://supertuxkart.sourceforge.net/Get_involved>
http://supertuxkart.sourceforge.net/Get_involved

Binary file not shown.

View File

@ -5,19 +5,19 @@
<spreading angle="3" /> <spreading angle="3" />
<velocity x="0.0" <velocity x="-0.005"
y="-0.01" y="-0.01"
z="0.0" /> z="-0.005" />
<material file="snowflake.png" clampu="Y" clampv="Y" /> <material file="snowflake.png" clampu="Y" clampv="Y" />
<!-- Amount of particles emitted per second --> <!-- Amount of particles emitted per second -->
<rate min="400" <rate min="1000"
max="500" /> max="1000" />
<!-- Minimal and maximal lifetime of a particle, in milliseconds. --> <!-- Minimal and maximal lifetime of a particle, in milliseconds. -->
<lifetime min="9000" <lifetime min="10000"
max="9000" /> max="10000" />
<!-- Size of the particles --> <!-- Size of the particles -->
<size min="0.40" <size min="0.40"

View File

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-16"?>
<stkgui>
<div x="1%" y="1%" width="98%" height="98%" layout="vertical-row" >
<header align="center" width="80%" text="Login" text_align="center"/>
<spacer height="15" width="10"/>
<tabs id="login_tabs" height="10%" max_height="110" x="2%" width="98%" align="center">
<icon-button id="tab_login" width="128" height="128" icon="gui/track_random.png"
I18N="Tab in login menu" text="Sign In"/>
<icon-button id="tab_guest_login" width="128" height="128" icon="gui/mode_ftl.png"
I18N="Tab in login menu" text="Sign In As Guest"/>
<icon-button id="tab_register" width="128" height="128" icon="gui/mode_ftl.png"
I18N="Tab in login menu" text="Register"/>
</tabs>
<box proportion="1" width="100%" layout="vertical-row">
<header id="title" width="96%" height="fit" text_align="center" word_wrap="true"
I18N="In the login dialog" text="Guest Sign in"/>
<spacer height="15" width="10"/>
<box proportion="4" width="90%" layout="vertical-row" align="center">
<div x="2%" y="2%" width="96%" height="80%" layout="vertical-row" id="outer_box" >
<label I18N="In the online multiplayer screen" proportion="4" word_wrap="true" text=
"Signing in as a guest allows you to participate in online races,
but it does not allow you to vote for addons,
or collect any achievements while being online."
align="center"/>
</div>
</box>
<spacer height="15" width="10"/>
<buttonbar id="options" width="90%" height="13%" align="bottom">
<icon-button id="sign_in" width="64" height="64" icon="gui/green_check.png"
I18N="Login dialog" text="Sign In" label_location="bottom"/>
<icon-button id="cancel" width="64" height="64" icon="gui/main_quit.png"
I18N="Login dialog" text="Close" label_location="bottom"/>
</buttonbar>
<spacer height="15" width="10"/>
</box>
</div>
<icon-button id="back" x="0" y="0" height="15%" icon="gui/back.png"/>
</stkgui>

View File

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-16"?>
<stkgui>
<div x="1%" y="1%" width="98%" height="98%" layout="vertical-row" >
<header align="center" width="80%" text="Login" text_align="center"/>
<spacer height="15" width="10"/>
<tabs id="login_tabs" height="10%" max_height="110" x="2%" width="98%" align="center">
<icon-button id="tab_login" width="128" height="128" icon="gui/track_random.png"
I18N="Tab in login menu" text="Sign In"/>
<icon-button id="tab_guest_login" width="128" height="128" icon="gui/mode_ftl.png"
I18N="Tab in login menu" text="Sign In As Guest"/>
<icon-button id="tab_register" width="128" height="128" icon="gui/mode_ftl.png"
I18N="Tab in login menu" text="Register"/>
</tabs>
<box proportion="1" width="100%" layout="vertical-row">
<header id="title" width="96%" height="fit" text_align="center" word_wrap="true"
I18N="In the login dialog" text="Sign in"/>
<spacer height="20" width="20"/>
<div width="80%" align="center" layout="vertical-row" height="fit" >
<div width="100%" height="fit" layout="horizontal-row" >
<label proportion="1" height="100%" text_align="left" I18N="In the login dialog" text="Username"/>
<textbox proportion="2" height="fit" id="username" I18N="In the login dialog"/>
</div>
<spacer height="20" width="20"/>
<div width="100%" height="fit" layout="horizontal-row" >
<label proportion="1" height="100%" text_align="left" I18N="In the login dialog" text="Password"/>
<textbox x="5" proportion="2" height="fit" id="password" I18N="In the login dialog"/>
</div>
<spacer height="20" width="20"/>
<div width="100%" height="fit" layout="horizontal-row" >
<label proportion="1" text_align="left" I18N="In the login dialog" text="Stay signed in"/>
<div proportion="2" height="100%" layout="horizontal-row">
<checkbox width="fit" height="fit" id="remember" I18N="In the login dialog"/>
</div>
</div>
</div>
<label id="info" proportion="1" width="90%" align="center" text_align="center"
word_wrap="true" text=""/>
<spacer height="20" width="20"/>
<buttonbar id="options" width="90%" height="13%" align="bottom">
<icon-button id="sign_in" width="64" height="64" icon="gui/green_check.png"
I18N="Login dialog" text="Sign In" label_location="bottom"/>
<icon-button id="recovery" width="64" height="64" icon="gui/main_help.png"
I18N="Login dialog" text="Recovery" label_location="bottom"/>
<icon-button id="cancel" width="64" height="64" icon="gui/main_quit.png"
I18N="Login dialog" text="Close" label_location="bottom"/>
</buttonbar>
</box>
</div>
<icon-button id="back" x="0" y="0" height="8%" icon="gui/back.png"/>
</stkgui>

View File

@ -1,59 +0,0 @@
<stkgui>
<div x="2%" y="5%" width="96%" height="90%" layout="vertical-row" >
<header id="title" width="96%" height="fit" text_align="center" word_wrap="true"
I18N="In the login dialog" text="Sign in"/>
<spacer height="25" width="50">
<label id="message" proportion="2" width="90%" align="center" text_align="left" word_wrap="true" text=""/>
<spacer height="40" width="50">
<div width="80%" align="center" layout="vertical-row" height="fit" >
<div width="100%" height="fit" layout="horizontal-row" >
<label proportion="1" height="100%" text_align="left" I18N="In the login dialog" text="Username"/>
<textbox proportion="2" height="fit" id="username" I18N="In the login dialog"/>
</div>
<spacer height="20" width="20">
<div width="100%" height="fit" layout="horizontal-row" >
<label proportion="1" height="100%" text_align="left" I18N="In the login dialog" text="Password"/>
<textbox x="5" proportion="2" height="fit" id="password" I18N="In the login dialog"/>
</div>
<spacer height="20" width="20">
<div width="100%" height="fit" layout="horizontal-row" >
<label proportion="1" text_align="left" I18N="In the login dialog" text="Stay signed in"/>
<div proportion="2" height="100%" layout="horizontal-row">
<checkbox width="fit" height="fit" id="remember" I18N="In the login dialog"/>
</div>
</div>
</div>
<spacer height="20" width="50">
<label id="info" proportion="1" width="90%" align="center" text_align="center" word_wrap="true" text=""/>
<spacer height="20" width="50">
<buttonbar id="options" width="90%" height="13%" align="center">
<icon-button id="sign_in" width="64" height="64" icon="gui/green_check.png"
I18N="Login dialog" text="Sign In" label_location="bottom"/>
<icon-button id="recovery" width="64" height="64" icon="gui/main_help.png"
I18N="Login dialog" text="Recovery" label_location="bottom"/>
<icon-button id="register" width="64" height="64" icon="gui/tutorial.png"
I18N="Login dialog" text="Register" label_location="bottom"/>
<icon-button id="as_guest" width="64" height="64" icon="gui/main_about.png"
I18N="Login dialog" text="As guest" label_location="bottom"/>
<icon-button id="cancel" width="64" height="64" icon="gui/main_quit.png"
I18N="Login dialog" text="Close" label_location="bottom"/>
</buttonbar>
</div>
</stkgui>

View File

@ -32,10 +32,6 @@
<spacer width="10" height="10" /> <spacer width="10" height="10" />
<buttonbar id="menu_bottomrow" x="0" y="0" width="12%" height="100%" align="center"> <buttonbar id="menu_bottomrow" x="0" y="0" width="12%" height="100%" align="center">
<icon-button id="sign_in" width="64" height="64" icon="gui/main_about.png" extend_label="50"
I18N="Online menu button" text="Sign In" label_location="hover"/>
<icon-button id="register" width="64" height="64" icon="gui/tutorial.png" extend_label="75"
I18N="Online menu button" text="Register" label_location="hover"/>
<icon-button id="profile" width="64" height="64" icon="gui/green_check.png" extend_label="50" <icon-button id="profile" width="64" height="64" icon="gui/green_check.png" extend_label="50"
I18N="Online menu button" text="Profile" label_location="hover"/> I18N="Online menu button" text="Profile" label_location="hover"/>
<icon-button id="sign_out" width="64" height="64" icon="gui/main_quit.png" extend_label="70" <icon-button id="sign_out" width="64" height="64" icon="gui/main_quit.png" extend_label="70"

View File

@ -1,61 +1,78 @@
<?xml version="1.0" encoding="UTF-16"?>
<stkgui> <stkgui>
<div x="2%" y="4%" width="96%" height="92%" layout="vertical-row" > <div x="1%" y="1%" width="98%" height="98%" layout="vertical-row" >
<header align="center" width="80%" text="Login" text_align="center"/>
<spacer height="15" width="10"/>
<tabs id="login_tabs" height="10%" max_height="110" x="2%" width="98%" align="center">
<icon-button id="tab_login" width="128" height="128" icon="gui/track_random.png"
I18N="Tab in login menu" text="Sign In"/>
<icon-button id="tab_guest_login" width="128" height="128" icon="gui/mode_ftl.png"
I18N="Tab in login menu" text="Sign In As Guest"/>
<icon-button id="tab_register" width="128" height="128" icon="gui/mode_ftl.png"
I18N="Tab in login menu" text="Register"/>
</tabs>
<box proportion="1" width="100%" layout="vertical-row">
<header id="title" width="96%" height="fit" text_align="center" word_wrap="true" <header id="title" width="96%" height="fit" text_align="center" word_wrap="true"
I18N="In the registration dialog' dialog" text="Registration"/> I18N="In the login dialog" text="Sign in"/>
<spacer height="40" width="20"/>
<spacer height="25" width="50">
<div width="80%" align="center" layout="vertical-row" height="fit"> <div width="80%" align="center" layout="vertical-row" height="fit">
<div width="100%" height="fit" layout="horizontal-row" > <div width="100%" height="fit" layout="horizontal-row" >
<label proportion="1" height="100%" text_align="left" I18N="In the registration dialog" text="Username"/> <label proportion="1" height="100%" text_align="left" I18N="In the registration dialog" text="Username"/>
<textbox proportion="2" height="fit" id="username" I18N="In the registration dialog"/> <textbox proportion="2" height="fit" id="username" I18N="In the registration dialog"/>
</div> </div>
<spacer height="20" width="20"> <spacer height="20" width="20"/>
<div width="100%" height="fit" layout="horizontal-row" > <div width="100%" height="fit" layout="horizontal-row" >
<label proportion="1" height="100%" text_align="left" I18N="In the registration dialog" text="Password"/> <label proportion="1" height="100%" text_align="left" I18N="In the registration dialog" text="Password"/>
<textbox proportion="2" height="fit" id="password" I18N="In the registration dialog"/> <textbox proportion="2" height="fit" id="password" I18N="In the registration dialog"/>
</div> </div>
<spacer height="20" width="20"> <spacer height="20" width="20"/>
<div width="100%" height="fit" layout="horizontal-row" > <div width="100%" height="fit" layout="horizontal-row" >
<label proportion="1" height="100%" text_align="left" I18N="In the registration dialog" text="Confirm"/> <label proportion="1" height="100%" text_align="left" I18N="In the registration dialog" text="Confirm"/>
<textbox proportion="2" height="fit" id="password_confirm" I18N="In the registration dialog"/> <textbox proportion="2" height="fit" id="password_confirm" I18N="In the registration dialog"/>
</div> </div>
<spacer height="20" width="20"> <spacer height="20" width="20"/>
<div width="100%" height="fit" layout="horizontal-row" > <div width="100%" height="fit" layout="horizontal-row" >
<label proportion="1" height="100%" text_align="left" I18N="In the registration dialog" text="Email"/> <label proportion="1" height="100%" text_align="left" I18N="In the registration dialog" text="Email"/>
<textbox proportion="2" height="fit" id="email" I18N="In the registration dialog"/> <textbox proportion="2" height="fit" id="email" I18N="In the registration dialog"/>
</div> </div>
<spacer height="20" width="20"> <spacer height="20" width="20"/>
<div width="100%" height="fit" layout="horizontal-row" > <div width="100%" height="fit" layout="horizontal-row" >
<label proportion="1" height="100%" text_align="left" I18N="In the registration dialog" text="Confirm"/> <label proportion="1" height="100%" text_align="left" I18N="In the registration dialog" text="Confirm"/>
<textbox proportion="2" height="fit" id="email_confirm" I18N="In the registration dialog"/> <textbox proportion="2" height="fit" id="email_confirm" I18N="In the registration dialog"/>
</div> </div>
</div> <spacer height="20" width="50"/>
<spacer height="20" width="50">
<label id="info" proportion="1" width="90%" align="center" text_align="center" word_wrap="true" <label id="info" proportion="1" width="90%" align="center" text_align="center" word_wrap="true"
I18N="In the registration dialog" text="You don't need to register if you have a STK Addons account!"/> I18N="In the registration dialog" text="You don't need to register if you have a STK Addons account!"/>
<spacer height="20" width="50"> <spacer height="20" width="50"/>
</div>
<spacer height="20" width="50"/>
<buttonbar id="options" width="25%" height="14%" align="center"> <buttonbar id="options" width="25%" height="14%" align="center">
<icon-button id="next" width="64" height="64" icon="gui/green_check.png" <icon-button id="next" width="64" height="64" icon="gui/green_check.png"
I18N="Registration dialog" text="Next" label_location="none"/> I18N="Registration dialog" text="Next" label_location="none"/>
<icon-button id="cancel" width="64" height="64" icon="gui/main_quit.png" <icon-button id="cancel" width="64" height="64" icon="gui/main_quit.png"
I18N="Registration dialog" text="Cancel" label_location="none"/> I18N="Registration dialog" text="Cancel" label_location="none"/>
</buttonbar> </buttonbar>
</box>
</div> </div>
<icon-button id="back" x="0" y="0" height="8%" icon="gui/back.png"/>
</stkgui> </stkgui>

View File

@ -1,23 +0,0 @@
<stkgui>
<div x="2%" y="4%" width="96%" height="92%" layout="vertical-row" >
<header id="title" width="96%" height="fit" text_align="center" word_wrap="true"
I18N="In the registration dialog' dialog" text="Registration Complete"/>
<spacer height="25" width="50">
<label id="info" proportion="1" width="90%" align="center" text_align="center" word_wrap="true" I18N="In the registration dialog"
text="You will receive an email with further instructions regarding account activation. Please be patient and be sure to check your spam folder."/>
<spacer height="20" width="50">
<buttonbar id="options" width="25%" height="14%" align="center">
<icon-button id="cancel" width="64" height="64" icon="gui/green_check.png"
I18N="Registration dialog" text="Close" label_location="none"/>
</buttonbar>
</div>
</stkgui>

View File

@ -14,7 +14,6 @@
<div align="center" width="fit" height="fit" layout="horizontal-row" > <div align="center" width="fit" height="fit" layout="horizontal-row" >
<label text_align="center" align="center" I18N="In the registration dialog" word_wrap="true" <label text_align="center" align="center" I18N="In the registration dialog" word_wrap="true"
text="I agree to the above terms and am 13 years or older. "/> text="I agree to the above terms and am 13 years or older. "/>
<checkbox id="accepted" I18N="In the registration dialog"/>
</div> </div>
<spacer height="20" width="50"> <spacer height="20" width="50">
@ -25,12 +24,10 @@
<spacer height="20" width="50"> <spacer height="20" width="50">
<buttonbar id="options" width="45%" height="14%" align="center"> <buttonbar id="options" width="45%" height="14%" align="center">
<icon-button id="previous" width="64" height="64" icon="gui/back.png" <icon-button id="accept" width="64" height="64" icon="gui/green_check.png"
I18N="Registration dialog" text="Previous" label_location="bottom"/> I18N="Registration dialog" text="Accept" label_location="bottom"/>
<icon-button id="next" width="64" height="64" icon="gui/green_check.png"
I18N="Registration dialog" text="Submit" label_location="bottom"/>
<icon-button id="cancel" width="64" height="64" icon="gui/main_quit.png" <icon-button id="cancel" width="64" height="64" icon="gui/main_quit.png"
I18N="Registration dialog" text="Cancel" label_location="bottom"/> I18N="Registration dialog" text="Cancel" label_location="bottom"/>
</buttonbar> </buttonbar>

View File

@ -8,34 +8,33 @@
<spacer height="25" width="25"/> <spacer height="25" width="25"/>
<div layout="horizontal-row" width="100%" height="50" align="center"> <div layout="horizontal-row" width="fit" height="35" align="left">
<bright proportion="1" height="100%" <bright proportion="1" height="100%"
I18N="In soccer setup menu" text="Number of goals to win" text_align="right" /> I18N="In soccer setup menu" text="Number of goals to win" text_align="left" />
<spacer width="50" height="25"/> <spacer width="50" height="25"/>
<spinner id="goalamount" proportion="1" height="100%" min_value="1" max_value="10" wrap_around="true"/> <spinner id="goalamount" width="200" height="90%" min_value="1" max_value="10"/>
</div> </div>
<div layout="horizontal-row" width="fit" height="35" align="left">
<div layout="horizontal-row" width="100%" height="50" align="center">
<bright proportion="1" height="100%" <bright proportion="1" height="100%"
I18N="In soccer setup menu" text="Maximum time(minutes)" text_align="right" /> I18N="In soccer setup menu" text="Maximum time (min.)" text_align="left" />
<spacer width="20" height="25"/> <spacer width="50" height ="25">
<spinner id="timeamount" width="200" height="90%" min_value="1" max_value="15"/>
</div>
<div layout="horizontal-row" width="fit" height="35" align="left">
<bright proportion="1" height="100%"
I18N="In soccer setup menu" text="Game type (Goals limit / Time limit)" text_align="left" />
<spacer width="50" height="25"/>
<checkbox id="time_enabled"/> <checkbox id="time_enabled"/>
<spacer width="20" height ="25">
<spinner id="timeamount" proportion="1" height="100%" min_value="1" max_value="45" wrap_around="true"/>
</div> </div>
<spacer height="40" width="25"/>
<spacer height="25" width="25"/>
<bright height="15" width="25" I18N="In soccer setup menu" text="Use left/right to choose your team" text_align="center" align="center" /> <bright height="15" width="25" I18N="In soccer setup menu" text="Use left/right to choose your team and press fire" text_align="center" align="center" />
<spacer height="25" width="25"/>
<div id="central_div" layout="horizontal-row" width="100%" proportion="1" align="center"> <div id="central_div" layout="horizontal-row" width="100%" proportion="1" align="center">
<roundedbox x="2%" y="5%" proportion="1" layout="horizontal-row" height="100%"> <roundedbox y="5%" width="100%" layout="horizontal-row" height="100%">
<!-- Content is added programmatically --> <!-- Content is added programmatically -->
</roundedbox> </roundedbox>
<header id="vs" text="VS"/> <!-- Layout is done programmatically --> <header id="vs" text="VS"/> <!-- Layout is done programmatically -->

View File

@ -1,13 +1,17 @@
#version 130
uniform sampler2D tex; uniform sampler2D tex;
uniform float low; uniform float low;
in vec2 uv;
out vec4 FragColor;
void main() void main()
{ {
vec3 weights = vec3(0.2126, 0.7152, 0.0722); // ITU-R BT. 709 vec3 weights = vec3(0.2126, 0.7152, 0.0722); // ITU-R BT. 709
vec3 col = texture2D(tex, gl_TexCoord[0].xy).xyz; vec3 col = texture(tex, uv).xyz;
float luma = dot(weights, col); float luma = dot(weights, col);
col *= smoothstep(low, 0.9, luma); col *= smoothstep(low, 0.9, luma);
gl_FragColor = vec4(col, 1.0); FragColor = vec4(col, 1.0);
} }

View File

@ -1,10 +1,14 @@
#version 130
uniform sampler2D tex; uniform sampler2D tex;
in vec2 uv;
out vec4 FragColor;
void main() void main()
{ {
vec4 col = texture2D(tex, gl_TexCoord[0].xy); vec4 col = texture(tex, uv);
col.xyz *= 10.0 * col.a; col.xyz *= 10.0 * col.a;
gl_FragColor = vec4(col.xyz, 1.0); FragColor = vec4(col.xyz, 1.);
} }

View File

@ -1,11 +1,14 @@
#version 130
uniform float power; uniform float power;
uniform sampler2D tex; uniform sampler2D tex;
out vec4 FragColor;
void main() void main()
{ {
vec4 col = texture2D(tex, gl_TexCoord[0].xy); vec4 col = texture(tex, gl_TexCoord[0].xy);
if (col.a < 0.5) if (col.a < 0.5)
discard; discard;
gl_FragColor = vec4(col.xyz, power); FragColor = vec4(col.xyz, power);
} }

View File

@ -14,13 +14,14 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#version 130
uniform sampler2D tex; uniform sampler2D tex;
uniform float transparency; uniform float transparency;
varying vec2 uv; in vec2 uv;
out vec4 FragColor;
void main() void main()
{ {
gl_FragColor = texture2D(tex, uv); FragColor = texture(tex, uv);
gl_FragColor.a *= transparency; FragColor.a *= transparency;
} }

View File

@ -17,17 +17,20 @@
// Creates a bubble (wave) effect by distorting the texture depending on time // Creates a bubble (wave) effect by distorting the texture depending on time
#version 130
uniform mat4 ModelViewProjectionMatrix;
uniform float time; uniform float time;
varying vec2 uv;
in vec3 Position;
in vec2 Texcoord;
out vec2 uv;
void main() void main()
{ {
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; gl_Position = ModelViewProjectionMatrix * vec4(Position, 1.);
gl_Position = ftransform();
float delta_x = cos(time*3.0) * sin( 4.0 * gl_TexCoord[0].st.s * 6.28318531 ); float delta_x = cos(time*3.0) * sin( 4.0 * Texcoord.x * 6.28318531 );
float delta_y = cos(time*2.0) * sin( 3.0 * gl_TexCoord[0].st.t * 6.28318531 ); float delta_y = cos(time*2.0) * sin( 3.0 * Texcoord.y * 6.28318531 );
uv = gl_TexCoord[0].st + vec2(0.02*delta_x, 0.02*delta_y); uv = Texcoord + vec2(0.02*delta_x, 0.02*delta_y);
} }

View File

@ -1,17 +1,20 @@
#version 130
uniform sampler2D tex; uniform sampler2D tex;
uniform sampler2D caustictex; uniform sampler2D caustictex;
uniform vec2 dir; uniform vec2 dir;
uniform vec2 dir2; uniform vec2 dir2;
out vec4 FragColor;
void main() void main()
{ {
vec2 tc = gl_TexCoord[0].xy; vec2 tc = gl_TexCoord[0].xy;
vec3 col = texture2D(tex, tc).xyz; vec3 col = texture(tex, tc).xyz;
float caustic = texture2D(caustictex, tc + dir).x; float caustic = texture(caustictex, tc + dir).x;
float caustic2 = texture2D(caustictex, (tc.yx + dir2 * vec2(-0.6, 0.3)) * vec2(0.6)).x; float caustic2 = texture(caustictex, (tc.yx + dir2 * vec2(-0.6, 0.3)) * vec2(0.6)).x;
col += caustic * caustic2 * 10.0; col += caustic * caustic2 * 10.0;
gl_FragColor = vec4(col, 1.0); FragColor = vec4(col, 1.0);
} }

View File

@ -1,9 +1,12 @@
#version 130
uniform sampler2D tex; uniform sampler2D tex;
uniform sampler2D oldtex; uniform sampler2D oldtex;
uniform vec2 pixel; uniform vec2 pixel;
uniform vec2 multi; uniform vec2 multi;
uniform int size; uniform int size;
out vec4 FragColor;
void main() void main()
{ {
float res = 0.0; float res = 0.0;
@ -13,13 +16,13 @@ void main()
for (int i = 0; i < size; i++) for (int i = 0; i < size; i++)
{ {
float col = texture2D(tex, tc).x; float col = texture(tex, tc).x;
res = max(col, res); res = max(col, res);
tc += pixel; tc += pixel;
} }
float old = texture2D(oldtex, gl_TexCoord[0].xy).x; float old = texture(oldtex, gl_TexCoord[0].xy).x;
gl_FragColor = vec4(mix(old, res, 0.7)); FragColor = vec4(mix(old, res, 0.7));
} }

View File

@ -1,14 +1,18 @@
#version 130
uniform sampler2D tex; uniform sampler2D tex;
uniform vec3 inlevel; uniform vec3 inlevel;
uniform vec2 outlevel; uniform vec2 outlevel;
in vec2 uv;
out vec4 FragColor;
void main() void main()
{ {
vec2 texc = gl_TexCoord[0].xy; vec2 texc = uv;
texc.y = 1.0 - texc.y; //texc.y = 1.0 - texc.y;
vec4 col = texture2D(tex, texc); vec4 col = texture(tex, texc);
//col = col / (1 - col); //col = col / (1 - col);
@ -22,5 +26,5 @@ void main()
col.rgb = (pow(((col.rgb * 255.0) - inBlack) / (inWhite - inBlack), col.rgb = (pow(((col.rgb * 255.0) - inBlack) / (inWhite - inBlack),
vec3(1.0 / inGamma)) * (outWhite - outBlack) + outBlack) / 255.0; vec3(1.0 / inGamma)) * (outWhite - outBlack) + outBlack) / 255.0;
gl_FragColor = vec4(col.rgb, 1.0); FragColor = vec4(col.rgb, 1.0);
} }

View File

@ -0,0 +1,9 @@
#version 130
uniform ivec4 color;
out vec4 FragColor;
void main()
{
FragColor = vec4(color) / 255.;
}

View File

@ -0,0 +1,11 @@
#version 130
uniform vec2 center;
uniform vec2 size;
in vec2 position;
void main()
{
gl_Position = vec4(position * size + center, 0., 1.);
}

View File

@ -1,6 +1,9 @@
#version 130
uniform vec3 col; uniform vec3 col;
out vec4 FragColor;
void main() void main()
{ {
gl_FragColor = vec4(col, 1.0); FragColor = vec4(col, 1.0);
} }

View File

@ -1,11 +1,14 @@
#version 130
uniform vec3 col; uniform vec3 col;
uniform sampler2D tex; uniform sampler2D tex;
out vec4 FragColor;
void main() void main()
{ {
float alpha = texture2D(tex, gl_TexCoord[0].xy).a; float alpha = texture(tex, gl_TexCoord[0].xy).a;
if (alpha < 0.5) if (alpha < 0.5)
discard; discard;
gl_FragColor = vec4(col, 1.0); FragColor = vec4(col, 1.0);
} }

View File

@ -0,0 +1,12 @@
#version 130
uniform sampler2D tex;
in vec2 uv;
in vec4 col;
out vec4 FragColor;
void main()
{
vec4 res = texture(tex, uv);
FragColor = vec4(res.xyz * col.xyz, res.a);
}

View File

@ -0,0 +1,18 @@
#version 130
uniform vec2 center;
uniform vec2 size;
uniform vec2 texcenter;
uniform vec2 texsize;
in vec2 position;
in vec2 texcoord;
in uvec4 color;
out vec2 uv;
out vec4 col;
void main()
{
col = vec4(color) / 255.;
uv = texcoord * texsize + texcenter;
gl_Position = vec4(position * size + center, 0., 1.);
}

View File

@ -1,40 +1,40 @@
#version 130
uniform sampler2D tex; uniform sampler2D tex;
uniform vec2 screen;
uniform vec2 dir; uniform vec2 dir;
uniform vec2 dir2; uniform vec2 dir2;
varying float camdist; in vec2 uv;
in vec2 uv_bis;
in float camdist;
out vec4 FragColor;
const float maxlen = 0.02;
void main() void main()
{ {
vec2 tc = gl_TexCoord[0].xy; float horiz = texture(tex, uv + dir).x;
float vert = texture(tex, (uv.yx + dir2) * vec2(0.9)).x;
vec4 col = vec4(0.0);
const float maxlen = 0.02;
float horiz = texture2D(tex, tc + dir).x;
float vert = texture2D(tex, (tc.yx + dir2) * vec2(0.9)).x;
vec2 offset = vec2(horiz, vert); vec2 offset = vec2(horiz, vert);
offset *= 2.0; offset *= 2.0;
offset -= 1.0; offset -= 1.0;
// Fade according to distance to cam // Fade according to distance to cam
float fade = 1.0 - smoothstep(1.0, 40.0, camdist); float fade = 1.0 - smoothstep(1.0, 100.0, camdist);
// Fade according to distance from the edges // Fade according to distance from the edges
vec2 edger = gl_TexCoord[1].xy;
const float mindist = 0.1; const float mindist = 0.1;
fade *= smoothstep(0.0, mindist, edger.x) * smoothstep(0.0, mindist, edger.y) * fade *= smoothstep(0.0, mindist, uv_bis.x) * smoothstep(0.0, mindist, uv_bis.y) *
(1.0 - smoothstep(1.0 - mindist, 1.0, edger.x)) * (1.0 - smoothstep(1.0 - mindist, 1.0, uv_bis.x)) *
(1.0 - smoothstep(1.0 - mindist, 1.0, edger.y)); (1.0 - smoothstep(1.0 - mindist, 1.0, uv_bis.y));
offset *= 50.0 * fade * maxlen; offset *= 50.0 * fade * maxlen;
vec4 col;
col.r = step(offset.x, 0.0) * -offset.x; col.r = step(offset.x, 0.0) * -offset.x;
col.g = step(0.0, offset.x) * offset.x; col.g = step(0.0, offset.x) * offset.x;
col.b = step(offset.y, 0.0) * -offset.y; col.b = step(offset.y, 0.0) * -offset.y;
col.a = step(0.0, offset.y) * offset.y; col.a = step(0.0, offset.y) * offset.y;
gl_FragColor = col; FragColor = col;
} }

View File

@ -1,9 +1,17 @@
varying float camdist; #version 130
uniform mat4 ModelViewProjectionMatrix;
uniform mat4 ModelViewMatrix;
in vec3 Position;
in vec2 Texcoord;
in vec2 SecondTexcoord;
out vec2 uv;
out vec2 uv_bis;
out float camdist;
void main() { void main() {
gl_Position = ftransform(); gl_Position = ModelViewProjectionMatrix * vec4(Position, 1.);
gl_TexCoord[0] = gl_MultiTexCoord0; uv = Texcoord;
gl_TexCoord[1] = gl_MultiTexCoord1; uv_bis = SecondTexcoord;
camdist = length(ModelViewMatrix * vec4(Position, 1.));
camdist = length((gl_ModelViewMatrix * gl_Vertex).xyz);
} }

View File

@ -1,6 +1,6 @@
#version 130
uniform mat4 ModelViewProjectionMatrix;
void main() { void main() {
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; gl_Position = (ModelViewProjectionMatrix * gl_Vertex).xyww;
gl_TexCoord[1] = gl_TextureMatrix[1] * gl_MultiTexCoord1;
gl_Position = (gl_ModelViewProjectionMatrix * gl_Vertex).xyww;
gl_FrontColor = gl_Color;
} }

View File

@ -1,10 +0,0 @@
uniform sampler2D tex;
void main()
{
vec2 texc = gl_TexCoord[0].xy;
texc.y = 1.0 - texc.y;
gl_FragColor = vec4(texture2D(tex, texc).rgb, 1.0);
}

View File

@ -0,0 +1,61 @@
#version 130
uniform mat4 ProjectionMatrix;
uniform mat4 ViewMatrix;
in vec2 quadcorner;
in vec2 texcoord;
in vec3 position;
in float lifetime;
in float size;
in vec3 rotationvec;
in float anglespeed;
out float lf;
out vec2 tc;
void main(void)
{
tc = texcoord;
lf = lifetime;
vec3 newposition = position;
// from http://jeux.developpez.com/faq/math
float angle = lf * anglespeed;
float sin_a = sin(angle / 2.);
float cos_a = cos(angle / 2.);
vec4 quaternion = normalize(vec4(rotationvec * sin_a, cos_a));
float xx = quaternion.x * quaternion.x;
float xy = quaternion.x * quaternion.y;
float xz = quaternion.x * quaternion.z;
float xw = quaternion.x * quaternion.w;
float yy = quaternion.y * quaternion.y;
float yz = quaternion.y * quaternion.z;
float yw = quaternion.y * quaternion.w;
float zz = quaternion.z * quaternion.z;
float zw = quaternion.z * quaternion.w;
vec4 col1 = vec4(
1. - 2. * ( yy + zz ),
2. * ( xy + zw ),
2. * ( xz - yw ),
0.);
vec4 col2 = vec4(
2. * ( xy - zw ),
1. - 2. * ( xx + zz ),
2. * ( yz + xw ),
0.);
vec4 col3 = vec4(
2. * ( xz + yw ),
2. * ( yz - xw ),
1. - 2. * ( xx + yy ),
0.);
vec4 col4 = vec4(0., 0., 0., 1.);
mat4 rotationMatrix = mat4(col1, col2, col3, col4);
vec3 newquadcorner = size * vec3(quadcorner, 0.);
newquadcorner = (rotationMatrix * vec4(newquadcorner, 0.)).xyz;
vec4 viewpos = ViewMatrix * vec4(newposition + newquadcorner, 1.0);
gl_Position = ProjectionMatrix * viewpos;
}

View File

@ -1,3 +1,4 @@
#version 130
uniform sampler2D tex; uniform sampler2D tex;
uniform float fogmax; uniform float fogmax;
@ -9,13 +10,12 @@ uniform vec3 col;
uniform vec3 campos; uniform vec3 campos;
uniform mat4 ipvmat; uniform mat4 ipvmat;
float decdepth(vec4 rgba) { in vec2 uv;
return dot(rgba, vec4(1.0, 1.0/255.0, 1.0/65025.0, 1.0/16581375.0)); out vec4 FragColor;
}
void main() void main()
{ {
float z = decdepth(vec4(texture2D(tex, gl_TexCoord[0].xy).xyz, 0.0)); float z = texture(tex, uv).a;
vec3 tmp = vec3(gl_TexCoord[0].xy, z); vec3 tmp = vec3(gl_TexCoord[0].xy, z);
tmp = tmp * 2.0 - 1.0; tmp = tmp * 2.0 - 1.0;
@ -30,5 +30,5 @@ void main()
fog = min(fog, fogmax); fog = min(fog, fogmax);
gl_FragColor = vec4(col, fog); FragColor = vec4(col, fog);
} }

View File

@ -1,19 +1,23 @@
#version 130
uniform sampler2D tex; uniform sampler2D tex;
uniform vec2 pixel; uniform vec2 pixel;
// Gaussian separated blur with radius 3. // Gaussian separated blur with radius 3.
in vec2 uv;
out vec4 FragColor;
void main() void main()
{ {
vec4 sum = vec4(0.0); vec4 sum = vec4(0.0);
float X = gl_TexCoord[0].x; float X = uv.x;
float Y = gl_TexCoord[0].y; float Y = uv.y;
sum += texture2D(tex, vec2(X - 3.0 * pixel.x, Y)) * 0.03125; sum += texture(tex, vec2(X - 3.0 * pixel.x, Y)) * 0.03125;
sum += texture2D(tex, vec2(X - 1.3333 * pixel.x, Y)) * 0.328125; sum += texture(tex, vec2(X - 1.3333 * pixel.x, Y)) * 0.328125;
sum += texture2D(tex, vec2(X, Y)) * 0.273438; sum += texture(tex, vec2(X, Y)) * 0.273438;
sum += texture2D(tex, vec2(X + 1.3333 * pixel.x, Y)) * 0.328125; sum += texture(tex, vec2(X + 1.3333 * pixel.x, Y)) * 0.328125;
sum += texture2D(tex, vec2(X + 3.0 * pixel.x, Y)) * 0.03125; sum += texture(tex, vec2(X + 3.0 * pixel.x, Y)) * 0.03125;
gl_FragColor = sum; FragColor = sum;
} }

View File

@ -1,19 +1,23 @@
#version 130
uniform sampler2D tex; uniform sampler2D tex;
uniform vec2 pixel; uniform vec2 pixel;
// Gaussian separated blur with radius 3. // Gaussian separated blur with radius 3.
in vec2 uv;
out vec4 FragColor;
void main() void main()
{ {
vec4 sum = vec4(0.0); vec4 sum = vec4(0.0);
float X = gl_TexCoord[0].x; float X = uv.x;
float Y = gl_TexCoord[0].y; float Y = uv.y;
sum += texture2D(tex, vec2(X, Y - 3.0 * pixel.y)) * 0.03125; sum += texture(tex, vec2(X, Y - 3.0 * pixel.y)) * 0.03125;
sum += texture2D(tex, vec2(X, Y - 1.3333 * pixel.y)) * 0.328125; sum += texture(tex, vec2(X, Y - 1.3333 * pixel.y)) * 0.328125;
sum += texture2D(tex, vec2(X, Y)) * 0.273438; sum += texture(tex, vec2(X, Y)) * 0.273438;
sum += texture2D(tex, vec2(X, Y + 1.3333 * pixel.y)) * 0.328125; sum += texture(tex, vec2(X, Y + 1.3333 * pixel.y)) * 0.328125;
sum += texture2D(tex, vec2(X, Y + 3.0 * pixel.y)) * 0.03125; sum += texture(tex, vec2(X, Y + 3.0 * pixel.y)) * 0.03125;
gl_FragColor = sum; FragColor = sum;
} }

View File

@ -1,21 +1,25 @@
#version 130
uniform sampler2D tex; uniform sampler2D tex;
uniform vec2 pixel; uniform vec2 pixel;
// Gaussian separated blur with radius 6. // Gaussian separated blur with radius 6.
in vec2 uv;
out vec4 FragColor;
void main() void main()
{ {
vec4 sum = vec4(0.0); vec4 sum = vec4(0.0);
float X = gl_TexCoord[0].x; float X = uv.x;
float Y = gl_TexCoord[0].y; float Y = uv.y;
sum += texture2D(tex, vec2(X - 5.13333 * pixel.x, Y)) * 0.00640869; sum += texture(tex, vec2(X - 5.13333 * pixel.x, Y)) * 0.00640869;
sum += texture2D(tex, vec2(X - 3.26667 * pixel.x, Y)) * 0.083313; sum += texture(tex, vec2(X - 3.26667 * pixel.x, Y)) * 0.083313;
sum += texture2D(tex, vec2(X - 1.4 * pixel.x, Y)) * 0.305481; sum += texture(tex, vec2(X - 1.4 * pixel.x, Y)) * 0.305481;
sum += texture2D(tex, vec2(X, Y)) * 0.209473; sum += texture(tex, vec2(X, Y)) * 0.209473;
sum += texture2D(tex, vec2(X + 1.4 * pixel.x, Y)) * 0.305481; sum += texture(tex, vec2(X + 1.4 * pixel.x, Y)) * 0.305481;
sum += texture2D(tex, vec2(X + 3.26667 * pixel.x, Y)) * 0.083313; sum += texture(tex, vec2(X + 3.26667 * pixel.x, Y)) * 0.083313;
sum += texture2D(tex, vec2(X + 5.13333 * pixel.x, Y)) * 0.00640869; sum += texture(tex, vec2(X + 5.13333 * pixel.x, Y)) * 0.00640869;
gl_FragColor = sum; FragColor = sum;
} }

View File

@ -1,21 +1,25 @@
#version 130
uniform sampler2D tex; uniform sampler2D tex;
uniform vec2 pixel; uniform vec2 pixel;
// Gaussian separated blur with radius 6. // Gaussian separated blur with radius 6.
in vec2 uv;
out vec4 FragColor;
void main() void main()
{ {
vec4 sum = vec4(0.0); vec4 sum = vec4(0.0);
float X = gl_TexCoord[0].x; float X = uv.x;
float Y = gl_TexCoord[0].y; float Y = uv.y;
sum += texture2D(tex, vec2(X, Y - 5.13333 * pixel.y)) * 0.00640869; sum += texture(tex, vec2(X, Y - 5.13333 * pixel.y)) * 0.00640869;
sum += texture2D(tex, vec2(X, Y - 3.26667 * pixel.y)) * 0.083313; sum += texture(tex, vec2(X, Y - 3.26667 * pixel.y)) * 0.083313;
sum += texture2D(tex, vec2(X, Y - 1.4 * pixel.y)) * 0.305481; sum += texture(tex, vec2(X, Y - 1.4 * pixel.y)) * 0.305481;
sum += texture2D(tex, vec2(X, Y)) * 0.209473; sum += texture(tex, vec2(X, Y)) * 0.209473;
sum += texture2D(tex, vec2(X, Y + 1.4 * pixel.y)) * 0.305481; sum += texture(tex, vec2(X, Y + 1.4 * pixel.y)) * 0.305481;
sum += texture2D(tex, vec2(X, Y + 3.26667 * pixel.y)) * 0.083313; sum += texture(tex, vec2(X, Y + 3.26667 * pixel.y)) * 0.083313;
sum += texture2D(tex, vec2(X, Y + 5.13333 * pixel.y)) * 0.00640869; sum += texture(tex, vec2(X, Y + 5.13333 * pixel.y)) * 0.00640869;
gl_FragColor = sum; FragColor = sum;
} }

View File

@ -1,17 +1,20 @@
#version 130
uniform sampler2D tex; uniform sampler2D tex;
uniform vec2 res;
in vec2 uv;
out vec4 FragColor;
void main() void main()
{ {
vec2 coords = gl_FragCoord.xy / res; vec2 coords = uv;
vec4 col = texture2D(tex, coords); vec4 col = texture(tex, coords);
float alpha = col.a; float alpha = col.a;
if (alpha < 0.04) discard; if (alpha < 0.04 || length(col.xyz) < 0.2) discard;
col *= vec4(vec3(4.0), 1.5); col *= vec4(vec3(4.0), 1.5);
col.a *= 0.6; col.a *= 0.6;
gl_FragColor = col; FragColor = col;
} }

View File

@ -1,9 +1,11 @@
#version 130
uniform sampler2D tex; uniform sampler2D tex;
uniform vec3 col; uniform vec3 col;
out vec4 FragColor;
void main() void main()
{ {
vec4 res = texture2D(tex, gl_TexCoord[0].xy); vec4 res = texture(tex, gl_TexCoord[0].xy);
// Keep the sun fully bright, but fade the sky // Keep the sun fully bright, but fade the sky
float mul = distance(res.xyz, col); float mul = distance(res.xyz, col);
@ -12,5 +14,5 @@ void main()
res = res * vec4(mul); res = res * vec4(mul);
gl_FragColor = res; FragColor = res;
} }

View File

@ -1,3 +1,4 @@
#version 130
uniform sampler2D tex; uniform sampler2D tex;
uniform vec2 sunpos; uniform vec2 sunpos;
@ -5,6 +6,8 @@ uniform vec2 sunpos;
const float decaystep = 0.88; const float decaystep = 0.88;
out vec4 FragColor;
void main() void main()
{ {
vec2 texc = gl_TexCoord[0].xy; vec2 texc = gl_TexCoord[0].xy;
@ -14,16 +17,16 @@ void main()
vec2 dist = tosun * 1.0/(float(SAMPLES) * 1.12); vec2 dist = tosun * 1.0/(float(SAMPLES) * 1.12);
vec3 col = texture2D(tex, texc).xyz; vec3 col = texture(tex, texc).xyz;
float decay = 1.0; float decay = 1.0;
for (int i = 0; i < SAMPLES; i++) { for (int i = 0; i < SAMPLES; i++) {
texc += dist; texc += dist;
vec3 here = texture2D(tex, texc).xyz; vec3 here = texture(tex, texc).xyz;
here *= decay; here *= decay;
col += here; col += here;
decay *= decaystep; decay *= decaystep;
} }
gl_FragColor = vec4(col, 1.0) * 0.8; FragColor = vec4(col, 1.0) * 0.8;
} }

View File

@ -1,30 +1,17 @@
#version 130 #version 130
uniform float far; uniform float far;
uniform float objectid; uniform float objectid;
uniform sampler2D tex; uniform sampler2D tex;
noperspective in vec3 nor; noperspective in vec3 nor;
in vec2 uv;
const float near = 1.0; out vec4 Albedo;
out vec4 NormalDepth;
vec4 encdepth(float v) { out vec4 Specular;
vec4 enc = vec4(1.0, 255.0, 65025.0, 16581375.0) * v;
enc = fract(enc);
enc -= enc.yzww * vec4(1.0/255.0, 1.0/255.0, 1.0/255.0, 0.0);
return enc;
}
void main() void main()
{ {
vec4 color = texture2D(tex, gl_TexCoord[0].st); Albedo = texture(tex, uv);
NormalDepth = vec4(0.5 * normalize(nor) + 0.5, gl_FragCoord.z);
float linear_z = (2.0 * near) / (far + near - gl_FragCoord.z * (far - near)); Specular = vec4(0.);
// Tune for better inside range without losing outdoors
linear_z *= 2.0;
gl_FragData[0] = color;
gl_FragData[1] = vec4(0.5 * normalize(nor) + 0.5, linear_z);
gl_FragData[2] = vec4(encdepth(gl_FragCoord.z).xyz, objectid);
} }

View File

@ -1,15 +1,18 @@
#version 130 #version 130
uniform vec3 windDir; uniform vec3 windDir;
uniform mat4 ModelViewProjectionMatrix;
uniform mat4 TransposeInverseModelView;
noperspective out vec3 nor; noperspective out vec3 nor;
out vec2 uv;
void main() void main()
{ {
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; uv = gl_MultiTexCoord0.st;
vec4 vertexPosition = gl_Vertex; vec4 vertexPosition = gl_Vertex;
vertexPosition.xyz += windDir * gl_Color.r; vertexPosition.xyz += windDir * gl_Color.r;
nor = gl_NormalMatrix * gl_Normal; nor = (TransposeInverseModelView * vec4(gl_Normal, 1.)).xyz;
gl_Position = gl_ModelViewProjectionMatrix * vertexPosition; gl_Position = ModelViewProjectionMatrix * vertexPosition;
} }

View File

@ -0,0 +1,18 @@
#version 130
uniform vec3 windDir;
uniform mat4 ModelViewProjectionMatrix;
uniform mat4 TransposeInverseModelView;
in vec3 Position;
in vec3 Normal;
in vec2 Texcoord;
in vec4 Color;
noperspective out vec3 nor;
out vec2 uv;
void main()
{
uv = Texcoord;
nor = (TransposeInverseModelView * vec4(Normal, 1.)).xyz;
gl_Position = ModelViewProjectionMatrix * vec4(Position + windDir * Color.r, 1.);
}

View File

@ -0,0 +1,14 @@
#version 130
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.);
}

View File

@ -19,20 +19,21 @@
// Jean-manuel clemencon (c) supertuxkart 2013 // Jean-manuel clemencon (c) supertuxkart 2013
// bubble gum shield // bubble gum shield
// TODO: Add a nice texture and soft edges when intersect with geometry // TODO: Add a nice texture and soft edges when intersect with geometry
#version 130
uniform sampler2D tex; uniform sampler2D tex;
uniform float transparency; uniform float transparency;
varying vec2 uv; in vec2 uv;
varying vec3 eyeVec; noperspective in vec3 eyeVec;
varying vec3 normal; noperspective in vec3 normal;
out vec4 FragColor;
void main() void main()
{ {
float inter = dot(normal, eyeVec); float inter = dot(normal, eyeVec);
float m = texture2D(tex, vec2(0.5, uv.y)).r; float m = texture(tex, vec2(0.5, uv.y)).r;
inter = 1.0 - inter; inter = 1.0 - inter;
float alpha = inter + 1.0;// * m; float alpha = inter + 1.0;// * m;
gl_FragColor = vec4(0.8, 0.16, 0.48, alpha); FragColor = vec4(0.8, 0.16, 0.48, alpha);
} }

View File

@ -22,20 +22,22 @@
// TODO: The texture should reflect the strength of the shield, // TODO: The texture should reflect the strength of the shield,
// such that the user gets to know whether the shield has several // such that the user gets to know whether the shield has several
// "layers" or whether the shield is about to break. // "layers" or whether the shield is about to break.
#version 130
varying vec2 uv; uniform mat4 ModelViewMatrix;
varying vec3 eyeVec; uniform mat4 ProjectionMatrix;
varying vec3 normal; uniform mat4 TransposeInverseModelView;
out vec2 uv;
noperspective out vec3 eyeVec;
noperspective out vec3 normal;
void main() void main()
{ {
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; vec4 viewp = ModelViewMatrix * gl_Vertex;
vec4 viewp = gl_ModelViewMatrix * gl_Vertex;
eyeVec = normalize(-viewp).xyz; eyeVec = normalize(-viewp).xyz;
normal = gl_NormalMatrix * gl_Normal; normal = (TransposeInverseModelView * vec4(gl_Normal, 1.).xyz;
gl_Position = ftransform(); gl_Position = ProjectionMatrix * viewp;
uv = gl_TexCoord[0].st; uv = (gl_TextureMatrix[0] * gl_MultiTexCoord0).st;
} }

View File

@ -21,19 +21,20 @@
// Original idea: http://udn.epicgames.com/Three/VolumetricLightbeamTutorial.html // Original idea: http://udn.epicgames.com/Three/VolumetricLightbeamTutorial.html
// TODO: Soft edges when it intesects geometry // TODO: Soft edges when it intesects geometry
// Some artefacts are still visible // Some artefacts are still visible
#version 130
uniform sampler2D tex; uniform sampler2D tex;
uniform float transparency; uniform float transparency;
varying vec2 uv; in vec2 uv;
varying vec3 eyeVec; noperspective in vec3 eyeVec;
varying vec3 normal; noperspective in vec3 normal;
out vec4 FragColor;
void main() void main()
{ {
float inter = dot(normal, eyeVec); float inter = dot(normal, eyeVec);
float m = texture2D(tex, vec2(0.5, uv.y)).r; float m = texture(tex, vec2(0.5, uv.y)).r;
float alpha = inter * inter * inter * inter * m; float alpha = inter * inter * inter * inter * m;
gl_FragColor = vec4(1.0, 1.0, 0.8, alpha); FragColor = vec4(1.0, 1.0, 0.8, alpha);
} }

View File

@ -18,20 +18,22 @@
// Jean-manuel clemencon (C) Copyright supertuxkart // Jean-manuel clemencon (C) Copyright supertuxkart
// Creates a cone lightbeam effect by smoothing edges // Creates a cone lightbeam effect by smoothing edges
#version 130
varying vec2 uv; uniform mat4 ModelViewMatrix;
varying vec3 eyeVec; uniform mat4 ProjectionMatrix;
varying vec3 normal; uniform mat4 TransposeInverseModelView;
out vec2 uv;
noperspective out vec3 eyeVec;
noperspective out vec3 normal;
void main() void main()
{ {
gl_TexCoord[0] = gl_MultiTexCoord0; vec4 viewp = ModelViewMatrix * gl_Vertex;
vec4 viewp = gl_ModelViewMatrix * gl_Vertex;
eyeVec = normalize(-viewp).xyz; eyeVec = normalize(-viewp).xyz;
normal = gl_NormalMatrix * gl_Normal; normal = (TransposeInverseModelView * vec4(gl_Normal, 1.).xyz;
gl_Position = ftransform(); gl_Position = ProjectionMatrix * viewp;
uv = gl_TexCoord[0].st; uv = gl_MultiTexCoord0.st;
} }

View File

@ -1,19 +1,21 @@
uniform sampler2D tex; #version 130
uniform sampler2D diffuse;
uniform sampler2D specular;
uniform sampler2D ambient_occlusion;
uniform sampler2D specular_map;
uniform vec3 ambient; uniform vec3 ambient;
uniform sampler2D spectex;
in vec2 uv;
out vec4 FragColor;
void main() void main()
{ {
vec2 texc = gl_TexCoord[0].xy; vec2 texc = uv;
vec4 col = texture2D(tex, texc); vec3 diffuse = texture(diffuse, texc).xyz;
vec4 specular = texture2D(spectex, texc); vec3 spec = texture(specular, texc).xyz;
float specmap = texture(specular_map, texc).x;
float ao = texture(ambient_occlusion, texc).x;
col.xyz += ambient; FragColor = vec4(diffuse + spec * specmap + ao * ambient, 1.0);
float spec = col.a - 0.05;
spec *= specular.a;
col.xyz += spec;
col.a = 1.0;
gl_FragColor = col;
} }

View File

@ -0,0 +1,38 @@
#version 130
uniform sampler2D diffuse;
uniform sampler2D specular;
uniform sampler2D ambient_occlusion;
uniform sampler2D specular_map;
uniform vec3 ambient;
<<<<<<< HEAD
uniform sampler2D spectex;
void main()
{
vec2 texc = gl_TexCoord[0].xy;
vec4 col = texture2D(tex, texc);
vec4 specular = texture2D(spectex, texc);
col.xyz += ambient;
float spec = col.a - 0.05;
spec *= specular.a;
col.xyz += spec;
col.a = 1.0;
=======
in vec2 uv;
out vec4 FragColor;
void main()
{
vec2 texc = uv;
vec3 diffuse = texture(diffuse, texc).xyz;
vec3 spec = texture(specular, texc).xyz;
float specmap = texture(specular_map, texc).x;
float ao = texture(ambient_occlusion, texc).x;
>>>>>>> master
FragColor = vec4(diffuse + spec * specmap + ao * ambient, 1.0);
}

View File

@ -0,0 +1,38 @@
#version 130
uniform sampler2D diffuse;
uniform sampler2D specular;
uniform sampler2D ambient_occlusion;
uniform sampler2D specular_map;
uniform vec3 ambient;
<<<<<<< HEAD
uniform sampler2D spectex;
void main()
{
vec2 texc = gl_TexCoord[0].xy;
vec4 col = texture2D(tex, texc);
vec4 specular = texture2D(spectex, texc);
col.xyz += ambient;
float spec = col.a - 0.05;
spec *= specular.a;
col.xyz += spec;
col.a = 1.0;
=======
in vec2 uv;
out vec4 FragColor;
void main()
{
vec2 texc = uv;
vec3 diffuse = texture(diffuse, texc).xyz;
vec3 spec = texture(specular, texc).xyz;
float specmap = texture(specular_map, texc).x;
float ao = texture(ambient_occlusion, texc).x;
>>>>>>> master
FragColor = vec4(diffuse + spec * specmap + ao * ambient, 1.0);
}

View File

@ -0,0 +1,19 @@
uniform sampler2D tex;
uniform vec3 ambient;
//uniform sampler2D spectex;
void main()
{
vec2 texc = gl_TexCoord[0].xy;
vec4 col = texture2D(tex, texc);
//vec4 specular = texture2D(spectex, texc);
col.xyz += ambient;
float spec = col.a - 0.05;
//spec *= specular.a;
col.xyz += spec * col.xyz;
col.a = 1.0;
gl_FragColor = col;
}

View File

@ -0,0 +1,19 @@
uniform sampler2D tex;
uniform vec3 ambient;
//uniform sampler2D spectex;
void main()
{
vec2 texc = gl_TexCoord[0].xy;
vec4 col = texture2D(tex, texc);
//vec4 specular = texture2D(spectex, texc);
col.xyz += ambient;
float spec = col.a - 0.05;
//spec *= specular.a;
col.xyz += spec * col.xyz;
col.a = 1.0;
gl_FragColor = col;
}

View File

@ -0,0 +1,19 @@
uniform sampler2D tex;
uniform vec3 ambient;
uniform sampler2D spectex;
void main()
{
vec2 texc = gl_TexCoord[0].xy;
vec4 col = texture2D(tex, texc);
vec4 specular = texture2D(spectex, texc);
col.xyz += ambient;
float spec = col.a - 0.05;
spec *= specular.a;
col.xyz += spec;
col.a = 1.0;
gl_FragColor = col;
}

View File

@ -0,0 +1,19 @@
uniform sampler2D tex;
uniform vec3 ambient;
uniform sampler2D spectex;
void main()
{
vec2 texc = gl_TexCoord[0].xy;
vec4 col = texture2D(tex, texc);
vec4 specular = texture2D(spectex, texc);
col.xyz += ambient;
float spec = col.a - 0.05;
spec *= specular.a;
col.xyz += spec;
col.a = 1.0;
gl_FragColor = col;
}

View File

@ -0,0 +1,21 @@
#version 130
uniform sampler2D diffuse;
uniform sampler2D specular;
uniform sampler2D ambient_occlusion;
uniform sampler2D specular_map;
uniform vec3 ambient;
in vec2 uv;
out vec4 FragColor;
void main()
{
vec2 texc = uv;
vec3 diffuse = texture(diffuse, texc).xyz;
vec3 spec = texture(specular, texc).xyz;
float specmap = texture(specular_map, texc).x;
float ao = texture(ambient_occlusion, texc).x;
FragColor = vec4(diffuse + spec * specmap + ao * ambient, 1.0);
}

View File

@ -0,0 +1,21 @@
#version 130
uniform sampler2D diffuse;
uniform sampler2D specular;
uniform sampler2D ambient_occlusion;
uniform sampler2D specular_map;
uniform vec3 ambient;
in vec2 uv;
out vec4 FragColor;
void main()
{
vec2 texc = uv;
vec3 diffuse = texture(diffuse, texc).xyz;
vec3 spec = texture(specular, texc).xyz;
float specmap = texture(specular_map, texc).x;
float ao = texture(ambient_occlusion, texc).x;
FragColor = vec4(diffuse + spec * specmap + ao * ambient, 1.0);
}

View File

@ -1,8 +1,9 @@
#version 120 #version 130
uniform sampler2D tex; uniform sampler2D tex;
uniform vec2 texsize; uniform vec2 texsize;
uniform int notex; uniform int notex;
out vec4 FragColor;
float miplevel(in vec2 texture_coordinate) float miplevel(in vec2 texture_coordinate)
{ {
@ -19,7 +20,7 @@ float miplevel(in vec2 texture_coordinate)
void main() { void main() {
if (notex != 0) { if (notex != 0) {
gl_FragColor = gl_Color; FragColor = gl_Color;
return; return;
} }
@ -44,9 +45,9 @@ void main() {
float mixer = fract(mip); float mixer = fract(mip);
vec4 mixcol = mix(levels[lowmip], levels[highmip], mixer); vec4 mixcol = mix(levels[lowmip], levels[highmip], mixer);
vec4 tcol = texture2D(tex, gl_TexCoord[0].xy); vec4 tcol = texture(tex, gl_TexCoord[0].xy);
vec3 col = mix(tcol.xyz, mixcol.xyz, mixcol.a); vec3 col = mix(tcol.xyz, mixcol.xyz, mixcol.a);
gl_FragColor = vec4(col, tcol.a); FragColor = vec4(col, tcol.a);
} }

View File

@ -1,3 +1,4 @@
#version 130
#define MAX_SEARCH_STEPS 8.0 #define MAX_SEARCH_STEPS 8.0
#define MAX_DISTANCE 33.0 #define MAX_DISTANCE 33.0
@ -8,6 +9,8 @@ uniform sampler2D areaMap;
uniform vec2 PIXEL_SIZE; uniform vec2 PIXEL_SIZE;
out vec4 FragColor;
/** /**
* This one just returns the first level of a mip map chain, which allow us to * This one just returns the first level of a mip map chain, which allow us to
* avoid the nasty ddx/ddy warnings, even improving the performance a little * avoid the nasty ddx/ddy warnings, even improving the performance a little
@ -76,7 +79,7 @@ vec2 Area(vec2 distance, float e1, float e2) {
void main() { void main() {
vec4 areas = vec4(0.0); vec4 areas = vec4(0.0);
vec2 e = texture2D(edgesMap, gl_TexCoord[0].xy).rg; vec2 e = texture(edgesMap, gl_TexCoord[0].xy).rg;
if (e.g != 0.0) { // Edge at north if (e.g != 0.0) { // Edge at north
@ -108,5 +111,5 @@ void main() {
areas.ba = Area(abs(d), e1, e2); areas.ba = Area(abs(d), e1, e2);
} }
gl_FragColor = areas; FragColor = areas;
} }

View File

@ -1,19 +1,23 @@
varying vec4 offset[2]; #version 130
in vec4 offset[2];
in vec2 uv;
uniform sampler2D colorMapG; uniform sampler2D colorMapG;
const float threshold = 0.1; const float threshold = 0.1;
out vec4 FragColor;
void main() { void main() {
vec3 weights = vec3(0.2126,0.7152, 0.0722); // ITU-R BT. 709 vec3 weights = vec3(0.2126,0.7152, 0.0722); // ITU-R BT. 709
/** /**
* Luma calculation requires gamma-corrected colors: * Luma calculation requires gamma-corrected colors:
*/ */
float L = dot(texture2D(colorMapG, gl_TexCoord[0].xy).rgb, weights); float L = dot(texture(colorMapG, uv).rgb, weights);
float Lleft = dot(texture2D(colorMapG, offset[0].xy).rgb, weights); float Lleft = dot(texture(colorMapG, offset[0].xy).rgb, weights);
float Ltop = dot(texture2D(colorMapG, offset[0].zw).rgb, weights); float Ltop = dot(texture(colorMapG, offset[0].zw).rgb, weights);
float Lright = dot(texture2D(colorMapG, offset[1].xy).rgb, weights); float Lright = dot(texture(colorMapG, offset[1].xy).rgb, weights);
float Lbottom = dot(texture2D(colorMapG, offset[1].zw).rgb, weights); float Lbottom = dot(texture(colorMapG, offset[1].zw).rgb, weights);
vec4 delta = abs(vec4(L) - vec4(Lleft, Ltop, Lright, Lbottom)); vec4 delta = abs(vec4(L) - vec4(Lleft, Ltop, Lright, Lbottom));
vec4 edges = step(vec4(threshold), delta); vec4 edges = step(vec4(threshold), delta);
@ -21,5 +25,5 @@ void main() {
if (dot(edges, vec4(1.0)) == 0.0) if (dot(edges, vec4(1.0)) == 0.0)
discard; discard;
gl_FragColor = edges; FragColor = edges;
} }

View File

@ -1,13 +1,16 @@
varying vec4 offset[2]; #version 130
in vec4 offset[2];
in vec2 uv;
out vec4 FragColor;
uniform sampler2D blendMap; uniform sampler2D blendMap;
uniform sampler2D colorMap; uniform sampler2D colorMap;
void main() { void main() {
// Fetch the blending weights for current pixel: // Fetch the blending weights for current pixel:
vec4 topLeft = texture2D(blendMap, gl_TexCoord[0].xy); vec4 topLeft = texture(blendMap, uv);
float bottom = texture2D(blendMap, offset[1].zw).g; float bottom = texture(blendMap, offset[1].zw).g;
float right = texture2D(blendMap, offset[1].xy).a; float right = texture(blendMap, offset[1].xy).a;
vec4 a = vec4(topLeft.r, bottom, topLeft.b, right); vec4 a = vec4(topLeft.r, bottom, topLeft.b, right);
// Up to 4 lines can be crossing a pixel (one in each edge). So, we perform // Up to 4 lines can be crossing a pixel (one in each edge). So, we perform
@ -23,16 +26,16 @@ void main() {
vec4 color = vec4(0.0); vec4 color = vec4(0.0);
// Add the contributions of the possible 4 lines that can cross this pixel: // Add the contributions of the possible 4 lines that can cross this pixel:
vec4 C = texture2D(colorMap, gl_TexCoord[0].xy); vec4 C = texture(colorMap, uv);
vec4 Cleft = texture2D(colorMap, offset[0].xy); vec4 Cleft = texture(colorMap, offset[0].xy);
vec4 Ctop = texture2D(colorMap, offset[0].zw); vec4 Ctop = texture(colorMap, offset[0].zw);
vec4 Cright = texture2D(colorMap, offset[1].xy); vec4 Cright = texture(colorMap, offset[1].xy);
vec4 Cbottom = texture2D(colorMap, offset[1].zw); vec4 Cbottom = texture(colorMap, offset[1].zw);
color = mix(C, Ctop, a.r) * w.r + color; color = mix(C, Ctop, a.r) * w.r + color;
color = mix(C, Cbottom, a.g) * w.g + color; color = mix(C, Cbottom, a.g) * w.g + color;
color = mix(C, Cleft, a.b) * w.b + color; color = mix(C, Cleft, a.b) * w.b + color;
color = mix(C, Cright, a.a) * w.a + color; color = mix(C, Cright, a.a) * w.a + color;
// Normalize the resulting color and we are finished! // Normalize the resulting color and we are finished!
gl_FragColor = color / sum; FragColor = color / sum;
} }

View File

@ -1,11 +1,15 @@
varying vec4 offset[2]; #version 130
uniform vec2 PIXEL_SIZE; uniform vec2 PIXEL_SIZE;
uniform mat4 ModelViewProjectionMatrix;
out vec4 offset[2];
out vec2 uv;
void main() { void main() {
gl_Position = ftransform(); gl_Position = ModelViewProjectionMatrix * gl_Vertex;
vec4 invy = gl_MultiTexCoord0; vec4 invy = gl_MultiTexCoord0;
// invy.y = 1.0 - invy.y; // invy.y = 1.0 - invy.y;
gl_TexCoord[0] = invy; uv = invy.st;
offset[0] = invy.xyxy + PIXEL_SIZE.xyxy * vec4(-1.0, 0.0, 0.0, 1.0); offset[0] = invy.xyxy + PIXEL_SIZE.xyxy * vec4(-1.0, 0.0, 0.0, 1.0);
offset[1] = invy.xyxy + PIXEL_SIZE.xyxy * vec4( 1.0, 0.0, 0.0, -1.0); offset[1] = invy.xyxy + PIXEL_SIZE.xyxy * vec4( 1.0, 0.0, 0.0, -1.0);

View File

@ -21,6 +21,7 @@
// The actual boost amount (which linearly scales the blur to be shown). // 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 // 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]. // the blurring too string. Atm we are using [0, 0.5].
#version 130
uniform float boost_amount; uniform float boost_amount;
// The color buffer to use. // The color buffer to use.
@ -40,6 +41,8 @@ uniform float mask_radius;
// Maximum height of texture used // Maximum height of texture used
uniform float max_tex_height; uniform float max_tex_height;
out vec4 FragColor;
// Number of samples used for blurring // Number of samples used for blurring
#define NB_SAMPLES 8 #define NB_SAMPLES 8
@ -48,7 +51,7 @@ void main()
vec2 texcoords = gl_TexCoord[0].st; vec2 texcoords = gl_TexCoord[0].st;
// Sample the color buffer // Sample the color buffer
vec3 color = texture2D(color_buffer, texcoords).rgb; vec3 color = texture(color_buffer, texcoords).rgb;
// Compute the blur direction. // Compute the blur direction.
// IMPORTANT: we don't normalize it so that it avoids a glitch around 'center', // IMPORTANT: we don't normalize it so that it avoids a glitch around 'center',
@ -73,12 +76,12 @@ void main()
vec2 blur_texcoords = texcoords + inc_vec; vec2 blur_texcoords = texcoords + inc_vec;
for(int i=1 ; i < NB_SAMPLES ; i++) for(int i=1 ; i < NB_SAMPLES ; i++)
{ {
color += texture2D(color_buffer, blur_texcoords).rgb; color += texture(color_buffer, blur_texcoords).rgb;
blur_texcoords += inc_vec; blur_texcoords += inc_vec;
} }
color /= vec3(NB_SAMPLES); color /= vec3(NB_SAMPLES);
gl_FragColor = vec4(color, 1.0); FragColor = vec4(color, 1.0);
// Keep this commented line for debugging: // Keep this commented line for debugging:
//gl_FragColor = vec4(blur_factor, blur_factor, blur_factor, 0.0); //FragColor = vec4(blur_factor, blur_factor, blur_factor, 0.0);
} }

View File

@ -17,6 +17,7 @@
// motion_blur.vert // motion_blur.vert
#version 130
void main() void main()
{ {

View File

@ -1,10 +1,13 @@
#version 130
uniform sampler2D tex1; uniform sampler2D tex1;
uniform sampler2D tex2; uniform sampler2D tex2;
out vec4 FragColor;
void main() void main()
{ {
vec4 col1 = texture2D(tex1, gl_TexCoord[0].xy); vec4 col1 = texture(tex1, gl_TexCoord[0].xy);
vec4 col2 = vec4(vec3(texture2D(tex2, gl_TexCoord[0].xy).x), 1.0); vec4 col2 = vec4(vec3(texture(tex2, gl_TexCoord[0].xy).x), 1.0);
gl_FragColor = col1 * col2; FragColor = col1 * col2;
} }

View File

@ -1,33 +1,22 @@
#version 130 #version 130
uniform sampler2D texture; //The texture uniform sampler2D normalMap;
uniform sampler2D normalMap; //The bump-map
noperspective in vec3 tangent; noperspective in vec3 tangent;
noperspective in vec3 bitangent; noperspective in vec3 bitangent;
noperspective in vec3 normal; in vec2 uv;
out vec4 FragColor;
vec4 encdepth(float v) {
vec4 enc = vec4(1.0, 255.0, 65025.0, 16581375.0) * v;
enc = fract(enc);
enc -= enc.yzww * vec4(1.0/255.0, 1.0/255.0, 1.0/255.0, 0.0);
return enc;
}
void main() void main()
{ {
// normal in Tangent Space // normal in Tangent Space
vec3 TS_normal = 2.0 * texture2D (normalMap, gl_TexCoord[0].st).rgb - 1.0; vec3 TS_normal = 2.0 * texture (normalMap, uv).rgb - 1.0;
// Because of interpolation, we need to renormalize // Because of interpolation, we need to renormalize
vec3 Frag_tangent = normalize(tangent); vec3 Frag_tangent = normalize(tangent);
vec3 Frag_bitangent = normalize(cross(normal, tangent)); vec3 Frag_normal = normalize(cross(Frag_tangent, bitangent));
vec3 Frag_normal = cross(Frag_tangent, Frag_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;
vec3 FragmentNormal = TS_normal.x * Frag_tangent + TS_normal.y * Frag_bitangent + TS_normal.z * Frag_normal;
FragmentNormal = normalize(FragmentNormal); FragmentNormal = normalize(FragmentNormal);
FragColor = vec4(0.5 * FragmentNormal + 0.5, gl_FragCoord.z);
gl_FragData[0] = texture2D (texture, gl_TexCoord[0].st);
gl_FragData[1] = vec4(0.5 * FragmentNormal + 0.5, 1.0);
gl_FragData[2] = vec4(encdepth(gl_FragCoord.z).xyz, 0.0);
} }

View File

@ -1,14 +1,20 @@
#version 130 #version 130
uniform mat4 ModelViewProjectionMatrix;
uniform mat4 TransposeInverseModelView;
in vec3 Position;
in vec2 Texcoord;
in vec3 Tangent;
in vec3 Bitangent;
noperspective out vec3 tangent; noperspective out vec3 tangent;
noperspective out vec3 bitangent; noperspective out vec3 bitangent;
noperspective out vec3 normal; out vec2 uv;
void main() void main()
{ {
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; uv = Texcoord;
normal = gl_NormalMatrix * gl_Normal; tangent = (TransposeInverseModelView * vec4(Tangent, 1.)).xyz;
tangent = gl_NormalMatrix * gl_MultiTexCoord1.xyz; bitangent = (TransposeInverseModelView * vec4(Bitangent, 1.)).xyz;
bitangent = gl_NormalMatrix * gl_MultiTexCoord2.xyz; gl_Position = ModelViewProjectionMatrix * vec4(Position, 1.);
gl_Position = ftransform();
} }

View File

@ -0,0 +1,8 @@
#version 130
noperspective in vec3 nor;
out vec4 FragColor;
void main(void)
{
FragColor = vec4(0.5 * normalize(nor) + 0.5, gl_FragCoord.z);
}

View File

@ -0,0 +1,13 @@
#version 130
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;
}

View File

@ -0,0 +1,21 @@
#version 130
uniform sampler2D Albedo;
uniform sampler2D DiffuseMap;
uniform sampler2D SpecularMap;
uniform sampler2D SSAO;
uniform vec2 screen;
uniform vec3 ambient;
in vec2 uv;
out vec4 FragColor;
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 * ao, 1.);
}

View File

@ -0,0 +1,12 @@
#version 130
uniform mat4 ModelViewProjectionMatrix;
in vec3 Position;
in vec2 Texcoord;
out vec2 uv;
void main(void)
{
uv = Texcoord;
gl_Position = ModelViewProjectionMatrix * vec4(Position, 1.);
}

View File

@ -1,41 +1,32 @@
#version 130 #version 130
uniform sampler2D tex; uniform sampler2D tex;
uniform sampler2D lighttex; uniform sampler2D lighttex;
uniform float far;
uniform int hastex; uniform int hastex;
uniform int haslightmap; uniform int haslightmap;
uniform float objectid;
noperspective in vec3 nor; noperspective in vec3 nor;
in vec4 color;
const float near = 1.0; in vec2 uv0;
in vec2 uv1;
vec4 encdepth(float v) { out vec4 Albedo;
vec4 enc = vec4(1.0, 255.0, 65025.0, 16581375.0) * v; out vec4 NormalDepth;
enc = fract(enc); out vec4 Specular;
enc -= enc.yzww * vec4(1.0/255.0, 1.0/255.0, 1.0/255.0, 0.0);
return enc;
}
void main() { void main() {
float linear_z = (2.0 * near) / (far + near - gl_FragCoord.z * (far - near));
// Tune for better inside range without losing outdoors
linear_z *= 2.0;
vec4 light = vec4(1.0); vec4 light = vec4(1.0);
vec4 col;
if (haslightmap != 0) { if (haslightmap != 0) {
light = texture2D(lighttex, gl_TexCoord[1].xy); light = texture(lighttex, uv1);
} }
if (hastex != 0) if (hastex != 0)
gl_FragData[0] = texture2D(tex, gl_TexCoord[0].xy) * light; col = texture(tex, uv0) * light;
else else
gl_FragData[0] = gl_Color; col = color;
gl_FragData[1] = vec4(0.5 * normalize(nor) + 0.5, linear_z); Albedo = vec4(col.xyz, 1.);
gl_FragData[2] = vec4(encdepth(gl_FragCoord.z).xyz, objectid); NormalDepth = vec4(0.5 * normalize(nor) + 0.5, gl_FragCoord.z);
Specular = vec4(1. - col.a);
} }

View File

@ -1,12 +1,19 @@
#version 130 #version 130
uniform mat4 ModelViewProjectionMatrix;
uniform mat4 TransposeInverseModelView;
uniform mat4 TextureMatrix0;
uniform mat4 TextureMatrix1;
noperspective out vec3 nor; noperspective out vec3 nor;
out vec4 color;
out vec2 uv0;
out vec2 uv1;
void main() { void main() {
nor = gl_NormalMatrix * gl_Normal; nor = (TransposeInverseModelView * vec4(gl_Normal, 1.)).xyz;
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; uv0 = (gl_TextureMatrix[0] * gl_MultiTexCoord0).st;
gl_TexCoord[1] = gl_TextureMatrix[1] * gl_MultiTexCoord1; uv1 = (gl_TextureMatrix[1] * gl_MultiTexCoord1).st;
gl_Position = ftransform(); gl_Position = ModelViewProjectionMatrix * gl_Vertex;
gl_FrontColor = gl_Color; color = gl_Color;
} }

View File

@ -1,39 +1,29 @@
#version 130 #version 130
uniform sampler2D tex; uniform sampler2D tex;
uniform float far;
uniform int hastex; uniform int hastex;
uniform float objectid; uniform float objectid;
noperspective in vec3 nor; noperspective in vec3 nor;
in vec2 uv0;
const float near = 1.0; in vec2 uv1;
out vec4 Albedo;
vec4 encdepth(float v) { out vec4 NormalDepth;
vec4 enc = vec4(1.0, 255.0, 65025.0, 16581375.0) * v; out vec4 Specular;
enc = fract(enc);
enc -= enc.yzww * vec4(1.0/255.0, 1.0/255.0, 1.0/255.0, 0.0);
return enc;
}
void main() { void main() {
float linear_z = (2.0 * near) / (far + near - gl_FragCoord.z * (far - near));
// Tune for better inside range without losing outdoors
linear_z *= 2.0;
//if (hastex != 0) { //if (hastex != 0) {
vec4 col = texture2D(tex, gl_TexCoord[0].xy); vec4 col = texture(tex, uv0);
if (col.a < 0.5) if (col.a < 0.5)
discard; discard;
gl_FragData[0] = col; Albedo = vec4(col.xyz, 1.);
//} else { //} else {
// gl_FragData[0] = gl_Color; // Albedo = gl_Color;
//} //}
gl_FragData[1] = vec4(0.5 * normalize(nor) + 0.5, linear_z); NormalDepth = vec4(0.5 * normalize(nor) + 0.5, gl_FragCoord.z);
gl_FragData[2] = vec4(encdepth(gl_FragCoord.z).xyz, objectid); Specular = vec4(1. - col.a);
} }

View File

@ -1,46 +1,35 @@
#version 130 #version 130
uniform sampler2D tex; uniform sampler2D tex;
uniform float far;
uniform int hastex; uniform int hastex;
uniform float objectid; uniform float objectid;
noperspective in vec3 nor; noperspective in vec3 nor;
noperspective in vec3 eyenor; noperspective in vec3 eyenor;
noperspective in vec3 viewpos; noperspective in vec3 viewpos;
out vec4 Albedo;
const float near = 1.0; out vec4 NormalDepth;
out vec4 Specular;
vec4 encdepth(float v) {
vec4 enc = vec4(1.0, 255.0, 65025.0, 16581375.0) * v;
enc = fract(enc);
enc -= enc.yzww * vec4(1.0/255.0, 1.0/255.0, 1.0/255.0, 0.0);
return enc;
}
void main() { void main() {
float linear_z = (2.0 * near) / (far + near - gl_FragCoord.z * (far - near));
// Tune for better inside range without losing outdoors
linear_z *= 2.0;
float rim = 1.0 - dot(eyenor, viewpos); float rim = 1.0 - dot(eyenor, viewpos);
rim = smoothstep(0.5, 1.5, rim) * 0.35; rim = smoothstep(0.5, 1.5, rim) * 0.35;
vec4 color;
if (hastex != 0) { if (hastex != 0) {
vec4 col = texture2D(tex, gl_TexCoord[0].xy); vec4 col = texture(tex, gl_TexCoord[0].xy);
if (col.a < 0.5) if (col.a < 0.1)
discard; discard;
col.xyz += rim; col.xyz += rim;
gl_FragData[0] = col; color = col;
} else { } else {
gl_FragData[0] = gl_Color + vec4(vec3(rim), 0.0); color = gl_Color + vec4(vec3(rim), 0.0);
} }
gl_FragData[1] = vec4(0.5 * normalize(nor) + 0.5, linear_z); Albedo = vec4(color.xyz, 1.);
gl_FragData[2] = vec4(encdepth(gl_FragCoord.z).xyz, objectid); NormalDepth = vec4(0.5 * normalize(nor) + 0.5, gl_FragCoord.z);
Specular = vec4(1. - color.a);
} }

View File

@ -10,6 +10,6 @@ void main() {
viewpos = -normalize((gl_ModelViewMatrix * gl_Vertex).xyz); viewpos = -normalize((gl_ModelViewMatrix * gl_Vertex).xyz);
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
gl_Position = ftransform(); gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
gl_FrontColor = gl_Color; gl_FrontColor = gl_Color;
} }

View File

@ -1,43 +1,22 @@
#version 130 #version 130
uniform sampler2D tex; uniform sampler2D tex;
uniform float far;
uniform float objectid;
noperspective in vec3 eyenor;
noperspective in vec3 viewpos;
noperspective in vec3 nor; noperspective in vec3 nor;
out vec4 FragColor;
const float near = 1.0;
vec4 encdepth(float v) {
vec4 enc = vec4(1.0, 255.0, 65025.0, 16581375.0) * v;
enc = fract(enc);
enc -= enc.yzww * vec4(1.0/255.0, 1.0/255.0, 1.0/255.0, 0.0);
return enc;
}
void main() { void main() {
float linear_z = (2.0 * near) / (far + near - gl_FragCoord.z * (far - near));
// Tune for better inside range without losing outdoors
linear_z *= 2.0;
// Calculate the spherical UV // Calculate the spherical UV
const vec3 forward = vec3(0.0, 0.0, 1.0); const vec3 forward = vec3(0.0, 0.0, 1.0);
// get the angle between the forward vector and the horizontal portion of the normal // get the angle between the forward vector and the horizontal portion of the normal
vec3 normal_x = normalize(vec3(eyenor.x, 0.0, eyenor.z)); vec3 normal_x = normalize(vec3(nor.x, 0.0, nor.z));
float sin_theta_x = length(cross( forward, normal_x )) * eyenor.x/abs(eyenor.x); float sin_theta_x = length(cross( forward, normal_x )) * nor.x / abs(nor.x);
// get the angle between the forward vector and the vertical portion of the normal // get the angle between the forward vector and the vertical portion of the normal
vec3 normal_y = normalize(vec3(0.0, eyenor.y, eyenor.z)); vec3 normal_y = normalize(vec3(0.0, nor.y, nor.z));
float sin_theta_y = length(cross( forward, normal_y )) * eyenor.y/abs(eyenor.y); float sin_theta_y = length(cross( forward, normal_y )) * nor.y / abs(nor.y);
vec4 detail0 = texture2D(tex, vec2(0.5 + sin_theta_x*0.5, 0.5 + sin_theta_y*0.5)); vec4 detail0 = texture(tex, 0.5 * vec2(sin_theta_x, sin_theta_y) + 0.5);
gl_FragData[0] = detail0 * gl_Color; FragColor = vec4(detail0.xyz, 1.);
gl_FragData[1] = vec4(nor, linear_z);
gl_FragData[2] = vec4(encdepth(gl_FragCoord.z).xyz, objectid);
} }

View File

@ -0,0 +1,14 @@
#version 130
uniform sampler2D tex;
noperspective in vec3 nor;
in vec2 uv;
out vec4 NormalDepth;
void main() {
vec4 col = texture(tex, uv);
if (col.a < 0.5)
discard;
NormalDepth = vec4(0.5 * normalize(nor) + 0.5, gl_FragCoord.z);
}

View File

@ -0,0 +1,16 @@
#version 130
uniform mat4 ModelViewProjectionMatrix;
uniform mat4 TransposeInverseModelView;
in vec3 Position;
in vec3 Normal;
in vec2 Texcoord;
noperspective out vec3 nor;
out vec2 uv;
void main(void)
{
uv = Texcoord;
gl_Position = ModelViewProjectionMatrix * vec4(Position, 1.);
nor = (TransposeInverseModelView * vec4(Normal, 0.)).xyz;
}

View File

@ -0,0 +1,21 @@
#version 130
uniform sampler2D Albedo;
uniform sampler2D DiffuseMap;
uniform sampler2D SpecularMap;
uniform sampler2D SSAO;
uniform vec2 screen;
uniform vec3 ambient;
in vec2 uv;
out vec4 FragColor;
void main(void)
{
vec4 color = texture(Albedo, uv);
if (color.a < 0.5) discard;
vec2 tc = gl_FragCoord.xy / screen;
vec3 DiffuseComponent = texture(DiffuseMap, tc).xyz;
vec3 SpecularComponent = texture(SpecularMap, tc).xyz;
float ao = texture(SSAO, tc).x;
vec3 LightFactor = ao * ambient + DiffuseComponent + SpecularComponent;
FragColor = vec4(color.xyz * LightFactor, 1.);
}

View File

@ -0,0 +1,25 @@
#version 130
uniform sampler2D tex;
uniform sampler2D normals_and_depth;
uniform mat4 invproj;
uniform vec2 screen;
in float lf;
in vec2 tc;
out vec4 color;
void main(void)
{
vec2 xy = gl_FragCoord.xy / screen;
float FragZ = gl_FragCoord.z;
float EnvZ = texture(normals_and_depth, xy).a;
vec4 FragmentPos = invproj * (2. * vec4(xy, FragZ, 1.0) - 1.);
FragmentPos /= FragmentPos.w;
vec4 EnvPos = invproj * (2. * vec4(xy, EnvZ, 1.0) - 1.);
EnvPos /= EnvPos.w;
float len = dot(vec3(1.0), abs(texture(normals_and_depth, xy).xyz));
float alpha = (len < 0.2) ? 1. : clamp((EnvPos.z - FragmentPos.z) * 0.3, 0., 1.);
color = texture(tex, tc);
color.a *= alpha * smoothstep(1., 0.8, lf);
}

View File

@ -0,0 +1,23 @@
#version 130
uniform mat4 ProjectionMatrix;
uniform mat4 ViewMatrix;
in vec2 quadcorner;
in vec2 texcoord;
in vec3 position;
in float lifetime;
in float size;
out float lf;
out vec2 tc;
void main(void)
{
tc = texcoord;
lf = lifetime;
vec3 newposition = position;
vec4 viewpos = ViewMatrix * vec4(newposition, 1.0);
viewpos += size * vec4(quadcorner, 0., 0.);
gl_Position = ProjectionMatrix * viewpos;
}

View File

@ -0,0 +1,50 @@
#version 140
uniform int dt;
uniform mat4 sourcematrix;
uniform int level;
uniform float size_increase_factor;
uniform float track_x;
uniform float track_z;
uniform float track_x_len;
uniform float track_z_len;
uniform samplerBuffer heightmap;
in vec3 particle_position_initial;
in float lifetime_initial;
in vec3 particle_velocity_initial;
in float size_initial;
in vec3 particle_position;
in float lifetime;
in vec3 particle_velocity;
in float size;
out vec3 new_particle_position;
out float new_lifetime;
out vec3 new_particle_velocity;
out float new_size;
void main(void)
{
bool reset = false;
float i_as_float = clamp(256. * (particle_position.x - track_x) / track_x_len, 0., 255.);
float j_as_float = clamp(256. * (particle_position.z - track_z) / track_z_len, 0., 255.);
int i = int(i_as_float);
int j = int(j_as_float);
float h = particle_position.y - texelFetch(heightmap, i * 256 + j).r;
reset = h < 0.;
vec4 initialposition = sourcematrix * vec4(particle_position_initial, 1.0);
vec4 adjusted_initial_velocity = sourcematrix * vec4(particle_position_initial + particle_velocity_initial, 1.0) - initialposition;
float adjusted_lifetime = lifetime + (float(dt)/lifetime_initial);
reset = reset || (adjusted_lifetime > 1.) && (gl_VertexID <= level);
reset = reset || (lifetime < 0.);
new_particle_position = !reset ? particle_position + particle_velocity.xyz * float(dt) : initialposition.xyz;
new_lifetime = !reset ? adjusted_lifetime : 0.;
new_particle_velocity = !reset ? particle_velocity : adjusted_initial_velocity.xyz;
new_size = !reset ? mix(size_initial, size_initial * size_increase_factor, adjusted_lifetime) : size_initial;
gl_Position = vec4(0.);
}

View File

@ -1,6 +1,9 @@
#version 130
uniform sampler2D tex; uniform sampler2D tex;
out vec4 FragColor;
void main() void main()
{ {
gl_FragColor = texture2D(tex, gl_TexCoord[0].xy); FragColor = texture(tex, gl_TexCoord[0].xy);
} }

View File

@ -1,6 +1,9 @@
// Passthrough shader for drawQuad()
#version 130
out vec2 uv;
void main() { void main() {
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; uv = gl_MultiTexCoord0.xy;
gl_TexCoord[1] = gl_TextureMatrix[1] * gl_MultiTexCoord1; gl_Position = gl_Vertex;
gl_Position = ftransform();
gl_FrontColor = gl_Color;
} }

View File

@ -1,6 +1,8 @@
#version 130
uniform sampler2D tex; uniform sampler2D tex;
uniform vec2 pixel; uniform vec2 pixel;
out vec4 FragColor;
// Separated penumbra, horizontal // Separated penumbra, horizontal
void main() void main()
@ -12,41 +14,41 @@ void main()
float width = 0.0; float width = 0.0;
float zsum = 0.00001; float zsum = 0.00001;
tmp = texture2D(tex, vec2(X - 5.13333 * pixel.x, Y)); tmp = texture(tex, vec2(X - 5.13333 * pixel.x, Y));
sum += tmp.x * 0.00640869; sum += tmp.x * 0.00640869;
zsum += tmp.z; zsum += tmp.z;
width += tmp.y; width += tmp.y;
tmp = texture2D(tex, vec2(X - 3.26667 * pixel.x, Y)); tmp = texture(tex, vec2(X - 3.26667 * pixel.x, Y));
sum += tmp.x * 0.083313; sum += tmp.x * 0.083313;
zsum += tmp.z; zsum += tmp.z;
width += tmp.y; width += tmp.y;
tmp = texture2D(tex, vec2(X - 1.4 * pixel.x, Y)); tmp = texture(tex, vec2(X - 1.4 * pixel.x, Y));
sum += tmp.x * 0.305481; sum += tmp.x * 0.305481;
zsum += tmp.z; zsum += tmp.z;
width += tmp.y; width += tmp.y;
tmp = texture2D(tex, vec2(X, Y)); tmp = texture(tex, vec2(X, Y));
sum += tmp.x * 0.209473; sum += tmp.x * 0.209473;
zsum += tmp.z; zsum += tmp.z;
width += tmp.y; width += tmp.y;
tmp = texture2D(tex, vec2(X + 1.4 * pixel.x, Y)); tmp = texture(tex, vec2(X + 1.4 * pixel.x, Y));
sum += tmp.x * 0.305481; sum += tmp.x * 0.305481;
zsum += tmp.z; zsum += tmp.z;
width += tmp.y; width += tmp.y;
tmp = texture2D(tex, vec2(X + 3.26667 * pixel.x, Y)); tmp = texture(tex, vec2(X + 3.26667 * pixel.x, Y));
sum += tmp.x * 0.083313; sum += tmp.x * 0.083313;
zsum += tmp.z; zsum += tmp.z;
width += tmp.y; width += tmp.y;
tmp = texture2D(tex, vec2(X + 5.13333 * pixel.x, Y)); tmp = texture(tex, vec2(X + 5.13333 * pixel.x, Y));
sum += tmp.x * 0.00640869; sum += tmp.x * 0.00640869;
zsum += tmp.z; zsum += tmp.z;
width += tmp.y; width += tmp.y;
float hasz = step(0.7, zsum); float hasz = step(0.7, zsum);
gl_FragColor = vec4(sum, (width / zsum) * hasz, hasz, 1.0); FragColor = vec4(sum, (width / zsum) * hasz, hasz, 1.0);
} }

View File

@ -1,6 +1,9 @@
#version 130
uniform sampler2D tex; uniform sampler2D tex;
uniform vec2 pixel; uniform vec2 pixel;
out vec4 FragColor;
// Separated penumbra, vertical // Separated penumbra, vertical
void main() void main()
@ -12,41 +15,41 @@ void main()
float width = 0.0; float width = 0.0;
float zsum = 0.00001; float zsum = 0.00001;
tmp = texture2D(tex, vec2(X, Y - 5.13333 * pixel.y)); tmp = texture(tex, vec2(X, Y - 5.13333 * pixel.y));
sum += tmp.x * 0.00640869; sum += tmp.x * 0.00640869;
zsum += tmp.z; zsum += tmp.z;
width += tmp.y; width += tmp.y;
tmp = texture2D(tex, vec2(X, Y - 3.26667 * pixel.y)); tmp = texture(tex, vec2(X, Y - 3.26667 * pixel.y));
sum += tmp.x * 0.083313; sum += tmp.x * 0.083313;
zsum += tmp.z; zsum += tmp.z;
width += tmp.y; width += tmp.y;
tmp = texture2D(tex, vec2(X, Y - 1.4 * pixel.y)); tmp = texture(tex, vec2(X, Y - 1.4 * pixel.y));
sum += tmp.x * 0.305481; sum += tmp.x * 0.305481;
zsum += tmp.z; zsum += tmp.z;
width += tmp.y; width += tmp.y;
tmp = texture2D(tex, vec2(X, Y)); tmp = texture(tex, vec2(X, Y));
sum += tmp.x * 0.209473; sum += tmp.x * 0.209473;
zsum += tmp.z; zsum += tmp.z;
width += tmp.y; width += tmp.y;
tmp = texture2D(tex, vec2(X, Y + 1.4 * pixel.y)); tmp = texture(tex, vec2(X, Y + 1.4 * pixel.y));
sum += tmp.x * 0.305481; sum += tmp.x * 0.305481;
zsum += tmp.z; zsum += tmp.z;
width += tmp.y; width += tmp.y;
tmp = texture2D(tex, vec2(X, Y + 3.26667 * pixel.y)); tmp = texture(tex, vec2(X, Y + 3.26667 * pixel.y));
sum += tmp.x * 0.083313; sum += tmp.x * 0.083313;
zsum += tmp.z; zsum += tmp.z;
width += tmp.y; width += tmp.y;
tmp = texture2D(tex, vec2(X, Y + 5.13333 * pixel.y)); tmp = texture(tex, vec2(X, Y + 5.13333 * pixel.y));
sum += tmp.x * 0.00640869; sum += tmp.x * 0.00640869;
zsum += tmp.z; zsum += tmp.z;
width += tmp.y; width += tmp.y;
float hasz = step(0.7, zsum); float hasz = step(0.7, zsum);
gl_FragColor = vec4(sum, (width / zsum) * hasz, hasz, 1.0); FragColor = vec4(sum, (width / zsum) * hasz, hasz, 1.0);
} }

View File

@ -0,0 +1,51 @@
#version 130
uniform int dt;
uniform mat4 sourcematrix;
uniform int level;
uniform float size_increase_factor;
in vec3 particle_position_initial;
in float lifetime_initial;
in vec3 particle_velocity_initial;
in float size_initial;
in vec3 particle_position;
in float lifetime;
in vec3 particle_velocity;
in float size;
out vec3 new_particle_position;
out float new_lifetime;
out vec3 new_particle_velocity;
out float new_size;
void main(void)
{
float updated_lifetime = lifetime + (float(dt)/lifetime_initial);
if (updated_lifetime > 1.)
{
if (gl_VertexID <= level)
{
float dt_from_last_frame = fract(updated_lifetime) * lifetime_initial;
vec4 updated_initialposition = sourcematrix * vec4(particle_position_initial, 1.0);
vec4 updated_initial_velocity = sourcematrix * vec4(particle_position_initial + particle_velocity_initial, 1.0) - updated_initialposition;
new_particle_position = updated_initialposition.xyz + updated_initial_velocity.xyz * float(dt_from_last_frame);
new_particle_velocity = updated_initial_velocity.xyz;
new_lifetime = fract(updated_lifetime);
new_size = mix(size_initial, size_initial * size_increase_factor, fract(updated_lifetime));
}
else
{
new_lifetime = fract(updated_lifetime);
new_size = 0;
}
}
else
{
new_particle_position = particle_position + particle_velocity.xyz * float(dt);
new_particle_velocity = particle_velocity;
new_lifetime = updated_lifetime;
new_size = (size == 0) ? 0. : mix(size_initial, size_initial * size_increase_factor, updated_lifetime);
}
gl_Position = vec4(0.);
}

View File

@ -1,41 +1,51 @@
#version 130
uniform sampler2D ntex; uniform sampler2D ntex;
uniform sampler2D dtex;
uniform vec3 center; uniform vec4 center[16];
uniform vec3 col; uniform vec4 col[16];
uniform float r; uniform float energy[16];
uniform float spec; uniform float spec;
uniform vec2 screen;
uniform mat4 invproj; uniform mat4 invproj;
uniform mat4 viewm;
float decdepth(vec4 rgba) { in vec2 uv;
return dot(rgba, vec4(1.0, 1.0/255.0, 1.0/65025.0, 1.0/16581375.0)); out vec4 Diffuse;
} out vec4 Specular;
void main() { void main() {
vec2 texc = gl_FragCoord.xy / screen; vec2 texc = uv;
float z = decdepth(vec4(texture2D(dtex, texc).xyz, 0.0)); float z = texture(ntex, texc).a;
vec4 xpos = 2.0 * vec4(texc, z, 1.0) - 1.0f; vec4 xpos = 2.0 * vec4(texc, z, 1.0) - 1.0f;
xpos = invproj * xpos; xpos = invproj * xpos;
xpos /= xpos.w; xpos /= xpos.w;
float d = distance(center, xpos.xyz); vec3 diffuse = vec3(0.), specular = vec3(0.);
if (d > r) discard;
float att = 1.0 - smoothstep(0.0, r, d);
vec3 norm = texture2D(ntex, texc).xyz; for (int i = 0; i < 16; ++i) {
norm = (norm - 0.5) * 2.0; vec4 pseudocenter = viewm * vec4(center[i].xyz, 1.0);
pseudocenter /= pseudocenter.w;
vec3 light_pos = pseudocenter.xyz;
vec3 light_col = col[i].xyz;
float d = distance(light_pos, xpos.xyz);
float att = energy[i] * 200. / (4. * 3.14 * d * d);
float spec_att = (energy[i] + 10.) * 200. / (4. * 3.14 * d * d);
// Light Direction vec3 norm = texture(ntex, texc).xyz;
vec3 L = normalize(xpos.xyz - center); norm = (norm - 0.5) * 2.0;
vec3 eyedir = normalize(xpos.xyz);
vec3 H = normalize(-L + eyedir);
float NdotL = max(0.0, dot(norm, -L)) * att; // Light Direction
float NdotH = max(0.0, dot(norm, H)); vec3 L = normalize(xpos.xyz - light_pos);
NdotH = pow(NdotH, spec);
NdotH += 0.05; // offset so that the alpha test doesn't kill us
gl_FragColor = NdotL * vec4(NdotL * col, NdotH); float NdotL = max(0.0, dot(norm, -L));
diffuse += NdotL * light_col * att;
// Reflected light dir
vec3 R = reflect(-L, norm);
float RdotE = max(0.0, dot(R, normalize(xpos.xyz)));
float Specular = pow(RdotE, spec);
specular += Specular * light_col * spec_att;
}
Diffuse = vec4(diffuse, 1.);
Specular = vec4(specular , 1.);
} }

View File

@ -1,26 +1,30 @@
#version 130
uniform sampler2D tex; uniform sampler2D tex;
uniform sampler2D dtex; uniform sampler2D dtex;
uniform int viz; uniform int viz;
in vec2 uv;
out vec4 FragColor;
void main() void main()
{ {
vec2 tc = gl_TexCoord[0].xy; vec2 tc = uv;
vec4 shiftval = texture2D(dtex, tc) / vec4(50.0); vec4 shiftval = texture(dtex, tc) / vec4(50.0);
vec2 shift; vec2 shift;
shift.x = -shiftval.x + shiftval.y; shift.x = -shiftval.x + shiftval.y;
shift.y = -shiftval.z + shiftval.w; shift.y = -shiftval.z + shiftval.w;
tc += shift; tc += shift;
vec4 newcol = texture2D(tex, tc); vec4 newcol = texture(tex, tc);
if (viz < 1) if (viz < 1)
{ {
gl_FragColor = newcol; FragColor = newcol;
} else } else
{ {
gl_FragColor = shiftval * vec4(50.0); FragColor = shiftval * vec4(50.0);
} }
} }

View File

@ -1,6 +1,22 @@
#version 130
uniform sampler2D tex; uniform sampler2D tex;
uniform sampler2D normals_and_depth;
uniform mat4 invproj;
uniform vec2 screen;
out vec4 FragColor;
void main() void main()
{ {
gl_FragColor = texture2D(tex, gl_TexCoord[0].xy); vec2 xy = gl_FragCoord.xy / screen;
float FragZ = gl_FragCoord.z;
float EnvZ = texture(normals_and_depth, xy).a;
vec4 FragmentPos = invproj * (2. * vec4(xy, FragZ, 1.0) - 1.);
FragmentPos /= FragmentPos.w;
vec4 EnvPos = invproj * (2. * vec4(xy, EnvZ, 1.0) - 1.);
EnvPos /= EnvPos.w;
float len = dot(vec3(1.0), abs(texture(normals_and_depth, xy).xyz));
float alpha = (len < 0.2) ? 1. : clamp((EnvPos.z - FragmentPos.z) * 0.3, 0., 1.);
FragColor = texture(tex, gl_PointCoord.xy);
FragColor.a *= alpha;
} }

View File

@ -1,33 +1,13 @@
#version 130
uniform float screenw; uniform float screenw;
uniform float time;
uniform mat4 viewm;
uniform vec3 campos;
void main() void main()
{ {
const float size = 0.5; const float size = 0.5;
// This simulation will run accurately for a bit under five days. vec4 eyepos = gl_Vertex;
vec4 start = gl_Vertex;
start.y -= time;
// How many times has it fell?
float count = floor(start.y / 24.0);
start.x += sin(count);
start.z += cos(count);
vec2 signs = sign(start.xz);
start.xz = mod(start.xz, 17.5) * signs;
start.y = mod(start.y, 24.0) - 3.0;
start.xyz += campos;
vec4 eyepos = viewm * start;
vec4 projCorner = gl_ProjectionMatrix * vec4(vec2(size), eyepos.z, eyepos.w); vec4 projCorner = gl_ProjectionMatrix * vec4(vec2(size), eyepos.z, eyepos.w);
gl_PointSize = screenw * projCorner.x / projCorner.w; gl_PointSize = screenw * projCorner.x / projCorner.w;
gl_Position = gl_ProjectionMatrix * eyepos; gl_Position = gl_ProjectionMatrix * eyepos;
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
} }

29
data/shaders/rainsim.vert Normal file
View File

@ -0,0 +1,29 @@
#version 130
uniform float time;
uniform vec3 campos;
uniform mat4 viewm;
in vec3 initialPosition;
out vec3 currentPosition;
void main()
{
// This simulation will run accurately for a bit under five days.
vec4 start = vec4(initialPosition, 1.0);
start.y -= time;
// How many times has it fell?
float count = floor(start.y / 24.0);
start.x += sin(count);
start.z += cos(count);
vec2 signs = sign(start.xz);
start.xz = mod(start.xz, 17.5) * signs;
start.y = mod(start.y, 24.0) - 3.0;
start.xyz += campos;
currentPosition = (viewm * start).xyz;
gl_Position = vec4(0.);
}

View File

@ -0,0 +1,10 @@
#version 130
in vec2 Position;
in vec2 Texcoord;
out vec2 uv;
void main() {
uv = Texcoord;
gl_Position = vec4(Position, 0., 1.);
}

View File

@ -1,13 +1,15 @@
#version 130
uniform sampler2D halft; // half is a reserved word uniform sampler2D halft; // half is a reserved word
uniform sampler2D quarter; uniform sampler2D quarter;
uniform sampler2D eighth; uniform sampler2D eighth;
out vec4 FragColor;
void main() void main()
{ {
vec3 val[3]; vec3 val[3];
val[0] = texture2D(halft, gl_TexCoord[0].xy).xyz; val[0] = texture(halft, gl_TexCoord[0].xy).xyz;
val[1] = texture2D(quarter, gl_TexCoord[0].xy).xyz; val[1] = texture(quarter, gl_TexCoord[0].xy).xyz;
val[2] = texture2D(eighth, gl_TexCoord[0].xy).xyz; val[2] = texture(eighth, gl_TexCoord[0].xy).xyz;
// Find the first level with a penumbra value // Find the first level with a penumbra value
int i; int i;
@ -40,5 +42,5 @@ void main()
outval = 1.0 - mix(val[down].x, val[up].x, interp); outval = 1.0 - mix(val[down].x, val[up].x, interp);
} }
gl_FragColor = vec4(vec3(outval), 1.0); FragColor = vec4(vec3(outval), 1.0);
} }

Some files were not shown because too many files have changed in this diff Show More