-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
changed uniforms, fixed no geometry jobs
- Loading branch information
Showing
4 changed files
with
81 additions
and
37 deletions.
There are no files selected for viewing
65 changes: 65 additions & 0 deletions
65
src/main/java/me/cortex/vulkanite/client/rendering/Uniforms.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package me.cortex.vulkanite.client.rendering; | ||
|
||
import net.coderbot.iris.uniforms.CapturedRenderingState; | ||
import net.minecraft.client.MinecraftClient; | ||
import net.minecraft.client.render.CameraSubmersionType; | ||
import net.minecraft.client.world.ClientWorld; | ||
import net.minecraft.util.math.Direction; | ||
import net.minecraft.util.math.RotationAxis; | ||
import org.joml.Matrix4f; | ||
import org.joml.Vector4f; | ||
|
||
import java.util.Objects; | ||
|
||
public class Uniforms { | ||
|
||
|
||
//Copied from CommonUniforms | ||
static int isEyeInWater() { | ||
CameraSubmersionType var0 = MinecraftClient.getInstance().gameRenderer.getCamera().getSubmersionType(); | ||
if (var0 == CameraSubmersionType.WATER) { | ||
return 1; | ||
} else if (var0 == CameraSubmersionType.LAVA) { | ||
return 2; | ||
} else { | ||
return var0 == CameraSubmersionType.POWDER_SNOW ? 3 : 0; | ||
} | ||
} | ||
|
||
//Copied from CelestialUniforms | ||
|
||
static Vector4f getSunPosition() { | ||
return getCelestialPosition(100.0F); | ||
} | ||
|
||
static Vector4f getMoonPosition() { | ||
return getCelestialPosition(-100.0F); | ||
} | ||
|
||
|
||
static Vector4f getCelestialPosition(float y) { | ||
final float sunPathRotation = 0.0f; | ||
|
||
Vector4f position = new Vector4f(0.0F, y, 0.0F, 0.0F); | ||
|
||
Matrix4f celestial = new Matrix4f(CapturedRenderingState.INSTANCE.getGbufferModelView()); | ||
|
||
// This is the same transformation applied by renderSky, however, it's been moved to here. | ||
// This is because we need the result of it before it's actually performed in vanilla. | ||
celestial.rotate(RotationAxis.POSITIVE_Y.rotationDegrees(-90.0F)); | ||
celestial.rotate(RotationAxis.POSITIVE_Z.rotationDegrees(sunPathRotation)); | ||
celestial.rotate(RotationAxis.POSITIVE_X.rotationDegrees(getSkyAngle() * 360.0F)); | ||
|
||
position = celestial.transform(position); | ||
|
||
return position; | ||
} | ||
|
||
private static ClientWorld getWorld() { | ||
return MinecraftClient.getInstance().world; | ||
} | ||
|
||
private static float getSkyAngle() { | ||
return getWorld().getSkyAngleRadians(CapturedRenderingState.INSTANCE.getTickDelta()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters