feat: some lines
This commit is contained in:
parent
530872728f
commit
143d968587
|
@ -1,16 +1,13 @@
|
|||
package me.theclashfruit.arctic.mixin;
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import net.minecraft.client.gl.Framebuffer;
|
||||
import net.minecraft.client.gl.VertexBuffer;
|
||||
import net.minecraft.client.render.*;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.joml.Matrix4f;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
@ -48,40 +45,27 @@ public class WorldRendererMixin {
|
|||
|
||||
@Unique
|
||||
private BufferBuilder.BuiltBuffer renderAurora(BufferBuilder buffer) {
|
||||
buffer.begin(VertexFormat.DrawMode.DEBUG_LINES, VertexFormats.POSITION_COLOR);
|
||||
buffer.begin(VertexFormat.DrawMode.DEBUG_LINES, VertexFormats.POSITION);
|
||||
|
||||
// TODO: Make an actual thing
|
||||
float amplitude = 0.5f;
|
||||
float frequency = 1.5f;
|
||||
buffer.vertex(0, 70, 0).next();
|
||||
buffer.vertex(10, 70, 0).next();
|
||||
|
||||
for (int i = 0; i <= 100; i++) {
|
||||
float x = i * 0.1f;
|
||||
float y = amplitude * (float) Math.sin(frequency * x);
|
||||
float z = 5f;
|
||||
buffer.vertex(-10, 70, 0).next();
|
||||
buffer.vertex(0, 70, 10).next();
|
||||
|
||||
buffer.vertex(x, y, z).color(0, 255, 0, 255).next();
|
||||
|
||||
x += 0.1f;
|
||||
|
||||
y = amplitude * (float) Math.sin(frequency * x);
|
||||
|
||||
buffer.vertex(x, y, z).color(0, 255, 0, 255).next();
|
||||
}
|
||||
buffer.vertex(0, 70, -10).next();
|
||||
buffer.vertex(5, 70, 5).next();
|
||||
|
||||
return buffer.end();
|
||||
}
|
||||
|
||||
@Inject(method = "renderSky(Lnet/minecraft/client/util/math/MatrixStack;Lorg/joml/Matrix4f;FLnet/minecraft/client/render/Camera;ZLjava/lang/Runnable;)V", at = @At("TAIL"))
|
||||
public void renderSky(MatrixStack matrices, Matrix4f projectionMatrix, float tickDelta, Camera camera, boolean thickFog, Runnable fogCallback, CallbackInfo ci) {
|
||||
float u = ((WorldRendererAccessor) this).getWorld().method_23787(tickDelta) * (1.0f - ((WorldRendererAccessor) this).getWorld().getRainGradient(tickDelta));
|
||||
|
||||
if (u > 0.0f) {
|
||||
RenderSystem.setShaderColor(u, u, u, u);
|
||||
BackgroundRenderer.clearFog();
|
||||
auroraBuffer.bind();
|
||||
auroraBuffer.draw(matrices.peek().getPositionMatrix(), projectionMatrix, GameRenderer.getPositionProgram());
|
||||
VertexBuffer.unbind();
|
||||
fogCallback.run();
|
||||
}
|
||||
RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
BackgroundRenderer.clearFog();
|
||||
auroraBuffer.bind();
|
||||
auroraBuffer.draw(matrices.peek().getPositionMatrix(), projectionMatrix, GameRenderer.getPositionProgram());
|
||||
VertexBuffer.unbind();
|
||||
fogCallback.run();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue