Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
stpv221 authored May 31, 2024
0 parents commit 16a0bcd
Showing 6,538 changed files with 693,947 additions and 0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
53 changes: 53 additions & 0 deletions .github/workflows/compile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Build
on: [push, pull_request, workflow_dispatch]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup java
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "21"
cache: "gradle"
- name: Validate Gradle wrapper
uses: gradle/actions/wrapper-validation@v3
- name: Compile javascript
run: ./gradlew generateJavaScript
- name: Compile web assets
run: bash ./CompileEPK.sh
- name: Upload web files
uses: actions/upload-artifact@v4
with:
name: web
path: |
javascript/lang/
javascript/index.html
javascript/classes.js
javascript/classes.js.map
javascript/favicon.ico
javascript/assets.epk
- name: Copy web files to _site/
if: github.ref == 'refs/heads/main'
run: mkdir _site/ && cp --recursive --target-directory=_site/
javascript/lang/
javascript/index.html
javascript/classes.js
javascript/classes.js.map
javascript/favicon.ico
javascript/assets.epk
- name: Upload github-pages artifact
if: github.ref == 'refs/heads/main'
uses: actions/upload-pages-artifact@v3
- name: Compile offline assets
run: bash CompileEPK.sh
- name: Make offline download
run: bash MakeOfflineDownload.sh
- name: Upload offline download
uses: actions/upload-artifact@v4
with:
name: offline
path: javascript/EaglercraftX_1.8_Offline_en_US.html
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.gradle
.settings
.classpath
.project
build
bin
proxyServer/bin
proxyServer/rundir
desktopRuntime/_eagstorage*
desktopRuntime/eclipseProject/bin*
desktopRuntime/hs_err_*
desktopRuntime/crash-reports/*
desktopRuntime/options.txt
desktopRuntime/_eagstorage*
desktopRuntime/filesystem/*
desktopRuntime/downloads/*
6 changes: 6 additions & 0 deletions CompileEPK.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@echo off
title epkcompiler
echo compiling, please wait...
java -jar "desktopRuntime/CompileEPK.jar" "desktopRuntime/resources" "javascript/assets.epk"
echo finished compiling epk
pause
2 changes: 2 additions & 0 deletions CompileEPK.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
java -jar "desktopRuntime/CompileEPK.jar" "desktopRuntime/resources" "javascript/assets.epk"
4 changes: 4 additions & 0 deletions CompileJS.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@echo off
title gradlew generateJavascript
gradlew generateJavascript
pause
3 changes: 3 additions & 0 deletions CompileJS.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
chmod +x gradlew
./gradlew generateJavascript
4 changes: 4 additions & 0 deletions MakeOfflineDownload.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@echo off
title MakeOfflineDownload
java -cp "desktopRuntime/MakeOfflineDownload.jar;desktopRuntime/CompileEPK.jar" net.lax1dude.eaglercraft.v1_8.buildtools.workspace.MakeOfflineDownload "javascript/OfflineDownloadTemplate.txt" "javascript/classes.js" "javascript/assets.epk" "javascript/EaglercraftX_1.8_Offline_en_US.html" "javascript/EaglercraftX_1.8_Offline_International.html" "javascript/lang"
pause
2 changes: 2 additions & 0 deletions MakeOfflineDownload.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
java -cp "desktopRuntime/MakeOfflineDownload.jar:desktopRuntime/CompileEPK.jar" net.lax1dude.eaglercraft.v1_8.buildtools.workspace.MakeOfflineDownload "javascript/OfflineDownloadTemplate.txt" "javascript/classes.js" "javascript/assets.epk" "javascript/EaglercraftX_1.8_Offline_en_US.html" "javascript/EaglercraftX_1.8_Offline_International.html" "javascript/lang"
4 changes: 4 additions & 0 deletions MakeSignedClient.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@echo off
title MakeSignedClient
java -cp "desktopRuntime/MakeOfflineDownload.jar;desktopRuntime/CompileEPK.jar" net.lax1dude.eaglercraft.v1_8.buildtools.workspace.MakeSignedClient "javascript/SignedBundleTemplate.txt" "javascript/classes.js" "javascript/assets.epk" "javascript/lang" "javascript/SignedClientTemplate.txt" "javascript/UpdateDownloadSources.txt" "javascript/EaglercraftX_1.8_Offline_Signed_Client.html"
pause
2 changes: 2 additions & 0 deletions MakeSignedClient.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
java -cp "desktopRuntime/MakeOfflineDownload.jar:desktopRuntime/CompileEPK.jar" net.lax1dude.eaglercraft.v1_8.buildtools.workspace.MakeSignedClient "javascript/SignedBundleTemplate.txt" "javascript/classes.js" "javascript/assets.epk" "javascript/lang" "javascript/SignedClientTemplate.txt" "javascript/UpdateDownloadSources.txt" "javascript/EaglercraftX_1.8_Offline_Signed_Client.html"
39 changes: 39 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
plugins {
id 'java'
id 'eclipse'
id 'org.teavm' version '0.9.2'
}

sourceSets {
main {
java {
srcDir 'src/main/java'
srcDir 'src/teavm/java'
}
}
}

repositories {
mavenCentral()
}

dependencies {
teavm(teavm.libs.jso)
teavm(teavm.libs.jsoApis)
}

teavm.js {
obfuscated = true
sourceMap = true
targetFileName = "../classes.js"
optimization = org.teavm.gradle.api.OptimizationLevel.BALANCED // no fps boost was observed with "AGGRESSIVE"
outOfProcess = false
fastGlobalAnalysis = false
processMemory = 512
entryPointName = 'main'
mainClass = 'net.lax1dude.eaglercraft.v1_8.internal.teavm.MainClass'
outputDir = file("javascript")
properties = null
sourceMap = true
debugInformation = false
}
Binary file added desktopRuntime/CompileEPK.jar
Binary file not shown.
Binary file not shown.
29 changes: 29 additions & 0 deletions desktopRuntime/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Copyright (c) 2012-present Lightweight Java Game Library
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

- Neither the name Lightweight Java Game Library nor the names of
its contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Binary file added desktopRuntime/MakeOfflineDownload.jar
Binary file not shown.
Binary file added desktopRuntime/OpenAL.dll
Binary file not shown.
Binary file added desktopRuntime/UnsafeMemcpy.dll
Binary file not shown.
Binary file added desktopRuntime/UnsafeMemcpy.jar
Binary file not shown.
32 changes: 32 additions & 0 deletions desktopRuntime/angle_license.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Copyright 2018 The ANGLE Project Authors.
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:

Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.

Neither the name of TransGaming Inc., Google Inc., 3DLabs Inc.
Ltd., nor the names of their contributors may be used to endorse
or promote products derived from this software without specific
prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Binary file added desktopRuntime/codecjorbis-20101023.jar
Binary file not shown.
Binary file added desktopRuntime/codecwav-20101023.jar
Binary file not shown.
Binary file added desktopRuntime/d3dcompiler_47.dll
Binary file not shown.
23 changes: 23 additions & 0 deletions desktopRuntime/eclipseProject/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src_main_java"/>
<classpathentry kind="src" path="src_lwjgl_java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="deps_fix/codecjorbis-20101023.jar"/>
<classpathentry kind="lib" path="deps_fix/codecwav-20101023.jar"/>
<classpathentry kind="lib" path="deps_fix/Java-WebSocket-1.5.1-with-dependencies.jar"/>
<classpathentry kind="lib" path="deps_fix/lwjgl.jar"/>
<classpathentry kind="lib" path="deps_fix/lwjgl-egl.jar"/>
<classpathentry kind="lib" path="deps_fix/lwjgl-glfw.jar"/>
<classpathentry kind="lib" path="deps_fix/lwjgl-jemalloc.jar"/>
<classpathentry kind="lib" path="deps_fix/lwjgl-openal.jar"/>
<classpathentry kind="lib" path="deps_fix/lwjgl-opengles.jar"/>
<classpathentry kind="lib" path="deps_fix/soundsystem-20120107.jar"/>
<classpathentry kind="lib" path="deps_fix/webrtc-java-0.8.0.jar"/>
<classpathentry kind="lib" path="deps_fix/UnsafeMemcpy.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
29 changes: 29 additions & 0 deletions desktopRuntime/eclipseProject/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>eclipseProject</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
<linkedResources>
<link>
<name>src_lwjgl_java</name>
<type>2</type>
<locationURI>PARENT-2-PROJECT_LOC../src/lwjgl/java</locationURI>
</link>
<link>
<name>src_main_java</name>
<type>2</type>
<locationURI>PARENT-2-PROJECT_LOC../src/main/java</locationURI>
</link>
</linkedResources>
</projectDescription>
15 changes: 15 additions & 0 deletions desktopRuntime/eclipseProject/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.8
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added desktopRuntime/eclipseProject/deps_fix/lwjgl.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.
23 changes: 23 additions & 0 deletions desktopRuntime/eclipseProject/eaglercraftDebugRuntime.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<booleanAttribute key="org.eclipse.debug.core.ATTR_FORCE_SYSTEM_CONSOLE_ENCODING" value="false"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/eclipseProject/src_lwjgl_java/net/lax1dude/eaglercraft/v1_8/internal/lwjgl/MainClass.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
<listEntry value="org.eclipse.debug.ui.launchGroup.run"/>
</listAttribute>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_ATTR_USE_ARGFILE" value="false"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_SHOW_CODEDETAILS_IN_EXCEPTION_MESSAGES" value="true"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_CLASSPATH_ONLY_JAR" value="false"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="net.lax1dude.eaglercraft.v1_8.internal.lwjgl.MainClass"/>
<stringAttribute key="org.eclipse.jdt.launching.MODULE_NAME" value="eclipseProject"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="eclipseProject"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Djava.library.path=."/>
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${project_loc}/../"/>
</launchConfiguration>
Binary file added desktopRuntime/glfw.dll
Binary file not shown.
21 changes: 21 additions & 0 deletions desktopRuntime/glfw_license.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Copyright (c) 2002-2006 Marcus Geelnard
Copyright (c) 2006-2010 Camilla Berglund <[email protected]>

This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.

Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:

1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would
be appreciated but is not required.

2. Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software.

3. This notice may not be removed or altered from any source
distribution.
Binary file added desktopRuntime/icon16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added desktopRuntime/icon32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added desktopRuntime/javadoc/lwjgl-egl-javadoc.jar
Binary file not shown.
Binary file added desktopRuntime/javadoc/lwjgl-glfw-javadoc.jar
Binary file not shown.
Binary file added desktopRuntime/javadoc/lwjgl-javadoc.jar
Binary file not shown.
Binary file not shown.
Binary file added desktopRuntime/javadoc/lwjgl-openal-javadoc.jar
Binary file not shown.
Binary file added desktopRuntime/javadoc/lwjgl-opengles-javadoc.jar
Binary file not shown.
Binary file added desktopRuntime/jemalloc.dll
Binary file not shown.
27 changes: 27 additions & 0 deletions desktopRuntime/jemalloc_license.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Unless otherwise specified, files in the jemalloc source distribution are
subject to the following license:
--------------------------------------------------------------------------------
Copyright (C) 2002-2018 Jason Evans <[email protected]>.
All rights reserved.
Copyright (C) 2007-2012 Mozilla Foundation. All rights reserved.
Copyright (C) 2009-2018 Facebook, Inc. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice(s),
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice(s),
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY EXPRESS
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------------
22 changes: 22 additions & 0 deletions desktopRuntime/khronos_license.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
** Copyright (c) 2013-2014 The Khronos Group Inc.
**
** Permission is hereby granted, free of charge, to any person obtaining a
** copy of this software and/or associated documentation files (the
** "Materials"), to deal in the Materials without restriction, including
** without limitation the rights to use, copy, modify, merge, publish,
** distribute, sublicense, and/or sell copies of the Materials, and to
** permit persons to whom the Materials are furnished to do so, subject to
** the following conditions:
**
** The above copyright notice and this permission notice shall be included
** in all copies or substantial portions of the Materials.
**
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
*/
Binary file added desktopRuntime/libEGL.dll
Binary file not shown.
Binary file added desktopRuntime/libEGL.so
Binary file not shown.
Binary file added desktopRuntime/libGLESv2.dll
Binary file not shown.
Binary file added desktopRuntime/libGLESv2.so
Binary file not shown.
Binary file added desktopRuntime/libUnsafeMemcpy.so
Binary file not shown.
21 changes: 21 additions & 0 deletions desktopRuntime/libffi_license.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
libffi - Copyright (c) 1996-2020 Anthony Green, Red Hat, Inc and others.
See source files for details.

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
``Software''), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Binary file added desktopRuntime/libglfw.so
Binary file not shown.
Binary file added desktopRuntime/libjemalloc.so
Binary file not shown.
Binary file added desktopRuntime/liblwjgl.so
Binary file not shown.
Binary file added desktopRuntime/liblwjgl_opengles.so
Binary file not shown.
Binary file added desktopRuntime/libopenal.so
Binary file not shown.
7 changes: 7 additions & 0 deletions desktopRuntime/liburing_license.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Copyright 2020 Jens Axboe

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Binary file added desktopRuntime/libvulkan.so.1
Binary file not shown.
Binary file added desktopRuntime/libwebrtc-java.so
Binary file not shown.
Binary file added desktopRuntime/lwjgl-egl.jar
Binary file not shown.
Binary file added desktopRuntime/lwjgl-glfw.jar
Binary file not shown.
Binary file added desktopRuntime/lwjgl-jemalloc.jar
Binary file not shown.
Binary file added desktopRuntime/lwjgl-openal.jar
Binary file not shown.
Binary file added desktopRuntime/lwjgl-opengles.jar
Binary file not shown.
Binary file added desktopRuntime/lwjgl.dll
Binary file not shown.
Binary file added desktopRuntime/lwjgl.jar
Binary file not shown.
Binary file added desktopRuntime/lwjgl_opengles.dll
Binary file not shown.
481 changes: 481 additions & 0 deletions desktopRuntime/openal_soft_license.txt

Large diffs are not rendered by default.

110 changes: 110 additions & 0 deletions desktopRuntime/resources/SignedClientTemplate.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="EaglercraftX 1.8 Offline" />
<meta name="keywords" content="eaglercraft, eaglercraftx, minecraft, 1.8, 1.8.8" />
<title>EaglercraftX 1.8</title>
<meta property="og:locale" content="en-US" />
<meta property="og:type" content="website" />
<meta property="og:title" content="EaglercraftX 1.8" />
<meta property="og:description" content="Play minecraft 1.8 in your browser" />
<script type="text/javascript">
"use strict";
const relayId = Math.floor(Math.random() * 3);

