Skip to content

Commit

Permalink
Fix frustum culling
Browse files Browse the repository at this point in the history
  • Loading branch information
gdavid04 committed Feb 19, 2024
1 parent 7b9d522 commit 885ef87
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 8 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,9 @@ A WIP space mod for Fabric 1.20.1 with 6DOF movement.

## 6DOF
- [x] camera
- [ ] fix frustum culling
- [ ] fix debug cursor orientation
- [x] model pose
- [x] look around
- [x] fix first person model acting weird on some rotations
- [ ] fix third person front view rotation controls
- [x] controls for roll
- [ ] camera relative movement (hook Entity.movementInputToVelocity)
Expand Down
6 changes: 0 additions & 6 deletions src/main/java/gdavid/sixdoftest/ClientMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderEvents;
import net.minecraft.client.option.KeyBinding;
import net.minecraft.entity.Entity;
import org.lwjgl.glfw.GLFW;

public class ClientMod implements ClientModInitializer {
Expand All @@ -16,10 +14,6 @@ public class ClientMod implements ClientModInitializer {
public void onInitializeClient() {
KeyBindingHelper.registerKeyBinding(keyRollLeft);
KeyBindingHelper.registerKeyBinding(keyRollRight);
WorldRenderEvents.START.register((ctx) -> {
Entity focus = ctx.camera().getFocusedEntity();
IRoll.rollTransform(ctx.matrixStack(), focus, true);
});
}

}
24 changes: 24 additions & 0 deletions src/main/java/gdavid/sixdoftest/mixin/GameRendererMixin.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package gdavid.sixdoftest.mixin;

import gdavid.sixdoftest.IRoll;
import net.minecraft.client.render.Camera;
import net.minecraft.client.render.GameRenderer;
import net.minecraft.client.util.math.MatrixStack;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(GameRenderer.class)
public class GameRendererMixin {

@Shadow @Final private Camera camera;

@Inject(method = "renderWorld", at = @At("HEAD"))
private void rollRender(float tickDelta, long limitTime, MatrixStack matrices, CallbackInfo callback) {
IRoll.rollTransform(matrices, camera.getFocusedEntity(), true);
}

}
1 change: 1 addition & 0 deletions src/main/resources/sixdoftest.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
],
"client": [
"ClientPlayerMixin",
"GameRendererMixin",
"PlayerEntityRendererMixin"
],
"injectors": {
Expand Down

0 comments on commit 885ef87

Please sign in to comment.