From e2af2895109962d82e42894e99b76687e9c758eb Mon Sep 17 00:00:00 2001 From: Nyaann <88116907+Nyaannn@users.noreply.github.com> Date: Sat, 26 Nov 2022 18:14:08 -0700 Subject: [PATCH] i have commitment issues 2 --- .../com/lambda/client/module/Category.kt | 2 +- .../client/module/modules/chat/AutoReply.kt | 46 +++ .../module/modules/client/MenuShader.kt | 8 +- .../client/module/modules/combat/BedAura.kt | 8 +- .../assets/shaders/menu/PY3's Dream.fsh | 154 --------- .../resources/assets/shaders/menu/clouds.fsh | 293 ------------------ .../resources/assets/shaders/menu/sunset.fsh | 134 ++++++++ .../assets/shaders/menu/triangle.fsh | 206 ++++-------- 8 files changed, 256 insertions(+), 595 deletions(-) create mode 100644 src/main/kotlin/com/lambda/client/module/modules/chat/AutoReply.kt delete mode 100644 src/main/resources/assets/shaders/menu/PY3's Dream.fsh delete mode 100644 src/main/resources/assets/shaders/menu/clouds.fsh create mode 100644 src/main/resources/assets/shaders/menu/sunset.fsh diff --git a/src/main/kotlin/com/lambda/client/module/Category.kt b/src/main/kotlin/com/lambda/client/module/Category.kt index 2b97ba9..c3e88ca 100644 --- a/src/main/kotlin/com/lambda/client/module/Category.kt +++ b/src/main/kotlin/com/lambda/client/module/Category.kt @@ -11,6 +11,6 @@ enum class Category(override val displayName: String) : DisplayEnum { PLAYER("Player"), RENDER("Render"), EXPLOITS("Exploits"), - TUCOCLIENT("Random"); + TUCOCLIENT("Tuco"); override fun toString() = displayName } \ No newline at end of file diff --git a/src/main/kotlin/com/lambda/client/module/modules/chat/AutoReply.kt b/src/main/kotlin/com/lambda/client/module/modules/chat/AutoReply.kt new file mode 100644 index 0000000..2c69a42 --- /dev/null +++ b/src/main/kotlin/com/lambda/client/module/modules/chat/AutoReply.kt @@ -0,0 +1,46 @@ +package com.lambda.client.module.modules.chat +import com.lambda.client.event.events.PacketEvent +import com.lambda.client.module.Category +import com.lambda.client.util.TickTimer +import com.lambda.client.util.TimeUnit +import com.lambda.client.util.text.MessageDetection +import com.lambda.client.util.text.MessageSendHelper +import com.lambda.client.util.text.MessageSendHelper.sendServerMessage +import com.lambda.client.util.threads.safeListener +import com.lambda.client.event.listener.listener +import net.minecraft.network.play.server.SPacketChat +import com.lambda.client.module.Module +import net.minecraftforge.fml.common.gameevent.TickEvent + + +object AutoReply : Module( + name = "AutoReply", + description = "Automatically reply to direct messages", + category = Category.CHAT +) { + private val customMessage by setting("Custom Message", false) + private val customText by setting("Custom Text", "unchanged", { customMessage }) + + private val timer = TickTimer(TimeUnit.SECONDS) + private const val defaultMessage = "Lambda+ on top!" + + init { + listener { + if (it.packet is SPacketChat) { + val message = (it.packet as SPacketChat).chatComponent.unformattedText + if (MessageDetection.Direct.RECEIVE detect message) { + if (customMessage) { + if (!message.contains(customText)) sendServerMessage("/r $customText") + } else { + if (!message.contains(defaultMessage)) sendServerMessage("/r $defaultMessage") + } + } + } + } + safeListener { + if (timer.tick(5L) && customMessage && customText.equals("unchanged", true)) { + MessageSendHelper.sendWarningMessage("$chatName Warning: In order to use the custom $name, please change the CustomText setting in ClickGUI") + } + } + } +} \ No newline at end of file diff --git a/src/main/kotlin/com/lambda/client/module/modules/client/MenuShader.kt b/src/main/kotlin/com/lambda/client/module/modules/client/MenuShader.kt index bb35cee..d5e5c58 100644 --- a/src/main/kotlin/com/lambda/client/module/modules/client/MenuShader.kt +++ b/src/main/kotlin/com/lambda/client/module/modules/client/MenuShader.kt @@ -20,7 +20,7 @@ object MenuShader : Module( enabledByDefault = true ) { private val mode by setting("Mode", Mode.SET) - private val shader by setting("Shader", ShaderEnum.CLOUDS, { mode == Mode.SET }) + private val shader by setting("Shader", ShaderEnum.SUNSET, { mode == Mode.SET }) private enum class Mode { RANDOM, SET @@ -28,13 +28,11 @@ object MenuShader : Module( @Suppress("UNUSED") private enum class ShaderEnum(val path: String) { - PY3sDream("/assets/shaders/menu/PY3's Dream.fsh"), - Germany("/assets/shaders/menu/germany.fsh"), + GERMANY("/assets/shaders/menu/germany.fsh"), BLUEGRID("/assets/shaders/menu/bluegrid.fsh"), BLUENEBULA("/assets/shaders/menu/bluenebula.fsh"), BLUEVORTEX("/assets/shaders/menu/bluevortex.fsh"), CAVE("/assets/shaders/menu/cave.fsh"), - CLOUDS("/assets/shaders/menu/clouds.fsh"), DOUGHNUTS("/assets/shaders/menu/doughnuts.fsh"), FIRE("/assets/shaders/menu/fire.fsh"), JUPITER("/assets/shaders/menu/jupiter.fsh"), @@ -48,7 +46,7 @@ object MenuShader : Module( SPACE("/assets/shaders/menu/space.fsh"), SPACE2("/assets/shaders/menu/space2.fsh"), STORM("/assets/shaders/menu/storm.fsh"), - TRIANGLE("/assets/shaders/menu/triangle.fsh") + SUNSET("/assets/shaders/menu/triangle.fsh") } diff --git a/src/main/kotlin/com/lambda/client/module/modules/combat/BedAura.kt b/src/main/kotlin/com/lambda/client/module/modules/combat/BedAura.kt index 9e2803b..aa066fc 100644 --- a/src/main/kotlin/com/lambda/client/module/modules/combat/BedAura.kt +++ b/src/main/kotlin/com/lambda/client/module/modules/combat/BedAura.kt @@ -46,7 +46,7 @@ object BedAura : Module( private val suicideMode by setting("Suicide Mode", false) private val hitDelay by setting("Hit Delay", 5, 1..10, 1, unit = " ticks") private val hitDelayb by setting("Hit Delay Bypass", 0f, -100f..100f, 0.25f,unit = " ticks") - + private val iticks by setting("Inactive Ticks", 5, 1..100, 1) private val refillDelay by setting("Refill Delay", 2, 1..5, 1, unit = " ticks") private val minDamage by setting("Min Damage", 10f, 1f..20f , 0.25f) private val maxSelfDamage by setting("Max Self Damage", 4f, 1f..10f, 0.25f, { !suicideMode }) @@ -57,7 +57,7 @@ object BedAura : Module( private var state = State.NONE private var clickPos = BlockPos(0, -6969, 0) private var lastRotation = Vec2f.ZERO - private var hitTickCount = -10 + private var hitTickCount = 0 private var inactiveTicks = 0 private enum class State { @@ -95,7 +95,7 @@ object BedAura : Module( if (player.dimension == 0 || !CombatManager.isOnTopPriority(BedAura) || CombatSetting.pause) { state = State.NONE resetRotation() - inactiveTicks = 6 + inactiveTicks = iticks return@safeListener } @@ -197,7 +197,7 @@ object BedAura : Module( private fun getExplodePos() = bedMap.values.firstOrNull() private fun SafeClientEvent.preExplode(pos: BlockPos) { - hitTickCount = -10 + hitTickCount = 0 preClick(pos, Vec3d(0.5, 0.0, 0.5)) state = State.EXPLODE } diff --git a/src/main/resources/assets/shaders/menu/PY3's Dream.fsh b/src/main/resources/assets/shaders/menu/PY3's Dream.fsh deleted file mode 100644 index 895c113..0000000 --- a/src/main/resources/assets/shaders/menu/PY3's Dream.fsh +++ /dev/null @@ -1,154 +0,0 @@ -// SixteenSegmentDisplay.glsl -// 16 Segment Display Example v3 -// rearranged source code by I.G.P. -// better comments added to source by Hekate - -#ifdef GL_ES -precision highp float; -#endif - -vec2 uv; - -uniform float time; -uniform vec2 resolution; - -const vec2 ch_size = vec2(1.0, 2.0); // character size (X,Y) -const vec2 ch_space = ch_size + vec2(1.0, 1.0); // character distance Vector(X,Y) -const vec2 ch_start = vec2 (ch_space.x * -5., 2.); // start position - vec2 ch_pos = vec2 (0.0, 0.0); // character position(X,Y) - vec3 ch_color = vec3 (0.6, 0.4, 2.5); // character color (R,G,B) -const vec3 bg_color = vec3 (0.0, 0.0, 0.0); // background color (R,G,B) - -#define REPEAT_SIGN false // True/False; True=Multiple, False=Single - -/* 16 segment display...Akin to LED Display. - -Segment bit positions: - JJ2__ __1__ - |\ | /| - | \ | / | - 3 11 10 9 0 - | \ | / | - | \|/ | - _12__ __8__ - | | - | /|\ | - 4 / | \ 7 - | 13 14 15 | - | / | \ | - __5__|__6__ - -15 12 11 8 7 4 3 0 - | | | | | | | | - 0000 0000 0000 0000 - -example: letter A - - 12 8 7 4 3210 - | | | | |||| - 0001 0001 1001 1111 - - binary to hex -> 0x119F -*/ - -#define n1 ddigit(0x22FF); -#define n9 ddigit(0x0281); -#define n0 ddigit(0x00FF); - -#define n1 ddigit(0x22FF); -#define n6 ddigit(0x11E6); -#define n3 ddigit(0x2206); -#define n8 ddigit(0x2206); - -#define A ddigit(0x119F); -#define B ddigit(0x927E); -#define C ddigit(0x007E); -#define D ddigit(0x44E7); -#define E ddigit(0x107E); -#define F ddigit(0x101E); -#define G ddigit(0x807E); -#define H ddigit(0x1199); -#define I ddigit(0x4466); -#define J ddigit(0x4436); -#define K ddigit(0x9218); -#define L ddigit(0x0078); -#define M ddigit(0x0A99); -#define N ddigit(0x8899); -#define O ddigit(0x00FF); -#define P ddigit(0x111F); -#define Q ddigit(0x80FF); -#define R ddigit(0x911F); -#define S ddigit(0x8866); -#define T ddigit(0x4406); -#define U ddigit(0x00F9); -#define V ddigit(0x2218); -#define W ddigit(0xA099); -#define X ddigit(0xAA00); -#define Y ddigit(0x4A00); -#define Z ddigit(0x2266); -#define _ ch_pos.x += ch_space.x; -#define s_dot ddigit(0); -#define s_minus ddigit(0x1100); -#define s_plus ddigit(0x5500); -#define s_greater ddigit(0x2800); -#define s_less ddigit(0x8200); -#define s_sqrt ddigit(0x0C02); -#define nl1 ch_pos = ch_start; ch_pos.y -= 3.0; -#define nl2 ch_pos = ch_start; ch_pos.y -= 6.0; -#define nl3 ch_pos = ch_start; ch_pos.y -= 9.0; - -float dseg(vec2 p0, vec2 p1) -{ - vec2 dir = normalize(p1 - p0); - vec2 cp = (uv - ch_pos - p0) * mat2(dir.x, dir.y,-dir.y, dir.x); - return distance(cp, clamp(cp, vec2(0), vec2(distance(p0, p1), 0))); -} - -bool bit(int n, int b) -{ - return mod(floor(float(n) / exp2(floor(float(b)))), 2.0) != 0.0; -} - -float d = 1e6; - -void ddigit(int n) -{ - float v = 1e6; - vec2 cp = uv - ch_pos; - if (n == 0) v = min(v, dseg(vec2(-0.405, -1.000), vec2(-0.500, -1.000))); - if (bit(n, 0)) v = min(v, dseg(vec2( 0.500, 0.063), vec2( 0.500, 0.937))); - if (bit(n, 1)) v = min(v, dseg(vec2( 0.438, 1.000), vec2( 0.063, 1.000))); - if (bit(n, 2)) v = min(v, dseg(vec2(-0.063, 1.000), vec2(-0.438, 1.000))); - if (bit(n, 3)) v = min(v, dseg(vec2(-0.500, 0.937), vec2(-0.500, 0.062))); - if (bit(n, 4)) v = min(v, dseg(vec2(-0.500, -0.063), vec2(-0.500, -0.938))); - if (bit(n, 5)) v = min(v, dseg(vec2(-0.438, -1.000), vec2(-0.063, -1.000))); - if (bit(n, 6)) v = min(v, dseg(vec2( 0.063, -1.000), vec2( 0.438, -1.000))); - if (bit(n, 7)) v = min(v, dseg(vec2( 0.500, -0.938), vec2( 0.500, -0.063))); - if (bit(n, 8)) v = min(v, dseg(vec2( 0.063, 0.000), vec2( 0.438, -0.000))); - if (bit(n, 9)) v = min(v, dseg(vec2( 0.063, 0.063), vec2( 0.438, 0.938))); - if (bit(n, 10)) v = min(v, dseg(vec2( 0.000, 0.063), vec2( 0.000, 0.937))); - if (bit(n, 11)) v = min(v, dseg(vec2(-0.063, 0.063), vec2(-0.438, 0.938))); - if (bit(n, 12)) v = min(v, dseg(vec2(-0.438, 0.000), vec2(-0.063, -0.000))); - if (bit(n, 13)) v = min(v, dseg(vec2(-0.063, -0.063), vec2(-0.438, -0.938))); - if (bit(n, 14)) v = min(v, dseg(vec2( 0.000, -0.938), vec2( 0.000, -0.063))); - if (bit(n, 15)) v = min(v, dseg(vec2( 0.063, -0.063), vec2( 0.438, -0.938))); - ch_pos.x += ch_space.x; - d = min(d, v); -} - -void main( void ) -{ - vec2 aspect = resolution.xy / resolution.y; - uv = ( gl_FragCoord.xy / resolution.y ) - aspect / 2.0; - uv.y += sin(time*6.)*0.2; - uv *= 15.0 + sin(time); // set zoom size - if (REPEAT_SIGN) - uv = -14.0 + mod(1.8*(uv-1.0),ch_space*vec2(16.,6.5)); // set zoom size - - ch_pos = ch_start + vec2(sin(time),0.0); // set start position - - _ I _ W A N N A _ B E nl2 F U C K E D _ H A R D - - vec3 color = mix(ch_color, bg_color, 0.9- (0.08 / d)); // shading - gl_FragColor = vec4(color, 1.0); -} \ No newline at end of file diff --git a/src/main/resources/assets/shaders/menu/clouds.fsh b/src/main/resources/assets/shaders/menu/clouds.fsh deleted file mode 100644 index ec22f34..0000000 --- a/src/main/resources/assets/shaders/menu/clouds.fsh +++ /dev/null @@ -1,293 +0,0 @@ -// ported by vitos1k -// it's a port from Shader toy Structured Volume sampling https://www.shadertoy.com/view/Mt3GWs -// in the original there was noise texture iChannel0 used to generate some 3d noise. -// i used float noise(vec3) from this example http://glslsandbox.com/e#35155.0 to generate some random noise - - - - -/* -The MIT License (MIT) - -Copyright (c) 2016 Huw Bowles, Daniel Zimmermann, Beibei Wang - -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. -*/ - -// -// For diagram shader showing how samples are taken: -// -// https://www.shadertoy.com/view/ll3GWs -// -// We are in the process of writing up this technique. The following github repos -// is the home of this research. -// -// https://github.com/huwb/volsample -// -// -// -// Additional credits - this scene is mostly mash up of these two amazing shaders: -// -// Clouds by iq: https://www.shadertoy.com/view/XslGRr -// Cloud Ten by nimitz: https://www.shadertoy.com/view/XtS3DD -// - - -#ifdef GL_ES -precision mediump float; -#endif - -uniform float time; -uniform vec2 mouse; -uniform vec2 resolution; - - -#define SAMPLE_COUNT 16 -#define PERIOD 2. -#define SEED 1337.37 -#define PI 3.14159265359 - -// mouse toggle -bool STRUCTURED = true; - -// cam moving in a straight line -vec3 lookDir = vec3(cos(PI * 1.2), 0., sin(PI * 1.2)); -vec3 camVel = vec3(-20., 0., 0.); -float zoom = 1.0;// 1.5; - -vec3 sundir = normalize(vec3(-1.0, 0.0, -1.)); - -// Noise salvaged from here http://glslsandbox.com/e#35155.0 - -float rand(vec3 p){ - return fract(4768.1232345456 * sin((p.z + p.x * 22.0))); -} - - -float noise(vec3 pos) -{ - vec3 ip = floor(pos); - vec3 fp = smoothstep(0.0, 1.0, fract(pos)); - vec4 a = vec4( - rand(ip + vec3(0, 0, 0)), - rand(ip + vec3(1, 0, 0)), - rand(ip + vec3(0, 1, 0)), - rand(ip + vec3(1, 1, 0))); - vec4 b = vec4( - rand(ip + vec3(0, 0, 1)), - rand(ip + vec3(1, 0, 1)), - rand(ip + vec3(0, 1, 1)), - rand(ip + vec3(1, 1, 1))); - - a = mix(a, b, fp.z); - a.xy = mix(a.xy, a.zw, fp.yx); - return mix(a.x, a.y, fp.x); -} - - -vec4 map(in vec3 p) -{ - float d = 0.2 + .8 * sin(0.6*p.z)*sin(0.5*p.x) - p.y; - - vec3 q = p; - float f; - - f = 0.5000*noise(q); q = q*2.02; - f += 0.2500*noise(q); q = q*2.03; - f += 0.1250*noise(q); q = q*2.01; - f += 0.0625*noise(q); - d += 2.75 * f; - - d = clamp(d, 0.0, 1.0); - - vec4 res = vec4(d); - - vec3 col = 1.15 * vec3(1.0, 0.95, 0.8); - col += vec3(1., 0., 0.) * exp2(res.x*10.-10.); - res.xyz = mix(col, vec3(0.7, 0.7, 0.7), res.x); - - return res; -} - - - // to share with unity hlsl - #define float2 vec2 - #define float3 vec3 - #define fmod mod -float mysign(float x) { return x < 0. ? -1. : 1.; } - float2 mysign(float2 x) { return float2(x.x < 0. ? -1. : 1., x.y < 0. ? -1. : 1.); } - -// compute ray march start offset and ray march step delta and blend weight for the current ray -void SetupSampling(out float2 t, out float2 dt, out float2 wt, in float3 ro, in float3 rd) -{ - if (!STRUCTURED) - { - dt = float2(PERIOD, PERIOD); - t = dt; - wt = float2(0.5, 0.5); - return; - } - - // the following code computes intersections between the current ray, and a set - // of (possibly) stationary sample planes. - - // much of this should be more at home on the CPU or in a VS. - - // structured sampling pattern line normals - float3 n0 = (abs(rd.x) > abs(rd.z)) ? float3(1., 0., 0.) : float3(0., 0., 1.);// non diagonal -float3 n1 = float3(mysign(rd.x * rd.z), 0., 1.);// diagonal - -// normal lengths (used later) -float2 ln = float2(length(n0), length(n1)); - n0 /= ln.x; - n1 /= ln.y; - - // some useful DPs - float2 ndotro = float2(dot(ro, n0), dot(ro, n1)); -float2 ndotrd = float2(dot(rd, n0), dot(rd, n1)); - -// step size -float2 period = ln * PERIOD; - dt = period / abs(ndotrd); - - // dist to line through origin - float2 dist = abs(ndotro / ndotrd); - - // raymarch start offset - skips leftover bit to get from ro to first strata lines - t = -mysign(ndotrd) * fmod(ndotro, period) / abs(ndotrd); - if (ndotrd.x > 0.) t.x += dt.x; - if (ndotrd.y > 0.) t.y += dt.y; - - // sample weights - float minperiod = PERIOD; - float maxperiod = sqrt(2.)*PERIOD; - wt = smoothstep(maxperiod, minperiod, dt/ln); - wt /= (wt.x + wt.y); -} - -vec4 raymarch(in vec3 ro, in vec3 rd) -{ - vec4 sum = vec4(0, 0, 0, 0); - - // setup sampling - compute intersection of ray with 2 sets of planes - float2 t, dt, wt; - SetupSampling(t, dt, wt, ro, rd); - - // fade samples at far extent - float f = .6;// magic number - TODO justify this - float endFade = f*float(SAMPLE_COUNT)*PERIOD; - float startFade = .8*endFade; - - for (int i=0; i 0.99) continue; - - // data for next sample - vec4 data = t.x < t.y ? vec4(t.x, wt.x, dt.x, 0.) : vec4(t.y, wt.y, 0., dt.y); - // somewhat similar to: https://www.shadertoy.com/view/4dX3zl - //vec4 data = mix( vec4( t.x, wt.x, dt.x, 0. ), vec4( t.y, wt.y, 0., dt.y ), float(t.x > t.y) ); - vec3 pos = ro + data.x * rd; - float w = data.y; - t += data.zw; - - // fade samples at far extent - w *= smoothstep(endFade, startFade, data.x); - - vec4 col = map(pos); - - // iqs goodness - float dif = clamp((col.w - map(pos+0.6*sundir).w)/0.6, 0.0, 1.0); - vec3 lin = vec3(0.51, 0.53, 0.63)*1.35 + 0.55*vec3(0.85, 0.57, 0.3)*dif; - col.xyz *= lin; - - col.xyz *= col.xyz; - - col.a *= 0.75; - col.rgb *= col.a; - - // integrate. doesn't account for dt yet, wip. - sum += col * (1.0 - sum.a) * w; - } - - sum.xyz /= (0.001+sum.w); - - return clamp(sum, 0.0, 1.0); -} - -vec3 sky(vec3 rd) -{ - vec3 col = vec3(0.); - - float hort = 1. - clamp(abs(rd.y), 0., 1.); - col += 0.5*vec3(.99, .5, .0)*exp2(hort*8.-8.); - col += 0.1*vec3(.5, .9, 1.)*exp2(hort*3.-3.); - col += 0.55*vec3(.6, .6, .9); - - float sun = clamp(dot(sundir, rd), 0.0, 1.0); - col += .2*vec3(1.0, 0.3, 0.2)*pow(sun, 2.0); - col += .5*vec3(1., .9, .9)*exp2(sun*650.-650.); - col += .1*vec3(1., 1., 0.1)*exp2(sun*100.-100.); - col += .3*vec3(1., .7, 0.)*exp2(sun*50.-50.); - col += .5*vec3(1., 0.3, 0.05)*exp2(sun*10.-10.); - - float ax = atan(rd.y, length(rd.xz))/1.; - float ay = atan(rd.z, rd.x)/2.; - float st = noise(vec3(ax, ay, 1.0)); - float st2 = noise(.25*vec3(ax, ay, 0.5)); - st *= st2; - st = smoothstep(0.65, .9, st); - col = mix(col, col+1.8*st, clamp(1.-1.1*length(col), 0., 1.)); - - return col; -} - - -void main(void) { - - - vec2 q = gl_FragCoord.xy / resolution.xy; - vec2 p = -1.0 + 2.0*q; - p.x *= resolution.x/ resolution.y; - - // camera - vec3 ro = vec3(0., 1.5, 0.) + 0.01*time*camVel; - vec3 ta = ro + lookDir;//vec3(ro.x, ro.y, ro.z-1.); - vec3 ww = normalize(ta - ro); - vec3 uu = normalize(cross(vec3(0.0, 1.0, 0.0), ww)); - vec3 vv = normalize(cross(ww, uu)); - float fov = 1.; - vec3 rd = normalize(fov*p.x*uu + fov*1.2*p.y*vv + 1.5*ww); - - // divide by forward component to get fixed z layout instead of fixed dist layout - //vec3 rd_layout = rd/mix(dot(rd,ww),1.0,samplesCurvature); - vec4 clouds = raymarch(ro, rd); - - vec3 col = clouds.xyz; - - // sky if visible - if (clouds.w <= 0.99) - col = mix(sky(rd), col, clouds.w); - - col = clamp(col, 0., 1.); - col = smoothstep(0., 1., col); - col *= pow(16.0*q.x*q.y*(1.0-q.x)*(1.0-q.y), 0.12);//Vign - - gl_FragColor = vec4(col, 1.0); - -} \ No newline at end of file diff --git a/src/main/resources/assets/shaders/menu/sunset.fsh b/src/main/resources/assets/shaders/menu/sunset.fsh new file mode 100644 index 0000000..291c1b7 --- /dev/null +++ b/src/main/resources/assets/shaders/menu/sunset.fsh @@ -0,0 +1,134 @@ +#extension GL_OES_standard_derivatives : enable + +precision highp float; + +uniform float time; +uniform vec2 mouse; +uniform vec2 resolution; + + const float r = .5; + const float mg = 1.7320508; + + const float PI_H = 1.570796326794896; +const float PI = 3.14159265358979; +const float PI_2 = 6.28318530717958; + const float PI_4 = 12.56637061435917; + + const vec3 mulColor1 = vec3( .9, .2, 1. ); + const vec3 mulColor2 = vec3( .1, .8, .2 ); + const vec3 lineColor1 = vec3( .0, .95, .5 ); + const vec3 lineColor2 = vec3( .1, .05, .9 ); + const vec3 bgColor = vec3( .2, .15, .5 ); + const vec3 glowColor = vec3( .1, .75, .55 ); + const vec3 frontColor = vec3( 1., 1., 1. ); + const vec3 frontColor2 = vec3( .01, .03, .05 ); + + vec3 hex( in vec2 p, in float t, in float x, in float y, in float o ) { + + float d; + if ( abs(p.x) > abs(p.y) * mg ) + d += abs(p.x); + else + d += (abs(p.y) * mg + abs(p.x)) * .5; + + vec3 c = lineColor1 * clamp(PI-t, 0., PI) + lineColor2 * min(t, PI); + c += (1. - p.x) * r * 5. * mulColor1 + p.x * r * 5. * mulColor2; + + float w = (y - o) * x + 1.; + float wp = w * PI; + + float q = r - d; + + float m = 0.; + m += 1. / abs(d - r) * .007 - .01; + if (d < r) m -= q; + vec3 res = c * clamp( m, 0., 9. ); + + float a = atan(p.y, p.x) + PI * (1.5 - cos(mod(min(t, wp), PI))); + float s = mod(a, PI_2) / (PI_2); + float f = (s - .5); + + res *= clamp( 1. / (abs(f) + .05) * .007 - .015 * (.5 - cos(mod(min(t * 2., wp * 2.), PI_2))), 0., 8. ) * (w - 1.); + + return res * ( 2.0 - ( cos(min(t / w, PI) * 2.) + 1. )); + + } + + vec3 bg( in float d ) { + + return bgColor * ( 4. - d ) * .09; + + } + +vec3 glow( in vec2 p ) { + + float g = length( vec2( ( gl_FragCoord.y * 2. ) / min( resolution.x, resolution.y ), p.x ) ); + return glowColor * max((1. / (g + 0.3) * .15), 0.); + + } + +vec3 front( in vec3 res, in vec2 p, in float t ) { + + p *= 1. / (.97 + (1. - sin(min(t * .2 * PI, PI_H))) * .3); + + float d; + if ( abs(p.x) > abs(p.y) * mg ) + d += abs(p.x); + else + d += (abs(p.y) * mg + abs(p.x)) * .5; + + if (t > 1.5) { + + float tq = clamp(((t - 1.5) * 4.5 + p.y * mg * r) * 1., 0., 1.); + float v = clamp(((1. / abs(r - d) * .0015) - .2) * tq, 0., 1.); + + if (d < r + .01) { + + float i = clamp((r - d) * 500., 0., 1.); + if (t < 1.8) + res += clamp((t - 1.5) * 3., 0., 1.) * i; + else { + + float a = clamp((1.8 - t) * 4. + p.x * 0.2 - p.y * .5 + 1., 0., 1.); + res = mix(res, mix(frontColor2, frontColor, a), i); + + } + + } + + if (t >= 1.8) { + + v *= clamp(1.8 - t * .8, 0., 1.); + + } + + res += frontColor * v; + } + return res; + + } + +void main( void ) { + + vec3 res; + + vec2 p = ( gl_FragCoord.xy * 2. - resolution.xy ) / min( resolution.x, resolution.y ); + + float t = mod(time * 1.2, 3.); + + for (float i = 0.; i < 12.; i++) { + float ti = mod(time * 1.2 - i * 0.02, 3.); + vec2 pm = p * (1. - (1. + -ti * .25) * (i * .01)); + float t2 = t * t * .5; + float o = .02 * i * (.9 + t2 * .4); + float s = sin(o); + float c = cos(o); + res += hex(vec2((pm.x * c - pm.y * s) / (1. + i * 0.015), pm.y * c + pm.x * s), t2 * PI, .083, 12., i); + } + res += bg(length(p)); + res += glow(p); + res = front(res, p, t); + + gl_FragColor = vec4( res, 1. ); + + } \ No newline at end of file diff --git a/src/main/resources/assets/shaders/menu/triangle.fsh b/src/main/resources/assets/shaders/menu/triangle.fsh index 2c239b3..2ce2ad8 100644 --- a/src/main/resources/assets/shaders/menu/triangle.fsh +++ b/src/main/resources/assets/shaders/menu/triangle.fsh @@ -1,6 +1,7 @@ // ... and lo, Man created gods in his own image. #ifdef GL_ES precision mediump float; + #endif #extension GL_OES_standard_derivatives : enable @@ -9,166 +10,95 @@ uniform float time; uniform vec2 mouse; uniform vec2 resolution; + float lineWidth = 0.02; + float border = 0.05; + float scale = 0.07; + float t = time*1.4; + // Letter code (https://dl.dropboxusercontent.com/u/14645664/files/glsl-text.txt) + float line(vec2 p, vec2 s, vec2 e) {s*=scale;e*=scale;float l=length(s-e);vec2 d=vec2(e-s)/l;p-=vec2(s.x,-s.y);p=vec2(p.x*d.x+p.y*-d.y,p.x*d.y+p.y*d.x);return length(max(abs(p-vec2(l/2.0,0))-vec2(l/2.0,lineWidth/2.0),0.0))-border;} -#define Resolution resolution -#define Time time - -#define HorizontalAmplitude 0.30 -#define VerticleAmplitude 0.20 -#define HorizontalSpeed 0.90 -#define VerticleSpeed 1.50 -#define ParticleMinSize 1.76 -#define ParticleMaxSize 1.61 -#define ParticleBreathingSpeed 0.30 -#define ParticleColorChangeSpeed 0.70 -#define ParticleCount 2.0 -#define ParticleColor1 vec3(9.0, 5.0, 3.0) -#define ParticleColor2 vec3(1.0, 3.0, 9.0) - - -float hash(float x) -{ - return fract(sin(x) * 43758.5453); -} - -float noise(vec2 uv)// Thanks Inigo Quilez -{ - vec3 x = vec3(uv.xy, 90.0); - - vec3 p = floor(x); - vec3 f = fract(x); - - f = f*f*(3.0 - 2.0*f); - - float offset = 57.0; - - float n = dot(p, vec3(1.0, offset, offset*2.0)); - - return mix(mix(mix(hash(n + 0.0), hash(n + 1.0), f.x), - mix(hash(n + offset), hash(n + offset+1.0), f.x), f.y), - mix(mix(hash(n + offset*2.0), hash(n + offset*2.0+1.0), f.x), - mix(hash(n + offset*3.0), hash(n + offset*3.0+1.0), f.x), f.y), f.z); -} - -float snoise(vec2 uv) -{ - return noise(uv) * 2.0 - 1.0; -} - - -float perlinNoise(vec2 uv) -{ - float n = noise(uv * 1.0) * 128.0 + - noise(uv * 2.0) * 64.0 + - noise(uv * 4.0) * 32.0 + - noise(uv * 8.0) * 16.0 + - noise(uv * 16.0) * 8.0 + - noise(uv * 32.0) * 4.0 + - noise(uv * 64.0) * 2.0 + - noise(uv * 128.0) * 1.0; - - float noiseVal = n / (1.0 + 2.0 + 4.0 + 8.0 + 16.0 + 32.0 + 64.0 + 128.0); - noiseVal = abs(noiseVal * 2.0 - 1.0); - - return noiseVal; -} - -float fBm(vec2 uv, float lacunarity, float gain) -{ - float sum = 0.0; - float amp = 7.0; - - for (int i = 0; i < 2; ++i) - { - sum += (perlinNoise(uv)) * amp; - amp *= gain; - uv *= lacunarity; - } - - return sum; -} - -vec3 particles(vec2 pos) -{ - - vec3 c = vec3(0, 0, 0); - - float noiseFactor = fBm(pos, 0.01, 0.1); - - for (float i = 1.0; i < ParticleCount+1.0; ++i) - { - float cs = cos(time * HorizontalSpeed * (i/ParticleCount) + noiseFactor) * HorizontalAmplitude; - float ss = sin(time * VerticleSpeed * (i/ParticleCount) + noiseFactor) * VerticleAmplitude; - vec2 origin = vec2(cs, ss); - - float t = sin(time * ParticleBreathingSpeed * i) * 0.5 + 0.5; - float particleSize = mix(ParticleMinSize, ParticleMaxSize, t); - float d = clamp(sin(length(pos - origin) + particleSize), 0.0, particleSize); - - float t2 = sin(time * ParticleColorChangeSpeed * i) * 0.5 + 0.5; - vec3 color = mix(ParticleColor1, ParticleColor2, t2); - c += color * pow(d, 10.0); - } - - return c; -} - +float Astroph(vec2 p){float d=1.0;d=min(d,line(p,vec2(1.5,1.5),vec2(2.5,0.7)));return d;} -float line(vec2 a, vec2 b, vec2 p) -{ - vec2 aTob = b - a; - vec2 aTop = p - a; +float spike(float x) { + x = mod(x, 2.0); - float t = dot(aTop, aTob) / dot(aTob, aTob); + if (x < 1.0) + return x * x; - t = clamp(t, 0.0, 1.0); + x = 2.0 - x; - float d = length(p - (a + aTob * t)); - d = 1.0 / d; + return x * x; + } - return clamp(d, 0.0, 1.0); -} +float noise(float x, float amplitude) { + float n = sin(x*8.0 + time) * 0.05 + + sin(x*27.3 + time*0.5) * 0.005 + + sin(time) * 0.01; + return n * amplitude; + } -void main(void) { +const vec3 sky_high = vec3(255, 221, 128) / 255.0; + const vec3 sky_low = vec3(255, 174, 107) / 255.0; +const vec3 water = vec3(97, 160, 171) / 255.0; - float aspectRatio = resolution.x / resolution.y; + float fog = 10.0; - vec2 uv = (gl_FragCoord.xy / resolution.xy); +void main() { - vec2 signedUV = uv * 2.0 - 1.0; - signedUV.x *= aspectRatio; + vec2 uv2 = (gl_FragCoord.xy - resolution.xy) / resolution.yy+0.7; + uv2.x += 0.15; - float freqA = mix(0.4, 1.2, sin(time + 30.0) * 0.5 + 0.5); - float freqB = mix(0.4, 1.2, sin(time + 20.0) * 0.5 + 0.5); - float freqC = mix(0.4, 1.2, sin(time + 10.0) * 0.5 + 0.5); + uv2.x *= abs(sin(uv2.x+t*2.0+22.0)*0.7+4.4); + uv2.y *= abs(sin(uv2.x+t*2.0)+2.2)+1.0; + vec3 col = vec3(uv2.y)*vec3(0.0,0.0, 0.0); + float d = 1.0; - float scale = 100.0; - const float v = 70.0; - vec3 finalColor = vec3(0.0); + float w = 0.01; + col = mix(vec3(1,uv2.y,0.5),col,smoothstep(lineWidth-w,lineWidth+w,d)); - finalColor = (particles(sin(abs(signedUV))) * length(signedUV)) * 0.20; + vec2 uv = (gl_FragCoord.xy / resolution.xy); + vec2 sunuv = (gl_FragCoord.xy * 2.0 - resolution) / min(resolution.x, resolution.y); - float t = line(vec2(-v, -v), vec2(0.0, v), signedUV * scale); - finalColor += vec3(8.0 * t, 2.0 * t, 4.0 * t) * freqA; - t = line(vec2(0.0, v), vec2(v, -v), signedUV * scale); - finalColor += vec3(2.0 * t, 8.0 * t, 4.0 * t) * freqB; - t = line(vec2(-v, -v), vec2(v, -v), signedUV * scale); - finalColor += vec3(2.0 * t, 4.0 * t, 8.0 * t) * freqC; + float v = 0.0; + vec3 sun = vec3(179, 107, 0) / 255.0; - //scale = scale * 1.2; - //t = line( vec2(0.0, v * 0.2), vec2(0.0, -v * 0.8), signedUV * scale ); - //finalColor += vec3( 8.0 * t, 4.0 * t, 2.0 * t) * 0.5; + if (distance(sunuv, vec2(0.0)) > 0.5) + sun = vec3(0.0); - //t = line( vec2(-v * 0.3, -v*0.1), vec2(v * 0.3, -v*0.1), signedUV * scale ); - //finalColor += vec3( 8.0 * t, 4.0 * t, 2.0 * t) * 0.4; + float n0 = noise(uv.x * 3.18, 0.3); + float n1 = noise(uv.x * 2.34, 0.4); + float n2 = noise(uv.x * 2.14, 0.6); + float n3 = noise(uv.x * 1.4, 0.8); + float n4 = noise(uv.x * 1.23, 1.0); + if (uv.y < 0.2 + n4) { + v = 0.5; + } else if (uv.y < 0.3 + n3) { + v = 0.4; + } else if (uv.y < 0.35 + n2) { + v = 0.3; + } else if (uv.y < 0.385 + n1) { + v = 0.2; + } else if (uv.y < 0.41 + n0) { + v = 0.1; + } + vec3 color = mix(sky_low, sky_high, uv.y) + sun; + vec3 red = vec3(1.0,0.2,0.0); + vec2 P0 = sunuv + vec2(0.0, 0.3); + float r = (1.0 - length(P0)); + red = red * vec3(r); - gl_FragColor = vec4(finalColor, 1.0); + if (v > 0.0) { + vec3 water_color = water * v; + color = mix(mix(sky_high, sky_low, 0.5), water_color, clamp(1.0-(uv.y*uv.y*uv.y)*fog, 0.0, 1.0)) + red; + } + color += col; -} \ No newline at end of file + gl_FragColor = vec4(color, 1.0); + } \ No newline at end of file