// %%%%%%%%% launch options %%%%%%%%%%%%

window.eaglercraftXOptsHints = {
hintsVersion: 1,
container: "game_frame",
worldsDB: "worlds",
relays: [
{ addr: "wss://relay.deev.is/", comment: "lax1dude relay #1", primary: relayId === 0 },
{ addr: "wss://relay.lax1dude.net/", comment: "lax1dude relay #2", primary: relayId === 1 },
{ addr: "wss://relay.shhnowisnottheti.me/", comment: "ayunami relay #1", primary: relayId === 2 }
],
checkRelaysForUpdates: true
};

// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

</script>
<style type="eaglercraft" id="eaglercraftXClientSignature">data:application/octet-stream;base64,${client_signature}</style>
<style type="eaglercraft" id="eaglercraftXClientBundle">data:application/octet-stream;base64,${client_bundle}</style>
<script type="text/javascript">
"use strict";
(function(){
function eaglerBundleUnwrap(tagIn) { const e = document.getElementById(tagIn); const ret = e.innerText; e.remove(); return ret; }
window.eaglercraftXClientSignature = eaglerBundleUnwrap("eaglercraftXClientSignature");
window.eaglercraftXClientBundle = eaglerBundleUnwrap("eaglercraftXClientBundle");
})();
</script>
<script type="text/javascript">
"use strict";
(function(){
var ds = new DecompressionStream("gzip");
var result = [];
function fetchStream(reader) {
reader.read().then(function processData({ done, value }) {
if (done) {
window.clientScriptSrcURL = URL.createObjectURL(new Blob(result, { type: "text/javascript;charset=utf-8" }));
result = [];
ds = null;
return;
}
result.push(value);
return reader.read().then(processData);
});
}
fetch(window.eaglercraftXClientBundle, { cache: "force-cache" })
.then((response) => response.blob())
.then((blob) => fetchStream(blob.stream().pipeThrough(ds).getReader()));
})();
</script>
<script type="text/javascript">
"use strict";
(function(){
var launchInterval = -1;
var launchCounter = 1;
var launchCountdownNumberElement = null;
var launchCountdownProgressElement = null;
function launchTick() {
if(launchCounter > 100) {
if(window.clientScriptSrcURL) {
clearInterval(launchInterval);
setTimeout(() => {
document.getElementById("launch_countdown_screen").remove();
const script = document.createElement("script");
script.type = "text/javascript";
script.src = window.clientScriptSrcURL;
window.clientScriptSrcURL = null;
document.head.appendChild(script);
}, 50);
}
return;
}
launchCountdownNumberElement.innerText = "" + Math.floor(6.0 - launchCounter * 0.06);
launchCountdownProgressElement.style.width = "" + launchCounter + "%";
++launchCounter;
}
window.addEventListener("load", () => {
launchCountdownNumberElement = document.getElementById("launchCountdownNumber");
launchCountdownProgressElement = document.getElementById("launchCountdownProgress");
launchInterval = setInterval(launchTick, 50);
});
})();
</script>
<link type="image/png" rel="shortcut icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAIAAAD8GO2jAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAFiUAABYlAUlSJPAAAAR/SURBVEhLtZXZK3ZRFMYPcqXc+gv413DHxVuGIpIhkciQWaRccCNjSCkligwXSOZ5nmfv9zvn2e8+58V753sudmuvvdZ61l5r7XOc8H+GS/D19aUNkPz5+aktQH5/f//4+LBKZKuRkpUtQjCUYG5gD2T38vLy/PwsDfL9/f3Dw8PT05M0b29vnKLhCKCBT4L4gvBLBIei4//4+Hh1dUVEQutUuLu7E83FxQUGnKLBWKfQaA3S+AREVxaEOD8/Pzk50XpzcyMDcH19zdZG3N3d3dzc3Nvb01aX5pQUpQGGQJxcQpfNysoKhUIdHR1o1tbWbInYAgxIPDMzMy8vLzc3FxqOdMoRqwJK8G8ALUYIhHMiSEhIwI6CyIb0qQzC4eGhsXCc1tZWnZIEKzdQJQSXgKxfX18RCM3Z5eWlcfVAxKOjo+Pj49PTU88lTOk2NjbMsePc3t6SAfcgFdszOyMuAdeBg0CQi2lhYUHOeOLDCisN8FzcPFZXV3t7ezHY3t5GQ+6it+2xMASsKhEEWKsmRLRBBUpPvpJ/TpFKFBwKYAiITmicsbYhdHfJAltqhUCVsCQhwslmeXmZxiBQT9c0Ar9E2O3v72sYSE0N1yQArkKy0kBMXLqlZqIZHR3t6empqqqSDcBdhXEJSJ/bUc3q6uq+vj629GB9fR1WsLW1NTs7u7S0RN2locMjIyOEm5ubQ7+4uJienk4/+vv77Y1hwhLBEKhwWHitdVFfX9/Y2Gg2HuLi4owUAysrK8yCG97rh0+ApP5Q2ZycHFlPTExUVFRIBvn5+WhKSkp2dnaMKhptbW2426GgQ/rwuAQCZ1hwFayLiork9hMFBQV1dXVmE0BLS4vqw3QFB8kn4IAxoGPkYpxi4FeDmpqas7Mz4pClAgqGwD48rjY2NmacYqC0tJQ1KSlJWyE5OZkpUKkBAxZVIntAoZh04+Q48fHxPNGBgYHExMT29naj9cBodnZ2mo3jlJWVMeW2OGQck4B1amqqoaGhqamJjx2lGxwcpL0mUgR8fJhsWqJtSkoKU2SbHHUDpkhPBujd8xuQG6PJRM/Pz09PT7O1NNnZ2Tw3fgZkXVhYKCUlUhBATP+hCVyKZGky17RV0g04laayslJ6hlVeFHB4eFhKaogGd0LxtmTgE+hbhKDnPjMzgw8E3qGL2tpaBWpubjYqj2BoaEj6rq4uNATRZ0ZwCbiL6gXEzINk5vCBQJ9rMD4+rkA8QNK036uDg4Py8vLu7m680KjIBNR3zBDoWQM1g98snyB+VSoRW8C/UwR81/SvhgNj9JOTkwwVERUdRBEI0BAdLRVERkhLS8vIyEDQlrsTPTU1lVFhKxARvZgUlFLbegCf4BvIsbi4mIg4E5EogIHhiKCMtU0WUFiVy06j5fAJIDdSBDQw+PegDfBRcbOPwH4F9LuFWIIQdQNKwWqzIE0aoFUaBsw+SQuFw0uNtC9A+F4i3QNrbg3IDn+SAsHh+wYiEpeyBEMLv/cAO6KzAijxxB+Y4wisBhssJUhjEbPJf4Nw+B+JXqLW3bw+wQAAAABJRU5ErkJggg==" />
</head>
<body style="margin:0px;width:100vw;height:100vh;overflow:hidden;" id="game_frame">
<div style="margin:0px;width:100%;height:100%;font-family:sans-serif;display:flex;align-items:center;user-select:none;" id="launch_countdown_screen">
<div style="margin:auto;text-align:center;">
<h1>This file is from <span style="color:#AA0000;">${date}</span></h1>
<h2>Game will launch in <span id="launchCountdownNumber">5</span>...</h2>
<div style="border:2px solid black;width:100%;height:15px;padding:1px;margin-bottom:20vh;"><div id="launchCountdownProgress" style="background-color:#555555;width:0%;height:100%;"></div></div>
</div>
</div>
</body>
</html>
707 changes: 707 additions & 0 deletions desktopRuntime/resources/assets/eagler/CREDITS.txt

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added desktopRuntime/resources/assets/eagler/eagtek.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions desktopRuntime/resources/assets/eagler/glsl/accel_font.fsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#line 2

