File tree Expand file tree Collapse file tree 1 file changed +15
-6
lines changed
src/main/java/com/ventooth/swansong/shader Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -803,16 +803,14 @@ public static void finishRenderFinal() {
803803
804804 public static @ Nullable Frustrum mcFrustrum ;
805805
806- private static final Frustrum frustrum = new Frustrum ();
807- private static final ClippingHelperShadow ch = new ClippingHelperShadow ();
808-
809- static {
810- frustrum .clippingHelper = ch ;
811- }
806+ private static @ Nullable Frustrum frustrum ;
807+ private static @ Nullable ClippingHelperShadow ch ;
812808
813809 private static int shadowFrustumCheckOffset = 0 ;
814810
815811 private static void clipRenderersByFrustumShadow (WorldRenderer [] wrs ) {
812+ assert frustrum != null : "frustrum not initialized" ;
813+
816814 for (int i = 0 , wrsLength = wrs .length ; i < wrsLength ; i ++) {
817815 var wr = wrs [i ];
818816 val wre = (WorldRendererExt ) wr ;
@@ -838,6 +836,17 @@ private static void renderShadowMap() {
838836 if (state .shadow == null ) {
839837 return ;
840838 }
839+
840+ if (frustrum == null ) {
841+ frustrum = new Frustrum ();
842+ }
843+ if (ch == null ) {
844+ ch = new ClippingHelperShadow ();
845+ }
846+ if (frustrum .clippingHelper == null ) {
847+ frustrum .clippingHelper = ch ;
848+ }
849+
841850 GLDebugGroups .RENDER_SHADOW .push ();
842851
843852 val partialTicks = ShaderState .getSubTick ();
You can’t perform that action at this time.
0 commit comments