diff --git a/.gitignore b/.gitignore index bb864ee..89e2c55 100644 --- a/.gitignore +++ b/.gitignore @@ -25,13 +25,10 @@ [Rr]elease/ [Rr]eleases/ bld/ -[Qq]uartz/[Bb]in/ -[Ff][Nn][Aa]/[Bb]in/ [Bb]uild/ -[Dd]ebug/ +Generator/bin/[Dd]ebug [Oo]bj/ [Ll]og/ -[xX][68][46]/ # Visual Studio 2015 cache/options directory .vs/ diff --git a/ExampleApplication/bin/Debug/ExampleApplication.exe b/ExampleApplication/bin/Debug/ExampleApplication.exe new file mode 100644 index 0000000..77c36c1 Binary files /dev/null and b/ExampleApplication/bin/Debug/ExampleApplication.exe differ diff --git a/ExampleApplication/bin/Debug/ExampleApplication.exe.config b/ExampleApplication/bin/Debug/ExampleApplication.exe.config new file mode 100644 index 0000000..731f6de --- /dev/null +++ b/ExampleApplication/bin/Debug/ExampleApplication.exe.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/ExampleApplication/bin/Debug/raylib.dll b/ExampleApplication/bin/Debug/raylib.dll new file mode 100644 index 0000000..6a9ef2b Binary files /dev/null and b/ExampleApplication/bin/Debug/raylib.dll differ diff --git a/ExampleApplication/bin/Debug/resources/AnonymousPro-Bold.ttf b/ExampleApplication/bin/Debug/resources/AnonymousPro-Bold.ttf new file mode 100644 index 0000000..badb0aa Binary files /dev/null and b/ExampleApplication/bin/Debug/resources/AnonymousPro-Bold.ttf differ diff --git a/ExampleApplication/bin/Debug/resources/AnonymousPro_OFL.txt b/ExampleApplication/bin/Debug/resources/AnonymousPro_OFL.txt new file mode 100644 index 0000000..5ca1911 --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/AnonymousPro_OFL.txt @@ -0,0 +1,94 @@ +Copyright (c) 2009, Mark Simonson (http://www.ms-studio.com, mark@marksimonson.com), +with Reserved Font Name Anonymous Pro. + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/ExampleApplication/bin/Debug/resources/KAISG.ttf b/ExampleApplication/bin/Debug/resources/KAISG.ttf new file mode 100644 index 0000000..04478b2 Binary files /dev/null and b/ExampleApplication/bin/Debug/resources/KAISG.ttf differ diff --git a/ExampleApplication/bin/Debug/resources/angle_gauge.png b/ExampleApplication/bin/Debug/resources/angle_gauge.png new file mode 100644 index 0000000..f7871de Binary files /dev/null and b/ExampleApplication/bin/Debug/resources/angle_gauge.png differ diff --git a/ExampleApplication/bin/Debug/resources/applause.mp3 b/ExampleApplication/bin/Debug/resources/applause.mp3 new file mode 100644 index 0000000..084a7d1 Binary files /dev/null and b/ExampleApplication/bin/Debug/resources/applause.mp3 differ diff --git a/ExampleApplication/bin/Debug/resources/background.png b/ExampleApplication/bin/Debug/resources/background.png new file mode 100644 index 0000000..69a74b7 Binary files /dev/null and b/ExampleApplication/bin/Debug/resources/background.png differ diff --git a/ExampleApplication/bin/Debug/resources/billboard.png b/ExampleApplication/bin/Debug/resources/billboard.png new file mode 100644 index 0000000..e2fe398 Binary files /dev/null and b/ExampleApplication/bin/Debug/resources/billboard.png differ diff --git a/ExampleApplication/bin/Debug/resources/bmfont.fnt b/ExampleApplication/bin/Debug/resources/bmfont.fnt new file mode 100644 index 0000000..372c2c8 --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/bmfont.fnt @@ -0,0 +1,99 @@ +info face="Arial Black" size=-32 bold=0 italic=0 charset="" unicode=1 stretchH=100 smooth=1 aa=1 padding=0,0,0,0 spacing=2,2 outline=0 +common lineHeight=45 base=35 scaleW=512 scaleH=256 pages=1 packed=0 alphaChnl=0 redChnl=4 greenChnl=4 blueChnl=4 +page id=0 file="bmfont.png" +chars count=95 +char id=32 x=423 y=141 width=3 height=45 xoffset=-1 yoffset=0 xadvance=11 page=0 chnl=15 +char id=33 x=323 y=141 width=9 height=45 xoffset=1 yoffset=0 xadvance=11 page=0 chnl=15 +char id=34 x=123 y=141 width=16 height=45 xoffset=0 yoffset=0 xadvance=16 page=0 chnl=15 +char id=35 x=221 y=47 width=21 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15 +char id=36 x=244 y=47 width=21 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15 +char id=37 x=70 y=0 width=30 height=45 xoffset=1 yoffset=0 xadvance=32 page=0 chnl=15 +char id=38 x=390 y=0 width=25 height=45 xoffset=2 yoffset=0 xadvance=28 page=0 chnl=15 +char id=39 x=378 y=141 width=8 height=45 xoffset=1 yoffset=0 xadvance=9 page=0 chnl=15 +char id=40 x=222 y=141 width=11 height=45 xoffset=1 yoffset=0 xadvance=12 page=0 chnl=15 +char id=41 x=499 y=94 width=11 height=45 xoffset=1 yoffset=0 xadvance=12 page=0 chnl=15 +char id=42 x=497 y=47 width=13 height=45 xoffset=2 yoffset=0 xadvance=18 page=0 chnl=15 +char id=43 x=394 y=94 width=19 height=45 xoffset=1 yoffset=0 xadvance=21 page=0 chnl=15 +char id=44 x=367 y=141 width=9 height=45 xoffset=1 yoffset=0 xadvance=11 page=0 chnl=15 +char id=45 x=261 y=141 width=11 height=45 xoffset=0 yoffset=0 xadvance=11 page=0 chnl=15 +char id=46 x=356 y=141 width=9 height=45 xoffset=1 yoffset=0 xadvance=11 page=0 chnl=15 +char id=47 x=248 y=141 width=11 height=45 xoffset=-1 yoffset=0 xadvance=9 page=0 chnl=15 +char id=48 x=382 y=47 width=21 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15 +char id=49 x=496 y=0 width=14 height=45 xoffset=2 yoffset=0 xadvance=21 page=0 chnl=15 +char id=50 x=134 y=94 width=20 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15 +char id=51 x=359 y=47 width=21 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15 +char id=52 x=313 y=47 width=21 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15 +char id=53 x=336 y=47 width=21 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15 +char id=54 x=178 y=94 width=20 height=45 xoffset=1 yoffset=0 xadvance=21 page=0 chnl=15 +char id=55 x=478 y=94 width=19 height=45 xoffset=1 yoffset=0 xadvance=21 page=0 chnl=15 +char id=56 x=290 y=47 width=21 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15 +char id=57 x=90 y=94 width=20 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15 +char id=58 x=345 y=141 width=9 height=45 xoffset=1 yoffset=0 xadvance=11 page=0 chnl=15 +char id=59 x=334 y=141 width=9 height=45 xoffset=1 yoffset=0 xadvance=11 page=0 chnl=15 +char id=60 x=0 y=141 width=19 height=45 xoffset=1 yoffset=0 xadvance=21 page=0 chnl=15 +char id=61 x=21 y=141 width=19 height=45 xoffset=1 yoffset=0 xadvance=21 page=0 chnl=15 +char id=62 x=310 y=94 width=19 height=45 xoffset=1 yoffset=0 xadvance=21 page=0 chnl=15 +char id=63 x=352 y=94 width=19 height=45 xoffset=1 yoffset=0 xadvance=20 page=0 chnl=15 +char id=64 x=279 y=0 width=26 height=45 xoffset=-1 yoffset=0 xadvance=24 page=0 chnl=15 +char id=65 x=193 y=0 width=27 height=45 xoffset=-1 yoffset=0 xadvance=25 page=0 chnl=15 +char id=66 x=150 y=47 width=22 height=45 xoffset=2 yoffset=0 xadvance=25 page=0 chnl=15 +char id=67 x=444 y=0 width=24 height=45 xoffset=1 yoffset=0 xadvance=25 page=0 chnl=15 +char id=68 x=174 y=47 width=22 height=45 xoffset=2 yoffset=0 xadvance=25 page=0 chnl=15 +char id=69 x=156 y=94 width=20 height=45 xoffset=2 yoffset=0 xadvance=23 page=0 chnl=15 +char id=70 x=63 y=141 width=18 height=45 xoffset=2 yoffset=0 xadvance=21 page=0 chnl=15 +char id=71 x=417 y=0 width=25 height=45 xoffset=1 yoffset=0 xadvance=27 page=0 chnl=15 +char id=72 x=125 y=47 width=23 height=45 xoffset=2 yoffset=0 xadvance=27 page=0 chnl=15 +char id=73 x=388 y=141 width=8 height=45 xoffset=2 yoffset=0 xadvance=12 page=0 chnl=15 +char id=74 x=200 y=94 width=20 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15 +char id=75 x=251 y=0 width=26 height=45 xoffset=2 yoffset=0 xadvance=27 page=0 chnl=15 +char id=76 x=373 y=94 width=19 height=45 xoffset=2 yoffset=0 xadvance=21 page=0 chnl=15 +char id=77 x=134 y=0 width=28 height=45 xoffset=1 yoffset=0 xadvance=30 page=0 chnl=15 +char id=78 x=100 y=47 width=23 height=45 xoffset=2 yoffset=0 xadvance=27 page=0 chnl=15 +char id=79 x=363 y=0 width=25 height=45 xoffset=1 yoffset=0 xadvance=27 page=0 chnl=15 +char id=80 x=112 y=94 width=20 height=45 xoffset=2 yoffset=0 xadvance=23 page=0 chnl=15 +char id=81 x=335 y=0 width=26 height=45 xoffset=1 yoffset=0 xadvance=27 page=0 chnl=15 +char id=82 x=470 y=0 width=24 height=45 xoffset=2 yoffset=0 xadvance=25 page=0 chnl=15 +char id=83 x=75 y=47 width=23 height=45 xoffset=0 yoffset=0 xadvance=23 page=0 chnl=15 +char id=84 x=50 y=47 width=23 height=45 xoffset=0 yoffset=0 xadvance=23 page=0 chnl=15 +char id=85 x=25 y=47 width=23 height=45 xoffset=2 yoffset=0 xadvance=27 page=0 chnl=15 +char id=86 x=307 y=0 width=26 height=45 xoffset=0 yoffset=0 xadvance=25 page=0 chnl=15 +char id=87 x=0 y=0 width=34 height=45 xoffset=-1 yoffset=0 xadvance=32 page=0 chnl=15 +char id=88 x=222 y=0 width=27 height=45 xoffset=-1 yoffset=0 xadvance=25 page=0 chnl=15 +char id=89 x=164 y=0 width=27 height=45 xoffset=-1 yoffset=0 xadvance=25 page=0 chnl=15 +char id=90 x=0 y=47 width=23 height=45 xoffset=0 yoffset=0 xadvance=23 page=0 chnl=15 +char id=91 x=274 y=141 width=11 height=45 xoffset=1 yoffset=0 xadvance=12 page=0 chnl=15 +char id=92 x=300 y=141 width=10 height=45 xoffset=-1 yoffset=0 xadvance=9 page=0 chnl=15 +char id=93 x=287 y=141 width=11 height=45 xoffset=0 yoffset=0 xadvance=12 page=0 chnl=15 +char id=94 x=457 y=94 width=19 height=45 xoffset=1 yoffset=0 xadvance=21 page=0 chnl=15 +char id=95 x=103 y=141 width=18 height=45 xoffset=-1 yoffset=0 xadvance=16 page=0 chnl=15 +char id=96 x=312 y=141 width=9 height=45 xoffset=0 yoffset=0 xadvance=11 page=0 chnl=15 +char id=97 x=474 y=47 width=21 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15 +char id=98 x=68 y=94 width=20 height=45 xoffset=1 yoffset=0 xadvance=21 page=0 chnl=15 +char id=99 x=267 y=47 width=21 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15 +char id=100 x=46 y=94 width=20 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15 +char id=101 x=198 y=47 width=21 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15 +char id=102 x=141 y=141 width=15 height=45 xoffset=-1 yoffset=0 xadvance=12 page=0 chnl=15 +char id=103 x=222 y=94 width=20 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15 +char id=104 x=415 y=94 width=19 height=45 xoffset=1 yoffset=0 xadvance=21 page=0 chnl=15 +char id=105 x=398 y=141 width=7 height=45 xoffset=2 yoffset=0 xadvance=11 page=0 chnl=15 +char id=106 x=235 y=141 width=11 height=45 xoffset=-2 yoffset=0 xadvance=11 page=0 chnl=15 +char id=107 x=405 y=47 width=21 height=45 xoffset=1 yoffset=0 xadvance=21 page=0 chnl=15 +char id=108 x=407 y=141 width=7 height=45 xoffset=2 yoffset=0 xadvance=11 page=0 chnl=15 +char id=109 x=102 y=0 width=30 height=45 xoffset=1 yoffset=0 xadvance=32 page=0 chnl=15 +char id=110 x=331 y=94 width=19 height=45 xoffset=1 yoffset=0 xadvance=21 page=0 chnl=15 +char id=111 x=428 y=47 width=21 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15 +char id=112 x=266 y=94 width=20 height=45 xoffset=1 yoffset=0 xadvance=21 page=0 chnl=15 +char id=113 x=288 y=94 width=20 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15 +char id=114 x=158 y=141 width=15 height=45 xoffset=1 yoffset=0 xadvance=14 page=0 chnl=15 +char id=115 x=244 y=94 width=20 height=45 xoffset=0 yoffset=0 xadvance=20 page=0 chnl=15 +char id=116 x=175 y=141 width=14 height=45 xoffset=0 yoffset=0 xadvance=14 page=0 chnl=15 +char id=117 x=436 y=94 width=19 height=45 xoffset=1 yoffset=0 xadvance=21 page=0 chnl=15 +char id=118 x=451 y=47 width=21 height=45 xoffset=0 yoffset=0 xadvance=20 page=0 chnl=15 +char id=119 x=36 y=0 width=32 height=45 xoffset=-1 yoffset=0 xadvance=30 page=0 chnl=15 +char id=120 x=0 y=94 width=21 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15 +char id=121 x=23 y=94 width=21 height=45 xoffset=0 yoffset=0 xadvance=20 page=0 chnl=15 +char id=122 x=83 y=141 width=18 height=45 xoffset=0 yoffset=0 xadvance=18 page=0 chnl=15 +char id=123 x=191 y=141 width=14 height=45 xoffset=-1 yoffset=0 xadvance=12 page=0 chnl=15 +char id=124 x=416 y=141 width=5 height=45 xoffset=2 yoffset=0 xadvance=9 page=0 chnl=15 +char id=125 x=207 y=141 width=13 height=45 xoffset=0 yoffset=0 xadvance=12 page=0 chnl=15 +char id=126 x=42 y=141 width=19 height=45 xoffset=1 yoffset=0 xadvance=21 page=0 chnl=15 diff --git a/ExampleApplication/bin/Debug/resources/bmfont.png b/ExampleApplication/bin/Debug/resources/bmfont.png new file mode 100644 index 0000000..9d62159 Binary files /dev/null and b/ExampleApplication/bin/Debug/resources/bmfont.png differ diff --git a/ExampleApplication/bin/Debug/resources/cat.png b/ExampleApplication/bin/Debug/resources/cat.png new file mode 100644 index 0000000..d023aa2 Binary files /dev/null and b/ExampleApplication/bin/Debug/resources/cat.png differ diff --git a/ExampleApplication/bin/Debug/resources/chiptun1.mod b/ExampleApplication/bin/Debug/resources/chiptun1.mod new file mode 100644 index 0000000..00d1688 Binary files /dev/null and b/ExampleApplication/bin/Debug/resources/chiptun1.mod differ diff --git a/ExampleApplication/bin/Debug/resources/coin.wav b/ExampleApplication/bin/Debug/resources/coin.wav new file mode 100644 index 0000000..6007509 Binary files /dev/null and b/ExampleApplication/bin/Debug/resources/coin.wav differ diff --git a/ExampleApplication/bin/Debug/resources/cubicmap.png b/ExampleApplication/bin/Debug/resources/cubicmap.png new file mode 100644 index 0000000..b361c01 Binary files /dev/null and b/ExampleApplication/bin/Debug/resources/cubicmap.png differ diff --git a/ExampleApplication/bin/Debug/resources/cubicmap_atlas.png b/ExampleApplication/bin/Debug/resources/cubicmap_atlas.png new file mode 100644 index 0000000..7ddfc83 Binary files /dev/null and b/ExampleApplication/bin/Debug/resources/cubicmap_atlas.png differ diff --git a/ExampleApplication/bin/Debug/resources/custom_alagard.png b/ExampleApplication/bin/Debug/resources/custom_alagard.png new file mode 100644 index 0000000..c3eb63b Binary files /dev/null and b/ExampleApplication/bin/Debug/resources/custom_alagard.png differ diff --git a/ExampleApplication/bin/Debug/resources/custom_jupiter_crash.png b/ExampleApplication/bin/Debug/resources/custom_jupiter_crash.png new file mode 100644 index 0000000..451b591 Binary files /dev/null and b/ExampleApplication/bin/Debug/resources/custom_jupiter_crash.png differ diff --git a/ExampleApplication/bin/Debug/resources/custom_mecha.png b/ExampleApplication/bin/Debug/resources/custom_mecha.png new file mode 100644 index 0000000..59caab2 Binary files /dev/null and b/ExampleApplication/bin/Debug/resources/custom_mecha.png differ diff --git a/ExampleApplication/bin/Debug/resources/dresden_square.hdr b/ExampleApplication/bin/Debug/resources/dresden_square.hdr new file mode 100644 index 0000000..b6d0e77 Binary files /dev/null and b/ExampleApplication/bin/Debug/resources/dresden_square.hdr differ diff --git a/ExampleApplication/bin/Debug/resources/fonts/alagard.png b/ExampleApplication/bin/Debug/resources/fonts/alagard.png new file mode 100644 index 0000000..3ac4bf1 Binary files /dev/null and b/ExampleApplication/bin/Debug/resources/fonts/alagard.png differ diff --git a/ExampleApplication/bin/Debug/resources/fonts/alpha_beta.png b/ExampleApplication/bin/Debug/resources/fonts/alpha_beta.png new file mode 100644 index 0000000..c362bfb Binary files /dev/null and b/ExampleApplication/bin/Debug/resources/fonts/alpha_beta.png differ diff --git a/ExampleApplication/bin/Debug/resources/fonts/jupiter_crash.png b/ExampleApplication/bin/Debug/resources/fonts/jupiter_crash.png new file mode 100644 index 0000000..1f5172f Binary files /dev/null and b/ExampleApplication/bin/Debug/resources/fonts/jupiter_crash.png differ diff --git a/ExampleApplication/bin/Debug/resources/fonts/mecha.png b/ExampleApplication/bin/Debug/resources/fonts/mecha.png new file mode 100644 index 0000000..8022d18 Binary files /dev/null and b/ExampleApplication/bin/Debug/resources/fonts/mecha.png differ diff --git a/ExampleApplication/bin/Debug/resources/fonts/pixantiqua.png b/ExampleApplication/bin/Debug/resources/fonts/pixantiqua.png new file mode 100644 index 0000000..ce422e7 Binary files /dev/null and b/ExampleApplication/bin/Debug/resources/fonts/pixantiqua.png differ diff --git a/ExampleApplication/bin/Debug/resources/fonts/pixelplay.png b/ExampleApplication/bin/Debug/resources/fonts/pixelplay.png new file mode 100644 index 0000000..bf8f881 Binary files /dev/null and b/ExampleApplication/bin/Debug/resources/fonts/pixelplay.png differ diff --git a/ExampleApplication/bin/Debug/resources/fonts/romulus.png b/ExampleApplication/bin/Debug/resources/fonts/romulus.png new file mode 100644 index 0000000..46ccc32 Binary files /dev/null and b/ExampleApplication/bin/Debug/resources/fonts/romulus.png differ diff --git a/ExampleApplication/bin/Debug/resources/fonts/setback.png b/ExampleApplication/bin/Debug/resources/fonts/setback.png new file mode 100644 index 0000000..086f3e2 Binary files /dev/null and b/ExampleApplication/bin/Debug/resources/fonts/setback.png differ diff --git a/ExampleApplication/bin/Debug/resources/fudesumi.png b/ExampleApplication/bin/Debug/resources/fudesumi.png new file mode 100644 index 0000000..9d9038f Binary files /dev/null and b/ExampleApplication/bin/Debug/resources/fudesumi.png differ diff --git a/ExampleApplication/bin/Debug/resources/fudesumi.raw b/ExampleApplication/bin/Debug/resources/fudesumi.raw new file mode 100644 index 0000000..dad6ff0 Binary files /dev/null and b/ExampleApplication/bin/Debug/resources/fudesumi.raw differ diff --git a/ExampleApplication/bin/Debug/resources/guitar_noodling.ogg b/ExampleApplication/bin/Debug/resources/guitar_noodling.ogg new file mode 100644 index 0000000..f502204 Binary files /dev/null and b/ExampleApplication/bin/Debug/resources/guitar_noodling.ogg differ diff --git a/ExampleApplication/bin/Debug/resources/heightmap.png b/ExampleApplication/bin/Debug/resources/heightmap.png new file mode 100644 index 0000000..fe30f67 Binary files /dev/null and b/ExampleApplication/bin/Debug/resources/heightmap.png differ diff --git a/ExampleApplication/bin/Debug/resources/mini1111.xm b/ExampleApplication/bin/Debug/resources/mini1111.xm new file mode 100644 index 0000000..a185c1a Binary files /dev/null and b/ExampleApplication/bin/Debug/resources/mini1111.xm differ diff --git a/ExampleApplication/bin/Debug/resources/models/barracks_diffuse.png b/ExampleApplication/bin/Debug/resources/models/barracks_diffuse.png new file mode 100644 index 0000000..25a3658 Binary files /dev/null and b/ExampleApplication/bin/Debug/resources/models/barracks_diffuse.png differ diff --git a/ExampleApplication/bin/Debug/resources/models/church_diffuse.png b/ExampleApplication/bin/Debug/resources/models/church_diffuse.png new file mode 100644 index 0000000..7399846 Binary files /dev/null and b/ExampleApplication/bin/Debug/resources/models/church_diffuse.png differ diff --git a/ExampleApplication/bin/Debug/resources/models/watermill_diffuse.png b/ExampleApplication/bin/Debug/resources/models/watermill_diffuse.png new file mode 100644 index 0000000..7064956 Binary files /dev/null and b/ExampleApplication/bin/Debug/resources/models/watermill_diffuse.png differ diff --git a/ExampleApplication/bin/Debug/resources/parrots.png b/ExampleApplication/bin/Debug/resources/parrots.png new file mode 100644 index 0000000..d6ec60b Binary files /dev/null and b/ExampleApplication/bin/Debug/resources/parrots.png differ diff --git a/ExampleApplication/bin/Debug/resources/pbr/trooper_albedo.png b/ExampleApplication/bin/Debug/resources/pbr/trooper_albedo.png new file mode 100644 index 0000000..ac1422e Binary files /dev/null and b/ExampleApplication/bin/Debug/resources/pbr/trooper_albedo.png differ diff --git a/ExampleApplication/bin/Debug/resources/pbr/trooper_ao.png b/ExampleApplication/bin/Debug/resources/pbr/trooper_ao.png new file mode 100644 index 0000000..8567f7b Binary files /dev/null and b/ExampleApplication/bin/Debug/resources/pbr/trooper_ao.png differ diff --git a/ExampleApplication/bin/Debug/resources/pbr/trooper_metalness.png b/ExampleApplication/bin/Debug/resources/pbr/trooper_metalness.png new file mode 100644 index 0000000..6c212a0 Binary files /dev/null and b/ExampleApplication/bin/Debug/resources/pbr/trooper_metalness.png differ diff --git a/ExampleApplication/bin/Debug/resources/pbr/trooper_normals.png b/ExampleApplication/bin/Debug/resources/pbr/trooper_normals.png new file mode 100644 index 0000000..59c7bdc Binary files /dev/null and b/ExampleApplication/bin/Debug/resources/pbr/trooper_normals.png differ diff --git a/ExampleApplication/bin/Debug/resources/pbr/trooper_roughness.png b/ExampleApplication/bin/Debug/resources/pbr/trooper_roughness.png new file mode 100644 index 0000000..53186d5 Binary files /dev/null and b/ExampleApplication/bin/Debug/resources/pbr/trooper_roughness.png differ diff --git a/ExampleApplication/bin/Debug/resources/pitch.png b/ExampleApplication/bin/Debug/resources/pitch.png new file mode 100644 index 0000000..6d7a233 Binary files /dev/null and b/ExampleApplication/bin/Debug/resources/pitch.png differ diff --git a/ExampleApplication/bin/Debug/resources/pixantiqua.fnt b/ExampleApplication/bin/Debug/resources/pixantiqua.fnt new file mode 100644 index 0000000..971b9b0 --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/pixantiqua.fnt @@ -0,0 +1,188 @@ +info face="PixAntiqua" size=32 bold=0 italic=0 charset="" unicode=1 stretchH=100 smooth=1 aa=1 padding=2,2,2,2 spacing=2,2 outline=0 +common lineHeight=32 base=27 scaleW=512 scaleH=512 pages=1 packed=0 alphaChnl=0 redChnl=4 greenChnl=4 blueChnl=4 +page id=0 file="pixantiqua_0.png" +chars count=184 +char id=32 x=9 y=304 width=7 height=36 xoffset=-3 yoffset=-2 xadvance=8 page=0 chnl=15 +char id=33 x=391 y=266 width=11 height=36 xoffset=-3 yoffset=-2 xadvance=8 page=0 chnl=15 +char id=34 x=240 y=266 width=14 height=36 xoffset=-3 yoffset=-2 xadvance=11 page=0 chnl=15 +char id=35 x=468 y=38 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15 +char id=36 x=152 y=76 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=37 x=176 y=76 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=38 x=303 y=0 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15 +char id=39 x=495 y=266 width=8 height=36 xoffset=-3 yoffset=-2 xadvance=5 page=0 chnl=15 +char id=40 x=256 y=266 width=14 height=36 xoffset=-3 yoffset=-2 xadvance=11 page=0 chnl=15 +char id=199 x=432 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=200 x=126 y=228 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15 +char id=201 x=147 y=228 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15 +char id=202 x=288 y=190 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15 +char id=203 x=189 y=228 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15 +char id=204 x=468 y=228 width=16 height=36 xoffset=-3 yoffset=-2 xadvance=13 page=0 chnl=15 +char id=205 x=486 y=228 width=16 height=36 xoffset=-3 yoffset=-2 xadvance=13 page=0 chnl=15 +char id=206 x=0 y=266 width=16 height=36 xoffset=-3 yoffset=-2 xadvance=13 page=0 chnl=15 +char id=207 x=72 y=266 width=16 height=36 xoffset=-3 yoffset=-2 xadvance=13 page=0 chnl=15 +char id=208 x=329 y=0 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15 +char id=209 x=277 y=0 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15 +char id=210 x=182 y=38 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15 +char id=211 x=26 y=76 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15 +char id=41 x=272 y=266 width=14 height=36 xoffset=-3 yoffset=-2 xadvance=11 page=0 chnl=15 +char id=42 x=288 y=266 width=14 height=36 xoffset=-3 yoffset=-2 xadvance=11 page=0 chnl=15 +char id=43 x=414 y=190 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15 +char id=44 x=378 y=266 width=11 height=36 xoffset=-3 yoffset=-2 xadvance=8 page=0 chnl=15 +char id=45 x=414 y=228 width=16 height=36 xoffset=-3 yoffset=-2 xadvance=13 page=0 chnl=15 +char id=46 x=443 y=266 width=11 height=36 xoffset=-3 yoffset=-2 xadvance=8 page=0 chnl=15 +char id=47 x=392 y=76 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=48 x=485 y=0 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15 +char id=49 x=450 y=228 width=16 height=36 xoffset=-3 yoffset=-2 xadvance=13 page=0 chnl=15 +char id=50 x=21 y=228 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15 +char id=51 x=42 y=228 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15 +char id=59 x=456 y=266 width=11 height=36 xoffset=-3 yoffset=-2 xadvance=8 page=0 chnl=15 +char id=60 x=168 y=228 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15 +char id=61 x=309 y=190 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15 +char id=62 x=336 y=228 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15 +char id=63 x=315 y=228 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15 +char id=64 x=364 y=38 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15 +char id=65 x=390 y=38 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15 +char id=66 x=120 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=67 x=144 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=68 x=168 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=69 x=294 y=228 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15 +char id=52 x=488 y=76 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=53 x=63 y=228 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15 +char id=54 x=24 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=55 x=48 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=56 x=72 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=57 x=96 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=58 x=404 y=266 width=11 height=36 xoffset=-3 yoffset=-2 xadvance=8 page=0 chnl=15 +char id=70 x=252 y=228 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15 +char id=71 x=192 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=72 x=78 y=76 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15 +char id=78 x=78 y=38 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15 +char id=79 x=355 y=0 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15 +char id=80 x=264 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=81 x=381 y=0 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15 +char id=82 x=288 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=83 x=312 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=91 x=144 y=266 width=14 height=36 xoffset=-3 yoffset=-2 xadvance=11 page=0 chnl=15 +char id=92 x=108 y=266 width=16 height=36 xoffset=-3 yoffset=-2 xadvance=13 page=0 chnl=15 +char id=93 x=304 y=266 width=14 height=36 xoffset=-3 yoffset=-2 xadvance=11 page=0 chnl=15 +char id=94 x=34 y=0 width=32 height=36 xoffset=-3 yoffset=-2 xadvance=29 page=0 chnl=15 +char id=95 x=231 y=228 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15 +char id=96 x=442 y=38 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15 +char id=97 x=408 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=98 x=432 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=99 x=210 y=228 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15 +char id=84 x=336 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=85 x=360 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=86 x=0 y=38 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15 +char id=87 x=68 y=0 width=30 height=36 xoffset=-3 yoffset=-2 xadvance=27 page=0 chnl=15 +char id=88 x=26 y=38 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15 +char id=89 x=384 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=90 x=84 y=228 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15 +char id=100 x=456 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=101 x=480 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=102 x=54 y=266 width=16 height=36 xoffset=-3 yoffset=-2 xadvance=13 page=0 chnl=15 +char id=103 x=0 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=104 x=24 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=105 x=469 y=266 width=11 height=36 xoffset=-3 yoffset=-2 xadvance=8 page=0 chnl=15 +char id=106 x=18 y=266 width=16 height=36 xoffset=-8 yoffset=-2 xadvance=8 page=0 chnl=15 +char id=107 x=48 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=108 x=417 y=266 width=11 height=36 xoffset=-3 yoffset=-2 xadvance=8 page=0 chnl=15 +char id=109 x=161 y=0 width=27 height=36 xoffset=-3 yoffset=-2 xadvance=24 page=0 chnl=15 +char id=110 x=72 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=111 x=96 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=117 x=192 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=118 x=216 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=119 x=248 y=0 width=27 height=36 xoffset=-3 yoffset=-2 xadvance=24 page=0 chnl=15 +char id=120 x=240 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=121 x=264 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=122 x=288 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=123 x=432 y=228 width=16 height=36 xoffset=-3 yoffset=-2 xadvance=13 page=0 chnl=15 +char id=124 x=365 y=266 width=11 height=36 xoffset=-3 yoffset=-2 xadvance=8 page=0 chnl=15 +char id=125 x=378 y=228 width=16 height=36 xoffset=-3 yoffset=-2 xadvance=13 page=0 chnl=15 +char id=126 x=393 y=190 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15 +char id=127 x=132 y=0 width=27 height=36 xoffset=-3 yoffset=-2 xadvance=24 page=0 chnl=15 +char id=160 x=0 y=304 width=7 height=36 xoffset=-3 yoffset=-2 xadvance=8 page=0 chnl=15 +char id=161 x=352 y=266 width=11 height=36 xoffset=-3 yoffset=-2 xadvance=8 page=0 chnl=15 +char id=162 x=351 y=190 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15 +char id=163 x=336 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=165 x=360 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=167 x=384 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=169 x=433 y=0 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15 +char id=170 x=224 y=266 width=14 height=36 xoffset=-3 yoffset=-2 xadvance=11 page=0 chnl=15 +char id=171 x=105 y=228 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15 +char id=172 x=0 y=0 width=32 height=36 xoffset=-3 yoffset=-2 xadvance=29 page=0 chnl=15 +char id=173 x=494 y=38 width=16 height=36 xoffset=-3 yoffset=-2 xadvance=13 page=0 chnl=15 +char id=174 x=52 y=76 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15 +char id=175 x=52 y=38 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15 +char id=176 x=126 y=266 width=16 height=36 xoffset=-3 yoffset=-2 xadvance=13 page=0 chnl=15 +char id=177 x=435 y=190 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15 +char id=178 x=320 y=266 width=14 height=36 xoffset=-3 yoffset=-2 xadvance=11 page=0 chnl=15 +char id=179 x=336 y=266 width=14 height=36 xoffset=-3 yoffset=-2 xadvance=11 page=0 chnl=15 +char id=181 x=459 y=0 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15 +char id=112 x=120 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=113 x=144 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=114 x=396 y=228 width=16 height=36 xoffset=-3 yoffset=-2 xadvance=13 page=0 chnl=15 +char id=115 x=168 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=116 x=36 y=266 width=16 height=36 xoffset=-3 yoffset=-2 xadvance=13 page=0 chnl=15 +char id=182 x=408 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=183 x=498 y=190 width=11 height=36 xoffset=-3 yoffset=-2 xadvance=8 page=0 chnl=15 +char id=185 x=192 y=266 width=14 height=36 xoffset=-3 yoffset=-2 xadvance=11 page=0 chnl=15 +char id=186 x=208 y=266 width=14 height=36 xoffset=-3 yoffset=-2 xadvance=11 page=0 chnl=15 +char id=187 x=477 y=190 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15 +char id=191 x=456 y=190 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15 +char id=192 x=407 y=0 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15 +char id=193 x=234 y=38 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15 +char id=194 x=416 y=38 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15 +char id=195 x=156 y=38 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15 +char id=196 x=130 y=38 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15 +char id=197 x=104 y=38 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15 +char id=198 x=190 y=0 width=27 height=36 xoffset=-3 yoffset=-2 xadvance=24 page=0 chnl=15 +char id=212 x=0 y=76 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15 +char id=213 x=338 y=38 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15 +char id=214 x=312 y=38 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15 +char id=215 x=357 y=228 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15 +char id=216 x=286 y=38 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15 +char id=217 x=456 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=218 x=480 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=219 x=0 y=190 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=220 x=24 y=190 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=221 x=48 y=190 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=222 x=260 y=38 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15 +char id=223 x=72 y=190 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=224 x=96 y=190 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=225 x=120 y=190 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=226 x=144 y=190 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=227 x=168 y=190 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=228 x=192 y=190 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=229 x=216 y=190 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=230 x=219 y=0 width=27 height=36 xoffset=-3 yoffset=-2 xadvance=24 page=0 chnl=15 +char id=231 x=372 y=190 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15 +char id=73 x=90 y=266 width=16 height=36 xoffset=-3 yoffset=-2 xadvance=13 page=0 chnl=15 +char id=74 x=216 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=75 x=240 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=76 x=273 y=228 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15 +char id=77 x=100 y=0 width=30 height=36 xoffset=-3 yoffset=-2 xadvance=27 page=0 chnl=15 +char id=232 x=312 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=233 x=240 y=190 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=234 x=264 y=190 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=235 x=104 y=76 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=236 x=430 y=266 width=11 height=36 xoffset=-3 yoffset=-2 xadvance=8 page=0 chnl=15 +char id=237 x=482 y=266 width=11 height=36 xoffset=-3 yoffset=-2 xadvance=8 page=0 chnl=15 +char id=238 x=160 y=266 width=14 height=36 xoffset=-3 yoffset=-2 xadvance=11 page=0 chnl=15 +char id=239 x=176 y=266 width=14 height=36 xoffset=-3 yoffset=-2 xadvance=8 page=0 chnl=15 +char id=240 x=128 y=76 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=241 x=200 y=76 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=242 x=224 y=76 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=243 x=248 y=76 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=244 x=272 y=76 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=245 x=296 y=76 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=246 x=320 y=76 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=247 x=330 y=190 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15 +char id=248 x=208 y=38 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15 +char id=249 x=344 y=76 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=250 x=368 y=76 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=251 x=416 y=76 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=252 x=440 y=76 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=253 x=464 y=76 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 +char id=254 x=0 y=228 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15 +char id=255 x=0 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15 diff --git a/ExampleApplication/bin/Debug/resources/pixantiqua.ttf b/ExampleApplication/bin/Debug/resources/pixantiqua.ttf new file mode 100644 index 0000000..e012875 Binary files /dev/null and b/ExampleApplication/bin/Debug/resources/pixantiqua.ttf differ diff --git a/ExampleApplication/bin/Debug/resources/pixantiqua_0.png b/ExampleApplication/bin/Debug/resources/pixantiqua_0.png new file mode 100644 index 0000000..2aa2870 Binary files /dev/null and b/ExampleApplication/bin/Debug/resources/pixantiqua_0.png differ diff --git a/ExampleApplication/bin/Debug/resources/plane.png b/ExampleApplication/bin/Debug/resources/plane.png new file mode 100644 index 0000000..58951ea Binary files /dev/null and b/ExampleApplication/bin/Debug/resources/plane.png differ diff --git a/ExampleApplication/bin/Debug/resources/plane_diffuse.png b/ExampleApplication/bin/Debug/resources/plane_diffuse.png new file mode 100644 index 0000000..fb16f24 Binary files /dev/null and b/ExampleApplication/bin/Debug/resources/plane_diffuse.png differ diff --git a/ExampleApplication/bin/Debug/resources/ps3.png b/ExampleApplication/bin/Debug/resources/ps3.png new file mode 100644 index 0000000..98befac Binary files /dev/null and b/ExampleApplication/bin/Debug/resources/ps3.png differ diff --git a/ExampleApplication/bin/Debug/resources/raylib_logo.png b/ExampleApplication/bin/Debug/resources/raylib_logo.png new file mode 100644 index 0000000..6654562 Binary files /dev/null and b/ExampleApplication/bin/Debug/resources/raylib_logo.png differ diff --git a/ExampleApplication/bin/Debug/resources/scarfy.png b/ExampleApplication/bin/Debug/resources/scarfy.png new file mode 100644 index 0000000..beb5ffa Binary files /dev/null and b/ExampleApplication/bin/Debug/resources/scarfy.png differ diff --git a/ExampleApplication/bin/Debug/resources/shaders/brdf.fs b/ExampleApplication/bin/Debug/resources/shaders/brdf.fs new file mode 100644 index 0000000..59ae384 --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/shaders/brdf.fs @@ -0,0 +1,140 @@ +/******************************************************************************************* +* +* rPBR [shader] - Bidirectional reflectance distribution function fragment shader +* +* Copyright (c) 2017 Victor Fisac +* +**********************************************************************************************/ + +#version 330 +#define MAX_SAMPLES 1024u + +// Input vertex attributes (from vertex shader) +in vec2 fragTexCoord; + +// Constant values +const float PI = 3.14159265359; + +// Output fragment color +out vec4 finalColor; + +float DistributionGGX(vec3 N, vec3 H, float roughness); +float RadicalInverse_VdC(uint bits); +vec2 Hammersley(uint i, uint N); +vec3 ImportanceSampleGGX(vec2 Xi, vec3 N, float roughness); +float GeometrySchlickGGX(float NdotV, float roughness); +float GeometrySmith(vec3 N, vec3 V, vec3 L, float roughness); +vec2 IntegrateBRDF(float NdotV, float roughness); + +float DistributionGGX(vec3 N, vec3 H, float roughness) +{ + float a = roughness*roughness; + float a2 = a*a; + float NdotH = max(dot(N, H), 0.0); + float NdotH2 = NdotH*NdotH; + + float nom = a2; + float denom = (NdotH2*(a2 - 1.0) + 1.0); + denom = PI*denom*denom; + + return nom/denom; +} + +float RadicalInverse_VdC(uint bits) +{ + bits = (bits << 16u) | (bits >> 16u); + bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u); + bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u); + bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u); + bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u); + return float(bits) * 2.3283064365386963e-10; // / 0x100000000 +} + +vec2 Hammersley(uint i, uint N) +{ + return vec2(float(i)/float(N), RadicalInverse_VdC(i)); +} + +vec3 ImportanceSampleGGX(vec2 Xi, vec3 N, float roughness) +{ + float a = roughness*roughness; + float phi = 2.0 * PI * Xi.x; + float cosTheta = sqrt((1.0 - Xi.y)/(1.0 + (a*a - 1.0)*Xi.y)); + float sinTheta = sqrt(1.0 - cosTheta*cosTheta); + + // Transform from spherical coordinates to cartesian coordinates (halfway vector) + vec3 H = vec3(cos(phi)*sinTheta, sin(phi)*sinTheta, cosTheta); + + // Transform from tangent space H vector to world space sample vector + vec3 up = ((abs(N.z) < 0.999) ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0)); + vec3 tangent = normalize(cross(up, N)); + vec3 bitangent = cross(N, tangent); + vec3 sampleVec = tangent*H.x + bitangent*H.y + N*H.z; + + return normalize(sampleVec); +} + +float GeometrySchlickGGX(float NdotV, float roughness) +{ + // For IBL k is calculated different + float k = (roughness*roughness)/2.0; + + float nom = NdotV; + float denom = NdotV*(1.0 - k) + k; + + return nom/denom; +} + +float GeometrySmith(vec3 N, vec3 V, vec3 L, float roughness) +{ + float NdotV = max(dot(N, V), 0.0); + float NdotL = max(dot(N, L), 0.0); + float ggx2 = GeometrySchlickGGX(NdotV, roughness); + float ggx1 = GeometrySchlickGGX(NdotL, roughness); + + return ggx1*ggx2; +} + +vec2 IntegrateBRDF(float NdotV, float roughness) +{ + vec3 V = vec3(sqrt(1.0 - NdotV*NdotV), 0.0, NdotV); + float A = 0.0; + float B = 0.0; + vec3 N = vec3(0.0, 0.0, 1.0); + + for(uint i = 0u; i < MAX_SAMPLES; i++) + { + // Generate a sample vector that's biased towards the preferred alignment direction (importance sampling) + vec2 Xi = Hammersley(i, MAX_SAMPLES); + vec3 H = ImportanceSampleGGX(Xi, N, roughness); + vec3 L = normalize(2.0*dot(V, H)*H - V); + float NdotL = max(L.z, 0.0); + float NdotH = max(H.z, 0.0); + float VdotH = max(dot(V, H), 0.0); + + if (NdotL > 0.0) + { + float G = GeometrySmith(N, V, L, roughness); + float G_Vis = (G*VdotH)/(NdotH*NdotV); + float Fc = pow(1.0 - VdotH, 5.0); + + A += (1.0 - Fc)*G_Vis; + B += Fc*G_Vis; + } + } + + // Calculate brdf average sample + A /= float(MAX_SAMPLES); + B /= float(MAX_SAMPLES); + + return vec2(A, B); +} + +void main() +{ + // Calculate brdf based on texture coordinates + vec2 brdf = IntegrateBRDF(fragTexCoord.x, fragTexCoord.y); + + // Calculate final fragment color + finalColor = vec4(brdf.r, brdf.g, 0.0, 1.0); +} diff --git a/ExampleApplication/bin/Debug/resources/shaders/brdf.vs b/ExampleApplication/bin/Debug/resources/shaders/brdf.vs new file mode 100644 index 0000000..0638467 --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/shaders/brdf.vs @@ -0,0 +1,25 @@ +/******************************************************************************************* +* +* rPBR [shader] - Bidirectional reflectance distribution function vertex shader +* +* Copyright (c) 2017 Victor Fisac +* +**********************************************************************************************/ + +#version 330 + +// Input vertex attributes +in vec3 vertexPosition; +in vec2 vertexTexCoord; + +// Output vertex attributes (to fragment shader) +out vec2 fragTexCoord; + +void main() +{ + // Calculate fragment position based on model transformations + fragTexCoord = vertexTexCoord; + + // Calculate final vertex position + gl_Position = vec4(vertexPosition, 1.0); +} \ No newline at end of file diff --git a/ExampleApplication/bin/Debug/resources/shaders/cubemap.fs b/ExampleApplication/bin/Debug/resources/shaders/cubemap.fs new file mode 100644 index 0000000..09ae62f --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/shaders/cubemap.fs @@ -0,0 +1,38 @@ +/******************************************************************************************* +* +* rPBR [shader] - Equirectangular to cubemap fragment shader +* +* Copyright (c) 2017 Victor Fisac +* +**********************************************************************************************/ + +#version 330 + +// Input vertex attributes (from vertex shader) +in vec3 fragPos; + +// Input uniform values +uniform sampler2D equirectangularMap; + +// Output fragment color +out vec4 finalColor; + +vec2 SampleSphericalMap(vec3 v) +{ + vec2 uv = vec2(atan(v.z, v.x), asin(v.y)); + uv *= vec2(0.1591, 0.3183); + uv += 0.5; + return uv; +} + +void main() +{ + // Normalize local position + vec2 uv = SampleSphericalMap(normalize(fragPos)); + + // Fetch color from texture map + vec3 color = texture(equirectangularMap, uv).rgb; + + // Calculate final fragment color + finalColor = vec4(color, 1.0); +} diff --git a/ExampleApplication/bin/Debug/resources/shaders/cubemap.vs b/ExampleApplication/bin/Debug/resources/shaders/cubemap.vs new file mode 100644 index 0000000..6e0bf4e --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/shaders/cubemap.vs @@ -0,0 +1,28 @@ +/******************************************************************************************* +* +* rPBR [shader] - Equirectangular to cubemap vertex shader +* +* Copyright (c) 2017 Victor Fisac +* +**********************************************************************************************/ + +#version 330 + +// Input vertex attributes +in vec3 vertexPosition; + +// Input uniform values +uniform mat4 projection; +uniform mat4 view; + +// Output vertex attributes (to fragment shader) +out vec3 fragPos; + +void main() +{ + // Calculate fragment position based on model transformations + fragPos = vertexPosition; + + // Calculate final vertex position + gl_Position = projection*view*vec4(vertexPosition, 1.0); +} diff --git a/ExampleApplication/bin/Debug/resources/shaders/glsl100/base.fs b/ExampleApplication/bin/Debug/resources/shaders/glsl100/base.fs new file mode 100644 index 0000000..b004ba0 --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/shaders/glsl100/base.fs @@ -0,0 +1,24 @@ +#version 100 + +precision mediump float; + +// Input vertex attributes (from vertex shader) +varying vec2 fragTexCoord; +varying vec4 fragColor; + +// Input uniform values +uniform sampler2D texture0; +uniform vec4 colDiffuse; + +// NOTE: Add here your custom variables +uniform vec2 resolution = vec2(800, 450); + +void main() +{ + // Texel color fetching from texture sampler + vec4 texelColor = texture2D(texture0, fragTexCoord); + + // NOTE: Implement here your fragment shader code + + gl_FragColor = texelColor*colDiffuse; +} \ No newline at end of file diff --git a/ExampleApplication/bin/Debug/resources/shaders/glsl100/base.vs b/ExampleApplication/bin/Debug/resources/shaders/glsl100/base.vs new file mode 100644 index 0000000..4be76b9 --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/shaders/glsl100/base.vs @@ -0,0 +1,26 @@ +#version 100 + +// Input vertex attributes +attribute vec3 vertexPosition; +attribute vec2 vertexTexCoord; +attribute vec3 vertexNormal; +attribute vec4 vertexColor; + +// Input uniform values +uniform mat4 mvp; + +// Output vertex attributes (to fragment shader) +varying vec2 fragTexCoord; +varying vec4 fragColor; + +// NOTE: Add here your custom variables + +void main() +{ + // Send vertex attributes to fragment shader + fragTexCoord = vertexTexCoord; + fragColor = vertexColor; + + // Calculate final vertex position + gl_Position = mvp*vec4(vertexPosition, 1.0); +} \ No newline at end of file diff --git a/ExampleApplication/bin/Debug/resources/shaders/glsl100/bloom.fs b/ExampleApplication/bin/Debug/resources/shaders/glsl100/bloom.fs new file mode 100644 index 0000000..a8e1d20 --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/shaders/glsl100/bloom.fs @@ -0,0 +1,39 @@ +#version 100 + +precision mediump float; + +// Input vertex attributes (from vertex shader) +varying vec2 fragTexCoord; +varying vec4 fragColor; + +// Input uniform values +uniform sampler2D texture0; +uniform vec4 colDiffuse; + +// NOTE: Add here your custom variables + +const vec2 size = vec2(800, 450); // render size +const float samples = 5.0; // pixels per axis; higher = bigger glow, worse performance +const float quality = 2.5; // lower = smaller glow, better quality + +void main() +{ + vec4 sum = vec4(0); + vec2 sizeFactor = vec2(1)/size*quality; + + // Texel color fetching from texture sampler + vec4 source = texture2D(texture0, fragTexCoord); + + const int range = 2; // should be = (samples - 1)/2; + + for (int x = -range; x <= range; x++) + { + for (int y = -range; y <= range; y++) + { + sum += texture2D(texture0, fragTexCoord + vec2(x, y)*sizeFactor); + } + } + + // Calculate final fragment color + gl_FragColor = ((sum/(samples*samples)) + source)*colDiffuse; +} \ No newline at end of file diff --git a/ExampleApplication/bin/Debug/resources/shaders/glsl100/blur.fs b/ExampleApplication/bin/Debug/resources/shaders/glsl100/blur.fs new file mode 100644 index 0000000..96f780e --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/shaders/glsl100/blur.fs @@ -0,0 +1,34 @@ +#version 100 + +precision mediump float; + +// Input vertex attributes (from vertex shader) +varying vec2 fragTexCoord; +varying vec4 fragColor; + +// Input uniform values +uniform sampler2D texture0; +uniform vec4 colDiffuse; + +// NOTE: Add here your custom variables + +// NOTE: Render size values must be passed from code +const float renderWidth = 800.0; +const float renderHeight = 450.0; + +vec3 offset = vec3(0.0, 1.3846153846, 3.2307692308); +vec3 weight = vec3(0.2270270270, 0.3162162162, 0.0702702703); + +void main() +{ + // Texel color fetching from texture sampler + vec3 tc = texture2D(texture0, fragTexCoord).rgb*weight.x; + + tc += texture2D(texture0, fragTexCoord + vec2(offset.y)/renderWidth, 0.0).rgb*weight.y; + tc += texture2D(texture0, fragTexCoord - vec2(offset.y)/renderWidth, 0.0).rgb*weight.y; + + tc += texture2D(texture0, fragTexCoord + vec2(offset.z)/renderWidth, 0.0).rgb*weight.z; + tc += texture2D(texture0, fragTexCoord - vec2(offset.z)/renderWidth, 0.0).rgb*weight.z; + + gl_FragColor = vec4(tc, 1.0); +} \ No newline at end of file diff --git a/ExampleApplication/bin/Debug/resources/shaders/glsl100/cross_hatching.fs b/ExampleApplication/bin/Debug/resources/shaders/glsl100/cross_hatching.fs new file mode 100644 index 0000000..7d63b0a --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/shaders/glsl100/cross_hatching.fs @@ -0,0 +1,47 @@ +# version 100 + +precision mediump float; + +// Input vertex attributes (from vertex shader) +varying vec2 fragTexCoord; +varying vec4 fragColor; + +// Input uniform values +uniform sampler2D texture0; +uniform vec4 colDiffuse; + +// NOTE: Add here your custom variables + +float hatchOffsetY = 5.0; +float lumThreshold01 = 0.9; +float lumThreshold02 = 0.7; +float lumThreshold03 = 0.5; +float lumThreshold04 = 0.3; + +void main() +{ + vec3 tc = vec3(1.0, 1.0, 1.0); + float lum = length(texture2D(texture0, fragTexCoord).rgb); + + if (lum < lumThreshold01) + { + if (mod(gl_FragCoord.x + gl_FragCoord.y, 10.0) == 0.0) tc = vec3(0.0, 0.0, 0.0); + } + + if (lum < lumThreshold02) + { + if (mod(gl_FragCoord .x - gl_FragCoord .y, 10.0) == 0.0) tc = vec3(0.0, 0.0, 0.0); + } + + if (lum < lumThreshold03) + { + if (mod(gl_FragCoord .x + gl_FragCoord .y - hatchOffsetY, 10.0) == 0.0) tc = vec3(0.0, 0.0, 0.0); + } + + if (lum < lumThreshold04) + { + if (mod(gl_FragCoord .x - gl_FragCoord .y - hatchOffsetY, 10.0) == 0.0) tc = vec3(0.0, 0.0, 0.0); + } + + gl_FragColor = vec4(tc, 1.0); +} \ No newline at end of file diff --git a/ExampleApplication/bin/Debug/resources/shaders/glsl100/cross_stitching.fs b/ExampleApplication/bin/Debug/resources/shaders/glsl100/cross_stitching.fs new file mode 100644 index 0000000..de6d4f4 --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/shaders/glsl100/cross_stitching.fs @@ -0,0 +1,57 @@ +# version 100 + +precision mediump float; + +// Input vertex attributes (from vertex shader) +varying vec2 fragTexCoord; +varying vec4 fragColor; + +// Input uniform values +uniform sampler2D texture0; +uniform vec4 colDiffuse; + +// NOTE: Add here your custom variables + +// NOTE: Render size values must be passed from code +const float renderWidth = 800.0; +const float renderHeight = 450.0; + +float stitchingSize = 6.0; +int invert = 0; + +vec4 PostFX(sampler2D tex, vec2 uv) +{ + vec4 c = vec4(0.0); + float size = stitchingSize; + vec2 cPos = uv * vec2(renderWidth, renderHeight); + vec2 tlPos = floor(cPos / vec2(size, size)); + tlPos *= size; + + int remX = int(mod(cPos.x, size)); + int remY = int(mod(cPos.y, size)); + + if (remX == 0 && remY == 0) tlPos = cPos; + + vec2 blPos = tlPos; + blPos.y += (size - 1.0); + + if ((remX == remY) || (((int(cPos.x) - int(blPos.x)) == (int(blPos.y) - int(cPos.y))))) + { + if (invert == 1) c = vec4(0.2, 0.15, 0.05, 1.0); + else c = texture2D(tex, tlPos * vec2(1.0/renderWidth, 1.0/renderHeight)) * 1.4; + } + else + { + if (invert == 1) c = texture2D(tex, tlPos * vec2(1.0/renderWidth, 1.0/renderHeight)) * 1.4; + else c = vec4(0.0, 0.0, 0.0, 1.0); + } + + return c; +} + +void main() +{ + vec3 tc = PostFX(texture0, fragTexCoord).rgb; + + gl_FragColor = vec4(tc, 1.0); +} \ No newline at end of file diff --git a/ExampleApplication/bin/Debug/resources/shaders/glsl100/distortion.fs b/ExampleApplication/bin/Debug/resources/shaders/glsl100/distortion.fs new file mode 100644 index 0000000..50116ce --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/shaders/glsl100/distortion.fs @@ -0,0 +1,54 @@ +#version 100 + +precision mediump float; + +// Input vertex attributes (from vertex shader) +varying vec2 fragTexCoord; + +// Input uniform values +uniform sampler2D texture0; + +// NOTE: Default parameters for Oculus Rift DK2 device +const vec2 LeftLensCenter = vec2(0.2863248, 0.5); +const vec2 RightLensCenter = vec2(0.7136753, 0.5); +const vec2 LeftScreenCenter = vec2(0.25, 0.5); +const vec2 RightScreenCenter = vec2(0.75, 0.5); +const vec2 Scale = vec2(0.25, 0.45); +const vec2 ScaleIn = vec2(4.0, 2.5); +const vec4 HmdWarpParam = vec4(1.0, 0.22, 0.24, 0.0); +const vec4 ChromaAbParam = vec4(0.996, -0.004, 1.014, 0.0); + +void main() +{ + // The following two variables need to be set per eye + vec2 LensCenter = fragTexCoord.x < 0.5 ? LeftLensCenter : RightLensCenter; + vec2 ScreenCenter = fragTexCoord.x < 0.5 ? LeftScreenCenter : RightScreenCenter; + + // Scales input texture coordinates for distortion: vec2 HmdWarp(vec2 fragTexCoord, vec2 LensCenter) + vec2 theta = (fragTexCoord - LensCenter)*ScaleIn; // Scales to [-1, 1] + float rSq = theta.x*theta.x + theta.y*theta.y; + vec2 theta1 = theta*(HmdWarpParam.x + HmdWarpParam.y*rSq + HmdWarpParam.z*rSq*rSq + HmdWarpParam.w*rSq*rSq*rSq); + //vec2 tc = LensCenter + Scale*theta1; + + // Detect whether blue texture coordinates are out of range since these will scaled out the furthest + vec2 thetaBlue = theta1*(ChromaAbParam.z + ChromaAbParam.w*rSq); + vec2 tcBlue = LensCenter + Scale*thetaBlue; + + if (any(bvec2(clamp(tcBlue, ScreenCenter - vec2(0.25, 0.5), ScreenCenter + vec2(0.25, 0.5)) - tcBlue))) gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0); + else + { + // Do blue texture lookup + float blue = texture2D(texture0, tcBlue).b; + + // Do green lookup (no scaling) + vec2 tcGreen = LensCenter + Scale*theta1; + float green = texture2D(texture0, tcGreen).g; + + // Do red scale and lookup + vec2 thetaRed = theta1*(ChromaAbParam.x + ChromaAbParam.y*rSq); + vec2 tcRed = LensCenter + Scale*thetaRed; + float red = texture2D(texture0, tcRed).r; + + gl_FragColor = vec4(red, green, blue, 1.0); + } +} diff --git a/ExampleApplication/bin/Debug/resources/shaders/glsl100/dream_vision.fs b/ExampleApplication/bin/Debug/resources/shaders/glsl100/dream_vision.fs new file mode 100644 index 0000000..fa9c5b7 --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/shaders/glsl100/dream_vision.fs @@ -0,0 +1,37 @@ +#version 100 + +precision mediump float; + +// Input vertex attributes (from vertex shader) +varying vec2 fragTexCoord; +varying vec4 fragColor; + +// Input uniform values +uniform sampler2D texture0; +uniform vec4 colDiffuse; + +// NOTE: Add here your custom variables + +void main() +{ + vec4 color = texture2D(texture0, fragTexCoord); + + color += texture2D(texture0, fragTexCoord + 0.001); + color += texture2D(texture0, fragTexCoord + 0.003); + color += texture2D(texture0, fragTexCoord + 0.005); + color += texture2D(texture0, fragTexCoord + 0.007); + color += texture2D(texture0, fragTexCoord + 0.009); + color += texture2D(texture0, fragTexCoord + 0.011); + + color += texture2D(texture0, fragTexCoord - 0.001); + color += texture2D(texture0, fragTexCoord - 0.003); + color += texture2D(texture0, fragTexCoord - 0.005); + color += texture2D(texture0, fragTexCoord - 0.007); + color += texture2D(texture0, fragTexCoord - 0.009); + color += texture2D(texture0, fragTexCoord - 0.011); + + color.rgb = vec3((color.r + color.g + color.b)/3.0); + color = color/9.5; + + gl_FragColor = color; +} \ No newline at end of file diff --git a/ExampleApplication/bin/Debug/resources/shaders/glsl100/fisheye.fs b/ExampleApplication/bin/Debug/resources/shaders/glsl100/fisheye.fs new file mode 100644 index 0000000..8beb3d4 --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/shaders/glsl100/fisheye.fs @@ -0,0 +1,43 @@ +#version 100 + +precision mediump float; + +// Input vertex attributes (from vertex shader) +varying vec2 fragTexCoord; +varying vec4 fragColor; + +// Input uniform values +uniform sampler2D texture0; +uniform vec4 colDiffuse; + +// NOTE: Add here your custom variables + +const float PI = 3.1415926535; + +void main() +{ + float aperture = 178.0; + float apertureHalf = 0.5 * aperture * (PI / 180.0); + float maxFactor = sin(apertureHalf); + + vec2 uv = vec2(0.0); + vec2 xy = 2.0 * fragTexCoord.xy - 1.0; + float d = length(xy); + + if (d < (2.0 - maxFactor)) + { + d = length(xy * maxFactor); + float z = sqrt(1.0 - d * d); + float r = atan(d, z) / PI; + float phi = atan(xy.y, xy.x); + + uv.x = r * cos(phi) + 0.5; + uv.y = r * sin(phi) + 0.5; + } + else + { + uv = fragTexCoord.xy; + } + + gl_FragColor = texture2D(texture0, uv); +} \ No newline at end of file diff --git a/ExampleApplication/bin/Debug/resources/shaders/glsl100/grayscale.fs b/ExampleApplication/bin/Debug/resources/shaders/glsl100/grayscale.fs new file mode 100644 index 0000000..15174ea --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/shaders/glsl100/grayscale.fs @@ -0,0 +1,25 @@ +#version 100 + +precision mediump float; + +// Input vertex attributes (from vertex shader) +varying vec2 fragTexCoord; +varying vec4 fragColor; + +// Input uniform values +uniform sampler2D texture0; +uniform vec4 colDiffuse; + +// NOTE: Add here your custom variables + +void main() +{ + // Texel color fetching from texture sampler + vec4 texelColor = texture2D(texture0, fragTexCoord)*colDiffuse*fragColor; + + // Convert texel color to grayscale using NTSC conversion weights + float gray = dot(texelColor.rgb, vec3(0.299, 0.587, 0.114)); + + // Calculate final fragment color + gl_FragColor = vec4(gray, gray, gray, texelColor.a); +} \ No newline at end of file diff --git a/ExampleApplication/bin/Debug/resources/shaders/glsl100/pixelizer.fs b/ExampleApplication/bin/Debug/resources/shaders/glsl100/pixelizer.fs new file mode 100644 index 0000000..44fb0ca --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/shaders/glsl100/pixelizer.fs @@ -0,0 +1,32 @@ +#version 100 + +precision mediump float; + +// Input vertex attributes (from vertex shader) +varying vec2 fragTexCoord; +varying vec4 fragColor; + +// Input uniform values +uniform sampler2D texture0; +uniform vec4 colDiffuse; + +// NOTE: Add here your custom variables + +// NOTE: Render size values must be passed from code +const float renderWidth = 800.0; +const float renderHeight = 450.0; + +float pixelWidth = 5.0; +float pixelHeight = 5.0; + +void main() +{ + float dx = pixelWidth*(1.0/renderWidth); + float dy = pixelHeight*(1.0/renderHeight); + + vec2 coord = vec2(dx*floor(fragTexCoord.x/dx), dy*floor(fragTexCoord.y/dy)); + + vec3 tc = texture2D(texture0, coord).rgb; + + gl_FragColor = vec4(tc, 1.0); +} \ No newline at end of file diff --git a/ExampleApplication/bin/Debug/resources/shaders/glsl100/posterization.fs b/ExampleApplication/bin/Debug/resources/shaders/glsl100/posterization.fs new file mode 100644 index 0000000..a7942c8 --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/shaders/glsl100/posterization.fs @@ -0,0 +1,29 @@ +#version 100 + +precision mediump float; + +// Input vertex attributes (from vertex shader) +varying vec2 fragTexCoord; +varying vec4 fragColor; + +// Input uniform values +uniform sampler2D texture0; +uniform vec4 colDiffuse; + +// NOTE: Add here your custom variables + +float gamma = 0.6; +float numColors = 8.0; + +void main() +{ + vec3 color = texture2D(texture0, fragTexCoord.xy).rgb; + + color = pow(color, vec3(gamma, gamma, gamma)); + color = color*numColors; + color = floor(color); + color = color/numColors; + color = pow(color, vec3(1.0/gamma)); + + gl_FragColor = vec4(color, 1.0); +} \ No newline at end of file diff --git a/ExampleApplication/bin/Debug/resources/shaders/glsl100/predator.fs b/ExampleApplication/bin/Debug/resources/shaders/glsl100/predator.fs new file mode 100644 index 0000000..37dc0bd --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/shaders/glsl100/predator.fs @@ -0,0 +1,31 @@ +#version 100 + +precision mediump float; + +// Input vertex attributes (from vertex shader) +varying vec2 fragTexCoord; +varying vec4 fragColor; + +// Input uniform values +uniform sampler2D texture0; +uniform vec4 colDiffuse; + +// NOTE: Add here your custom variables + +void main() +{ + vec3 color = texture2D(texture0, fragTexCoord).rgb; + vec3 colors[3]; + colors[0] = vec3(0.0, 0.0, 1.0); + colors[1] = vec3(1.0, 1.0, 0.0); + colors[2] = vec3(1.0, 0.0, 0.0); + + float lum = (color.r + color.g + color.b)/3.0; + + vec3 tc = vec3(0.0, 0.0, 0.0); + + if (lum < 0.5) tc = mix(colors[0], colors[1], lum/0.5); + else tc = mix(colors[1], colors[2], (lum - 0.5)/0.5); + + gl_FragColor = vec4(tc, 1.0); +} \ No newline at end of file diff --git a/ExampleApplication/bin/Debug/resources/shaders/glsl100/scanlines.fs b/ExampleApplication/bin/Debug/resources/shaders/glsl100/scanlines.fs new file mode 100644 index 0000000..ce649e1 --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/shaders/glsl100/scanlines.fs @@ -0,0 +1,44 @@ +#version 100 + +precision mediump float; + +// Input vertex attributes (from vertex shader) +varying vec2 fragTexCoord; +varying vec4 fragColor; + +// Input uniform values +uniform sampler2D texture0; +uniform vec4 colDiffuse; + +// NOTE: Add here your custom variables + +float offset = 0.0; +float frequency = 450.0/3.0; + +uniform float time; + +void main() +{ +/* + // Scanlines method 1 + float tval = 0; //time + vec2 uv = 0.5 + (fragTexCoord - 0.5)*(0.9 + 0.01*sin(0.5*tval)); + + vec4 color = texture2D(texture0, fragTexCoord); + + color = clamp(color*0.5 + 0.5*color*color*1.2, 0.0, 1.0); + color *= 0.5 + 0.5*16.0*uv.x*uv.y*(1.0 - uv.x)*(1.0 - uv.y); + color *= vec4(0.8, 1.0, 0.7, 1); + color *= 0.9 + 0.1*sin(10.0*tval + uv.y*1000.0); + color *= 0.97 + 0.03*sin(110.0*tval); + + fragColor = color; +*/ + // Scanlines method 2 + float globalPos = (fragTexCoord.y + offset) * frequency; + float wavePos = cos((fract(globalPos) - 0.5)*3.14); + + vec4 color = texture2D(texture0, fragTexCoord); + + gl_FragColor = mix(vec4(0.0, 0.3, 0.0, 0.0), color, wavePos); +} \ No newline at end of file diff --git a/ExampleApplication/bin/Debug/resources/shaders/glsl100/sobel.fs b/ExampleApplication/bin/Debug/resources/shaders/glsl100/sobel.fs new file mode 100644 index 0000000..745562a --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/shaders/glsl100/sobel.fs @@ -0,0 +1,40 @@ +#version 100 + +precision mediump float; + +// Input vertex attributes (from vertex shader) +varying vec2 fragTexCoord; +varying vec4 fragColor; + +// Input uniform values +uniform sampler2D texture0; +uniform vec4 colDiffuse; + +// NOTE: Add here your custom variables +vec2 resolution = vec2(800.0, 450.0); + +void main() +{ + float x = 1.0/resolution.x; + float y = 1.0/resolution.y; + + vec4 horizEdge = vec4(0.0); + horizEdge -= texture2D(texture0, vec2(fragTexCoord.x - x, fragTexCoord.y - y))*1.0; + horizEdge -= texture2D(texture0, vec2(fragTexCoord.x - x, fragTexCoord.y ))*2.0; + horizEdge -= texture2D(texture0, vec2(fragTexCoord.x - x, fragTexCoord.y + y))*1.0; + horizEdge += texture2D(texture0, vec2(fragTexCoord.x + x, fragTexCoord.y - y))*1.0; + horizEdge += texture2D(texture0, vec2(fragTexCoord.x + x, fragTexCoord.y ))*2.0; + horizEdge += texture2D(texture0, vec2(fragTexCoord.x + x, fragTexCoord.y + y))*1.0; + + vec4 vertEdge = vec4(0.0); + vertEdge -= texture2D(texture0, vec2(fragTexCoord.x - x, fragTexCoord.y - y))*1.0; + vertEdge -= texture2D(texture0, vec2(fragTexCoord.x , fragTexCoord.y - y))*2.0; + vertEdge -= texture2D(texture0, vec2(fragTexCoord.x + x, fragTexCoord.y - y))*1.0; + vertEdge += texture2D(texture0, vec2(fragTexCoord.x - x, fragTexCoord.y + y))*1.0; + vertEdge += texture2D(texture0, vec2(fragTexCoord.x , fragTexCoord.y + y))*2.0; + vertEdge += texture2D(texture0, vec2(fragTexCoord.x + x, fragTexCoord.y + y))*1.0; + + vec3 edge = sqrt((horizEdge.rgb*horizEdge.rgb) + (vertEdge.rgb*vertEdge.rgb)); + + gl_FragColor = vec4(edge, texture2D(texture0, fragTexCoord).a); +} \ No newline at end of file diff --git a/ExampleApplication/bin/Debug/resources/shaders/glsl100/swirl.fs b/ExampleApplication/bin/Debug/resources/shaders/glsl100/swirl.fs new file mode 100644 index 0000000..b969aab --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/shaders/glsl100/swirl.fs @@ -0,0 +1,46 @@ +#version 100 + +precision mediump float; + +// Input vertex attributes (from vertex shader) +varying vec2 fragTexCoord; +varying vec4 fragColor; + +// Input uniform values +uniform sampler2D texture0; +uniform vec4 colDiffuse; + +// NOTE: Add here your custom variables + +// NOTE: Render size values should be passed from code +const float renderWidth = 800; +const float renderHeight = 450; + +float radius = 250.0; +float angle = 0.8; + +uniform vec2 center; + +void main() +{ + vec2 texSize = vec2(renderWidth, renderHeight); + vec2 tc = fragTexCoord*texSize; + tc -= center; + + float dist = length(tc); + + if (dist < radius) + { + float percent = (radius - dist)/radius; + float theta = percent*percent*angle*8.0; + float s = sin(theta); + float c = cos(theta); + + tc = vec2(dot(tc, vec2(c, -s)), dot(tc, vec2(s, c))); + } + + tc += center; + vec4 color = texture2D(texture0, tc/texSize)*colDiffuse*fragColor;; + + gl_FragColor = vec4(color.rgb, 1.0);; +} \ No newline at end of file diff --git a/ExampleApplication/bin/Debug/resources/shaders/glsl120/base.fs b/ExampleApplication/bin/Debug/resources/shaders/glsl120/base.fs new file mode 100644 index 0000000..18799f9 --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/shaders/glsl120/base.fs @@ -0,0 +1,22 @@ +#version 120 + +// Input vertex attributes (from vertex shader) +varying vec2 fragTexCoord; +varying vec4 fragColor; + +// Input uniform values +uniform sampler2D texture0; +uniform vec4 colDiffuse; + +// NOTE: Add here your custom variables +uniform vec2 resolution = vec2(800, 450); + +void main() +{ + // Texel color fetching from texture sampler + vec4 texelColor = texture2D(texture0, fragTexCoord); + + // NOTE: Implement here your fragment shader code + + gl_FragColor = texelColor*colDiffuse; +} \ No newline at end of file diff --git a/ExampleApplication/bin/Debug/resources/shaders/glsl120/base.vs b/ExampleApplication/bin/Debug/resources/shaders/glsl120/base.vs new file mode 100644 index 0000000..674153d --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/shaders/glsl120/base.vs @@ -0,0 +1,26 @@ +#version 120 + +// Input vertex attributes +attribute vec3 vertexPosition; +attribute vec2 vertexTexCoord; +attribute vec3 vertexNormal; +attribute vec4 vertexColor; + +// Input uniform values +uniform mat4 mvp; + +// Output vertex attributes (to fragment shader) +varying vec2 fragTexCoord; +varying vec4 fragColor; + +// NOTE: Add here your custom variables + +void main() +{ + // Send vertex attributes to fragment shader + fragTexCoord = vertexTexCoord; + fragColor = vertexColor; + + // Calculate final vertex position + gl_Position = mvp*vec4(vertexPosition, 1.0); +} \ No newline at end of file diff --git a/ExampleApplication/bin/Debug/resources/shaders/glsl120/bloom.fs b/ExampleApplication/bin/Debug/resources/shaders/glsl120/bloom.fs new file mode 100644 index 0000000..c28836b --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/shaders/glsl120/bloom.fs @@ -0,0 +1,37 @@ +#version 120 + +// Input vertex attributes (from vertex shader) +varying vec2 fragTexCoord; +varying vec4 fragColor; + +// Input uniform values +uniform sampler2D texture0; +uniform vec4 colDiffuse; + +// NOTE: Add here your custom variables + +const vec2 size = vec2(800, 450); // render size +const float samples = 5.0; // pixels per axis; higher = bigger glow, worse performance +const float quality = 2.5; // lower = smaller glow, better quality + +void main() +{ + vec4 sum = vec4(0); + vec2 sizeFactor = vec2(1)/size*quality; + + // Texel color fetching from texture sampler + vec4 source = texture2D(texture0, fragTexCoord); + + const int range = 2; // should be = (samples - 1)/2; + + for (int x = -range; x <= range; x++) + { + for (int y = -range; y <= range; y++) + { + sum += texture2D(texture0, fragTexCoord + vec2(x, y)*sizeFactor); + } + } + + // Calculate final fragment color + gl_FragColor = ((sum/(samples*samples)) + source)*colDiffuse; +} \ No newline at end of file diff --git a/ExampleApplication/bin/Debug/resources/shaders/glsl120/blur.fs b/ExampleApplication/bin/Debug/resources/shaders/glsl120/blur.fs new file mode 100644 index 0000000..99cddfc --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/shaders/glsl120/blur.fs @@ -0,0 +1,32 @@ +#version 120 + +// Input vertex attributes (from vertex shader) +varying vec2 fragTexCoord; +varying vec4 fragColor; + +// Input uniform values +uniform sampler2D texture0; +uniform vec4 colDiffuse; + +// NOTE: Add here your custom variables + +// NOTE: Render size values must be passed from code +const float renderWidth = 800.0; +const float renderHeight = 450.0; + +vec3 offset = vec3(0.0, 1.3846153846, 3.2307692308); +vec3 weight = vec3(0.2270270270, 0.3162162162, 0.0702702703); + +void main() +{ + // Texel color fetching from texture sampler + vec3 tc = texture2D(texture0, fragTexCoord).rgb*weight.x; + + tc += texture2D(texture0, fragTexCoord + vec2(offset.y)/renderWidth, 0.0).rgb*weight.y; + tc += texture2D(texture0, fragTexCoord - vec2(offset.y)/renderWidth, 0.0).rgb*weight.y; + + tc += texture2D(texture0, fragTexCoord + vec2(offset.z)/renderWidth, 0.0).rgb*weight.z; + tc += texture2D(texture0, fragTexCoord - vec2(offset.z)/renderWidth, 0.0).rgb*weight.z; + + gl_FragColor = vec4(tc, 1.0); +} \ No newline at end of file diff --git a/ExampleApplication/bin/Debug/resources/shaders/glsl120/cross_hatching.fs b/ExampleApplication/bin/Debug/resources/shaders/glsl120/cross_hatching.fs new file mode 100644 index 0000000..4651412 --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/shaders/glsl120/cross_hatching.fs @@ -0,0 +1,45 @@ +# version 120 + +// Input vertex attributes (from vertex shader) +varying vec2 fragTexCoord; +varying vec4 fragColor; + +// Input uniform values +uniform sampler2D texture0; +uniform vec4 colDiffuse; + +// NOTE: Add here your custom variables + +float hatchOffsetY = 5.0; +float lumThreshold01 = 0.9; +float lumThreshold02 = 0.7; +float lumThreshold03 = 0.5; +float lumThreshold04 = 0.3; + +void main() +{ + vec3 tc = vec3(1.0, 1.0, 1.0); + float lum = length(texture2D(texture0, fragTexCoord).rgb); + + if (lum < lumThreshold01) + { + if (mod(gl_FragCoord.x + gl_FragCoord.y, 10.0) == 0.0) tc = vec3(0.0, 0.0, 0.0); + } + + if (lum < lumThreshold02) + { + if (mod(gl_FragCoord .x - gl_FragCoord .y, 10.0) == 0.0) tc = vec3(0.0, 0.0, 0.0); + } + + if (lum < lumThreshold03) + { + if (mod(gl_FragCoord .x + gl_FragCoord .y - hatchOffsetY, 10.0) == 0.0) tc = vec3(0.0, 0.0, 0.0); + } + + if (lum < lumThreshold04) + { + if (mod(gl_FragCoord .x - gl_FragCoord .y - hatchOffsetY, 10.0) == 0.0) tc = vec3(0.0, 0.0, 0.0); + } + + gl_FragColor = vec4(tc, 1.0); +} \ No newline at end of file diff --git a/ExampleApplication/bin/Debug/resources/shaders/glsl120/cross_stitching.fs b/ExampleApplication/bin/Debug/resources/shaders/glsl120/cross_stitching.fs new file mode 100644 index 0000000..dee4617 --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/shaders/glsl120/cross_stitching.fs @@ -0,0 +1,55 @@ +# version 120 + +// Input vertex attributes (from vertex shader) +varying vec2 fragTexCoord; +varying vec4 fragColor; + +// Input uniform values +uniform sampler2D texture0; +uniform vec4 colDiffuse; + +// NOTE: Add here your custom variables + +// NOTE: Render size values must be passed from code +const float renderWidth = 800.0; +const float renderHeight = 450.0; + +float stitchingSize = 6.0; +int invert = 0; + +vec4 PostFX(sampler2D tex, vec2 uv) +{ + vec4 c = vec4(0.0); + float size = stitchingSize; + vec2 cPos = uv * vec2(renderWidth, renderHeight); + vec2 tlPos = floor(cPos / vec2(size, size)); + tlPos *= size; + + int remX = int(mod(cPos.x, size)); + int remY = int(mod(cPos.y, size)); + + if (remX == 0 && remY == 0) tlPos = cPos; + + vec2 blPos = tlPos; + blPos.y += (size - 1.0); + + if ((remX == remY) || (((int(cPos.x) - int(blPos.x)) == (int(blPos.y) - int(cPos.y))))) + { + if (invert == 1) c = vec4(0.2, 0.15, 0.05, 1.0); + else c = texture2D(tex, tlPos * vec2(1.0/renderWidth, 1.0/renderHeight)) * 1.4; + } + else + { + if (invert == 1) c = texture2D(tex, tlPos * vec2(1.0/renderWidth, 1.0/renderHeight)) * 1.4; + else c = vec4(0.0, 0.0, 0.0, 1.0); + } + + return c; +} + +void main() +{ + vec3 tc = PostFX(texture0, fragTexCoord).rgb; + + gl_FragColor = vec4(tc, 1.0); +} \ No newline at end of file diff --git a/ExampleApplication/bin/Debug/resources/shaders/glsl120/distortion.fs b/ExampleApplication/bin/Debug/resources/shaders/glsl120/distortion.fs new file mode 100644 index 0000000..f9d7f1e --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/shaders/glsl120/distortion.fs @@ -0,0 +1,52 @@ +#version 120 + +// Input vertex attributes (from vertex shader) +varying vec2 fragTexCoord; + +// Input uniform values +uniform sampler2D texture0; + +// NOTE: Default parameters for Oculus Rift DK2 device +const vec2 LeftLensCenter = vec2(0.2863248, 0.5); +const vec2 RightLensCenter = vec2(0.7136753, 0.5); +const vec2 LeftScreenCenter = vec2(0.25, 0.5); +const vec2 RightScreenCenter = vec2(0.75, 0.5); +const vec2 Scale = vec2(0.25, 0.45); +const vec2 ScaleIn = vec2(4.0, 2.5); +const vec4 HmdWarpParam = vec4(1.0, 0.22, 0.24, 0.0); +const vec4 ChromaAbParam = vec4(0.996, -0.004, 1.014, 0.0); + +void main() +{ + // The following two variables need to be set per eye + vec2 LensCenter = fragTexCoord.x < 0.5 ? LeftLensCenter : RightLensCenter; + vec2 ScreenCenter = fragTexCoord.x < 0.5 ? LeftScreenCenter : RightScreenCenter; + + // Scales input texture coordinates for distortion: vec2 HmdWarp(vec2 fragTexCoord, vec2 LensCenter) + vec2 theta = (fragTexCoord - LensCenter)*ScaleIn; // Scales to [-1, 1] + float rSq = theta.x*theta.x + theta.y*theta.y; + vec2 theta1 = theta*(HmdWarpParam.x + HmdWarpParam.y*rSq + HmdWarpParam.z*rSq*rSq + HmdWarpParam.w*rSq*rSq*rSq); + //vec2 tc = LensCenter + Scale*theta1; + + // Detect whether blue texture coordinates are out of range since these will scaled out the furthest + vec2 thetaBlue = theta1*(ChromaAbParam.z + ChromaAbParam.w*rSq); + vec2 tcBlue = LensCenter + Scale*thetaBlue; + + if (any(bvec2(clamp(tcBlue, ScreenCenter - vec2(0.25, 0.5), ScreenCenter + vec2(0.25, 0.5)) - tcBlue))) gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0); + else + { + // Do blue texture lookup + float blue = texture2D(texture0, tcBlue).b; + + // Do green lookup (no scaling) + vec2 tcGreen = LensCenter + Scale*theta1; + float green = texture2D(texture0, tcGreen).g; + + // Do red scale and lookup + vec2 thetaRed = theta1*(ChromaAbParam.x + ChromaAbParam.y*rSq); + vec2 tcRed = LensCenter + Scale*thetaRed; + float red = texture2D(texture0, tcRed).r; + + gl_FragColor = vec4(red, green, blue, 1.0); + } +} diff --git a/ExampleApplication/bin/Debug/resources/shaders/glsl120/dream_vision.fs b/ExampleApplication/bin/Debug/resources/shaders/glsl120/dream_vision.fs new file mode 100644 index 0000000..4ca2a86 --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/shaders/glsl120/dream_vision.fs @@ -0,0 +1,35 @@ +#version 120 + +// Input vertex attributes (from vertex shader) +varying vec2 fragTexCoord; +varying vec4 fragColor; + +// Input uniform values +uniform sampler2D texture0; +uniform vec4 colDiffuse; + +// NOTE: Add here your custom variables + +void main() +{ + vec4 color = texture2D(texture0, fragTexCoord); + + color += texture2D(texture0, fragTexCoord + 0.001); + color += texture2D(texture0, fragTexCoord + 0.003); + color += texture2D(texture0, fragTexCoord + 0.005); + color += texture2D(texture0, fragTexCoord + 0.007); + color += texture2D(texture0, fragTexCoord + 0.009); + color += texture2D(texture0, fragTexCoord + 0.011); + + color += texture2D(texture0, fragTexCoord - 0.001); + color += texture2D(texture0, fragTexCoord - 0.003); + color += texture2D(texture0, fragTexCoord - 0.005); + color += texture2D(texture0, fragTexCoord - 0.007); + color += texture2D(texture0, fragTexCoord - 0.009); + color += texture2D(texture0, fragTexCoord - 0.011); + + color.rgb = vec3((color.r + color.g + color.b)/3.0); + color = color/9.5; + + gl_FragColor = color; +} \ No newline at end of file diff --git a/ExampleApplication/bin/Debug/resources/shaders/glsl120/fisheye.fs b/ExampleApplication/bin/Debug/resources/shaders/glsl120/fisheye.fs new file mode 100644 index 0000000..6f376ba --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/shaders/glsl120/fisheye.fs @@ -0,0 +1,41 @@ +#version 120 + +// Input vertex attributes (from vertex shader) +varying vec2 fragTexCoord; +varying vec4 fragColor; + +// Input uniform values +uniform sampler2D texture0; +uniform vec4 colDiffuse; + +// NOTE: Add here your custom variables + +const float PI = 3.1415926535; + +void main() +{ + float aperture = 178.0; + float apertureHalf = 0.5 * aperture * (PI / 180.0); + float maxFactor = sin(apertureHalf); + + vec2 uv = vec2(0.0); + vec2 xy = 2.0 * fragTexCoord.xy - 1.0; + float d = length(xy); + + if (d < (2.0 - maxFactor)) + { + d = length(xy * maxFactor); + float z = sqrt(1.0 - d * d); + float r = atan(d, z) / PI; + float phi = atan(xy.y, xy.x); + + uv.x = r * cos(phi) + 0.5; + uv.y = r * sin(phi) + 0.5; + } + else + { + uv = fragTexCoord.xy; + } + + gl_FragColor = texture2D(texture0, uv); +} \ No newline at end of file diff --git a/ExampleApplication/bin/Debug/resources/shaders/glsl120/grayscale.fs b/ExampleApplication/bin/Debug/resources/shaders/glsl120/grayscale.fs new file mode 100644 index 0000000..4de60d2 --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/shaders/glsl120/grayscale.fs @@ -0,0 +1,23 @@ +#version 120 + +// Input vertex attributes (from vertex shader) +varying vec2 fragTexCoord; +varying vec4 fragColor; + +// Input uniform values +uniform sampler2D texture0; +uniform vec4 colDiffuse; + +// NOTE: Add here your custom variables + +void main() +{ + // Texel color fetching from texture sampler + vec4 texelColor = texture2D(texture0, fragTexCoord)*colDiffuse*fragColor; + + // Convert texel color to grayscale using NTSC conversion weights + float gray = dot(texelColor.rgb, vec3(0.299, 0.587, 0.114)); + + // Calculate final fragment color + gl_FragColor = vec4(gray, gray, gray, texelColor.a); +} \ No newline at end of file diff --git a/ExampleApplication/bin/Debug/resources/shaders/glsl120/pixelizer.fs b/ExampleApplication/bin/Debug/resources/shaders/glsl120/pixelizer.fs new file mode 100644 index 0000000..6f741fa --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/shaders/glsl120/pixelizer.fs @@ -0,0 +1,30 @@ +#version 120 + +// Input vertex attributes (from vertex shader) +varying vec2 fragTexCoord; +varying vec4 fragColor; + +// Input uniform values +uniform sampler2D texture0; +uniform vec4 colDiffuse; + +// NOTE: Add here your custom variables + +// NOTE: Render size values must be passed from code +const float renderWidth = 800.0; +const float renderHeight = 450.0; + +float pixelWidth = 5.0; +float pixelHeight = 5.0; + +void main() +{ + float dx = pixelWidth*(1.0/renderWidth); + float dy = pixelHeight*(1.0/renderHeight); + + vec2 coord = vec2(dx*floor(fragTexCoord.x/dx), dy*floor(fragTexCoord.y/dy)); + + vec3 tc = texture2D(texture0, coord).rgb; + + gl_FragColor = vec4(tc, 1.0); +} \ No newline at end of file diff --git a/ExampleApplication/bin/Debug/resources/shaders/glsl120/posterization.fs b/ExampleApplication/bin/Debug/resources/shaders/glsl120/posterization.fs new file mode 100644 index 0000000..475b93a --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/shaders/glsl120/posterization.fs @@ -0,0 +1,27 @@ +#version 120 + +// Input vertex attributes (from vertex shader) +varying vec2 fragTexCoord; +varying vec4 fragColor; + +// Input uniform values +uniform sampler2D texture0; +uniform vec4 colDiffuse; + +// NOTE: Add here your custom variables + +float gamma = 0.6; +float numColors = 8.0; + +void main() +{ + vec3 color = texture2D(texture0, fragTexCoord.xy).rgb; + + color = pow(color, vec3(gamma, gamma, gamma)); + color = color*numColors; + color = floor(color); + color = color/numColors; + color = pow(color, vec3(1.0/gamma)); + + gl_FragColor = vec4(color, 1.0); +} \ No newline at end of file diff --git a/ExampleApplication/bin/Debug/resources/shaders/glsl120/predator.fs b/ExampleApplication/bin/Debug/resources/shaders/glsl120/predator.fs new file mode 100644 index 0000000..2999cc8 --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/shaders/glsl120/predator.fs @@ -0,0 +1,29 @@ +#version 120 + +// Input vertex attributes (from vertex shader) +varying vec2 fragTexCoord; +varying vec4 fragColor; + +// Input uniform values +uniform sampler2D texture0; +uniform vec4 colDiffuse; + +// NOTE: Add here your custom variables + +void main() +{ + vec3 color = texture2D(texture0, fragTexCoord).rgb; + vec3 colors[3]; + colors[0] = vec3(0.0, 0.0, 1.0); + colors[1] = vec3(1.0, 1.0, 0.0); + colors[2] = vec3(1.0, 0.0, 0.0); + + float lum = (color.r + color.g + color.b)/3.0; + + vec3 tc = vec3(0.0, 0.0, 0.0); + + if (lum < 0.5) tc = mix(colors[0], colors[1], lum/0.5); + else tc = mix(colors[1], colors[2], (lum - 0.5)/0.5); + + gl_FragColor = vec4(tc, 1.0); +} \ No newline at end of file diff --git a/ExampleApplication/bin/Debug/resources/shaders/glsl120/scanlines.fs b/ExampleApplication/bin/Debug/resources/shaders/glsl120/scanlines.fs new file mode 100644 index 0000000..929c79e --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/shaders/glsl120/scanlines.fs @@ -0,0 +1,42 @@ +#version 120 + +// Input vertex attributes (from vertex shader) +varying vec2 fragTexCoord; +varying vec4 fragColor; + +// Input uniform values +uniform sampler2D texture0; +uniform vec4 colDiffuse; + +// NOTE: Add here your custom variables + +float offset = 0.0; +float frequency = 450.0/3.0; + +uniform float time; + +void main() +{ +/* + // Scanlines method 1 + float tval = 0; //time + vec2 uv = 0.5 + (fragTexCoord - 0.5)*(0.9 + 0.01*sin(0.5*tval)); + + vec4 color = texture2D(texture0, fragTexCoord); + + color = clamp(color*0.5 + 0.5*color*color*1.2, 0.0, 1.0); + color *= 0.5 + 0.5*16.0*uv.x*uv.y*(1.0 - uv.x)*(1.0 - uv.y); + color *= vec4(0.8, 1.0, 0.7, 1); + color *= 0.9 + 0.1*sin(10.0*tval + uv.y*1000.0); + color *= 0.97 + 0.03*sin(110.0*tval); + + fragColor = color; +*/ + // Scanlines method 2 + float globalPos = (fragTexCoord.y + offset) * frequency; + float wavePos = cos((fract(globalPos) - 0.5)*3.14); + + vec4 color = texture2D(texture0, fragTexCoord); + + gl_FragColor = mix(vec4(0.0, 0.3, 0.0, 0.0), color, wavePos); +} \ No newline at end of file diff --git a/ExampleApplication/bin/Debug/resources/shaders/glsl120/sobel.fs b/ExampleApplication/bin/Debug/resources/shaders/glsl120/sobel.fs new file mode 100644 index 0000000..a3f3f2b --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/shaders/glsl120/sobel.fs @@ -0,0 +1,38 @@ +#version 120 + +// Input vertex attributes (from vertex shader) +varying vec2 fragTexCoord; +varying vec4 fragColor; + +// Input uniform values +uniform sampler2D texture0; +uniform vec4 colDiffuse; + +// NOTE: Add here your custom variables +vec2 resolution = vec2(800.0, 450.0); + +void main() +{ + float x = 1.0/resolution.x; + float y = 1.0/resolution.y; + + vec4 horizEdge = vec4(0.0); + horizEdge -= texture2D(texture0, vec2(fragTexCoord.x - x, fragTexCoord.y - y))*1.0; + horizEdge -= texture2D(texture0, vec2(fragTexCoord.x - x, fragTexCoord.y ))*2.0; + horizEdge -= texture2D(texture0, vec2(fragTexCoord.x - x, fragTexCoord.y + y))*1.0; + horizEdge += texture2D(texture0, vec2(fragTexCoord.x + x, fragTexCoord.y - y))*1.0; + horizEdge += texture2D(texture0, vec2(fragTexCoord.x + x, fragTexCoord.y ))*2.0; + horizEdge += texture2D(texture0, vec2(fragTexCoord.x + x, fragTexCoord.y + y))*1.0; + + vec4 vertEdge = vec4(0.0); + vertEdge -= texture2D(texture0, vec2(fragTexCoord.x - x, fragTexCoord.y - y))*1.0; + vertEdge -= texture2D(texture0, vec2(fragTexCoord.x , fragTexCoord.y - y))*2.0; + vertEdge -= texture2D(texture0, vec2(fragTexCoord.x + x, fragTexCoord.y - y))*1.0; + vertEdge += texture2D(texture0, vec2(fragTexCoord.x - x, fragTexCoord.y + y))*1.0; + vertEdge += texture2D(texture0, vec2(fragTexCoord.x , fragTexCoord.y + y))*2.0; + vertEdge += texture2D(texture0, vec2(fragTexCoord.x + x, fragTexCoord.y + y))*1.0; + + vec3 edge = sqrt((horizEdge.rgb*horizEdge.rgb) + (vertEdge.rgb*vertEdge.rgb)); + + gl_FragColor = vec4(edge, texture2D(texture0, fragTexCoord).a); +} \ No newline at end of file diff --git a/ExampleApplication/bin/Debug/resources/shaders/glsl120/swirl.fs b/ExampleApplication/bin/Debug/resources/shaders/glsl120/swirl.fs new file mode 100644 index 0000000..0618e01 --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/shaders/glsl120/swirl.fs @@ -0,0 +1,44 @@ +#version 120 + +// Input vertex attributes (from vertex shader) +varying vec2 fragTexCoord; +varying vec4 fragColor; + +// Input uniform values +uniform sampler2D texture0; +uniform vec4 colDiffuse; + +// NOTE: Add here your custom variables + +// NOTE: Render size values should be passed from code +const float renderWidth = 800; +const float renderHeight = 450; + +float radius = 250.0; +float angle = 0.8; + +uniform vec2 center; + +void main() +{ + vec2 texSize = vec2(renderWidth, renderHeight); + vec2 tc = fragTexCoord*texSize; + tc -= center; + + float dist = length(tc); + + if (dist < radius) + { + float percent = (radius - dist)/radius; + float theta = percent*percent*angle*8.0; + float s = sin(theta); + float c = cos(theta); + + tc = vec2(dot(tc, vec2(c, -s)), dot(tc, vec2(s, c))); + } + + tc += center; + vec4 color = texture2D(texture0, tc/texSize)*colDiffuse*fragColor;; + + gl_FragColor = vec4(color.rgb, 1.0);; +} \ No newline at end of file diff --git a/ExampleApplication/bin/Debug/resources/shaders/glsl330/base.fs b/ExampleApplication/bin/Debug/resources/shaders/glsl330/base.fs new file mode 100644 index 0000000..f1418df --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/shaders/glsl330/base.fs @@ -0,0 +1,25 @@ +#version 330 + +// Input vertex attributes (from vertex shader) +in vec2 fragTexCoord; +in vec4 fragColor; + +// Input uniform values +uniform sampler2D texture0; +uniform vec4 colDiffuse; + +// Output fragment color +out vec4 finalColor; + +// NOTE: Add here your custom variables + +void main() +{ + // Texel color fetching from texture sampler + vec4 texelColor = texture(texture0, fragTexCoord); + + // NOTE: Implement here your fragment shader code + + finalColor = texelColor*colDiffuse; +} + diff --git a/ExampleApplication/bin/Debug/resources/shaders/glsl330/base.vs b/ExampleApplication/bin/Debug/resources/shaders/glsl330/base.vs new file mode 100644 index 0000000..f3099e8 --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/shaders/glsl330/base.vs @@ -0,0 +1,26 @@ +#version 330 + +// Input vertex attributes +in vec3 vertexPosition; +in vec2 vertexTexCoord; +in vec3 vertexNormal; +in vec4 vertexColor; + +// Input uniform values +uniform mat4 mvp; + +// Output vertex attributes (to fragment shader) +out vec2 fragTexCoord; +out vec4 fragColor; + +// NOTE: Add here your custom variables + +void main() +{ + // Send vertex attributes to fragment shader + fragTexCoord = vertexTexCoord; + fragColor = vertexColor; + + // Calculate final vertex position + gl_Position = mvp*vec4(vertexPosition, 1.0); +} \ No newline at end of file diff --git a/ExampleApplication/bin/Debug/resources/shaders/glsl330/bloom.fs b/ExampleApplication/bin/Debug/resources/shaders/glsl330/bloom.fs new file mode 100644 index 0000000..333d5b0 --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/shaders/glsl330/bloom.fs @@ -0,0 +1,40 @@ +#version 330 + +// Input vertex attributes (from vertex shader) +in vec2 fragTexCoord; +in vec4 fragColor; + +// Input uniform values +uniform sampler2D texture0; +uniform vec4 colDiffuse; + +// Output fragment color +out vec4 finalColor; + +// NOTE: Add here your custom variables + +const vec2 size = vec2(800, 450); // render size +const float samples = 5.0; // pixels per axis; higher = bigger glow, worse performance +const float quality = 2.5; // lower = smaller glow, better quality + +void main() +{ + vec4 sum = vec4(0); + vec2 sizeFactor = vec2(1)/size*quality; + + // Texel color fetching from texture sampler + vec4 source = texture(texture0, fragTexCoord); + + const int range = 2; // should be = (samples - 1)/2; + + for (int x = -range; x <= range; x++) + { + for (int y = -range; y <= range; y++) + { + sum += texture(texture0, fragTexCoord + vec2(x, y)*sizeFactor); + } + } + + // Calculate final fragment color + finalColor = ((sum/(samples*samples)) + source)*colDiffuse; +} \ No newline at end of file diff --git a/ExampleApplication/bin/Debug/resources/shaders/glsl330/blur.fs b/ExampleApplication/bin/Debug/resources/shaders/glsl330/blur.fs new file mode 100644 index 0000000..e4df406 --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/shaders/glsl330/blur.fs @@ -0,0 +1,35 @@ +#version 330 + +// Input vertex attributes (from vertex shader) +in vec2 fragTexCoord; +in vec4 fragColor; + +// Input uniform values +uniform sampler2D texture0; +uniform vec4 colDiffuse; + +// Output fragment color +out vec4 finalColor; + +// NOTE: Add here your custom variables + +// NOTE: Render size values must be passed from code +const float renderWidth = 800; +const float renderHeight = 450; + +float offset[3] = float[](0.0, 1.3846153846, 3.2307692308); +float weight[3] = float[](0.2270270270, 0.3162162162, 0.0702702703); + +void main() +{ + // Texel color fetching from texture sampler + vec3 texelColor = texture(texture0, fragTexCoord).rgb*weight[0]; + + for (int i = 1; i < 3; i++) + { + texelColor += texture(texture0, fragTexCoord + vec2(offset[i])/renderWidth, 0.0).rgb*weight[i]; + texelColor += texture(texture0, fragTexCoord - vec2(offset[i])/renderWidth, 0.0).rgb*weight[i]; + } + + finalColor = vec4(texelColor, 1.0); +} \ No newline at end of file diff --git a/ExampleApplication/bin/Debug/resources/shaders/glsl330/cross_hatching.fs b/ExampleApplication/bin/Debug/resources/shaders/glsl330/cross_hatching.fs new file mode 100644 index 0000000..f95ad07 --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/shaders/glsl330/cross_hatching.fs @@ -0,0 +1,48 @@ +#version 330 + +// Input vertex attributes (from vertex shader) +in vec2 fragTexCoord; +in vec4 fragColor; + +// Input uniform values +uniform sampler2D texture0; +uniform vec4 colDiffuse; + +// Output fragment color +out vec4 finalColor; + +// NOTE: Add here your custom variables + +float hatchOffsetY = 5.0; +float lumThreshold01 = 0.9; +float lumThreshold02 = 0.7; +float lumThreshold03 = 0.5; +float lumThreshold04 = 0.3; + +void main() +{ + vec3 tc = vec3(1.0, 1.0, 1.0); + float lum = length(texture(texture0, fragTexCoord).rgb); + + if (lum < lumThreshold01) + { + if (mod(gl_FragCoord.x + gl_FragCoord.y, 10.0) == 0.0) tc = vec3(0.0, 0.0, 0.0); + } + + if (lum < lumThreshold02) + { + if (mod(gl_FragCoord.x - gl_FragCoord.y, 10.0) == 0.0) tc = vec3(0.0, 0.0, 0.0); + } + + if (lum < lumThreshold03) + { + if (mod(gl_FragCoord.x + gl_FragCoord.y - hatchOffsetY, 10.0) == 0.0) tc = vec3(0.0, 0.0, 0.0); + } + + if (lum < lumThreshold04) + { + if (mod(gl_FragCoord.x - gl_FragCoord.y - hatchOffsetY, 10.0) == 0.0) tc = vec3(0.0, 0.0, 0.0); + } + + finalColor = vec4(tc, 1.0); +} \ No newline at end of file diff --git a/ExampleApplication/bin/Debug/resources/shaders/glsl330/cross_stitching.fs b/ExampleApplication/bin/Debug/resources/shaders/glsl330/cross_stitching.fs new file mode 100644 index 0000000..9cdd36c --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/shaders/glsl330/cross_stitching.fs @@ -0,0 +1,59 @@ +#version 330 + +// Input vertex attributes (from vertex shader) +in vec2 fragTexCoord; +in vec4 fragColor; + +// Input uniform values +uniform sampler2D texture0; +uniform vec4 colDiffuse; + +// Output fragment color +out vec4 finalColor; + +// NOTE: Add here your custom variables + +// NOTE: Render size values must be passed from code +const float renderWidth = 800.0; +const float renderHeight = 450.0; + +float stitchingSize = 6.0; + +uniform int invert = 0; + +vec4 PostFX(sampler2D tex, vec2 uv) +{ + vec4 c = vec4(0.0); + float size = stitchingSize; + vec2 cPos = uv * vec2(renderWidth, renderHeight); + vec2 tlPos = floor(cPos / vec2(size, size)); + tlPos *= size; + + int remX = int(mod(cPos.x, size)); + int remY = int(mod(cPos.y, size)); + + if (remX == 0 && remY == 0) tlPos = cPos; + + vec2 blPos = tlPos; + blPos.y += (size - 1.0); + + if ((remX == remY) || (((int(cPos.x) - int(blPos.x)) == (int(blPos.y) - int(cPos.y))))) + { + if (invert == 1) c = vec4(0.2, 0.15, 0.05, 1.0); + else c = texture(tex, tlPos * vec2(1.0/renderWidth, 1.0/renderHeight)) * 1.4; + } + else + { + if (invert == 1) c = texture(tex, tlPos * vec2(1.0/renderWidth, 1.0/renderHeight)) * 1.4; + else c = vec4(0.0, 0.0, 0.0, 1.0); + } + + return c; +} + +void main() +{ + vec3 tc = PostFX(texture0, fragTexCoord).rgb; + + finalColor = vec4(tc, 1.0); +} \ No newline at end of file diff --git a/ExampleApplication/bin/Debug/resources/shaders/glsl330/depth.fs b/ExampleApplication/bin/Debug/resources/shaders/glsl330/depth.fs new file mode 100644 index 0000000..2422f39 --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/shaders/glsl330/depth.fs @@ -0,0 +1,27 @@ +#version 330 + +// Input vertex attributes (from vertex shader) +in vec2 fragTexCoord; +in vec4 fragColor; + +// Input uniform values +uniform sampler2D texture0; // Depth texture +uniform vec4 colDiffuse; + +// Output fragment color +out vec4 finalColor; + +// NOTE: Add here your custom variables + +void main() +{ + float zNear = 0.01; // camera z near + float zFar = 10.0; // camera z far + float z = texture(texture0, fragTexCoord).x; + + // Linearize depth value + float depth = (2.0*zNear)/(zFar + zNear - z*(zFar - zNear)); + + // Calculate final fragment color + finalColor = vec4(depth, depth, depth, 1.0f); +} \ No newline at end of file diff --git a/ExampleApplication/bin/Debug/resources/shaders/glsl330/distortion.fs b/ExampleApplication/bin/Debug/resources/shaders/glsl330/distortion.fs new file mode 100644 index 0000000..cb4be8f --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/shaders/glsl330/distortion.fs @@ -0,0 +1,56 @@ +#version 330 + +// Input vertex attributes (from vertex shader) +in vec2 fragTexCoord; + +// Input uniform values +uniform sampler2D texture0; + +// Output fragment color +out vec4 finalColor; + +// NOTE: Default parameters for Oculus Rift DK2 device +const vec2 LeftLensCenter = vec2(0.2863248, 0.5); +const vec2 RightLensCenter = vec2(0.7136753, 0.5); +const vec2 LeftScreenCenter = vec2(0.25, 0.5); +const vec2 RightScreenCenter = vec2(0.75, 0.5); +const vec2 Scale = vec2(0.25, 0.45); +const vec2 ScaleIn = vec2(4.0, 2.5); +const vec4 HmdWarpParam = vec4(1.0, 0.22, 0.24, 0.0); +const vec4 ChromaAbParam = vec4(0.996, -0.004, 1.014, 0.0); + +void main() +{ + // The following two variables need to be set per eye + vec2 LensCenter = fragTexCoord.x < 0.5 ? LeftLensCenter : RightLensCenter; + vec2 ScreenCenter = fragTexCoord.x < 0.5 ? LeftScreenCenter : RightScreenCenter; + + // Scales input texture coordinates for distortion: vec2 HmdWarp(vec2 fragTexCoord, vec2 LensCenter) + vec2 theta = (fragTexCoord - LensCenter)*ScaleIn; // Scales to [-1, 1] + float rSq = theta.x*theta.x + theta.y*theta.y; + vec2 theta1 = theta*(HmdWarpParam.x + HmdWarpParam.y*rSq + HmdWarpParam.z*rSq*rSq + HmdWarpParam.w*rSq*rSq*rSq); + //vec2 tc = LensCenter + Scale*theta1; + + // Detect whether blue texture coordinates are out of range since these will scaled out the furthest + vec2 thetaBlue = theta1*(ChromaAbParam.z + ChromaAbParam.w*rSq); + vec2 tcBlue = LensCenter + Scale*thetaBlue; + + if (any(bvec2(clamp(tcBlue, ScreenCenter - vec2(0.25, 0.5), ScreenCenter + vec2(0.25, 0.5)) - tcBlue))) finalColor = vec4(0.0, 0.0, 0.0, 1.0); + else + { + // Do blue texture lookup + float blue = texture(texture0, tcBlue).b; + + // Do green lookup (no scaling) + vec2 tcGreen = LensCenter + Scale*theta1; + float green = texture(texture0, tcGreen).g; + + // Do red scale and lookup + vec2 thetaRed = theta1*(ChromaAbParam.x + ChromaAbParam.y*rSq); + vec2 tcRed = LensCenter + Scale*thetaRed; + float red = texture(texture0, tcRed).r; + + finalColor = vec4(red, green, blue, 1.0); + } +} + diff --git a/ExampleApplication/bin/Debug/resources/shaders/glsl330/dream_vision.fs b/ExampleApplication/bin/Debug/resources/shaders/glsl330/dream_vision.fs new file mode 100644 index 0000000..0311586 --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/shaders/glsl330/dream_vision.fs @@ -0,0 +1,34 @@ +#version 330 + +in vec2 fragTexCoord; + +out vec4 fragColor; + +uniform sampler2D texture0; +uniform vec4 colDiffuse; + +// NOTE: Add here your custom variables + +void main() +{ + vec4 color = texture(texture0, fragTexCoord); + + color += texture(texture0, fragTexCoord + 0.001); + color += texture(texture0, fragTexCoord + 0.003); + color += texture(texture0, fragTexCoord + 0.005); + color += texture(texture0, fragTexCoord + 0.007); + color += texture(texture0, fragTexCoord + 0.009); + color += texture(texture0, fragTexCoord + 0.011); + + color += texture(texture0, fragTexCoord - 0.001); + color += texture(texture0, fragTexCoord - 0.003); + color += texture(texture0, fragTexCoord - 0.005); + color += texture(texture0, fragTexCoord - 0.007); + color += texture(texture0, fragTexCoord - 0.009); + color += texture(texture0, fragTexCoord - 0.011); + + color.rgb = vec3((color.r + color.g + color.b)/3.0); + color = color/9.5; + + fragColor = color; +} \ No newline at end of file diff --git a/ExampleApplication/bin/Debug/resources/shaders/glsl330/fisheye.fs b/ExampleApplication/bin/Debug/resources/shaders/glsl330/fisheye.fs new file mode 100644 index 0000000..e85d7c9 --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/shaders/glsl330/fisheye.fs @@ -0,0 +1,40 @@ +#version 330 + +in vec2 fragTexCoord; + +out vec4 fragColor; + +uniform sampler2D texture0; +uniform vec4 colDiffuse; + +// NOTE: Add here your custom variables + +const float PI = 3.1415926535; + +void main() +{ + float aperture = 178.0; + float apertureHalf = 0.5 * aperture * (PI / 180.0); + float maxFactor = sin(apertureHalf); + + vec2 uv = vec2(0); + vec2 xy = 2.0 * fragTexCoord.xy - 1.0; + float d = length(xy); + + if (d < (2.0 - maxFactor)) + { + d = length(xy * maxFactor); + float z = sqrt(1.0 - d * d); + float r = atan(d, z) / PI; + float phi = atan(xy.y, xy.x); + + uv.x = r * cos(phi) + 0.5; + uv.y = r * sin(phi) + 0.5; + } + else + { + uv = fragTexCoord.xy; + } + + fragColor = texture(texture0, uv); +} \ No newline at end of file diff --git a/ExampleApplication/bin/Debug/resources/shaders/glsl330/grayscale.fs b/ExampleApplication/bin/Debug/resources/shaders/glsl330/grayscale.fs new file mode 100644 index 0000000..5b3e11b --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/shaders/glsl330/grayscale.fs @@ -0,0 +1,26 @@ +#version 330 + +// Input vertex attributes (from vertex shader) +in vec2 fragTexCoord; +in vec4 fragColor; + +// Input uniform values +uniform sampler2D texture0; +uniform vec4 colDiffuse; + +// Output fragment color +out vec4 finalColor; + +// NOTE: Add here your custom variables + +void main() +{ + // Texel color fetching from texture sampler + vec4 texelColor = texture(texture0, fragTexCoord)*colDiffuse*fragColor; + + // Convert texel color to grayscale using NTSC conversion weights + float gray = dot(texelColor.rgb, vec3(0.299, 0.587, 0.114)); + + // Calculate final fragment color + finalColor = vec4(gray, gray, gray, texelColor.a); +} \ No newline at end of file diff --git a/ExampleApplication/bin/Debug/resources/shaders/glsl330/overdraw.fs b/ExampleApplication/bin/Debug/resources/shaders/glsl330/overdraw.fs new file mode 100644 index 0000000..435217c --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/shaders/glsl330/overdraw.fs @@ -0,0 +1,26 @@ +#version 330 + +// Input vertex attributes (from vertex shader) +in vec2 fragTexCoord; +in vec4 fragColor; + +// Input uniform values +uniform sampler2D texture0; +uniform vec4 colDiffuse; + +// Output fragment color +out vec4 finalColor; + +// NOTE: Add here your custom variables + +void main() +{ + // To show overdraw, we just render all the fragments + // with a solid color and some transparency + + // NOTE: This is not a postpro render, + // it will only render all screen texture in a plain color + + finalColor = vec4(1.0, 0.0, 0.0, 0.2); +} + diff --git a/ExampleApplication/bin/Debug/resources/shaders/glsl330/pixelizer.fs b/ExampleApplication/bin/Debug/resources/shaders/glsl330/pixelizer.fs new file mode 100644 index 0000000..cf8aec4 --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/shaders/glsl330/pixelizer.fs @@ -0,0 +1,33 @@ +#version 330 + +// Input vertex attributes (from vertex shader) +in vec2 fragTexCoord; +in vec4 fragColor; + +// Input uniform values +uniform sampler2D texture0; +uniform vec4 colDiffuse; + +// Output fragment color +out vec4 finalColor; + +// NOTE: Add here your custom variables + +// NOTE: Render size values must be passed from code +const float renderWidth = 800; +const float renderHeight = 450; + +uniform float pixelWidth = 5.0; +uniform float pixelHeight = 5.0; + +void main() +{ + float dx = pixelWidth*(1.0/renderWidth); + float dy = pixelHeight*(1.0/renderHeight); + + vec2 coord = vec2(dx*floor(fragTexCoord.x/dx), dy*floor(fragTexCoord.y/dy)); + + vec3 tc = texture(texture0, coord).rgb; + + finalColor = vec4(tc, 1.0); +} \ No newline at end of file diff --git a/ExampleApplication/bin/Debug/resources/shaders/glsl330/posterization.fs b/ExampleApplication/bin/Debug/resources/shaders/glsl330/posterization.fs new file mode 100644 index 0000000..be2b5dd --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/shaders/glsl330/posterization.fs @@ -0,0 +1,31 @@ +#version 330 + +// Input vertex attributes (from vertex shader) +in vec2 fragTexCoord; +in vec4 fragColor; + +// Input uniform values +uniform sampler2D texture0; +uniform vec4 colDiffuse; + +// Output fragment color +out vec4 finalColor; + +// NOTE: Add here your custom variables + +float gamma = 0.6; +float numColors = 8.0; + +void main() +{ + // Texel color fetching from texture sampler + vec3 texelColor = texture(texture0, fragTexCoord.xy).rgb; + + texelColor = pow(texelColor, vec3(gamma, gamma, gamma)); + texelColor = texelColor*numColors; + texelColor = floor(texelColor); + texelColor = texelColor/numColors; + texelColor = pow(texelColor, vec3(1.0/gamma)); + + finalColor = vec4(texelColor, 1.0); +} \ No newline at end of file diff --git a/ExampleApplication/bin/Debug/resources/shaders/glsl330/predator.fs b/ExampleApplication/bin/Debug/resources/shaders/glsl330/predator.fs new file mode 100644 index 0000000..6a55c76 --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/shaders/glsl330/predator.fs @@ -0,0 +1,32 @@ +#version 330 + +// Input vertex attributes (from vertex shader) +in vec2 fragTexCoord; +in vec4 fragColor; + +// Input uniform values +uniform sampler2D texture0; +uniform vec4 colDiffuse; + +// Output fragment color +out vec4 finalColor; + +// NOTE: Add here your custom variables + +void main() +{ + // Texel color fetching from texture sampler + vec3 texelColor = texture(texture0, fragTexCoord).rgb; + vec3 colors[3]; + colors[0] = vec3(0.0, 0.0, 1.0); + colors[1] = vec3(1.0, 1.0, 0.0); + colors[2] = vec3(1.0, 0.0, 0.0); + + float lum = (texelColor.r + texelColor.g + texelColor.b)/3.0; + + int ix = (lum < 0.5)? 0:1; + + vec3 tc = mix(colors[ix], colors[ix + 1], (lum - float(ix)*0.5)/0.5); + + finalColor = vec4(tc, 1.0); +} \ No newline at end of file diff --git a/ExampleApplication/bin/Debug/resources/shaders/glsl330/scanlines.fs b/ExampleApplication/bin/Debug/resources/shaders/glsl330/scanlines.fs new file mode 100644 index 0000000..22dc9cd --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/shaders/glsl330/scanlines.fs @@ -0,0 +1,49 @@ +#version 330 + +// Input vertex attributes (from vertex shader) +in vec2 fragTexCoord; +in vec4 fragColor; + +// Input uniform values +uniform sampler2D texture0; +uniform vec4 colDiffuse; + +// Output fragment color +out vec4 finalColor; + +// NOTE: Add here your custom variables + +// NOTE: Render size values must be passed from code +const float renderWidth = 800; +const float renderHeight = 450; +float offset = 0.0; + +uniform float time; + +void main() +{ + float frequency = renderHeight/3.0; +/* + // Scanlines method 1 + float tval = 0; //time + vec2 uv = 0.5 + (fragTexCoord - 0.5)*(0.9 + 0.01*sin(0.5*tval)); + + vec4 color = texture(texture0, fragTexCoord); + + color = clamp(color*0.5 + 0.5*color*color*1.2, 0.0, 1.0); + color *= 0.5 + 0.5*16.0*uv.x*uv.y*(1.0 - uv.x)*(1.0 - uv.y); + color *= vec4(0.8, 1.0, 0.7, 1); + color *= 0.9 + 0.1*sin(10.0*tval + uv.y*1000.0); + color *= 0.97 + 0.03*sin(110.0*tval); + + fragColor = color; +*/ + // Scanlines method 2 + float globalPos = (fragTexCoord.y + offset) * frequency; + float wavePos = cos((fract(globalPos) - 0.5)*3.14); + + // Texel color fetching from texture sampler + vec4 texelColor = texture(texture0, fragTexCoord); + + finalColor = mix(vec4(0.0, 0.3, 0.0, 0.0), texelColor, wavePos); +} \ No newline at end of file diff --git a/ExampleApplication/bin/Debug/resources/shaders/glsl330/sobel.fs b/ExampleApplication/bin/Debug/resources/shaders/glsl330/sobel.fs new file mode 100644 index 0000000..a1430cd --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/shaders/glsl330/sobel.fs @@ -0,0 +1,41 @@ +#version 330 + +// Input vertex attributes (from vertex shader) +in vec2 fragTexCoord; +in vec4 fragColor; + +// Input uniform values +uniform sampler2D texture0; +uniform vec4 colDiffuse; + +// Output fragment color +out vec4 finalColor; + +// NOTE: Add here your custom variables +uniform vec2 resolution = vec2(800, 450); + +void main() +{ + float x = 1.0/resolution.x; + float y = 1.0/resolution.y; + + vec4 horizEdge = vec4(0.0); + horizEdge -= texture2D(texture0, vec2(fragTexCoord.x - x, fragTexCoord.y - y))*1.0; + horizEdge -= texture2D(texture0, vec2(fragTexCoord.x - x, fragTexCoord.y ))*2.0; + horizEdge -= texture2D(texture0, vec2(fragTexCoord.x - x, fragTexCoord.y + y))*1.0; + horizEdge += texture2D(texture0, vec2(fragTexCoord.x + x, fragTexCoord.y - y))*1.0; + horizEdge += texture2D(texture0, vec2(fragTexCoord.x + x, fragTexCoord.y ))*2.0; + horizEdge += texture2D(texture0, vec2(fragTexCoord.x + x, fragTexCoord.y + y))*1.0; + + vec4 vertEdge = vec4(0.0); + vertEdge -= texture2D(texture0, vec2(fragTexCoord.x - x, fragTexCoord.y - y))*1.0; + vertEdge -= texture2D(texture0, vec2(fragTexCoord.x , fragTexCoord.y - y))*2.0; + vertEdge -= texture2D(texture0, vec2(fragTexCoord.x + x, fragTexCoord.y - y))*1.0; + vertEdge += texture2D(texture0, vec2(fragTexCoord.x - x, fragTexCoord.y + y))*1.0; + vertEdge += texture2D(texture0, vec2(fragTexCoord.x , fragTexCoord.y + y))*2.0; + vertEdge += texture2D(texture0, vec2(fragTexCoord.x + x, fragTexCoord.y + y))*1.0; + + vec3 edge = sqrt((horizEdge.rgb*horizEdge.rgb) + (vertEdge.rgb*vertEdge.rgb)); + + finalColor = vec4(edge, texture2D(texture0, fragTexCoord).a); +} \ No newline at end of file diff --git a/ExampleApplication/bin/Debug/resources/shaders/glsl330/swirl.fs b/ExampleApplication/bin/Debug/resources/shaders/glsl330/swirl.fs new file mode 100644 index 0000000..4741e59 --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/shaders/glsl330/swirl.fs @@ -0,0 +1,47 @@ +#version 330 + +// Input vertex attributes (from vertex shader) +in vec2 fragTexCoord; +in vec4 fragColor; + +// Input uniform values +uniform sampler2D texture0; +uniform vec4 colDiffuse; + +// Output fragment color +out vec4 finalColor; + +// NOTE: Add here your custom variables + +// NOTE: Render size values should be passed from code +const float renderWidth = 800; +const float renderHeight = 450; + +float radius = 250.0; +float angle = 0.8; + +uniform vec2 center = vec2(200.0, 200.0); + +void main() +{ + vec2 texSize = vec2(renderWidth, renderHeight); + vec2 tc = fragTexCoord*texSize; + tc -= center; + + float dist = length(tc); + + if (dist < radius) + { + float percent = (radius - dist)/radius; + float theta = percent*percent*angle*8.0; + float s = sin(theta); + float c = cos(theta); + + tc = vec2(dot(tc, vec2(c, -s)), dot(tc, vec2(s, c))); + } + + tc += center; + vec4 color = texture2D(texture0, tc/texSize)*colDiffuse*fragColor;; + + finalColor = vec4(color.rgb, 1.0);; +} \ No newline at end of file diff --git a/ExampleApplication/bin/Debug/resources/shaders/irradiance.fs b/ExampleApplication/bin/Debug/resources/shaders/irradiance.fs new file mode 100644 index 0000000..8711367 --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/shaders/irradiance.fs @@ -0,0 +1,58 @@ +/******************************************************************************************* +* +* rPBR [shader] - Irradiance cubemap fragment shader +* +* Copyright (c) 2017 Victor Fisac +* +**********************************************************************************************/ + +#version 330 + +// Input vertex attributes (from vertex shader) +in vec3 fragPos; + +// Input uniform values +uniform samplerCube environmentMap; + +// Constant values +const float PI = 3.14159265359f; + +// Output fragment color +out vec4 finalColor; + +void main() +{ + // The sample direction equals the hemisphere's orientation + vec3 normal = normalize(fragPos); + + vec3 irradiance = vec3(0.0); + + vec3 up = vec3(0.0, 1.0, 0.0); + vec3 right = cross(up, normal); + up = cross(normal, right); + + float sampleDelta = 0.025f; + float nrSamples = 0.0f; + + for (float phi = 0.0; phi < 2.0*PI; phi += sampleDelta) + { + for (float theta = 0.0; theta < 0.5*PI; theta += sampleDelta) + { + // Spherical to cartesian (in tangent space) + vec3 tangentSample = vec3(sin(theta)*cos(phi), sin(theta)*sin(phi), cos(theta)); + + // tangent space to world + vec3 sampleVec = tangentSample.x*right + tangentSample.y*up + tangentSample.z*normal; + + // Fetch color from environment cubemap + irradiance += texture(environmentMap, sampleVec).rgb*cos(theta)*sin(theta); + nrSamples++; + } + } + + // Calculate irradiance average value from samples + irradiance = PI*irradiance*(1.0/float(nrSamples)); + + // Calculate final fragment color + finalColor = vec4(irradiance, 1.0); +} diff --git a/ExampleApplication/bin/Debug/resources/shaders/pbr.fs b/ExampleApplication/bin/Debug/resources/shaders/pbr.fs new file mode 100644 index 0000000..38d56c5 --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/shaders/pbr.fs @@ -0,0 +1,298 @@ +/******************************************************************************************* +* +* rPBR [shader] - Physically based rendering fragment shader +* +* Copyright (c) 2017 Victor Fisac +* +**********************************************************************************************/ + +#version 330 + +#define MAX_REFLECTION_LOD 4.0 +#define MAX_DEPTH_LAYER 20 +#define MIN_DEPTH_LAYER 10 + +#define MAX_LIGHTS 4 +#define LIGHT_DIRECTIONAL 0 +#define LIGHT_POINT 1 + +struct MaterialProperty { + vec3 color; + int useSampler; + sampler2D sampler; +}; + +struct Light { + int enabled; + int type; + vec3 position; + vec3 target; + vec4 color; +}; + +// Input vertex attributes (from vertex shader) +in vec3 fragPosition; +in vec2 fragTexCoord; +in vec3 fragNormal; +in vec3 fragTangent; +in vec3 fragBinormal; + +// Input material values +uniform MaterialProperty albedo; +uniform MaterialProperty normals; +uniform MaterialProperty metalness; +uniform MaterialProperty roughness; +uniform MaterialProperty occlusion; +uniform MaterialProperty emission; +uniform MaterialProperty height; + +// Input uniform values +uniform samplerCube irradianceMap; +uniform samplerCube prefilterMap; +uniform sampler2D brdfLUT; + +// Input lighting values +uniform Light lights[MAX_LIGHTS]; + +// Other uniform values +uniform int renderMode; +uniform vec3 viewPos; +vec2 texCoord; + +// Constant values +const float PI = 3.14159265359; + +// Output fragment color +out vec4 finalColor; + +vec3 ComputeMaterialProperty(MaterialProperty property); +float DistributionGGX(vec3 N, vec3 H, float roughness); +float GeometrySchlickGGX(float NdotV, float roughness); +float GeometrySmith(vec3 N, vec3 V, vec3 L, float roughness); +vec3 fresnelSchlick(float cosTheta, vec3 F0); +vec3 fresnelSchlickRoughness(float cosTheta, vec3 F0, float roughness); +vec2 ParallaxMapping(vec2 texCoords, vec3 viewDir); + +vec3 ComputeMaterialProperty(MaterialProperty property) +{ + vec3 result = vec3(0.0, 0.0, 0.0); + + if (property.useSampler == 1) result = texture(property.sampler, texCoord).rgb; + else result = property.color; + + return result; +} + +float DistributionGGX(vec3 N, vec3 H, float roughness) +{ + float a = roughness*roughness; + float a2 = a*a; + float NdotH = max(dot(N, H), 0.0); + float NdotH2 = NdotH*NdotH; + + float nom = a2; + float denom = (NdotH2*(a2 - 1.0) + 1.0); + denom = PI*denom*denom; + + return nom/denom; +} + +float GeometrySchlickGGX(float NdotV, float roughness) +{ + float r = (roughness + 1.0); + float k = r*r/8.0; + + float nom = NdotV; + float denom = NdotV*(1.0 - k) + k; + + return nom/denom; +} +float GeometrySmith(vec3 N, vec3 V, vec3 L, float roughness) +{ + float NdotV = max(dot(N, V), 0.0); + float NdotL = max(dot(N, L), 0.0); + float ggx2 = GeometrySchlickGGX(NdotV, roughness); + float ggx1 = GeometrySchlickGGX(NdotL, roughness); + + return ggx1*ggx2; +} + +vec3 fresnelSchlick(float cosTheta, vec3 F0) +{ + return F0 + (1.0 - F0)*pow(1.0 - cosTheta, 5.0); +} + +vec3 fresnelSchlickRoughness(float cosTheta, vec3 F0, float roughness) +{ + return F0 + (max(vec3(1.0 - roughness), F0) - F0)*pow(1.0 - cosTheta, 5.0); +} + +vec2 ParallaxMapping(vec2 texCoords, vec3 viewDir) +{ + // Calculate the number of depth layers and calculate the size of each layer + float numLayers = mix(MAX_DEPTH_LAYER, MIN_DEPTH_LAYER, abs(dot(vec3(0.0, 0.0, 1.0), viewDir))); + float layerDepth = 1.0/numLayers; + + // Calculate depth of current layer + float currentLayerDepth = 0.0; + + // Calculate the amount to shift the texture coordinates per layer (from vector P) + // Note: height amount is stored in height material attribute color R channel (sampler use is independent) + vec2 P = viewDir.xy*height.color.r; + vec2 deltaTexCoords = P/numLayers; + + // Store initial texture coordinates and depth values + vec2 currentTexCoords = texCoords; + float currentDepthMapValue = texture(height.sampler, currentTexCoords).r; + + while (currentLayerDepth < currentDepthMapValue) + { + // Shift texture coordinates along direction of P + currentTexCoords -= deltaTexCoords; + + // Get depth map value at current texture coordinates + currentDepthMapValue = texture(height.sampler, currentTexCoords).r; + + // Get depth of next layer + currentLayerDepth += layerDepth; + } + + // Get texture coordinates before collision (reverse operations) + vec2 prevTexCoords = currentTexCoords + deltaTexCoords; + + // Get depth after and before collision for linear interpolation + float afterDepth = currentDepthMapValue - currentLayerDepth; + float beforeDepth = texture(height.sampler, prevTexCoords).r - currentLayerDepth + layerDepth; + + // Interpolation of texture coordinates + float weight = afterDepth/(afterDepth - beforeDepth); + vec2 finalTexCoords = prevTexCoords*weight + currentTexCoords*(1.0 - weight); + + return finalTexCoords; +} + +void main() +{ + // Calculate TBN and RM matrices + mat3 TBN = transpose(mat3(fragTangent, fragBinormal, fragNormal)); + + // Calculate lighting required attributes + vec3 normal = normalize(fragNormal); + vec3 view = normalize(viewPos - fragPosition); + vec3 refl = reflect(-view, normal); + + // Check if parallax mapping is enabled and calculate texture coordinates to use based on height map + // NOTE: remember that 'texCoord' variable must be assigned before calling any ComputeMaterialProperty() function + if (height.useSampler == 1) texCoord = ParallaxMapping(fragTexCoord, view); + else texCoord = fragTexCoord; // Use default texture coordinates + + // Fetch material values from texture sampler or color attributes + vec3 color = ComputeMaterialProperty(albedo); + vec3 metal = ComputeMaterialProperty(metalness); + vec3 rough = ComputeMaterialProperty(roughness); + vec3 emiss = ComputeMaterialProperty(emission); + vec3 ao = ComputeMaterialProperty(occlusion); + + // Check if normal mapping is enabled + if (normals.useSampler == 1) + { + // Fetch normal map color and transform lighting values to tangent space + normal = ComputeMaterialProperty(normals); + normal = normalize(normal*2.0 - 1.0); + normal = normalize(normal*TBN); + + // Convert tangent space normal to world space due to cubemap reflection calculations + refl = normalize(reflect(-view, normal)); + } + + // Calculate reflectance at normal incidence + vec3 F0 = vec3(0.04); + F0 = mix(F0, color, metal.r); + + // Calculate lighting for all lights + vec3 Lo = vec3(0.0); + vec3 lightDot = vec3(0.0); + + for (int i = 0; i < MAX_LIGHTS; i++) + { + if (lights[i].enabled == 1) + { + // Calculate per-light radiance + vec3 light = vec3(0.0); + vec3 radiance = lights[i].color.rgb; + if (lights[i].type == LIGHT_DIRECTIONAL) light = -normalize(lights[i].target - lights[i].position); + else if (lights[i].type == LIGHT_POINT) + { + light = normalize(lights[i].position - fragPosition); + float distance = length(lights[i].position - fragPosition); + float attenuation = 1.0/(distance*distance); + radiance *= attenuation; + } + + // Cook-torrance BRDF + vec3 high = normalize(view + light); + float NDF = DistributionGGX(normal, high, rough.r); + float G = GeometrySmith(normal, view, light, rough.r); + vec3 F = fresnelSchlick(max(dot(high, view), 0.0), F0); + vec3 nominator = NDF*G*F; + float denominator = 4*max(dot(normal, view), 0.0)*max(dot(normal, light), 0.0) + 0.001; + vec3 brdf = nominator/denominator; + + // Store to kS the fresnel value and calculate energy conservation + vec3 kS = F; + vec3 kD = vec3(1.0) - kS; + + // Multiply kD by the inverse metalness such that only non-metals have diffuse lighting + kD *= 1.0 - metal.r; + + // Scale light by dot product between normal and light direction + float NdotL = max(dot(normal, light), 0.0); + + // Add to outgoing radiance Lo + // Note: BRDF is already multiplied by the Fresnel so it doesn't need to be multiplied again + Lo += (kD*color/PI + brdf)*radiance*NdotL*lights[i].color.a; + lightDot += radiance*NdotL + brdf*lights[i].color.a; + } + } + + // Calculate ambient lighting using IBL + vec3 F = fresnelSchlickRoughness(max(dot(normal, view), 0.0), F0, rough.r); + vec3 kS = F; + vec3 kD = 1.0 - kS; + kD *= 1.0 - metal.r; + + // Calculate indirect diffuse + vec3 irradiance = texture(irradianceMap, fragNormal).rgb; + vec3 diffuse = color*irradiance; + + // Sample both the prefilter map and the BRDF lut and combine them together as per the Split-Sum approximation + vec3 prefilterColor = textureLod(prefilterMap, refl, rough.r*MAX_REFLECTION_LOD).rgb; + vec2 brdf = texture(brdfLUT, vec2(max(dot(normal, view), 0.0), rough.r)).rg; + vec3 reflection = prefilterColor*(F*brdf.x + brdf.y); + + // Calculate final lighting + vec3 ambient = (kD*diffuse + reflection)*ao; + + // Calculate fragment color based on render mode + vec3 fragmentColor = ambient + Lo + emiss; // Physically Based Rendering + + if (renderMode == 1) fragmentColor = color; // Albedo + else if (renderMode == 2) fragmentColor = normal; // Normals + else if (renderMode == 3) fragmentColor = metal; // Metalness + else if (renderMode == 4) fragmentColor = rough; // Roughness + else if (renderMode == 5) fragmentColor = ao; // Ambient Occlusion + else if (renderMode == 6) fragmentColor = emiss; // Emission + else if (renderMode == 7) fragmentColor = lightDot; // Lighting + else if (renderMode == 8) fragmentColor = kS; // Fresnel + else if (renderMode == 9) fragmentColor = irradiance; // Irradiance + else if (renderMode == 10) fragmentColor = reflection; // Reflection + + // Apply HDR tonemapping + fragmentColor = fragmentColor/(fragmentColor + vec3(1.0)); + + // Apply gamma correction + fragmentColor = pow(fragmentColor, vec3(1.0/2.2)); + + // Calculate final fragment color + finalColor = vec4(fragmentColor, 1.0); +} diff --git a/ExampleApplication/bin/Debug/resources/shaders/pbr.vs b/ExampleApplication/bin/Debug/resources/shaders/pbr.vs new file mode 100644 index 0000000..8bd3faa --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/shaders/pbr.vs @@ -0,0 +1,49 @@ +/******************************************************************************************* +* +* rPBR [shader] - Physically based rendering vertex shader +* +* Copyright (c) 2017 Victor Fisac +* +**********************************************************************************************/ + +#version 330 + +// Input vertex attributes +in vec3 vertexPosition; +in vec2 vertexTexCoord; +in vec3 vertexNormal; +in vec4 vertexTangent; + +// Input uniform values +uniform mat4 mvp; +uniform mat4 matModel; + +// Output vertex attributes (to fragment shader) +out vec3 fragPosition; +out vec2 fragTexCoord; +out vec3 fragNormal; +out vec3 fragTangent; +out vec3 fragBinormal; + +void main() +{ + // Calculate binormal from vertex normal and tangent + vec3 vertexBinormal = cross(vertexNormal, vec3(vertexTangent)); + + // Calculate fragment normal based on normal transformations + mat3 normalMatrix = transpose(inverse(mat3(matModel))); + + // Calculate fragment position based on model transformations + fragPosition = vec3(matModel*vec4(vertexPosition, 1.0f)); + + // Send vertex attributes to fragment shader + fragTexCoord = vertexTexCoord; + fragNormal = normalize(normalMatrix*vertexNormal); + fragTangent = normalize(normalMatrix*vec3(vertexTangent)); + fragTangent = normalize(fragTangent - dot(fragTangent, fragNormal)*fragNormal); + fragBinormal = normalize(normalMatrix*vertexBinormal); + fragBinormal = cross(fragNormal, fragTangent); + + // Calculate final vertex position + gl_Position = mvp*vec4(vertexPosition, 1.0); +} \ No newline at end of file diff --git a/ExampleApplication/bin/Debug/resources/shaders/prefilter.fs b/ExampleApplication/bin/Debug/resources/shaders/prefilter.fs new file mode 100644 index 0000000..f5cf64b --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/shaders/prefilter.fs @@ -0,0 +1,120 @@ +/******************************************************************************************* +* +* rPBR [shader] - Prefiltered environment for reflections fragment shader +* +* Copyright (c) 2017 Victor Fisac +* +**********************************************************************************************/ + +#version 330 +#define MAX_SAMPLES 1024u +#define CUBEMAP_RESOLUTION 1024.0 + +// Input vertex attributes (from vertex shader) +in vec3 fragPos; + +// Input uniform values +uniform samplerCube environmentMap; +uniform float roughness; + +// Constant values +const float PI = 3.14159265359f; + +// Output fragment color +out vec4 finalColor; + +float DistributionGGX(vec3 N, vec3 H, float roughness); +float RadicalInverse_VdC(uint bits); +vec2 Hammersley(uint i, uint N); +vec3 ImportanceSampleGGX(vec2 Xi, vec3 N, float roughness); + +float DistributionGGX(vec3 N, vec3 H, float roughness) +{ + float a = roughness*roughness; + float a2 = a*a; + float NdotH = max(dot(N, H), 0.0); + float NdotH2 = NdotH*NdotH; + + float nom = a2; + float denom = (NdotH2*(a2 - 1.0) + 1.0); + denom = PI*denom*denom; + + return nom/denom; +} + +float RadicalInverse_VdC(uint bits) +{ + bits = (bits << 16u) | (bits >> 16u); + bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u); + bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u); + bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u); + bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u); + return float(bits) * 2.3283064365386963e-10; // / 0x100000000 +} + +vec2 Hammersley(uint i, uint N) +{ + return vec2(float(i)/float(N), RadicalInverse_VdC(i)); +} + +vec3 ImportanceSampleGGX(vec2 Xi, vec3 N, float roughness) +{ + float a = roughness*roughness; + float phi = 2.0 * PI * Xi.x; + float cosTheta = sqrt((1.0 - Xi.y)/(1.0 + (a*a - 1.0)*Xi.y)); + float sinTheta = sqrt(1.0 - cosTheta*cosTheta); + + // Transform from spherical coordinates to cartesian coordinates (halfway vector) + vec3 H = vec3(cos(phi)*sinTheta, sin(phi)*sinTheta, cosTheta); + + // Transform from tangent space H vector to world space sample vector + vec3 up = ((abs(N.z) < 0.999) ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0)); + vec3 tangent = normalize(cross(up, N)); + vec3 bitangent = cross(N, tangent); + vec3 sampleVec = tangent*H.x + bitangent*H.y + N*H.z; + + return normalize(sampleVec); +} + +void main() +{ + // Make the simplyfying assumption that V equals R equals the normal + vec3 N = normalize(fragPos); + vec3 R = N; + vec3 V = R; + + vec3 prefilteredColor = vec3(0.0); + float totalWeight = 0.0; + + for (uint i = 0u; i < MAX_SAMPLES; i++) + { + // Generate a sample vector that's biased towards the preferred alignment direction (importance sampling) + vec2 Xi = Hammersley(i, MAX_SAMPLES); + vec3 H = ImportanceSampleGGX(Xi, N, roughness); + vec3 L = normalize(2.0*dot(V, H)*H - V); + + float NdotL = max(dot(N, L), 0.0); + if(NdotL > 0.0) + { + // Sample from the environment's mip level based on roughness/pdf + float D = DistributionGGX(N, H, roughness); + float NdotH = max(dot(N, H), 0.0); + float HdotV = max(dot(H, V), 0.0); + float pdf = D*NdotH/(4.0*HdotV) + 0.0001; + + float resolution = CUBEMAP_RESOLUTION; + float saTexel = 4.0*PI/(6.0*resolution*resolution); + float saSample = 1.0/(float(MAX_SAMPLES)*pdf + 0.0001); + float mipLevel = ((roughness == 0.0) ? 0.0 : 0.5*log2(saSample/saTexel)); + + prefilteredColor += textureLod(environmentMap, L, mipLevel).rgb*NdotL; + totalWeight += NdotL; + } + } + + // Calculate prefilter average color + prefilteredColor = prefilteredColor/totalWeight; + + // Calculate final fragment color + finalColor = vec4(prefilteredColor, 1.0); +} diff --git a/ExampleApplication/bin/Debug/resources/shaders/sdf.fs b/ExampleApplication/bin/Debug/resources/shaders/sdf.fs new file mode 100644 index 0000000..44d33e9 --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/shaders/sdf.fs @@ -0,0 +1,26 @@ +#version 330 + +// Input vertex attributes (from vertex shader) +in vec2 fragTexCoord; +in vec4 fragColor; + +// Input uniform values +uniform sampler2D texture0; +uniform vec4 colDiffuse; + +// Output fragment color +out vec4 finalColor; + +// NOTE: Add here your custom variables +const float smoothing = 1.0/16.0; + +void main() +{ + // Texel color fetching from texture sampler + // NOTE: Calculate alpha using signed distance field (SDF) + float distance = texture(texture0, fragTexCoord).a; + float alpha = smoothstep(0.5 - smoothing, 0.5 + smoothing, distance); + + // Calculate final fragment color + finalColor = vec4(fragColor.rgb, fragColor.a*alpha); +} diff --git a/ExampleApplication/bin/Debug/resources/shaders/skybox.fs b/ExampleApplication/bin/Debug/resources/shaders/skybox.fs new file mode 100644 index 0000000..0bd2f32 --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/shaders/skybox.fs @@ -0,0 +1,31 @@ +/******************************************************************************************* +* +* rPBR [shader] - Background skybox fragment shader +* +* Copyright (c) 2017 Victor Fisac +* +**********************************************************************************************/ + +#version 330 + +// Input vertex attributes (from vertex shader) +in vec3 fragPos; + +// Input uniform values +uniform samplerCube environmentMap; + +// Output fragment color +out vec4 finalColor; + +void main() +{ + // Fetch color from texture map + vec3 color = texture(environmentMap, fragPos).rgb; + + // Apply gamma correction + color = color/(color + vec3(1.0)); + color = pow(color, vec3(1.0/2.2)); + + // Calculate final fragment color + finalColor = vec4(color, 1.0); +} diff --git a/ExampleApplication/bin/Debug/resources/shaders/skybox.vs b/ExampleApplication/bin/Debug/resources/shaders/skybox.vs new file mode 100644 index 0000000..f40d615 --- /dev/null +++ b/ExampleApplication/bin/Debug/resources/shaders/skybox.vs @@ -0,0 +1,32 @@ +/******************************************************************************************* +* +* rPBR [shader] - Background skybox vertex shader +* +* Copyright (c) 2017 Victor Fisac +* +**********************************************************************************************/ + +#version 330 + +// Input vertex attributes +in vec3 vertexPosition; + +// Input uniform values +uniform mat4 projection; +uniform mat4 view; + +// Output vertex attributes (to fragment shader) +out vec3 fragPos; + +void main() +{ + // Calculate fragment position based on model transformations + fragPos = vertexPosition; + + // Remove translation from the view matrix + mat4 rotView = mat4(mat3(view)); + vec4 clipPos = projection*rotView*vec4(vertexPosition, 1.0); + + // Calculate final vertex position + gl_Position = clipPos.xyww; +} diff --git a/ExampleApplication/bin/Debug/resources/smoke.png b/ExampleApplication/bin/Debug/resources/smoke.png new file mode 100644 index 0000000..7bad8c6 Binary files /dev/null and b/ExampleApplication/bin/Debug/resources/smoke.png differ diff --git a/ExampleApplication/bin/Debug/resources/sound.wav b/ExampleApplication/bin/Debug/resources/sound.wav new file mode 100644 index 0000000..b5d01c9 Binary files /dev/null and b/ExampleApplication/bin/Debug/resources/sound.wav differ diff --git a/ExampleApplication/bin/Debug/resources/spring.wav b/ExampleApplication/bin/Debug/resources/spring.wav new file mode 100644 index 0000000..c7fbf1b Binary files /dev/null and b/ExampleApplication/bin/Debug/resources/spring.wav differ diff --git a/ExampleApplication/bin/Debug/resources/tanatana.flac b/ExampleApplication/bin/Debug/resources/tanatana.flac new file mode 100644 index 0000000..dfe735c Binary files /dev/null and b/ExampleApplication/bin/Debug/resources/tanatana.flac differ diff --git a/ExampleApplication/bin/Debug/resources/tanatana.ogg b/ExampleApplication/bin/Debug/resources/tanatana.ogg new file mode 100644 index 0000000..90b1795 Binary files /dev/null and b/ExampleApplication/bin/Debug/resources/tanatana.ogg differ diff --git a/ExampleApplication/bin/Debug/resources/weird.wav b/ExampleApplication/bin/Debug/resources/weird.wav new file mode 100644 index 0000000..101029c Binary files /dev/null and b/ExampleApplication/bin/Debug/resources/weird.wav differ diff --git a/ExampleApplication/bin/Debug/resources/xbox.png b/ExampleApplication/bin/Debug/resources/xbox.png new file mode 100644 index 0000000..029c910 Binary files /dev/null and b/ExampleApplication/bin/Debug/resources/xbox.png differ diff --git a/ExampleApplication/bin/Debug/x64/raylib.dll b/ExampleApplication/bin/Debug/x64/raylib.dll new file mode 100644 index 0000000..fe44fa8 Binary files /dev/null and b/ExampleApplication/bin/Debug/x64/raylib.dll differ diff --git a/ExampleApplication/bin/Debug/x86/raylib.dll b/ExampleApplication/bin/Debug/x86/raylib.dll new file mode 100644 index 0000000..6a9ef2b Binary files /dev/null and b/ExampleApplication/bin/Debug/x86/raylib.dll differ diff --git a/README.md b/README.md index 51f0704..1cb2bb1 100644 --- a/README.md +++ b/README.md @@ -3,21 +3,15 @@ C# bindings for raylib 2.0, a simple and easy-to-use library to learn videogames programming (www.raylib.com) ## Installation -Windows: -- Download the repository -- Open Raylib-cs.sln -- Copy x86 or x64 dll inside ExampleApplication to your output folder -- Build and run +- Download the repository +- Run ExampleApplication.exe in ExampleApplication/bin/Debug/ # TODO: ## Cppsharp generator: -- Change #defines such as KEY_ENTER to static variables or enums. - Add utility constructors for types -> Vector3(x, y, z). - Add utility for cleaning up types so they are destroyed with the type. ## General -- Copy raylib.dll across to same output folder automatically -- Add windows forms interface for generator - Allow raylib to be used inside windows forms - Convert across raylib examples @@ -28,4 +22,4 @@ If you'd like to contribute, please fork the repository and make changes as you'd like. Pull requests are warmly welcome. ## Licensing -raylib-cs is licensed under an unmodified zlib/libpng license, which is an OSI-certified, BSD-like license that allows static linking with closed source software. Check [LICENSE](LICENSE) for further details. +raylib-cs is licensed under an unmodified zlib/libpng license, which is an OSI-certified, BSD-like license that allows static linking with closed source software. Check [LICENSE](LICENSE) for further details. \ No newline at end of file