/*
* Copyright (c) 2022-2023 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/

precision lowp int;
precision mediump float;
precision mediump sampler2D;

in vec2 v_texCoord2f;
in vec4 v_color4f;

layout(location = 0) out vec4 output4f;

uniform sampler2D u_inputTexture;
uniform vec4 u_colorBias4f;

void main() {
output4f = texture(u_inputTexture, v_texCoord2f) * v_color4f + u_colorBias4f;
if(output4f.a < 0.004) {
discard;
}
}
53 changes: 53 additions & 0 deletions desktopRuntime/resources/assets/eagler/glsl/accel_font.vsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#line 2

/*
* Copyright (c) 2022-2023 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/

precision lowp int;
precision highp float;
precision mediump sampler2D;

layout(location = 0) in vec3 a_position3f;

layout(location = 1) in vec2 c_position2i;
layout(location = 2) in vec2 c_coords2i;
layout(location = 3) in vec4 c_color4f;

out vec2 v_texCoord2f;
out vec4 v_color4f;

uniform mat4 u_matrixTransform;
uniform vec2 u_charSize2f;
uniform vec2 u_charCoordSize2f;
uniform vec4 u_color4f;

void main() {
v_color4f = c_color4f.bgra;
float shadowBit = a_position3f.z;
float boldBit = shadowBit >= 0.5 ? 1.0 : 0.0;
shadowBit -= boldBit * 0.5;
v_color4f.rgb *= (1.0 - shadowBit * 3.0);
v_texCoord2f = (c_coords2i + a_position3f.xy) * u_charCoordSize2f;
vec2 pos2d = c_position2i + vec2(shadowBit * 4.0);
pos2d += a_position3f.xy * u_charSize2f;
pos2d.x += boldBit;
float italicBit = v_color4f.a >= 0.5 ? 2.0 : 0.0;
v_color4f.a -= italicBit * 0.25;
pos2d.x -= (a_position3f.y - 0.5) * italicBit;
v_color4f.a *= 2.0;
v_color4f *= u_color4f;
gl_Position = u_matrixTransform * vec4(pos2d, 0.0, 1.0);
}
35 changes: 35 additions & 0 deletions desktopRuntime/resources/assets/eagler/glsl/accel_particle.fsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#line 2

/*
* Copyright (c) 2022-2023 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/

precision lowp int;
precision mediump float;
precision mediump sampler2D;

in vec2 v_texCoord2f;
in vec4 v_color4f;

layout(location = 0) out vec4 output4f;

uniform sampler2D u_inputTexture;

void main() {
output4f = texture(u_inputTexture, v_texCoord2f) * v_color4f;
if(output4f.a < 0.004) {
discard;
}
}
61 changes: 61 additions & 0 deletions desktopRuntime/resources/assets/eagler/glsl/accel_particle.vsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#line 2

/*
* Copyright (c) 2022-2023 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/

precision lowp int;
precision highp float;
precision mediump sampler2D;

layout(location = 0) in vec2 a_position2f;

layout(location = 1) in vec3 p_position3f;
layout(location = 2) in vec2 p_texCoords2i;
layout(location = 3) in vec2 p_lightMap2f;
layout(location = 4) in vec2 p_particleSize_texCoordsSize_2i;
layout(location = 5) in vec4 p_color4f;

out vec2 v_texCoord2f;
out vec4 v_color4f;

uniform mat4 u_matrixTransform;
uniform vec3 u_texCoordSize2f_particleSize1f;
uniform vec4 u_transformParam_1_2_3_4_f;
uniform float u_transformParam_5_f;
uniform vec4 u_color4f;

uniform sampler2D u_lightmapTexture;

void main() {
v_color4f = u_color4f * p_color4f.bgra * texture(u_lightmapTexture, p_lightMap2f);

vec2 tex2f = a_position2f * 0.5 + 0.5;
tex2f.y = 1.0 - tex2f.y;
tex2f = p_texCoords2i + tex2f * p_particleSize_texCoordsSize_2i.y;
v_texCoord2f = tex2f * u_texCoordSize2f_particleSize1f.xy;

float particleSize = u_texCoordSize2f_particleSize1f.z * p_particleSize_texCoordsSize_2i.x;

vec3 pos3f = p_position3f;
vec2 spos2f = a_position2f * particleSize;
pos3f.x += u_transformParam_1_2_3_4_f.x * spos2f.x;
pos3f.x += u_transformParam_1_2_3_4_f.w * spos2f.y;
pos3f.y += u_transformParam_1_2_3_4_f.y * spos2f.y;
pos3f.z += u_transformParam_1_2_3_4_f.z * spos2f.x;
pos3f.z += u_transformParam_5_f * spos2f.y;

gl_Position = u_matrixTransform * vec4(pos3f, 1.0);
}
183 changes: 183 additions & 0 deletions desktopRuntime/resources/assets/eagler/glsl/core.fsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
#line 2

/*
* Copyright (c) 2022-2023 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/

#if defined(COMPILE_ENABLE_TEX_GEN) || defined(COMPILE_ENABLE_FOG)
in vec4 v_position4f;
#endif

#ifdef COMPILE_TEXTURE_ATTRIB
in vec2 v_texture2f;
#endif

uniform vec4 u_color4f;

#ifdef COMPILE_BLEND_ADD
uniform vec4 u_colorBlendSrc4f;
uniform vec4 u_colorBlendAdd4f;
#endif

#ifdef COMPILE_COLOR_ATTRIB
in vec4 v_color4f;
#endif

#ifdef COMPILE_NORMAL_ATTRIB
in vec3 v_normal3f;
#endif

#ifdef COMPILE_LIGHTMAP_ATTRIB
in vec2 v_lightmap2f;
#endif

#ifdef COMPILE_ENABLE_TEXTURE2D
uniform sampler2D u_samplerTexture;
#if !defined(COMPILE_TEXTURE_ATTRIB) && !defined(COMPILE_ENABLE_TEX_GEN)
uniform vec2 u_textureCoords01;
#endif
#endif

#ifdef COMPILE_ENABLE_LIGHTMAP
uniform sampler2D u_samplerLightmap;
#ifndef COMPILE_LIGHTMAP_ATTRIB
uniform vec2 u_textureCoords02;
#endif
#endif

#ifdef COMPILE_ENABLE_ALPHA_TEST
uniform float u_alphaTestRef1f;
#endif

#ifdef COMPILE_ENABLE_MC_LIGHTING
uniform int u_lightsEnabled1i;
uniform vec4 u_lightsDirections4fv[4];
uniform vec3 u_lightsAmbient3f;
#ifndef COMPILE_NORMAL_ATTRIB
uniform vec3 u_uniformNormal3f;
#endif
#endif

#ifdef COMPILE_ENABLE_FOG
uniform vec4 u_fogParameters4f;
uniform vec4 u_fogColor4f;
#endif

#ifdef COMPILE_ENABLE_TEX_GEN
in vec3 v_objectPosition3f;
uniform ivec4 u_texGenPlane4i;
uniform vec4 u_texGenS4f;
uniform vec4 u_texGenT4f;
uniform vec4 u_texGenR4f;
uniform vec4 u_texGenQ4f;
uniform mat4 u_textureMat4f01;
#endif

#ifdef COMPILE_ENABLE_ANISOTROPIC_FIX
uniform vec2 u_textureAnisotropicFix;
#endif

layout(location = 0) out vec4 output4f;

void main() {

#ifdef COMPILE_COLOR_ATTRIB
vec4 color = v_color4f * u_color4f;
#else
vec4 color = u_color4f;
#endif

#ifdef COMPILE_ENABLE_TEX_GEN
vec4 texGenVector;

vec4 texGenPosSrc[2];
texGenPosSrc[0] = vec4(v_objectPosition3f, 1.0);
texGenPosSrc[1] = v_position4f;

texGenVector.x = dot(texGenPosSrc[u_texGenPlane4i.x], u_texGenS4f);
texGenVector.y = dot(texGenPosSrc[u_texGenPlane4i.y], u_texGenT4f);
texGenVector.z = dot(texGenPosSrc[u_texGenPlane4i.z], u_texGenR4f);
texGenVector.w = dot(texGenPosSrc[u_texGenPlane4i.w], u_texGenQ4f);

texGenVector = u_textureMat4f01 * texGenVector;
color *= texture(u_samplerTexture, texGenVector.xy / texGenVector.w);

#ifdef COMPILE_ENABLE_ALPHA_TEST
if(color.a < u_alphaTestRef1f) discard;
#endif

#else

#ifdef COMPILE_ENABLE_TEXTURE2D
#ifdef COMPILE_TEXTURE_ATTRIB
#ifdef COMPILE_ENABLE_ANISOTROPIC_FIX
// d3d11 doesn't support GL_NEAREST upscaling with anisotropic
// filtering enabled, so it needs this stupid fix to 'work'
vec2 uv = floor(v_texture2f * u_textureAnisotropicFix) + 0.5;
color *= texture(u_samplerTexture, uv / u_textureAnisotropicFix);
#else
color *= texture(u_samplerTexture, v_texture2f);
#endif
#else
color *= texture(u_samplerTexture, u_textureCoords01);
#endif
#endif

#ifdef COMPILE_ENABLE_LIGHTMAP
#ifdef COMPILE_LIGHTMAP_ATTRIB
color *= texture(u_samplerLightmap, v_lightmap2f);
#else
color *= texture(u_samplerLightmap, u_textureCoords02);
#endif
#endif

#ifdef COMPILE_BLEND_ADD
color = color * u_colorBlendSrc4f + u_colorBlendAdd4f;
#endif

#ifdef COMPILE_ENABLE_ALPHA_TEST
if(color.a < u_alphaTestRef1f) discard;
#endif

#endif

#ifdef COMPILE_ENABLE_MC_LIGHTING
#ifdef COMPILE_NORMAL_ATTRIB
vec3 normal = normalize(v_normal3f);
#else
vec3 normal = u_uniformNormal3f;
#endif
float diffuse = 0.0;
vec4 light;
for(int i = 0; i < u_lightsEnabled1i; ++i) {
light = u_lightsDirections4fv[i];
diffuse += max(dot(light.xyz, normal), 0.0) * light.w;
}
color.rgb *= min(u_lightsAmbient3f + vec3(diffuse), 1.0);
#endif

#ifdef COMPILE_ENABLE_FOG
vec3 fogPos = v_position4f.xyz / v_position4f.w;
float dist = sqrt(dot(fogPos, fogPos));
float fogDensity = u_fogParameters4f.y;
float fogStart = u_fogParameters4f.z;
float fogEnd = u_fogParameters4f.w;
float f = u_fogParameters4f.x > 0.0 ? 1.0 - exp(-fogDensity * dist) :
(dist - fogStart) / (fogEnd - fogStart);
color.rgb = mix(color.rgb, u_fogColor4f.rgb, clamp(f, 0.0, 1.0) * u_fogColor4f.a);
#endif

output4f = color;
}
99 changes: 99 additions & 0 deletions desktopRuntime/resources/assets/eagler/glsl/core.vsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
#line 2

/*
* Copyright (c) 2022-2023 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/

in vec3 a_position3f;

#if defined(COMPILE_ENABLE_TEX_GEN) || defined(COMPILE_ENABLE_FOG)
#define _COMPILE_VARYING_POSITION
#endif

#ifdef _COMPILE_VARYING_POSITION
out vec4 v_position4f;
#endif

#ifdef COMPILE_ENABLE_TEX_GEN
out vec3 v_objectPosition3f;
#endif

#ifdef COMPILE_TEXTURE_ATTRIB
in vec2 a_texture2f;
out vec2 v_texture2f;
uniform mat4 u_textureMat4f01;
#endif

#ifdef COMPILE_COLOR_ATTRIB
in vec4 a_color4f;
out vec4 v_color4f;
#endif

#ifdef COMPILE_NORMAL_ATTRIB
in vec4 a_normal4f;
out vec3 v_normal3f;
#endif

#ifdef COMPILE_LIGHTMAP_ATTRIB
in vec2 a_lightmap2f;
out vec2 v_lightmap2f;
uniform mat4 u_textureMat4f02;
#endif

#ifdef _COMPILE_VARYING_POSITION
uniform mat4 u_modelviewMat4f;
uniform mat4 u_projectionMat4f;
#else
uniform mat4 u_modelviewProjMat4f;
#ifdef COMPILE_NORMAL_ATTRIB
uniform mat4 u_modelviewMat4f;
#endif
#endif

#define TEX_MAT3(mat4In) mat3(mat4In[0].xyw,mat4In[1].xyw,mat4In[3].xyw)

void main() {
#ifdef COMPILE_ENABLE_TEX_GEN
v_objectPosition3f = a_position3f;
#endif

#ifdef _COMPILE_VARYING_POSITION
v_position4f = u_modelviewMat4f * vec4(a_position3f, 1.0);
#endif

#ifdef COMPILE_TEXTURE_ATTRIB
vec3 v_textureTmp3f = TEX_MAT3(u_textureMat4f01) * vec3(a_texture2f, 1.0);
v_texture2f = v_textureTmp3f.xy / v_textureTmp3f.z;
#endif

#ifdef COMPILE_COLOR_ATTRIB
v_color4f = a_color4f;
#endif

#ifdef COMPILE_NORMAL_ATTRIB
v_normal3f = normalize(mat3(u_modelviewMat4f) * a_normal4f.xyz);
#endif

#ifdef COMPILE_LIGHTMAP_ATTRIB
vec3 v_lightmapTmp3f = TEX_MAT3(u_textureMat4f02) * vec3(a_lightmap2f, 1.0);
v_lightmap2f = v_lightmapTmp3f.xy / v_lightmapTmp3f.z;
#endif

#ifdef _COMPILE_VARYING_POSITION
gl_Position = u_projectionMat4f * v_position4f;
#else
gl_Position = u_modelviewProjMat4f * vec4(a_position3f, 1.0);
#endif
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#line 2

/*
* Copyright (c) 2023 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/

precision lowp int;
precision highp float;
precision mediump sampler2D;

layout(location = 0) in vec2 a_position2f;

layout(location = 1) in vec3 p_position3f;
layout(location = 2) in vec2 p_texCoords2i;
layout(location = 3) in vec2 p_lightMap2f;
layout(location = 4) in vec2 p_particleSize_texCoordsSize_2i;
layout(location = 5) in vec4 p_color4f;

out vec2 v_texCoord2f;
out vec4 v_color4f;
out vec2 v_lightmap2f;

#ifdef COMPILE_FORWARD_VSH
out vec4 v_position4f;
uniform mat4 u_modelViewMatrix4f;
uniform mat4 u_projectionMatrix4f;
#endif

#ifdef COMPILE_GBUFFER_VSH
uniform mat4 u_matrixTransform;
#endif

uniform vec3 u_texCoordSize2f_particleSize1f;
uniform vec4 u_transformParam_1_2_3_4_f;
uniform float u_transformParam_5_f;

void main() {
v_color4f = p_color4f.bgra;
v_lightmap2f = p_lightMap2f;

vec2 tex2f = a_position2f * 0.5 + 0.5;
tex2f.y = 1.0 - tex2f.y;
tex2f = p_texCoords2i + tex2f * p_particleSize_texCoordsSize_2i.y;
v_texCoord2f = tex2f * u_texCoordSize2f_particleSize1f.xy;

float particleSize = u_texCoordSize2f_particleSize1f.z * p_particleSize_texCoordsSize_2i.x;

vec3 pos3f = p_position3f;
vec2 spos2f = a_position2f * particleSize;
pos3f.x += u_transformParam_1_2_3_4_f.x * spos2f.x;
pos3f.x += u_transformParam_1_2_3_4_f.w * spos2f.y;
pos3f.y += u_transformParam_1_2_3_4_f.y * spos2f.y;
pos3f.z += u_transformParam_1_2_3_4_f.z * spos2f.x;
pos3f.z += u_transformParam_5_f * spos2f.y;

#ifdef COMPILE_GBUFFER_VSH
gl_Position = u_matrixTransform * vec4(pos3f, 1.0);
#endif
#ifdef COMPILE_FORWARD_VSH
v_position4f = u_modelViewMatrix4f * vec4(pos3f, 1.0);
gl_Position = u_projectionMatrix4f * v_position4f;
#endif
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,235 @@
#line 2

/*
* Copyright (c) 2023 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/

precision lowp int;
precision highp float;
precision mediump sampler2D;
precision highp sampler2DShadow;

in vec4 v_position4f;
in vec2 v_texCoord2f;
in vec4 v_color4f;
in vec2 v_lightmap2f;

layout(location = 0) out vec4 output4f;

uniform sampler2D u_diffuseTexture;

uniform vec2 u_textureYScale2f;

uniform mat4 u_inverseViewMatrix4f;

#ifdef COMPILE_DYNAMIC_LIGHTS
struct DynamicLight {
mediump vec4 u_lightPosition4f;
mediump vec4 u_lightColor4f;
};
layout(std140) uniform u_chunkLightingData {
mediump int u_dynamicLightCount1i;
mediump int _paddingA_;
mediump int _paddingB_;
mediump int _paddingC_;
DynamicLight u_dynamicLightArray[12];
};
#endif

layout(std140) uniform u_worldLightingData {
mediump vec4 u_sunDirection4f;
mediump vec4 u_sunColor3f_sky1f;
mediump vec4 u_fogParameters4f;
mediump vec4 u_fogColorLight4f;
mediump vec4 u_fogColorDark4f;
mediump vec4 u_fogColorAddSun4f;
mediump vec4 u_blockSkySunDynamicLightFac4f;
#ifdef COMPILE_SUN_SHADOW_LOD0
mediump mat4 u_sunShadowMatrixLOD04f;
#define DO_COMPILE_SUN_SHADOWS
#define SUN_SHADOW_MAP_FRAC 1.0
#endif
#ifdef COMPILE_SUN_SHADOW_LOD1
mediump mat4 u_sunShadowMatrixLOD04f;
mediump mat4 u_sunShadowMatrixLOD14f;
#define DO_COMPILE_SUN_SHADOWS
#define SUN_SHADOW_MAP_FRAC 0.5
#endif
#ifdef COMPILE_SUN_SHADOW_LOD2
mediump mat4 u_sunShadowMatrixLOD04f;
mediump mat4 u_sunShadowMatrixLOD14f;
mediump mat4 u_sunShadowMatrixLOD24f;
#define DO_COMPILE_SUN_SHADOWS
#define SUN_SHADOW_MAP_FRAC 0.3333333
#endif
};

uniform sampler2D u_samplerNormalMaterial;

uniform sampler2D u_metalsLUT;

#define LIB_INCLUDE_PBR_LIGHTING_FUNCTION
#define LIB_INCLUDE_PBR_LIGHTING_PREFETCH
#EAGLER INCLUDE (3) "eagler:glsl/deferred/lib/pbr_lighting.glsl"

uniform sampler2D u_irradianceMap;

#ifdef DO_COMPILE_SUN_SHADOWS
uniform sampler2DShadow u_sunShadowDepthTexture;
#endif

void main() {
vec4 worldPosition4f;
vec4 worldDirection4f;
vec4 diffuseColor4f;
vec3 normalVector3f;
vec2 lightmapCoords2f;
vec3 materialData3f;

// =========== RESOLVE CONSTANTS ============ //

worldPosition4f = u_inverseViewMatrix4f * v_position4f;
worldPosition4f.xyz /= worldPosition4f.w;
worldPosition4f.w = 1.0;
worldDirection4f = u_inverseViewMatrix4f * vec4(v_position4f.xyz / v_position4f.w, 0.0);
worldDirection4f.xyz = normalize(worldDirection4f.xyz);

lightmapCoords2f = v_lightmap2f;

normalVector3f = normalize(u_inverseViewMatrix4f[2].xyz);

// ========= CALCULATE DIFFUSE COLOR ========== //

diffuseColor4f = texture(u_diffuseTexture, v_texCoord2f) * v_color4f;

// ============= ALPHA TEST ============== //

if(diffuseColor4f.a < 0.004) discard;

// ========== RESOLVE MATERIALS =========== //

materialData3f = texture(u_samplerNormalMaterial, vec2(v_texCoord2f.x, v_texCoord2f.y * u_textureYScale2f.x + u_textureYScale2f.y)).rgb;

vec3 metalN, metalK;
PREFETCH_METALS(diffuseColor4f.rgb, materialData3f.g, metalN, metalK)

// ============ SUN LIGHTING ============== //

diffuseColor4f.rgb *= diffuseColor4f.rgb;

vec3 lightColor3f = vec3(0.0);
if(dot(u_sunDirection4f.xyz, normalVector3f) > 0.0 && lightmapCoords2f.g > 0.5 &&
(u_sunColor3f_sky1f.r + u_sunColor3f_sky1f.g + u_sunColor3f_sky1f.b) > 0.001) {
#ifdef DO_COMPILE_SUN_SHADOWS

// ========== SUN SHADOW: LOD0 ============ //

float skyLight = max(lightmapCoords2f.g * 2.0 - 1.0, 0.0);
float shadowSample = 1.0;
vec4 shadowWorldPos4f = worldPosition4f;
shadowWorldPos4f.xyz += normalVector3f * 0.05;

vec4 shadowTexPos4f;
vec2 tmpVec2;
for(;;) {
shadowTexPos4f = u_sunShadowMatrixLOD04f * shadowWorldPos4f;
if(shadowTexPos4f.xyz == clamp(shadowTexPos4f.xyz, vec3(0.005), vec3(0.995))) {
shadowSample = textureLod(u_sunShadowDepthTexture, vec3(shadowTexPos4f.xy * vec2(1.0, SUN_SHADOW_MAP_FRAC), shadowTexPos4f.z), 0.0);
break;
}

#if defined(COMPILE_SUN_SHADOW_LOD1) || defined(COMPILE_SUN_SHADOW_LOD2)
shadowTexPos4f = u_sunShadowMatrixLOD14f * shadowWorldPos4f;
if(shadowTexPos4f.xyz == clamp(shadowTexPos4f.xyz, vec3(0.005), vec3(0.995))) {
shadowTexPos4f.y += 1.0;
shadowTexPos4f.y *= SUN_SHADOW_MAP_FRAC;
shadowSample = textureLod(u_sunShadowDepthTexture, vec3(shadowTexPos4f.xy, shadowTexPos4f.z + 0.00015), 0.0);
break;
}
#endif

#ifdef COMPILE_SUN_SHADOW_LOD2
shadowTexPos4f = u_sunShadowMatrixLOD24f * shadowWorldPos4f;
if(shadowTexPos4f.xyz == clamp(shadowTexPos4f.xyz, vec3(0.005), vec3(0.995))) {
shadowTexPos4f.y += 2.0;
shadowTexPos4f.y *= SUN_SHADOW_MAP_FRAC;
shadowSample = textureLod(u_sunShadowDepthTexture, vec3(shadowTexPos4f.xy, shadowTexPos4f.z + 0.00015), 0.0);
}
#endif
break;
}
#endif
lightColor3f = u_sunColor3f_sky1f.rgb * max(lightmapCoords2f.g * 2.0 - 1.0, 0.0);
#ifdef DO_COMPILE_SUN_SHADOWS
lightColor3f *= shadowSample * skyLight;
#endif
vec3 normalWrap3f = normalVector3f * (dot(-worldDirection4f.xyz, normalVector3f) < 0.0 ? -1.0 : 1.0);
lightColor3f = eaglercraftLighting(diffuseColor4f.rgb, lightColor3f, -worldDirection4f.xyz, u_sunDirection4f.xyz, normalWrap3f, materialData3f, metalN, metalK) * u_blockSkySunDynamicLightFac4f.z;
}

// =========== IRRADIANCE MAP =========== //

lightmapCoords2f *= lightmapCoords2f;

vec3 irradianceMapSamplePos2f = normalVector3f;
irradianceMapSamplePos2f.xz /= abs(irradianceMapSamplePos2f.y) + 1.0;
float dst = 1.0 - dot(irradianceMapSamplePos2f.xz, irradianceMapSamplePos2f.xz);
dst *= dst;
irradianceMapSamplePos2f.xz *= 0.975;
vec3 skyLight = vec3(sqrt(0.01 + max(u_sunDirection4f.w, 0.0)));
if(dst < 0.005) {
vec4 sample1 = textureLod(u_irradianceMap, irradianceMapSamplePos2f.xz * vec2(0.5, 0.25) + vec2(0.5, 0.25), 0.0);
vec4 sample2 = textureLod(u_irradianceMap, irradianceMapSamplePos2f.xz * vec2(0.5, -0.25) + vec2(0.5, 0.75), 0.0);
skyLight += mix(sample1.rgb, sample2.rgb, smoothstep(0.0, 1.0, irradianceMapSamplePos2f.y * -12.5 + 0.5)).rgb;
}else {
irradianceMapSamplePos2f.xz *= vec2(0.5, irradianceMapSamplePos2f.y > 0.0 ? 0.25 : -0.25);
irradianceMapSamplePos2f.xz += vec2(0.5, irradianceMapSamplePos2f.y > 0.0 ? 0.25 : 0.75);
skyLight += textureLod(u_irradianceMap, irradianceMapSamplePos2f.xz, 0.0).rgb;
}
skyLight *= lightmapCoords2f.g * u_sunColor3f_sky1f.w;

#ifdef COMPILE_DYNAMIC_LIGHTS

// =========== DYNAMIC LIGHTING =========== //

vec3 dlightDist3f, dlightDir3f, dlightColor3f;
int safeLightCount = u_dynamicLightCount1i > 12 ? 0 : u_dynamicLightCount1i; // hate this
for(int i = 0; i < safeLightCount; ++i) {
dlightDist3f = worldPosition4f.xyz - u_dynamicLightArray[i].u_lightPosition4f.xyz;
dlightDir3f = normalize(dlightDist3f);
dlightDir3f = dlightDir3f * (dot(dlightDir3f, normalVector3f) < 0.0 ? 1.0 : -1.0);
dlightDir3f = materialData3f.b == 1.0 ? normalVector3f : -dlightDir3f;
if(dot(dlightDir3f, normalVector3f) <= 0.0) {
continue;
}
dlightColor3f = u_dynamicLightArray[i].u_lightColor4f.rgb / dot(dlightDist3f, dlightDist3f);
if(dlightColor3f.r + dlightColor3f.g + dlightColor3f.b < 0.025) {
continue;
}
lightColor3f += eaglercraftLighting(diffuseColor4f.rgb, dlightColor3f, -worldDirection4f.xyz, dlightDir3f, normalVector3f, materialData3f, metalN, metalK) * u_blockSkySunDynamicLightFac4f.w;
}

#endif

// ============ OUTPUT COLOR ============== //

vec3 blockLight = lightmapCoords2f.r * vec3(1.0, 0.5809, 0.2433) * 2.0 * u_blockSkySunDynamicLightFac4f.x;
skyLight *= u_blockSkySunDynamicLightFac4f.y;
float emissive = materialData3f.b == 1.0 ? 0.0 : materialData3f.b;
diffuseColor4f.rgb *= max(skyLight + blockLight, vec3(emissive * emissive * 20.0 + 0.075)) * 0.075;
diffuseColor4f.rgb += lightColor3f;

output4f = vec4(diffuseColor4f.rgb * diffuseColor4f.a, diffuseColor4f.a);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#line 2

/*
* Copyright (c) 2023 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/

precision lowp int;
precision mediump float;
precision mediump sampler2D;

in vec2 v_texCoord2f;
in vec4 v_color4f;
in vec2 v_lightmap2f;

layout(location = 0) out vec4 gbufferColor4f;
layout(location = 1) out vec4 gbufferNormal4f;
layout(location = 2) out vec4 gbufferMaterial4f;

uniform sampler2D u_diffuseTexture;
uniform sampler2D u_samplerNormalMaterial;

uniform vec2 u_textureYScale2f;

void main() {
vec4 diffuseRGBA = texture(u_diffuseTexture, v_texCoord2f) * v_color4f;
if(diffuseRGBA.a < 0.004) {
discard;
}
gbufferColor4f = vec4(diffuseRGBA.rgb, v_lightmap2f.r);
gbufferNormal4f = vec4(0.5, 0.5, 1.0, v_lightmap2f.g);
gbufferMaterial4f = vec4(texture(u_samplerNormalMaterial, vec2(v_texCoord2f.x, v_texCoord2f.y * u_textureYScale2f.x + u_textureYScale2f.y)).rgb, 1.0);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
these are just low quality fallback material textures for the default vanilla resource pack when no PBR resource pack is loaded, if you would like to make a PBR resource pack put your _n and _s textures in the "/assets/minecraft/textures/" directory of your zip file, do not modify any files within "/assets/eagler/glsl/deferred/assets_pbr/textures/" because they will not be recognized
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#line 2

/*
* Copyright (c) 2023 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/

precision lowp int;
precision highp float;
precision highp sampler2D;

in vec2 v_position2f;

layout(location = 0) out float output1f;

uniform sampler2D u_noiseTexture;

uniform float u_textureSlice1f;
uniform vec2 u_textureSize2f;
uniform mat4x3 u_sampleOffsetMatrix4f;
uniform vec3 u_cloudMovement3f;

#define GET_CLOUDS(pos3f, accum, factor, tmp3f)\
tmp3f.z = floor(pos3f.z);\
tmp3f.xy = pos3f.xy * 0.015625 + (tmp3f.z * 0.265625);\
pos3f.x = textureLod(u_noiseTexture, tmp3f.xy, 0.0).x;\
pos3f.y = textureLod(u_noiseTexture, tmp3f.xy + 0.265625, 0.0).x;\
accum += mix(pos3f.x, pos3f.y, pos3f.z - tmp3f.z) * factor;

void main() {
vec3 p = vec3(v_position2f.x, u_textureSlice1f, v_position2f.y) * vec3(u_textureSize2f.x, 1.0, u_textureSize2f.y);
p = u_sampleOffsetMatrix4f * vec4(p, 1.0);
vec3 sampleCoord3f = p + u_cloudMovement3f;
float noise = 0.0;

vec3 in3f = sampleCoord3f;
GET_CLOUDS(in3f, noise, 0.5, p)
in3f = sampleCoord3f * 2.0 + u_cloudMovement3f;
GET_CLOUDS(in3f, noise, 0.25, p)
in3f = sampleCoord3f * 7.0 - u_cloudMovement3f;
GET_CLOUDS(in3f, noise, 0.125, p)
in3f = (sampleCoord3f + u_cloudMovement3f) * 16.0;
GET_CLOUDS(in3f, noise, 0.0625, p)

output1f = noise;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
#line 2

/*
* Copyright (c) 2023 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/

precision lowp int;
precision highp float;
precision highp sampler2D;
precision highp sampler3D;

in vec2 v_position2f;

layout(location = 0) out vec4 output4f;

uniform float u_rainStrength1f;
uniform vec4 u_densityModifier4f;
uniform float u_sampleStep1f;
uniform float u_cloudTimer1f;
uniform vec3 u_cloudOffset3f;
uniform vec3 u_sunDirection3f;
uniform vec3 u_sunColor3f;

uniform sampler3D u_noiseTexture3D;
uniform sampler2D u_skyIrradianceMap;
#define GET_CLOUDS(pos3f, out1f)\
if(pos3f == clamp(pos3f, vec3(0.0), vec3(1.0))) {\
out1f = length(pos3f - clamp(pos3f, vec3(0.05), vec3(0.95)));\
out1f = smoothstep(0.0, 1.0, max(1.0 - out1f * 15.0, 0.0));\
out1f *= textureLod(u_noiseTexture3D, pos3f.xzy, 0.0).r;\
out1f += u_densityModifier4f.w;\
out1f = max(out1f * out1f * u_densityModifier4f.x + out1f * u_densityModifier4f.y + u_densityModifier4f.z, 0.0);\
}else out1f = 0.0;

void main() {
vec2 latLong = v_position2f * 2.0 - 1.0;
float latLongLen = dot(latLong, latLong);
if(latLongLen > 1.025) {
output4f = vec4(0.0);
return;
}

float mag2 = 2.0 / (latLongLen + 1.0);
vec3 dir;
dir.y = mag2 - 1.0;
dir.xz = latLong * mag2;

vec3 samplePos = vec3(0.0, -4.5 + u_cloudOffset3f.y * 0.05, 0.0) + dir * u_sampleStep1f * 0.2;
samplePos = samplePos * vec3(0.05, 0.1, 0.05) + vec3(0.5, 0.0, 0.5);

float sample0, sample1;
GET_CLOUDS(samplePos, sample0)

if(sample0 < 0.002) {
output4f = vec4(0.0, 0.0, 0.0, 1.0);
return;
}

output4f.a = exp2(-sample0 * 5.0);

vec3 sunDirection = u_sunDirection3f * vec3(1.0, 2.0, 1.0) * 0.025;
float sunVisibility = sample0;

GET_CLOUDS((samplePos + sunDirection), sample1)
sunVisibility += sample1;
GET_CLOUDS((samplePos + sunDirection * 2.0), sample1)
sunVisibility += sample1;
GET_CLOUDS((samplePos + sunDirection * 3.0), sample1)
sunVisibility += sample1;
GET_CLOUDS((samplePos + sunDirection * 4.0), sample1)
sunVisibility += sample1;
GET_CLOUDS((samplePos + sunDirection * 5.0), sample1)
sunVisibility += sample1;

sunVisibility = exp2(-sunVisibility * 50.0);
sunVisibility *= 1.0 - exp2(-sample0 * 1.2);

vec3 sky = textureLod(u_skyIrradianceMap, v_position2f * vec2(1.0, 0.5) + vec2(0.0, 0.5), 0.0).rgb * 0.05;
float intergal = exp2(-7.33 * sample0) * -9.0 + 9.0;

output4f.rgb = (u_sunColor3f * sunVisibility + sky) * intergal;
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#line 2

/*
* Copyright (c) 2023 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/

precision lowp int;
precision mediump float;
precision mediump sampler3D;

in vec2 v_position2f;

layout(location = 0) out vec4 output4f;

uniform sampler3D u_inputTexture;
uniform float u_textureLevel1f;
uniform float u_textureLod1f;
uniform vec2 u_sampleWeights2f;

void main() {
float objsample = textureLod(u_inputTexture, vec3(v_position2f, u_textureLevel1f), u_textureLod1f).r;
output4f = vec4(objsample * u_sampleWeights2f.x, 0.0, 0.0, objsample * u_sampleWeights2f.y + 1.0);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#line 2

/*
* Copyright (c) 2023 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/

precision lowp int;
precision highp float;
precision mediump sampler2D;

layout(location = 0) in vec2 a_position2f;

out vec2 v_position2f;

uniform mat3x2 u_transformMatrix3x2f;

void main() {
v_position2f = a_position2f * 0.5 + 0.5;
gl_Position = vec4(u_transformMatrix3x2f * vec3(a_position2f, 1.0), 0.0, 1.0);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#line 2

/*
* Copyright (c) 2023 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/

precision lowp int;
precision highp float;
precision highp sampler2D;

layout(location = 0) out float occlusionOut1f;

uniform mat4x3 u_sampleMatrix4x3f;
uniform sampler2D u_cloudsTexture;

#define SAMPLE_DENSITY(v, a_, f)\
f = u_sampleMatrix4x3f * v;\
f.xy = (f.xz / (f.y + 1.0)) * 0.975 * 0.5 + 0.5;\
if(f.xy == clamp(f.xy, vec2(0.001), vec2(0.999)))\
a_ += textureLod(u_cloudsTexture, f.xy, 0.0).a * 0.125;\
else\
a_ += 0.125;

void main() {
vec3 f;
float accum = 0.0;

SAMPLE_DENSITY(vec4(0.000, 0.000, 1.000, 1.0), accum, f)
SAMPLE_DENSITY(vec4(0.844, 0.521, 0.126, 1.0), accum, f)
SAMPLE_DENSITY(vec4(-0.187, 0.979, 0.087, 1.0), accum, f)
SAMPLE_DENSITY(vec4(0.402, -0.904, 0.145, 1.0), accum, f)
SAMPLE_DENSITY(vec4(-0.944, -0.316, 0.098, 1.0), accum, f)
SAMPLE_DENSITY(vec4(-0.759, 0.427, 0.491, 1.0), accum, f)
SAMPLE_DENSITY(vec4(0.955, -0.285, 0.076, 1.0), accum, f)
SAMPLE_DENSITY(vec4(-0.322, -0.664, 0.675, 1.0), accum, f)

occlusionOut1f = clamp(sqrt(accum) * 3.0 - 1.0, 0.0, 1.0);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
#line 2

/*
* Copyright (c) 2023 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/

precision lowp int;
precision highp float;
precision highp sampler2D;

in vec2 v_position2f;

layout(location = 0) out vec4 output4f;

uniform sampler2D u_gbufferColorTexture;
uniform sampler2D u_gbufferNormalTexture;
uniform sampler2D u_gbufferMaterialTexture;

uniform sampler2D u_gbufferDepthTexture;

uniform vec2 u_halfResolutionPixelAlignment2f;

#ifdef COMPILE_GLOBAL_AMBIENT_OCCLUSION
uniform sampler2D u_ssaoTexture;
#endif

#ifdef COMPILE_SCREEN_SPACE_REFLECTIONS
uniform sampler2D u_ssrReflectionTexture;
#endif

#ifdef COMPILE_ENV_MAP_REFLECTIONS
uniform sampler2D u_environmentMap;
#endif

uniform sampler2D u_irradianceMap;

uniform sampler2D u_brdfLUT;
uniform sampler2D u_metalsLUT;

uniform mat4 u_inverseProjMatrix4f;
uniform mat4 u_inverseViewMatrix4f;

uniform vec3 u_sunDirection3f;
uniform float u_skyLightFactor1f;

#if defined(COMPILE_SCREEN_SPACE_REFLECTIONS) || defined(COMPILE_ENV_MAP_REFLECTIONS)
#define LIB_INCLUDE_PBR_IMAGE_BASED_LIGHTING_SPECULAR
#endif

#EAGLER INCLUDE (3) "eagler:glsl/deferred/lib/pbr_env_map.glsl"

void main() {
vec3 diffuseColor3f;
vec3 normalVector3f;
vec2 lightmapCoords2f;
vec4 materialData4f;

float depth = textureLod(u_gbufferDepthTexture, v_position2f, 0.0).r;
if(depth < 0.00001) {
discard;
}

vec4 sampleVar4f = textureLod(u_gbufferColorTexture, v_position2f, 0.0);
diffuseColor3f.rgb = sampleVar4f.rgb * sampleVar4f.rgb;
lightmapCoords2f.x = sampleVar4f.a;
sampleVar4f = textureLod(u_gbufferNormalTexture, v_position2f, 0.0);
normalVector3f.xyz = sampleVar4f.rgb * 2.0 - 1.0;
normalVector3f.xyz = mat3(u_inverseViewMatrix4f) * normalVector3f.xyz;
normalVector3f.xyz = normalize(normalVector3f.xyz);
lightmapCoords2f.y = sampleVar4f.a;
materialData4f = textureLod(u_gbufferMaterialTexture, v_position2f, 0.0);

float shadow = 0.075;

#ifdef COMPILE_GLOBAL_AMBIENT_OCCLUSION
vec4 ao = textureLod(u_ssaoTexture, min(v_position2f * u_halfResolutionPixelAlignment2f, 1.0), 0.0);
ao.g = ao.b > 0.0 ? ao.g : 1.0;
shadow = mix(shadow, shadow * ao.g, 0.9);
#endif

lightmapCoords2f *= lightmapCoords2f;
vec3 irradianceMapSamplePos2f = normalVector3f;
irradianceMapSamplePos2f.xz /= abs(irradianceMapSamplePos2f.y) + 1.0;
float dst = 1.0 - dot(irradianceMapSamplePos2f.xz, irradianceMapSamplePos2f.xz);
dst *= dst;
irradianceMapSamplePos2f.xz *= 0.975;
vec3 skyLight = vec3(sqrt(0.01 + max(-u_sunDirection3f.y, 0.0)));
if(dst < 0.005) {
vec4 sample1 = textureLod(u_irradianceMap, irradianceMapSamplePos2f.xz * vec2(0.5, 0.25) + vec2(0.5, 0.25), 0.0);
vec4 sample2 = textureLod(u_irradianceMap, irradianceMapSamplePos2f.xz * vec2(0.5, -0.25) + vec2(0.5, 0.75), 0.0);
skyLight += mix(sample1.rgb, sample2.rgb, smoothstep(0.0, 1.0, irradianceMapSamplePos2f.y * -12.5 + 0.5)).rgb;
}else {
irradianceMapSamplePos2f.xz *= vec2(0.5, irradianceMapSamplePos2f.y > 0.0 ? 0.25 : -0.25);
irradianceMapSamplePos2f.xz += vec2(0.5, irradianceMapSamplePos2f.y > 0.0 ? 0.25 : 0.75);
skyLight += textureLod(u_irradianceMap, irradianceMapSamplePos2f.xz, 0.0).rgb;
}

skyLight *= lightmapCoords2f.g * u_skyLightFactor1f;

vec3 blockLight = lightmapCoords2f.r * vec3(1.0, 0.5809, 0.2433) * 2.0;
float emissive = materialData4f.b == 1.0 ? 0.0 : materialData4f.b;
vec3 specular = vec3(0.0);

#ifdef COMPILE_ENV_MAP_REFLECTIONS
float f = materialData4f.g < 0.06 ? 1.0 : 0.0;
f += materialData4f.r < 0.5 ? 1.0 : 0.0;
while((materialData4f.a >= 0.5 ? f : -1.0) == 0.0) {
vec4 worldPosition4f = vec4(v_position2f, depth, 1.0) * 2.0 - 1.0;
worldPosition4f = u_inverseProjMatrix4f * worldPosition4f;
worldPosition4f.xyz /= worldPosition4f.w;
float posDst = dot(worldPosition4f.xyz, worldPosition4f.xyz);
if(posDst > 25.0) {
break;
}
worldPosition4f = u_inverseViewMatrix4f * vec4(worldPosition4f.xyz, 0.0);
vec3 viewDir3f = normalize(worldPosition4f.xyz); // need confirmation this should be negative
vec3 reflectDir = reflect(viewDir3f, normalVector3f);
reflectDir.xz /= abs(reflectDir.y) + 1.0;
float dst = 1.0 - dot(reflectDir.xz, reflectDir.xz);
dst *= dst;
reflectDir.xz = reflectDir.xz * 0.975;
vec4 envMapSample4f;
if(dst < 0.005) {
vec4 sample1 = textureLod(u_environmentMap, reflectDir.xz * vec2(0.5, 0.25) + vec2(0.5, 0.25), 0.0);
vec4 sample2 = textureLod(u_environmentMap, reflectDir.xz * vec2(0.5, -0.25) + vec2(0.5, 0.75), 0.0);
envMapSample4f = vec4(mix(sample1.rgb, sample2.rgb, smoothstep(0.0, 1.0, reflectDir.y * -12.5 + 0.5)).rgb, min(sample1.a, sample2.a));
}else {
reflectDir.xz = reflectDir.xz * vec2(0.5, reflectDir.y > 0.0 ? 0.25 : -0.25);
reflectDir.xz += vec2(0.5, reflectDir.y > 0.0 ? 0.25 : 0.75);
envMapSample4f = textureLod(u_environmentMap, reflectDir.xz, 0.0);
}
if(envMapSample4f.a > 0.0) {
specular = eaglercraftIBL_Specular(diffuseColor3f.rgb, envMapSample4f.rgb, viewDir3f, normalVector3f, materialData4f.rgb);
specular *= 1.0 - sqrt(posDst) * 0.2;
}
break;
}
#endif

#ifdef COMPILE_SCREEN_SPACE_REFLECTIONS
#ifndef COMPILE_ENV_MAP_REFLECTIONS
float f = materialData4f.g < 0.06 ? 1.0 : 0.0;
f += materialData4f.r < 0.5 ? 1.0 : 0.0;
if(f == 0.0) {
#else
if((materialData4f.a < 0.5 ? f : -1.0) == 0.0) {
#endif
vec4 ssrSample = textureLod(u_ssrReflectionTexture, min(v_position2f * u_halfResolutionPixelAlignment2f, 1.0), 0.0);
if(ssrSample.g > 0.0) {
ssrSample.g -= 0.005;
vec4 worldPosition4f = vec4(v_position2f, depth, 1.0) * 2.0 - 1.0;
worldPosition4f = u_inverseProjMatrix4f * worldPosition4f;
worldPosition4f = u_inverseViewMatrix4f * vec4(worldPosition4f.xyz / worldPosition4f.w, 0.0);
vec3 viewDir3f = normalize(worldPosition4f.xyz); // need confirmation this should be negative
specular = eaglercraftIBL_Specular(diffuseColor3f.rgb, ssrSample.rgb, viewDir3f, normalVector3f.xyz, materialData4f.rgb);
}
}
#endif

output4f = vec4((diffuseColor3f.rgb * max(skyLight + blockLight, vec3(emissive * emissive * 20.0 + 0.075)) + specular * 8.0) * shadow, 1.0);

}
116 changes: 116 additions & 0 deletions desktopRuntime/resources/assets/eagler/glsl/deferred/deferred_core.vsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
#line 2

/*
* Copyright (c) 2023 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/

in vec3 a_position3f;

#ifdef COMPILE_TEXTURE_ATTRIB
in vec2 a_texture2f;
out vec2 v_texture2f;
uniform mat4 u_textureMat4f01;
#endif

#ifdef COMPILE_COLOR_ATTRIB
in vec4 a_color4f;
out vec4 v_color4f;
#endif

#ifdef COMPILE_NORMAL_ATTRIB
in vec4 a_normal4f;
out vec3 v_normal3f;
out float v_block1f;
#endif

#ifdef COMPILE_STATE_WAVING_BLOCKS
uniform mat4 u_modelMatrix4f;
uniform mat4 u_viewMatrix4f;
uniform vec3 u_wavingBlockOffset3f;
uniform vec4 u_wavingBlockParam4f;
#ifndef COMPILE_NORMAL_ATTRIB
uniform float u_blockConstant1f;
#endif
#define DO_COMPILE_STATE_WAVING_BLOCKS
#define FAKE_SIN(valueIn, valueOut)\
valueOut = abs(1.0 - fract(valueIn * 0.159155) * 2.0);\
valueOut = valueOut * valueOut * (3.0 - 2.0 * valueOut) * 2.0 - 1.0;
#define LIB_INCLUDE_WAVING_BLOCKS_FUNCTION
#endif

#EAGLER INCLUDE (2) "eagler:glsl/deferred/lib/waving_blocks.glsl"

#ifdef COMPILE_NORMAL_MATERIAL_TEXTURE
out vec3 v_viewdir3f;
#endif

#ifdef COMPILE_LIGHTMAP_ATTRIB
in vec2 a_lightmap2f;
out vec2 v_lightmap2f;
uniform mat4 u_textureMat4f02;
#endif

uniform mat4 u_modelviewMat4f;
uniform mat4 u_projectionMat4f;

#define TEX_MAT3(mat4In) mat3(mat4In[0].xyw,mat4In[1].xyw,mat4In[3].xyw)

void main() {

#ifdef COMPILE_TEXTURE_ATTRIB
vec3 v_textureTmp3f = TEX_MAT3(u_textureMat4f01) * vec3(a_texture2f, 1.0);
v_texture2f = v_textureTmp3f.xy / v_textureTmp3f.z;
#endif

#ifdef COMPILE_COLOR_ATTRIB
v_color4f = a_color4f;
#endif

#ifdef COMPILE_NORMAL_ATTRIB
v_normal3f = normalize(mat3(u_modelviewMat4f) * a_normal4f.xyz);
float blockId = v_block1f = floor((a_normal4f.w + 1.0) * 127.0 + 0.5);
#endif

#ifdef COMPILE_LIGHTMAP_ATTRIB
vec3 v_lightmapTmp3f = TEX_MAT3(u_textureMat4f02) * vec3(a_lightmap2f, 1.0);
v_lightmap2f = v_lightmapTmp3f.xy / v_lightmapTmp3f.z;
#endif

vec4 pos = vec4(a_position3f, 1.0);

#ifdef DO_COMPILE_STATE_WAVING_BLOCKS
#ifndef COMPILE_NORMAL_ATTRIB
float blockId = u_blockConstant1f;
#endif
#ifdef COMPILE_LIGHTMAP_ATTRIB
if(v_lightmap2f.y > 0.33) {
COMPUTE_WAVING_BLOCKS(pos, min(v_lightmap2f.y * 3.0 - 1.0, 1.0), 24.0, blockId, u_modelMatrix4f, u_viewMatrix4f, u_modelviewMat4f, u_wavingBlockOffset3f, u_wavingBlockParam4f)
}else {
pos = u_modelviewMat4f * pos;
}
#else
COMPUTE_WAVING_BLOCKS(pos, 1.0, 32.0, blockId, u_modelMatrix4f, u_viewMatrix4f, u_modelviewMat4f, u_wavingBlockOffset3f, u_wavingBlockParam4f)
#endif
#else
pos = u_modelviewMat4f * pos;
#endif

#ifdef COMPILE_NORMAL_MATERIAL_TEXTURE
v_viewdir3f = pos.xyz / pos.w;
#endif

gl_Position = u_projectionMat4f * pos;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
#line 2

/*
* Copyright (c) 2023 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/

#ifdef COMPILE_TEXTURE_ATTRIB
in vec2 v_texture2f;
#endif

uniform vec4 u_color4f;

#ifdef COMPILE_COLOR_ATTRIB
in vec4 v_color4f;
#endif

#ifdef COMPILE_NORMAL_ATTRIB
in vec3 v_normal3f;
in float v_block1f;
#else
uniform vec3 u_uniformNormal3f;
uniform float u_blockConstant1f;
#endif

uniform float u_useEnvMap1f;

#ifdef COMPILE_LIGHTMAP_ATTRIB
in vec2 v_lightmap2f;
#endif

#ifdef COMPILE_ENABLE_TEXTURE2D
uniform sampler2D u_samplerTexture;
#ifndef COMPILE_TEXTURE_ATTRIB
uniform vec2 u_textureCoords01;
#endif
#endif

#ifdef COMPILE_ENABLE_LIGHTMAP
#ifndef COMPILE_LIGHTMAP_ATTRIB
uniform vec2 u_textureCoords02;
#endif
#endif

#ifdef COMPILE_ENABLE_ALPHA_TEST
uniform float u_alphaTestRef1f;
#endif

#ifdef COMPILE_ENABLE_ANISOTROPIC_FIX
uniform vec2 u_textureAnisotropicFix;
#endif

#ifdef COMPILE_BLEND_ADD
uniform vec4 u_colorBlendSrc4f;
uniform vec4 u_colorBlendAdd4f;
#endif

#ifdef COMPILE_NORMAL_MATERIAL_TEXTURE
uniform sampler2D u_samplerNormalMaterial;
in vec3 v_viewdir3f;
#ifndef COMPILE_TEXTURE_ATTRIB
uniform vec2 u_textureCoords01;
#endif
#else
uniform vec3 u_materialConstants3f;
#endif

#ifdef COMPILE_NORMAL_MATERIAL_TEXTURE
mat3 cotangent_frame(in vec3 N, in vec3 p, in vec2 uv) {
vec3 dp1 = dFdx(p);
vec3 dp2 = dFdy(p);
vec2 duv1 = dFdx(uv);
vec2 duv2 = dFdy(uv);
vec3 dp2perp = cross(dp2, N);
vec3 dp1perp = cross(N, dp1);
vec3 T = dp2perp * duv1.x + dp1perp * duv2.x;
vec3 B = dp2perp * duv1.y + dp1perp * duv2.y;
float invmax = inversesqrt(max(dot(T,T), dot(B,B)));
return mat3(T * invmax, B * invmax, N);
}
#endif

layout(location = 0) out vec4 gbufferColor4f;
layout(location = 1) out vec4 gbufferNormal4f;
layout(location = 2) out vec4 gbufferMaterial4f;

void main() {
#ifdef COMPILE_COLOR_ATTRIB
vec4 color = v_color4f * u_color4f;
#else
vec4 color = u_color4f;
#endif

vec3 normal;
#ifdef COMPILE_NORMAL_ATTRIB
normal = normalize(v_normal3f);
#else
normal = u_uniformNormal3f;
#endif

#if defined(COMPILE_ENABLE_TEXTURE2D) || defined(COMPILE_NORMAL_MATERIAL_TEXTURE)
vec2 uv;
#ifdef COMPILE_TEXTURE_ATTRIB
#ifdef COMPILE_ENABLE_ANISOTROPIC_FIX
uv = floor(uv * u_textureAnisotropicFix) + 0.5;
uv /= u_textureAnisotropicFix;
#else
uv = v_texture2f;
#endif
#else
uv = u_textureCoords01;
#endif
#ifdef COMPILE_ENABLE_TEXTURE2D
color *= texture(u_samplerTexture, uv);
#endif
#endif

vec2 lightmap = vec2(0.0, 1.0);

#ifdef COMPILE_ENABLE_LIGHTMAP
#ifdef COMPILE_LIGHTMAP_ATTRIB
lightmap = v_lightmap2f;
#else
lightmap = u_textureCoords02;
#endif
#endif

#ifdef COMPILE_BLEND_ADD
color = color * u_colorBlendSrc4f + u_colorBlendAdd4f;
#endif

#ifdef COMPILE_ENABLE_ALPHA_TEST
if(color.a < u_alphaTestRef1f) discard;
#endif

#ifdef COMPILE_NORMAL_MATERIAL_TEXTURE
vec2 uv2 = vec2(1.0, 0.5) * uv;
vec2 normal2 = texture(u_samplerNormalMaterial, uv2).xy;
mat3 cf;
if(normal2.x + normal2.y > 0.0) {
normal2 *= 2.0;
normal2 -= 1.0;
cf = cotangent_frame(normal, normalize(v_viewdir3f), uv);
normal = cf * vec3(normal2, sqrt(1.0 - dot(normal2, normal2)));
}
uv2.y += 0.5;
vec3 material = texture(u_samplerNormalMaterial, uv2).rgb;
#else
vec3 material = u_materialConstants3f;
#endif

gbufferColor4f.rgb = color.rgb;
gbufferColor4f.a = lightmap.r;
gbufferNormal4f.rgb = normal * 0.5 + 0.5;
gbufferNormal4f.a = lightmap.g;
gbufferMaterial4f = vec4(material.rgb, u_useEnvMap1f);
}
104 changes: 104 additions & 0 deletions desktopRuntime/resources/assets/eagler/glsl/deferred/deferred_fog.fsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
#line 2

/*
* Copyright (c) 2023 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/

precision lowp int;
precision highp float;
precision highp sampler2D;

layout(location = 0) out vec4 output4f;

in vec2 v_position2f;

uniform sampler2D u_gbufferDepthTexture;
uniform sampler2D u_gbufferNormalTexture;
uniform sampler2D u_fogDepthTexture;

#ifdef COMPILE_FOG_LIGHT_SHAFTS
uniform sampler2D u_lightShaftsTexture;
#endif

#ifdef COMPILE_FOG_ATMOSPHERE
uniform sampler2D u_environmentMap;
uniform vec3 u_sunColorAdd3f;
#endif

uniform mat4 u_inverseViewProjMatrix4f;

#ifdef COMPILE_FOG_LINEAR
uniform vec2 u_linearFogParam2f;
#else
uniform float u_expFogDensity1f;
#endif

uniform vec4 u_fogColorLight4f;
uniform vec4 u_fogColorDark4f;

void main() {
vec4 fragPos4f = vec4(v_position2f, textureLod(u_fogDepthTexture, v_position2f, 0.0).r, 1.0);

#ifdef COMPILE_FOG_ATMOSPHERE
if(fragPos4f.z <= 0.0000001) {
discard;
}
#endif

float solidDepth = textureLod(u_gbufferDepthTexture, v_position2f, 0.0).r;
if(solidDepth != fragPos4f.z) {
discard;
}

fragPos4f.xyz *= 2.0;
fragPos4f.xyz -= 1.0;

fragPos4f = u_inverseViewProjMatrix4f * fragPos4f;
fragPos4f.xyz /= fragPos4f.w;
fragPos4f.w = 1.0;

float l = sqrt(dot(fragPos4f.xyz, fragPos4f.xyz));
#ifdef COMPILE_FOG_LINEAR
float f = (l - u_linearFogParam2f.x) / (u_linearFogParam2f.y - u_linearFogParam2f.x);
#else
float f = 1.0 - exp(-u_expFogDensity1f * l);
#endif
float f2 = textureLod(u_gbufferNormalTexture, v_position2f, 0.0).a;
vec4 fogColor4f = mix(u_fogColorDark4f, u_fogColorLight4f, f2 * f2);
f = clamp(f, 0.0, 1.0) * fogColor4f.a;

#ifdef COMPILE_FOG_ATMOSPHERE
fragPos4f.xyz /= -l;
fragPos4f.xz /= abs(fragPos4f.y) + 1.0;
fragPos4f.xz *= 0.75;

vec3 envMapSample3f;

fragPos4f.xz *= vec2(-0.5, -0.25);
fragPos4f.xz += vec2(0.5, 0.25);
envMapSample3f = textureLod(u_environmentMap, fragPos4f.xz, 0.0).rgb + u_sunColorAdd3f;

#ifdef COMPILE_FOG_LIGHT_SHAFTS
f2 = textureLod(u_lightShaftsTexture, v_position2f, 0.0).r;
envMapSample3f *= pow(f2, 2.25);
f = (f * 0.85 + 0.2) * f2 + f * (1.0 - f2);
#endif

output4f = vec4(envMapSample3f * fogColor4f.rgb, f);
#else
output4f = vec4(fogColor4f.rgb, f);
#endif

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#line 2

/*
* Copyright (c) 2023 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/

precision lowp int;
precision highp float;
precision highp sampler2D;

layout(location = 0) in vec2 a_position2f;

out vec2 v_position2f;

void main() {
v_position2f = a_position2f * 0.5 + 0.5;
gl_Position = vec4(a_position2f, 0.0, 1.0);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#line 2

/*
* Copyright (c) 2023 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/

#if !defined(COMPILE_ENABLE_ALPHA_TEST) && !defined(COMPILE_COLORED_SHADOWS)
#undef COMPILE_ENABLE_TEXTURE2D
#endif

#ifdef COMPILE_COLORED_SHADOWS
layout(location = 0) out vec4 output4f;
uniform vec4 u_color4f;
#endif

#ifdef COMPILE_ENABLE_TEXTURE2D
uniform sampler2D u_samplerTexture;
#ifdef COMPILE_TEXTURE_ATTRIB
in vec2 v_texture2f;
#else
uniform vec2 u_textureCoords01;
#endif
#ifdef COMPILE_ENABLE_ALPHA_TEST
uniform float u_alphaTestRef1f;
#endif
#endif

void main() {
#ifdef COMPILE_COLORED_SHADOWS
vec4 color = u_color4f;
#else
vec4 color = vec4(1.0);
#endif

#ifdef COMPILE_ENABLE_TEXTURE2D
#ifdef COMPILE_TEXTURE_ATTRIB
color *= texture(u_samplerTexture, v_texture2f);
#else
color *= texture(u_samplerTexture, u_textureCoords01);
#endif
#ifdef COMPILE_ENABLE_ALPHA_TEST
if(color.a < u_alphaTestRef1f) discard;
#endif
#endif

#ifdef COMPILE_COLORED_SHADOWS
output4f = vec4(mix(vec3(1.0), color.rgb, color.a), color.a);
#endif
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
#line 2

/*
* Copyright (c) 2023 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/

in vec3 a_position3f;

#if defined(COMPILE_ENABLE_ALPHA_TEST) && defined(COMPILE_ENABLE_TEXTURE2D)
#define DO_SHADOW_ALPHA_TEST
#endif

#ifdef DO_SHADOW_ALPHA_TEST
#ifdef COMPILE_TEXTURE_ATTRIB
in vec2 a_texture2f;
out vec2 v_texture2f;
uniform mat4 u_textureMat4f01;
#endif
#endif

uniform mat4 u_modelviewProjMat4f;

#ifdef COMPILE_STATE_WAVING_BLOCKS
#ifdef COMPILE_NORMAL_ATTRIB
in vec4 a_normal4f;
#else
uniform float u_blockConstant1f;
#endif
#ifdef COMPILE_ENABLE_LIGHTMAP
#ifdef COMPILE_LIGHTMAP_ATTRIB
in vec2 a_lightmap2f;
uniform mat4 u_textureMat4f02;
#else
uniform vec2 u_textureCoords02;
#endif
#endif
uniform mat4 u_modelMatrix4f;
uniform mat4 u_viewMatrix4f;
uniform vec3 u_wavingBlockOffset3f;
uniform vec4 u_wavingBlockParam4f;
#define DO_COMPILE_STATE_WAVING_BLOCKS
#define FAKE_SIN(valueIn, valueOut)\
valueOut = abs(1.0 - fract(valueIn * 0.159155) * 2.0);\
valueOut = valueOut * valueOut * (3.0 - 2.0 * valueOut) * 2.0 - 1.0;
#define LIB_INCLUDE_WAVING_BLOCKS_FUNCTION
#endif

#EAGLER INCLUDE (2) "eagler:glsl/deferred/lib/waving_blocks.glsl"

#define TEX_MAT3(mat4In) mat3(mat4In[0].xyw,mat4In[1].xyw,mat4In[3].xyw)

void main() {
#ifdef DO_SHADOW_ALPHA_TEST
#ifdef COMPILE_TEXTURE_ATTRIB
vec3 v_textureTmp3f = TEX_MAT3(u_textureMat4f01) * vec3(a_texture2f, 1.0);
v_texture2f = v_textureTmp3f.xy / v_textureTmp3f.z;
#endif
#endif
#ifdef DO_COMPILE_STATE_WAVING_BLOCKS
vec4 pos = vec4(a_position3f, 1.0);
#ifdef COMPILE_NORMAL_ATTRIB
float blockId = floor((a_normal4f.w + 1.0) * 127.0 + 0.5);
#else
float blockId = u_blockConstant1f;
#endif
#ifdef COMPILE_ENABLE_LIGHTMAP
#ifdef COMPILE_LIGHTMAP_ATTRIB
mat4x2 texMat4x2 = mat4x2(
u_textureMat4f02[0].yw,
u_textureMat4f02[1].yw,
u_textureMat4f02[2].yw,
u_textureMat4f02[3].yw
);
vec2 v_lightmapTmp2f = texMat4x2 * vec4(a_lightmap2f, 0.0, 1.0);
v_lightmapTmp2f.x = v_lightmapTmp2f.x / v_lightmapTmp2f.y;
#else
vec2 v_lightmapTmp2f = vec2(u_textureCoords02.y, 0.0);
#endif
if(v_lightmapTmp2f.x > 0.33) {
COMPUTE_WAVING_BLOCKS(pos, min(v_lightmapTmp2f.x * 3.0 - 1.0, 1.0), 24.0, blockId, u_modelMatrix4f, u_viewMatrix4f, u_modelviewProjMat4f, u_wavingBlockOffset3f, u_wavingBlockParam4f)
}else {
pos = u_modelviewProjMat4f * pos;
}
#else
COMPUTE_WAVING_BLOCKS(pos, 1.0, 32.0, blockId, u_modelMatrix4f, u_viewMatrix4f, u_modelviewProjMat4f, u_wavingBlockOffset3f, u_wavingBlockParam4f)
#endif
gl_Position = pos;
#else
gl_Position = u_modelviewProjMat4f * vec4(a_position3f, 1.0);
#endif
}
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
item,damage,red,green,blue,intensity
minecraft:beacon,0,0.4493,0.6007,1.0000,500.0
minecraft:glowstone,0,1.0000,0.6636,0.3583,10.0
minecraft:lit_pumpkin,0,1.0000,0.5447,0.2005,10.0
minecraft:torch,0,1.0000,0.5983,0.2655,10.0
minecraft:redstone_torch,0,1.0000,0.1578,0.0000,4.0
minecraft:sea_lantern,0,0.5530,0.6468,1.0000,10.0,
minecraft:lava_bucket,0,1.0000,0.4461,0.1054,6.0,
minecraft:nether_star,0,0.5711,0.6611,1.0000,6.0
473 changes: 473 additions & 0 deletions desktopRuntime/resources/assets/eagler/glsl/deferred/forward_core.fsh

Large diffs are not rendered by default.

103 changes: 103 additions & 0 deletions desktopRuntime/resources/assets/eagler/glsl/deferred/forward_core.vsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
#line 2

/*
* Copyright (c) 2023 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/

in vec3 a_position3f;

out vec4 v_position4f;

#ifdef COMPILE_FOG_LIGHT_SHAFTS
out vec2 v_positionClip2f;
#endif

#ifdef COMPILE_TEXTURE_ATTRIB
in vec2 a_texture2f;
out vec2 v_texture2f;
uniform mat4 u_textureMat4f01;
#endif

#ifdef COMPILE_ENABLE_TEX_GEN
out vec3 v_objectPosition3f;
#endif

#ifdef COMPILE_COLOR_ATTRIB
in vec4 a_color4f;
out vec4 v_color4f;
#endif

#ifdef COMPILE_NORMAL_ATTRIB
in vec4 a_normal4f;
out vec3 v_normal3f;
out float v_block1f;
#endif

#ifdef COMPILE_LIGHTMAP_ATTRIB
in vec2 a_lightmap2f;
out vec2 v_lightmap2f;
uniform mat4 u_textureMat4f02;
#endif

uniform mat4 u_modelviewMat4f;

#ifdef COMPILE_PARABOLOID
uniform float u_farPlane1f;
#else
uniform mat4 u_projectionMat4f;
#endif

#define TEX_MAT3(mat4In) mat3(mat4In[0].xyw,mat4In[1].xyw,mat4In[3].xyw)

void main() {
#ifdef COMPILE_ENABLE_TEX_GEN
v_objectPosition3f = a_position3f;
#endif
v_position4f = u_modelviewMat4f * vec4(a_position3f, 1.0);

#ifdef COMPILE_TEXTURE_ATTRIB
vec3 v_textureTmp3f = TEX_MAT3(u_textureMat4f01) * vec3(a_texture2f, 1.0);
v_texture2f = v_textureTmp3f.xy / v_textureTmp3f.z;
#endif

#ifdef COMPILE_COLOR_ATTRIB
v_color4f = a_color4f;
#endif

#ifdef COMPILE_NORMAL_ATTRIB
v_normal3f = normalize(mat3(u_modelviewMat4f) * a_normal4f.xyz);
v_block1f = floor((a_normal4f.w + 1.0) * 127.0 + 0.5);
#endif

#ifdef COMPILE_LIGHTMAP_ATTRIB
vec3 v_lightmapTmp3f = TEX_MAT3(u_textureMat4f02) * vec3(a_lightmap2f, 1.0);
v_lightmap2f = v_lightmapTmp3f.xy / v_lightmapTmp3f.z;
#endif

#ifdef COMPILE_PARABOLOID
vec3 pos = v_position4f.xyz / v_position4f.w;
float dist = pos.z;
pos.xyz = normalize(pos.xyz);
pos.xy /= 1.0 - pos.z;
pos.z = dist / u_farPlane1f + 1.00005;
gl_Position = vec4(pos.xyz, 1.0);
#else
gl_Position = u_projectionMat4f * v_position4f;
#endif

#ifdef COMPILE_FOG_LIGHT_SHAFTS
v_positionClip2f = gl_Position.xy / gl_Position.w;
#endif
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,308 @@
#line 2

/*
* Copyright (c) 2023 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/

precision highp sampler2DShadow;

in vec4 v_position4f;

uniform vec4 u_color4f;

#ifdef COMPILE_NORMAL_ATTRIB
in vec3 v_normal3f;
in float v_block1f;
#else
uniform vec3 u_uniformNormal3f;
uniform float u_blockConstant1f;
#endif

#ifdef COMPILE_LIGHTMAP_ATTRIB
in vec2 v_lightmap2f;
#else
uniform vec2 u_textureCoords02;
#endif

uniform mat4 u_inverseViewMatrix4f;

layout(location = 0) out vec4 output4f;

#ifdef COMPILE_DYNAMIC_LIGHTS
struct DynamicLight {
mediump vec4 u_lightPosition4f;
mediump vec4 u_lightColor4f;
};
layout(std140) uniform u_chunkLightingData {
mediump int u_dynamicLightCount1i;
mediump int _paddingA_;
mediump int _paddingB_;
mediump int _paddingC_;
DynamicLight u_dynamicLightArray[12];
};
#endif

layout(std140) uniform u_worldLightingData {
mediump vec4 u_sunDirection4f;
mediump vec4 u_sunColor3f_sky1f;
mediump vec4 u_fogParameters4f;
mediump vec4 u_fogColorLight4f;
mediump vec4 u_fogColorDark4f;
mediump vec4 u_fogColorAddSun4f;
mediump vec4 u_blockSkySunDynamicLightFac4f;
#ifdef COMPILE_SUN_SHADOW_LOD0
mediump mat4 u_sunShadowMatrixLOD04f;
#define DO_COMPILE_SUN_SHADOWS
#define SUN_SHADOW_MAP_FRAC 1.0
#endif
#ifdef COMPILE_SUN_SHADOW_LOD1
mediump mat4 u_sunShadowMatrixLOD04f;
mediump mat4 u_sunShadowMatrixLOD14f;
#define DO_COMPILE_SUN_SHADOWS
#define SUN_SHADOW_MAP_FRAC 0.5
#endif
#ifdef COMPILE_SUN_SHADOW_LOD2
mediump mat4 u_sunShadowMatrixLOD04f;
mediump mat4 u_sunShadowMatrixLOD14f;
mediump mat4 u_sunShadowMatrixLOD24f;
#define DO_COMPILE_SUN_SHADOWS
#define SUN_SHADOW_MAP_FRAC 0.3333333
#endif
};

uniform sampler2D u_environmentMap;
uniform sampler2D u_brdfLUT;

#define GLASS_ROUGHNESS 0.15
#define GLASS_F0 0.4

vec3 eaglercraftLighting_Glass(in vec3 radiance, in vec3 viewDir, in vec3 lightDir, in vec3 normalVec) {
float roughness = 1.0 - GLASS_ROUGHNESS * 0.85;
vec3 H = normalize(viewDir + lightDir);
vec3 NdotHVL = max(normalVec * mat3(H, viewDir, lightDir), vec3(0.0));
float NDF = (GLASS_ROUGHNESS * GLASS_ROUGHNESS * GLASS_ROUGHNESS * GLASS_ROUGHNESS);
float denom = NdotHVL.x * NdotHVL.x * (NDF - 1.0) + 1.0;
NDF /= denom * denom * 3.141592;
float gs = GLASS_ROUGHNESS + 1.0;
gs *= gs * 0.125;
vec2 Ndot = NdotHVL.yz;
Ndot /= Ndot * (1.0 - gs) + gs;
NDF *= Ndot.x * Ndot.y;
float fresnel = pow(max(1.0 - NdotHVL.x, 0.0), 5.0);
vec3 F = vec3(GLASS_F0 + (1.0 - GLASS_F0) * fresnel);
denom = 4.0 * NdotHVL.y * NdotHVL.z + 0.0001;
return (NDF * F / denom) * radiance * NdotHVL.z;
}

vec3 eaglercraftIBL_Specular_Glass(in vec3 envMapSample, in vec3 viewDir, in vec3 normalVec) {
float NdotV = dot(normalVec, -viewDir);
float fresnel = pow(max(1.0 - NdotV, 0.0), 5.0);
vec3 F = vec3(GLASS_F0 + (max(1.0 - GLASS_ROUGHNESS, GLASS_F0) - GLASS_F0) * fresnel);
vec2 brdf2f = vec2(max(NdotV, 0.0), GLASS_ROUGHNESS);
brdf2f = 1.0 - brdf2f;
brdf2f *= brdf2f;
brdf2f = 1.0 - brdf2f;
brdf2f = textureLod(u_brdfLUT, brdf2f, 0.0).rg;
return envMapSample * (F * brdf2f.r + brdf2f.g);
}

#ifdef DO_COMPILE_SUN_SHADOWS
uniform sampler2DShadow u_sunShadowDepthTexture;
#ifdef COMPILE_SUN_SHADOW_SMOOTH
const vec2 POISSON_DISK[7] = vec2[](
vec2(-0.077, 0.995), vec2(0.998, 0.015),
vec2(-0.116, -0.987), vec2(-0.916, 0.359),
vec2(-0.697, -0.511), vec2(0.740, -0.612),
vec2(0.675, 0.682));
#define SMOOTH_SHADOW_SAMPLES 1.0 / 8.0
#define SMOOTH_SHADOW_RADIUS 0.00075
#define SMOOTH_SHADOW_POISSON_SAMPLE(idx, tex, lod, vec3Pos, accum, tmpVec2)\
tmpVec2 = vec3Pos.xy + POISSON_DISK[idx] * SMOOTH_SHADOW_RADIUS;\
tmpVec2 = clamp(tmpVec2, vec2(0.001), vec2(0.999));\
tmpVec2.y += lod;\
tmpVec2.y *= SUN_SHADOW_MAP_FRAC;\
accum += textureLod(tex, vec3(tmpVec2, vec3Pos.z), 0.0) * SMOOTH_SHADOW_SAMPLES;
#endif
#endif

void main() {
vec4 worldPosition4f;
vec4 worldDirection4f;
vec3 normalVector3f;
vec2 lightmapCoords2f;
float block1f;

// =========== RESOLVE CONSTANTS ============ //

worldPosition4f = u_inverseViewMatrix4f * v_position4f;
worldPosition4f.xyz /= worldPosition4f.w;
worldPosition4f.w = 1.0;
worldDirection4f = u_inverseViewMatrix4f * vec4(v_position4f.xyz / v_position4f.w, 0.0);
worldDirection4f.xyz = normalize(worldDirection4f.xyz);

#ifdef COMPILE_ENABLE_LIGHTMAP
#ifdef COMPILE_LIGHTMAP_ATTRIB
lightmapCoords2f = v_lightmap2f;
#else
lightmapCoords2f = u_textureCoords02;
#endif
#else
lightmapCoords2f = vec2(0.0, 1.0);
#endif

#ifdef COMPILE_NORMAL_ATTRIB
normalVector3f = normalize(v_normal3f);
block1f = v_block1f;
#else
normalVector3f = u_uniformNormal3f;
block1f = u_blockConstant1f;
#endif

normalVector3f = normalize(mat3(u_inverseViewMatrix4f) * normalVector3f);

// ============ SUN LIGHTING ============== //

vec3 lightColor3f = vec3(0.0);
if(dot(u_sunDirection4f.xyz, normalVector3f) > 0.0 && lightmapCoords2f.g > 0.5 &&
(u_sunColor3f_sky1f.r + u_sunColor3f_sky1f.g + u_sunColor3f_sky1f.b) > 0.001) {
#ifdef DO_COMPILE_SUN_SHADOWS

// ========== SUN SHADOW: LOD0 ============ //

float skyLight = max(lightmapCoords2f.g * 2.0 - 1.0, 0.0);
float shadowSample = 1.0;
vec4 shadowWorldPos4f = worldPosition4f;
shadowWorldPos4f.xyz += normalVector3f * 0.05;

vec4 shadowTexPos4f;
vec2 tmpVec2;
for(;;) {
shadowTexPos4f = u_sunShadowMatrixLOD04f * shadowWorldPos4f;
if(shadowTexPos4f.xyz == clamp(shadowTexPos4f.xyz, vec3(0.005), vec3(0.995))) {
shadowSample = textureLod(u_sunShadowDepthTexture, vec3(shadowTexPos4f.xy * vec2(1.0, SUN_SHADOW_MAP_FRAC), shadowTexPos4f.z), 0.0);
#ifdef COMPILE_SUN_SHADOW_SMOOTH
shadowSample *= SMOOTH_SHADOW_SAMPLES;
SMOOTH_SHADOW_POISSON_SAMPLE(0, u_sunShadowDepthTexture, 0.0, shadowTexPos4f.xyz, shadowSample, tmpVec2)
SMOOTH_SHADOW_POISSON_SAMPLE(1, u_sunShadowDepthTexture, 0.0, shadowTexPos4f.xyz, shadowSample, tmpVec2)
SMOOTH_SHADOW_POISSON_SAMPLE(2, u_sunShadowDepthTexture, 0.0, shadowTexPos4f.xyz, shadowSample, tmpVec2)
SMOOTH_SHADOW_POISSON_SAMPLE(3, u_sunShadowDepthTexture, 0.0, shadowTexPos4f.xyz, shadowSample, tmpVec2)
SMOOTH_SHADOW_POISSON_SAMPLE(4, u_sunShadowDepthTexture, 0.0, shadowTexPos4f.xyz, shadowSample, tmpVec2)
SMOOTH_SHADOW_POISSON_SAMPLE(5, u_sunShadowDepthTexture, 0.0, shadowTexPos4f.xyz, shadowSample, tmpVec2)
SMOOTH_SHADOW_POISSON_SAMPLE(6, u_sunShadowDepthTexture, 0.0, shadowTexPos4f.xyz, shadowSample, tmpVec2)
shadowSample = max(shadowSample * 2.0 - 1.0, 0.0);
#endif
break;
}

#if defined(COMPILE_SUN_SHADOW_LOD1) || defined(COMPILE_SUN_SHADOW_LOD2)
shadowTexPos4f = u_sunShadowMatrixLOD14f * shadowWorldPos4f;
if(shadowTexPos4f.xyz == clamp(shadowTexPos4f.xyz, vec3(0.005), vec3(0.995))) {
shadowTexPos4f.y += 1.0;
shadowTexPos4f.y *= SUN_SHADOW_MAP_FRAC;
shadowSample = textureLod(u_sunShadowDepthTexture, vec3(shadowTexPos4f.xy, shadowTexPos4f.z + 0.00015), 0.0);
break;
}
#endif

#ifdef COMPILE_SUN_SHADOW_LOD2
shadowTexPos4f = u_sunShadowMatrixLOD24f * shadowWorldPos4f;
if(shadowTexPos4f.xyz == clamp(shadowTexPos4f.xyz, vec3(0.005), vec3(0.995))) {
shadowTexPos4f.y += 2.0;
shadowTexPos4f.y *= SUN_SHADOW_MAP_FRAC;
shadowSample = textureLod(u_sunShadowDepthTexture, vec3(shadowTexPos4f.xy, shadowTexPos4f.z + 0.00015), 0.0);
}
#endif
break;
}
#endif
lightColor3f = u_sunColor3f_sky1f.rgb * max(lightmapCoords2f.g * 2.0 - 1.0, 0.0);
#ifdef DO_COMPILE_SUN_SHADOWS
lightColor3f *= shadowSample * skyLight;
#endif
lightColor3f = eaglercraftLighting_Glass(lightColor3f, -worldDirection4f.xyz, u_sunDirection4f.xyz, normalVector3f) * u_blockSkySunDynamicLightFac4f.z;
}

// =========== ENVIRONMENT MAP =========== //

for(;;) {
float dst2 = dot(worldPosition4f.xyz, worldPosition4f.xyz);
if(dst2 > 16.0) {
break;
}
vec3 reflectDir = reflect(worldDirection4f.xyz, normalVector3f);
reflectDir.xz /= abs(reflectDir.y) + 1.0;
float dst = 1.0 - dot(reflectDir.xz, reflectDir.xz);
dst *= dst;
reflectDir.xz = reflectDir.xz * 0.975;
vec4 envMapSample4f;
if(dst < 0.005) {
vec4 sample1 = textureLod(u_environmentMap, reflectDir.xz * vec2(0.5, 0.25) + vec2(0.5, 0.25), 0.0);
vec4 sample2 = textureLod(u_environmentMap, reflectDir.xz * vec2(0.5, -0.25) + vec2(0.5, 0.75), 0.0);
envMapSample4f = vec4(mix(sample1.rgb, sample2.rgb, smoothstep(0.0, 1.0, reflectDir.y * -12.5 + 0.5)).rgb, min(sample1.a, sample2.a));
}else {
reflectDir.xz = reflectDir.xz * vec2(0.5, reflectDir.y > 0.0 ? 0.25 : -0.25);
reflectDir.xz += vec2(0.5, reflectDir.y > 0.0 ? 0.25 : 0.75);
envMapSample4f = textureLod(u_environmentMap, reflectDir.xz, 0.0);
}
if(envMapSample4f.a > 0.0) {
lightColor3f += eaglercraftIBL_Specular_Glass(envMapSample4f.rgb, worldDirection4f.xyz, normalVector3f) * (1.0 - sqrt(dst2) * 0.25);
}
break;
}

#ifdef COMPILE_DYNAMIC_LIGHTS

// =========== DYNAMIC LIGHTING =========== //

vec3 dlightDist3f, dlightDir3f, dlightColor3f;
int safeLightCount = u_dynamicLightCount1i > 12 ? 0 : u_dynamicLightCount1i; // hate this
for(int i = 0; i < safeLightCount; ++i) {
dlightDist3f = u_dynamicLightArray[i].u_lightPosition4f.xyz - worldPosition4f.xyz;
dlightDir3f = normalize(dlightDist3f);
if(dot(dlightDir3f, normalVector3f) <= 0.0) {
continue;
}
dlightColor3f = u_dynamicLightArray[i].u_lightColor4f.rgb / dot(dlightDist3f, dlightDist3f);
if(dlightColor3f.r + dlightColor3f.g + dlightColor3f.b < 0.025) {
continue;
}
lightColor3f += eaglercraftLighting_Glass(dlightColor3f, -worldDirection4f.xyz, dlightDir3f, normalVector3f) * u_blockSkySunDynamicLightFac4f.w;
}

#endif

// ============ CACLULATE FOG ============= //

float fogFade = 0.0;
if(u_fogParameters4f.x > 0.0) {
float atmos = u_fogParameters4f.x >= 4.0 ? 4.0 : 0.0;
float type = u_fogParameters4f.x - atmos;
fogFade = mix(u_fogColorDark4f.a, u_fogColorLight4f.a, lightmapCoords2f.g);

float f;
float l = sqrt(dot(v_position4f.xyz, v_position4f.xyz));
if(type == 1.0) {
f = (l - u_fogParameters4f.z) / (u_fogParameters4f.w - u_fogParameters4f.z);
}else {
f = 1.0 - exp(-u_fogParameters4f.y * l);
}

fogFade *= clamp(f, 0.0, 1.0);
}

// ============ OUTPUT COLOR ============== //

output4f = vec4(lightColor3f * (1.0 - fogFade), 0.1);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#line 2

/*
* Copyright (c) 2023 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/

in vec3 a_position3f;

out vec4 v_position4f;

#ifdef COMPILE_NORMAL_ATTRIB
in vec4 a_normal4f;
out vec3 v_normal3f;
out float v_block1f;
#endif

#ifdef COMPILE_LIGHTMAP_ATTRIB
in vec2 a_lightmap2f;
out vec2 v_lightmap2f;
uniform mat4 u_textureMat4f02;
#endif

uniform mat4 u_modelviewMat4f;
uniform mat4 u_projectionMat4f;

#define TEX_MAT3(mat4In) mat3(mat4In[0].xyw,mat4In[1].xyw,mat4In[3].xyw)

void main() {
v_position4f = u_modelviewMat4f * vec4(a_position3f, 1.0);

#ifdef COMPILE_NORMAL_ATTRIB
v_normal3f = normalize(mat3(u_modelviewMat4f) * a_normal4f.xyz);
v_block1f = floor((a_normal4f.w + 1.0) * 127.0 + 0.5);
#endif

#ifdef COMPILE_LIGHTMAP_ATTRIB
vec3 v_lightmapTmp3f = TEX_MAT3(u_textureMat4f02) * vec3(a_lightmap2f, 1.0);
v_lightmap2f = v_lightmapTmp3f.xy / v_lightmapTmp3f.z;
#endif

gl_Position = u_projectionMat4f * v_position4f;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
#line 2

/*
* Copyright (c) 2023 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/

precision lowp int;
precision highp float;
precision highp sampler2D;

in vec2 v_position2f;

layout(location = 0) out vec4 output4f;

uniform sampler2D u_texture0;
uniform sampler2D u_texture1;

#ifdef DEBUG_VIEW_18
precision highp sampler3D;
uniform sampler3D u_texture3D0;
uniform float u_fuckU1f;
#endif

uniform mat4 u_inverseViewMatrix;
uniform vec2 u_depthSliceStartEnd2f;

void main() {
#ifdef DEBUG_VIEW_0
output4f = vec4(textureLod(u_texture0, v_position2f, 0.0).rgb, 1.0);
#endif
#ifdef DEBUG_VIEW_1
vec3 color3f = textureLod(u_texture0, v_position2f, 0.0).rgb;
if(color3f.x == 0.0 && color3f.y == 0.0 && color3f.z == 0.0) {
output4f = vec4(0.0, 0.0, 0.0, 1.0);
}else {
output4f = vec4(normalize(mat3(u_inverseViewMatrix) * (color3f * 2.0 - 1.0)), 1.0);
}
#endif
#ifdef DEBUG_VIEW_2
output4f = vec4(textureLod(u_texture0, v_position2f, 0.0).a, textureLod(u_texture1, v_position2f, 0.0).a, 0.0, 1.0);
#endif
#ifdef DEBUG_VIEW_3
vec4 color4f = textureLod(u_texture0, v_position2f, 0.0);
output4f = vec4(color4f.b > 0.99 ? 1.0 : 0.0, color4f.a, 0.0, 1.0);
#endif
#ifdef DEBUG_VIEW_4
output4f = vec4(vec3(clamp((textureLod(u_texture0, v_position2f, 0.0).r - u_depthSliceStartEnd2f.x) * u_depthSliceStartEnd2f.y, 0.0, 1.0)), 1.0);
#endif
#ifdef DEBUG_VIEW_5
output4f = vec4(vec3(textureLod(u_texture0, (v_position2f + vec2(0.0, u_depthSliceStartEnd2f.y)) * vec2(1.0, u_depthSliceStartEnd2f.x), 0.0).r), 1.0);
#endif
#ifdef DEBUG_VIEW_6
output4f = vec4(vec3(textureLod(u_texture0, v_position2f, 0.0).r), 1.0);
#endif
#ifdef DEBUG_VIEW_7
output4f = vec4(vec3(textureLod(u_texture0, v_position2f, 0.0).a > 0.0 ? 1.0 : 0.0), 1.0);
#endif
#ifdef DEBUG_VIEW_8
output4f = vec4(textureLod(u_texture0, v_position2f, 0.0).rgb * 10.0, 1.0);
output4f.xyz /= (output4f.xyz + 1.0);
output4f.xyz = sqrt(output4f.xyz);
#endif
#ifdef DEBUG_VIEW_9
output4f = vec4(vec3(textureLod(u_texture0, v_position2f, 0.0).g), 1.0);
#endif
#ifdef DEBUG_VIEW_10
vec2 coord = (v_position2f + vec2(0.0, u_depthSliceStartEnd2f.y)) * vec2(1.0, u_depthSliceStartEnd2f.x);
vec4 color2 = textureLod(u_texture1, coord, 0.0);
output4f = vec4(mix(color2.rgb, vec3(textureLod(u_texture0, coord, 0.0).r), color2.a), 1.0);
#endif
#ifdef DEBUG_VIEW_11
output4f = vec4(vec3(textureLod(u_texture0, v_position2f, 0.0).a * 0.017), 1.0);
#endif
#ifdef DEBUG_VIEW_12
output4f = vec4(abs(textureLod(u_texture0, v_position2f, 0.0).rgb) * 0.1, 1.0);
#endif
#ifdef DEBUG_VIEW_13
output4f = vec4(vec3(textureLod(u_texture0, v_position2f, 0.0).g > 0.0 ? 1.0 : 0.0), 1.0);
#endif
#ifdef DEBUG_VIEW_14
output4f = vec4(textureLod(u_texture0, v_position2f.yx, 0.0).rgb * 2.5, 1.0);
output4f.xyz /= (output4f.xyz + 1.0);
output4f.xyz = sqrt(output4f.xyz);
#endif
#ifdef DEBUG_VIEW_15
output4f = vec4(vec3(textureLod(u_texture0, v_position2f.yx, 0.0).a > 0.0 ? 1.0 : 0.0), 1.0);
#endif
#ifdef DEBUG_VIEW_16
output4f = vec4(textureLod(u_texture0, v_position2f, 0.0).rg, 0.0, 1.0);
#endif
#ifdef DEBUG_VIEW_17
output4f = vec4(vec3(textureLod(u_texture0, v_position2f, 0.0).r) * 10.0, 1.0);
output4f.xyz /= (output4f.xyz + 1.0);
output4f.xyz = sqrt(output4f.xyz);
#endif
#ifdef DEBUG_VIEW_18
output4f = vec4(vec3(textureLod(u_texture3D0, vec3(v_position2f, u_fuckU1f), 0.0).r), 1.0);
#endif
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#line 2

/*
* Copyright (c) 2023 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/

precision lowp int;
precision mediump float;
precision highp sampler2D;

in vec2 v_position2f;

uniform sampler2D u_depthTexture;

void main() {
gl_FragDepth = textureLod(u_depthTexture, v_position2f, 0.0).r <= 0.0000001 ? 0.0 : 1.0;
}
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#line 2

/*
* Copyright (c) 2023 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/

precision lowp int;
precision highp float;
precision highp sampler2D;

layout(location = 0) out float occlusionOut1f;

uniform mat3 u_sampleMatrix3f;
uniform sampler2D u_depthBufferTexture;
uniform sampler2D u_cloudsSunOcclusion;

#define SAMPLE_DEPTH(v, a, f)\
f = u_sampleMatrix3f * v;\
f.xy /= f.z;\
if(f.xy == clamp(f.xy, vec2(0.001), vec2(0.999)))\
a += textureLod(u_depthBufferTexture, f.xy, 0.0).r > 0.000001 ? 0.0 : 0.0417;

void main() {
vec3 f;
float accum = 0.0;
float cloud = textureLod(u_cloudsSunOcclusion, vec2(0.5, 0.5), 0.0).r;
if(cloud < 0.01) {
occlusionOut1f = 0.0;
return;
}

SAMPLE_DEPTH(vec3(0.0, 0.0, 1.0), accum, f)
SAMPLE_DEPTH(vec3(-0.235, -0.962, 1.0), accum, f)
SAMPLE_DEPTH(vec3(0.029, 0.996, 1.0), accum, f)
SAMPLE_DEPTH(vec3(0.834, -0.509, 1.0), accum, f)
SAMPLE_DEPTH(vec3(-0.981, -0.086, 1.0), accum, f)
SAMPLE_DEPTH(vec3(0.821, 0.478, 1.0), accum, f)
SAMPLE_DEPTH(vec3(-0.614, 0.563, 1.0), accum, f)
SAMPLE_DEPTH(vec3(0.251, -0.578, 1.0), accum, f)
SAMPLE_DEPTH(vec3(-0.571, -0.491, 1.0), accum, f)
SAMPLE_DEPTH(vec3(0.142, 0.494, 1.0), accum, f)
SAMPLE_DEPTH(vec3(0.533, -0.036, 1.0), accum, f)
SAMPLE_DEPTH(vec3(0.970, -0.035, 1.0), accum, f)
SAMPLE_DEPTH(vec3(-0.388, 0.918, 1.0), accum, f)
SAMPLE_DEPTH(vec3(-0.521, 0.067, 1.0), accum, f)
SAMPLE_DEPTH(vec3(-0.140, -0.471, 1.0), accum, f)
SAMPLE_DEPTH(vec3(0.487, 0.692, 1.0), accum, f)
SAMPLE_DEPTH(vec3(-0.157, 0.331, 1.0), accum, f)
SAMPLE_DEPTH(vec3(0.559, -0.760, 1.0), accum, f)
SAMPLE_DEPTH(vec3(0.156, -0.956, 1.0), accum, f)
SAMPLE_DEPTH(vec3(0.181, -0.267, 1.0), accum, f)
SAMPLE_DEPTH(vec3(-0.773, 0.272, 1.0), accum, f)
SAMPLE_DEPTH(vec3(0.329, 0.228, 1.0), accum, f)
SAMPLE_DEPTH(vec3(-0.341, -0.187, 1.0), accum, f)
SAMPLE_DEPTH(vec3(-0.121, 0.689, 1.0), accum, f)

occlusionOut1f = min(accum * cloud, 1.0);
}
Loading

0 comments on commit 16a0bcd

Please sign in to comment.