Skip to content

Commit

Permalink
some more random stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
IMS212 committed Oct 3, 2023
1 parent f2642e8 commit e519b39
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ public void renderShadows(LevelRendererAccessor levelRenderer, Camera playerCame
visibleBlockEntities = new ArrayList<>();

// Create our camera
PoseStack modelView = createShadowModelView(this.sunPathRotation, this.intervalSize);
PoseStack modelView = ((NewWorldRenderingPipeline) Iris.getPipelineManager().getPipelineNullable()).shadowModelView;
MODELVIEW = new Matrix4f(modelView.last().pose());

levelRenderer.getLevel().getProfiler().push("terrain_setup");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -957,11 +957,11 @@ Matrix4f GetShadowProjection(Matrix4f shadowModelViewEx) {
GetFrustumMinMax(matSceneToShadow, shadowMin, shadowMax);

Vector3f shadowSize = shadowMax.sub(shadowMin);
Vector2f center = new Vector2f(shadowSize.x * 0.5f, shadowSize.y * 0.5f);
Vector3f center = new Vector3f((shadowMin.x + shadowMax.x) * 0.5f, (shadowMin.y + shadowMax.y) * 0.5f, (shadowMin.z + shadowMax.z) * 0.5f);
center.negate();
float shadowFar = Math.max(Math.abs(shadowMin.z), Math.abs(shadowMax.z));
Matrix4f shadowProjection = new Matrix4f().setOrthoSymmetric(shadowSize.x, shadowSize.y, -200.0f, shadowFar);
Matrix4f shadowOffset = new Matrix4f().setTranslation(new Vector3f(center, 0));
Matrix4f shadowOffset = new Matrix4f().setTranslation(center);

return shadowProjection.mul(shadowOffset);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public static void addMatrixUniforms(UniformHolder uniforms, PackDirectives dire
// We need to audit Mojang's linear algebra.
addMatrix(uniforms, "Projection", CapturedRenderingState.INSTANCE::getGbufferProjection);
addShadowMatrix(uniforms, "ModelView", () ->
new Matrix4f(ShadowRenderer.createShadowModelView(directives.getSunPathRotation(), directives.getShadowDirectives().getIntervalSize()).last().pose()));
((NewWorldRenderingPipeline) Iris.getPipelineManager().getPipelineNullable()).shadowModelView.last().pose());
addShadowMatrix(uniforms, "Projection", () -> ((NewWorldRenderingPipeline) Iris.getPipelineManager().getPipelineNullable()).shadowProjection);
}

Expand Down

0 comments on commit e519b39

Please sign in to comment.