-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
93cc755
commit 58c6bfb
Showing
14 changed files
with
157 additions
and
55 deletions.
There are no files selected for viewing
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
24 changes: 24 additions & 0 deletions
24
...org/valkyrienskies/mod/mixin/feature/debug_sparse_voxel_rendering/MixinDebugRenderer.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,24 @@ | ||
package org.valkyrienskies.mod.mixin.feature.debug_sparse_voxel_rendering; | ||
|
||
import com.mojang.blaze3d.vertex.PoseStack; | ||
import net.minecraft.client.renderer.MultiBufferSource; | ||
import net.minecraft.client.renderer.debug.DebugRenderer; | ||
import org.spongepowered.asm.mixin.Final; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Unique; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
import org.valkyrienskies.mod.client.SparseVoxelRenderer; | ||
|
||
@Mixin(DebugRenderer.class) | ||
public class MixinDebugRenderer { | ||
@Unique | ||
@Final | ||
SparseVoxelRenderer sparseVoxelRenderer = new SparseVoxelRenderer(); | ||
|
||
@Inject(method = "render", at = @At("HEAD")) | ||
void render(PoseStack poseStack, MultiBufferSource.BufferSource bufferSource, double d, double e, double f, final CallbackInfo ci) { | ||
//sparseVoxelRenderer.render(poseStack, bufferSource, d, e, f); | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
...ain/java/org/valkyrienskies/mod/mixin/feature/sealed_air_sync/MixinBlockUpdatePacket.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,4 @@ | ||
package org.valkyrienskies.mod.mixin.feature.sealed_air_sync; | ||
|
||
public class MixinBlockUpdatePacket { | ||
} |
11 changes: 11 additions & 0 deletions
11
.../org/valkyrienskies/mod/mixin/feature/sealed_air_sync/MixinSectionBlocksUpdatePacket.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,11 @@ | ||
package org.valkyrienskies.mod.mixin.feature.sealed_air_sync; | ||
|
||
import net.minecraft.network.protocol.game.ClientboundSectionBlocksUpdatePacket; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Unique; | ||
|
||
@Mixin(ClientboundSectionBlocksUpdatePacket.class) | ||
public class MixinSectionBlocksUpdatePacket { | ||
@Unique | ||
private boolean[] sealed; | ||
} |
9 changes: 9 additions & 0 deletions
9
common/src/main/java/org/valkyrienskies/mod/mixinducks/world/WithSealedPositions.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,9 @@ | ||
package org.valkyrienskies.mod.mixinducks.world; | ||
|
||
import net.minecraft.core.BlockPos; | ||
|
||
public interface WithSealedPositions { | ||
public void setSealed(BlockPos pos, boolean sealed); | ||
|
||
public boolean[] getSealed(); | ||
} |
41 changes: 41 additions & 0 deletions
41
common/src/main/kotlin/org/valkyrienskies/mod/client/SparseVoxelRenderer.kt
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,41 @@ | ||
package org.valkyrienskies.mod.client | ||
|
||
import com.mojang.blaze3d.vertex.PoseStack | ||
import com.mojang.blaze3d.vertex.Tesselator | ||
import net.minecraft.client.Minecraft | ||
import net.minecraft.client.renderer.MultiBufferSource.BufferSource | ||
import net.minecraft.client.renderer.RenderType | ||
import net.minecraft.client.renderer.debug.DebugRenderer | ||
import net.minecraft.world.phys.AABB | ||
import org.valkyrienskies.core.util.datastructures.SparseVoxelPosition | ||
|
||
class SparseVoxelRenderer() { | ||
val voxels = HashSet<SparseVoxelPosition>() | ||
|
||
init { | ||
voxels.add(SparseVoxelPosition(0, 128, 0, 2)) | ||
} | ||
|
||
fun render(ms: PoseStack, buffer: BufferSource, camX: Double, camY: Double, camZ: Double) { | ||
for (voxel in voxels) { | ||
drawVoxel(voxel, ms, buffer, camX, camY, camZ) | ||
} | ||
} | ||
|
||
fun drawVoxel(voxel: SparseVoxelPosition, poseStack: PoseStack, buffer: BufferSource, camX: Double, camY: Double, camZ: Double) { | ||
poseStack.pushPose() | ||
|
||
// Draw the voxel | ||
val random = Minecraft.getInstance().level?.random ?: return | ||
DebugRenderer.renderFilledBox(voxel.toAABB(-camX, -camY, -camZ), 1.0f, 1.0f, 0.5f, 0.5f) | ||
//Tesselator.getInstance().end() | ||
|
||
poseStack.popPose() | ||
} | ||
|
||
private fun SparseVoxelPosition.toAABB(offsetX: Double = 0.0, offsetY: Double = 0.0, offsetZ: Double = 0.0): AABB { | ||
return AABB(x.toDouble() + offsetX, y.toDouble() + offsetY, z.toDouble() + offsetZ, | ||
x.toDouble() + extent.toDouble() + offsetX, y.toDouble() + extent.toDouble() + offsetY, z.toDouble() + extent.toDouble() + offsetZ) | ||
|
||
} | ||
} |
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
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
Oops, something went wrong.