Skip to content

Commit

Permalink
1.5.15
Browse files Browse the repository at this point in the history
  • Loading branch information
Ultrinik committed Oct 3, 2024
1 parent c568adb commit b896bc2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 46 deletions.
56 changes: 14 additions & 42 deletions heaven's call/content/shaders.xml
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,6 @@
<param name="Enabled" type="float"/>
<param name="BlackPosition" type="vec3"/>
<param name="Time" type="float"/>
<param name="WarpCheck" type="vec2"/>
</parameters>

<vertex><![CDATA[
Expand All @@ -496,49 +495,29 @@
attribute vec2 TexCoord;
attribute vec4 RenderData;
attribute float Scale;
attribute float Enabled;
attribute vec3 BlackPosition;
attribute float Time;
attribute vec2 WarpCheck;
varying vec4 Color0;
varying vec2 TexCoord0;
varying vec4 RenderDataOut;
varying float ScaleOut;
varying float EnabledOut;
varying vec3 BlackPositionOut;
varying float TimeOut;
varying float YWarping;
uniform mat4 Transform;
void main(void)
{
RenderDataOut = RenderData;
ScaleOut = Scale; // Passing data to fragment shader
EnabledOut = Enabled; // Passing data to fragment shader
BlackPositionOut = BlackPosition; // Passing data to fragment shader
TimeOut = Time; // Passing data to fragment shader
Color0 = Color;
TexCoord0 = TexCoord;
gl_Position = Transform * vec4(Position.xyz, 1.0);
if (Enabled > 0.0) {
EnabledOut = Enabled; // Passing data to fragment shader
TimeOut = Time; // Passing data to fragment shader
vec4 TargetPos;
TargetPos.xy = (BlackPosition.xy / RenderData.zw) * Scale;
TargetPos.zw = (BlackPosition.zy / RenderData.zw) * Scale;
BlackPositionOut = vec3(TargetPos.xy, distance(TargetPos.xy, TargetPos.zw)); // Passing data to fragment shader
vec2 WarpChecker = (WarpCheck.xy / RenderData.zw) * Scale;
float xDistance = distance(vec2(WarpChecker.x, TargetPos.y), TargetPos.xy);
float yDistance = distance(vec2(TargetPos.x, WarpChecker.y), TargetPos.xy);
YWarping = xDistance / yDistance; // Passing data to fragment shader
}
}
]]></vertex>
Expand All @@ -548,33 +527,26 @@
varying vec2 TexCoord0;
varying vec4 RenderDataOut;
varying float ScaleOut;
varying float EnabledOut;
varying vec3 BlackPositionOut;
varying float TimeOut;
varying float YWarping;
uniform sampler2D Texture0;
float warpedDistance(vec2 a, vec2 b) {
vec2 diff = a - b;
float distanceSquared = (diff.x * diff.x) + (diff.y * diff.y * YWarping * YWarping);
return sqrt(distanceSquared);
}
void main(void)
{
float aspect = RenderDataOut.z/RenderDataOut.w;
vec4 Color = Color0 * texture2D(Texture0, TexCoord0);
if (EnabledOut > 0.0){
float dist = warpedDistance(TexCoord0.xy, BlackPositionOut.xy);
if (dist < 0.035 * TimeOut){
Color.r = 0.0;
Color.g = 0.0;
Color.b = 0.0;
}
}
vec2 pos = (BlackPositionOut.xy / RenderDataOut.zw) * ScaleOut ;
vec2 rad = (BlackPositionOut.zy / RenderDataOut.zw) * ScaleOut * 1.02;
float radius = length((rad - pos) * vec2(aspect,1.0)); //Actual radius
float dist = length((TexCoord0 - pos) * vec2(aspect,1.0)); //Distance from pixel to center
if (dist < radius * TimeOut) {
Color.r -= EnabledOut * Color.r;
Color.g -= EnabledOut * Color.g;
Color.b -= EnabledOut * Color.b;
}
gl_FragColor = Color;
}
]]></fragment>
Expand Down
2 changes: 0 additions & 2 deletions heaven's call/main.LUA
Original file line number Diff line number Diff line change
Expand Up @@ -1747,15 +1747,13 @@ function mod:ShadersRender(shaderName)
Enabled = 1,
BlackPosition = {position.X, position.Y, radius.X},
Time = time,
WarpCheck = {position.X + 1, position.Y + 1},
}
return params
else
local params = {
Enabled = 0,
BlackPosition = {0, 0, 0},
Time = 0,
WarpCheck = {0, 0},
}
return params
end
Expand Down
3 changes: 1 addition & 2 deletions heaven's call/scripts/lunaritems.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2261,11 +2261,10 @@ mod:AddCallback(ModCallbacks.MC_POST_EFFECT_UPDATE, function(_, blackhole)
data.Init_HC = true

data.Position_HC = blackhole.Position

mod.ModFlags.blackHolePosition = blackhole.Position
mod.ModFlags.blackHoleTime = 0
mod.ModFlags.blackHole = true

local room = game:GetRoom()
if room:IsMirrorWorld() then
local ogY = mod.ModFlags.blackHolePosition.Y
Expand Down

0 comments on commit b896bc2

Please sign in to comment.